From fd8cf8b4a2515f92135f8cd735149e810daeb12e Mon Sep 17 00:00:00 2001 From: Konstantin Scheglov Date: Wed, 25 Sep 2024 14:40:17 -0700 Subject: [PATCH] Require analyzer ^6.9.0, switch to using 'enclosingElement3'. (dart-lang/source_gen#722) Prepare for https://dart-review.googlesource.com/c/sdk/+/385100 --- .../source_gen/.github/workflows/dart.yml | 34 +++++++++---------- .../source_gen/example_usage/pubspec.yaml | 2 +- source_gen/source_gen/source_gen/CHANGELOG.md | 2 +- .../source_gen/lib/src/constants/revive.dart | 4 +-- source_gen/source_gen/source_gen/pubspec.yaml | 4 +-- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/source_gen/source_gen/.github/workflows/dart.yml b/source_gen/source_gen/.github/workflows/dart.yml index 5360da88a..712e04014 100644 --- a/source_gen/source_gen/.github/workflows/dart.yml +++ b/source_gen/source_gen/.github/workflows/dart.yml @@ -40,23 +40,23 @@ jobs: - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: - name: "analyze_format; linux; Dart 3.5.0; PKG: source_gen; `dart analyze`" + name: "analyze_format; linux; Dart 3.6.0-270.0.dev; PKG: source_gen; `dart analyze`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:source_gen;commands:analyze_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev;packages:source_gen;commands:analyze_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:source_gen - os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev;packages:source_gen + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.5.0" + sdk: "3.6.0-270.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -143,23 +143,23 @@ jobs: if: "always() && steps.source_gen_pub_upgrade.conclusion == 'success'" working-directory: source_gen job_004: - name: "unit_test; linux; Dart 3.5.0; PKG: example_usage; `dart test --run-skipped`" + name: "unit_test; linux; Dart 3.6.0-270.0.dev; PKG: example_usage; `dart test --run-skipped`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:example_usage;commands:test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev;packages:example_usage;commands:test_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:example_usage - os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev;packages:example_usage + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.5.0" + sdk: "3.6.0-270.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -177,23 +177,23 @@ jobs: - job_002 - job_003 job_005: - name: "unit_test; linux; Dart 3.5.0; PKG: source_gen; `dart test`" + name: "unit_test; linux; Dart 3.6.0-270.0.dev; PKG: source_gen; `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:source_gen;commands:test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev;packages:source_gen;commands:test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:source_gen - os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev;packages:source_gen + os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0-270.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.5.0" + sdk: "3.6.0-270.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -279,13 +279,13 @@ jobs: - job_002 - job_003 job_008: - name: "unit_test; windows; Dart 3.5.0; PKG: source_gen; `dart test`" + name: "unit_test; windows; Dart 3.6.0-270.0.dev; PKG: source_gen; `dart test`" runs-on: windows-latest steps: - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.5.0" + sdk: "3.6.0-270.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 diff --git a/source_gen/source_gen/example_usage/pubspec.yaml b/source_gen/source_gen/example_usage/pubspec.yaml index 612ef197f..96babda59 100644 --- a/source_gen/source_gen/example_usage/pubspec.yaml +++ b/source_gen/source_gen/example_usage/pubspec.yaml @@ -3,7 +3,7 @@ publish_to: none resolution: workspace environment: - sdk: ^3.5.0 + sdk: ^3.6.0-270.0.dev dependencies: source_gen_example: diff --git a/source_gen/source_gen/source_gen/CHANGELOG.md b/source_gen/source_gen/source_gen/CHANGELOG.md index a69d855d9..8a903398b 100644 --- a/source_gen/source_gen/source_gen/CHANGELOG.md +++ b/source_gen/source_gen/source_gen/CHANGELOG.md @@ -9,7 +9,7 @@ `GeneratorForAnnotation.generateForAnnotatedElement`. - Support all the glob quotes. - Require `analyzer: ^6.9.0` -- Require Dart 3.5.0 +- Require Dart 3.6.0-270.0.dev - `LibraryBuilder`, `PartBuilder`, and `SharedPartBuilder` now take an optional `writeDescriptions` boolean. When set to `false`, headers and generator descriptions for the files will not be included in the builder output. ## 1.5.0 diff --git a/source_gen/source_gen/source_gen/lib/src/constants/revive.dart b/source_gen/source_gen/source_gen/lib/src/constants/revive.dart index ddfaded2e..4bd038aca 100644 --- a/source_gen/source_gen/source_gen/lib/src/constants/revive.dart +++ b/source_gen/source_gen/source_gen/lib/src/constants/revive.dart @@ -43,7 +43,7 @@ Revivable reviveInstance(DartObject object, [LibraryElement? origin]) { if (element is MethodElement && element.isStatic) { return Revivable._( source: url.removeFragment(), - accessor: '${element.enclosingElement.name}.${element.name}', + accessor: '${element.enclosingElement3.name}.${element.name}', ); } @@ -81,7 +81,7 @@ Revivable reviveInstance(DartObject object, [LibraryElement? origin]) { } final i = (object as DartObjectImpl).getInvocation(); if (i != null) { - url = Uri.parse(urlOfElement(i.constructor.enclosingElement)); + url = Uri.parse(urlOfElement(i.constructor.enclosingElement3)); final result = Revivable._( source: url, accessor: i.constructor.name, diff --git a/source_gen/source_gen/source_gen/pubspec.yaml b/source_gen/source_gen/source_gen/pubspec.yaml index 66b5c8316..12889bc94 100644 --- a/source_gen/source_gen/source_gen/pubspec.yaml +++ b/source_gen/source_gen/source_gen/pubspec.yaml @@ -6,10 +6,10 @@ repository: https://github.com/dart-lang/source_gen/tree/master/source_gen resolution: workspace environment: - sdk: ^3.5.0 + sdk: ^3.6.0-270.0.dev dependencies: - analyzer: ^6.4.0 + analyzer: ^6.9.0 async: ^2.5.0 build: ^2.1.0 dart_style: ^2.3.7