Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed May 19, 2024
1 parent 02e17e5 commit 0e82cd6
Show file tree
Hide file tree
Showing 12 changed files with 83 additions and 92 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/dart.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Created with package:mono_repo v6.5.7
# Created with package:mono_repo v6.6.1
name: Dart CI
on:
push:
Expand Down Expand Up @@ -36,27 +36,27 @@ jobs:
name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- name: mono_repo self validate
run: dart pub global activate mono_repo 6.5.7
run: dart pub global activate mono_repo 6.6.1
- name: mono_repo self validate
run: dart pub global run mono_repo generate --validate
job_002:
name: "analyzer_and_format; Dart 3.0.0; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; `dart analyze`"
name: "analyzer_and_format; Dart 3.4.0; 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.0.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:analyze_1"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:analyze_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0
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
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "3.0.0"
sdk: "3.4.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
Expand Down Expand Up @@ -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.0.0; PKGS: _test_yaml, checked_yaml, example, json_serializable; `dart test`"
name: "unit_test; Dart 3.4.0; 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.0.0;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_0"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_0"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:_test_yaml-checked_yaml-example-json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0
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
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "3.0.0"
sdk: "3.4.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
Expand Down Expand Up @@ -253,23 +253,23 @@ jobs:
- job_002
- job_003
job_005:
name: "unit_test; Dart 3.0.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/annotation_version_test.dart`"
name: "unit_test; Dart 3.4.0; 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.0.0;packages:json_serializable;commands:test_3"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:json_serializable;commands:test_3"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0
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
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "3.0.0"
sdk: "3.4.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
Expand All @@ -287,23 +287,23 @@ jobs:
- job_002
- job_003
job_006:
name: "unit_test; Dart 3.0.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
name: "unit_test; Dart 3.4.0; 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.0.0;packages:json_serializable;commands:test_1"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:json_serializable;commands:test_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0
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
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "3.0.0"
sdk: "3.4.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
Expand All @@ -321,23 +321,23 @@ jobs:
- job_002
- job_003
job_007:
name: "unit_test; Dart 3.0.0; PKG: json_serializable; `dart test -p chrome`"
name: "unit_test; Dart 3.4.0; 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.0.0;packages:json_serializable;commands:test_2"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:json_serializable;commands:test_2"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:json_serializable
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0
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
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "3.0.0"
sdk: "3.4.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
Expand Down Expand Up @@ -518,23 +518,23 @@ jobs:
- job_002
- job_003
job_012:
name: "ensure_build; Dart 3.0.0; PKGS: _test_yaml, checked_yaml, example; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
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`"
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.0.0;packages:_test_yaml-checked_yaml-example;commands:test_1"
key: "os:ubuntu-latest;pub-cache-hosted;sdk:3.4.0;packages:_test_yaml-checked_yaml-example;commands:test_1"
restore-keys: |
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0;packages:_test_yaml-checked_yaml-example
os:ubuntu-latest;pub-cache-hosted;sdk:3.0.0
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
os:ubuntu-latest
- name: Setup Dart SDK
uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3
with:
sdk: "3.0.0"
sdk: "3.4.0"
- id: checkout
name: Checkout repository
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
Expand Down
14 changes: 7 additions & 7 deletions _test_yaml/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ name: _test_yaml
publish_to: none

environment:
sdk: ^3.0.0
sdk: ^3.4.0

dev_dependencies:
_json_serial_shared_test:
path: ../shared_test
build_runner: ^2.0.0
build_runner: ^2.2.1
build_verify: ^3.0.0
checked_yaml: any
dart_flutter_team_lints: ^2.0.0
json_annotation: ^4.8.1
json_serializable: any
checked_yaml: ^2.0.4-wip
dart_flutter_team_lints: ^3.0.0
json_annotation: ^4.9.0
json_serializable: ^6.8.0
path: ^1.8.2
test: ^1.6.0
test: ^1.21.6
yaml: ^3.0.0

dependency_overrides:
Expand Down
10 changes: 5 additions & 5 deletions checked_yaml/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ topics:
- codegen

environment:
sdk: ^3.0.0
sdk: ^3.4.0

dependencies:
json_annotation: ^4.3.0
source_span: ^1.8.0
yaml: ^3.0.0

dev_dependencies:
build_runner: ^2.0.0
build_runner: ^2.0.6
build_verify: ^3.0.0
dart_flutter_team_lints: ^2.0.0
dart_flutter_team_lints: ^3.0.0
json_serializable: ^6.0.0
path: ^1.0.0
test: ^1.16.0
path: ^1.8.0
test: ^1.17.10
test_process: ^2.0.0

#dependency_overrides:
Expand Down
10 changes: 5 additions & 5 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: example
publish_to: none

environment:
sdk: ^3.0.0
sdk: ^3.4.0

dependencies:
json_annotation: ^4.8.0
json_annotation: ^4.9.0

dev_dependencies:
# Used by tests. Not required to use `json_serializable`.
Expand All @@ -19,14 +19,14 @@ dev_dependencies:
build_verify: ^3.0.0

# Not required to use `json_serializable`.
dart_flutter_team_lints: ^2.0.0
dart_flutter_team_lints: ^3.0.0

# REQUIRED!
json_serializable: ^6.6.0
json_serializable: ^6.8.0

# Not required to use `json_serializable`.
path: ^1.8.0
test: ^1.16.0
test: ^1.21.6

# This section is used to verify changes to these packages. Do not include in
# your code!
Expand Down
4 changes: 2 additions & 2 deletions json_annotation/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ topics:
- codegen

environment:
sdk: ^3.0.0
sdk: ^3.4.0

dependencies:
meta: ^1.4.0

dev_dependencies:
dart_flutter_team_lints: ^2.0.0
dart_flutter_team_lints: ^3.0.0
# When changing JsonSerializable class.
# build_runner: ^2.0.0
# json_serializable: any
5 changes: 4 additions & 1 deletion json_serializable/lib/src/decode_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ mixin DecodeHelper implements HelperCore {
config.constructor,
accessibleFields.keys,
accessibleFields.values
.where((fe) => element.lookUpSetter(fe.name, element.library) != null)
.where((fe) =>
element.augmented
.lookUpSetter(name: fe.name, library: element.library) !=
null)
.map((fe) => fe.name)
.toList(),
unavailableReasons,
Expand Down
4 changes: 2 additions & 2 deletions json_serializable/lib/src/field_helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ List<FieldElement> createSortedFieldSet(ClassElement element) {
}

if (v is PropertyAccessorElement && v.isGetter) {
assert(v.variable is FieldElement);
final variable = v.variable as FieldElement;
assert(v.variable2 is FieldElement);
final variable = v.variable2 as FieldElement;
assert(!inheritedFields.containsKey(variable.name));
inheritedFields[variable.name] = variable;
}
Expand Down
8 changes: 0 additions & 8 deletions json_serializable/lib/src/json_serializable_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ class JsonSerializableGenerator
ConstantReader annotation,
BuildStep buildStep,
) {
if (!element.library!.isNonNullableByDefault) {
throw InvalidGenerationSourceError(
'Generator cannot target libraries that have not been migrated to '
'null-safety.',
element: element,
);
}

if (element is! ClassElement || element is EnumElement) {
throw InvalidGenerationSourceError(
'`@JsonSerializable` can only be used on classes.',
Expand Down
2 changes: 1 addition & 1 deletion json_serializable/lib/src/type_helpers/map_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class MapHelper extends TypeHelper<TypeHelperContextWithConfig> {
// `toDouble` on input values
valueArg.isSimpleJsonTypeNotDouble)) {
// No mapping of the values or null check required!
final valueString = valueArg.getDisplayString(withNullability: true);
final valueString = valueArg.getDisplayString();
return 'Map<String, $valueString>.from($expression as Map)';
}
}
Expand Down
32 changes: 16 additions & 16 deletions json_serializable/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,40 @@ description: >-
Dart classes.
repository: https://github.com/google/json_serializable.dart/tree/master/json_serializable
environment:
sdk: ^3.0.0
sdk: ^3.4.0
topics:
- json
- build-runner
- json-serializable
- codegen

dependencies:
analyzer: '>=5.12.0 <7.0.0'
async: ^2.8.0
build: ^2.0.0
build_config: '>=0.4.4 <2.0.0'
collection: ^1.14.0
analyzer: ^6.5.0
async: ^2.10.0
build: ^2.4.1
build_config: ^1.1.0
collection: ^1.17.0

# Use a tight version constraint to ensure that a constraint on
# `json_annotation` properly constrains all features it provides.
json_annotation: '>=4.9.0 <4.10.0'
meta: ^1.3.0
path: ^1.8.0
pub_semver: ^2.0.0
meta: ^1.14.0
path: ^1.9.0
pub_semver: ^2.1.4
pubspec_parse: ^1.0.0
source_gen: ^1.3.2
source_helper: ^1.3.0
source_gen: ^1.4.0
source_helper: ^1.3.4

dev_dependencies:
_json_serial_shared_test:
path: ../shared_test
build_runner: ^2.0.0
build_runner: ^2.4.6
build_verify: ^3.0.0
dart_flutter_team_lints: ^2.0.0
dart_style: ^2.0.0
dart_flutter_team_lints: ^3.0.0
dart_style: ^2.3.2
logging: ^1.0.0
source_gen_test: ^1.0.0
test: ^1.16.0
source_gen_test: ^1.0.6
test: ^1.24.4
test_descriptor: ^2.0.0
test_process: ^2.0.0
yaml: ^3.0.0
Loading

0 comments on commit 0e82cd6

Please sign in to comment.