From 801c353bcac3c52ba7f9a3d1bc06d25bd24f3f13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 10:46:26 +0100 Subject: [PATCH 01/10] Replace removed `dart:typed_data` type in test code `Unmodifiable...View` types were deprecated in favor of `asModifiableView`s members introduced in SDK 3.3.0. These types are now removed, so the protobuf package tests can't be built with the most recent SDK. Bump the SDK dependency to 3.3.0 (the version introduced `asModifiableView`) and replace the removed type with `asModifiableView` in the test. --- protobuf/pubspec.yaml | 4 ++-- protobuf/test/coded_buffer_reader_test.dart | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/protobuf/pubspec.yaml b/protobuf/pubspec.yaml index aeaf84223..e69fa3d99 100644 --- a/protobuf/pubspec.yaml +++ b/protobuf/pubspec.yaml @@ -2,11 +2,11 @@ name: protobuf version: 4.0.0-dev description: >- Runtime library for protocol buffers support. Use with package:protoc_plugin - to generate dart code for your '.proto' files. + to generate Dart code for your '.proto' files. repository: https://github.com/google/protobuf.dart/tree/master/protobuf environment: - sdk: '>=2.19.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dependencies: collection: ^1.15.0 diff --git a/protobuf/test/coded_buffer_reader_test.dart b/protobuf/test/coded_buffer_reader_test.dart index 00a715c04..85c6ea67c 100644 --- a/protobuf/test/coded_buffer_reader_test.dart +++ b/protobuf/test/coded_buffer_reader_test.dart @@ -84,11 +84,7 @@ void main() { }); test('unmodifiable-uint8-list-view', () { - // TODO: Use `Uint8List.asUnmodifiableView` instead of - // `UnmodifiableUint8ListView` when it's available in the oldest - // supported SDK version. - // ignore: deprecated_member_use - testWithList(UnmodifiableUint8ListView(Uint8List.fromList(inputBuffer))); + testWithList(Uint8List.fromList(inputBuffer).asUnmodifiableView()); }); test('uint8-list-view', () { From 45f1fbfa1bed40fc5ba43929117b8b2502265735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 10:53:28 +0100 Subject: [PATCH 02/10] Update CHANGELOG --- protobuf/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protobuf/CHANGELOG.md b/protobuf/CHANGELOG.md index 32a41e693..45dc6d37d 100644 --- a/protobuf/CHANGELOG.md +++ b/protobuf/CHANGELOG.md @@ -34,11 +34,14 @@ ([#49], [#918]) +* Minimum SDK dependency bumped from 2.19.0 to 3.3.0. (#953) + [#738]: https://github.com/google/protobuf.dart/issues/738 [#896]: https://github.com/google/protobuf.dart/issues/896 [#902]: https://github.com/google/protobuf.dart/issues/902 [#49]: https://github.com/google/protobuf.dart/issues/49 [#918]: https://github.com/google/protobuf.dart/pulls/918 +[#953]: https://github.com/google/protobuf.dart/pull/953 ## 3.1.0 From 2b6a8c80608c8ad799d40413d764147076ab34dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 10:57:40 +0100 Subject: [PATCH 03/10] Regenerate GitHub workflows with the latest mono_repo to update the SDK bound --- .github/workflows/dart.yml | 84 +++++++++++++++++++------------------- tool/ci.sh | 18 ++++---- 2 files changed, 49 insertions(+), 53 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 199ff163e..488240283 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -1,4 +1,4 @@ -# Created with package:mono_repo v6.5.7 +# Created with package:mono_repo v6.6.2 name: Dart CI on: push: @@ -35,27 +35,27 @@ jobs: name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - name: mono_repo self validate - run: dart pub global activate mono_repo 6.5.7 + 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: "format_analyze; linux; Dart 2.19.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`" + name: "format_analyze; linux; Dart 3.3.0; PKG: protobuf; `dart analyze lib`, `dart analyze test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:analyze_1-analyze_2" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:analyze_1-analyze_2" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: - sdk: "2.19.0" + sdk: "3.3.0" - id: checkout name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -233,16 +233,16 @@ jobs: if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" working-directory: protoc_plugin job_007: - name: "run_tests; linux; Dart 2.19.0; PKG: protobuf; `dart test`" + name: "run_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf + os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -253,15 +253,23 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade + - id: protoc_plugin_pub_upgrade + name: protoc_plugin; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart test + working-directory: protoc_plugin + - name: protoc_plugin; ./../tool/setup.sh + run: ./../tool/setup.sh + if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" + working-directory: protoc_plugin + - name: protoc_plugin; make protos + run: make protos + if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" + working-directory: protoc_plugin + - name: protoc_plugin; dart test run: dart test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf + if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" + working-directory: protoc_plugin needs: - job_001 - job_002 @@ -270,43 +278,35 @@ jobs: - job_005 - job_006 job_008: - name: "run_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`" + name: "run_tests; linux; Dart 3.3.0; PKG: protobuf; `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: - sdk: "2.19.0" + sdk: "3.3.0" - id: checkout name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protoc_plugin_pub_upgrade - name: protoc_plugin; dart pub upgrade + - id: protobuf_pub_upgrade + name: protobuf; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; ./../tool/setup.sh - run: ./../tool/setup.sh - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; make protos - run: make protos - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; dart test + working-directory: protobuf + - name: protobuf; dart test run: dart test - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin + if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" + working-directory: protobuf needs: - job_001 - job_002 @@ -397,23 +397,23 @@ jobs: - job_005 - job_006 job_011: - name: "run_tests; osx; Dart 2.19.0; PKG: protobuf; `dart test`" + name: "run_tests; osx; Dart 3.3.0; PKG: protobuf; `dart test`" runs-on: macos-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:macos-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf;commands:test_0" + key: "os:macos-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test_0" restore-keys: | - os:macos-latest;pub-cache-hosted;sdk:2.19.0;packages:protobuf - os:macos-latest;pub-cache-hosted;sdk:2.19.0 + os:macos-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf + os:macos-latest;pub-cache-hosted;sdk:3.3.0 os:macos-latest;pub-cache-hosted os:macos-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: - sdk: "2.19.0" + sdk: "3.3.0" - id: checkout name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 @@ -471,13 +471,13 @@ jobs: - job_005 - job_006 job_013: - name: "run_tests; windows; Dart 2.19.0; PKG: protobuf; `dart test`" + name: "run_tests; windows; Dart 3.3.0; PKG: protobuf; `dart test`" runs-on: windows-latest steps: - name: Setup Dart SDK uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: - sdk: "2.19.0" + sdk: "3.3.0" - id: checkout name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 diff --git a/tool/ci.sh b/tool/ci.sh index a824f9d2b..21acd0a8a 100755 --- a/tool/ci.sh +++ b/tool/ci.sh @@ -1,9 +1,10 @@ #!/bin/bash -# Created with package:mono_repo v6.5.7 +# Created with package:mono_repo v6.6.2 # Support built in commands on windows out of the box. + # When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") -# then "flutter" is called instead of "pub". +# then "flutter pub" is called instead of "dart pub". # This assumes that the Flutter SDK has been installed in a previous step. function pub() { if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then @@ -12,18 +13,13 @@ function pub() { command dart pub "$@" fi } -# When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") -# then "flutter" is called instead of "pub". -# This assumes that the Flutter SDK has been installed in a previous step. + function format() { - if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then - command flutter format "$@" - else - command dart format "$@" - fi + command dart format "$@" } + # When it is a flutter repo (check the pubspec.yaml for "sdk: flutter") -# then "flutter" is called instead of "pub". +# then "flutter analyze" is called instead of "dart analyze". # This assumes that the Flutter SDK has been installed in a previous step. function analyze() { if grep -Fq "sdk: flutter" "${PWD}/pubspec.yaml"; then From c473fd263db4fda01fa52abe7ef08861c8865676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 10:59:44 +0100 Subject: [PATCH 04/10] Fix analyzer issue --- protobuf/lib/src/protobuf/field_set.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protobuf/lib/src/protobuf/field_set.dart b/protobuf/lib/src/protobuf/field_set.dart index bd9799116..15c36586d 100644 --- a/protobuf/lib/src/protobuf/field_set.dart +++ b/protobuf/lib/src/protobuf/field_set.dart @@ -337,7 +337,7 @@ class _FieldSet { if (currentOneofTag != null) { _clearField(currentOneofTag); } - _oneofCases![oneofIndex] = tag; + _oneofCases[oneofIndex] = tag; } _values[fi.index!] = value; @@ -485,7 +485,7 @@ class _FieldSet { if (currentOneofTag != null) { _clearField(currentOneofTag); } - _oneofCases![oneofIndex] = tag; + _oneofCases[oneofIndex] = tag; } _values[index] = value; } From 2eac1eac2084e16e206c0b45fdaa330ab715ba41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 11:26:14 +0100 Subject: [PATCH 05/10] Don't block useful CI jobs for analyze errors in api_benchmark --- .github/workflows/dart.yml | 8 ++------ api_benchmark/mono_pkg.yaml | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index 488240283..d6c4a82b2 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -73,14 +73,14 @@ jobs: if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" working-directory: protobuf job_003: - name: "format_analyze; linux; Dart dev; PKG: api_benchmark; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `./compile_protos.sh`, `dart analyze --fatal-infos`" + name: "format_analyze; linux; Dart dev; PKG: api_benchmark; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `./compile_protos.sh`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark;commands:format-command_0-command_1-analyze_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark;commands:format-command_0-command_1" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:api_benchmark os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -110,10 +110,6 @@ jobs: run: ./compile_protos.sh if: "always() && steps.api_benchmark_pub_upgrade.conclusion == 'success'" working-directory: api_benchmark - - name: "api_benchmark; dart analyze --fatal-infos" - run: dart analyze --fatal-infos - if: "always() && steps.api_benchmark_pub_upgrade.conclusion == 'success'" - working-directory: api_benchmark job_004: name: "format_analyze; linux; Dart dev; PKG: benchmarks; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `./tool/compile_protos.sh`, `dart analyze --fatal-infos`" runs-on: ubuntu-latest diff --git a/api_benchmark/mono_pkg.yaml b/api_benchmark/mono_pkg.yaml index b23af8b06..c3046ef03 100644 --- a/api_benchmark/mono_pkg.yaml +++ b/api_benchmark/mono_pkg.yaml @@ -6,5 +6,4 @@ stages: - format - command: ./../tool/setup.sh - command: ./compile_protos.sh - - analyze: --fatal-infos sdk: dev From bffaca59e4ee8cfaa370fa8ece48bcca8af53767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 11:53:10 +0100 Subject: [PATCH 06/10] Update SDK lower bound of generated files --- protoc_plugin/CHANGELOG.md | 2 + protoc_plugin/lib/src/file_generator.dart | 2 +- protoc_plugin/pubspec.yaml | 2 +- protoc_plugin/test/goldens/deprecations | 2 +- .../test/goldens/deprecations.pbenum | 2 +- protoc_plugin/test/goldens/doc_comments | 2 +- .../test/goldens/doc_comments.pbenum | 2 +- protoc_plugin/test/goldens/grpc_service.pb | 2 +- .../test/goldens/grpc_service.pbgrpc | 2 +- .../test/goldens/header_in_package.pb | 2 +- .../test/goldens/header_with_fixnum.pb | 2 +- protoc_plugin/test/goldens/imports.pb | 2 +- protoc_plugin/test/goldens/imports.pbjson | 2 +- protoc_plugin/test/goldens/int64.pb | 2 +- protoc_plugin/test/goldens/oneMessage.pb | 2 +- protoc_plugin/test/goldens/oneMessage.pb.meta | 56 +++++++++---------- protoc_plugin/test/goldens/oneMessage.pbjson | 2 +- protoc_plugin/test/goldens/service.pb | 2 +- protoc_plugin/test/goldens/service.pbserver | 2 +- .../test/goldens/serviceGenerator.pb.json | 2 +- protoc_plugin/test/goldens/topLevelEnum.pb | 2 +- .../test/goldens/topLevelEnum.pbenum | 2 +- .../test/goldens/topLevelEnum.pbenum.meta | 20 +++---- .../test/goldens/topLevelEnum.pbjson | 2 +- 24 files changed, 61 insertions(+), 59 deletions(-) diff --git a/protoc_plugin/CHANGELOG.md b/protoc_plugin/CHANGELOG.md index 1d56341df..1876f2af9 100644 --- a/protoc_plugin/CHANGELOG.md +++ b/protoc_plugin/CHANGELOG.md @@ -12,6 +12,7 @@ * `deprecated` options in messages, grpc services and methods, and enum types and values are now handled to generate Dart `@deprecated` annotations. ([#900], [#908]) +* `protoc_plugin` and generated files now require Dart 3.3.0. (#953) [#738]: https://github.com/google/protobuf.dart/issues/738 [#903]: https://github.com/google/protobuf.dart/pull/903 @@ -20,6 +21,7 @@ [#900]: https://github.com/google/protobuf.dart/issues/900 [#909]: https://github.com/google/protobuf.dart/pull/909 [#908]: https://github.com/google/protobuf.dart/pull/908 +[#953]: https://github.com/google/protobuf.dart/pull/953 ## 21.1.2 diff --git a/protoc_plugin/lib/src/file_generator.dart b/protoc_plugin/lib/src/file_generator.dart index e74ae365b..220a325ab 100644 --- a/protoc_plugin/lib/src/file_generator.dart +++ b/protoc_plugin/lib/src/file_generator.dart @@ -644,7 +644,7 @@ class FileGenerator extends ProtobufContainer { // Generated code. Do not modify. // source: ${descriptor.name} // -// @dart = 2.12 +// @dart = 3.3 '''); ignorelines.forEach(out.println); out.println(''); diff --git a/protoc_plugin/pubspec.yaml b/protoc_plugin/pubspec.yaml index 14c96de1a..0c70bfec4 100644 --- a/protoc_plugin/pubspec.yaml +++ b/protoc_plugin/pubspec.yaml @@ -4,7 +4,7 @@ description: A protobuf protoc compiler plugin used to generate Dart code. repository: https://github.com/google/protobuf.dart/tree/master/protoc_plugin environment: - sdk: '>=2.19.0 <4.0.0' + sdk: '>=3.3.0 <4.0.0' dependencies: fixnum: ^1.0.0 diff --git a/protoc_plugin/test/goldens/deprecations b/protoc_plugin/test/goldens/deprecations index 97e98f706..0e636e4e1 100644 --- a/protoc_plugin/test/goldens/deprecations +++ b/protoc_plugin/test/goldens/deprecations @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: deprecations.proto // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/deprecations.pbenum b/protoc_plugin/test/goldens/deprecations.pbenum index 235430d9c..38b2e49de 100644 --- a/protoc_plugin/test/goldens/deprecations.pbenum +++ b/protoc_plugin/test/goldens/deprecations.pbenum @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: deprecations.proto // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/doc_comments b/protoc_plugin/test/goldens/doc_comments index 9460bcda3..55cb54678 100644 --- a/protoc_plugin/test/goldens/doc_comments +++ b/protoc_plugin/test/goldens/doc_comments @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: doc_comments.proto // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/doc_comments.pbenum b/protoc_plugin/test/goldens/doc_comments.pbenum index 3a400053f..f8d15198a 100644 --- a/protoc_plugin/test/goldens/doc_comments.pbenum +++ b/protoc_plugin/test/goldens/doc_comments.pbenum @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: doc_comments.proto // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/grpc_service.pb b/protoc_plugin/test/goldens/grpc_service.pb index b7a21b7ce..6c3909f39 100644 --- a/protoc_plugin/test/goldens/grpc_service.pb +++ b/protoc_plugin/test/goldens/grpc_service.pb @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/grpc_service.pbgrpc b/protoc_plugin/test/goldens/grpc_service.pbgrpc index 9e7194173..2035e1f5f 100644 --- a/protoc_plugin/test/goldens/grpc_service.pbgrpc +++ b/protoc_plugin/test/goldens/grpc_service.pbgrpc @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/header_in_package.pb b/protoc_plugin/test/goldens/header_in_package.pb index 14dcfbd6d..a123b07e4 100644 --- a/protoc_plugin/test/goldens/header_in_package.pb +++ b/protoc_plugin/test/goldens/header_in_package.pb @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/header_with_fixnum.pb b/protoc_plugin/test/goldens/header_with_fixnum.pb index d50ef3dcc..69f20e06b 100644 --- a/protoc_plugin/test/goldens/header_with_fixnum.pb +++ b/protoc_plugin/test/goldens/header_with_fixnum.pb @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/imports.pb b/protoc_plugin/test/goldens/imports.pb index 288535a43..b8d1f3f92 100644 --- a/protoc_plugin/test/goldens/imports.pb +++ b/protoc_plugin/test/goldens/imports.pb @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test.proto // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/imports.pbjson b/protoc_plugin/test/goldens/imports.pbjson index 27df3fe4f..4a3248a7f 100644 --- a/protoc_plugin/test/goldens/imports.pbjson +++ b/protoc_plugin/test/goldens/imports.pbjson @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test.proto // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/int64.pb b/protoc_plugin/test/goldens/int64.pb index 64040add3..fb09db213 100644 --- a/protoc_plugin/test/goldens/int64.pb +++ b/protoc_plugin/test/goldens/int64.pb @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/oneMessage.pb b/protoc_plugin/test/goldens/oneMessage.pb index c5212f9a7..f01d10592 100644 --- a/protoc_plugin/test/goldens/oneMessage.pb +++ b/protoc_plugin/test/goldens/oneMessage.pb @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/oneMessage.pb.meta b/protoc_plugin/test/goldens/oneMessage.pb.meta index 20dfc3ca2..9e61c75fa 100644 --- a/protoc_plugin/test/goldens/oneMessage.pb.meta +++ b/protoc_plugin/test/goldens/oneMessage.pb.meta @@ -2,15 +2,15 @@ annotation: { path: 4 path: 0 sourceFile: test - begin: 526 - end: 537 + begin: 525 + end: 536 } annotation: { path: 4 path: 0 sourceFile: test - begin: 608 - end: 619 + begin: 607 + end: 618 } annotation: { path: 4 @@ -18,8 +18,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 2328 - end: 2334 + begin: 2327 + end: 2333 } annotation: { path: 4 @@ -27,8 +27,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 2376 - end: 2382 + begin: 2375 + end: 2381 } annotation: { path: 4 @@ -36,8 +36,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 2455 - end: 2464 + begin: 2454 + end: 2463 } annotation: { path: 4 @@ -45,8 +45,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 2507 - end: 2518 + begin: 2506 + end: 2517 } annotation: { path: 4 @@ -54,8 +54,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 2578 - end: 2582 + begin: 2577 + end: 2581 } annotation: { path: 4 @@ -63,8 +63,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 2624 - end: 2628 + begin: 2623 + end: 2627 } annotation: { path: 4 @@ -72,8 +72,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 2703 - end: 2710 + begin: 2702 + end: 2709 } annotation: { path: 4 @@ -81,8 +81,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 2753 - end: 2762 + begin: 2752 + end: 2761 } annotation: { path: 4 @@ -90,8 +90,8 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 2825 - end: 2829 + begin: 2824 + end: 2828 } annotation: { path: 4 @@ -99,8 +99,8 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 2876 - end: 2880 + begin: 2875 + end: 2879 } annotation: { path: 4 @@ -108,8 +108,8 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 2953 - end: 2960 + begin: 2952 + end: 2959 } annotation: { path: 4 @@ -117,6 +117,6 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 3003 - end: 3012 + begin: 3002 + end: 3011 } diff --git a/protoc_plugin/test/goldens/oneMessage.pbjson b/protoc_plugin/test/goldens/oneMessage.pbjson index 4692c4dad..093e11186 100644 --- a/protoc_plugin/test/goldens/oneMessage.pbjson +++ b/protoc_plugin/test/goldens/oneMessage.pbjson @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/service.pb b/protoc_plugin/test/goldens/service.pb index 706e352af..098d70668 100644 --- a/protoc_plugin/test/goldens/service.pb +++ b/protoc_plugin/test/goldens/service.pb @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/service.pbserver b/protoc_plugin/test/goldens/service.pbserver index 00be809e8..3957d381b 100644 --- a/protoc_plugin/test/goldens/service.pbserver +++ b/protoc_plugin/test/goldens/service.pbserver @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names diff --git a/protoc_plugin/test/goldens/serviceGenerator.pb.json b/protoc_plugin/test/goldens/serviceGenerator.pb.json index 209607327..80429a800 100644 --- a/protoc_plugin/test/goldens/serviceGenerator.pb.json +++ b/protoc_plugin/test/goldens/serviceGenerator.pb.json @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: testpkg.proto // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/topLevelEnum.pb b/protoc_plugin/test/goldens/topLevelEnum.pb index 9a8ed6010..4fb6447a9 100644 --- a/protoc_plugin/test/goldens/topLevelEnum.pb +++ b/protoc_plugin/test/goldens/topLevelEnum.pb @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/topLevelEnum.pbenum b/protoc_plugin/test/goldens/topLevelEnum.pbenum index 2e5349e7d..82b934e89 100644 --- a/protoc_plugin/test/goldens/topLevelEnum.pbenum +++ b/protoc_plugin/test/goldens/topLevelEnum.pbenum @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes diff --git a/protoc_plugin/test/goldens/topLevelEnum.pbenum.meta b/protoc_plugin/test/goldens/topLevelEnum.pbenum.meta index 170e621c4..fc667d4fa 100644 --- a/protoc_plugin/test/goldens/topLevelEnum.pbenum.meta +++ b/protoc_plugin/test/goldens/topLevelEnum.pbenum.meta @@ -2,8 +2,8 @@ annotation: { path: 5 path: 0 sourceFile: test - begin: 445 - end: 454 + begin: 444 + end: 453 } annotation: { path: 5 @@ -11,8 +11,8 @@ annotation: { path: 2 path: 0 sourceFile: test - begin: 507 - end: 513 + begin: 506 + end: 512 } annotation: { path: 5 @@ -20,8 +20,8 @@ annotation: { path: 2 path: 1 sourceFile: test - begin: 589 - end: 593 + begin: 588 + end: 592 } annotation: { path: 5 @@ -29,8 +29,8 @@ annotation: { path: 2 path: 2 sourceFile: test - begin: 667 - end: 671 + begin: 666 + end: 670 } annotation: { path: 5 @@ -38,6 +38,6 @@ annotation: { path: 2 path: 3 sourceFile: test - begin: 746 - end: 754 + begin: 745 + end: 753 } diff --git a/protoc_plugin/test/goldens/topLevelEnum.pbjson b/protoc_plugin/test/goldens/topLevelEnum.pbjson index b9a97ed09..092d9a005 100644 --- a/protoc_plugin/test/goldens/topLevelEnum.pbjson +++ b/protoc_plugin/test/goldens/topLevelEnum.pbjson @@ -2,7 +2,7 @@ // Generated code. Do not modify. // source: test // -// @dart = 2.12 +// @dart = 3.3 // ignore_for_file: annotate_overrides, camel_case_types, comment_references // ignore_for_file: constant_identifier_names, library_prefixes From 0d80c5ddf29ac657a7b8cbfd7e9fa1fd61d2488e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 11:55:10 +0100 Subject: [PATCH 07/10] Regenerate mono_repo --- .github/workflows/dart.yml | 66 +++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index d6c4a82b2..dfc4bec00 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -229,43 +229,35 @@ jobs: if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" working-directory: protoc_plugin job_007: - name: "run_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`" + name: "run_tests; linux; Dart 3.3.0; PKG: protobuf; `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: - sdk: "2.19.0" + sdk: "3.3.0" - id: checkout name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protoc_plugin_pub_upgrade - name: protoc_plugin; dart pub upgrade + - id: protobuf_pub_upgrade + name: protobuf; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; ./../tool/setup.sh - run: ./../tool/setup.sh - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; make protos - run: make protos - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; dart test + working-directory: protobuf + - name: protobuf; dart test run: dart test - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin + if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" + working-directory: protobuf needs: - job_001 - job_002 @@ -274,16 +266,16 @@ jobs: - job_005 - job_006 job_008: - name: "run_tests; linux; Dart 3.3.0; PKG: protobuf; `dart test`" + name: "run_tests; linux; Dart 3.3.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin;commands:command_0-command_3-test_0" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest @@ -294,15 +286,23 @@ jobs: - id: checkout name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protobuf_pub_upgrade - name: protobuf; dart pub upgrade + - id: protoc_plugin_pub_upgrade + name: protoc_plugin; dart pub upgrade run: dart pub upgrade if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protobuf - - name: protobuf; dart test + working-directory: protoc_plugin + - name: protoc_plugin; ./../tool/setup.sh + run: ./../tool/setup.sh + if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" + working-directory: protoc_plugin + - name: protoc_plugin; make protos + run: make protos + if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" + working-directory: protoc_plugin + - name: protoc_plugin; dart test run: dart test - if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" - working-directory: protobuf + if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" + working-directory: protoc_plugin needs: - job_001 - job_002 @@ -521,23 +521,23 @@ jobs: - job_005 - job_006 job_015: - name: "run_legacy_tests; linux; Dart 2.19.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test legacy_tests/generated_message_test.dart`" + name: "run_legacy_tests; linux; Dart 3.3.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test legacy_tests/generated_message_test.dart`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin;commands:command_0-command_3-test_1" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin;commands:command_0-command_3-test_1" restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0 + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin + os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 os:ubuntu-latest;pub-cache-hosted os:ubuntu-latest - name: Setup Dart SDK uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 with: - sdk: "2.19.0" + sdk: "3.3.0" - id: checkout name: Checkout repository uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 From 5ad7fe1630e91ad43077830444ca3c140fede112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 11:56:56 +0100 Subject: [PATCH 08/10] Fix warning in protoc_plugin --- protoc_plugin/lib/indenting_writer.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protoc_plugin/lib/indenting_writer.dart b/protoc_plugin/lib/indenting_writer.dart index f6b8dae43..307b7856e 100644 --- a/protoc_plugin/lib/indenting_writer.dart +++ b/protoc_plugin/lib/indenting_writer.dart @@ -159,7 +159,7 @@ class IndentingWriter { } final annotation = GeneratedCodeInfo_Annotation() ..path.addAll(fieldPath) - ..sourceFile = _sourceFile! + ..sourceFile = _sourceFile ..begin = _previousOffset + start ..end = _previousOffset + start + name.length; sourceLocationInfo.annotation.add(annotation); From 4068c4fdd3809cb6975e4079bdc25846e422a837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 12:03:21 +0100 Subject: [PATCH 09/10] Fix new warnings in protoc_plugin generated code and tests with 3.3.0 --- protoc_plugin/lib/src/enum_generator.dart | 4 +--- protoc_plugin/lib/testing/mixins.dart | 6 +++--- protoc_plugin/test/goldens/deprecations.pbenum | 2 +- protoc_plugin/test/goldens/doc_comments.pbenum | 2 +- protoc_plugin/test/goldens/enum | 2 +- protoc_plugin/test/goldens/messageGeneratorEnums | 2 +- protoc_plugin/test/goldens/topLevelEnum.pbenum | 2 +- 7 files changed, 9 insertions(+), 11 deletions(-) diff --git a/protoc_plugin/lib/src/enum_generator.dart b/protoc_plugin/lib/src/enum_generator.dart index 875e3aede..a1cd8b5f7 100644 --- a/protoc_plugin/lib/src/enum_generator.dart +++ b/protoc_plugin/lib/src/enum_generator.dart @@ -182,9 +182,7 @@ class EnumGenerator extends ProtobufContainer { ' _byValue[value];'); out.println(); - out.println( - 'const $classname._($coreImportPrefix.int v, $coreImportPrefix.String n) ' - ': super(v, n);'); + out.println('const $classname._(super.v, super.n);'); }); } diff --git a/protoc_plugin/lib/testing/mixins.dart b/protoc_plugin/lib/testing/mixins.dart index c735f1def..c70612002 100644 --- a/protoc_plugin/lib/testing/mixins.dart +++ b/protoc_plugin/lib/testing/mixins.dart @@ -1,4 +1,4 @@ -abstract class Mixin1 { +mixin Mixin1 { String get overriddenString => 'mixin1'; String get interfaceString; @@ -6,10 +6,10 @@ abstract class Mixin1 { bool hasInterfaceString(); } -abstract class Mixin2 { +mixin Mixin2 { String get overriddenString => 'mixin2'; bool hasOverriddenHasMethod() => false; } -abstract class Mixin3 {} +mixin Mixin3 {} diff --git a/protoc_plugin/test/goldens/deprecations.pbenum b/protoc_plugin/test/goldens/deprecations.pbenum index 38b2e49de..30bc5d782 100644 --- a/protoc_plugin/test/goldens/deprecations.pbenum +++ b/protoc_plugin/test/goldens/deprecations.pbenum @@ -28,7 +28,7 @@ class A extends $pb.ProtobufEnum { $pb.ProtobufEnum.initByValue(values); static A? valueOf($core.int value) => _byValue[value]; - const A._($core.int v, $core.String n) : super(v, n); + const A._(super.v, super.n); } const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/protoc_plugin/test/goldens/doc_comments.pbenum b/protoc_plugin/test/goldens/doc_comments.pbenum index f8d15198a..7cde50e13 100644 --- a/protoc_plugin/test/goldens/doc_comments.pbenum +++ b/protoc_plugin/test/goldens/doc_comments.pbenum @@ -30,7 +30,7 @@ class A extends $pb.ProtobufEnum { $pb.ProtobufEnum.initByValue(values); static A? valueOf($core.int value) => _byValue[value]; - const A._($core.int v, $core.String n) : super(v, n); + const A._(super.v, super.n); } const _omitEnumNames = $core.bool.fromEnvironment('protobuf.omit_enum_names'); diff --git a/protoc_plugin/test/goldens/enum b/protoc_plugin/test/goldens/enum index ae5df5cf4..812247ddf 100644 --- a/protoc_plugin/test/goldens/enum +++ b/protoc_plugin/test/goldens/enum @@ -14,7 +14,7 @@ class PhoneType extends $pb.ProtobufEnum { static final $core.Map<$core.int, PhoneType> _byValue = $pb.ProtobufEnum.initByValue(values); static PhoneType? valueOf($core.int value) => _byValue[value]; - const PhoneType._($core.int v, $core.String n) : super(v, n); + const PhoneType._(super.v, super.n); } diff --git a/protoc_plugin/test/goldens/messageGeneratorEnums b/protoc_plugin/test/goldens/messageGeneratorEnums index e942de900..3469c7bab 100644 --- a/protoc_plugin/test/goldens/messageGeneratorEnums +++ b/protoc_plugin/test/goldens/messageGeneratorEnums @@ -14,7 +14,7 @@ class PhoneNumber_PhoneType extends $pb.ProtobufEnum { static final $core.Map<$core.int, PhoneNumber_PhoneType> _byValue = $pb.ProtobufEnum.initByValue(values); static PhoneNumber_PhoneType? valueOf($core.int value) => _byValue[value]; - const PhoneNumber_PhoneType._($core.int v, $core.String n) : super(v, n); + const PhoneNumber_PhoneType._(super.v, super.n); } diff --git a/protoc_plugin/test/goldens/topLevelEnum.pbenum b/protoc_plugin/test/goldens/topLevelEnum.pbenum index 82b934e89..30d81a24e 100644 --- a/protoc_plugin/test/goldens/topLevelEnum.pbenum +++ b/protoc_plugin/test/goldens/topLevelEnum.pbenum @@ -29,7 +29,7 @@ class PhoneType extends $pb.ProtobufEnum { static final $core.Map<$core.int, PhoneType> _byValue = $pb.ProtobufEnum.initByValue(values); static PhoneType? valueOf($core.int value) => _byValue[value]; - const PhoneType._($core.int v, $core.String n) : super(v, n); + const PhoneType._(super.v, super.n); } From 561ac2a9df2666c047e7f8437d0e745d9117fd74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96mer=20Sinan=20A=C4=9Facan?= Date: Wed, 5 Feb 2025 12:07:38 +0100 Subject: [PATCH 10/10] Remove legacy tests --- .github/workflows/dart.yml | 73 ++----------- .../legacy_tests/generated_message_test.dart | 101 ------------------ protoc_plugin/mono_pkg.yaml | 9 +- tool/ci.sh | 10 +- 4 files changed, 12 insertions(+), 181 deletions(-) delete mode 100644 protoc_plugin/legacy_tests/generated_message_test.dart diff --git a/.github/workflows/dart.yml b/.github/workflows/dart.yml index dfc4bec00..c9f6846e2 100644 --- a/.github/workflows/dart.yml +++ b/.github/workflows/dart.yml @@ -187,14 +187,14 @@ jobs: if: "always() && steps.protobuf_pub_upgrade.conclusion == 'success'" working-directory: protobuf job_006: - name: "format_analyze; linux; Dart dev; PKG: protoc_plugin; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `make protos`, `dart analyze --fatal-infos bin lib test`" + name: "format_analyze; linux; Dart dev; PKG: protoc_plugin; `dart format --output=none --set-exit-if-changed .`, `./../tool/setup.sh`, `make protos`, `dart analyze --fatal-infos`" runs-on: ubuntu-latest steps: - name: Cache Pub hosted dependencies uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:format-command_0-command_3-analyze_3" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:format-command_0-command_3-analyze_0" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -224,8 +224,8 @@ jobs: run: make protos if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" working-directory: protoc_plugin - - name: "protoc_plugin; dart analyze --fatal-infos bin lib test" - run: dart analyze --fatal-infos bin lib test + - name: "protoc_plugin; dart analyze --fatal-infos" + run: dart analyze --fatal-infos if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" working-directory: protoc_plugin job_007: @@ -236,7 +236,7 @@ jobs: uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 @@ -273,7 +273,7 @@ jobs: uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin;commands:command_0-command_3-test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin;commands:command_0-command_3-test" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 @@ -318,7 +318,7 @@ jobs: uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protobuf os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -355,7 +355,7 @@ jobs: uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:command_0-command_3-test_0" + key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin;commands:command_0-command_3-test" restore-keys: | os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:protoc_plugin os:ubuntu-latest;pub-cache-hosted;sdk:dev @@ -400,7 +400,7 @@ jobs: uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:macos-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test_0" + key: "os:macos-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf;commands:test" restore-keys: | os:macos-latest;pub-cache-hosted;sdk:3.3.0;packages:protobuf os:macos-latest;pub-cache-hosted;sdk:3.3.0 @@ -437,7 +437,7 @@ jobs: uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 with: path: "~/.pub-cache/hosted" - key: "os:macos-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test_0" + key: "os:macos-latest;pub-cache-hosted;sdk:dev;packages:protobuf;commands:test" restore-keys: | os:macos-latest;pub-cache-hosted;sdk:dev;packages:protobuf os:macos-latest;pub-cache-hosted;sdk:dev @@ -520,56 +520,3 @@ jobs: - job_004 - job_005 - job_006 - job_015: - name: "run_legacy_tests; linux; Dart 3.3.0; PKG: protoc_plugin; `./../tool/setup.sh`, `make protos`, `dart test legacy_tests/generated_message_test.dart`" - runs-on: ubuntu-latest - steps: - - name: Cache Pub hosted dependencies - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 - with: - path: "~/.pub-cache/hosted" - key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin;commands:command_0-command_3-test_1" - restore-keys: | - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0;packages:protoc_plugin - os:ubuntu-latest;pub-cache-hosted;sdk:3.3.0 - os:ubuntu-latest;pub-cache-hosted - os:ubuntu-latest - - name: Setup Dart SDK - uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94 - with: - sdk: "3.3.0" - - id: checkout - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - - id: protoc_plugin_pub_upgrade - name: protoc_plugin; dart pub upgrade - run: dart pub upgrade - if: "always() && steps.checkout.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; ./../tool/setup.sh - run: ./../tool/setup.sh - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; make protos - run: make protos - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - - name: protoc_plugin; dart test legacy_tests/generated_message_test.dart - run: dart test legacy_tests/generated_message_test.dart - if: "always() && steps.protoc_plugin_pub_upgrade.conclusion == 'success'" - working-directory: protoc_plugin - needs: - - job_001 - - job_002 - - job_003 - - job_004 - - job_005 - - job_006 - - job_007 - - job_008 - - job_009 - - job_010 - - job_011 - - job_012 - - job_013 - - job_014 diff --git a/protoc_plugin/legacy_tests/generated_message_test.dart b/protoc_plugin/legacy_tests/generated_message_test.dart deleted file mode 100644 index 77dc36d74..000000000 --- a/protoc_plugin/legacy_tests/generated_message_test.dart +++ /dev/null @@ -1,101 +0,0 @@ -// 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. - -// @dart=2.11 - -import 'package:test/test.dart'; - -import '../out/protos/google/protobuf/unittest.pb.dart'; -import '../out/protos/toplevel.pb.dart'; -import '../out/protos/toplevel_import.pb.dart' as t; - -void main() { - test('testSettersRejectNull', () { - final message = TestAllTypes(); - expect(() { - message.optionalString = null; - }, throwsArgumentError); - expect(() { - message.optionalBytes = null; - }, throwsArgumentError); - expect(() { - message.optionalNestedMessage = null; - }, throwsArgumentError); - expect(() { - message.optionalNestedMessage = null; - }, throwsArgumentError); - expect(() { - message.optionalNestedEnum = null; - }, throwsArgumentError); - expect(() { - message.repeatedString.add(null); - }, throwsArgumentError); - expect(() { - message.repeatedBytes.add(null); - }, throwsArgumentError); - expect(() { - message.repeatedNestedMessage.add(null); - }, throwsArgumentError); - expect(() { - message.repeatedNestedMessage.add(null); - }, throwsArgumentError); - expect(() { - message.repeatedNestedEnum.add(null); - }, throwsArgumentError); - }); - - test('testRepeatedSettersRejectNull', () { - final message = TestAllTypes(); - - message.repeatedString.addAll(['one', 'two']); - expect(() { - message.repeatedString[1] = null; - }, throwsArgumentError); - - message.repeatedBytes.addAll(['one'.codeUnits, 'two'.codeUnits]); - expect(() { - message.repeatedBytes[1] = null; - }, throwsArgumentError); - - message.repeatedNestedMessage.addAll([ - TestAllTypes_NestedMessage()..bb = 318, - TestAllTypes_NestedMessage()..bb = 456 - ]); - expect(() { - message.repeatedNestedMessage[1] = null; - }, throwsArgumentError); - - message.repeatedNestedEnum - .addAll([TestAllTypes_NestedEnum.FOO, TestAllTypes_NestedEnum.BAR]); - expect(() { - message.repeatedNestedEnum[1] = null; - }, throwsArgumentError); - }); - - test('testRepeatedAppendRejectsNull', () { - final message = TestAllTypes(); - - expect(() { - message.repeatedForeignMessage.addAll([ForeignMessage()..c = 12, null]); - }, throwsArgumentError); - - expect(() { - message.repeatedForeignEnum.addAll([ForeignEnum.FOREIGN_BAZ, null]); - }, throwsArgumentError); - - expect(() { - message.repeatedString.addAll(['one', null]); - }, throwsArgumentError); - - expect(() { - message.repeatedBytes.addAll(['one'.codeUnits, null]); - }, throwsArgumentError); - }); - - test('testToplevel', () { - final message = t.M(); - message.t = T(); - t.SApi(null); - }); -} diff --git a/protoc_plugin/mono_pkg.yaml b/protoc_plugin/mono_pkg.yaml index f7cefe59b..d9625f261 100644 --- a/protoc_plugin/mono_pkg.yaml +++ b/protoc_plugin/mono_pkg.yaml @@ -5,8 +5,7 @@ stages: - format - command: ./../tool/setup.sh - command: make protos - # Specify directores to exclude legacy_tests - - analyze: --fatal-infos bin lib test + - analyze: --fatal-infos sdk: [dev] - run_tests: - group: @@ -14,9 +13,3 @@ stages: - command: make protos - test sdk: [pubspec, dev] - - run_legacy_tests: - - group: - - command: ./../tool/setup.sh - - command: make protos - - test: legacy_tests/generated_message_test.dart - sdk: [pubspec] diff --git a/tool/ci.sh b/tool/ci.sh index 21acd0a8a..987255104 100755 --- a/tool/ci.sh +++ b/tool/ci.sh @@ -75,10 +75,6 @@ for PKG in ${PKGS}; do echo 'dart analyze test' dart analyze test || EXIT_CODE=$? ;; - analyze_3) - echo 'dart analyze --fatal-infos bin lib test' - dart analyze --fatal-infos bin lib test || EXIT_CODE=$? - ;; command_0) echo './../tool/setup.sh' ./../tool/setup.sh || EXIT_CODE=$? @@ -99,14 +95,10 @@ for PKG in ${PKGS}; do echo 'dart format --output=none --set-exit-if-changed .' dart format --output=none --set-exit-if-changed . || EXIT_CODE=$? ;; - test_0) + test) echo 'dart test' dart test || EXIT_CODE=$? ;; - test_1) - echo 'dart test legacy_tests/generated_message_test.dart' - dart test legacy_tests/generated_message_test.dart || EXIT_CODE=$? - ;; *) echo -e "\033[31mUnknown TASK '${TASK}' - TERMINATING JOB\033[0m" exit 64