From ac55cd4ce052b6ab15e643150641f142d7bb18ee Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Mon, 5 Aug 2024 14:25:50 -0700 Subject: [PATCH] Move to use (experimental) workspaces (#1433) --- .github/workflows/dart.yml | 64 +++++++++++----------- _test_yaml/pubspec.yaml | 12 +--- checked_yaml/pubspec.yaml | 10 +--- example/pubspec.yaml | 12 +--- json_annotation/pubspec.yaml | 4 +- json_serializable/README.md | 18 +++--- json_serializable/pubspec.yaml | 4 +- json_serializable/tool/readme_builder.dart | 14 ++--- pubspec.yaml | 15 +++++ shared_test/pubspec.yaml | 4 +- tool/ci.sh | 2 +- 11 files changed, 82 insertions(+), 77 deletions(-) create mode 100644 pubspec.yaml diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index d03227527..cffabe4cf 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -1,4 +1,4 @@ -# Created with package:mono_repo v6.6.1 +# Created with package:mono_repo v6.6.2 name: Dart CI on: push: @@ -36,27 +36,27 @@ jobs: name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 - name: mono_repo self validate - run: dart pub global activate mono_repo 6.6.1 + run: dart pub global activate mono_repo 6.6.2 - name: mono_repo self validate run: dart pub global run mono_repo generate --validate job_002: - name: "analyzer_and_format; Dart 3.4.0; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; `dart analyze`" + name: "analyzer_and_format; Dart 3.5.0-259.0.dev; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; `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.4.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:analyze_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:analyze_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.4.0" + sdk: "3.5.0-259.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -192,23 +192,23 @@ jobs: if: "always() && steps.json_serializable_pub_upgrade.conclusion == 'success'" working-directory: json_serializable job_004: - name: "unit_test; Dart 3.4.0; PKGS: _test_yaml, checked_yaml, example, json_serializable; `dart test`" + name: "unit_test; Dart 3.5.0-259.0.dev; PKGS: _test_yaml, checked_yaml, example, json_serializable; `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.4.0;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:_test_yaml-checked_yaml-example-json_serializable - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:_test_yaml-checked_yaml-example-json_serializable + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.4.0" + sdk: "3.5.0-259.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -253,23 +253,23 @@ jobs: - job_002 - job_003 job_005: - name: "unit_test; Dart 3.4.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/annotation_version_test.dart`" + name: "unit_test; Dart 3.5.0-259.0.dev; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/annotation_version_test.dart`" 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.4.0;packages:json_serializable;commands:test_3" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:json_serializable;commands:test_3" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:json_serializable - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:json_serializable + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.4.0" + sdk: "3.5.0-259.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -287,23 +287,23 @@ jobs: - job_002 - job_003 job_006: - name: "unit_test; Dart 3.4.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`" + name: "unit_test; Dart 3.5.0-259.0.dev; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`" 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.4.0;packages:json_serializable;commands:test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:json_serializable;commands:test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:json_serializable - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:json_serializable + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.4.0" + sdk: "3.5.0-259.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -321,23 +321,23 @@ jobs: - job_002 - job_003 job_007: - name: "unit_test; Dart 3.4.0; PKG: json_serializable; `dart test -p chrome`" + name: "unit_test; Dart 3.5.0-259.0.dev; PKG: json_serializable; `dart test -p chrome`" 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.4.0;packages:json_serializable;commands:test_2" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:json_serializable;commands:test_2" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:json_serializable - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:json_serializable + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.4.0" + sdk: "3.5.0-259.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 @@ -518,23 +518,23 @@ jobs: - job_002 - job_003 job_012: - name: "ensure_build; Dart 3.4.0; PKGS: _test_yaml, checked_yaml, example; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`" + name: "ensure_build; Dart 3.5.0-259.0.dev; PKGS: _test_yaml, checked_yaml, example; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`" 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.4.0;packages:_test_yaml-checked_yaml-example;commands:test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:_test_yaml-checked_yaml-example;commands:test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:_test_yaml-checked_yaml-example - os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev;packages:_test_yaml-checked_yaml-example + os:ubuntu-latest;pub-cache-hosted;sdk:3.5.0-259.0.dev os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672 with: - sdk: "3.4.0" + sdk: "3.5.0-259.0.dev" - id: checkout name: Checkout repository uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 diff --git a/_test_yaml/pubspec.yaml b/_test_yaml/pubspec.yaml index 8bf18a935..967c84111 100644 --- a/_test_yaml/pubspec.yaml +++ b/_test_yaml/pubspec.yaml @@ -2,7 +2,9 @@ name: _test_yaml publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0-259.0.dev + +resolution: workspace dev_dependencies: _json_serial_shared_test: @@ -16,11 +18,3 @@ dev_dependencies: path: ^1.8.2 test: ^1.21.6 yaml: ^3.0.0 - -dependency_overrides: - checked_yaml: - path: ../checked_yaml - json_annotation: - path: ../json_annotation - json_serializable: - path: ../json_serializable diff --git a/checked_yaml/pubspec.yaml b/checked_yaml/pubspec.yaml index 2be93cc62..bc8bcc7e0 100644 --- a/checked_yaml/pubspec.yaml +++ b/checked_yaml/pubspec.yaml @@ -13,7 +13,9 @@ topics: - codegen environment: - sdk: ^3.4.0 + sdk: ^3.5.0-259.0.dev + +resolution: workspace dependencies: json_annotation: ^4.3.0 @@ -28,9 +30,3 @@ dev_dependencies: path: ^1.8.0 test: ^1.17.10 test_process: ^2.0.0 - -#dependency_overrides: -# json_annotation: -# path: ../json_annotation -# json_serializable: -# path: ../json_serializable diff --git a/example/pubspec.yaml b/example/pubspec.yaml index be24d38a3..6e7e6362d 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -2,7 +2,9 @@ name: example publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0-259.0.dev + +resolution: workspace dependencies: json_annotation: ^4.9.0 @@ -27,11 +29,3 @@ dev_dependencies: # Not required to use `json_serializable`. path: ^1.8.0 test: ^1.21.6 - -# This section is used to verify changes to these packages. Do not include in -# your code! -dependency_overrides: - json_annotation: - path: ../json_annotation - json_serializable: - path: ../json_serializable diff --git a/json_annotation/pubspec.yaml b/json_annotation/pubspec.yaml index 917f8e111..b1bff234c 100644 --- a/json_annotation/pubspec.yaml +++ b/json_annotation/pubspec.yaml @@ -11,7 +11,9 @@ topics: - codegen environment: - sdk: ^3.4.0 + sdk: ^3.5.0-259.0.dev + +resolution: workspace dependencies: meta: ^1.4.0 diff --git a/json_serializable/README.md b/json_serializable/README.md index d30a13659..5d30efd16 100644 --- a/json_serializable/README.md +++ b/json_serializable/README.md @@ -298,15 +298,15 @@ targets: [`Enum`]: https://api.dart.dev/stable/dart-core/Enum-class.html [`int`]: https://api.dart.dev/stable/dart-core/int-class.html [`Iterable`]: https://api.dart.dev/stable/dart-core/Iterable-class.html -[`JsonConverter`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonConverter-class.html -[`JsonEnum.valueField`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonEnum/valueField.html -[`JsonEnum`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonEnum-class.html -[`JsonKey.fromJson`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonKey/fromJson.html -[`JsonKey.toJson`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonKey/toJson.html -[`JsonKey`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonKey-class.html -[`JsonLiteral`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonLiteral-class.html -[`JsonSerializable`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonSerializable-class.html -[`JsonValue`]: https://pub.dev/documentation/json_annotation/4.9.0/json_annotation/JsonValue-class.html +[`JsonConverter`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonConverter-class.html +[`JsonEnum.valueField`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonEnum/valueField.html +[`JsonEnum`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonEnum-class.html +[`JsonKey.fromJson`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/fromJson.html +[`JsonKey.toJson`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey/toJson.html +[`JsonKey`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonKey-class.html +[`JsonLiteral`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonLiteral-class.html +[`JsonSerializable`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonSerializable-class.html +[`JsonValue`]: https://pub.dev/documentation/json_annotation/latest/json_annotation/JsonValue-class.html [`List`]: https://api.dart.dev/stable/dart-core/List-class.html [`Map`]: https://api.dart.dev/stable/dart-core/Map-class.html [`num`]: https://api.dart.dev/stable/dart-core/num-class.html diff --git a/json_serializable/pubspec.yaml b/json_serializable/pubspec.yaml index 2ad1e7a1d..5773ec736 100644 --- a/json_serializable/pubspec.yaml +++ b/json_serializable/pubspec.yaml @@ -5,13 +5,15 @@ description: >- Dart classes. repository: https://github.com/google/json_serializable.dart/tree/master/json_serializable environment: - sdk: ^3.4.0 + sdk: ^3.5.0-259.0.dev topics: - json - build-runner - json-serializable - codegen +resolution: workspace + dependencies: analyzer: ^6.5.0 async: ^2.10.0 diff --git a/json_serializable/tool/readme_builder.dart b/json_serializable/tool/readme_builder.dart index 5de07dfe3..cd832eab5 100644 --- a/json_serializable/tool/readme_builder.dart +++ b/json_serializable/tool/readme_builder.dart @@ -154,13 +154,13 @@ extension on BuildStep { AssetId assetIdForInputPackage(String path) => AssetId(inputId.package, path); Future jsonAnnotationVersion() async { - final lockFileAssetId = assetIdForInputPackage('pubspec.lock'); - final lockFileContent = await readAsString(lockFileAssetId); - final lockFileYaml = - loadYaml(lockFileContent, sourceUrl: lockFileAssetId.uri) as YamlMap; - final pkgMap = lockFileYaml['packages'] as YamlMap; - final jsonAnnotationMap = pkgMap['json_annotation'] as YamlMap; - final jsonAnnotationVersionString = jsonAnnotationMap['version'] as String; + final jsonAnnotationPubspecAssetId = + AssetId('json_annotation', 'pubspec.yaml'); + final jsonAnnotationPubspecContent = + await readAsString(jsonAnnotationPubspecAssetId); + final pubspecYaml = loadYaml(jsonAnnotationPubspecContent, + sourceUrl: jsonAnnotationPubspecAssetId.uri) as YamlMap; + final jsonAnnotationVersionString = pubspecYaml['version'] as String; final jsonAnnotationVersion = Version.parse(jsonAnnotationVersionString.trim()); diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 000000000..2f7c7b72f --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,15 @@ +name: json_serial_workspace # Can be anything +environment: + sdk: ^3.5.0-259.0.dev # Must be ^3.5.0 or later for workspace to be allowed + +publish_to: none + +dev_dependencies: + dart_flutter_team_lints: ^3.1.0 +workspace: + - _test_yaml + - checked_yaml + - example + - json_annotation + - json_serializable + - shared_test diff --git a/shared_test/pubspec.yaml b/shared_test/pubspec.yaml index 975abe375..f88ea12db 100644 --- a/shared_test/pubspec.yaml +++ b/shared_test/pubspec.yaml @@ -1,7 +1,9 @@ name: _json_serial_shared_test publish_to: none environment: - sdk: ^3.4.0 + sdk: ^3.5.0-259.0.dev + +resolution: workspace dependencies: stack_trace: ^1.10.0 diff --git a/tool/ci.sh b/tool/ci.sh index deac64920..c6a601c34 100755 --- a/tool/ci.sh +++ b/tool/ci.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Created with package:mono_repo v6.6.1 +# Created with package:mono_repo v6.6.2 # Support built in commands on windows out of the box.