diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index dea9c5d3e..16e273a39 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -6,8 +6,6 @@ on: - main - master pull_request: - schedule: - - cron: "0 0 * * 0" defaults: run: shell: bash @@ -40,23 +38,23 @@ jobs: - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: - name: "analyze_and_format; linux; Dart 3.7.0; PKGS: _benchmark, build; `dart analyze --fatal-infos .`" + name: "analyze_and_format; linux; PKGS: _benchmark, _test, build, build_config, build_daemon, build_modules, build_runner, build_test, build_web_compilers, example, scratch_space; `dart analyze --fatal-infos .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:_benchmark-build;commands:analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_benchmark-_test-build-build_config-build_daemon-build_modules-build_runner-build_test-build_web_compilers-example-scratch_space;commands:analyze" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:_benchmark-build - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_benchmark-_test-build-build_config-build_daemon-build_modules-build_runner-build_test-build_web_compilers-example-scratch_space + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: "3.7.0" + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -69,6 +67,15 @@ jobs: run: dart analyze --fatal-infos . if: "always() && steps._benchmark_pub_upgrade.conclusion == 'success'" working-directory: _benchmark + - id: _test_pub_upgrade + name: _test; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: _test + - name: "_test; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . + if: "always() && steps._test_pub_upgrade.conclusion == 'success'" + working-directory: _test - id: build_pub_upgrade name: build; dart pub upgrade run: dart pub upgrade @@ -78,36 +85,38 @@ jobs: run: dart analyze --fatal-infos . if: "always() && steps.build_pub_upgrade.conclusion == 'success'" working-directory: build - job_003: - name: "analyze_and_format; linux; Dart 3.7.0; PKGS: build_runner, build_test, example, scratch_space; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner-build_test-example-scratch_space;commands:format-analyze" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner-build_test-example-scratch_space - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + - id: build_config_pub_upgrade + name: build_config; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: build_config + - name: "build_config; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . + if: "always() && steps.build_config_pub_upgrade.conclusion == 'success'" + working-directory: build_config + - id: build_daemon_pub_upgrade + name: build_daemon; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: build_daemon + - name: "build_daemon; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . + if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" + working-directory: build_daemon + - id: build_modules_pub_upgrade + name: build_modules; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: build_modules + - name: "build_modules; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . + if: "always() && steps.build_modules_pub_upgrade.conclusion == 'success'" + working-directory: build_modules - id: build_runner_pub_upgrade name: build_runner; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: build_runner - - name: "build_runner; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner - name: "build_runner; dart analyze --fatal-infos ." run: dart analyze --fatal-infos . if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" @@ -117,23 +126,24 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: build_test - - name: "build_test; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" - working-directory: build_test - name: "build_test; dart analyze --fatal-infos ." run: dart analyze --fatal-infos . if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" working-directory: build_test + - id: build_web_compilers_pub_upgrade + name: build_web_compilers; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: build_web_compilers + - name: "build_web_compilers; dart analyze --fatal-infos ." + run: dart analyze --fatal-infos . + if: "always() && steps.build_web_compilers_pub_upgrade.conclusion == 'success'" + working-directory: build_web_compilers - id: example_pub_upgrade name: example; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: example - - name: "example; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.example_pub_upgrade.conclusion == 'success'" - working-directory: example - name: "example; dart analyze --fatal-infos ." run: dart analyze --fatal-infos . if: "always() && steps.example_pub_upgrade.conclusion == 'success'" @@ -143,25 +153,21 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: scratch_space - - name: "scratch_space; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" - working-directory: scratch_space - name: "scratch_space; dart analyze --fatal-infos ." run: dart analyze --fatal-infos . if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" working-directory: scratch_space - job_004: - name: "analyze_and_format; linux; Dart dev; PKG: build; `dart analyze --fatal-infos .`" + job_003: + name: "analyze_and_format; linux; PKGS: _benchmark, _test, build, build_config, build_daemon, build_modules, build_runner, build_test, build_web_compilers, example, scratch_space; `dart format --output=none --set-exit-if-changed .`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build;commands:analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_benchmark-_test-build-build_config-build_daemon-build_modules-build_runner-build_test-build_web_compilers-example-scratch_space;commands:format" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_benchmark-_test-build-build_config-build_daemon-build_modules-build_runner-build_test-build_web_compilers-example-scratch_space os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -172,36 +178,24 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_pub_upgrade - name: build; dart pub upgrade + - id: _benchmark_pub_upgrade + name: _benchmark; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build - - name: "build; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.build_pub_upgrade.conclusion == 'success'" - working-directory: build - job_005: - name: "analyze_and_format; linux; Dart dev; PKG: build; `dart format --output=none --set-exit-if-changed .`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build;commands:format" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + working-directory: _benchmark + - name: "_benchmark; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps._benchmark_pub_upgrade.conclusion == 'success'" + working-directory: _benchmark + - id: _test_pub_upgrade + name: _test; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: _test + - name: "_test; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps._test_pub_upgrade.conclusion == 'success'" + working-directory: _test - id: build_pub_upgrade name: build; dart pub upgrade run: dart pub upgrade @@ -211,27 +205,6 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.build_pub_upgrade.conclusion == 'success'" working-directory: build - job_006: - name: "analyze_and_format; linux; Dart dev; PKGS: build_config, build_daemon, build_runner, build_test, example, scratch_space; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_config-build_daemon-build_runner-build_test-example-scratch_space;commands:format-analyze" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_config-build_daemon-build_runner-build_test-example-scratch_space - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - id: build_config_pub_upgrade name: build_config; dart pub upgrade run: dart pub upgrade @@ -241,10 +214,6 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.build_config_pub_upgrade.conclusion == 'success'" working-directory: build_config - - name: "build_config; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.build_config_pub_upgrade.conclusion == 'success'" - working-directory: build_config - id: build_daemon_pub_upgrade name: build_daemon; dart pub upgrade run: dart pub upgrade @@ -254,10 +223,15 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" working-directory: build_daemon - - name: "build_daemon; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" - working-directory: build_daemon + - id: build_modules_pub_upgrade + name: build_modules; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: build_modules + - name: "build_modules; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.build_modules_pub_upgrade.conclusion == 'success'" + working-directory: build_modules - id: build_runner_pub_upgrade name: build_runner; dart pub upgrade run: dart pub upgrade @@ -267,10 +241,6 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" working-directory: build_runner - - name: "build_runner; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner - id: build_test_pub_upgrade name: build_test; dart pub upgrade run: dart pub upgrade @@ -280,10 +250,15 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" working-directory: build_test - - name: "build_test; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" - working-directory: build_test + - id: build_web_compilers_pub_upgrade + name: build_web_compilers; dart pub upgrade + run: dart pub upgrade + if: "always() && steps.checkout.conclusion == 'success'" + working-directory: build_web_compilers + - name: "build_web_compilers; dart format --output=none --set-exit-if-changed ." + run: "dart format --output=none --set-exit-if-changed ." + if: "always() && steps.build_web_compilers_pub_upgrade.conclusion == 'success'" + working-directory: build_web_compilers - id: example_pub_upgrade name: example; dart pub upgrade run: dart pub upgrade @@ -293,10 +268,6 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.example_pub_upgrade.conclusion == 'success'" working-directory: example - - name: "example; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.example_pub_upgrade.conclusion == 'success'" - working-directory: example - id: scratch_space_pub_upgrade name: scratch_space; dart pub upgrade run: dart pub upgrade @@ -306,28 +277,24 @@ jobs: run: "dart format --output=none --set-exit-if-changed ." if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" working-directory: scratch_space - - name: "scratch_space; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" - working-directory: scratch_space - job_007: - name: "analyze_and_format; linux; Dart main; PKG: _test; `dart analyze --fatal-infos .`" + job_004: + name: "unit_test; linux; PKG: _test; `dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test;commands:analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test;commands:command_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test - os:ubuntu-latest;pub-cache-hosted;sdk:main + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -336,75 +303,66 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: _test - - name: "_test; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . + - name: "_test; dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random" + run: "dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random" if: "always() && steps._test_pub_upgrade.conclusion == 'success'" working-directory: _test - job_008: - name: "analyze_and_format; linux; Dart main; PKGS: build_modules, build_web_compilers; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" + needs: + - job_001 + - job_002 + - job_003 + job_005: + name: "unit_test; linux; PKG: _test; `dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:build_modules-build_web_compilers;commands:format-analyze" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test;commands:command_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:build_modules-build_web_compilers - os:ubuntu-latest;pub-cache-hosted;sdk:main + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_modules_pub_upgrade - name: build_modules; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_modules - - name: "build_modules; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.build_modules_pub_upgrade.conclusion == 'success'" - working-directory: build_modules - - name: "build_modules; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.build_modules_pub_upgrade.conclusion == 'success'" - working-directory: build_modules - - id: build_web_compilers_pub_upgrade - name: build_web_compilers; dart pub upgrade + - id: _test_pub_upgrade + name: _test; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_web_compilers - - name: "build_web_compilers; dart format --output=none --set-exit-if-changed ." - run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.build_web_compilers_pub_upgrade.conclusion == 'success'" - working-directory: build_web_compilers - - name: "build_web_compilers; dart analyze --fatal-infos ." - run: dart analyze --fatal-infos . - if: "always() && steps.build_web_compilers_pub_upgrade.conclusion == 'success'" - working-directory: build_web_compilers - job_009: - name: "unit_test; linux; Dart 3.7.0; PKG: build; `dart test --test-randomize-ordering-seed=random`" + working-directory: _test + - name: "_test; dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random" + run: "dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random" + if: "always() && steps._test_pub_upgrade.conclusion == 'success'" + working-directory: _test + needs: + - job_001 + - job_002 + - job_003 + job_006: + name: "unit_test; linux; PKG: build; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build;commands:test_04" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build;commands:test_03" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: "3.7.0" + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -421,178 +379,85 @@ jobs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_010: - name: "unit_test; linux; Dart 3.7.0; PKG: build_daemon; `dart test --test-randomize-ordering-seed=random`" + job_007: + name: "unit_test; linux; PKG: build_config; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_daemon;commands:test_04" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_config;commands:test_03" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_daemon - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_config + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: "3.7.0" + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_daemon_pub_upgrade - name: build_daemon; dart pub upgrade + - id: build_config_pub_upgrade + name: build_config; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_daemon - - name: "build_daemon; dart test --test-randomize-ordering-seed=random" + working-directory: build_config + - name: "build_config; dart test --test-randomize-ordering-seed=random" run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" - working-directory: build_daemon - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_011: - name: "unit_test; linux; Dart 3.7.0; PKG: build_test; `dart test --test-randomize-ordering-seed=random`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_test;commands:test_04" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_test - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_test_pub_upgrade - name: build_test; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_test - - name: "build_test; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" - working-directory: build_test + if: "always() && steps.build_config_pub_upgrade.conclusion == 'success'" + working-directory: build_config needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_012: - name: "unit_test; linux; Dart 3.7.0; PKG: scratch_space; `dart test --test-randomize-ordering-seed=random`" + job_008: + name: "unit_test; linux; PKG: build_daemon; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:scratch_space;commands:test_04" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_daemon;commands:test_03" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:scratch_space - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_daemon + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: "3.7.0" + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: scratch_space_pub_upgrade - name: scratch_space; dart pub upgrade + - id: build_daemon_pub_upgrade + name: build_daemon; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: scratch_space - - name: "scratch_space; dart test --test-randomize-ordering-seed=random" + working-directory: build_daemon + - name: "build_daemon; dart test --test-randomize-ordering-seed=random" run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" - working-directory: scratch_space - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_013: - name: "unit_test; linux; Dart 3.7.0; PKG: build_runner; `dart test -x integration --test-randomize-ordering-seed=random`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner;commands:test_06" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_runner_pub_upgrade - name: build_runner; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_runner - - name: "build_runner; dart test -x integration --test-randomize-ordering-seed=random" - run: "dart test -x integration --test-randomize-ordering-seed=random" - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner + if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" + working-directory: build_daemon needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_014: - name: "unit_test; linux; Dart dev; PKG: build; `dart test --test-randomize-ordering-seed=random`" + job_009: + name: "unit_test; linux; PKG: build_test; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build;commands:test_04" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_test;commands:test_03" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_test os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -603,35 +468,30 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_pub_upgrade - name: build; dart pub upgrade + - id: build_test_pub_upgrade + name: build_test; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build - - name: "build; dart test --test-randomize-ordering-seed=random" + working-directory: build_test + - name: "build_test; dart test --test-randomize-ordering-seed=random" run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_pub_upgrade.conclusion == 'success'" - working-directory: build + if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" + working-directory: build_test needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_015: - name: "unit_test; linux; Dart dev; PKG: build_config; `dart test --test-randomize-ordering-seed=random`" + job_010: + name: "unit_test; linux; PKG: build_web_compilers; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_config;commands:test_04" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_web_compilers;commands:test_03" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_config + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_web_compilers os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -642,35 +502,30 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_config_pub_upgrade - name: build_config; dart pub upgrade + - id: build_web_compilers_pub_upgrade + name: build_web_compilers; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_config - - name: "build_config; dart test --test-randomize-ordering-seed=random" + working-directory: build_web_compilers + - name: "build_web_compilers; dart test --test-randomize-ordering-seed=random" run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_config_pub_upgrade.conclusion == 'success'" - working-directory: build_config + if: "always() && steps.build_web_compilers_pub_upgrade.conclusion == 'success'" + working-directory: build_web_compilers needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_016: - name: "unit_test; linux; Dart dev; PKG: build_daemon; `dart test --test-randomize-ordering-seed=random`" + job_011: + name: "unit_test; linux; PKG: scratch_space; `dart test --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_daemon;commands:test_04" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:scratch_space;commands:test_03" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_daemon + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:scratch_space os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -681,35 +536,30 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_daemon_pub_upgrade - name: build_daemon; dart pub upgrade + - id: scratch_space_pub_upgrade + name: scratch_space; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_daemon - - name: "build_daemon; dart test --test-randomize-ordering-seed=random" + working-directory: scratch_space + - name: "scratch_space; dart test --test-randomize-ordering-seed=random" run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" - working-directory: build_daemon + if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" + working-directory: scratch_space needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_017: - name: "unit_test; linux; Dart dev; PKG: build_test; `dart test --test-randomize-ordering-seed=random`" + job_012: + name: "unit_test; linux; PKG: build_modules; `dart test -P presubmit --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_test;commands:test_04" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_modules;commands:test_04" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_test + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_modules os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -720,35 +570,30 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_test_pub_upgrade - name: build_test; dart pub upgrade + - id: build_modules_pub_upgrade + name: build_modules; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_test - - name: "build_test; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" - working-directory: build_test + working-directory: build_modules + - name: "build_modules; dart test -P presubmit --test-randomize-ordering-seed=random" + run: "dart test -P presubmit --test-randomize-ordering-seed=random" + if: "always() && steps.build_modules_pub_upgrade.conclusion == 'success'" + working-directory: build_modules needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_018: - name: "unit_test; linux; Dart dev; PKG: scratch_space; `dart test --test-randomize-ordering-seed=random`" + job_013: + name: "unit_test; linux; PKG: build_runner; `dart test -P experiments --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:scratch_space;commands:test_04" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_06" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:scratch_space + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -759,26 +604,21 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: scratch_space_pub_upgrade - name: scratch_space; dart pub upgrade + - id: build_runner_pub_upgrade + name: build_runner; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: scratch_space - - name: "scratch_space; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" - working-directory: scratch_space + working-directory: build_runner + - name: "build_runner; dart test -P experiments --test-randomize-ordering-seed=random" + run: "dart test -P experiments --test-randomize-ordering-seed=random" + if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" + working-directory: build_runner needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_019: - name: "unit_test; linux; Dart dev; PKG: build_runner; `dart test -P experiments --test-randomize-ordering-seed=random`" + job_014: + name: "unit_test; linux; PKG: build_runner; `dart test -t integration --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies @@ -803,28 +643,23 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: build_runner - - name: "build_runner; dart test -P experiments --test-randomize-ordering-seed=random" - run: "dart test -P experiments --test-randomize-ordering-seed=random" + - name: "build_runner; dart test -t integration --test-randomize-ordering-seed=random" + run: "dart test -t integration --test-randomize-ordering-seed=random" if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" working-directory: build_runner needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_020: - name: "unit_test; linux; Dart dev; PKG: build_runner; `dart test -x integration --test-randomize-ordering-seed=random`" + job_015: + name: "unit_test; linux; PKG: build_runner; `dart test -x integration -x slow --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_06" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_05" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -842,37 +677,22 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: build_runner - - name: "build_runner; dart test -x integration --test-randomize-ordering-seed=random" - run: "dart test -x integration --test-randomize-ordering-seed=random" + - name: "build_runner; dart test -x integration -x slow --test-randomize-ordering-seed=random" + run: "dart test -x integration -x slow --test-randomize-ordering-seed=random" if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" working-directory: build_runner needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_021: - name: "unit_test; linux; Dart main; PKG: _test; `dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random`" - runs-on: ubuntu-latest + job_016: + name: "unit_test; windows; PKG: _test; `dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random`" + runs-on: windows-latest steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test;commands:command_0" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test - os:ubuntu-latest;pub-cache-hosted;sdk:main - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -889,765 +709,38 @@ jobs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_022: - name: "unit_test; linux; Dart main; PKG: _test; `dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test;commands:command_1" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test - os:ubuntu-latest;pub-cache-hosted;sdk:main - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: main - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: _test_pub_upgrade - name: _test; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: _test - - name: "_test; dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random" - run: "dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random" - if: "always() && steps._test_pub_upgrade.conclusion == 'success'" - working-directory: _test - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_023: - name: "unit_test; linux; Dart main; PKG: build_modules; `dart test -P presubmit --test-randomize-ordering-seed=random`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:build_modules;commands:test_05" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:build_modules - os:ubuntu-latest;pub-cache-hosted;sdk:main - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: main - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_modules_pub_upgrade - name: build_modules; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_modules - - name: "build_modules; dart test -P presubmit --test-randomize-ordering-seed=random" - run: "dart test -P presubmit --test-randomize-ordering-seed=random" - if: "always() && steps.build_modules_pub_upgrade.conclusion == 'success'" - working-directory: build_modules - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_024: - name: "unit_test; linux; Dart main; PKG: build_web_compilers; `dart test --test-randomize-ordering-seed=random`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:build_web_compilers;commands:test_04" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:build_web_compilers - os:ubuntu-latest;pub-cache-hosted;sdk:main - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: main - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_web_compilers_pub_upgrade - name: build_web_compilers; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_web_compilers - - name: "build_web_compilers; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_web_compilers_pub_upgrade.conclusion == 'success'" - working-directory: build_web_compilers - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_025: - name: "unit_test; windows; Dart 3.7.0; PKG: build; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_pub_upgrade - name: build; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build - - name: "build; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_pub_upgrade.conclusion == 'success'" - working-directory: build - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_026: - name: "unit_test; windows; Dart 3.7.0; PKG: build_daemon; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_daemon_pub_upgrade - name: build_daemon; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_daemon - - name: "build_daemon; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" - working-directory: build_daemon - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_027: - name: "unit_test; windows; Dart 3.7.0; PKG: build_test; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_test_pub_upgrade - name: build_test; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_test - - name: "build_test; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" - working-directory: build_test - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_028: - name: "unit_test; windows; Dart 3.7.0; PKG: scratch_space; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: scratch_space_pub_upgrade - name: scratch_space; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: scratch_space - - name: "scratch_space; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" - working-directory: scratch_space - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_029: - name: "unit_test; windows; Dart dev; PKG: build; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_pub_upgrade - name: build; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build - - name: "build; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_pub_upgrade.conclusion == 'success'" - working-directory: build - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_030: - name: "unit_test; windows; Dart dev; PKG: build_config; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_config_pub_upgrade - name: build_config; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_config - - name: "build_config; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_config_pub_upgrade.conclusion == 'success'" - working-directory: build_config - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_031: - name: "unit_test; windows; Dart dev; PKG: build_daemon; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_daemon_pub_upgrade - name: build_daemon; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_daemon - - name: "build_daemon; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" - working-directory: build_daemon - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_032: - name: "unit_test; windows; Dart dev; PKG: build_test; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_test_pub_upgrade - name: build_test; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_test - - name: "build_test; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_test_pub_upgrade.conclusion == 'success'" - working-directory: build_test - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_033: - name: "unit_test; windows; Dart dev; PKG: scratch_space; `dart test --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: scratch_space_pub_upgrade - name: scratch_space; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: scratch_space - - name: "scratch_space; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.scratch_space_pub_upgrade.conclusion == 'success'" - working-directory: scratch_space - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_034: - name: "unit_test; windows; Dart main; PKG: _test; `dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: main - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: _test_pub_upgrade - name: _test; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: _test - - name: "_test; dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random" - run: "dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random" - if: "always() && steps._test_pub_upgrade.conclusion == 'success'" - working-directory: _test - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_035: - name: "unit_test; windows; Dart main; PKG: build_modules; `dart test -P presubmit --test-randomize-ordering-seed=random`" - runs-on: windows-latest - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: main - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_modules_pub_upgrade - name: build_modules; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_modules - - name: "build_modules; dart test -P presubmit --test-randomize-ordering-seed=random" - run: "dart test -P presubmit --test-randomize-ordering-seed=random" - if: "always() && steps.build_modules_pub_upgrade.conclusion == 'success'" - working-directory: build_modules - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_036: - name: "unit_test; windows; Dart main; PKG: build_web_compilers; `dart test --test-randomize-ordering-seed=random`" + job_017: + name: "unit_test; windows; PKG: build_daemon; `dart test --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_web_compilers_pub_upgrade - name: build_web_compilers; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_web_compilers - - name: "build_web_compilers; dart test --test-randomize-ordering-seed=random" - run: "dart test --test-randomize-ordering-seed=random" - if: "always() && steps.build_web_compilers_pub_upgrade.conclusion == 'success'" - working-directory: build_web_compilers - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - job_037: - name: "leak_check; linux; Dart dev; PKG: build_runner; `../tool/leak_check.sh`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:command_2" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner - os:ubuntu-latest;pub-cache-hosted;sdk:dev - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: dev - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_runner_pub_upgrade - name: build_runner; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_runner - - name: build_runner; ../tool/leak_check.sh - run: ../tool/leak_check.sh - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - - job_009 - - job_010 - - job_011 - - job_012 - - job_013 - - job_014 - - job_015 - - job_016 - - job_017 - - job_018 - - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - job_038: - name: "e2e_test; linux; Dart 3.7.0; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner;commands:test_08" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_runner_pub_upgrade - name: build_runner; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - - job_009 - - job_010 - - job_011 - - job_012 - - job_013 - - job_014 - - job_015 - - job_016 - - job_017 - - job_018 - - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_039: - name: "e2e_test; linux; Dart 3.7.0; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner;commands:test_09" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_runner_pub_upgrade - name: build_runner; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - - job_009 - - job_010 - - job_011 - - job_012 - - job_013 - - job_014 - - job_015 - - job_016 - - job_017 - - job_018 - - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_040: - name: "e2e_test; linux; Dart 3.7.0; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner;commands:test_10" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: "3.7.0" + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_runner_pub_upgrade - name: build_runner; dart pub upgrade + - id: build_daemon_pub_upgrade + name: build_daemon; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner + working-directory: build_daemon + - name: "build_daemon; dart test --test-randomize-ordering-seed=random" + run: "dart test --test-randomize-ordering-seed=random" + if: "always() && steps.build_daemon_pub_upgrade.conclusion == 'success'" + working-directory: build_daemon needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - - job_009 - - job_010 - - job_011 - - job_012 - - job_013 - - job_014 - - job_015 - - job_016 - - job_017 - - job_018 - - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_041: - name: "e2e_test; linux; Dart 3.7.0; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" - runs-on: ubuntu-latest + job_018: + name: "unit_test; windows; PKG: build_runner; `dart test -t integration --test-randomize-ordering-seed=random`" + runs-on: windows-latest steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner;commands:test_11" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: "3.7.0" + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -1656,66 +749,32 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" + - name: "build_runner; dart test -t integration --test-randomize-ordering-seed=random" + run: "dart test -t integration --test-randomize-ordering-seed=random" if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" working-directory: build_runner needs: - job_001 - job_002 - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - - job_009 - - job_010 - - job_011 - - job_012 - - job_013 - - job_014 - - job_015 - - job_016 - - job_017 - - job_018 - - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_042: - name: "e2e_test; linux; Dart 3.7.0; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" + job_019: + name: "leak_check; linux; PKG: build_runner; `../tool/leak_check.sh`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner;commands:test_12" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:command_2" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0;packages:build_runner - os:ubuntu-latest;pub-cache-hosted;sdk:3.7.0 + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: "3.7.0" + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -1724,8 +783,8 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" + - name: build_runner; ../tool/leak_check.sh + run: ../tool/leak_check.sh if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" working-directory: build_runner needs: @@ -1747,36 +806,17 @@ jobs: - job_016 - job_017 - job_018 - - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_043: - name: "e2e_test; linux; Dart dev; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" + job_020: + name: "e2e_test; linux; PKG: _test; `dart test --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_08" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test;commands:test_00" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -1787,15 +827,15 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_runner_pub_upgrade - name: build_runner; dart pub upgrade + - id: _test_pub_upgrade + name: _test; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner + working-directory: _test + - name: "_test; dart test --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random" + run: "dart test --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random" + if: "always() && steps._test_pub_upgrade.conclusion == 'success'" + working-directory: _test needs: - job_001 - job_002 @@ -1816,35 +856,17 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_044: - name: "e2e_test; linux; Dart dev; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" + job_021: + name: "e2e_test; linux; PKG: _test; `dart test --total-shards 3 --shard-index 1 --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_09" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test;commands:test_01" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -1855,15 +877,15 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_runner_pub_upgrade - name: build_runner; dart pub upgrade + - id: _test_pub_upgrade + name: _test; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner + working-directory: _test + - name: "_test; dart test --total-shards 3 --shard-index 1 --test-randomize-ordering-seed=random" + run: "dart test --total-shards 3 --shard-index 1 --test-randomize-ordering-seed=random" + if: "always() && steps._test_pub_upgrade.conclusion == 'success'" + working-directory: _test needs: - job_001 - job_002 @@ -1884,35 +906,17 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_045: - name: "e2e_test; linux; Dart dev; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" + job_022: + name: "e2e_test; linux; PKG: _test; `dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_10" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test;commands:test_02" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -1923,15 +927,15 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: build_runner_pub_upgrade - name: build_runner; dart pub upgrade + - id: _test_pub_upgrade + name: _test; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" - working-directory: build_runner + working-directory: _test + - name: "_test; dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random" + run: "dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random" + if: "always() && steps._test_pub_upgrade.conclusion == 'success'" + working-directory: _test needs: - job_001 - job_002 @@ -1952,33 +956,15 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_046: - name: "e2e_test; linux; Dart dev; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" + job_023: + name: "e2e_test; linux; PKG: build_runner; `dart test -t slow --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random -j 1`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_11" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_08" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -1996,8 +982,8 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" + - name: "build_runner; dart test -t slow --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random -j 1" + run: "dart test -t slow --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random -j 1" if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" working-directory: build_runner needs: @@ -2020,33 +1006,15 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_047: - name: "e2e_test; linux; Dart dev; PKG: build_runner; `dart test -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1`" + job_024: + name: "e2e_test; linux; PKG: build_runner; `dart test -t slow --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random -j 1`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_12" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_09" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -2064,8 +1032,8 @@ jobs: run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" working-directory: build_runner - - name: "build_runner; dart test -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" - run: "dart test -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1" + - name: "build_runner; dart test -t slow --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random -j 1" + run: "dart test -t slow --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random -j 1" if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" working-directory: build_runner needs: @@ -2088,54 +1056,36 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_048: - name: "e2e_test; linux; Dart main; PKG: _test; `dart test --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random`" + job_025: + name: "e2e_test; linux; PKG: build_runner; `dart test -t slow --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random -j 1`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test;commands:test_00" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_10" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test - os:ubuntu-latest;pub-cache-hosted;sdk:main + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: _test_pub_upgrade - name: _test; dart pub upgrade + - id: build_runner_pub_upgrade + name: build_runner; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: _test - - name: "_test; dart test --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random" - run: "dart test --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random" - if: "always() && steps._test_pub_upgrade.conclusion == 'success'" - working-directory: _test + working-directory: build_runner + - name: "build_runner; dart test -t slow --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random -j 1" + run: "dart test -t slow --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random -j 1" + if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" + working-directory: build_runner needs: - job_001 - job_002 @@ -2156,54 +1106,36 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_049: - name: "e2e_test; linux; Dart main; PKG: _test; `dart test --total-shards 3 --shard-index 1 --test-randomize-ordering-seed=random`" + job_026: + name: "e2e_test; linux; PKG: build_runner; `dart test -t slow --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random -j 1`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test;commands:test_01" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_11" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test - os:ubuntu-latest;pub-cache-hosted;sdk:main + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: _test_pub_upgrade - name: _test; dart pub upgrade + - id: build_runner_pub_upgrade + name: build_runner; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: _test - - name: "_test; dart test --total-shards 3 --shard-index 1 --test-randomize-ordering-seed=random" - run: "dart test --total-shards 3 --shard-index 1 --test-randomize-ordering-seed=random" - if: "always() && steps._test_pub_upgrade.conclusion == 'success'" - working-directory: _test + working-directory: build_runner + - name: "build_runner; dart test -t slow --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random -j 1" + run: "dart test -t slow --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random -j 1" + if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" + working-directory: build_runner needs: - job_001 - job_002 @@ -2224,54 +1156,36 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_050: - name: "e2e_test; linux; Dart main; PKG: _test; `dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random`" + job_027: + name: "e2e_test; linux; PKG: build_runner; `dart test -t slow --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random -j 1`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test;commands:test_02" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner;commands:test_12" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test - os:ubuntu-latest;pub-cache-hosted;sdk:main + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:build_runner + os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: _test_pub_upgrade - name: _test; dart pub upgrade + - id: build_runner_pub_upgrade + name: build_runner; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: _test - - name: "_test; dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random" - run: "dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random" - if: "always() && steps._test_pub_upgrade.conclusion == 'success'" - working-directory: _test + working-directory: build_runner + - name: "build_runner; dart test -t slow --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random -j 1" + run: "dart test -t slow --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random -j 1" + if: "always() && steps.build_runner_pub_upgrade.conclusion == 'success'" + working-directory: build_runner needs: - job_001 - job_002 @@ -2292,32 +1206,14 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_051: - name: "e2e_test; windows; Dart main; PKG: _test; `dart test --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random`" + job_028: + name: "e2e_test; windows; PKG: _test; `dart test --total-shards 3 --shard-index 0 --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -2350,32 +1246,14 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_052: - name: "e2e_test; windows; Dart main; PKG: _test; `dart test --total-shards 3 --shard-index 1 --test-randomize-ordering-seed=random`" + job_029: + name: "e2e_test; windows; PKG: _test; `dart test --total-shards 3 --shard-index 1 --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -2408,32 +1286,14 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_053: - name: "e2e_test; windows; Dart main; PKG: _test; `dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random`" + job_030: + name: "e2e_test; windows; PKG: _test; `dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random`" runs-on: windows-latest steps: - name: Setup Dart SDK uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 with: - sdk: main + sdk: dev - id: checkout name: Checkout repository uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 @@ -2466,181 +1326,3 @@ jobs: - job_017 - job_018 - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - job_054: - name: "e2e_test_cron; linux; Dart main; PKG: _test; `dart test`" - runs-on: ubuntu-latest - if: "github.event_name == 'schedule'" - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test;commands:test_03" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:main;packages:_test - os:ubuntu-latest;pub-cache-hosted;sdk:main - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: main - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: _test_pub_upgrade - name: _test; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: _test - - name: _test; dart test - run: dart test - if: "always() && steps._test_pub_upgrade.conclusion == 'success'" - working-directory: _test - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - - job_009 - - job_010 - - job_011 - - job_012 - - job_013 - - job_014 - - job_015 - - job_016 - - job_017 - - job_018 - - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - - job_038 - - job_039 - - job_040 - - job_041 - - job_042 - - job_043 - - job_044 - - job_045 - - job_046 - - job_047 - - job_048 - - job_049 - - job_050 - - job_051 - - job_052 - - job_053 - job_055: - name: "e2e_test_cron; windows; Dart main; PKG: _test; `dart test`" - runs-on: windows-latest - if: "github.event_name == 'schedule'" - steps: - - name: Setup Dart SDK - uses: dart-lang/setup-dart@f0ead981b4d9a35b37f30d36160575d60931ec30 - with: - sdk: main - - id: checkout - name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 - - id: _test_pub_upgrade - name: _test; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: _test - - name: _test; dart test - run: dart test - if: "always() && steps._test_pub_upgrade.conclusion == 'success'" - working-directory: _test - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - - job_009 - - job_010 - - job_011 - - job_012 - - job_013 - - job_014 - - job_015 - - job_016 - - job_017 - - job_018 - - job_019 - - job_020 - - job_021 - - job_022 - - job_023 - - job_024 - - job_025 - - job_026 - - job_027 - - job_028 - - job_029 - - job_030 - - job_031 - - job_032 - - job_033 - - job_034 - - job_035 - - job_036 - - job_037 - - job_038 - - job_039 - - job_040 - - job_041 - - job_042 - - job_043 - - job_044 - - job_045 - - job_046 - - job_047 - - job_048 - - job_049 - - job_050 - - job_051 - - job_052 - - job_053 diff --git a/_benchmark/mono_pkg.yaml b/_benchmark/mono_pkg.yaml index fe09d0ec2..f08105835 100644 --- a/_benchmark/mono_pkg.yaml +++ b/_benchmark/mono_pkg.yaml @@ -1,9 +1,10 @@ sdk: -- pubspec +- dev os: - linux stages: - analyze_and_format: + - format - analyze: --fatal-infos . diff --git a/_test/build.throws.yaml b/_test/build.throws.yaml deleted file mode 100644 index a6b5d8ac4..000000000 --- a/_test/build.throws.yaml +++ /dev/null @@ -1,19 +0,0 @@ -targets: - $default: - builders: - provides_builder:some_builder: - options: - throw_in_constructor: true - build_web_compilers:entrypoint: - generate_for: - - web/main.dart - - web/sub/main.dart - - test/hello_world_test.dart - - test/hello_world_test.dart.browser_test.dart - - test/hello_world_deferred_test.dart - - test/hello_world_deferred_test.dart.browser_test.dart - - test/hello_world_custom_html_test.dart - - test/hello_world_custom_html_test.dart.browser_test.dart - - test/other_test.dart.browser_test.dart - - test/sub-dir/subdir_test.dart - - test/sub-dir/subdir_test.dart.browser_test.dart diff --git a/_test/mono_pkg.yaml b/_test/mono_pkg.yaml index 4353850f8..b8c5349e3 100644 --- a/_test/mono_pkg.yaml +++ b/_test/mono_pkg.yaml @@ -1,16 +1,18 @@ sdk: -- main +- dev os: - linux -- windows stages: - analyze_and_format: + - format - analyze: --fatal-infos . - os: linux - unit_test: - command: dart run build_runner test -- -p chrome --test-randomize-ordering-seed=random + os: + - linux + - windows # TODO(https://github.com/dart-lang/build/issues/3423): restore this on windows - command: dart run build_runner test -- -p vm test/configurable_uri_test.dart --test-randomize-ordering-seed=random os: linux @@ -27,8 +29,3 @@ stages: os: windows - test: --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random os: windows -# This stage is configured to only run for scheduled builds (see mono_repo.yaml) -- e2e_test_cron: - - test: - sdk: - - be/raw/latest diff --git a/_test/test/build_integration_test.dart b/_test/test/build_integration_test.dart index 2e0226b4e..1046c6ee9 100644 --- a/_test/test/build_integration_test.dart +++ b/_test/test/build_integration_test.dart @@ -7,7 +7,6 @@ library; import 'dart:io'; -import 'package:build_runner/src/internal.dart'; import 'package:path/path.dart' as p; import 'package:test/test.dart'; @@ -127,25 +126,6 @@ void main() { expect(dartSource.existsSync(), true); }); - test('Re-snapshots if there is no asset graph', () async { - final assetGraph = assetGraphPathFor(scriptKernelLocation); - await File(assetGraph).delete(); - - final nextBuild = await runBuild(); - expect( - (nextBuild.stdout as String).split('\n'), - containsAllInOrder([ - contains('Generating the build script'), - contains('Compiling the build script.'), - contains('Creating the asset graph.'), - contains( - 'Building, full build because there is no valid asset graph.', - ), - contains(BuildLog.successPattern), - ]), - ); - }); - test('incremental build after resolve missing import', () async { final dartSource = File(p.join('lib', 'app.dart')); dartSource.writeAsStringSync( diff --git a/_test/test/exception_handling_test.dart b/_test/test/exception_handling_test.dart deleted file mode 100644 index 36af46707..000000000 --- a/_test/test/exception_handling_test.dart +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@TestOn('vm') -library; - -import 'package:test/test.dart'; - -import 'common/utils.dart'; - -void main() { - test('Exceptions from the isolate are handled properly', () async { - final asyncResult = runBuild(trailingArgs: ['--config', 'throws']); - expect( - asyncResult, - completes, - reason: - 'Wrapper script should not hang if the isolate has an unhandled ' - 'error.', - ); - final result = await asyncResult; - expect( - result.stdout, - contains('Throwing on purpose cause you asked for it!'), - reason: 'Exceptions from the isolate should be logged.', - ); - expect( - result.exitCode, - isNot(0), - reason: - 'The exit code should be non-zero if there is an unhandled error.', - ); - }); -} diff --git a/_test/test/help_test.dart b/_test/test/help_test.dart deleted file mode 100644 index f3e7c4322..000000000 --- a/_test/test/help_test.dart +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@TestOn('vm') -library; - -import 'dart:async'; - -import 'package:test/test.dart'; - -import 'common/utils.dart'; - -void main() { - test('dart run build_runner help', () async { - await _testHelpCommand(['help'], checkContent: 'Dart build tool.'); - await _testHelpCommand(['--help'], checkContent: 'Dart build tool.'); - }); - - test('dart run build_runner build --help', () async { - await _testHelpCommand([ - 'build', - '--help', - ], checkContent: 'Builds the current package.'); - await _testHelpCommand([ - 'help', - 'build', - ], checkContent: 'Builds the current package.'); - }); - - test('dart run build_runner serve --help', () async { - await _testHelpCommand([ - 'serve', - '--help', - ], checkContent: 'Continuously builds and serves the current package.'); - await _testHelpCommand([ - 'help', - 'serve', - ], checkContent: 'Continuously builds and serves the current package.'); - }); - - test('dart run build_runner test --help', () async { - await _testHelpCommand([ - 'test', - '--help', - ], checkContent: 'Builds the current package then runs tests.'); - await _testHelpCommand([ - 'help', - 'test', - ], checkContent: 'Builds the current package then runs tests.'); - }); - - test('dart run build_runner watch --help', () async { - await _testHelpCommand([ - 'watch', - '--help', - ], checkContent: 'Continuously builds the current package.'); - await _testHelpCommand([ - 'help', - 'watch', - ], checkContent: 'Continuously builds the current package.'); - }); -} - -Future _testHelpCommand(List args, {String? checkContent}) async { - final asyncResult = runCommand(args); - expect( - asyncResult, - completes, - reason: 'should not cause the auto build script to hang', - ); - final result = await asyncResult; - expect( - result.exitCode, - equals(0), - reason: 'should give a successful exit code', - ); - expect(result.stderr, isEmpty, reason: 'Should output nothing on stderr'); - expect( - result.stdout, - isNot(contains('"Unhandled exception"')), - reason: 'Should not print an unhandled exception', - ); - if (checkContent != null) { - expect(result.stdout, contains(checkContent)); - } -} diff --git a/build/mono_pkg.yaml b/build/mono_pkg.yaml index 93eedff71..aa025bbfb 100644 --- a/build/mono_pkg.yaml +++ b/build/mono_pkg.yaml @@ -1,19 +1,12 @@ sdk: -- pubspec - dev +os: +- linux + stages: - analyze_and_format: + - format - analyze: --fatal-infos . - - format: - sdk: - - dev - unit_test: - test: --test-randomize-ordering-seed=random - os: - - linux - - windows - -cache: - directories: - - .dart_tool/build diff --git a/build_config/mono_pkg.yaml b/build_config/mono_pkg.yaml index a095a6290..aa025bbfb 100644 --- a/build_config/mono_pkg.yaml +++ b/build_config/mono_pkg.yaml @@ -1,17 +1,12 @@ sdk: - dev +os: +- linux + stages: - analyze_and_format: - - group: - - format - - analyze: --fatal-infos . + - format + - analyze: --fatal-infos . - unit_test: - test: --test-randomize-ordering-seed=random - os: - - linux - - windows - -cache: - directories: - - .dart_tool/build diff --git a/build_daemon/mono_pkg.yaml b/build_daemon/mono_pkg.yaml index 4fdefd7bf..da5f45663 100644 --- a/build_daemon/mono_pkg.yaml +++ b/build_daemon/mono_pkg.yaml @@ -1,14 +1,13 @@ sdk: - dev -- pubspec + +os: +- linux stages: - analyze_and_format: - - group: - - format - - analyze: --fatal-infos . - sdk: - - dev + - format + - analyze: --fatal-infos . - unit_test: - test: --test-randomize-ordering-seed=random os: diff --git a/build_modules/mono_pkg.yaml b/build_modules/mono_pkg.yaml index 509e1281a..571862d38 100644 --- a/build_modules/mono_pkg.yaml +++ b/build_modules/mono_pkg.yaml @@ -1,17 +1,12 @@ sdk: -- main +- dev + +os: +- linux stages: - analyze_and_format: - - group: - - format - - analyze: --fatal-infos . + - format + - analyze: --fatal-infos . - unit_test: - test: -P presubmit --test-randomize-ordering-seed=random - os: - - linux - - windows - -cache: - directories: - - .dart_tool/build diff --git a/build_runner/dart_test.yaml b/build_runner/dart_test.yaml index a89ee567b..6c74d4c58 100644 --- a/build_runner/dart_test.yaml +++ b/build_runner/dart_test.yaml @@ -3,8 +3,10 @@ presets: include_tags: experiments tags: - integration: + slow: timeout: 16x + integration: + timeout: 4x experiments: skip: 'Only ran if `-P experiments` is passed' presets: {experiments: {skip: false}} diff --git a/build_runner/mono_pkg.yaml b/build_runner/mono_pkg.yaml index 82b81cd18..87b91785c 100644 --- a/build_runner/mono_pkg.yaml +++ b/build_runner/mono_pkg.yaml @@ -1,25 +1,25 @@ sdk: -- pubspec - dev +os: +- linux + stages: - analyze_and_format: - - group: - - format - - analyze: --fatal-infos . + - format + - analyze: --fatal-infos . - unit_test: - - test: -x integration --test-randomize-ordering-seed=random + - test: -x integration -x slow --test-randomize-ordering-seed=random - test: -P experiments --test-randomize-ordering-seed=random - sdk: - - dev + - test: -t integration --test-randomize-ordering-seed=random + os: + - linux + - windows - leak_check: - - group: - - command: ../tool/leak_check.sh - sdk: dev + - command: ../tool/leak_check.sh - e2e_test: - # TODO: enable stack trace chaining https://github.com/dart-lang/build/issues/2894 - - test: -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 - - test: -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 - - test: -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 - - test: -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 - - test: -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 + - test: -t slow --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random -j 1 + - test: -t slow --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random -j 1 + - test: -t slow --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random -j 1 + - test: -t slow --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random -j 1 + - test: -t slow --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random -j 1 diff --git a/build_runner/test/bootstrap/build_script_generate_test.dart b/build_runner/test/bootstrap/build_script_generate_test.dart deleted file mode 100644 index 0081ebc9d..000000000 --- a/build_runner/test/bootstrap/build_script_generate_test.dart +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. -@Timeout.factor(4) -library; - -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import '../common/descriptors.dart'; -import '../common/sdk.dart'; - -void main() { - group('validation', () { - setUpAll(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'code_builder', - ], - ), - ]).create(); - await runPub('a', 'get'); - }); - - group('of builder imports', () { - test('support package relative imports', () async { - await d.dir('a', [ - d.file('build.yaml', ''' -builders: - fake: - import: "tool/builder.dart" - builder_factories: ["myFactory"] - build_extensions: {"foo": ["bar"]} -'''), - ]).create(); - - final result = await runPub( - 'a', - 'run', - args: ['build_runner', 'build'], - ); - expect(result.stderr, isEmpty); - await d.dir('a', [ - d.dir('.dart_tool', [ - d.dir('build', [ - d.dir('entrypoint', [ - d.file( - 'build.dart', - contains("import '../../../tool/builder.dart'"), - ), - ]), - ]), - ]), - ]).validate(); - }); - - test('warns for builder config that leaves unparseable Dart', () async { - await d.dir('a', [ - d.file('build.yaml', ''' -builders: - fake: - import: "tool/builder.dart" - builder_factories: ["not an identifier"] - build_extensions: {"foo": ["bar"]} -'''), - ]).create(); - final result = await runPub( - 'a', - 'run', - args: ['build_runner', 'build'], - ); - expect(result.stderr, isEmpty); - expect(result.stdout, contains('could not be parsed')); - }); - }); - - test('checks builder keys in global_options', () async { - await d.dir('a', [ - d.file('build.yaml', ''' -global_options: - a:a: - runs_before: - - b:b -'''), - ]).create(); - - final result = await runPub('a', 'run', args: ['build_runner', 'build']); - expect(result.stderr, isEmpty); - expect( - result.stdout, - allOf( - contains('Ignoring `global_options` for unknown builder `a:a`.'), - contains( - 'Ignoring `runs_before` in `global_options` ' - 'referencing unknown builder `b:b`.', - ), - ), - ); - }); - }); -} diff --git a/build_runner/test/commands/daemon/daemon_test.dart b/build_runner/test/commands/daemon/daemon_test.dart index 43716d87a..3ec5e9495 100644 --- a/build_runner/test/commands/daemon/daemon_test.dart +++ b/build_runner/test/commands/daemon/daemon_test.dart @@ -2,7 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -@Tags(['integration']) +// TODO(davidmorgan): speed up. +@Tags(['slow']) library; import 'dart:async'; diff --git a/build_runner/test/commands/serve/serve_integration_test.dart b/build_runner/test/commands/serve/serve_integration_test.dart index dc54753a3..f07318be9 100644 --- a/build_runner/test/commands/serve/serve_integration_test.dart +++ b/build_runner/test/commands/serve/serve_integration_test.dart @@ -2,7 +2,8 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -@Tags(['integration']) +// TODO(davidmorgan): speed up. +@Tags(['slow']) library; import 'dart:async'; diff --git a/build_runner/test/common/build_runner_tester.dart b/build_runner/test/common/build_runner_tester.dart new file mode 100644 index 000000000..5b59e470b --- /dev/null +++ b/build_runner/test/common/build_runner_tester.dart @@ -0,0 +1,284 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS floadF +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +import 'dart:convert'; +import 'dart:io'; +import 'dart:isolate'; + +import 'package:build_runner/src/logging/build_log.dart'; +import 'package:package_config/package_config.dart'; +import 'package:path/path.dart' as p; +import 'package:test/test.dart' as test; +import 'package:test/test.dart'; +import 'package:test_process/test_process.dart'; + +import 'fixture_packages.dart'; + +/// End to end tester for `build_runner`. +/// +/// Creates a workspace under system temp, fills it with Dart packages, and runs +/// commands in it. +class BuildRunnerTester { + final Pubspecs pubspecs; + final Directory tempDirectory; + + BuildRunnerTester(this.pubspecs) + : tempDirectory = Directory.systemTemp.createTempSync( + 'BuildRunnerTester-', + ) { + addTearDown(() => tempDirectory.deleteSync(recursive: true)); + } + + /// Writes a Dart package to the workspace. + /// + /// The package is written to the directory `$workspace/$name`. + /// + /// A `pubspec.yaml` is also written, see [Pubspecs.pubspec]. + void writePackage({ + required String name, + required Map files, + List? dependencies, + List? pathDependencies, + }) { + _writeDirectory( + name: name, + files: { + 'pubspec.yaml': pubspecs.pubspec( + name: name, + dependencies: dependencies, + pathDependencies: pathDependencies, + ), + ...files, + }, + ); + } + + void writeFixturePackage(FixturePackage fixturePackage) => writePackage( + name: fixturePackage.name, + files: fixturePackage.files, + dependencies: fixturePackage.dependencies, + pathDependencies: fixturePackage.pathDependencies, + ); + + /// Reads workspace-relative [path], or returns `null` if it does not exist. + String? read(String path) { + final file = File(p.join(tempDirectory.path, path)); + return file.existsSync() ? file.readAsStringSync() : null; + } + + /// Writes [contents] to workspace-relative [path]. + void write(String path, String contents) { + final file = File(p.join(tempDirectory.path, path)); + file + ..createSync(recursive: true) + ..writeAsStringSync(contents); + } + + /// Updates the file at workspace-relative [path], which must exist. + void update(String path, String Function(String) update) { + final file = File(p.join(tempDirectory.path, path)); + final data = file.readAsStringSync(); + file.writeAsStringSync(update(data)); + } + + /// Deletes the workspace-relative [path]. + void delete(String path) { + final file = File(p.join(tempDirectory.path, path)); + file.deleteSync(); + } + + /// Reads the tree of files at the workspace-relative [path]. + /// + /// Returns a `Map` from relative paths under [path] to file contents. + /// + /// The file contents is a `String` if utf8 decoding succeeds or a `Uint8List` + /// if not. + Map? readFileTree(String path) { + final absolutePath = p.join(tempDirectory.path, path); + final directory = Directory(absolutePath); + if (!directory.existsSync()) return null; + + final result = {}; + for (final file in directory.listSync(recursive: true).whereType()) { + final relativePath = file.path + .substring(absolutePath.length + 1) + .replaceAll(r'\', '/'); + try { + result[relativePath] = file.readAsStringSync(); + } catch (_) { + result[relativePath] = file.readAsBytesSync(); + } + } + + return result; + } + + /// Writes a directory to the '$workspace/$name'. + /// + /// [files] is a map from relative path to file contents to write. + /// + void _writeDirectory({ + required String name, + required Map files, + }) { + final directory = Directory(p.join(tempDirectory.path, name)); + for (final entry in files.entries) { + final file = File(p.join(directory.path, entry.key)); + file.createSync(recursive: true); + file.writeAsStringSync(entry.value); + } + } + + /// Runs [commandLine] in [directory]. + /// + /// By default, expects exit code 0 and fails the test if any other exit code + /// is reported. + /// + /// Specify [expectExitCode] to expect a different exit code. + Future run( + String directory, + String commandLine, { + int expectExitCode = 0, + }) async { + final args = commandLine.split(' '); + final command = args.removeAt(0); + final result = await Process.run( + command, + args, + workingDirectory: p.join(tempDirectory.path, directory), + ); + final output = ''' +=== $directory: $commandLine +${result.stdout}${result.stderr}=== +'''; + printOnFailure(output); + expect(result.exitCode, expectExitCode); + return output; + } + + /// Starts [commandLine] in [directory]. + /// + /// Returns a [BuildRunnerProcess] which can be used to interact with it. + Future start(String directory, String commandLine) async { + final args = commandLine.split(' '); + final command = args.removeAt(0); + final process = await TestProcess.start( + command, + args, + workingDirectory: p.join(tempDirectory.path, directory), + ); + addTearDown(process.kill); + return BuildRunnerProcess(process); + } +} + +/// A running `build_runner` process. +class BuildRunnerProcess { + late final HttpClient _client = HttpClient(); + final TestProcess process; + + BuildRunnerProcess(this.process); + + /// Expects [pattern] to appear in the process's stdout. + /// + /// If [failOn] is encountered instead, the test fails immediately. It + /// defaults to [BuildLog.failurePattern] so that `expect` will stop if the + /// process reports a build failure. + /// + /// If the process exits instead, the test fails immediately. + /// + /// Otherwise, waits until [pattern] appears. + Future expect(Pattern pattern, {Pattern? failOn}) async { + failOn ??= BuildLog.failurePattern; + while (true) { + String? line; + try { + line = await process.stdout.next; + } catch (_) { + throw fail('While expecting `$pattern`, process exited.'); + } + printOnFailure(line); + if (line.contains(failOn)) { + fail('While expecting `$pattern`, got `$failOn`.'); + } + if (line.contains(pattern)) return; + } + } + + /// Kills the process. + Future kill() => process.kill(); + + /// Requests [path] from the default server and expects it returns a 404 + /// response. + Future expect404(String path) async { + final request = await _client.get('localhost', 8080, path); + final response = await request.close(); + test.expect(response.statusCode, 404); + await response.drain(); + } + + /// Requests [path] from the default server and expects it returns a 200 + /// response with the body [content]. + Future expectContent(String path, String content) async { + final request = await _client.get('localhost', 8080, path); + final response = await request.close(); + test.expect(response.statusCode, 200); + test.expect(await utf8.decodeStream(response.cast>()), content); + } +} + +/// Creates `pubspec.yaml` for tests. +class Pubspecs { + final PackageConfig packageConfig; + + Pubspecs(this.packageConfig); + + /// Creates [Pubspecs] with package config from the current isolate. + static Future load() async => + Pubspecs(await loadPackageConfigUri((await Isolate.packageConfig)!)); + + /// Returns `pubspec.yaml` content for the package called [name]. + /// + /// The specified [dependencies] are included as path dependencies with + /// locations from the current isolate's package config. This is for real + /// packages that are being tested, such as `build_runner`. + /// + /// The specified [pathDependencies] are included as path dependencies onto + /// peer folders. This allows to add a dependency onto another package that + /// will be written using `writePackage`. + String pubspec({ + required String name, + List? dependencies, + List? pathDependencies, + }) { + dependencies ??= []; + pathDependencies ??= []; + + final result = StringBuffer(''' +name: $name +environment: + sdk: '>=3.7.0 <4.0.0' +dependencies: +'''); + + for (final package in [...dependencies, ...pathDependencies]) { + result.writeln(' $package: any'); + } + + result.writeln('dependency_overrides:'); + for (final package in dependencies) { + final path = packageConfig[package]!.root.toFilePath(); + result + ..writeln(' $package:') + ..writeln(' path: $path'); + } + for (final package in pathDependencies) { + result + ..writeln(' $package:') + ..writeln(' path: ../$package'); + } + + return result.toString(); + } +} diff --git a/build_runner/test/common/builders.dart b/build_runner/test/common/builders.dart index 6a01e089b..e2c6ac3a9 100644 --- a/build_runner/test/common/builders.dart +++ b/build_runner/test/common/builders.dart @@ -24,20 +24,6 @@ class CopyingPostProcessBuilder implements PostProcessBuilder { } } -/// A [Builder] which behaves exactly like it's [delegate] but has a different -/// runtime type. -class DelegatingBuilder implements Builder { - final Builder delegate; - - DelegatingBuilder(this.delegate); - - @override - Map> get buildExtensions => delegate.buildExtensions; - - @override - Future build(BuildStep buildStep) async => delegate.build(buildStep); -} - class PlaceholderBuilder extends Builder { final String inputPlaceholder; final BuiltMap outputFilenameToContent; diff --git a/build_runner/test/common/common.dart b/build_runner/test/common/common.dart index 10728fd8e..3b5e1bd8a 100644 --- a/build_runner/test/common/common.dart +++ b/build_runner/test/common/common.dart @@ -10,8 +10,10 @@ import 'package:crypto/crypto.dart'; export 'package:build_test/build_test.dart'; export 'package:build_test/src/internal_test_reader_writer.dart'; +export 'build_runner_tester.dart'; export 'builders.dart'; export 'descriptors.dart'; +export 'fixture_packages.dart'; export 'matchers.dart'; export 'package_graphs.dart'; export 'sdk.dart'; diff --git a/build_runner/test/common/fixture_packages.dart b/build_runner/test/common/fixture_packages.dart new file mode 100644 index 000000000..099f874f8 --- /dev/null +++ b/build_runner/test/common/fixture_packages.dart @@ -0,0 +1,117 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +/// A package with builders and `build.yaml` for use in end to end tests. +class FixturePackage { + final String name; + final List? dependencies; + final List? pathDependencies; + final Map files; + + FixturePackage({ + required this.name, + required this.files, + this.dependencies, + this.pathDependencies, + }); +} + +class FixturePackages { + /// Copies .txt files to .txt.copy files. + static FixturePackage copyBuilder({ + bool buildToCache = false, + bool applyToAllPackages = false, + }) => FixturePackage( + name: 'builder_pkg', + dependencies: ['build', 'build_runner'], + files: { + 'build.yaml': ''' +builders: + test_builder: + import: 'package:builder_pkg/builder.dart' + builder_factories: ['testBuilderFactory'] + build_extensions: {'.txt': ['.txt.copy']} + auto_apply: ${applyToAllPackages ? 'all_packages' : 'root_package'} + build_to: ${buildToCache ? 'cache' : 'source'} +''', + 'lib/builder.dart': ''' +import 'package:build/build.dart'; + +Builder testBuilderFactory(BuilderOptions options) => TestBuilder(); + +class TestBuilder implements Builder { + @override + Map> get buildExtensions => {'.txt': ['.txt.copy']}; + + @override + Future build(BuildStep buildStep) async { + buildStep.writeAsString( + buildStep.inputId.addExtension('.copy'), + await buildStep.readAsString(buildStep.inputId), + ); + } +} +''', + }, + ); + + /// OptionalCopyBuilder copies .txt -> .txt.copy, but its output is optional, + /// so it only does so if something consumes the output. + /// + /// ReadBuilder reads the file pointed to in a .read file. + static final optionalCopyAndReadBuilders = FixturePackage( + name: 'builder_pkg', + dependencies: ['build', 'build_runner'], + files: { + 'build.yaml': ''' +builders: + optional_copy_builder: + import: 'package:builder_pkg/builder.dart' + builder_factories: ['optionalCopyBuilder'] + build_extensions: {'.txt': ['.txt.copy']} + auto_apply: root_package + is_optional: true + build_to: source + runs_before: ["builder_pkg:read_builder"] + read_builder: + import: 'package:builder_pkg/builder.dart' + builder_factories: ['readBuilder'] + build_extensions: {'.read': ['.read.out']} + auto_apply: root_package + is_optional: false + build_to: source +''', + 'lib/builder.dart': ''' +import 'package:build/build.dart'; + +Builder optionalCopyBuilder(BuilderOptions options) => OptionalCopyBuilder(); +Builder readBuilder(BuilderOptions options) => ReadBuilder(); + +class OptionalCopyBuilder implements Builder { + @override + Map> get buildExtensions => {'.txt': ['.txt.copy']}; + + @override + Future build(BuildStep buildStep) async { + buildStep.writeAsString( + buildStep.inputId.addExtension('.copy'), + await buildStep.readAsString(buildStep.inputId), + ); + } +} + +class ReadBuilder implements Builder { + @override + Map> get buildExtensions => {'.read': ['.read.out']}; + + @override + Future build(BuildStep buildStep) async { + final target = await buildStep.readAsString(buildStep.inputId); + await buildStep.readAsString(AssetId.parse(target)); + } +} +''', + }, + ); +} diff --git a/build_runner/test/common/sdk.dart b/build_runner/test/common/sdk.dart index 2d32a32d3..359aa1bd5 100644 --- a/build_runner/test/common/sdk.dart +++ b/build_runner/test/common/sdk.dart @@ -8,13 +8,9 @@ import 'dart:io'; // ignore: implementation_imports import 'package:build_runner/src/constants.dart'; import 'package:path/path.dart' as p; -import 'package:pub_semver/pub_semver.dart'; import 'package:test/test.dart'; import 'package:test_descriptor/test_descriptor.dart' as d; -final bool supportsUnsoundNullSafety = - Version.parse(Platform.version.split(' ').first).major == 2; - /// Runs `pub get` on [package] (which is assumed to be in a directory with /// that name under the [d.sandbox] directory). Future pubGet(String package, {bool offline = true}) async { @@ -59,15 +55,3 @@ Future runDart( script, ...?args, ], workingDirectory: p.join(d.sandbox, package)); - -/// Starts the `dart` script [script] in [package] with [args]. -/// -/// The [script] should be a relative path under [package]. -Future startDart( - String package, - String script, { - Iterable? args, -}) => Process.start(dartBinary, [ - script, - ...?args, -], workingDirectory: p.join(d.sandbox, package)); diff --git a/build_runner/test/integration_tests/build_command_build_filter_test.dart b/build_runner/test/integration_tests/build_command_build_filter_test.dart new file mode 100644 index 000000000..670dcaefe --- /dev/null +++ b/build_runner/test/integration_tests/build_command_build_filter_test.dart @@ -0,0 +1,48 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('build command --build-filter', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writeFixturePackage( + FixturePackages.copyBuilder(buildToCache: true, applyToAllPackages: true), + ); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg', 'other_pkg'], + files: { + 'lib/a.txt': 'a', + 'lib/b.txt': 'b', + 'web/a.txt': 'a', + 'web/b.txt': 'b', + }, + ); + tester.writePackage( + name: 'other_pkg', + files: {'lib/a.txt': 'a', 'lib/b.txt': 'b'}, + ); + + await tester.run( + 'root_pkg', + 'dart run build_runner build ' + '--build-filter package:*/a.txt.copy ' + '--build-filter web/a.txt.copy ', + ); + expect(tester.readFileTree('root_pkg/.dart_tool/build/generated'), { + 'root_pkg/web/a.txt.copy': 'a', + 'root_pkg/lib/a.txt.copy': 'a', + 'other_pkg/lib/a.txt.copy': 'a', + }); + }); +} diff --git a/build_runner/test/integration_tests/build_command_config_validation_test.dart b/build_runner/test/integration_tests/build_command_config_validation_test.dart new file mode 100644 index 000000000..e4af26b67 --- /dev/null +++ b/build_runner/test/integration_tests/build_command_config_validation_test.dart @@ -0,0 +1,100 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:io/io.dart'; +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('build command config validation', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + files: { + 'build.yaml': r''' +targets: + $default: + builders: + bad:builder: + enabled: true +''', + }, + ); + + var output = await tester.run('root_pkg', 'dart run build_runner build'); + expect( + output, + contains( + 'Ignoring options for unknown builder `bad:builder` ' + 'in target `root_pkg:root_pkg`.', + ), + ); + + tester.write('root_pkg/build.yaml', r''' +global_options: + bad:builder: + options: {} +'''); + output = await tester.run('root_pkg', 'dart run build_runner build'); + expect( + output, + contains('Ignoring `global_options` for unknown builder `bad:builder`.'), + ); + + tester.delete('root_pkg/build.yaml'); + output = await tester.run( + 'root_pkg', + 'dart run build_runner build --define=bad:key=foo=bar', + ); + expect( + output, + contains('Ignoring options overrides for unknown builder `bad:key`.'), + ); + + // Compile errors caused by config errors. + tester.write('root_pkg/build.yaml', r''' +builders: + test_builder: + import: 'missing_builder.dart' + builder_factories: ['missingFactory'] + build_extensions: {'.txt': ['.txt.copy']} + auto_apply: root_package + build_to: source +'''); + output = await tester.run( + 'root_pkg', + 'dart run build_runner build', + expectExitCode: ExitCode.config.code, + ); + expect(output, contains("Error when reading 'missing_builder.dart'")); + expect(output, contains("Undefined name 'missingFactory'")); + + // A relative import is handled correctly. + tester.write('root_pkg/build.yaml', r''' +builders: + test_builder: + import: 'tool/missing_builder.dart' + builder_factories: ['missingFactory'] + build_extensions: {'.txt': ['.txt.copy']} + auto_apply: root_package + build_to: source +'''); + output = await tester.run( + 'root_pkg', + 'dart run build_runner build', + expectExitCode: ExitCode.config.code, + ); + expect( + tester.read('root_pkg/.dart_tool/build/entrypoint/build.dart'), + contains("import '../../../tool/missing_builder.dart'"), + ); + }); +} diff --git a/build_runner/test/integration_tests/build_command_define_test.dart b/build_runner/test/integration_tests/build_command_define_test.dart new file mode 100644 index 000000000..cb93e9e21 --- /dev/null +++ b/build_runner/test/integration_tests/build_command_define_test.dart @@ -0,0 +1,84 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('build command --define', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writePackage( + name: 'builder_pkg', + dependencies: ['build', 'build_runner'], + files: { + 'build.yaml': r''' +builders: + test_builder: + import: 'package:builder_pkg/builder.dart' + builder_factories: ['testBuilderFactory'] + build_extensions: {'.txt': ['.txt.copy']} + auto_apply: root_package + build_to: source +''', + 'lib/builder.dart': ''' +import 'package:build/build.dart'; + +Builder testBuilderFactory(BuilderOptions options) => + TestBuilder(AssetId.parse(options.config['copy_from'] as String)); + +class TestBuilder implements Builder { + final AssetId copyFrom; + + TestBuilder(this.copyFrom); + + @override + Map> get buildExtensions => {'.txt': ['.txt.copy']}; + + @override + Future build(BuildStep buildStep) async { + buildStep.writeAsString( + buildStep.inputId.addExtension('.copy'), + await buildStep.readAsString(copyFrom), + ); + } +}''', + }, + ); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: { + 'build.yaml': r''' +targets: + $default: + builders: + builder_pkg:test_builder: + options: + copy_from: root_pkg|web/b.txt +''', + 'web/a.txt': 'a', + 'web/b.txt': 'b', + }, + ); + + // Config in `build.yaml` is the default. + await tester.run('root_pkg', 'dart run build_runner build'); + expect(tester.read('root_pkg/web/a.txt.copy'), 'b'); + + // Override it with `--define`. + await tester.run( + 'root_pkg', + 'dart run build_runner build ' + '--define=builder_pkg:test_builder=copy_from=root_pkg|web/a.txt', + ); + expect(tester.read('root_pkg/web/a.txt.copy'), 'a'); + }); +} diff --git a/build_runner/test/integration_tests/build_command_errors_test.dart b/build_runner/test/integration_tests/build_command_errors_test.dart new file mode 100644 index 000000000..81dd0b1a5 --- /dev/null +++ b/build_runner/test/integration_tests/build_command_errors_test.dart @@ -0,0 +1,95 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('build command errors', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writePackage( + name: 'builder_pkg', + dependencies: ['build', 'build_runner'], + files: { + 'build.yaml': ''' +builders: + test_builder: + import: 'package:builder_pkg/builder.dart' + builder_factories: ['testBuilderFactory'] + build_extensions: {'.txt': ['.txt.copy']} + auto_apply: root_package + build_to: source +''', + 'lib/builder.dart': ''' +import 'dart:io'; +import 'package:build/build.dart'; + +Builder testBuilderFactory(BuilderOptions options) => TestBuilder(); + +class TestBuilder implements Builder { + @override + Map> get buildExtensions => {'.txt': ['.txt.copy']}; + + @override + Future build(BuildStep buildStep) async { + log.warning('builder ran'); + log.severe('builder failed'); + } +} +''', + }, + ); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: {'web/a.txt': 'a'}, + ); + + var output = await tester.run( + 'root_pkg', + 'dart run build_runner build', + expectExitCode: 1, + ); + expect(output, contains('builder ran')); + expect(output, contains('builder failed')); + + // On rebuild: nothing changed, so the action does not run again. + // Errors are serialized so the error is reported again; the warning is not. + output = await tester.run( + 'root_pkg', + 'dart run build_runner build', + expectExitCode: 1, + ); + expect(output, isNot(contains('builder ran'))); + expect(output, contains('builder failed')); + + // Throwing instead of `log.severe` is equivalent. + tester.update( + 'builder_pkg/lib/builder.dart', + (script) => script.replaceAll( + "log.severe('builder failed');", + "throw 'builder failed';", + ), + ); + output = await tester.run( + 'root_pkg', + 'dart run build_runner build', + expectExitCode: 1, + ); + expect(output, contains('builder ran')); + expect(output, contains('builder failed')); + // Now with stack trace. + expect( + output, + contains('TestBuilder.build (package:builder_pkg/builder.dart'), + ); + }); +} diff --git a/build_runner/test/integration_tests/build_command_find_assets_test.dart b/build_runner/test/integration_tests/build_command_find_assets_test.dart new file mode 100644 index 000000000..26b134be6 --- /dev/null +++ b/build_runner/test/integration_tests/build_command_find_assets_test.dart @@ -0,0 +1,104 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('build command find assets', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writePackage( + name: 'builder_pkg', + dependencies: ['build', 'build_runner'], + files: { + 'build.yaml': ''' +builders: + globbing_builder: + import: 'package:builder_pkg/builder.dart' + builder_factories: ['globbingBuilderFactory'] + build_extensions: {'.globPlaceholder': ['.matchingFiles']} + auto_apply: all_packages + build_to: source +''', + 'lib/builder.dart': r''' +import 'package:build/build.dart'; +import 'package:glob/glob.dart'; + +Builder globbingBuilderFactory(BuilderOptions options) => GlobbingBuilder(); + +class GlobbingBuilder extends Builder { + @override + Map> get buildExtensions => {'.globPlaceholder': ['.matchingFiles']}; + + @override + Future build(BuildStep buildStep) async { + final glob = Glob('**.txt'); + final allAssets = await buildStep.findAssets(glob).toList(); + allAssets.sort((a, b) => a.path.compareTo(b.path)); + await buildStep.writeAsString( + buildStep.inputId.changeExtension('.matchingFiles'), + allAssets.map((id) => id.toString()).join('\n'), + ); + } +} +''', + }, + ); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: {'web/a.globPlaceholder': '', 'web/a.txt': '', 'web/b.txt': ''}, + ); + + // Glob matches the expected files. + await tester.run('root_pkg', 'dart run build_runner build'); + expect(tester.read('root_pkg/web/a.matchingFiles')!.split('\n'), [ + 'root_pkg|web/a.txt', + 'root_pkg|web/b.txt', + ]); + + // On rebuild glob matches a new file. + tester.write('root_pkg/web/c.txt', ''); + await tester.run('root_pkg', 'dart run build_runner build'); + expect(tester.read('root_pkg/web/a.matchingFiles')!.split('\n'), [ + 'root_pkg|web/a.txt', + 'root_pkg|web/b.txt', + 'root_pkg|web/c.txt', + ]); + + // On rebuild glob no longer matches a deleted file. + tester.delete('root_pkg/web/c.txt'); + await tester.run('root_pkg', 'dart run build_runner build'); + expect(tester.read('root_pkg/web/a.matchingFiles')!.split('\n'), [ + 'root_pkg|web/a.txt', + 'root_pkg|web/b.txt', + ]); + + // No work on rebuild for a new non-matching file. + tester.write('root_pkg/web/c.other', ''); + var output = await tester.run('root_pkg', 'dart run build_runner build'); + expect(output, contains('wrote 0 outputs')); + expect(tester.read('root_pkg/web/a.matchingFiles')!.split('\n'), [ + 'root_pkg|web/a.txt', + 'root_pkg|web/b.txt', + ]); + + // No work on rebuild for changed matching file: the builder does not read + // the files so they are not inputs. + tester.write('root_pkg/web/a.txt', 'changed'); + output = await tester.run('root_pkg', 'dart run build_runner build'); + expect(output, contains('wrote 0 outputs')); + expect(tester.read('root_pkg/web/a.matchingFiles')!.split('\n'), [ + 'root_pkg|web/a.txt', + 'root_pkg|web/b.txt', + ]); + }); +} diff --git a/build_runner/test/integration_tests/build_command_invalidation_test.dart b/build_runner/test/integration_tests/build_command_invalidation_test.dart new file mode 100644 index 000000000..77fed4693 --- /dev/null +++ b/build_runner/test/integration_tests/build_command_invalidation_test.dart @@ -0,0 +1,80 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:build_runner/src/bootstrap/build_script_generate.dart'; +import 'package:build_runner/src/constants.dart'; +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('build command invalidation', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writeFixturePackage(FixturePackages.copyBuilder()); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: {'web/a.txt': 'a'}, + ); + + // Fake generated output to check that stale generated output is deleted. + final fakeGeneratedOutput = + 'root_pkg/.dart_tool/build/generated/fake_output'; + + // First build. + await tester.run('root_pkg', 'dart run build_runner build'); + expect(tester.read('root_pkg/web/a.txt.copy'), 'a'); + + // With no changes, no rebuild. + var output = await tester.run('root_pkg', 'dart run build_runner build'); + expect(output, contains('wrote 0 outputs')); + + // Change the build script, rebuilds. + tester.update('builder_pkg/lib/builder.dart', (script) => '$script\n'); + tester.write(fakeGeneratedOutput, ''); + output = await tester.run('root_pkg', 'dart run build_runner build'); + expect(output, contains('Building, full build because builders changed.')); + expect(output, contains('wrote 1 output')); + expect(tester.read(fakeGeneratedOutput), null); + + // Change the build script to output with a different extension. The old + // output file should be deleted and the new one created. + tester.update( + 'builder_pkg/lib/builder.dart', + (script) => script.replaceAll('.copy', '.copy2'), + ); + await tester.run('root_pkg', 'dart run build_runner build'); + expect(tester.read('root_pkg/web/a.txt.copy'), null); + expect(tester.read('root_pkg/web/a.txt.copy2'), 'a'); + + // Asset graph version mismatch. + final assetGraphPath = + 'root_pkg/${assetGraphPathFor(scriptKernelLocation)}'; + tester.update( + assetGraphPath, + (json) => json.replaceAll('"version":', '"version":1'), + ); + tester.write(fakeGeneratedOutput, ''); + output = await tester.run('root_pkg', 'dart run build_runner build'); + expect( + output, + contains('Building, full build because there is no valid asset graph.'), + ); + expect(tester.read(fakeGeneratedOutput), null); + + // "Core packages" location changed. + tester.update( + 'root_pkg/.dart_tool/build/entrypoint/.packageLocations', + (txt) => '$txt\n', + ); + output = await tester.run('root_pkg', 'dart run build_runner build'); + expect(output, contains('Building, full build because builders changed.')); + }); +} diff --git a/build_runner/test/integration_tests/build_command_output_only_required_test.dart b/build_runner/test/integration_tests/build_command_output_only_required_test.dart new file mode 100644 index 000000000..eadb1defe --- /dev/null +++ b/build_runner/test/integration_tests/build_command_output_only_required_test.dart @@ -0,0 +1,57 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('build command --output writes only required files', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + tester.writeFixturePackage(FixturePackages.optionalCopyAndReadBuilders); + + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: {'lib/a.txt': 'a', 'lib/b.txt': 'b'}, + ); + + // Initial build produces no output as the copy is not required. + await tester.run('root_pkg', 'dart run build_runner build --output build'); + expect(tester.readFileTree('root_pkg/build/packages/root_pkg'), { + 'a.txt': 'a', + 'b.txt': 'b', + }); + + // Read a copy so that it is now required. + tester.write('root_pkg/lib/new.read', 'root_pkg|lib/a.txt.copy'); + await tester.run('root_pkg', 'dart run build_runner build --output build'); + expect(tester.readFileTree('root_pkg/build/packages/root_pkg'), { + 'new.read': 'root_pkg|lib/a.txt.copy', + 'a.txt': 'a', + 'a.txt.copy': 'a', + 'b.txt': 'b', + }); + + // Stop requiring the copy and it is no longer output to `build`. + tester.delete('root_pkg/lib/new.read'); + await tester.run('root_pkg', 'dart run build_runner build --output build'); + expect(tester.readFileTree('root_pkg/build/packages/root_pkg'), { + 'a.txt': 'a', + 'b.txt': 'b', + }); + + // But it is not removed from the source tree. + expect(tester.readFileTree('root_pkg/lib'), { + 'a.txt': 'a', + 'a.txt.copy': 'a', + 'b.txt': 'b', + }); + }); +} diff --git a/build_runner/test/integration_tests/build_command_output_test.dart b/build_runner/test/integration_tests/build_command_output_test.dart new file mode 100644 index 000000000..0532948c7 --- /dev/null +++ b/build_runner/test/integration_tests/build_command_output_test.dart @@ -0,0 +1,109 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:io/io.dart'; +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('build command --output', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writeFixturePackage(FixturePackages.copyBuilder()); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: {'web/a.txt': 'a', 'web/b.txt': 'b'}, + ); + + // The --output option creates a merged output directory. + await tester.run('root_pkg', 'dart run build_runner build --output build'); + expect(tester.read('root_pkg/build/web/a.txt.copy'), 'a'); + expect(tester.read('root_pkg/build/web/b.txt.copy'), 'b'); + + // The --output option filters to --build-filter. + await tester.run( + 'root_pkg', + 'dart run build_runner build --output build --build-filter web/b.txt.copy', + ); + expect(tester.read('root_pkg/build/web/a.txt.copy'), null); + expect(tester.read('root_pkg/build/web/b.txt.copy'), 'b'); + + // The --output option accepts a root. + await tester.run( + 'root_pkg', + 'dart run build_runner build --output web:build', + ); + expect(tester.read('root_pkg/build/a.txt.copy'), 'a'); + expect(tester.read('root_pkg/build/b.txt.copy'), 'b'); + + // The --output option can be passed multiple times. + await tester.run( + 'root_pkg', + 'dart run build_runner build --output build1 --output build2', + ); + expect(tester.read('root_pkg/build1/web/a.txt.copy'), 'a'); + expect(tester.read('root_pkg/build1/web/b.txt.copy'), 'b'); + expect(tester.read('root_pkg/build2/web/a.txt.copy'), 'a'); + expect(tester.read('root_pkg/build2/web/b.txt.copy'), 'b'); + + // Duplicate --output options are an error. + var output = await tester.run( + 'root_pkg', + 'dart run build_runner build --output web:build --output test:build', + expectExitCode: ExitCode.usage.code, + ); + expect( + output, + contains( + 'Invalid argument (--output): Duplicate output directories are not ' + 'allowed, got: "web:build test:build"', + ), + ); + + // Can only specify top level directories to build. + output = await tester.run( + 'root_pkg', + 'dart run build_runner build --output lib/something:build', + expectExitCode: ExitCode.usage.code, + ); + expect( + output, + contains( + 'Invalid argument (--output): Input root can not be nested: ' + '"lib/something:build"', + ), + ); + + // Correct output with specified folder and --symlink. + await tester.run( + 'root_pkg', + 'dart run build_runner build --output web:build_web --symlink', + ); + expect(tester.read('root_pkg/build_web/a.txt.copy'), 'a'); + expect(tester.read('root_pkg/build_web/b.txt.copy'), 'b'); + + // The --output option refuses to overwrite an existing directory if it + // does not contain the expected manifest file. + tester.delete('root_pkg/build/.build.manifest'); + output = await tester.run( + 'root_pkg', + 'dart run build_runner build --output build', + expectExitCode: ExitCode.cantCreate.code, + ); + expect( + output, + contains( + 'Choose a different directory or delete the contents of that ' + 'directory.', + ), + ); + }); +} diff --git a/build_runner/test/integration_tests/build_integration_test.dart b/build_runner/test/integration_tests/build_integration_test.dart deleted file mode 100644 index 843661fd8..000000000 --- a/build_runner/test/integration_tests/build_integration_test.dart +++ /dev/null @@ -1,768 +0,0 @@ -// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:path/path.dart' as p; -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import '../common/common.dart'; - -void main() { - group('build integration tests', () { - group('build script', () { - final originalBuildContent = ''' -import 'dart:io'; -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -main(List args) async { - exitCode = await run( - args, [applyToRoot(new TestBuilder())]); -} -'''; - setUp(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - 'glob', - ], - ), - d.dir('tool', [d.file('build.dart', originalBuildContent)]), - d.dir('web', [d.file('a.txt', 'a')]), - ]).create(); - - await pubGet('a'); - - // Run a build and validate the output. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - await d.dir('a', [ - d.dir('web', [d.file('a.txt.copy', 'a')]), - ]).validate(); - }); - - test('updates cause a rebuild', () async { - // Append a newline to the build script! - await d.dir('a', [ - d.dir('tool', [d.file('build.dart', '$originalBuildContent\n')]), - ]).create(); - - // Run a build and validate the full rebuild output. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - expect( - result.stdout, - contains('Building, full build because builders changed.'), - ); - await d.dir('a', [ - d.dir('web', [d.file('a.txt.copy', 'a')]), - ]).validate(); - }); - - test('updates can change extensions', () async { - // Update the extension from .copy to .copy2 - final changedBuildScript = originalBuildContent.replaceFirst( - 'TestBuilder()', - "TestBuilder(buildExtensions: appendExtension('.copy2'))", - ); - await d.dir('a', [ - d.dir('tool', [d.file('build.dart', changedBuildScript)]), - ]).create(); - - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - expect( - result.stdout, - contains('Building, full build because target changed.'), - ); - - // Running a new builder should delete the old generated asset and add - // the new copy. - await d.dir('a', [ - d.dir('web', [d.file('a.txt.copy2', 'a'), d.nothing('a.txt.copy')]), - ]).validate(); - }); - - test('--output creates a merged directory', () async { - // Run a build and validate the full rebuild output. - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['build', '--output', 'build'], - ); - expect(result.exitCode, 0, reason: result.stderr as String); - await d.dir('a', [ - d.dir('build', [ - d.dir('web', [d.file('a.txt.copy', 'a')]), - ]), - ]).validate(); - }); - - test('--output respects build filters', () async { - await d.dir('a', [ - d.dir('web', [d.file('b.txt', 'b')]), - ]).create(); - // Run a build and validate the full rebuild output. - final result = await runDart( - 'a', - 'tool/build.dart', - args: [ - 'build', - '--output', - 'build', - '--build-filter', - 'web/b.txt.copy', - ], - ); - expect(result.exitCode, 0, reason: result.stderr as String); - await d.dir('a', [ - d.dir('build', [ - d.dir('web', [d.nothing('a.txt.copy'), d.file('b.txt.copy', 'b')]), - ]), - ]).validate(); - }); - - test('when --output fails a proper error code is returned', () async { - await d.dir('a', [ - d.dir('build', [d.file('non_empty', 'blah')]), - ]).create(); - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['build', '--output', 'build'], - ); - expect(result.exitCode, 73, reason: result.stderr as String); - }); - - test( - '--output creates a merged directory from the provided root', - () async { - // Run a build and validate the full rebuild output. - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['build', '--output', 'web:build'], - ); - expect(result.exitCode, 0, reason: result.stderr as String); - await d.dir('a', [ - d.dir('build', [d.file('a.txt.copy', 'a')]), - ]).validate(); - }, - ); - - test( - 'multiple --output options create multiple merged directories', - () async { - // Run a build and validate the full rebuild output. - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['build', '--output', 'build', '--output', 'foo'], - ); - expect(result.exitCode, 0, reason: result.stderr as String); - await d.dir('a', [ - d.dir('build', [ - d.dir('web', [d.file('a.txt.copy', 'a')]), - ]), - d.dir('foo', [ - d.dir('web', [d.file('a.txt.copy', 'a')]), - ]), - ]).validate(); - }, - ); - }); - - group('--build-filter', () { - setUp(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - 'glob', - ], - pathDependencies: {'b': '../b'}, - ), - d.dir('tool', [ - d.file('build.dart', ''' -import 'dart:io'; -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -main(List args) async { - exitCode = await run( - args, [ - apply('', [(_) => TestBuilder()], toAllPackages(), hideOutput: true) - ]); -} -'''), - ]), - d.dir('lib', [d.file('a.txt', 'a'), d.file('b.txt', 'b')]), - d.dir('web', [d.file('a.txt', 'a'), d.file('b.txt', 'b')]), - ]).create(); - - await d.dir('b', [ - await pubspec('b'), - d.dir('lib', [d.file('a.txt', 'a'), d.file('b.txt', 'b')]), - ]).create(); - - await pubGet('a'); - }); - - test('only builds matching files', () async { - await runBuild( - extraArgs: [ - '--build-filter', - 'package:*/a.txt.copy', - '--build-filter', - 'web/a.txt.copy', - ], - ); - await d.dir('a', [ - d.dir('.dart_tool', [ - d.dir('build', [ - d.dir('generated', [ - d.dir('a', [ - d.dir('lib', [ - d.file('a.txt.copy', 'a'), - d.nothing('b.txt.copy'), - ]), - d.dir('web', [ - d.file('a.txt.copy', 'a'), - d.nothing('b.txt.copy'), - ]), - ]), - d.dir('b', [ - d.dir('lib', [ - d.file('a.txt.copy', 'a'), - d.nothing('b.txt.copy'), - ]), - ]), - ]), - ]), - ]), - ]).validate(); - }); - }); - - group('findAssets', () { - setUp(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - 'glob', - ], - ), - d.dir('tool', [ - d.file('build.dart', ''' -import 'dart:async'; - -import 'package:build/build.dart'; -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; -import 'package:glob/glob.dart'; - -main() async { - await run( - ['build'], - [applyToRoot(new GlobbingBuilder(new Glob('**.txt')))]); -} -'''), - ]), - d.dir('web', [ - d.file('a.globPlaceholder'), - d.file('a.txt', ''), - d.file('b.txt', ''), - ]), - ]).create(); - - await pubGet('a'); - - // Run a build and validate the output. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - await d.dir('a', [ - d.dir('web', [d.file('a.matchingFiles', 'a|web/a.txt\na|web/b.txt')]), - ]).validate(); - }); - - test('picks up new files that match the glob', () async { - // Add a new file matching the glob. - await d.dir('a', [ - d.dir('web', [d.file('c.txt', '')]), - ]).create(); - - // Run a new build and validate. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(result.stdout, contains('wrote 1 output')); - await d.dir('a', [ - d.dir('web', [ - d.file('a.matchingFiles', 'a|web/a.txt\na|web/b.txt\na|web/c.txt'), - ]), - ]).validate(); - }); - - test('picks up deleted files that match the glob', () async { - // Delete a file matching the glob. - File(p.join(d.sandbox, 'a', 'web', 'a.txt')).deleteSync(); - - // Run a new build and validate. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(result.stdout, contains('wrote 1 output')); - await d.dir('a', [ - d.dir('web', [d.file('a.matchingFiles', 'a|web/b.txt')]), - ]).validate(); - }); - - test('doesn\'t cause new builds for files that don\'t match ' - 'any globs', () async { - // Add a new file not matching the glob. - await d.dir('a', [ - d.dir('web', [d.file('c.other', '')]), - ]).create(); - - // Run a new build and validate. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(result.stdout, contains('wrote 0 outputs')); - await d.dir('a', [ - d.dir('web', [d.file('a.matchingFiles', 'a|web/a.txt\na|web/b.txt')]), - ]).validate(); - }); - - test('doesn\'t cause new builds for file changes', () async { - // Change a file matching the glob. - await d.dir('a', [ - d.dir('web', [d.file('a.txt', 'changed!')]), - ]).create(); - - // Run a new build and validate. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(result.stdout, contains('wrote 0 outputs')); - await d.dir('a', [ - d.dir('web', [d.file('a.matchingFiles', 'a|web/a.txt\na|web/b.txt')]), - ]).validate(); - }); - }); - - group('findAssets with no initial output', () { - setUp(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - 'glob', - ], - ), - d.dir('tool', [ - d.file('build.dart', ''' -import 'dart:async'; - -import 'package:build/build.dart'; -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; -import 'package:glob/glob.dart'; - -main() async { - await run( - ['build'], - [applyToRoot(new OverDeclaringGlobbingBuilder( - new Glob('**.txt')))]); -} - -class OverDeclaringGlobbingBuilder extends GlobbingBuilder { - OverDeclaringGlobbingBuilder(Glob glob) : super(glob); - - @override - Future build(BuildStep buildStep) async { - var assets = await buildStep.findAssets(glob).toList(); - // Only output if we have a 'web/b.txt' file. - if (assets.any((id) => id.path == 'web/b.txt')) { - await super.build(buildStep); - } - } -} -'''), - ]), - d.dir('web', [d.file('a.globPlaceholder'), d.file('a.txt', '')]), - ]).create(); - - await pubGet('a'); - - // Run a build and validate the output. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(result.stdout, contains('wrote 0 outputs')); - await d.dir('a', [ - d.dir('web', [d.nothing('a.matchingFiles')]), - ]).validate(); - }); - - test('picks up new files that match the glob', () async { - // Add a new file matching the glob which causes a real output. - await d.dir('a', [ - d.dir('web', [d.file('b.txt', '')]), - ]).create(); - - // Run a new build and validate. - final result = await runDart('a', 'tool/build.dart', args: ['build']); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(result.stdout, contains('wrote 1 output')); - await d.dir('a', [ - d.dir('web', [d.file('a.matchingFiles', 'a|web/a.txt\na|web/b.txt')]), - ]).validate(); - }); - }); - - group('--define overrides build.yaml', () { - final buildContent = ''' -import 'package:build/build.dart'; -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -main(List args) async { - var buildApplications = [ - apply( - 'root:copy', - [ - (options) { - var copyFromId = options.config['copy_from']; - var build = copyFromId != null ? - copyFrom(new AssetId.parse(copyFromId)) : null; - return new TestBuilder( - buildExtensions: appendExtension('.copy', from: '.txt'), - build: build); - } - ], - toRoot(), - hideOutput: false, - isOptional: false), - ]; - await run(args, buildApplications); -} -'''; - - /// Expects the build output based on [expectedContent]. - Future expectBuildOutput(String expectedContent) async { - await d.dir('a', [ - d.dir('web', [ - d.file('a.txt', 'a'), - d.file('a.txt.copy', expectedContent), - ]), - ]).validate(); - } - - test('--define overrides build.yaml', () async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - ], - ), - d.file('build.yaml', r''' -targets: - $default: - builders: - root:copy: - options: - copy_from: a|web/b.txt -'''), - d.dir('tool', [d.file('build.dart', buildContent)]), - d.dir('web', [ - d.file('a.txt', 'a'), - d.file('b.txt', 'b'), - d.file('c.txt', 'c'), - ]), - ]).create(); - - await pubGet('a'); - - // Run a basic build with no --define config. - await runBuild(); - await expectBuildOutput('b'); - - // Run another build but add the --define. - await runBuild(extraArgs: ['--define=root:copy=copy_from=a|web/c.txt']); - await expectBuildOutput('c'); - }); - }); - }); - - group('config validation', () { - final buildContent = ''' -import 'package:build/build.dart'; -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -main(List args) async { - var buildApplications = [ - apply('root:copy', [(_) => new TestBuilder()], toRoot(), - hideOutput: false, isOptional: false), - ]; - await run(args, buildApplications); -} -'''; - - test('warns on invalid builder key in target options', () async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - ], - ), - d.file('build.yaml', r''' -targets: - $default: - builders: - bad:builder: - enabled: true -'''), - d.dir('tool', [d.file('build.dart', buildContent)]), - d.dir('web', [d.file('a.txt', 'a')]), - ]).create(); - - await pubGet('a'); - - final result = await runBuild(); - - expect( - result, - contains( - 'Ignoring options for unknown builder `bad:builder` in target `a:a`.', - ), - ); - }); - - test('warns on invalid builder key in global options', () async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - ], - ), - d.file('build.yaml', r''' -global_options: - bad:builder: - options: {} -'''), - d.dir('tool', [d.file('build.dart', buildContent)]), - d.dir('web', [d.file('a.txt', 'a')]), - ]).create(); - - await pubGet('a'); - - final result = await runBuild(); - - expect( - result, - contains( - 'Ignoring `global_options` for unknown builder `bad:builder`.', - ), - ); - }); - - test('warns on invalid builder key --define', () async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - ], - ), - d.dir('tool', [d.file('build.dart', buildContent)]), - d.dir('web', [d.file('a.txt', 'a')]), - ]).create(); - - await pubGet('a'); - - final result = await runBuild(extraArgs: ['--define=bad:key=foo=bar']); - - expect( - result, - contains('Ignoring options overrides for unknown builder `bad:key`.'), - ); - }); - }); - - group('regression tests', () { - test('checking for existing outputs works with deleted ' - 'intermediate outputs', () async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - 'glob', - ], - ), - d.dir('tool', [ - d.file('build.dart', ''' -import 'dart:io'; - -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -main() async { - exitCode = await run( - ['build'], - [ - applyToRoot(new TestBuilder()), - applyToRoot(new TestBuilder( - buildExtensions: appendExtension('.copy', from: '.txt.copy'))), - ]); -} -'''), - ]), - d.dir('web', [d.file('a.txt', 'a'), d.file('a.txt.copy.copy', 'a')]), - ]).create(); - - await pubGet('a'); - - final result = await runDart('a', 'tool/build.dart', args: ['build']); - - expect(result.exitCode, 0, reason: result.stderr as String); - }); - - test('Missing build_test dependency reports the right error', () async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'code_builder', - ], - ), - d.dir('web', [d.file('a.txt', 'a')]), - ]).create(); - - await pubGet('a'); - final result = await runPub('a', 'run', args: ['build_runner', 'test']); - - expect( - result.exitCode, - isNot(0), - reason: 'build should fail due to missing build_test dependency', - ); - expect( - result.stdout, - contains('Missing dev dependency on package:build_test'), - ); - }); - - test('Missing build_web_compilers dependency warns the user', () async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - ], - ), - d.dir('web', [d.file('a.dart', 'void main() {}')]), - ]).create(); - - await pubGet('a'); - final result = await startPub( - 'a', - 'run', - args: ['build_runner', 'serve'], - ); - addTearDown(result.kill); - final error = 'Missing dev dependency on package:build_web_compilers'; - - await for (final log in result.stdout.transform(utf8.decoder)) { - if (log.contains(error)) { - return; - } - } - - fail('No warning issued when running the "serve" command'); - }); - }); -} - -Future runBuild({List extraArgs = const []}) async { - final buildArgs = ['build', '-o', 'build', ...extraArgs]; - final result = await runDart('a', 'tool/build.dart', args: buildArgs); - expect(result.exitCode, 0, reason: '${result.stdout}\n${result.stderr}'); - printOnFailure('${result.stdout}\n${result.stderr}'); - return '${result.stdout}'; -} diff --git a/build_runner/test/integration_tests/build_invalidation_test.dart b/build_runner/test/integration_tests/build_invalidation_test.dart deleted file mode 100644 index a0c233ec2..000000000 --- a/build_runner/test/integration_tests/build_invalidation_test.dart +++ /dev/null @@ -1,214 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'dart:async'; -import 'dart:io'; - -import 'package:build_runner/src/bootstrap/build_script_generate.dart'; -import 'package:build_runner/src/constants.dart'; -import 'package:build_test/build_test.dart'; -import 'package:path/path.dart' as p; -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import 'utils/build_descriptor.dart'; - -// test-package-start ######################################################### -// $comment$ -final copyBuilder = TestBuilder(); -// test-package-end ########################################################### - -void main() { - final builders = [builder('copyBuilder', copyBuilder)]; - - late BuildTool buildTool; - late d.Descriptor builderPackage; - - setUpAll(() async { - builderPackage = await packageWithBuilders(builders); - buildTool = await package( - [builderPackage], - packageContents: [ - d.file('build.yaml', '#comment'), - d.dir('web', [d.file('a.txt', 'a')]), - ], - ); - }); - - tearDown(() async { - // Restore the files to their original state - final builderFile = File( - p.join(d.sandbox, builderPackage.name, 'lib', 'builders.dart'), - ); - await builderFile.writeAsString( - (await builderFile.readAsString()).replaceFirst( - r'$updated$', - r'$comment$', - ), - ); - final buildConfig = File(p.url.join(d.sandbox, 'a', 'build.yaml')); - await buildConfig.writeAsString( - (await buildConfig.readAsString()).replaceFirst('#updated', '#comment'), - ); - }); - - Future changeBuilders() async { - final builderFile = File( - p.join(d.sandbox, builderPackage.name, 'lib', 'builders.dart'), - ); - await builderFile.writeAsString( - (await builderFile.readAsString()).replaceFirst( - r'$comment$', - r'$updated$', - ), - ); - } - - Future changeBuildConfig() async { - final buildConfig = File(p.url.join(d.sandbox, 'a', 'build.yaml')); - // Update a comment - await buildConfig.writeAsString( - (await buildConfig.readAsString()).replaceFirst('#comment', '#updated'), - ); - } - - group('Invalidates next build', () { - late File markerFile; - setUp(() async { - // Run a first build before invalidation. - await buildTool.build(); - - // Add a marker file to check that generated directory is cleaned. - markerFile = File( - p.join( - d.sandbox, - 'a', - '.dart_tool', - 'build', - 'generated', - 'a', - 'marker_file.txt', - ), - ); - await markerFile.writeAsString('marker'); - }); - - tearDown(() async { - expect( - await markerFile.exists(), - isFalse, - reason: 'Cache dir should be cleaned on invalidated builds.', - ); - }); - - test('for changed dart source', () async { - await changeBuilders(); - - final secondBuild = await buildTool.build(); - - await expectOutput(secondBuild, [ - 'Compiling the build script.', - 'Creating the asset graph.', - 'Building, full build because builders changed.', - ]); - }); - - test('for invalid asset graph version', () async { - final assetGraph = File( - p.join(d.sandbox, 'a', assetGraphPathFor(scriptKernelLocation)), - ); - // Prepend a 1 to the version number - await assetGraph.writeAsString( - (await assetGraph.readAsString()).replaceFirst( - '"version":', - '"version":1', - ), - ); - - final secondBuild = await buildTool.build(); - - await expectOutput(secondBuild, [ - 'Creating the asset graph.', - 'Building, full build because there is no valid asset graph.', - ]); - }); - }); - - group('Recreates snapshot while serving', () { - late BuildServer server; - - setUp(() async { - server = await buildTool.serve(); - await server.nextSuccessfulBuild; - }); - - test('for changed dart source', () async { - await changeBuilders(); - - await expectOutput(server.stdout, [ - 'Terminating builds due to build script update', - 'Compiling the build script.', - 'Creating the asset graph.', - ]); - - await server.shutDown(); - }); - - test('for changed build config', () async { - await changeBuildConfig(); - - // Terminates and reruns, but does not invalidate build - await expectOutput(server.stdout, [ - 'Terminating builds due to a:build.yaml update', - 'Builds finished. Safe to exit', - 'wrote 0 outputs', - ]); - - await server.shutDown(); - }); - }); - - test('Recreates snapshot for changed core dependency path', () async { - // Run a first build before invalidation. - await buildTool.build(); - - final locationsFile = File( - p.join( - d.sandbox, - 'a', - '.dart_tool', - 'build', - 'entrypoint', - '.packageLocations', - ), - ); - // Modify the contents in some way - await locationsFile.writeAsString( - '${await locationsFile.readAsString()}' - '\nmodified!', - ); - - final secondBuild = await buildTool.build(); - - await expectOutput(secondBuild, [ - 'Compiling the build script.', - 'Building, full build because builders changed.', - ]); - }); - - test('Does not recreate snapshot if nothing changes', () async { - // Run a first build before invalidation. - await buildTool.build(); - - final secondBuild = await buildTool.build(); - await expectLater( - secondBuild, - neverEmits('Creating build script snapshot'), - reason: 'should not invalidate the previous snapshot', - ); - }); -} diff --git a/build_runner/test/integration_tests/clean_command_test.dart b/build_runner/test/integration_tests/clean_command_test.dart new file mode 100644 index 000000000..445c50666 --- /dev/null +++ b/build_runner/test/integration_tests/clean_command_test.dart @@ -0,0 +1,31 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('clean command', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + files: {}, + ); + + await tester.run('root_pkg', 'dart run build_runner build'); + expect( + tester.read('root_pkg/.dart_tool/build/entrypoint/build.dart'), + isNotNull, + ); + await tester.run('root_pkg', 'dart run build_runner clean'); + expect(tester.readFileTree('root_pkg/.dart_tool/build'), isNull); + }); +} diff --git a/build_runner/test/integration_tests/clean_integration_test.dart b/build_runner/test/integration_tests/clean_integration_test.dart deleted file mode 100644 index 3e378d59d..000000000 --- a/build_runner/test/integration_tests/clean_integration_test.dart +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import '../common/common.dart'; - -void main() { - group('clean command', () { - setUp(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - 'glob', - ], - ), - d.dir('tool', [d.file('build.dart', buildFile)]), - d.dir('web', [d.file('a.txt', 'a')]), - ]).create(); - - await pubGet('a'); - - // Run a build and validate the output. - final buildResult = await runDart( - 'a', - 'tool/build.dart', - args: ['build'], - ); - expect(buildResult.exitCode, 0); - await d.dir('a', [ - d.dir('web', [d.file('a.txt.copy', 'a')]), - d.dir('.dart_tool', [d.dir('build')]), - ]).validate(); - }); - - test('cleans up .dart_tool', () async { - final cleanResult = await runDart( - 'a', - 'tool/build.dart', - args: ['clean'], - ); - expect(cleanResult.exitCode, 0); - await d.dir('a', [ - d.dir('.dart_tool', [d.nothing('build')]), - ]).validate(); - }); - }); -} - -const buildFile = ''' -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -main(List args) async { - await run( - args, [applyToRoot(new TestBuilder())]); -} -'''; diff --git a/build_runner/test/integration_tests/errors_test.dart b/build_runner/test/integration_tests/errors_test.dart deleted file mode 100644 index bc7563814..000000000 --- a/build_runner/test/integration_tests/errors_test.dart +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'package:build_test/build_test.dart'; -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import 'utils/build_descriptor.dart'; - -// test-package-start ######################################################### -final alwaysThrow = TestBuilder( - buildExtensions: { - '.txt': ['.txt.copy'], - }, - build: (_, _) { - throw StateError('Build action failure'); - }, -); -// test-package-end ########################################################### - -void main() { - final builders = [builder('alwaysThrow', alwaysThrow)]; - - late BuildTool buildTool; - - setUpAll(() async { - buildTool = await packageWithBuildScript( - builders, - contents: [ - d.dir('web', [d.file('a.txt', 'a')]), - ], - ); - }); - - group('build', () { - test('replays errors on builds with no change', () async { - final firstBuild = await buildTool.build(expectExitCode: 1); - await expectLater( - firstBuild, - emitsThrough(contains('Build action failure')), - ); - - // Run another build, no action should run but the failure will be logged - // again - final nextBuild = await buildTool.build(expectExitCode: 1); - await expectLater( - nextBuild, - emitsThrough(contains('Build action failure')), - ); - }); - }); -} diff --git a/build_runner/test/integration_tests/optional_outputs_test.dart b/build_runner/test/integration_tests/optional_outputs_test.dart deleted file mode 100644 index 41ee263a0..000000000 --- a/build_runner/test/integration_tests/optional_outputs_test.dart +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'dart:async'; - -import 'package:build_test/build_test.dart'; -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import 'utils/build_descriptor.dart'; - -// test-package-start ######################################################### -/// Copies an asset to both `.txt.copy` and `.txt.extra`. -final copyTwice = TestBuilder( - buildExtensions: { - '.txt': ['.txt.copy', '.txt.extra'], - }, -); - -/// Reads `.txt.copy` files if the primary input contains "true". -final maybeReadCopy = TestBuilder( - buildExtensions: appendExtension('.other', from: '.txt'), - extraWork: (buildStep, _) async { - if ((await buildStep.readAsString(buildStep.inputId)).contains('true')) { - await buildStep.readAsString(buildStep.inputId.addExtension('.copy')); - } - }, -); -// test-package-end ########################################################### - -void main() { - final builders = [ - builder('copyTwice', copyTwice, isOptional: true), - builder('maybeReadCopy', maybeReadCopy, requiredInputs: ['.txt.copy']), - ]; - - late BuildTool buildTool; - - setUpAll(() async { - buildTool = await packageWithBuildScript( - builders, - contents: [ - d.dir('web', [d.file('a.txt', 'false')]), - ], - ); - }); - - Future updateTxtContent(String content) { - return d.dir('a', [ - d.dir('web', [d.file('a.txt', content)]), - ]).create(); - } - - group('serve', () { - test('only serves assets that were actually required', () async { - final server = await buildTool.serve(); - await server.started; - - await server.expect404('a.txt.copy'); - await server.expect404('a.txt.extra'); - - await updateTxtContent('true'); - - await server.nextSuccessfulBuild; - - await server.expectContent('a.txt.copy', 'true'); - await server.expectContent('a.txt.extra', 'true'); - - await updateTxtContent('false'); - - await server.nextSuccessfulBuild; - - await server.expect404('a.txt.copy'); - await server.expect404('a.txt.extra'); - - await server.shutDown(); - }); - }); - - group('build', () { - /// Expects the build output based on [expectCopy]. - Future expectBuildOutput({ - required bool expectCopy, - required String content, - }) async { - await d.dir('a', [ - d.dir('build', [ - d.dir('web', [ - d.file('a.txt', content), - d.file('a.txt.other', content), - expectCopy - ? d.file('a.txt.copy', content) - : d.nothing('a.txt.copy'), - expectCopy - ? d.file('a.txt.extra', content) - : d.nothing('a.txt.extra'), - ]), - ]), - ]).validate(); - } - - test('only copies assets that were actually required', () async { - await buildTool.build(args: const ['-o', 'build']); - await expectBuildOutput(expectCopy: false, content: 'false'); - - // Run another build but with the file indicating that the copy should be - // read - await updateTxtContent('true'); - await buildTool.build(args: const ['-o', 'build']); - await expectBuildOutput(expectCopy: true, content: 'true'); - - // Run again without reading the copy, should not copy over the .copy - // file even though it does exist now. - await updateTxtContent('false'); - await buildTool.build(args: const ['-o', 'build']); - await expectBuildOutput(expectCopy: false, content: 'false'); - }); - }); -} diff --git a/build_runner/test/integration_tests/run_command_test.dart b/build_runner/test/integration_tests/run_command_test.dart new file mode 100644 index 000000000..fa2ccceb9 --- /dev/null +++ b/build_runner/test/integration_tests/run_command_test.dart @@ -0,0 +1,134 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:io/io.dart'; +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('run command', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writePackage( + name: 'builder_pkg', + dependencies: ['build', 'build_runner'], + files: { + 'build.yaml': ''' +builders: + test_builder: + import: 'package:builder_pkg/builder.dart' + builder_factories: ['testBuilderFactory'] + build_extensions: {'.txt': ['.txt.copy']} + auto_apply: root_package + build_to: source +''', + 'lib/builder.dart': ''' +import 'package:build/build.dart'; + +Builder testBuilderFactory(BuilderOptions options) => TestBuilder(); + +class TestBuilder implements Builder { + @override + Map> get buildExtensions => {'.dart': ['.copy.dart']}; + + @override + Future build(BuildStep buildStep) async { + buildStep.writeAsString( + buildStep.inputId.changeExtension('.copy.dart'), + await buildStep.readAsString(buildStep.inputId), + ); + } +} +''', + }, + ); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: { + 'bin/main.txt': '', + 'bin/main.dart': r''' +import 'dart:io'; + +void main(List args) { + print('script is running'); + print('args: $args'); + if (args.contains('throw')) { + throw ArgumentError('asked to throw'); + } +} +''', + }, + ); + + // Message when script to run is omitted. + var output = await tester.run( + 'root_pkg', + 'dart run build_runner run', + expectExitCode: ExitCode.usage.code, + ); + expect(output, contains('Must specify an executable to run.')); + + // Message when script to run does not end `.dart`. + output = await tester.run( + 'root_pkg', + 'dart run build_runner run bin/main.txt.copy', + expectExitCode: ExitCode.usage.code, + ); + expect(output, contains('is not a valid Dart file')); + + // Message output when script to run is missing. + output = await tester.run( + 'root_pkg', + 'dart run build_runner run bin/nonexistent.dart', + expectExitCode: ExitCode.ioError.code, + ); + expect( + output, + contains( + 'Could not spawn isolate. Ensure that your file is in a valid ' + 'directory', + ), + ); + + // Run script as it was copied by the build. + output = await tester.run( + 'root_pkg', + 'dart run build_runner run bin/main.copy.dart', + ); + expect(output, contains('script is running')); + + // Works with --output. + output = await tester.run( + 'root_pkg', + 'dart run build_runner run bin/main.copy.dart --output build', + ); + expect(output, contains('script is running')); + + // Args are passed to the script. + output = await tester.run( + 'root_pkg', + 'dart run build_runner run bin/main.copy.dart -- a b c', + ); + expect(output, contains('script is running')); + expect(output, contains('args: [a, b, c]')); + + // Script error exit is handled. + output = await tester.run( + 'root_pkg', + 'dart run build_runner run bin/main.copy.dart -- throw', + expectExitCode: 1, + ); + expect(output, contains('Unhandled error from script:')); + expect(output, contains('asked to throw')); + // Stack trace mentions the script path. + expect(output, contains('bin/main.copy.dart')); + }); +} diff --git a/build_runner/test/integration_tests/run_script_test.dart b/build_runner/test/integration_tests/run_script_test.dart deleted file mode 100644 index 49fbb477f..000000000 --- a/build_runner/test/integration_tests/run_script_test.dart +++ /dev/null @@ -1,225 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'dart:convert'; - -import 'package:io/io.dart'; -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import '../common/common.dart'; - -void main() { - group('run_script validation tests', () { - // The TestBuilder() will create a `*.copy` of - // whatever it is given, so we'll use it to create a - // copy of an executable Dart file (bin/main.dart). - // - // The expected output of running the generated file - // will be "it works!". - setUp(() async { - final executableFileContent = ''' -import 'dart:io'; - -void main(List args) { - if (args.isEmpty) { - print("it works!"); - } else if (args[0] == "throw") { - throw StateError('oh no!'); - } else if (args[0] == "print_uri") { - print(Platform.script); - } else { - print(args.join(';')); - } -} - '''; - final originalBuildContent = ''' -import 'dart:io'; -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -main(List args) async { - exitCode = await run( - args, [applyToRoot(new TestBuilder( - buildExtensions: { - '.dart': ['.copy.dart'], - '.txt': ['.txt.copy'] - } - ))]); -} -'''; - - // Create the sandbox directory, including a build script, - // and the actual executable file. - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - 'glob', - ], - ), - d.dir('bin', [ - d.file('main.dart', executableFileContent), - d.file('main.txt', 'cannot run this'), - ]), - d.dir('tool', [d.file('build.dart', originalBuildContent)]), - ]).create(); - - // Get the dependencies. - await pubGet('a'); - - // We don't need to run a build in the setUp() closure, because - // that's not the functionality we're testing. - }); - - test('at least one argument must be provided', () async { - // Should throw error 64. - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['run', '--output', 'build'], - ); - expect( - result.exitCode, - ExitCode.usage.code, - reason: result.stderr as String, - ); - expect(result.stdout, contains('Must specify an executable to run.')); - }); - - test('extension must be .dart', () async { - // Should throw error 64. - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['run', 'bin/main.txt.copy', '--output', 'build'], - ); - expect( - result.exitCode, - ExitCode.usage.code, - reason: result.stderr as String, - ); - expect( - result.stdout, - contains('is not a valid Dart file and cannot be run in the VM.'), - ); - }); - - test('target file must actually exist', () async { - // Should throw error 64. - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['run', 'bin/nonexistent.dart', '--output', 'build'], - ); - expect( - result.exitCode, - ExitCode.ioError.code, - reason: result.stderr as String, - ); - expect( - result.stdout, - contains( - 'Could not spawn isolate. Ensure that your file is in a valid ' - 'directory', - ), - ); - }); - - test('runs the built version of the desired script', () async { - // Run the generated script, and examine its output. - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['run', 'bin/main.copy.dart', '--output', 'build'], - ); - final lastLine = - const LineSplitter().convert(result.stdout as String).last.trim(); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(lastLine, 'it works!', reason: result.stderr as String); - }); - - test('runs even if no output directory is given', () async { - // Verify that the script runs (it'll be generated into a temp dir) - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['run', 'bin/main.copy.dart'], - ); - final lastLine = - const LineSplitter().convert(result.stdout as String).last.trim(); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(lastLine, 'it works!', reason: result.stderr as String); - }); - - test('passes input args', () async { - // Run the generated script, and examine its output. - final result = await runDart( - 'a', - 'tool/build.dart', - args: [ - 'run', - 'bin/main.copy.dart', - '--output', - 'build', - '--', - 'a', - 'b', - 'c', - ], - ); - final lastLine = - const LineSplitter().convert(result.stdout as String).last.trim(); - expect(result.exitCode, 0, reason: result.stderr as String); - expect(lastLine, 'a;b;c', reason: result.stderr as String); - }); - - test('errors thrown in script result in non-zero exit', () async { - // Run the generated script, and examine its output. - final result = await runDart( - 'a', - 'tool/build.dart', - args: ['run', 'bin/main.copy.dart', '--output', 'build', '--', 'throw'], - ); - expect(result.exitCode, 1, reason: result.stderr as String); - expect(result.stdout, contains('Unhandled error from script:')); - expect(result.stdout, contains('Bad state: oh no!')); - }); - - // TODO (thosakwe): Test for stack trace - test('stack trace from errors is displayed in verbose mode', () async { - // Run the generated script, and examine its output. - final result = await runDart( - 'a', - 'tool/build.dart', - args: [ - 'run', - 'bin/main.copy.dart', - '--verbose', - '--output', - 'build', - '--', - 'throw', - ], - ); - expect(result.exitCode, 1, reason: result.stderr as String); - expect(result.stdout, contains('Unhandled error from script:')); - expect(result.stdout, contains('Bad state: oh no!')); - // bin/main.copy.dart 5:5 main - expect(result.stdout, contains('bin/main.copy.dart')); - expect(result.stdout, contains('7:5')); - expect(result.stdout, contains('main')); - }); - }); -} diff --git a/build_runner/test/integration_tests/run_test.dart b/build_runner/test/integration_tests/run_test.dart deleted file mode 100644 index 468840f91..000000000 --- a/build_runner/test/integration_tests/run_test.dart +++ /dev/null @@ -1,260 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:async/async.dart'; -import 'package:build_runner/src/logging/build_log.dart'; -import 'package:io/io.dart'; -import 'package:path/path.dart' as p; -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import '../common/common.dart'; - -void main() { - setUpAll(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_modules', - 'build_runner', - 'build_test', - 'build_web_compilers', - 'code_builder', - 'test', - ], - ), - d.dir('test', [ - d.file('hello_test.dart', ''' -import 'package:test/test.dart'; -main() { - test('hello', () {}); -}'''), - ]), - d.dir('web', [ - d.file('main.dart', ''' -main() { - print('hello world'); -}'''), - ]), - ]).create(); - - await pubGet('a', offline: false); - }); - - tearDown(() async { - for (final file - in Directory( - p.join(d.sandbox, 'a'), - ).listSync(recursive: true).whereType()) { - if (file.path.endsWith('.dart') || - file.path.endsWith('.yaml') || - file.path.endsWith('.lock')) { - continue; - } - file.deleteSync(); - } - }); - - void expectOutput(String path, {required bool exists}) { - path = p.join( - d.sandbox, - 'a', - '.dart_tool', - 'build', - 'generated', - 'a', - path, - ); - expect(File(path).existsSync(), exists); - } - - Future runSingleBuild( - String command, - List args, { - StreamSink? stdoutSink, - }) async { - final process = await startPub('a', 'run', args: args); - final stdoutLines = - process.stdout - .transform(const Utf8Decoder()) - .transform(const LineSplitter()) - .asBroadcastStream() - ..listen((line) { - stdoutSink?.add(line); - printOnFailure(line); - }); - final queue = StreamQueue(stdoutLines); - if (command == 'serve' || command == 'watch') { - while (await queue.hasNext) { - final nextLine = await queue.next; - if (nextLine.contains(BuildLog.successPattern)) { - process.kill(); - await process.exitCode; - return ExitCode.success.code; - } else if (nextLine.contains(BuildLog.failurePattern)) { - process.kill(); - await process.exitCode; - return 1; - } - } - throw StateError('Build process exited without success or failure.'); - } - final result = await process.exitCode; - return result; - } - - group('Building explicit output directories', () { - void testBasicBuildCommand(String command) { - test('is supported by the $command command', () async { - final args = ['build_runner', command, 'web']; - expect(await runSingleBuild(command, args), ExitCode.success.code); - expectOutput('web/main.dart.js', exists: true); - expectOutput( - 'test/hello_test.dart.browser_test.dart.js', - exists: false, - ); - }); - } - - void testBuildCommandWithOutput(String command) { - test('works with -o and the $command command', () async { - final outputDirName = 'foo'; - final args = [ - 'build_runner', - command, - 'web', - '-o', - 'test:$outputDirName', - ]; - expect(await runSingleBuild(command, args), ExitCode.success.code); - expectOutput('web/main.dart.js', exists: true); - expectOutput('test/hello_test.dart.browser_test.dart.js', exists: true); - - final outputDir = Directory(p.join(d.sandbox, 'a', 'foo')); - await outputDir.delete(recursive: true); - }); - } - - for (final command in ['build', 'serve', 'watch']) { - testBasicBuildCommand(command); - testBuildCommandWithOutput(command); - } - - test('is not supported for the test command', () async { - final command = 'test'; - final args = ['build_runner', command, 'web']; - expect(await runSingleBuild(command, args), ExitCode.usage.code); - - args.addAll(['--', '-p chrome']); - expect(await runSingleBuild(command, args), ExitCode.usage.code); - }); - }); - - test('test builds only the test directory by default', () async { - final command = 'test'; - final args = ['build_runner', command]; - expect(await runSingleBuild(command, args), ExitCode.success.code); - expectOutput('web/main.dart.js', exists: false); - expectOutput('test/hello_test.dart.browser_test.dart.js', exists: true); - }); - - test('hoists output correctly even with --symlink', () async { - final command = 'build'; - final outputDirName = 'foo'; - final args = [ - 'build_runner', - command, - '-o', - 'web:$outputDirName', - '--symlink', - ]; - expect(await runSingleBuild(command, args), ExitCode.success.code); - final outputDir = Directory(p.join(d.sandbox, 'a', 'foo')); - expect( - File(p.join(outputDir.path, 'web', 'main.dart.js')).existsSync(), - isFalse, - ); - expect(File(p.join(outputDir.path, 'main.dart.js')).existsSync(), isTrue); - - await outputDir.delete(recursive: true); - }); - - test('Duplicate output directories give a nice error', () async { - final command = 'build'; - final args = [ - 'build_runner', - command, - '-o', - 'web:build', - '-o', - 'test:build', - ]; - final stdoutController = StreamController(); - expect( - await runSingleBuild(command, args, stdoutSink: stdoutController.sink), - ExitCode.usage.code, - ); - expect( - stdoutController.stream, - emitsThrough( - contains( - 'Invalid argument (--output): Duplicate output directories are not ' - 'allowed, got: "web:build test:build"', - ), - ), - ); - await stdoutController.close(); - }); - - test('Build directories have to be top level dirs', () async { - final command = 'build'; - final args = ['build_runner', command, '-o', 'foo/bar:build']; - final stdoutController = StreamController(); - expect( - await runSingleBuild(command, args, stdoutSink: stdoutController.sink), - ExitCode.usage.code, - ); - expect( - stdoutController.stream, - emitsThrough( - contains( - 'Invalid argument (--output): Input root can not be nested: ' - '"foo/bar:build"', - ), - ), - ); - await stdoutController.close(); - }); - - test('Handles socket errors gracefully', () async { - final server = await HttpServer.bind('localhost', 8080); - addTearDown(server.close); - - final process = await runPub( - 'a', - 'run', - args: ['build_runner', 'serve', 'web:8080'], - ); - expect(process.exitCode, ExitCode.osError.code); - expect( - process.stdout, - allOf( - contains('Error starting server'), - contains('8080'), - contains('address is already in use'), - ), - ); - }); -} diff --git a/build_runner/test/integration_tests/serve_command_serve_only_required_test.dart b/build_runner/test/integration_tests/serve_command_serve_only_required_test.dart new file mode 100644 index 000000000..a319f5378 --- /dev/null +++ b/build_runner/test/integration_tests/serve_command_serve_only_required_test.dart @@ -0,0 +1,52 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// TODO(davidmorgan): find unused port so this can run in parallel. +@Tags(['slow']) +library; + +import 'package:build_runner/src/logging/build_log.dart'; +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('serve command serves only required files', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writeFixturePackage(FixturePackages.optionalCopyAndReadBuilders); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: {'web/a.txt': 'a', 'web/b.txt': 'b'}, + ); + + final serve = await tester.start('root_pkg', 'dart run build_runner serve'); + + // Initial build produces no output as the copy is not required. + await serve.expect(BuildLog.successPattern); + await serve.expect404('a.txt.copy'); + + // Read a copy so that it is now required. + tester.write('root_pkg/web/new.read', 'root_pkg|web/a.txt.copy'); + await serve.expect(BuildLog.successPattern); + await serve.expectContent('a.txt.copy', 'a'); + + // Stop requiring the copy and it is no longer served. + tester.delete('root_pkg/web/new.read'); + await serve.expect(BuildLog.successPattern); + await serve.expect404('a.txt.copy'); + + // But it is not removed from the source tree. + expect(tester.readFileTree('root_pkg/web'), { + 'a.txt': 'a', + 'a.txt.copy': 'a', + 'b.txt': 'b', + }); + + await serve.kill(); + }); +} diff --git a/build_runner/test/integration_tests/serve_command_test.dart b/build_runner/test/integration_tests/serve_command_test.dart new file mode 100644 index 000000000..055c1d4ce --- /dev/null +++ b/build_runner/test/integration_tests/serve_command_test.dart @@ -0,0 +1,56 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// TODO(davidmorgan): find unused port so this can run in parallel. +@Tags(['integration']) +library; + +import 'dart:io'; + +import 'package:io/io.dart'; +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('serve command', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + files: {}, + ); + + final serve = await tester.start('root_pkg', 'dart run build_runner serve'); + await serve.expect( + 'Missing dev dependency on package:build_web_compilers, ' + 'which is required to serve Dart compiled to JavaScript.', + ); + await serve.expect('Found no known web directories to serve'); + await serve.kill(); + + // Create some source to serve. + tester.write('root_pkg/web/a.txt', 'a'); + + // Start a server on the same port, serve, check the error. + final server = await HttpServer.bind('localhost', 8080); + addTearDown(server.close); + final output = await tester.run( + 'root_pkg', + 'dart run build_runner serve web:8080', + expectExitCode: ExitCode.osError.code, + ); + expect( + output, + allOf( + contains('Error starting server'), + contains('8080'), + contains('address is already in use'), + ), + ); + await server.close(); + }); +} diff --git a/build_runner/test/integration_tests/serve_integration_test.dart b/build_runner/test/integration_tests/serve_integration_test.dart deleted file mode 100644 index 9819cab99..000000000 --- a/build_runner/test/integration_tests/serve_integration_test.dart +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import '../common/common.dart'; - -void main() { - group('serve integration tests', () { - late Process pubProcess; - late Stream pubStdOutLines; - - setUp(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - ], - ), - d.dir('lib', [d.file('example.dart', "String hello = 'hello'")]), - ]).create(); - - await pubGet('a'); - pubProcess = await startPub('a', 'run', args: ['build_runner', 'serve']); - pubStdOutLines = - pubProcess.stdout - .transform(const Utf8Decoder()) - .transform(const LineSplitter()) - .asBroadcastStream(); - }); - - tearDown(() async { - pubProcess.kill(); - await pubProcess.exitCode; - }); - - test('warns if it didnt find a directory to serve', () async { - expect( - pubStdOutLines, - emitsThrough(contains('Found no known web directories to serve')), - reason: 'never saw the warning', - ); - }); - }); -} diff --git a/build_runner/test/integration_tests/symlinks_test.dart b/build_runner/test/integration_tests/symlinks_test.dart deleted file mode 100644 index dd2a93cee..000000000 --- a/build_runner/test/integration_tests/symlinks_test.dart +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'dart:async'; -import 'dart:io'; - -import 'package:build_test/build_test.dart'; -import 'package:path/path.dart' as p; -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import 'utils/build_descriptor.dart'; - -// test-package-start ######################################################### -/// Reads a `.link` asset which is not the primary input and copies it. -final readThroughLink = TestBuilder( - buildExtensions: appendExtension('.copy', from: '.txt'), - build: (buildStep, _) { - buildStep.writeAsString( - buildStep.inputId.addExtension('.copy'), - buildStep.readAsString(buildStep.inputId.changeExtension('.link')), - ); - }, -); -// test-package-end ########################################################### - -void main() { - final builders = [builder('readThroughLink', readThroughLink)]; - - late BuildTool buildTool; - - setUpAll(() async { - buildTool = await packageWithBuildScript( - builders, - contents: [ - d.dir('web', [d.file('a.txt', 'a')]), - ], - ); - await Link( - p.join(buildTool.rootPackageDir, 'web', 'a.link'), - ).create(p.join(buildTool.rootPackageDir, 'outside_build', 'linked')); - }); - - Future updateLinkContent(String content) { - return d.dir('a', [ - d.dir('outside_build', [d.file('linked', content)]), - ]).create(); - } - - setUp(() async { - await updateLinkContent('linked'); - }); - - Future expectGeneratedContent(String content) async { - await d.dir('a', [ - d.dir('.dart_tool', [ - d.dir('build', [ - d.dir('generated', [ - d.dir('a', [ - d.dir('web', [d.file('a.txt.copy', content)]), - ]), - ]), - ]), - ]), - ]).validate(); - } - - group('build', () { - test('reads from a linked file', () async { - await buildTool.build(); - await expectGeneratedContent('linked'); - - await updateLinkContent('new content'); - await buildTool.build(); - await expectGeneratedContent('new content'); - }); - }); - - group('serve', () { - test( - 'watches a linked file', - skip: 'Watcher package does not support watching symlink targets', - () async { - final server = await buildTool.serve(); - await server.nextSuccessfulBuild; - await expectGeneratedContent('linked'); - - await updateLinkContent('new content'); - await server.nextSuccessfulBuild; - await expectGeneratedContent('new content'); - }, - ); - }); -} diff --git a/build_runner/test/integration_tests/test_command_test.dart b/build_runner/test/integration_tests/test_command_test.dart new file mode 100644 index 000000000..135744a90 --- /dev/null +++ b/build_runner/test/integration_tests/test_command_test.dart @@ -0,0 +1,50 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:io/io.dart'; +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('test command', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + files: {}, + ); + + // `test` does not support specifying directory to build. + await tester.run( + 'root_pkg', + 'dart run build_runner test web', + expectExitCode: ExitCode.usage.code, + ); + await tester.run( + 'root_pkg', + 'dart run build_runner test web -- -p chrome', + expectExitCode: ExitCode.usage.code, + ); + + // Requires `build_test` dependency. + final output = await tester.run( + 'root_pkg', + 'dart run build_runner test', + expectExitCode: ExitCode.config.code, + ); + expect( + output, + contains( + 'Missing dev dependency on package:build_test, ' + 'which is required to run tests.', + ), + ); + }); +} diff --git a/build_runner/test/integration_tests/utils/build_descriptor.dart b/build_runner/test/integration_tests/utils/build_descriptor.dart deleted file mode 100644 index bdcb2f88a..000000000 --- a/build_runner/test/integration_tests/utils/build_descriptor.dart +++ /dev/null @@ -1,387 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; -import 'dart:isolate'; - -import 'package:async/async.dart'; -import 'package:build/build.dart'; -import 'package:build_runner/src/constants.dart'; -import 'package:build_runner/src/logging/build_log.dart'; -import 'package:package_config/package_config.dart'; -import 'package:path/path.dart' as p; -import 'package:stack_trace/stack_trace.dart'; -import 'package:test/test.dart' - show contains, emitsThrough, expect, expectLater; -import 'package:test_descriptor/test_descriptor.dart' as d; -import 'package:test_process/test_process.dart'; - -import '../../common/sdk.dart'; - -class TestBuilderDefinition { - final String key; - final bool isOptional; - Builder builder; - final List requiredInputs; - - TestBuilderDefinition( - this.key, - this.isOptional, - this.builder, - this.requiredInputs, - ); -} - -/// Define a builder with key [key] that can be assembled into a `build.dart` or -/// `build.yaml`. -/// -/// [key] must match the top level variable name of [builder]. It must exist in -/// the invoking script between the `test-package-start/end` comments. The -/// builder should only use references to `package:build_test/build_test.dart`. -/// -/// [requiredInputs] only has effect when using this builder with -/// [packageWithBuilders]. In the [packageWithBuildScript] use case the ordering -/// of the `builders` argument determines builder ordering. -TestBuilderDefinition builder( - String key, - Builder builder, { - bool isOptional = false, - List requiredInputs = const [], -}) => TestBuilderDefinition(key, isOptional, builder, requiredInputs); - -/// Create a package in [d.sandbox] with a `build.yaml` file exporting -/// [builders] and auto applying them to dependents. -/// -/// The content in between `test-package-start/end` comments of the script that -/// this function is called from will be copied into 'lib/builders.dart'. It -/// should contain top level fields with names matching they keys in [builders] -/// and only rely on imports to `package:build_test/build_test.dart`. -Future packageWithBuilders( - Iterable builders, { - String name = 'provides_builders', -}) async { - final frameCaller = Frame.caller().uri; - return d.dir(name, [ - await _pubspecWithDeps( - name, - currentIsolateDependencies: ['build', 'build_test'], - ), - d.file('build.yaml', jsonEncode(_buildConfig(builders))), - d.dir('lib', [ - d.file( - 'builders.dart', - _buildersFile( - builders, - (await Isolate.resolvePackageUri(frameCaller))!, - ), - ), - ]), - ]); -} - -Map _buildConfig(Iterable builders) => { - 'builders': builders.map(_builderDefinition).reduce((a, b) => a..addAll(b)), -}; - -Map _builderDefinition(TestBuilderDefinition builder) => { - builder.key: { - 'import': 'package:provides_builders/builders.dart', - 'builder_factories': ['${builder.key}Factory'], - 'build_extensions': builder.builder.buildExtensions, - 'auto_apply': 'dependents', - 'is_optional': builder.isOptional, - 'required_inputs': builder.requiredInputs, - }, -}; - -/// Create a package in [d.sandbox] with dependencies on [otherPackages] set up -/// to run their builders with `dart run build_runner`. -/// -/// The package name is always 'a'. -/// -/// Files other than the pubspec should be set up with [packageContents]. -Future package( - Iterable otherPackages, { - Iterable packageContents = const [], -}) async { - await d.dir('a', [ - await _pubspecWithDeps( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'code_builder', - ], - pathDependencies: { - for (final o in otherPackages) o.name: p.join(d.sandbox, o.name), - }, - ), - ...packageContents, - ]).create(); - await Future.wait(otherPackages.map((d) => d.create())); - await pubGet('a'); - return BuildTool._(dartBinary, ['run', 'build_runner']); -} - -/// Create a package in [d.sandbox] with a `tool/build.dart` script using -/// [builders] and a [BuildTool] invoking it. -/// -/// The content in between `test-package-start/end` comments of the script that -/// this function is called from will be copied into the build script. It -/// should contain top level fields with names matching they keys in [builders] -/// and only rely on imports to `package:build_test/build_test.dart`. -/// -/// The package name is always 'a'. -/// -/// Files other than `tool/build.dart` and the pubspec should be set up with -/// [contents]. -Future packageWithBuildScript( - Iterable builders, { - Iterable contents = const [], -}) async { - final frameCaller = Frame.caller().uri; - await d.dir('a', [ - await _pubspecWithDeps( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - ], - ), - d.dir('tool', [ - d.file( - 'build.dart', - _buildToolFile( - builders, - (await Isolate.resolvePackageUri(frameCaller))!, - ), - ), - ]), - ...contents, - ]).create(); - await pubGet('a'); - return BuildTool._(dartBinary, [p.join('tool', 'build.dart')]); -} - -String _buildersFile( - Iterable builders, - Uri callingScript, -) => ''' -import 'package:build/build.dart'; -import 'package:build_test/build_test.dart'; - -${_builders(callingScript)} - -${builders.map(_builderFactory).join('\n')} -'''; - -String _builderFactory(TestBuilderDefinition builder) => - 'Builder ${builder.key}Factory(BuilderOptions _) => ${builder.key};'; - -String _buildToolFile( - Iterable builders, - Uri callingScript, -) => ''' -import 'dart:io'; - -import 'package:build/build.dart'; -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -${_builders(callingScript)} - -${builders.map(_builderFactory).join('\n')} - -main(List args) async { - exitCode = await run(args, - [${builders.map(_builderApplication).join(',\n')}]); -} -'''; - -String _builderApplication(TestBuilderDefinition builder) => ''' -apply('${builder.key}', [${builder.key}Factory], toRoot(), - isOptional: ${builder.isOptional}) -'''; - -String _builders(Uri callingScript) { - final content = File.fromUri(callingScript).readAsLinesSync(); - final start = content.indexWhere( - (l) => l.startsWith('// test-package-start'), - ); - final end = content.indexWhere((l) => l.contains('// test-package-end')); - return content.sublist(start + 1, end).join('\n'); -} - -/// Creates a `pubspec.yaml` file for package [name]. -/// -/// If [currentIsolateDependencies] is provided then it will add a path -/// dependency for each package listed, assuming it can be resolved in the -/// current isolate. -/// -/// If [pathDependencies] is provided then the keys are the package names -/// and the values are the exact paths which will be added as a dependency. -/// -/// If [versionDependencies] is provided then the keys are the package names -/// and the values are the exact versions which will be added as a dependency. -Future _pubspecWithDeps( - String name, { - Iterable currentIsolateDependencies = const [], - Map pathDependencies = const {}, - Map versionDependencies = const {}, -}) async { - final packageConfig = await loadPackageConfigUri( - (await Isolate.packageConfig)!, - ); - pathDependencies = Map.of(pathDependencies); - await Future.forEach(currentIsolateDependencies, (String package) async { - pathDependencies[package] = packageConfig[package]!.root.path; - }); - return _pubspec( - name, - pathDependencies: pathDependencies, - versionDependencies: versionDependencies, - ); -} - -/// Creates a `pubspec.yaml` file for package [name]. -/// -/// If [pathDependencies] is provided then the keys are the package names -/// and the values are the exact paths which will be added as a dependency. -/// -/// If [versionDependencies] is provided then the keys are the package names -/// and the values are the exact versions which will be added as a dependency. -d.FileDescriptor _pubspec( - String name, { - Map pathDependencies = const {}, - Map versionDependencies = const {}, -}) { - final buffer = - StringBuffer() - ..writeln('name: $name') - ..writeln('environment:') - ..writeln(' sdk: ^3.7.0'); - - void writeDeps(String group) { - buffer.writeln(group); - - pathDependencies.forEach((package, path) { - buffer - ..writeln(' $package:') - ..writeln(' path: $path'); - }); - - versionDependencies.forEach((package, version) { - buffer.writeln(' $package:$version'); - }); - } - - writeDeps('dependencies:'); - // Using dependency_overrides forces the path dependency and silences - // warnings about hosted vs path dependency conflicts. - writeDeps('dependency_overrides:'); - - return d.file('pubspec.yaml', buffer.toString()); -} - -/// An executable that can run builds. -/// -/// Either a manual build script or `dart run build_runner`. -class BuildTool { - final String _executable; - final List _baseArgs; - - BuildTool._(this._executable, this._baseArgs); - - Future serve() async => BuildServer( - await TestProcess.start(_executable, [ - ..._baseArgs, - 'serve', - ], workingDirectory: rootPackageDir), - ); - - Future> build({ - List args = const [], - int expectExitCode = 0, - }) async { - final process = await TestProcess.start(_executable, [ - ..._baseArgs, - 'build', - ...args, - ], workingDirectory: rootPackageDir); - await process.shouldExit(expectExitCode); - return process.stdout; - } - - String get rootPackageDir => p.join(d.sandbox, 'a'); -} - -/// A process running the `serve` command. -class BuildServer { - final TestProcess _process; - final HttpClient _client = HttpClient(); - - BuildServer(this._process); - - Future? _serversStarted; - Future get started => - _serversStarted ??= readThrough(BuildLog.successPattern); - - Future get nextSuccessfulBuild => readThrough(BuildLog.successPattern); - - /// Reads stdout until there is a line containing [message]; - Future readThrough(String message) async { - while (await _process.stdout.hasNext) { - if ((await _process.stdout.next).contains(message)) return; - } - throw StateError('Did not emit line containing [$message]'); - } - - /// Clean up this server. - /// - /// This must be called before the end of every test. - Future shutDown() async { - await _process.kill(); - _client.close(); - } - - /// Request [path] from the default server and expect it returns a 404 - /// response. - Future expect404(String path) async { - final request = await _client.get('localhost', 8080, path); - final response = await request.close(); - expect(response.statusCode, 404); - await response.drain(); - } - - /// Request [path] from the default server and expect it returns a 200 - /// response with the body [content]. - Future expectContent(String path, String content) async { - final request = await _client.get('localhost', 8080, path); - final response = await request.close(); - expect(response.statusCode, 200); - expect(await utf8.decodeStream(response.cast>()), content); - } - - StreamQueue get stdout => _process.stdout; -} - -/// Expect that [stdout] emits in order lines that contain every value in -/// [expected] with any other lines in between. -Future expectOutput( - StreamQueue stdout, - Iterable expected, -) async { - for (final line in expected) { - await expectLater(stdout, emitsThrough(contains(line))); - } -} diff --git a/build_runner/test/integration_tests/watch_command_invalidation_test.dart b/build_runner/test/integration_tests/watch_command_invalidation_test.dart new file mode 100644 index 000000000..e7e8d0bb2 --- /dev/null +++ b/build_runner/test/integration_tests/watch_command_invalidation_test.dart @@ -0,0 +1,61 @@ +// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +@Tags(['integration']) +library; + +import 'package:build_runner/src/logging/build_log.dart'; +import 'package:test/test.dart'; + +import '../common/common.dart'; + +void main() async { + test('watch command invalidation', () async { + final pubspecs = await Pubspecs.load(); + final tester = BuildRunnerTester(pubspecs); + + tester.writeFixturePackage(FixturePackages.copyBuilder()); + tester.writePackage( + name: 'root_pkg', + dependencies: ['build_runner'], + pathDependencies: ['builder_pkg'], + files: {'web/a.txt': 'a'}, + ); + + // Watch and initial build. + var watch = await tester.start('root_pkg', 'dart run build_runner watch'); + await watch.expect(BuildLog.successPattern); + expect(tester.read('root_pkg/web/a.txt.copy'), 'a'); + + // Builder change. + tester.update('builder_pkg/lib/builder.dart', (script) => '$script\n'); + await watch.expect('Terminating builds due to build script update'); + await watch.expect('Compiling the build script'); + await watch.expect('Creating the asset graph'); + await watch.expect(BuildLog.successPattern); + expect(tester.read('root_pkg/web/a.txt.copy'), 'a'); + + // Builder config change. + tester.write('root_pkg/build.yaml', '# new file, nothing here'); + await watch.expect('Terminating builds due to root_pkg:build.yaml update'); + await watch.expect(BuildLog.successPattern); + expect(tester.read('root_pkg/web/a.txt.copy'), 'a'); + + // Now with --output. + await watch.kill(); + watch = await tester.start( + 'root_pkg', + 'dart run build_runner watch --output web:build', + ); + await watch.expect(BuildLog.successPattern); + expect(tester.read('root_pkg/build/a.txt'), 'a'); + expect(tester.read('root_pkg/build/a.txt.copy'), 'a'); + + // Changed inputs and outputs are written to output directory. + tester.write('root_pkg/lib/a.txt', 'updated'); + await watch.expect(BuildLog.successPattern); + expect(tester.read('root_pkg/build/a.txt'), 'a'); + expect(tester.read('root_pkg/build/a.txt.copy'), 'a'); + }); +} diff --git a/build_runner/test/integration_tests/watch_integration_test.dart b/build_runner/test/integration_tests/watch_integration_test.dart deleted file mode 100644 index 1d4e01662..000000000 --- a/build_runner/test/integration_tests/watch_integration_test.dart +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:build_runner/src/logging/build_log.dart'; -import 'package:test/test.dart'; -import 'package:test_descriptor/test_descriptor.dart' as d; - -import '../common/common.dart'; - -late Process process; -late Stream stdOutLines; - -final String originalBuildContent = ''' -import 'package:build_runner/build_runner.dart'; -import 'package:build_runner/src/bootstrap/apply_builders.dart'; -import 'package:build_test/build_test.dart'; - -main() async { - await run(['watch', '-o', 'output_dir'], [ - applyToRoot(new TestBuilder( - buildExtensions: appendExtension('.copy', from: '.txt'))) - ]); -} -'''; - -void main() { - group('watch integration tests', () { - setUp(() async { - await d.dir('a', [ - await pubspec( - 'a', - currentIsolateDependencies: [ - 'build', - 'build_config', - 'build_daemon', - 'build_runner', - 'build_test', - 'code_builder', - 'glob', - ], - ), - d.dir('tool', [d.file('build.dart', originalBuildContent)]), - d.dir('web', [d.file('a.txt', 'a'), d.file('a.no_output', 'a')]), - ]).create(); - - await pubGet('a'); - - // Run a build and validate the output. - process = await startDart('a', 'tool/build.dart'); - - stdOutLines = - process.stdout - .transform(utf8.decoder) - .transform(const LineSplitter()) - .asBroadcastStream(); - - await nextSuccessfulBuild; - await d.dir('a', [ - d.dir('web', [d.file('a.txt.copy', 'a')]), - ]).validate(); - }); - - group('build script', () { - test('updates the process to quit', () async { - // Append a newline to the build script! - await d.dir('a', [ - d.dir('tool', [d.file('build.dart', '$originalBuildContent\n')]), - ]).create(); - - await nextStdOutLine('Terminating builds due to build script update'); - expect(await process.exitCode, equals(0)); - }); - }); - - group('outputDir', () { - test('updates on changed source file', () async { - await d.dir('a', [ - d.dir('output_dir', [ - d.dir('web', [d.file('a.no_output', 'a')]), - ]), - ]).validate(); - - await d.dir('a', [ - d.dir('web', [d.file('a.no_output', 'changed')]), - ]).create(); - await nextSuccessfulBuild; - - await d.dir('a', [ - d.dir('output_dir', [ - d.dir('web', [d.file('a.no_output', 'changed')]), - ]), - ]).validate(); - - process.kill(); - await process.exitCode; - }); - }); - }); -} - -Future get nextSuccessfulBuild => - stdOutLines.firstWhere((line) => line.contains(BuildLog.successPattern)); - -Future nextStdOutLine(String message) => - stdOutLines.firstWhere((line) => line.contains(message)); diff --git a/build_runner/test/integration_tests/wrong_builder_factory_test.dart b/build_runner/test/integration_tests/wrong_builder_factory_test.dart deleted file mode 100644 index 062f038fe..000000000 --- a/build_runner/test/integration_tests/wrong_builder_factory_test.dart +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -@Tags(['integration']) -library; - -import 'package:build_test/build_test.dart'; -import 'package:io/io.dart' show ExitCode; -import 'package:test/test.dart'; - -import 'utils/build_descriptor.dart'; - -// test-package-start ######################################################### -final correctKey = TestBuilder( - buildExtensions: { - '.txt': ['.txt.copy', '.txt.extra'], - }, -); -// test-package-end ########################################################### - -void main() { - final builders = [builder('wrongKey', correctKey)]; - - late BuildTool buildTool; - - setUpAll(() async { - buildTool = await package([await packageWithBuilders(builders)]); - }); - - group('build', () { - test( - 'warns when builder definition produces invalid build script', - () async { - final result = await buildTool.build( - expectExitCode: ExitCode.config.code, - ); - expect(result, emitsThrough(contains('Undefined name \'wrongKey\''))); - expect(result, emitsThrough(contains('Check builder definition'))); - }, - ); - }); -} diff --git a/build_test/mono_pkg.yaml b/build_test/mono_pkg.yaml index 076c6f941..aa025bbfb 100644 --- a/build_test/mono_pkg.yaml +++ b/build_test/mono_pkg.yaml @@ -1,18 +1,12 @@ sdk: -- pubspec - dev +os: +- linux + stages: - analyze_and_format: - - group: - - format - - analyze: --fatal-infos . + - format + - analyze: --fatal-infos . - unit_test: - test: --test-randomize-ordering-seed=random - os: - - linux - - windows - -cache: - directories: - - .dart_tool/build diff --git a/build_web_compilers/mono_pkg.yaml b/build_web_compilers/mono_pkg.yaml index 4d943759b..aa025bbfb 100644 --- a/build_web_compilers/mono_pkg.yaml +++ b/build_web_compilers/mono_pkg.yaml @@ -1,13 +1,12 @@ sdk: -- main +- dev + +os: +- linux stages: - analyze_and_format: - - group: - - format - - analyze: --fatal-infos . + - format + - analyze: --fatal-infos . - unit_test: - test: --test-randomize-ordering-seed=random - os: - - linux - - windows diff --git a/example/mono_pkg.yaml b/example/mono_pkg.yaml index 13942e4c2..f08105835 100644 --- a/example/mono_pkg.yaml +++ b/example/mono_pkg.yaml @@ -1,9 +1,10 @@ sdk: -- pubspec - dev +os: +- linux + stages: - analyze_and_format: - - group: - - format - - analyze: --fatal-infos . + - format + - analyze: --fatal-infos . diff --git a/mono_repo.yaml b/mono_repo.yaml index 07917007a..8ddd999ee 100644 --- a/mono_repo.yaml +++ b/mono_repo.yaml @@ -1,12 +1,5 @@ # See https://github.com/google/mono_repo.dart for details on this file self_validate: analyze_and_format -github: - cron: '0 0 * * 0' # “At 00:00 (UTC) on Sunday.” - stages: - - name: e2e_test_cron - # Only run this stage for scheduled cron jobs - if: github.event_name == 'schedule' - merge_stages: - analyze_and_format diff --git a/scratch_space/mono_pkg.yaml b/scratch_space/mono_pkg.yaml index 076c6f941..aa025bbfb 100644 --- a/scratch_space/mono_pkg.yaml +++ b/scratch_space/mono_pkg.yaml @@ -1,18 +1,12 @@ sdk: -- pubspec - dev +os: +- linux + stages: - analyze_and_format: - - group: - - format - - analyze: --fatal-infos . + - format + - analyze: --fatal-infos . - unit_test: - test: --test-randomize-ordering-seed=random - os: - - linux - - windows - -cache: - directories: - - .dart_tool/build diff --git a/tool/ci.sh b/tool/ci.sh index 5c9aaa637..c43fc0456 100755 --- a/tool/ci.sh +++ b/tool/ci.sh @@ -96,44 +96,44 @@ for PKG in ${PKGS}; do dart test --total-shards 3 --shard-index 2 --test-randomize-ordering-seed=random || EXIT_CODE=$? ;; test_03) - echo 'dart test' - dart test || EXIT_CODE=$? - ;; - test_04) echo 'dart test --test-randomize-ordering-seed=random' dart test --test-randomize-ordering-seed=random || EXIT_CODE=$? ;; - test_05) + test_04) echo 'dart test -P presubmit --test-randomize-ordering-seed=random' dart test -P presubmit --test-randomize-ordering-seed=random || EXIT_CODE=$? ;; - test_06) - echo 'dart test -x integration --test-randomize-ordering-seed=random' - dart test -x integration --test-randomize-ordering-seed=random || EXIT_CODE=$? + test_05) + echo 'dart test -x integration -x slow --test-randomize-ordering-seed=random' + dart test -x integration -x slow --test-randomize-ordering-seed=random || EXIT_CODE=$? ;; - test_07) + test_06) echo 'dart test -P experiments --test-randomize-ordering-seed=random' dart test -P experiments --test-randomize-ordering-seed=random || EXIT_CODE=$? ;; + test_07) + echo 'dart test -t integration --test-randomize-ordering-seed=random' + dart test -t integration --test-randomize-ordering-seed=random || EXIT_CODE=$? + ;; test_08) - echo 'dart test -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1' - dart test -t integration --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 || EXIT_CODE=$? + echo 'dart test -t slow --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random -j 1' + dart test -t slow --total-shards 5 --shard-index 0 --test-randomize-ordering-seed=random -j 1 || EXIT_CODE=$? ;; test_09) - echo 'dart test -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1' - dart test -t integration --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 || EXIT_CODE=$? + echo 'dart test -t slow --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random -j 1' + dart test -t slow --total-shards 5 --shard-index 1 --test-randomize-ordering-seed=random -j 1 || EXIT_CODE=$? ;; test_10) - echo 'dart test -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1' - dart test -t integration --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 || EXIT_CODE=$? + echo 'dart test -t slow --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random -j 1' + dart test -t slow --total-shards 5 --shard-index 2 --test-randomize-ordering-seed=random -j 1 || EXIT_CODE=$? ;; test_11) - echo 'dart test -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1' - dart test -t integration --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 || EXIT_CODE=$? + echo 'dart test -t slow --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random -j 1' + dart test -t slow --total-shards 5 --shard-index 3 --test-randomize-ordering-seed=random -j 1 || EXIT_CODE=$? ;; test_12) - echo 'dart test -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1' - dart test -t integration --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random --no-chain-stack-traces -j 1 || EXIT_CODE=$? + echo 'dart test -t slow --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random -j 1' + dart test -t slow --total-shards 5 --shard-index 4 --test-randomize-ordering-seed=random -j 1 || EXIT_CODE=$? ;; *) echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m"