diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 493038cfa..4811ff830 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -1,4 +1,4 @@ -# Created with package:mono_repo v6.4.2 +# Created with package:mono_repo v6.4.3 name: Dart CI on: push: @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable" @@ -35,9 +35,9 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - name: mono_repo self validate - run: dart pub global activate mono_repo 6.4.2 + run: dart pub global activate mono_repo 6.4.3 - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:format-analyze_0-test_0" @@ -60,7 +60,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -79,16 +79,16 @@ jobs: if: "always() && steps.dwds_pub_upgrade.conclusion == 'success'" working-directory: dwds job_003: - name: "analyzer_and_format; linux; Dart dev; PKGS: example, fixtures/_webdevSmoke, frontend_server_client, frontend_server_common; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`" + name: "analyzer_and_format; linux; Dart dev; PKGS: example, fixtures/_webdevSoundSmoke, frontend_server_client, frontend_server_common; `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@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:example-fixtures/_webdevSmoke-frontend_server_client-frontend_server_common;commands:format-analyze_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:example-fixtures/_webdevSoundSmoke-frontend_server_client-frontend_server_common;commands:format-analyze_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:example-fixtures/_webdevSmoke-frontend_server_client-frontend_server_common + os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:example-fixtures/_webdevSoundSmoke-frontend_server_client-frontend_server_common os:ubuntu-latest;pub-cache-hosted;sdk:dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -98,7 +98,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: example_pub_upgrade name: example; dart pub upgrade run: dart pub upgrade @@ -112,19 +112,19 @@ jobs: run: dart analyze --fatal-infos . if: "always() && steps.example_pub_upgrade.conclusion == 'success'" working-directory: example - - id: fixtures__webdevSmoke_pub_upgrade - name: fixtures/_webdevSmoke; dart pub upgrade + - id: fixtures__webdevSoundSmoke_pub_upgrade + name: fixtures/_webdevSoundSmoke; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: fixtures/_webdevSmoke - - name: "fixtures/_webdevSmoke; dart format --output=none --set-exit-if-changed ." + working-directory: fixtures/_webdevSoundSmoke + - name: "fixtures/_webdevSoundSmoke; dart format --output=none --set-exit-if-changed ." run: "dart format --output=none --set-exit-if-changed ." - if: "always() && steps.fixtures__webdevSmoke_pub_upgrade.conclusion == 'success'" - working-directory: fixtures/_webdevSmoke - - name: "fixtures/_webdevSmoke; dart analyze --fatal-infos ." + if: "always() && steps.fixtures__webdevSoundSmoke_pub_upgrade.conclusion == 'success'" + working-directory: fixtures/_webdevSoundSmoke + - name: "fixtures/_webdevSoundSmoke; dart analyze --fatal-infos ." run: dart analyze --fatal-infos . - if: "always() && steps.fixtures__webdevSmoke_pub_upgrade.conclusion == 'success'" - working-directory: fixtures/_webdevSmoke + if: "always() && steps.fixtures__webdevSoundSmoke_pub_upgrade.conclusion == 'success'" + working-directory: fixtures/_webdevSoundSmoke - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade run: dart pub upgrade @@ -156,7 +156,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:format-analyze_0-test_7" @@ -171,7 +171,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: webdev_pub_upgrade name: webdev; dart pub upgrade run: dart pub upgrade @@ -194,7 +194,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds-webdev;commands:analyze_1-test_1" @@ -209,7 +209,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -241,7 +241,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:command-test_2" @@ -256,7 +256,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -281,7 +281,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:test_3" @@ -296,7 +296,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -317,7 +317,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:test_4" @@ -332,7 +332,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -353,7 +353,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:dwds;commands:test_5" @@ -368,7 +368,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -389,7 +389,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:frontend_server_client;commands:test_6" @@ -404,7 +404,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade run: dart pub upgrade @@ -425,7 +425,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:webdev;commands:command-test_6" @@ -440,7 +440,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: webdev_pub_upgrade name: webdev; dart pub upgrade run: dart pub upgrade @@ -465,7 +465,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:command-test_2" @@ -480,7 +480,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -505,7 +505,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:test_3" @@ -520,7 +520,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -541,7 +541,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:test_4" @@ -556,7 +556,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -577,7 +577,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:dwds;commands:test_5" @@ -592,7 +592,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -613,7 +613,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:frontend_server_client;commands:test_6" @@ -628,7 +628,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade run: dart pub upgrade @@ -649,7 +649,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:stable;packages:webdev;commands:command-test_6" @@ -664,7 +664,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: webdev_pub_upgrade name: webdev; dart pub upgrade run: dart pub upgrade @@ -694,7 +694,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -720,7 +720,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -746,7 +746,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -772,7 +772,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -798,7 +798,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade run: dart pub upgrade @@ -824,7 +824,7 @@ jobs: sdk: dev - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: webdev_pub_upgrade name: webdev; dart pub upgrade run: dart pub upgrade @@ -850,7 +850,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -876,7 +876,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -902,7 +902,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -928,7 +928,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -954,7 +954,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: frontend_server_client_pub_upgrade name: frontend_server_client; dart pub upgrade run: dart pub upgrade @@ -980,7 +980,7 @@ jobs: sdk: stable - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: webdev_pub_upgrade name: webdev; dart pub upgrade run: dart pub upgrade @@ -1002,7 +1002,7 @@ jobs: if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:command-test_6" @@ -1017,7 +1017,7 @@ jobs: sdk: beta - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -1067,7 +1067,7 @@ jobs: if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:command-test_6" @@ -1082,7 +1082,7 @@ jobs: sdk: beta - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: webdev_pub_upgrade name: webdev; dart pub upgrade run: dart pub upgrade @@ -1132,7 +1132,7 @@ jobs: if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:dwds;commands:analyze_1" @@ -1147,7 +1147,7 @@ jobs: sdk: beta - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -1193,7 +1193,7 @@ jobs: if: "github.event_name == 'schedule'" steps: - name: Cache Pub hosted dependencies - uses: actions/cache@9b0c1fce7a93df8e3bb8926b0d6e9d89e92f20a7 + uses: actions/cache@4723a57e26efda3a62cbde1812113b730952852d with: path: "~/.pub-cache/hosted" key: "os:ubuntu-latest;pub-cache-hosted;sdk:beta;packages:webdev;commands:analyze_1" @@ -1208,7 +1208,7 @@ jobs: sdk: beta - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: webdev_pub_upgrade name: webdev; dart pub upgrade run: dart pub upgrade @@ -1259,7 +1259,7 @@ jobs: sdk: beta - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: dwds_pub_upgrade name: dwds; dart pub upgrade run: dart pub upgrade @@ -1310,7 +1310,7 @@ jobs: sdk: beta - id: checkout name: Checkout repository - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 + uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - id: webdev_pub_upgrade name: webdev; dart pub upgrade run: dart pub upgrade diff --git a/dwds/CHANGELOG.md b/dwds/CHANGELOG.md index 5254092ec..bef7437a5 100644 --- a/dwds/CHANGELOG.md +++ b/dwds/CHANGELOG.md @@ -17,6 +17,9 @@ - Add back `ChromeProxyService.setExceptionPauseMode()` without override. - Make hot restart atomic to prevent races on simultaneous execution. - Return error on expression evaluation if expression evaluator stopped. +- Prepare for Dart 3 alpha breaking changes: + - Generate missing SDK assets for tests. + - Enable frontend server null safe tests. **Breaking changes** - Include an optional param to `Dwds.start` to indicate whether it is running @@ -24,6 +27,8 @@ - Include an optional param to `Dwds.start` to indicate whether it a Flutter app or not. - Remove deprecated `ChromeProxyService.setExceptionPauseMode()`. +- Replace `SdkConfiguration.unsoundSdkSummaryPath` with + `SdkConfiguration.weakSdkSummaryPath`. ## 16.0.1 diff --git a/dwds/lib/dart_web_debug_service.dart b/dwds/lib/dart_web_debug_service.dart index ba66a8272..5dce5f30d 100644 --- a/dwds/lib/dart_web_debug_service.dart +++ b/dwds/lib/dart_web_debug_service.dart @@ -84,13 +84,13 @@ class Dwds { bool enableDevtoolsLaunch = true, DevtoolsLauncher? devtoolsLauncher, bool launchDevToolsInNewWindow = true, - SdkConfigurationProvider? sdkConfigurationProvider, + SdkConfigurationProvider sdkConfigurationProvider = + const DefaultSdkConfigurationProvider(), bool emitDebugEvents = true, bool isInternalBuild = false, bool isFlutterApp = false, }) async { globalLoadStrategy = loadStrategy; - sdkConfigurationProvider ??= DefaultSdkConfigurationProvider(); DevTools? devTools; Future? extensionUri; diff --git a/dwds/lib/dwds.dart b/dwds/lib/dwds.dart index 84bf219ee..3b67f1a14 100644 --- a/dwds/lib/dwds.dart +++ b/dwds/lib/dwds.dart @@ -29,4 +29,4 @@ export 'src/services/expression_compiler.dart' export 'src/services/expression_compiler_service.dart' show ExpressionCompilerService; export 'src/utilities/sdk_configuration.dart' - show SdkConfiguration, SdkConfigurationProvider; + show SdkLayout, SdkConfiguration, SdkConfigurationProvider; diff --git a/dwds/lib/src/services/expression_compiler_service.dart b/dwds/lib/src/services/expression_compiler_service.dart index 6b2c263df..74cd13510 100644 --- a/dwds/lib/src/services/expression_compiler_service.dart +++ b/dwds/lib/src/services/expression_compiler_service.dart @@ -77,7 +77,7 @@ class _Compiler { final workerUri = sdkConfiguration.compilerWorkerUri!; final sdkSummaryUri = soundNullSafety ? sdkConfiguration.soundSdkSummaryUri! - : sdkConfiguration.unsoundSdkSummaryUri!; + : sdkConfiguration.weakSdkSummaryUri!; final args = [ '--experimental-expression-compiler', @@ -241,11 +241,11 @@ class ExpressionCompilerService implements ExpressionCompiler { this._address, this._port, { bool verbose = false, - SdkConfigurationProvider? sdkConfigurationProvider, + SdkConfigurationProvider sdkConfigurationProvider = + const DefaultSdkConfigurationProvider(), this.experiments = const [], }) : _verbose = verbose, - _sdkConfigurationProvider = - sdkConfigurationProvider ?? DefaultSdkConfigurationProvider(); + _sdkConfigurationProvider = sdkConfigurationProvider; @override Future compileExpressionToJs( diff --git a/dwds/lib/src/utilities/sdk_configuration.dart b/dwds/lib/src/utilities/sdk_configuration.dart index 0439e01e6..b73da6a6c 100644 --- a/dwds/lib/src/utilities/sdk_configuration.dart +++ b/dwds/lib/src/utilities/sdk_configuration.dart @@ -2,6 +2,7 @@ // 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:io'; import 'package:file/file.dart'; @@ -24,11 +25,128 @@ class InvalidSdkConfigurationException implements Exception { /// SDK configuration provider interface. /// /// Supports lazily populated configurations by allowing to create -/// configuration asyncronously. +/// configuration asynchronously. abstract class SdkConfigurationProvider { + const SdkConfigurationProvider(); + Future get configuration; } +/// Sdk layout. +/// +/// Contains definition of the default SDK layout. +/// We keep all the path constants in one place for ease of update. +class SdkLayout { + static final sdkDir = p.dirname(p.dirname(Platform.resolvedExecutable)); + static final defaultSdkLayout = createDefault(sdkDir); + + static SdkLayout createDefault(String sdkDirectory) { + final sdkJsWeakFileName = 'dart_sdk.js'; + final sdkJsMapWeakFileName = 'dart_sdk.js.map'; + final sdkJsSoundFileName = 'dart_sdk_sound.js'; + final sdkJsMapSoundFileName = 'dart_sdk_sound.js.map'; + final sdkSummarySoundFileName = 'ddc_outline_sound.dill'; + final sdkSummaryWeakFileName = 'ddc_sdk.dill'; + final sdkFullDillSoundFileName = 'ddc_platform_sound.dill'; + final sdkFullDillWeakFileName = 'ddc_platform.dill'; + + final sdkSummaryDirectory = p.join(sdkDirectory, 'lib', '_internal'); + final sdkJsDirectory = + p.join(sdkDirectory, 'lib', 'dev_compiler', 'kernel', 'amd'); + + final soundSummaryPath = + p.join(sdkSummaryDirectory, sdkSummarySoundFileName); + final soundFullDillPath = + p.join(sdkSummaryDirectory, sdkFullDillSoundFileName); + final soundJsPath = p.join(sdkJsDirectory, sdkJsSoundFileName); + final soundJsMapPath = p.join(sdkJsDirectory, sdkJsMapSoundFileName); + + final weakSummaryPath = p.join(sdkSummaryDirectory, sdkSummaryWeakFileName); + final weakFullDillPath = + p.join(sdkSummaryDirectory, sdkFullDillWeakFileName); + final weakJsPath = p.join(sdkJsDirectory, sdkJsWeakFileName); + final weakJsMapPath = p.join(sdkJsDirectory, sdkJsMapWeakFileName); + + final librariesPath = p.join(sdkDirectory, 'lib', 'libraries.json'); + final dartdevcSnapshotPath = + p.join(sdkDirectory, 'bin', 'snapshots', 'dartdevc.dart.snapshot'); + final kernelWorkerSnapshotPath = + p.join(sdkDirectory, 'bin', 'snapshots', 'kernel_worker.dart.snapshot'); + + return SdkLayout( + sdkJsWeakFileName: sdkJsWeakFileName, + sdkJsMapWeakFileName: sdkJsMapWeakFileName, + sdkJsSoundFileName: sdkJsSoundFileName, + sdkJsMapSoundFileName: sdkJsMapSoundFileName, + sdkSummarySoundFileName: sdkSummarySoundFileName, + sdkSummaryWeakFileName: sdkSummaryWeakFileName, + sdkFullDillSoundFileName: sdkFullDillSoundFileName, + sdkFullDillWeakFileName: sdkFullDillWeakFileName, + sdkDirectory: sdkDirectory, + soundSummaryPath: soundSummaryPath, + soundFullDillPath: soundFullDillPath, + soundJsPath: soundJsPath, + soundJsMapPath: soundJsMapPath, + weakSummaryPath: weakSummaryPath, + weakFullDillPath: weakFullDillPath, + weakJsPath: weakJsPath, + weakJsMapPath: weakJsMapPath, + librariesPath: librariesPath, + dartdevcSnapshotPath: dartdevcSnapshotPath, + kernelWorkerSnapshotPath: kernelWorkerSnapshotPath, + ); + } + + final String sdkJsWeakFileName; + final String sdkJsMapWeakFileName; + final String sdkJsSoundFileName; + final String sdkJsMapSoundFileName; + final String sdkSummarySoundFileName; + final String sdkSummaryWeakFileName; + final String sdkFullDillSoundFileName; + final String sdkFullDillWeakFileName; + + final String sdkDirectory; + + final String soundSummaryPath; + final String soundFullDillPath; + final String soundJsPath; + final String soundJsMapPath; + + final String weakSummaryPath; + final String weakFullDillPath; + final String weakJsPath; + final String weakJsMapPath; + + final String librariesPath; + + final String dartdevcSnapshotPath; + final String kernelWorkerSnapshotPath; + + SdkLayout({ + required this.sdkJsWeakFileName, + required this.sdkJsMapWeakFileName, + required this.sdkJsSoundFileName, + required this.sdkJsMapSoundFileName, + required this.sdkSummarySoundFileName, + required this.sdkSummaryWeakFileName, + required this.sdkFullDillSoundFileName, + required this.sdkFullDillWeakFileName, + required this.sdkDirectory, + required this.soundSummaryPath, + required this.soundFullDillPath, + required this.soundJsPath, + required this.soundJsMapPath, + required this.weakSummaryPath, + required this.weakFullDillPath, + required this.weakJsPath, + required this.weakJsMapPath, + required this.librariesPath, + required this.dartdevcSnapshotPath, + required this.kernelWorkerSnapshotPath, + }); +} + /// Data class describing the SDK layout. /// /// Provides helpers to convert paths to uris that work on all platforms. @@ -36,30 +154,42 @@ abstract class SdkConfigurationProvider { /// Call [validate] method to make sure the files in the configuration /// layout exist before reading the files. class SdkConfiguration { - // TODO(annagrin): update the tests to take those parameters - // and make all of the paths required (except for the compilerWorkerPath - // that is not used in Flutter). + static final defaultSdkLayout = SdkLayout.defaultSdkLayout; + static final defaultConfiguration = + SdkConfiguration.fromSdkLayout(defaultSdkLayout); + String? sdkDirectory; - String? unsoundSdkSummaryPath; + String? weakSdkSummaryPath; String? soundSdkSummaryPath; String? librariesPath; String? compilerWorkerPath; SdkConfiguration({ this.sdkDirectory, - this.unsoundSdkSummaryPath, + this.weakSdkSummaryPath, this.soundSdkSummaryPath, this.librariesPath, this.compilerWorkerPath, }); + SdkConfiguration.empty() : this(); + + SdkConfiguration.fromSdkLayout(SdkLayout sdkLayout) + : this( + sdkDirectory: sdkLayout.sdkDirectory, + weakSdkSummaryPath: sdkLayout.weakSummaryPath, + soundSdkSummaryPath: sdkLayout.soundSummaryPath, + librariesPath: sdkLayout.librariesPath, + compilerWorkerPath: sdkLayout.dartdevcSnapshotPath, + ); + static Uri? _toUri(String? path) => path == null ? null : p.toUri(path); static Uri? _toAbsoluteUri(String? path) => path == null ? null : p.toUri(p.absolute(path)); Uri? get sdkDirectoryUri => _toUri(sdkDirectory); Uri? get soundSdkSummaryUri => _toUri(soundSdkSummaryPath); - Uri? get unsoundSdkSummaryUri => _toUri(unsoundSdkSummaryPath); + Uri? get weakSdkSummaryUri => _toUri(weakSdkSummaryPath); Uri? get librariesUri => _toUri(librariesPath); /// Note: has to be ///file: Uri to run in an isolate. @@ -85,14 +215,23 @@ class SdkConfiguration { } void validateSummaries({FileSystem fileSystem = const LocalFileSystem()}) { - if (unsoundSdkSummaryPath == null || - !fileSystem.file(unsoundSdkSummaryPath).existsSync()) { + validateSoundSummaries(fileSystem: fileSystem); + validateWeakSummaries(fileSystem: fileSystem); + } + + void validateWeakSummaries( + {FileSystem fileSystem = const LocalFileSystem()}) { + if (weakSdkSummaryPath == null || + !fileSystem.file(weakSdkSummaryPath).existsSync()) { throw InvalidSdkConfigurationException( - 'Sdk summary $unsoundSdkSummaryPath does not exist'); + 'Sdk summary $weakSdkSummaryPath does not exist'); } + } - if (soundSdkSummaryPath == null || - !fileSystem.file(soundSdkSummaryPath).existsSync()) { + void validateSoundSummaries( + {FileSystem fileSystem = const LocalFileSystem()}) { + if ((soundSdkSummaryPath == null || + !fileSystem.file(soundSdkSummaryPath).existsSync())) { throw InvalidSdkConfigurationException( 'Sdk summary $soundSdkSummaryPath does not exist'); } @@ -116,27 +255,10 @@ class SdkConfiguration { } } -/// Implementation for the default SDK configuration layout. class DefaultSdkConfigurationProvider extends SdkConfigurationProvider { - DefaultSdkConfigurationProvider(); + const DefaultSdkConfigurationProvider(); - late final SdkConfiguration _configuration = _create(); - - /// Create and validate configuration matching the default SDK layout. @override - Future get configuration async => _configuration; - - SdkConfiguration _create() { - final binDir = p.dirname(Platform.resolvedExecutable); - final sdkDir = p.dirname(binDir); - - return SdkConfiguration( - sdkDirectory: sdkDir, - unsoundSdkSummaryPath: p.join(sdkDir, 'lib', '_internal', 'ddc_sdk.dill'), - soundSdkSummaryPath: - p.join(sdkDir, 'lib', '_internal', 'ddc_outline_sound.dill'), - librariesPath: p.join(sdkDir, 'lib', 'libraries.json'), - compilerWorkerPath: p.join(binDir, 'snapshots', 'dartdevc.dart.snapshot'), - ); - } + Future get configuration async => + SdkConfiguration.defaultConfiguration; } diff --git a/dwds/test/build_daemon_callstack_test.dart b/dwds/test/build_daemon_callstack_test.dart index f3ee816ef..ba4f584e9 100644 --- a/dwds/test/build_daemon_callstack_test.dart +++ b/dwds/test/build_daemon_callstack_test.dart @@ -14,7 +14,6 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; import 'fixtures/logging.dart'; -import 'utils/version_compatibility.dart'; class TestSetup { static final contextUnsound = TestContext.withWeakNullSafety( @@ -50,278 +49,264 @@ void main() { final debug = false; for (var nullSafety in NullSafety.values) { - group( - '${nullSafety.name} null safety |', - () { - final soundNullSafety = nullSafety == NullSafety.sound; - final setup = - soundNullSafety ? TestSetup.sound() : TestSetup.unsound(); - final context = setup.context; - - setUpAll(() async { + group('${nullSafety.name} null safety |', () { + final soundNullSafety = nullSafety == NullSafety.sound; + final setup = + soundNullSafety ? TestSetup.sound() : TestSetup.unsound(); + final context = setup.context; + + setUpAll(() async { + setCurrentLogWriter(debug: debug); + await context.setUp( + compilationMode: CompilationMode.buildDaemon, + enableExpressionEvaluation: true, + verboseCompiler: debug, + ); + }); + + tearDownAll(() async { + await context.tearDown(); + }); + + group('callStack |', () { + late ChromeProxyService service; + VM vm; + late Isolate isolate; + ScriptList scripts; + late ScriptRef mainScript; + late ScriptRef testLibraryScript; + late Stream stream; + + setUp(() async { setCurrentLogWriter(debug: debug); - await context.setUp( - compilationMode: CompilationMode.buildDaemon, - enableExpressionEvaluation: true, - verboseCompiler: debug, - ); - }); + service = setup.service; + vm = await service.getVM(); + isolate = await service.getIsolate(vm.isolates!.first.id!); + scripts = await service.getScripts(isolate.id!); - tearDownAll(() async { - await context.tearDown(); - }); + await service.streamListen('Debug'); + stream = service.onEvent('Debug'); - group('callStack |', () { - late ChromeProxyService service; - VM vm; - late Isolate isolate; - ScriptList scripts; - late ScriptRef mainScript; - late ScriptRef testLibraryScript; - late Stream stream; - - setUp(() async { - setCurrentLogWriter(debug: debug); - service = setup.service; - vm = await service.getVM(); - isolate = await service.getIsolate(vm.isolates!.first.id!); - scripts = await service.getScripts(isolate.id!); - - await service.streamListen('Debug'); - stream = service.onEvent('Debug'); - - final testPackage = - soundNullSafety ? '_test_package_sound' : '_test_package'; - - mainScript = scripts.scripts! - .firstWhere((each) => each.uri!.contains('main.dart')); - testLibraryScript = scripts.scripts!.firstWhere((each) => each - .uri! - .contains('package:$testPackage/test_library.dart')); - }); + final testPackage = + soundNullSafety ? '_test_package_sound' : '_test_package'; - tearDown(() async { - await service.resume(isolate.id!); - }); + mainScript = scripts.scripts! + .firstWhere((each) => each.uri!.contains('main.dart')); + testLibraryScript = scripts.scripts!.firstWhere((each) => + each.uri!.contains('package:$testPackage/test_library.dart')); + }); - Future onBreakPoint(BreakpointTestData breakpoint, - Future Function() body) async { - Breakpoint? bp; - try { - final bpId = breakpoint.bpId; - final script = breakpoint.script; - final line = await context.findBreakpointLine( - bpId, isolate.id!, script); - bp = await setup.service.addBreakpointWithScriptUri( - isolate.id!, script.uri!, line); - - expect(bp, isNotNull); - expect(bp.location, _matchBpLocation(script, line, 0)); - - await stream.firstWhere((Event event) => - event.kind == EventKind.kPauseBreakpoint); - - await body(); - } finally { - // Remove breakpoint so it doesn't impact other tests or retries. - if (bp != null) { - await setup.service.removeBreakpoint(isolate.id!, bp.id!); - } - } - } + tearDown(() async { + await service.resume(isolate.id!); + }); - Future testCallStack(List breakpoints, - {int frameIndex = 1}) async { - // Find lines the breakpoints are located on. - final lines = await Future.wait(breakpoints.map((frame) => - context.findBreakpointLine( - frame.bpId, isolate.id!, frame.script))); - - // Get current stack. - final stack = await service.getStack(isolate.id!); - - // Verify the stack is correct. - expect( - stack.frames!.length, greaterThanOrEqualTo(lines.length)); - final expected = [ - for (var i = 0; i < lines.length; i++) - _matchFrame(breakpoints[i].script, breakpoints[i].function, - lines[i]) - ]; - expect(stack.frames, containsAll(expected)); - - // Verify that expression evaluation is not failing. - final instance = await service.evaluateInFrame( - isolate.id!, frameIndex, 'true'); - expect(instance, isA()); + Future onBreakPoint(BreakpointTestData breakpoint, + Future Function() body) async { + Breakpoint? bp; + try { + final bpId = breakpoint.bpId; + final script = breakpoint.script; + final line = + await context.findBreakpointLine(bpId, isolate.id!, script); + bp = await setup.service + .addBreakpointWithScriptUri(isolate.id!, script.uri!, line); + + expect(bp, isNotNull); + expect(bp.location, _matchBpLocation(script, line, 0)); + + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseBreakpoint); + + await body(); + } finally { + // Remove breakpoint so it doesn't impact other tests or retries. + if (bp != null) { + await setup.service.removeBreakpoint(isolate.id!, bp.id!); + } } + } + + Future testCallStack(List breakpoints, + {int frameIndex = 1}) async { + // Find lines the breakpoints are located on. + final lines = await Future.wait(breakpoints.map((frame) => context + .findBreakpointLine(frame.bpId, isolate.id!, frame.script))); + + // Get current stack. + final stack = await service.getStack(isolate.id!); + + // Verify the stack is correct. + expect(stack.frames!.length, greaterThanOrEqualTo(lines.length)); + final expected = [ + for (var i = 0; i < lines.length; i++) + _matchFrame( + breakpoints[i].script, breakpoints[i].function, lines[i]) + ]; + expect(stack.frames, containsAll(expected)); + + // Verify that expression evaluation is not failing. + final instance = await service.evaluateInFrame( + isolate.id!, frameIndex, 'true'); + expect(instance, isA()); + } + + test('breakpoint succeeds with correct callstack', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'printEnclosingObject', + 'printEnclosingObject', + mainScript, + ), + BreakpointTestData( + 'printEnclosingFunctionMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint( + breakpoints[0], () => testCallStack(breakpoints)); + }); - test('breakpoint succeeds with correct callstack', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'printEnclosingObject', - 'printEnclosingObject', - mainScript, - ), - BreakpointTestData( - 'printEnclosingFunctionMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint( - breakpoints[0], () => testCallStack(breakpoints)); - }); - - test('expression evaluation succeeds on parent frame', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'testLibraryClassConstructor', - 'new', - testLibraryScript, - ), - BreakpointTestData( - 'createLibraryObject', - 'printFieldFromLibraryClass', - mainScript, - ), - BreakpointTestData( - 'callPrintFieldFromLibraryClass', - '', - mainScript, - ), - ]; - await onBreakPoint(breakpoints[0], - () => testCallStack(breakpoints, frameIndex: 2)); - }); + test('expression evaluation succeeds on parent frame', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'testLibraryClassConstructor', + 'new', + testLibraryScript, + ), + BreakpointTestData( + 'createLibraryObject', + 'printFieldFromLibraryClass', + mainScript, + ), + BreakpointTestData( + 'callPrintFieldFromLibraryClass', + '', + mainScript, + ), + ]; + await onBreakPoint(breakpoints[0], + () => testCallStack(breakpoints, frameIndex: 2)); + }); - test('breakpoint inside a line gives correct callstack', - () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printNestedObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint( - breakpoints[0], () => testCallStack(breakpoints)); - }); + test('breakpoint inside a line gives correct callstack', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printNestedObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint( + breakpoints[0], () => testCallStack(breakpoints)); + }); - test('breakpoint gives correct callstack after step out', - () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printEnclosingObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint(breakpoints[0], () async { - await service.resume(isolate.id!, step: 'Out'); - await stream.firstWhere((Event event) => - event.kind == EventKind.kPauseInterrupted); - return testCallStack([breakpoints[1], breakpoints[2]]); - }); + test('breakpoint gives correct callstack after step out', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printEnclosingObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint(breakpoints[0], () async { + await service.resume(isolate.id!, step: 'Out'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted); + return testCallStack([breakpoints[1], breakpoints[2]]); }); + }); - test('breakpoint gives correct callstack after step in', - () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printNestedObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint(breakpoints[1], () async { - await service.resume(isolate.id!, step: 'Into'); - await stream.firstWhere((Event event) => - event.kind == EventKind.kPauseInterrupted); - return testCallStack(breakpoints); - }); + test('breakpoint gives correct callstack after step in', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printNestedObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint(breakpoints[1], () async { + await service.resume(isolate.id!, step: 'Into'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted); + return testCallStack(breakpoints); }); + }); - test( - 'breakpoint gives correct callstack after step into chain calls', - () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'createObjectWithMethod', - 'createObject', - mainScript, - ), - BreakpointTestData( - // This is currently incorrect, should be printObjectMultiLine. - // See issue: https://github.com/dart-lang/sdk/issues/48874 - 'printMultiLine', - 'printObjectMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintObjectMultiLine', - '', - mainScript, - ), - ]; - final bp = BreakpointTestData( - 'printMultiLine', 'printObjectMultiLine', mainScript); - await onBreakPoint(bp, () async { - await service.resume(isolate.id!, step: 'Into'); - await stream.firstWhere((Event event) => - event.kind == EventKind.kPauseInterrupted); - return testCallStack(breakpoints); - }); + test( + 'breakpoint gives correct callstack after step into chain calls', + () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'createObjectWithMethod', + 'createObject', + mainScript, + ), + BreakpointTestData( + // This is currently incorrect, should be printObjectMultiLine. + // See issue: https://github.com/dart-lang/sdk/issues/48874 + 'printMultiLine', + 'printObjectMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintObjectMultiLine', + '', + mainScript, + ), + ]; + final bp = BreakpointTestData( + 'printMultiLine', 'printObjectMultiLine', mainScript); + await onBreakPoint(bp, () async { + await service.resume(isolate.id!, step: 'Into'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted); + return testCallStack(breakpoints); }); }); - }, - // TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable. - skip: !supportedMode( - compilationMode: CompilationMode.buildDaemon, - nullSafetyMode: nullSafety, - ), - ); + }); + }); } }, ); diff --git a/dwds/test/build_daemon_circular_evaluate_test.dart b/dwds/test/build_daemon_circular_evaluate_test.dart index a6b61c6a2..86360ea7d 100644 --- a/dwds/test/build_daemon_circular_evaluate_test.dart +++ b/dwds/test/build_daemon_circular_evaluate_test.dart @@ -10,27 +10,17 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; import 'evaluate_circular_common.dart'; -import 'utils/version_compatibility.dart'; - void main() async { // Enable verbose logging for debugging. final debug = false; for (var nullSafety in NullSafety.values) { - group( - '${nullSafety.name} null safety |', - () { - testAll( - compilationMode: CompilationMode.buildDaemon, - nullSafety: nullSafety, - debug: debug, - ); - }, - // TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable. - skip: !supportedMode( + group('${nullSafety.name} null safety |', () { + testAll( compilationMode: CompilationMode.buildDaemon, - nullSafetyMode: nullSafety, - ), - ); + nullSafety: nullSafety, + debug: debug, + ); + }); } } diff --git a/dwds/test/build_daemon_evaluate_test.dart b/dwds/test/build_daemon_evaluate_test.dart index b640bfd16..141998c50 100644 --- a/dwds/test/build_daemon_evaluate_test.dart +++ b/dwds/test/build_daemon_evaluate_test.dart @@ -9,27 +9,18 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; import 'evaluate_common.dart'; -import 'utils/version_compatibility.dart'; void main() async { // Enable verbose logging for debugging. final debug = false; for (var nullSafety in NullSafety.values) { - group( - '${nullSafety.name} null safety |', - () { - testAll( - compilationMode: CompilationMode.buildDaemon, - nullSafety: nullSafety, - debug: debug, - ); - }, - // TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable. - skip: !supportedMode( + group('${nullSafety.name} null safety |', () { + testAll( compilationMode: CompilationMode.buildDaemon, - nullSafetyMode: nullSafety, - ), - ); + nullSafety: nullSafety, + debug: debug, + ); + }); } } diff --git a/dwds/test/dart_uri_file_uri_test.dart b/dwds/test/dart_uri_file_uri_test.dart index 346165ec2..fc35f6d2b 100644 --- a/dwds/test/dart_uri_file_uri_test.dart +++ b/dwds/test/dart_uri_file_uri_test.dart @@ -11,7 +11,6 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; import 'fixtures/utilities.dart'; -import 'utils/version_compatibility.dart'; final context = TestContext.withWeakNullSafety( packageName: '_testPackage', @@ -35,64 +34,58 @@ final testPackageDir = absolutePath(pathFromFixtures: p.join('_testPackage')); // testing sound null-safety. void main() { for (final compilationMode in CompilationMode.values) { - group( - '$compilationMode |', - () { - for (final useDebuggerModuleNames in [false, true]) { - group('Debugger module names: $useDebuggerModuleNames |', () { - final appServerPath = - compilationMode == CompilationMode.frontendServer - ? 'web/main.dart' - : 'main.dart'; + group('$compilationMode |', () { + for (final useDebuggerModuleNames in [false, true]) { + group('Debugger module names: $useDebuggerModuleNames |', () { + final appServerPath = + compilationMode == CompilationMode.frontendServer + ? 'web/main.dart' + : 'main.dart'; - final serverPath = - compilationMode == CompilationMode.frontendServer && - useDebuggerModuleNames - ? 'packages/_testPackage/lib/test_library.dart' - : 'packages/_test_package/test_library.dart'; + final serverPath = + compilationMode == CompilationMode.frontendServer && + useDebuggerModuleNames + ? 'packages/_testPackage/lib/test_library.dart' + : 'packages/_test_package/test_library.dart'; - final anotherServerPath = - compilationMode == CompilationMode.frontendServer && - useDebuggerModuleNames - ? 'packages/_test/lib/library.dart' - : 'packages/_test/library.dart'; + final anotherServerPath = + compilationMode == CompilationMode.frontendServer && + useDebuggerModuleNames + ? 'packages/_test/lib/library.dart' + : 'packages/_test/library.dart'; - setUpAll(() async { - await context.setUp( - compilationMode: compilationMode, - useDebuggerModuleNames: useDebuggerModuleNames, - ); - }); + setUpAll(() async { + await context.setUp( + compilationMode: compilationMode, + useDebuggerModuleNames: useDebuggerModuleNames, + ); + }); - tearDownAll(() async { - await context.tearDown(); - }); + tearDownAll(() async { + await context.tearDown(); + }); - test('file path to org-dartlang-app', () { - final webMain = - Uri.file(p.join(testPackageDir, 'web', 'main.dart')); - final uri = DartUri('$webMain'); - expect(uri.serverPath, appServerPath); - }); + test('file path to org-dartlang-app', () { + final webMain = + Uri.file(p.join(testPackageDir, 'web', 'main.dart')); + final uri = DartUri('$webMain'); + expect(uri.serverPath, appServerPath); + }); - test('file path to this package', () { - final testPackageLib = - Uri.file(p.join(testPackageDir, 'lib', 'test_library.dart')); - final uri = DartUri('$testPackageLib'); - expect(uri.serverPath, serverPath); - }); + test('file path to this package', () { + final testPackageLib = + Uri.file(p.join(testPackageDir, 'lib', 'test_library.dart')); + final uri = DartUri('$testPackageLib'); + expect(uri.serverPath, serverPath); + }); - test('file path to another package', () { - final testLib = Uri.file(p.join(testDir, 'lib', 'library.dart')); - final dartUri = DartUri('$testLib'); - expect(dartUri.serverPath, anotherServerPath); - }); + test('file path to another package', () { + final testLib = Uri.file(p.join(testDir, 'lib', 'library.dart')); + final dartUri = DartUri('$testLib'); + expect(dartUri.serverPath, anotherServerPath); }); - } - }, - // TODO(https://github.com/dart-lang/webdev/issues/1818): Re-enable. - skip: !supportedMode( - compilationMode: compilationMode, nullSafetyMode: NullSafety.weak), - ); + }); + } + }); } } diff --git a/dwds/test/dart_uri_test.dart b/dwds/test/dart_uri_test.dart index ad912f68d..f58427a17 100644 --- a/dwds/test/dart_uri_test.dart +++ b/dwds/test/dart_uri_test.dart @@ -14,6 +14,7 @@ import 'package:test/test.dart'; import 'fixtures/logging.dart'; import 'fixtures/fakes.dart'; +import 'fixtures/utilities.dart'; class TestStrategy extends FakeStrategy { @override @@ -83,7 +84,7 @@ void main() { group('initialized with current SDK directory', () { setUpAll(() async { final sdkConfiguration = - await DefaultSdkConfigurationProvider().configuration; + await TestSdkConfigurationProvider().configuration; await DartUri.initialize(sdkConfiguration); await DartUri.recordAbsoluteUris(['dart:io', 'dart:html']); }); diff --git a/dwds/test/expression_compiler_service_test.dart b/dwds/test/expression_compiler_service_test.dart index f64a43488..a1c2b1e7d 100644 --- a/dwds/test/expression_compiler_service_test.dart +++ b/dwds/test/expression_compiler_service_test.dart @@ -10,6 +10,7 @@ import 'dart:io'; import 'package:dwds/expression_compiler.dart'; import 'package:dwds/src/services/expression_compiler_service.dart'; +import 'package:dwds/src/utilities/sdk_configuration.dart'; import 'package:dwds/src/utilities/shared.dart'; import 'package:logging/logging.dart'; import 'package:path/path.dart' as p; @@ -69,7 +70,12 @@ void main() async { // start expression compilation service Response assetHandler(request) => Response(200, body: File.fromUri(kernel).readAsBytesSync()); - _service = ExpressionCompilerService('localhost', port, verbose: false); + _service = ExpressionCompilerService( + 'localhost', + port, + verbose: false, + sdkConfigurationProvider: DefaultSdkConfigurationProvider(), + ); await service.initialize(moduleFormat: 'amd'); diff --git a/dwds/test/fixtures/context.dart b/dwds/test/fixtures/context.dart index c8c8983dd..b64509e6f 100644 --- a/dwds/test/fixtures/context.dart +++ b/dwds/test/fixtures/context.dart @@ -21,7 +21,6 @@ import 'package:dwds/src/loaders/strategy.dart'; import 'package:dwds/src/readers/proxy_server_asset_reader.dart'; import 'package:dwds/src/services/expression_compiler_service.dart'; import 'package:dwds/src/utilities/dart_uri.dart'; -import 'package:dwds/src/utilities/sdk_configuration.dart'; import 'package:dwds/src/utilities/shared.dart'; import 'package:file/local.dart'; import 'package:frontend_server_common/src/resident_runner.dart'; @@ -195,21 +194,16 @@ class TestContext { CompilationMode compilationMode = CompilationMode.buildDaemon, bool enableExpressionEvaluation = false, bool verboseCompiler = false, - SdkConfigurationProvider? sdkConfigurationProvider, bool useDebuggerModuleNames = false, bool launchChrome = true, bool isFlutterApp = false, bool isInternalBuild = false, }) async { - // TODO(https://github.com/dart-lang/webdev/issues/1591): Support compiling - // with sound null-safety in Frontend Server. - if (compilationMode == CompilationMode.frontendServer && - nullSafety == NullSafety.sound) { - throw Exception( - 'Frontend Server compilation does not support sound null-safety. See https://github.com/dart-lang/webdev/issues/1591'); - } - - sdkConfigurationProvider ??= DefaultSdkConfigurationProvider(); + // Generate missing SDK assets if needed. + final sdkConfigurationProvider = + TestSdkConfigurationProvider(verboseCompiler: verboseCompiler); + final configuration = await sdkConfigurationProvider.configuration; + configuration.validate(); try { DartUri.currentDirectory = workingDirectory; @@ -413,6 +407,7 @@ class TestContext { ddcService, isFlutterApp, isInternalBuild, + sdkConfigurationProvider, ); _appUrl = basePath.isEmpty diff --git a/dwds/test/fixtures/sdk_asset_generator.dart b/dwds/test/fixtures/sdk_asset_generator.dart new file mode 100644 index 000000000..3710a181b --- /dev/null +++ b/dwds/test/fixtures/sdk_asset_generator.dart @@ -0,0 +1,239 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:dwds/src/utilities/sdk_configuration.dart'; +import 'package:file/file.dart'; +import 'package:file/local.dart'; +import 'package:logging/logging.dart'; +import 'package:path/path.dart' as p; + +/// Generates sdk.js, sdk.map, sdk full dill, and sdk summary files. +/// +/// Generates following missing assets if needed: +/// - sound null safety: js, source map, full dill. +/// - weak null safety: js, source map, full dill, summary. +class SdkAssetGenerator { + static bool _sdkAssetsGenerated = false; + final _logger = Logger('SdkAssetGenerator'); + + final FileSystem fileSystem; + final bool verboseCompiler; + + late final SdkLayout sdkLayout; + + SdkAssetGenerator({ + this.fileSystem = const LocalFileSystem(), + required this.sdkLayout, + this.verboseCompiler = false, + }); + + /// Generate all SDK assets, once for the current executable run. + Future generateSdkAssets() async { + if (!_sdkAssetsGenerated) { + _sdkAssetsGenerated = true; + + // SDK contains sound summary, but SDK js and full dill are + // normally generated by setup tools and their builds, + // i.e. flutter SDK or build_web_compilers. + // Generate missing files for tests if needed. + await _generateSdkJavaScript(soundNullSafety: true); + + // SDK does not contain any weak assets, generate them. + await _generateSdkJavaScript(soundNullSafety: false); + await _generateSdkSummary(soundNullSafety: false); + } + } + + Future _generateSdkJavaScript({required bool soundNullSafety}) async { + Directory? outputDir; + try { + // Files to copy generated files to. + final outputJsPath = + soundNullSafety ? sdkLayout.soundJsPath : sdkLayout.weakJsPath; + final outputJsMapPath = + soundNullSafety ? sdkLayout.soundJsMapPath : sdkLayout.weakJsMapPath; + final outputFullDillPath = soundNullSafety + ? sdkLayout.soundFullDillPath + : sdkLayout.weakFullDillPath; + + final hasJsAsset = _exists(outputJsPath); + final hasJsMapAsset = _exists(outputJsMapPath); + final hasFullDillAsset = _exists(outputFullDillPath); + final hasAssets = hasFullDillAsset && hasJsAsset && hasJsMapAsset; + + // Files already exist. + if (hasAssets) return; + + // Generate missing files. + outputDir = fileSystem.systemTempDirectory.createTempSync(); + + // Files to generate + final jsPath = soundNullSafety + ? p.join(outputDir.path, sdkLayout.sdkJsSoundFileName) + : p.join(outputDir.path, sdkLayout.sdkJsWeakFileName); + final jsMapPath = p.setExtension(jsPath, '.js.map'); + final fullDillPath = p.setExtension(jsPath, '.dill'); + + _logger.info('Generating js and full dill SDK files...'); + + final sdkDirectoryUri = fileSystem.directory(sdkLayout.sdkDirectory).uri; + final args = [ + sdkLayout.dartdevcSnapshotPath, + '--compile-sdk', + '--multi-root', + '$sdkDirectoryUri', + '--multi-root-scheme', + 'org-dartlang-sdk', + '--libraries-file', + 'org-dartlang-sdk:///lib/libraries.json', + '--modules', + 'amd', + if (soundNullSafety) + '--sound-null-safety' + else + '--no-sound-null-safety', + 'dart:core', + '-o', + jsPath, + ]; + + final output = []; + _logger.fine('Executing dart ${args.join(' ')}'); + final process = await Process.start(Platform.resolvedExecutable, args, + workingDirectory: sdkLayout.sdkDirectory); + + process.stdout + .transform(utf8.decoder) + .transform(const LineSplitter()) + .listen((line) { + _logger.fine(line); + output.add(line); + }); + + process.stderr + .transform(utf8.decoder) + .transform(const LineSplitter()) + .listen((line) { + _logger.warning(line); + output.add(line); + }); + + await process.exitCode.then((int code) { + if (code != 0) { + _logger.warning('Error generating $jsPath: ${output.join('\n')}'); + throw Exception('The Dart compiler exited unexpectedly'); + } + }); + + await _moveAndValidate(jsPath, outputJsPath); + await _moveAndValidate(jsMapPath, outputJsMapPath); + await _moveAndValidate(fullDillPath, outputFullDillPath); + + _logger.info('Done generating js and full dill SDK files.'); + } catch (e, s) { + _logger.severe( + 'Failed to generate SDK js, source map, and full dill', e, s); + rethrow; + } finally { + outputDir?.deleteSync(recursive: true); + } + } + + Future _generateSdkSummary({required bool soundNullSafety}) async { + Directory? outputDir; + try { + // Files to copy generated files to. + final outputSummaryPath = soundNullSafety + ? sdkLayout.soundSummaryPath + : sdkLayout.weakSummaryPath; + final hasAssets = _exists(outputSummaryPath); + + // Files already exist. + if (hasAssets) return; + + // Generate missing files. + outputDir = fileSystem.systemTempDirectory.createTempSync(); + final summaryPath = soundNullSafety + ? p.join(outputDir.path, sdkLayout.sdkSummarySoundFileName) + : p.join(outputDir.path, sdkLayout.sdkSummaryWeakFileName); + + _logger.info('Generating SDK summary files...'); + + final sdkDirectoryUri = fileSystem.directory(sdkLayout.sdkDirectory).uri; + final args = [ + sdkLayout.kernelWorkerSnapshotPath, + '--target', + 'ddc', + '--multi-root', + '$sdkDirectoryUri', + '--multi-root-scheme', + 'org-dartlang-sdk', + '--libraries-file', + 'org-dartlang-sdk:///lib/libraries.json', + '--source', + 'dart:core', + '--summary-only', + if (soundNullSafety) + '--sound-null-safety' + else + '--no-sound-null-safety', + '--output', + summaryPath, + if (verboseCompiler) '--verbose', + ]; + + _logger.fine('Executing dart ${args.join(' ')}'); + final process = await Process.start(Platform.resolvedExecutable, args, + workingDirectory: sdkLayout.sdkDirectory); + + final output = []; + process.stdout + .transform(utf8.decoder) + .transform(const LineSplitter()) + .listen((line) { + _logger.fine(line); + output.add(line); + }); + + process.stderr + .transform(utf8.decoder) + .transform(const LineSplitter()) + .listen((line) { + _logger.warning(line); + output.add(line); + }); + + await process.exitCode.then((int code) { + if (code != 0) { + _logger + .warning('Error generating $summaryPath: ${output.join('\n')}'); + throw Exception('The Dart kernel worker exited unexpectedly'); + } + }); + + await _moveAndValidate(summaryPath, outputSummaryPath); + + _logger.info('Done generating SDK summary files.'); + } catch (e, s) { + _logger.severe('Failed to generate SDK summary', e, s); + rethrow; + } finally { + outputDir?.deleteSync(recursive: true); + } + } + + bool _exists(String path) => fileSystem.file(path).existsSync(); + void _delete(String path) => fileSystem.file(path).deleteSync(); + + Future _moveAndValidate(String from, String to) async { + _logger.fine('Renaming $from to $to'); + + if (_exists(to)) _delete(to); + await fileSystem.file(from).rename(to); + + if (!_exists(to)) { + _logger.severe('Failed to generate SDK asset at $to'); + throw Exception('File does not exist.'); + } + } +} diff --git a/dwds/test/fixtures/server.dart b/dwds/test/fixtures/server.dart index 0f1a97f46..73db1462e 100644 --- a/dwds/test/fixtures/server.dart +++ b/dwds/test/fixtures/server.dart @@ -14,6 +14,7 @@ import 'package:dwds/src/loaders/require.dart'; import 'package:dwds/src/servers/devtools.dart'; import 'package:dwds/src/services/expression_compiler_service.dart'; import 'package:dwds/src/utilities/shared.dart'; +import 'package:dwds/src/utilities/sdk_configuration.dart'; import 'package:logging/logging.dart'; import 'package:shelf/shelf.dart'; import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; @@ -82,6 +83,7 @@ class TestServer { ExpressionCompilerService? ddcService, bool isFlutterApp, bool isInternalBuild, + SdkConfigurationProvider sdkConfigurationProvider, ) async { var pipeline = const Pipeline(); @@ -117,6 +119,7 @@ class TestServer { expressionCompiler: expressionCompiler, isInternalBuild: isInternalBuild, isFlutterApp: isFlutterApp, + sdkConfigurationProvider: sdkConfigurationProvider, devtoolsLauncher: serveDevTools ? (hostname) async { final server = await DevToolsServer().serveDevTools( diff --git a/dwds/test/fixtures/utilities.dart b/dwds/test/fixtures/utilities.dart index 1f153da02..18e5a2a2e 100644 --- a/dwds/test/fixtures/utilities.dart +++ b/dwds/test/fixtures/utilities.dart @@ -7,8 +7,11 @@ import 'dart:io'; import 'package:build_daemon/client.dart'; import 'package:build_daemon/constants.dart'; import 'package:build_daemon/data/server_log.dart'; +import 'package:dwds/src/utilities/sdk_configuration.dart'; import 'package:path/path.dart' as p; +import 'sdk_asset_generator.dart'; + const webdevDirName = 'webdev'; const dwdsDirName = 'dwds'; const fixturesDirName = 'fixtures'; @@ -153,3 +156,46 @@ Future retryFnAsync( failureMessage: failureMessage, ); } + +/// Implementation for SDK configuration for tests that can generate +/// missing assets. +/// +/// - Generate SDK js, source map, and full dill for weak and sound +/// modes (normally included in flutter SDK or produced by build). +/// - Need to generate SDK summary for weak null safety mode as it +/// is not provided by the SDK installation. +/// +/// TODO(annagrin): update to only generating missing sound artifacts +/// for frontend server after we have no uses of weak null safety. +class TestSdkConfigurationProvider extends SdkConfigurationProvider { + final bool _verboseCompiler; + SdkConfiguration? _configuration; + + TestSdkConfigurationProvider({bool verboseCompiler = false}) + : _verboseCompiler = verboseCompiler; + + @override + Future get configuration async => + _configuration ??= await _create(); + + /// Generate missing assets in the default SDK layout. + Future _create() async { + final sdk = SdkConfiguration.defaultConfiguration; + final sdkLayout = SdkConfiguration.defaultSdkLayout; + + final assetGenerator = SdkAssetGenerator( + sdkLayout: sdkLayout, + verboseCompiler: _verboseCompiler, + ); + + if (sdkLayout.soundSummaryPath != sdk.soundSdkSummaryPath) { + throw StateError('Invalid asset path ${sdkLayout.soundSummaryPath}'); + } + if (sdkLayout.weakSummaryPath != sdk.weakSdkSummaryPath) { + throw StateError('Invalid asset path ${sdkLayout.weakSummaryPath}'); + } + + await assetGenerator.generateSdkAssets(); + return sdk; + } +} diff --git a/dwds/test/frontend_server_breakpoint_test.dart b/dwds/test/frontend_server_breakpoint_test.dart index ba190c46d..4b11784fc 100644 --- a/dwds/test/frontend_server_breakpoint_test.dart +++ b/dwds/test/frontend_server_breakpoint_test.dart @@ -14,7 +14,6 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; import 'fixtures/logging.dart'; -import 'utils/version_compatibility.dart'; final context = TestContext.withWeakNullSafety( packageName: '_testPackage', @@ -37,107 +36,99 @@ void main() { // currently redirected to a logger. As a result, it will be printed // regardless of the logger settings. final verboseCompiler = false; - group( - 'shared context', - () { - setUpAll(() async { + group('shared context', () { + setUpAll(() async { + setCurrentLogWriter(debug: debug); + await context.setUp( + compilationMode: CompilationMode.frontendServer, + verboseCompiler: verboseCompiler, + ); + }); + + tearDownAll(() async { + await context.tearDown(); + }); + + group('breakpoint', () { + VM vm; + late Isolate isolate; + late String isolateId; + ScriptList scripts; + late ScriptRef mainScript; + late String mainScriptUri; + late Stream stream; + + setUp(() async { setCurrentLogWriter(debug: debug); - await context.setUp( - compilationMode: CompilationMode.frontendServer, - verboseCompiler: verboseCompiler, - ); + vm = await service.getVM(); + isolate = await service.getIsolate(vm.isolates!.first.id!); + isolateId = isolate.id!; + scripts = await service.getScripts(isolateId); + + await service.streamListen('Debug'); + stream = service.onEvent('Debug'); + + mainScript = scripts.scripts! + .firstWhere((each) => each.uri!.contains('main.dart')); + mainScriptUri = mainScript.uri!; + }); + + tearDown(() async { + await service.resume(isolateId); + }); + + test('set breakpoint', () async { + final line = await context.findBreakpointLine( + 'printLocal', isolateId, mainScript); + final bp = await service.addBreakpointWithScriptUri( + isolateId, mainScriptUri, line); + + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseBreakpoint); + + expect(bp, isNotNull); + + // Remove breakpoint so it doesn't impact other tests. + await service.removeBreakpoint(isolateId, bp.id!); }); - tearDownAll(() async { - await context.tearDown(); + test('set breakpoint again', () async { + final line = await context.findBreakpointLine( + 'printLocal', isolateId, mainScript); + final bp = await service.addBreakpointWithScriptUri( + isolateId, mainScriptUri, line); + + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseBreakpoint); + + expect(bp, isNotNull); + + // Remove breakpoint so it doesn't impact other tests. + await service.removeBreakpoint(isolateId, bp.id!); }); - group('breakpoint', () { - VM vm; - late Isolate isolate; - late String isolateId; - ScriptList scripts; - late ScriptRef mainScript; - late String mainScriptUri; - late Stream stream; - - setUp(() async { - setCurrentLogWriter(debug: debug); - vm = await service.getVM(); - isolate = await service.getIsolate(vm.isolates!.first.id!); - isolateId = isolate.id!; - scripts = await service.getScripts(isolateId); - - await service.streamListen('Debug'); - stream = service.onEvent('Debug'); - - mainScript = scripts.scripts! - .firstWhere((each) => each.uri!.contains('main.dart')); - mainScriptUri = mainScript.uri!; - }); - - tearDown(() async { - await service.resume(isolateId); - }); - - test('set breakpoint', () async { - final line = await context.findBreakpointLine( - 'printLocal', isolateId, mainScript); - final bp = await service.addBreakpointWithScriptUri( - isolateId, mainScriptUri, line); - - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseBreakpoint); - - expect(bp, isNotNull); - - // Remove breakpoint so it doesn't impact other tests. - await service.removeBreakpoint(isolateId, bp.id!); - }); - - test('set breakpoint again', () async { - final line = await context.findBreakpointLine( - 'printLocal', isolateId, mainScript); - final bp = await service.addBreakpointWithScriptUri( - isolateId, mainScriptUri, line); - - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseBreakpoint); - - expect(bp, isNotNull); - - // Remove breakpoint so it doesn't impact other tests. - await service.removeBreakpoint(isolateId, bp.id!); - }); - - test('set breakpoint inside a JavaScript line succeeds', () async { - final line = await context.findBreakpointLine( - 'printNestedObjectMultiLine', isolateId, mainScript); - final column = 0; - final bp = await service.addBreakpointWithScriptUri( - isolateId, mainScriptUri, line, - column: column); - - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseBreakpoint); - - expect(bp, isNotNull); - expect( - bp.location, - isA() - .having((loc) => loc.script, 'script', equals(mainScript)) - .having((loc) => loc.line, 'line', equals(line)) - .having((loc) => loc.column, 'column', greaterThan(column))); - - // Remove breakpoint so it doesn't impact other tests. - await service.removeBreakpoint(isolateId, bp.id!); - }); + test('set breakpoint inside a JavaScript line succeeds', () async { + final line = await context.findBreakpointLine( + 'printNestedObjectMultiLine', isolateId, mainScript); + final column = 0; + final bp = await service.addBreakpointWithScriptUri( + isolateId, mainScriptUri, line, + column: column); + + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseBreakpoint); + + expect(bp, isNotNull); + expect( + bp.location, + isA() + .having((loc) => loc.script, 'script', equals(mainScript)) + .having((loc) => loc.line, 'line', equals(line)) + .having((loc) => loc.column, 'column', greaterThan(column))); + + // Remove breakpoint so it doesn't impact other tests. + await service.removeBreakpoint(isolateId, bp.id!); }); - }, - // TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable. - skip: !supportedMode( - compilationMode: CompilationMode.frontendServer, - nullSafetyMode: NullSafety.weak, - ), - ); + }); + }); } diff --git a/dwds/test/frontend_server_callstack_test.dart b/dwds/test/frontend_server_callstack_test.dart index e1cb27c9a..f2f837204 100644 --- a/dwds/test/frontend_server_callstack_test.dart +++ b/dwds/test/frontend_server_callstack_test.dart @@ -14,7 +14,6 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart'; import 'fixtures/context.dart'; import 'fixtures/logging.dart'; -import 'utils/version_compatibility.dart'; class TestSetup { static final contextUnsound = TestContext.withWeakNullSafety( @@ -48,273 +47,263 @@ void main() { final debug = false; for (var nullSafety in NullSafety.values) { - group( - '${nullSafety.name} null safety |', - () { - final soundNullSafety = nullSafety == NullSafety.sound; - final setup = - soundNullSafety ? TestSetup.sound() : TestSetup.unsound(); - final context = setup.context; - - setUpAll(() async { + group('${nullSafety.name} null safety |', () { + final soundNullSafety = nullSafety == NullSafety.sound; + final setup = soundNullSafety ? TestSetup.sound() : TestSetup.unsound(); + final context = setup.context; + + setUpAll(() async { + setCurrentLogWriter(debug: debug); + await context.setUp( + compilationMode: CompilationMode.frontendServer, + enableExpressionEvaluation: true, + verboseCompiler: debug); + }); + + tearDownAll(() async { + await context.tearDown(); + }); + + group('callStack |', () { + late ChromeProxyService service; + VM vm; + late Isolate isolate; + late String isolateId; + ScriptList scripts; + late ScriptRef mainScript; + late ScriptRef testLibraryScript; + late Stream stream; + + setUp(() async { setCurrentLogWriter(debug: debug); - await context.setUp( - compilationMode: CompilationMode.frontendServer, - enableExpressionEvaluation: true, - verboseCompiler: debug); + service = setup.service; + vm = await service.getVM(); + isolate = await service.getIsolate(vm.isolates!.first.id!); + isolateId = isolate.id!; + scripts = await service.getScripts(isolateId); + + await service.streamListen('Debug'); + stream = service.onEvent('Debug'); + + final testPackage = + soundNullSafety ? '_test_package_sound' : '_test_package'; + + mainScript = scripts.scripts! + .firstWhere((each) => each.uri!.contains('main.dart')); + testLibraryScript = scripts.scripts!.firstWhere((each) => + each.uri!.contains('package:$testPackage/test_library.dart')); }); - tearDownAll(() async { - await context.tearDown(); + tearDown(() async { + await service.resume(isolateId); }); - group('callStack |', () { - late ChromeProxyService service; - VM vm; - late Isolate isolate; - late String isolateId; - ScriptList scripts; - late ScriptRef mainScript; - late ScriptRef testLibraryScript; - late Stream stream; - - setUp(() async { - setCurrentLogWriter(debug: debug); - service = setup.service; - vm = await service.getVM(); - isolate = await service.getIsolate(vm.isolates!.first.id!); - isolateId = isolate.id!; - scripts = await service.getScripts(isolateId); - - await service.streamListen('Debug'); - stream = service.onEvent('Debug'); - - final testPackage = - soundNullSafety ? '_test_package_sound' : '_test_package'; - - mainScript = scripts.scripts! - .firstWhere((each) => each.uri!.contains('main.dart')); - testLibraryScript = scripts.scripts!.firstWhere((each) => - each.uri!.contains('package:$testPackage/test_library.dart')); - }); - - tearDown(() async { - await service.resume(isolateId); - }); - - Future onBreakPoint(BreakpointTestData breakpoint, - Future Function() body) async { - Breakpoint? bp; - try { - final bpId = breakpoint.bpId; - final script = breakpoint.script; - final line = - await context.findBreakpointLine(bpId, isolateId, script); - bp = await setup.service - .addBreakpointWithScriptUri(isolateId, script.uri!, line); - - expect(bp, isNotNull); - expect(bp.location, _matchBpLocation(script, line, 0)); - - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseBreakpoint); - - await body(); - } finally { - // Remove breakpoint so it doesn't impact other tests or retries. - if (bp != null) { - await setup.service.removeBreakpoint(isolateId, bp.id!); - } + Future onBreakPoint(BreakpointTestData breakpoint, + Future Function() body) async { + Breakpoint? bp; + try { + final bpId = breakpoint.bpId; + final script = breakpoint.script; + final line = + await context.findBreakpointLine(bpId, isolateId, script); + bp = await setup.service + .addBreakpointWithScriptUri(isolateId, script.uri!, line); + + expect(bp, isNotNull); + expect(bp.location, _matchBpLocation(script, line, 0)); + + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseBreakpoint); + + await body(); + } finally { + // Remove breakpoint so it doesn't impact other tests or retries. + if (bp != null) { + await setup.service.removeBreakpoint(isolateId, bp.id!); } } + } + + Future testCallStack(List breakpoints, + {int frameIndex = 1}) async { + // Find lines the breakpoints are located on. + final lines = await Future.wait(breakpoints.map((frame) => context + .findBreakpointLine(frame.bpId, isolateId, frame.script))); + + // Get current stack. + final stack = await service.getStack(isolateId); + + // Verify the stack is correct. + expect(stack.frames!.length, greaterThanOrEqualTo(lines.length)); + final expected = [ + for (var i = 0; i < lines.length; i++) + _matchFrame( + breakpoints[i].script, breakpoints[i].function, lines[i]) + ]; + expect(stack.frames, containsAll(expected)); + + // Verify that expression evaluation is not failing. + final instance = + await service.evaluateInFrame(isolateId, frameIndex, 'true'); + expect(instance, isA()); + } + + test('breakpoint succeeds with correct callstack', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'printEnclosingObject', + 'printEnclosingObject', + mainScript, + ), + BreakpointTestData( + 'printEnclosingFunctionMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint( + breakpoints[0], () => testCallStack(breakpoints)); + }); - Future testCallStack(List breakpoints, - {int frameIndex = 1}) async { - // Find lines the breakpoints are located on. - final lines = await Future.wait(breakpoints.map((frame) => context - .findBreakpointLine(frame.bpId, isolateId, frame.script))); - - // Get current stack. - final stack = await service.getStack(isolateId); - - // Verify the stack is correct. - expect(stack.frames!.length, greaterThanOrEqualTo(lines.length)); - final expected = [ - for (var i = 0; i < lines.length; i++) - _matchFrame( - breakpoints[i].script, breakpoints[i].function, lines[i]) - ]; - expect(stack.frames, containsAll(expected)); - - // Verify that expression evaluation is not failing. - final instance = - await service.evaluateInFrame(isolateId, frameIndex, 'true'); - expect(instance, isA()); - } - - test('breakpoint succeeds with correct callstack', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'printEnclosingObject', - 'printEnclosingObject', - mainScript, - ), - BreakpointTestData( - 'printEnclosingFunctionMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint( - breakpoints[0], () => testCallStack(breakpoints)); - }); - - test('expression evaluation succeeds on parent frame', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'testLibraryClassConstructor', - 'new', - testLibraryScript, - ), - BreakpointTestData( - 'createLibraryObject', - 'printFieldFromLibraryClass', - mainScript, - ), - BreakpointTestData( - 'callPrintFieldFromLibraryClass', - '', - mainScript, - ), - ]; - await onBreakPoint(breakpoints[0], - () => testCallStack(breakpoints, frameIndex: 2)); - }); + test('expression evaluation succeeds on parent frame', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'testLibraryClassConstructor', + 'new', + testLibraryScript, + ), + BreakpointTestData( + 'createLibraryObject', + 'printFieldFromLibraryClass', + mainScript, + ), + BreakpointTestData( + 'callPrintFieldFromLibraryClass', + '', + mainScript, + ), + ]; + await onBreakPoint(breakpoints[0], + () => testCallStack(breakpoints, frameIndex: 2)); + }); - test('breakpoint inside a line gives correct callstack', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printNestedObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint( - breakpoints[0], () => testCallStack(breakpoints)); - }); + test('breakpoint inside a line gives correct callstack', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printNestedObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint( + breakpoints[0], () => testCallStack(breakpoints)); + }); - test('breakpoint gives correct callstack after step out', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printEnclosingObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint(breakpoints[0], () async { - await service.resume(isolateId, step: 'Out'); - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseInterrupted); - return testCallStack([breakpoints[1], breakpoints[2]]); - }); + test('breakpoint gives correct callstack after step out', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printEnclosingObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint(breakpoints[0], () async { + await service.resume(isolateId, step: 'Out'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted); + return testCallStack([breakpoints[1], breakpoints[2]]); }); + }); - test('breakpoint gives correct callstack after step in', () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'newEnclosedClass', - 'new', - mainScript, - ), - BreakpointTestData( - 'printNestedObjectMultiLine', - 'printNestedObjectsMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintEnclosingFunctionMultiLine', - '', - mainScript, - ), - ]; - await onBreakPoint(breakpoints[1], () async { - await service.resume(isolateId, step: 'Into'); - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseInterrupted); - return testCallStack(breakpoints); - }); + test('breakpoint gives correct callstack after step in', () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'newEnclosedClass', + 'new', + mainScript, + ), + BreakpointTestData( + 'printNestedObjectMultiLine', + 'printNestedObjectsMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintEnclosingFunctionMultiLine', + '', + mainScript, + ), + ]; + await onBreakPoint(breakpoints[1], () async { + await service.resume(isolateId, step: 'Into'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted); + return testCallStack(breakpoints); }); + }); - test( - 'breakpoint gives correct callstack after step into chain calls', - () async { - // Expected breakpoints on the stack - final breakpoints = [ - BreakpointTestData( - 'createObjectWithMethod', - 'createObject', - mainScript, - ), - BreakpointTestData( - // This is currently incorrect, should be printObjectMultiLine. - // See issue: https://github.com/dart-lang/sdk/issues/48874 - 'printMultiLine', - 'printObjectMultiLine', - mainScript, - ), - BreakpointTestData( - 'callPrintObjectMultiLine', - '', - mainScript, - ), - ]; - final bp = BreakpointTestData( - 'printMultiLine', 'printObjectMultiLine', mainScript); - await onBreakPoint(bp, () async { - await service.resume(isolateId, step: 'Into'); - await stream.firstWhere( - (Event event) => event.kind == EventKind.kPauseInterrupted); - return testCallStack(breakpoints); - }); + test('breakpoint gives correct callstack after step into chain calls', + () async { + // Expected breakpoints on the stack + final breakpoints = [ + BreakpointTestData( + 'createObjectWithMethod', + 'createObject', + mainScript, + ), + BreakpointTestData( + // This is currently incorrect, should be printObjectMultiLine. + // See issue: https://github.com/dart-lang/sdk/issues/48874 + 'printMultiLine', + 'printObjectMultiLine', + mainScript, + ), + BreakpointTestData( + 'callPrintObjectMultiLine', + '', + mainScript, + ), + ]; + final bp = BreakpointTestData( + 'printMultiLine', 'printObjectMultiLine', mainScript); + await onBreakPoint(bp, () async { + await service.resume(isolateId, step: 'Into'); + await stream.firstWhere( + (Event event) => event.kind == EventKind.kPauseInterrupted); + return testCallStack(breakpoints); }); }); - }, - // TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable. - skip: !supportedMode( - compilationMode: CompilationMode.frontendServer, - nullSafetyMode: nullSafety, - ), - ); + }); + }); } }); } diff --git a/dwds/test/frontend_server_circular_evaluate_test.dart b/dwds/test/frontend_server_circular_evaluate_test.dart index e8b92e76f..0e2c89441 100644 --- a/dwds/test/frontend_server_circular_evaluate_test.dart +++ b/dwds/test/frontend_server_circular_evaluate_test.dart @@ -12,7 +12,6 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; import 'evaluate_circular_common.dart'; -import 'utils/version_compatibility.dart'; void main() async { // Enable verbose logging for debugging. @@ -39,15 +38,8 @@ void main() async { skip: // https://github.com/dart-lang/sdk/issues/49277 indexBaseMode == IndexBaseMode.base && Platform.isWindows || - // https://github.com/dart-lang/webdev/issues/1591); - nullSafety == NullSafety.sound || // Needs debugger module names change in the SDK to work. - !debuggerModuleNamesSupported || - // TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable. - !supportedMode( - compilationMode: CompilationMode.frontendServer, - nullSafetyMode: nullSafety, - )); + !debuggerModuleNamesSupported); } }); } diff --git a/dwds/test/frontend_server_evaluate_test.dart b/dwds/test/frontend_server_evaluate_test.dart index b489d2a07..61d7d525f 100644 --- a/dwds/test/frontend_server_evaluate_test.dart +++ b/dwds/test/frontend_server_evaluate_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. @TestOn('vm') -@Timeout(Duration(minutes: 2)) +@Timeout(Duration(minutes: 5)) import 'dart:io'; @@ -12,7 +12,6 @@ import 'package:test/test.dart'; import 'fixtures/context.dart'; import 'evaluate_common.dart'; -import 'utils/version_compatibility.dart'; void main() async { // Enable verbose logging for debugging. @@ -28,31 +27,22 @@ void main() async { for (var nullSafety in NullSafety.values) { group('${nullSafety.name} null safety |', () { for (var indexBaseMode in IndexBaseMode.values) { - group( - 'with ${indexBaseMode.name} |', - () { - testAll( - compilationMode: CompilationMode.frontendServer, - indexBaseMode: indexBaseMode, - nullSafety: nullSafety, - useDebuggerModuleNames: useDebuggerModuleNames, - debug: debug, - ); - }, - skip: - // https://github.com/dart-lang/sdk/issues/49277 - (indexBaseMode == IndexBaseMode.base && Platform.isWindows) || - // https://github.com/dart-lang/webdev/issues/1591 - (nullSafety == NullSafety.sound) || - // Needs debugger module names feature in SDK. - (useDebuggerModuleNames && - !debuggerModuleNamesSupported) || - // TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable. - !supportedMode( - compilationMode: CompilationMode.frontendServer, - nullSafetyMode: nullSafety, - ), - ); + group('with ${indexBaseMode.name} |', () { + testAll( + compilationMode: CompilationMode.frontendServer, + indexBaseMode: indexBaseMode, + nullSafety: nullSafety, + useDebuggerModuleNames: useDebuggerModuleNames, + debug: debug, + ); + }, + skip: + // https://github.com/dart-lang/sdk/issues/49277 + (indexBaseMode == IndexBaseMode.base && + Platform.isWindows) || + // Needs debugger module names feature in SDK. + (useDebuggerModuleNames && + !debuggerModuleNamesSupported)); } }); } diff --git a/dwds/test/readers/frontend_server_asset_reader_test.dart b/dwds/test/readers/frontend_server_asset_reader_test.dart index 62a82098f..619038873 100644 --- a/dwds/test/readers/frontend_server_asset_reader_test.dart +++ b/dwds/test/readers/frontend_server_asset_reader_test.dart @@ -10,9 +10,7 @@ import 'package:dwds/src/readers/frontend_server_asset_reader.dart'; import 'package:path/path.dart' as p; import 'package:test/test.dart'; -import '../fixtures/context.dart'; import '../fixtures/utilities.dart'; -import '../utils/version_compatibility.dart'; final packagesDir = absolutePath(pathFromFixtures: '_test'); @@ -112,11 +110,5 @@ void main() { expect(newResult, isNotNull); }); }); - // TODO(https://github.com/dart-lang/webdev/issues/1818): Re-enable. Not sure - // why this is passing locally but failing during CI tests. - }, - skip: !supportedMode( - compilationMode: CompilationMode.frontendServer, - nullSafetyMode: NullSafety.weak, - )); + }); } diff --git a/dwds/test/readers/proxy_server_asset_reader_test.dart b/dwds/test/readers/proxy_server_asset_reader_test.dart index c9b76ccd0..eade1e6b0 100644 --- a/dwds/test/readers/proxy_server_asset_reader_test.dart +++ b/dwds/test/readers/proxy_server_asset_reader_test.dart @@ -8,7 +8,6 @@ import 'package:dwds/src/readers/proxy_server_asset_reader.dart'; import 'package:test/test.dart'; import '../fixtures/context.dart'; -import '../utils/version_compatibility.dart'; void main() { group('ProxyServerAssetReader', () { @@ -40,9 +39,5 @@ void main() { .dartSourceContents('hello_world/foo.unsound.ddc.js.map'); expect(result, isNull); }); - }, - // TODO(https://github.com/dart-lang/webdev/issues/1818) Re-enable. - skip: !supportedMode( - compilationMode: CompilationMode.frontendServer, - nullSafetyMode: NullSafety.weak)); + }); } diff --git a/dwds/test/sdk_asset_generator_test.dart b/dwds/test/sdk_asset_generator_test.dart new file mode 100644 index 000000000..d41b2a59f --- /dev/null +++ b/dwds/test/sdk_asset_generator_test.dart @@ -0,0 +1,170 @@ +// Copyright (c) 2023, 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') +@Timeout(Duration(minutes: 2)) + +import 'dart:io'; + +import 'package:dwds/src/utilities/sdk_configuration.dart'; +import 'package:path/path.dart' as p; +import 'package:test/test.dart'; + +import 'fixtures/logging.dart'; +import 'fixtures/sdk_asset_generator.dart'; + +void main() { + group('SDK asset generator', () { + final bool debug = false; + + late final Directory tempDir; + late String sdkDirectory; + late final String soundSdkSummaryPath; + late final String librariesPath; + late final String compilerWorkerPath; + + // Missing sound assets + late final String soundSdkFullDillPath; + late final String soundSdkJsPath; + late final String soundSdkJsMapPath; + + // Missing weak assets + late final String weakSdkSummaryPath; + late final String weakSdkFullDillPath; + late final String weakSdkJsPath; + late final String weakSdkJsMapPath; + + setUp(() async { + setCurrentLogWriter(debug: debug); + tempDir = Directory.systemTemp.createTempSync(); + + sdkDirectory = tempDir.path; + soundSdkSummaryPath = _soundSdkSummaryPath(sdkDirectory); + librariesPath = _librariesPath(sdkDirectory); + compilerWorkerPath = _compilerWorkerPath(sdkDirectory); + + // Copy the SDK directory into a temp directory. + await _copy(SdkLayout.sdkDir, sdkDirectory); + + // Simulate missing sound assets. + soundSdkFullDillPath = _soundSdkFullDillPath(sdkDirectory); + soundSdkJsPath = _soundSdkJsPath(sdkDirectory); + soundSdkJsMapPath = _soundSdkJsMapPath(sdkDirectory); + + _deleteIfExists(soundSdkFullDillPath); + _deleteIfExists(soundSdkJsPath); + _deleteIfExists(soundSdkJsMapPath); + + // Simulate missing weak assets. + weakSdkSummaryPath = _weakSdkSummaryPath(sdkDirectory); + weakSdkFullDillPath = _weakSdkFullDillPath(sdkDirectory); + weakSdkJsPath = _weakSdkJsPath(sdkDirectory); + weakSdkJsMapPath = _weakSdkJsMapPath(sdkDirectory); + + _deleteIfExists(weakSdkSummaryPath); + _deleteIfExists(weakSdkFullDillPath); + _deleteIfExists(weakSdkJsPath); + _deleteIfExists(weakSdkJsMapPath); + }); + + tearDown(() { + tempDir.deleteSync(recursive: true); + }); + + test('Can generate missing SDK assets and validate SDK configuration', + () async { + final sdkLayout = SdkLayout.createDefault(sdkDirectory); + final configuration = SdkConfiguration.fromSdkLayout(sdkLayout); + + final assetGenerator = + SdkAssetGenerator(sdkLayout: sdkLayout, verboseCompiler: true); + await assetGenerator.generateSdkAssets(); + + // Make sure SDK configuration and asset generator agree on the file paths. + expect(configuration.sdkDirectory, equals(sdkDirectory)); + expect(configuration.librariesPath, equals(librariesPath)); + expect(configuration.compilerWorkerPath, equals(compilerWorkerPath)); + + expect(sdkLayout.soundSummaryPath, equals(soundSdkSummaryPath)); + expect(sdkLayout.soundFullDillPath, equals(soundSdkFullDillPath)); + expect(sdkLayout.soundJsPath, equals(soundSdkJsPath)); + expect(sdkLayout.soundJsMapPath, equals(soundSdkJsMapPath)); + + expect(sdkLayout.weakSummaryPath, equals(weakSdkSummaryPath)); + expect(sdkLayout.weakFullDillPath, equals(weakSdkFullDillPath)); + expect(sdkLayout.weakJsPath, equals(weakSdkJsPath)); + expect(sdkLayout.weakJsMapPath, equals(weakSdkJsMapPath)); + + // Validate that configuration files exist. + configuration.validateSdkDir(); + configuration.validate(); + + // Validate all assets exist. + expect(sdkLayout.soundSummaryPath, _exists); + expect(sdkLayout.soundFullDillPath, _exists); + expect(sdkLayout.soundJsPath, _exists); + expect(sdkLayout.soundJsMapPath, _exists); + + expect(sdkLayout.weakSummaryPath, _exists); + expect(sdkLayout.weakFullDillPath, _exists); + expect(sdkLayout.weakJsPath, _exists); + expect(sdkLayout.weakJsMapPath, _exists); + }); + }); +} + +String _weakSdkSummaryPath(String sdkDir) => + p.join(sdkDir, 'lib', '_internal', 'ddc_sdk.dill'); + +String _soundSdkSummaryPath(String sdkDir) => + p.join(sdkDir, 'lib', '_internal', 'ddc_outline_sound.dill'); + +String _weakSdkFullDillPath(String sdkDir) => + p.join(sdkDir, 'lib', '_internal', 'ddc_platform.dill'); + +String _soundSdkFullDillPath(String sdkDir) => + p.join(sdkDir, 'lib', '_internal', 'ddc_platform_sound.dill'); + +String _weakSdkJsPath(String sdkDir) => + p.join(sdkDir, 'lib', 'dev_compiler', 'kernel', 'amd', 'dart_sdk.js'); + +String _soundSdkJsPath(String sdkDir) => + p.join(sdkDir, 'lib', 'dev_compiler', 'kernel', 'amd', 'dart_sdk_sound.js'); + +String _weakSdkJsMapPath(String sdkDir) => + p.join(sdkDir, 'lib', 'dev_compiler', 'kernel', 'amd', 'dart_sdk.js.map'); + +String _soundSdkJsMapPath(String sdkDir) => p.join( + sdkDir, 'lib', 'dev_compiler', 'kernel', 'amd', 'dart_sdk_sound.js.map'); + +String _librariesPath(String sdkDir) => p.join(sdkDir, 'lib', 'libraries.json'); + +String _compilerWorkerPath(String sdkDir) => + p.join(sdkDir, 'bin', 'snapshots', 'dartdevc.dart.snapshot'); + +Matcher _exists = predicate((String path) => File(path).existsSync()); + +void _deleteIfExists(String path) { + final file = File(path); + if (file.existsSync()) { + file.deleteSync(); + } +} + +// Update modified files. +Future _copy(String from, String to) async { + if (!Directory(from).existsSync()) return; + await Directory(to).create(recursive: true); + + await for (final file in Directory(from).list()) { + final copyTo = p.join(to, p.relative(file.path, from: from)); + if (file is Directory) { + await _copy(file.path, copyTo); + } else if (file is File) { + await File(file.path).copy(copyTo); + } else if (file is Link) { + await Link(copyTo).create(await file.target(), recursive: true); + } + } +} diff --git a/dwds/test/sdk_configuration_test.dart b/dwds/test/sdk_configuration_test.dart index 5151b5653..656024cb3 100644 --- a/dwds/test/sdk_configuration_test.dart +++ b/dwds/test/sdk_configuration_test.dart @@ -56,13 +56,13 @@ void main() { File(defaultSdkConfiguration.librariesPath!).copySync(librariesPath); final summariesDir = p.join(sdkDirectory, 'summaries'); - final unsoundSdkSummaryPath = p.join(summariesDir, 'ddc_sdk.dill'); + final weakSdkSummaryPath = p.join(summariesDir, 'ddc_sdk.dill'); final soundSdkSummaryPath = p.join(summariesDir, 'ddc_outline_sound.dill'); Directory(summariesDir).createSync(recursive: true); - File(defaultSdkConfiguration.unsoundSdkSummaryPath!) - .copySync(unsoundSdkSummaryPath); + File(defaultSdkConfiguration.weakSdkSummaryPath!) + .copySync(weakSdkSummaryPath); File(defaultSdkConfiguration.soundSdkSummaryPath!) .copySync(soundSdkSummaryPath); @@ -76,14 +76,13 @@ void main() { final sdkConfiguration = SdkConfiguration( sdkDirectory: sdkDirectory, soundSdkSummaryPath: soundSdkSummaryPath, - unsoundSdkSummaryPath: unsoundSdkSummaryPath, + weakSdkSummaryPath: weakSdkSummaryPath, librariesPath: librariesPath, compilerWorkerPath: compilerWorkerPath, ); expect(sdkConfiguration.sdkDirectory, equals(sdkDirectory)); - expect(sdkConfiguration.unsoundSdkSummaryPath, - equals(unsoundSdkSummaryPath)); + expect(sdkConfiguration.weakSdkSummaryPath, equals(weakSdkSummaryPath)); expect(sdkConfiguration.soundSdkSummaryPath, equals(soundSdkSummaryPath)); expect(sdkConfiguration.librariesPath, equals(librariesPath)); expect(sdkConfiguration.compilerWorkerPath, equals(compilerWorkerPath)); @@ -97,7 +96,7 @@ void main() { final librariesDir = p.join(sdkDir, 'fakespecs'); final librariesPath = p.join(librariesDir, 'libraries.json'); final summariesDir = p.join(sdkDir, 'fakesummaries'); - final unsoundSdkSummaryPath = p.join(summariesDir, 'ddc_sdk.dill'); + final weakSdkSummaryPath = p.join(summariesDir, 'ddc_sdk.dill'); final soundSdkSummaryPath = p.join(summariesDir, 'ddc_outline_sound.dill'); final workerDir = p.join(sdkDir, 'fakesnapshots'); @@ -106,7 +105,7 @@ void main() { final sdkConfiguration = SdkConfiguration( sdkDirectory: sdkDir, soundSdkSummaryPath: soundSdkSummaryPath, - unsoundSdkSummaryPath: unsoundSdkSummaryPath, + weakSdkSummaryPath: weakSdkSummaryPath, librariesPath: librariesPath, compilerWorkerPath: compilerWorkerPath, ); @@ -121,8 +120,8 @@ void main() { final root = '/root'; final sdkDirectory = root; - final soundSdkSummaryPath = _dartSoundSdkSummaryPath(sdkDirectory); - final unsoundSdkSummaryPath = _dartUnsoundSdkSummaryPath(sdkDirectory); + final soundSdkSummaryPath = _soundSdkSummaryPath(sdkDirectory); + final weakSdkSummaryPath = _weakSdkSummaryPath(sdkDirectory); final librariesPath = _librariesPath(sdkDirectory); final compilerWorkerPath = _compilerWorkerPath(root); @@ -130,7 +129,7 @@ void main() { fs = MemoryFileSystem(); await fs.directory(sdkDirectory).create(recursive: true); await fs.file(soundSdkSummaryPath).create(recursive: true); - await fs.file(unsoundSdkSummaryPath).create(recursive: true); + await fs.file(weakSdkSummaryPath).create(recursive: true); await fs.file(librariesPath).create(recursive: true); await fs.file(compilerWorkerPath).create(recursive: true); }); @@ -139,15 +138,14 @@ void main() { final configuration = SdkConfiguration( sdkDirectory: sdkDirectory, soundSdkSummaryPath: soundSdkSummaryPath, - unsoundSdkSummaryPath: unsoundSdkSummaryPath, + weakSdkSummaryPath: weakSdkSummaryPath, librariesPath: librariesPath, compilerWorkerPath: compilerWorkerPath, ); expect(configuration.sdkDirectory, equals(sdkDirectory)); expect(configuration.soundSdkSummaryPath, equals(soundSdkSummaryPath)); - expect( - configuration.unsoundSdkSummaryPath, equals(unsoundSdkSummaryPath)); + expect(configuration.weakSdkSummaryPath, equals(weakSdkSummaryPath)); expect(configuration.librariesPath, equals(librariesPath)); expect(configuration.compilerWorkerPath, equals(compilerWorkerPath)); @@ -157,10 +155,10 @@ void main() { }); } -String _dartUnsoundSdkSummaryPath(String sdkDir) => +String _weakSdkSummaryPath(String sdkDir) => p.join(sdkDir, 'lib', '_internal', 'ddc_sdk.dill'); -String _dartSoundSdkSummaryPath(String sdkDir) => +String _soundSdkSummaryPath(String sdkDir) => p.join(sdkDir, 'lib', '_internal', 'ddc_outline_sound.dill'); String _librariesPath(String sdkDir) => p.join(sdkDir, 'lib', 'libraries.json'); diff --git a/dwds/test/utils/version_compatibility.dart b/dwds/test/utils/version_compatibility.dart deleted file mode 100644 index 6206a07da..000000000 --- a/dwds/test/utils/version_compatibility.dart +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2022, 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 '../fixtures/context.dart'; - -bool supportedMode( - {required CompilationMode compilationMode, - required NullSafety nullSafetyMode}) { - // TODO(https://github.com/dart-lang/webdev/issues/1591): Support compiling to - // sound null-safety for the FrontendServer. - if (compilationMode == CompilationMode.frontendServer && - nullSafetyMode == NullSafety.sound) { - return false; - } - // All other modes are supported. - return true; -} diff --git a/fixtures/_webdevSmoke/mono_pkg.yaml b/fixtures/_webdevSoundSmoke/mono_pkg.yaml similarity index 100% rename from fixtures/_webdevSmoke/mono_pkg.yaml rename to fixtures/_webdevSoundSmoke/mono_pkg.yaml diff --git a/tool/ci.sh b/tool/ci.sh index a881ab9c0..ce7ed1107 100755 --- a/tool/ci.sh +++ b/tool/ci.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Created with package:mono_repo v6.4.2 +# Created with package:mono_repo v6.4.3 # Support built in commands on windows out of the box. # When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") diff --git a/webdev/CHANGELOG.md b/webdev/CHANGELOG.md index 6ed0de0ad..75b671a4b 100644 --- a/webdev/CHANGELOG.md +++ b/webdev/CHANGELOG.md @@ -5,6 +5,7 @@ - Prepare or Dart 3 alpha breaking changes: - Move weak null safety tests to special branch of `build_web_compilers`. - Do not pass `--(no)-sound-null-safety` flag to build daemon. + - Generate missing SDK assets for tests. ## 2.7.12 diff --git a/webdev/test/e2e_test.dart b/webdev/test/e2e_test.dart index 73f02ef79..16d812024 100644 --- a/webdev/test/e2e_test.dart +++ b/webdev/test/e2e_test.dart @@ -8,7 +8,6 @@ import 'dart:io'; import 'package:io/io.dart'; import 'package:logging/logging.dart'; import 'package:path/path.dart' as p; -import 'package:pub_semver/pub_semver.dart' as semver; import 'package:test/test.dart'; import 'package:test_descriptor/test_descriptor.dart' as d; import 'package:test_process/test_process.dart'; @@ -30,7 +29,7 @@ import 'test_utils.dart'; const _testItems = { 'main.dart.js': null, 'main.dart.bootstrap.js': true, - 'main.unsound.ddc.js': true, + 'main.sound.ddc.js': true, }; void main() { @@ -59,8 +58,8 @@ void main() { await d .file('.dart_tool/package_config.json', isNotEmpty) - .validate(exampleDirectory); - await d.file('pubspec.lock', isNotEmpty).validate(exampleDirectory); + .validate(soundExampleDirectory); + await d.file('pubspec.lock', isNotEmpty).validate(soundExampleDirectory); }); test('smoke test is configured properly', () async { @@ -82,7 +81,8 @@ void main() { var args = ['build', '-o', 'web:${d.sandbox}']; - var process = await runWebDev(args, workingDirectory: exampleDirectory); + var process = + await runWebDev(args, workingDirectory: soundExampleDirectory); // NOTE: We'd like this to be more useful // See https://github.com/dart-lang/build/issues/1283 @@ -109,7 +109,8 @@ void main() { '--delete-conflicting-outputs' ]; - var process = await runWebDev(args, workingDirectory: exampleDirectory); + var process = + await runWebDev(args, workingDirectory: soundExampleDirectory); await checkProcessStdout(process, ['Succeeded']); await process.shouldExit(0); @@ -123,7 +124,8 @@ void main() { args.add('--no-release'); } - var process = await runWebDev(args, workingDirectory: exampleDirectory); + var process = + await runWebDev(args, workingDirectory: soundExampleDirectory); var expectedItems = ['Succeeded']; @@ -141,32 +143,25 @@ void main() { } }); } - test( - 'and --null-safety=sound', - () async { - var args = [ - 'build', - '-o', - 'web:${d.sandbox}', - '--no-release', - '--null-safety=sound' - ]; + test('and --null-safety=sound', () async { + var args = [ + 'build', + '-o', + 'web:${d.sandbox}', + '--no-release', + '--null-safety=sound' + ]; - var process = - await runWebDev(args, workingDirectory: soundExampleDirectory); + var process = + await runWebDev(args, workingDirectory: soundExampleDirectory); - var expectedItems = ['Succeeded']; + var expectedItems = ['Succeeded']; - await checkProcessStdout(process, expectedItems); - await process.shouldExit(0); + await checkProcessStdout(process, expectedItems); + await process.shouldExit(0); - await d.file('main.sound.ddc.js', isNotEmpty).validate(); - }, - skip: semver.Version.parse(Platform.version.split(' ').first) > - semver.Version.parse('2.11.0') - ? null - : 'SDK does not support sound null safety', - ); + await d.file('main.sound.ddc.js', isNotEmpty).validate(); + }); test('and --null-safety=unsound', () async { var args = [ @@ -185,7 +180,8 @@ void main() { await process.shouldExit(0); await d.file('main.unsound.ddc.js', isNotEmpty).validate(); - }); + // 'https://github.com/dart-lang/webdev/issues/1892' + }, skip: true); }); group('should build with --output=NONE', () { @@ -196,14 +192,15 @@ void main() { args.add('--no-release'); } - var process = await runWebDev(args, workingDirectory: exampleDirectory); + var process = + await runWebDev(args, workingDirectory: soundExampleDirectory); var expectedItems = ['Succeeded']; await checkProcessStdout(process, expectedItems); await process.shouldExit(0); - await d.nothing('build').validate(exampleDirectory); + await d.nothing('build').validate(soundExampleDirectory); }); } }); @@ -218,7 +215,8 @@ void main() { args.add('--release'); } - var process = await runWebDev(args, workingDirectory: exampleDirectory); + var process = + await runWebDev(args, workingDirectory: soundExampleDirectory); var hostUrl = 'http://localhost:$openPort'; @@ -260,7 +258,7 @@ void main() { ]; var process = - await runWebDev(args, workingDirectory: exampleDirectory); + await runWebDev(args, workingDirectory: soundExampleDirectory); await expectLater( process.stdout, emitsThrough(contains( @@ -509,7 +507,8 @@ void main() { } }, timeout: const Timeout.factor(2)); }); - }); + // 'https://github.com/dart-lang/webdev/issues/1892' + }, skip: !soundNullSafety); } }); } diff --git a/webdev/test/test_utils.dart b/webdev/test/test_utils.dart index 6ba2efebd..56c207dcc 100644 --- a/webdev/test/test_utils.dart +++ b/webdev/test/test_utils.dart @@ -12,7 +12,8 @@ import 'package:webdev/src/util.dart'; final _webdevBin = p.absolute(p.join('bin', 'webdev.dart')); -Future runWebDev(List args, {String? workingDirectory}) { +Future runWebDev(List args, + {String? workingDirectory}) async { var fullArgs = [_webdevBin, ...args]; return TestProcess.start(dartPath, fullArgs,