From d98a7963f28299db538611347a29d151f0d9aef5 Mon Sep 17 00:00:00 2001
From: Kevin Moore <kevmoo@google.com>
Date: Tue, 17 Dec 2024 16:24:41 -0600
Subject: [PATCH] Bump to latest dependencies, require Dart 3.6

---
 .github/workflows/dart.yml         | 30 +++++++++++++++---------------
 build_cli/CHANGELOG.md             |  4 ++--
 build_cli/lib/src/to_share.dart    | 15 +++++++--------
 build_cli/pubspec.yaml             |  6 +++---
 build_cli/tool/builder.dart        |  2 +-
 build_cli_annotations/CHANGELOG.md |  2 +-
 build_cli_annotations/pubspec.yaml |  2 +-
 pubspec.yaml                       |  2 +-
 8 files changed, 31 insertions(+), 32 deletions(-)

diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml
index 8979053..877a367 100644
--- a/.github/workflows/dart.yml
+++ b/.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: "analyzer_and_format; Dart 3.5.0; PKGS: build_cli, build_cli_annotations; `dart analyze --fatal-infos .`"
+    name: "analyzer_and_format; Dart 3.6.0; PKGS: build_cli, build_cli_annotations; `dart analyze --fatal-infos .`"
     runs-on: ubuntu-latest
     steps:
       - name: Cache Pub hosted dependencies
         uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
         with:
           path: "~/.pub-cache/hosted"
-          key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:build_cli-build_cli_annotations;commands:analyze"
+          key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:build_cli-build_cli_annotations;commands:analyze"
           restore-keys: |
-            os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:build_cli-build_cli_annotations
-            os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0
+            os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:build_cli-build_cli_annotations
+            os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0
             os:ubuntu-latest;pub-cache-hosted
             os:ubuntu-latest
       - name: Setup Dart SDK
         uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
         with:
-          sdk: "3.5.0"
+          sdk: "3.6.0"
       - id: checkout
         name: Checkout repository
         uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
@@ -81,23 +81,23 @@ jobs:
     needs:
       - job_001
   job_003:
-    name: "analyzer_and_format; Dart 3.5.0; PKGS: build_cli, build_cli_annotations; `dart format --output=none --set-exit-if-changed .`"
+    name: "analyzer_and_format; Dart 3.6.0; PKGS: build_cli, build_cli_annotations; `dart format --output=none --set-exit-if-changed .`"
     runs-on: ubuntu-latest
     steps:
       - name: Cache Pub hosted dependencies
         uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
         with:
           path: "~/.pub-cache/hosted"
-          key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:build_cli-build_cli_annotations;commands:format"
+          key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:build_cli-build_cli_annotations;commands:format"
           restore-keys: |
-            os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:build_cli-build_cli_annotations
-            os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0
+            os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:build_cli-build_cli_annotations
+            os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0
             os:ubuntu-latest;pub-cache-hosted
             os:ubuntu-latest
       - name: Setup Dart SDK
         uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
         with:
-          sdk: "3.5.0"
+          sdk: "3.6.0"
       - id: checkout
         name: Checkout repository
         uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
@@ -204,23 +204,23 @@ jobs:
     needs:
       - job_001
   job_006:
-    name: "unit_test; Dart 3.5.0; PKG: build_cli; `dart test --run-skipped --reporter expanded`"
+    name: "unit_test; Dart 3.6.0; PKG: build_cli; `dart test --run-skipped --reporter expanded`"
     runs-on: ubuntu-latest
     steps:
       - name: Cache Pub hosted dependencies
         uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a
         with:
           path: "~/.pub-cache/hosted"
-          key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:build_cli;commands:test"
+          key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:build_cli;commands:test"
           restore-keys: |
-            os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0;packages:build_cli
-            os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0
+            os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0;packages:build_cli
+            os:ubuntu-latest;pub-cache-hosted;sdk:3.6.0
             os:ubuntu-latest;pub-cache-hosted
             os:ubuntu-latest
       - name: Setup Dart SDK
         uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
         with:
-          sdk: "3.5.0"
+          sdk: "3.6.0"
       - id: checkout
         name: Checkout repository
         uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
diff --git a/build_cli/CHANGELOG.md b/build_cli/CHANGELOG.md
index 71ad259..02c41d1 100644
--- a/build_cli/CHANGELOG.md
+++ b/build_cli/CHANGELOG.md
@@ -1,7 +1,7 @@
 ## 2.2.4-wip
 
-- Require latest `package:analyzer`.
-- Require `sdk: ^3.5.0`
+- Support the latest `package:analyzer` and `package:source_gen`.
+- Require `sdk: ^3.6.0`
 
 ## 2.2.3
 
diff --git a/build_cli/lib/src/to_share.dart b/build_cli/lib/src/to_share.dart
index 7cbaf0e..a35b225 100644
--- a/build_cli/lib/src/to_share.dart
+++ b/build_cli/lib/src/to_share.dart
@@ -2,8 +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.
 
-// TODO: remove deprecated_member_use when we bump min SDK to Dart 3.6
-// ignore_for_file: implementation_imports, deprecated_member_use
+// ignore_for_file: implementation_imports
 
 import 'package:analyzer/dart/element/element.dart';
 import 'package:analyzer/dart/element/type.dart';
@@ -41,7 +40,7 @@ Set<FieldElement> createSortedFieldSet(ClassElement element) {
 
   for (var v in manager.getInheritedMap2(element).values) {
     assert(v is! FieldElement);
-    if (_dartCoreObjectChecker.isExactly(v.enclosingElement)) {
+    if (_dartCoreObjectChecker.isExactly(v.enclosingElement3)) {
       continue;
     }
 
@@ -59,20 +58,20 @@ Set<FieldElement> createSortedFieldSet(ClassElement element) {
 
 int _sortByLocation(FieldElement a, FieldElement b) {
   final checkerA =
-      TypeChecker.fromStatic((a.enclosingElement as ClassElement).thisType);
+      TypeChecker.fromStatic((a.enclosingElement3 as ClassElement).thisType);
 
-  if (!checkerA.isExactly(b.enclosingElement)) {
+  if (!checkerA.isExactly(b.enclosingElement3)) {
     // in this case, you want to prioritize the enclosingElement that is more
     // "super".
 
-    if (checkerA.isSuperOf(b.enclosingElement)) {
+    if (checkerA.isSuperOf(b.enclosingElement3)) {
       return -1;
     }
 
     final checkerB =
-        TypeChecker.fromStatic((b.enclosingElement as ClassElement).thisType);
+        TypeChecker.fromStatic((b.enclosingElement3 as ClassElement).thisType);
 
-    if (checkerB.isSuperOf(a.enclosingElement)) {
+    if (checkerB.isSuperOf(a.enclosingElement3)) {
       return 1;
     }
   }
diff --git a/build_cli/pubspec.yaml b/build_cli/pubspec.yaml
index d4c8edf..698d8cb 100644
--- a/build_cli/pubspec.yaml
+++ b/build_cli/pubspec.yaml
@@ -6,19 +6,19 @@ description: >-
 homepage: https://github.com/kevmoo/build_cli
 
 environment:
-  sdk: ^3.5.0
+  sdk: ^3.6.0
 
 resolution: workspace
 
 dependencies:
-  analyzer: ^6.5.0
+  analyzer: '>=6.9.0 <8.0.0'
   build: ^2.4.1
   # Limit version range on build_cli_annotations
   # new features need to stay in sync
   build_cli_annotations: '>=2.1.0 <2.2.0'
   build_config: ^1.1.0
   pub_semver: ^2.1.4
-  source_gen: ^1.4.0
+  source_gen: '>=1.4.0 <3.0.0'
   source_helper: ^1.3.4
   yaml: ^3.1.0
 
diff --git a/build_cli/tool/builder.dart b/build_cli/tool/builder.dart
index 1a408de..3b9e0f7 100644
--- a/build_cli/tool/builder.dart
+++ b/build_cli/tool/builder.dart
@@ -11,7 +11,7 @@ import 'package:source_gen/source_gen.dart';
 LibraryBuilder _builder(_ReplaceGenerator generator) => LibraryBuilder(
       generator,
       generatedExtension: '.${generator.gName}.dart',
-      formatOutput: (a) => a,
+      formatOutput: (a, v) => a,
     );
 
 Builder defaultOverride([_]) => _builder(_NonNullableGenerator());
diff --git a/build_cli_annotations/CHANGELOG.md b/build_cli_annotations/CHANGELOG.md
index b242a84..b504600 100644
--- a/build_cli_annotations/CHANGELOG.md
+++ b/build_cli_annotations/CHANGELOG.md
@@ -1,7 +1,7 @@
 ## 2.1.1-wip
 
 - Require `args: ^2.6.0`
-- Require `sdk: ^3.5.0`
+- Require `sdk: ^3.6.0`
 
 ## 2.1.0
 
diff --git a/build_cli_annotations/pubspec.yaml b/build_cli_annotations/pubspec.yaml
index 9e5415b..8a6f45d 100644
--- a/build_cli_annotations/pubspec.yaml
+++ b/build_cli_annotations/pubspec.yaml
@@ -7,7 +7,7 @@ description: >-
 homepage: https://github.com/kevmoo/build_cli
 
 environment:
-  sdk: ^3.5.0
+  sdk: ^3.6.0
 
 resolution: workspace
 
diff --git a/pubspec.yaml b/pubspec.yaml
index 579baa2..801e872 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
 name: build_cli_workspace
 environment:
-  sdk: ^3.5.0
+  sdk: ^3.6.0
 
 publish_to: none