Skip to content

Commit 393cb43

Browse files
authored
Fix formatting with the latest SDK (#1295)
1 parent ff9d138 commit 393cb43

File tree

4 files changed

+64
-34
lines changed

4 files changed

+64
-34
lines changed

.github/workflows/dart.yml

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ jobs:
4040
- name: mono_repo self validate
4141
run: dart pub global run mono_repo generate --validate
4242
job_002:
43-
name: "analyzer_and_format; Dart 2.19.0; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
43+
name: "analyzer_and_format; Dart 2.19.0; PKGS: _test_yaml, checked_yaml, example, json_serializable; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
4444
runs-on: ubuntu-latest
4545
steps:
4646
- name: Cache Pub hosted dependencies
4747
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0
4848
with:
4949
path: "~/.pub-cache/hosted"
50-
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:format-analyze"
50+
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:_test_yaml-checked_yaml-example-json_serializable;commands:format-analyze_0"
5151
restore-keys: |
52-
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable
52+
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:_test_yaml-checked_yaml-example-json_serializable
5353
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0
5454
os:ubuntu-latest;pub-cache-hosted
5555
os:ubuntu-latest
@@ -99,19 +99,6 @@ jobs:
9999
run: dart analyze --fatal-infos .
100100
if: "always() && steps.example_pub_upgrade.conclusion == 'success'"
101101
working-directory: example
102-
- id: json_annotation_pub_upgrade
103-
name: json_annotation; dart pub upgrade
104-
run: dart pub upgrade
105-
if: "always() && steps.checkout.conclusion == 'success'"
106-
working-directory: json_annotation
107-
- name: "json_annotation; dart format --output=none --set-exit-if-changed ."
108-
run: "dart format --output=none --set-exit-if-changed ."
109-
if: "always() && steps.json_annotation_pub_upgrade.conclusion == 'success'"
110-
working-directory: json_annotation
111-
- name: "json_annotation; dart analyze --fatal-infos ."
112-
run: dart analyze --fatal-infos .
113-
if: "always() && steps.json_annotation_pub_upgrade.conclusion == 'success'"
114-
working-directory: json_annotation
115102
- id: json_serializable_pub_upgrade
116103
name: json_serializable; dart pub upgrade
117104
run: dart pub upgrade
@@ -126,14 +113,44 @@ jobs:
126113
if: "always() && steps.json_serializable_pub_upgrade.conclusion == 'success'"
127114
working-directory: json_serializable
128115
job_003:
116+
name: "analyzer_and_format; Dart 2.19.0; PKG: json_annotation; `dart analyze`"
117+
runs-on: ubuntu-latest
118+
steps:
119+
- name: Cache Pub hosted dependencies
120+
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0
121+
with:
122+
path: "~/.pub-cache/hosted"
123+
key: "os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:json_annotation;commands:analyze_1"
124+
restore-keys: |
125+
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0;packages:json_annotation
126+
os:ubuntu-latest;pub-cache-hosted;sdk:2.19.0
127+
os:ubuntu-latest;pub-cache-hosted
128+
os:ubuntu-latest
129+
- name: Setup Dart SDK
130+
uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
131+
with:
132+
sdk: "2.19.0"
133+
- id: checkout
134+
name: Checkout repository
135+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
136+
- id: json_annotation_pub_upgrade
137+
name: json_annotation; dart pub upgrade
138+
run: dart pub upgrade
139+
if: "always() && steps.checkout.conclusion == 'success'"
140+
working-directory: json_annotation
141+
- name: json_annotation; dart analyze
142+
run: dart analyze
143+
if: "always() && steps.json_annotation_pub_upgrade.conclusion == 'success'"
144+
working-directory: json_annotation
145+
job_004:
129146
name: "analyzer_and_format; Dart dev; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; `dart format --output=none --set-exit-if-changed .`, `dart analyze --fatal-infos .`"
130147
runs-on: ubuntu-latest
131148
steps:
132149
- name: Cache Pub hosted dependencies
133150
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0
134151
with:
135152
path: "~/.pub-cache/hosted"
136-
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:format-analyze"
153+
key: "os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:format-analyze_0"
137154
restore-keys: |
138155
os:ubuntu-latest;pub-cache-hosted;sdk:dev;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable
139156
os:ubuntu-latest;pub-cache-hosted;sdk:dev
@@ -211,7 +228,7 @@ jobs:
211228
run: dart analyze --fatal-infos .
212229
if: "always() && steps.json_serializable_pub_upgrade.conclusion == 'success'"
213230
working-directory: json_serializable
214-
job_004:
231+
job_005:
215232
name: "unit_test; Dart 2.19.0; PKGS: _test_yaml, checked_yaml, example, json_serializable; `dart test`"
216233
runs-on: ubuntu-latest
217234
steps:
@@ -272,7 +289,8 @@ jobs:
272289
- job_001
273290
- job_002
274291
- job_003
275-
job_005:
292+
- job_004
293+
job_006:
276294
name: "unit_test; Dart 2.19.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/annotation_version_test.dart`"
277295
runs-on: ubuntu-latest
278296
steps:
@@ -306,7 +324,8 @@ jobs:
306324
- job_001
307325
- job_002
308326
- job_003
309-
job_006:
327+
- job_004
328+
job_007:
310329
name: "unit_test; Dart 2.19.0; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
311330
runs-on: ubuntu-latest
312331
steps:
@@ -340,7 +359,8 @@ jobs:
340359
- job_001
341360
- job_002
342361
- job_003
343-
job_007:
362+
- job_004
363+
job_008:
344364
name: "unit_test; Dart 2.19.0; PKG: json_serializable; `dart test -p chrome`"
345365
runs-on: ubuntu-latest
346366
steps:
@@ -374,7 +394,8 @@ jobs:
374394
- job_001
375395
- job_002
376396
- job_003
377-
job_008:
397+
- job_004
398+
job_009:
378399
name: "unit_test; Dart dev; PKGS: _test_yaml, checked_yaml, example, json_serializable; `dart test`"
379400
runs-on: ubuntu-latest
380401
steps:
@@ -435,7 +456,8 @@ jobs:
435456
- job_001
436457
- job_002
437458
- job_003
438-
job_009:
459+
- job_004
460+
job_010:
439461
name: "unit_test; Dart dev; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/annotation_version_test.dart`"
440462
runs-on: ubuntu-latest
441463
steps:
@@ -469,7 +491,8 @@ jobs:
469491
- job_001
470492
- job_002
471493
- job_003
472-
job_010:
494+
- job_004
495+
job_011:
473496
name: "unit_test; Dart dev; PKG: json_serializable; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
474497
runs-on: ubuntu-latest
475498
steps:
@@ -503,7 +526,8 @@ jobs:
503526
- job_001
504527
- job_002
505528
- job_003
506-
job_011:
529+
- job_004
530+
job_012:
507531
name: "unit_test; Dart dev; PKG: json_serializable; `dart test -p chrome`"
508532
runs-on: ubuntu-latest
509533
steps:
@@ -537,7 +561,8 @@ jobs:
537561
- job_001
538562
- job_002
539563
- job_003
540-
job_012:
564+
- job_004
565+
job_013:
541566
name: "ensure_build; Dart 2.19.0; PKGS: _test_yaml, checked_yaml, example; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
542567
runs-on: ubuntu-latest
543568
steps:
@@ -597,7 +622,8 @@ jobs:
597622
- job_009
598623
- job_010
599624
- job_011
600-
job_013:
625+
- job_012
626+
job_014:
601627
name: "ensure_build; Dart dev; PKGS: _test_yaml, checked_yaml, example; `dart test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
602628
runs-on: ubuntu-latest
603629
steps:
@@ -657,3 +683,4 @@ jobs:
657683
- job_009
658684
- job_010
659685
- job_011
686+
- job_012

json_annotation/lib/src/checked_helpers.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ T $checkedCreate<T>(
1717
S Function(Object?), {
1818
Object? Function(Map, String)? readValue,
1919
}),
20-
)
21-
constructor, {
20+
) constructor, {
2221
Map<String, String> fieldKeyMap = const {},
2322
}) {
2423
Q checkedConvert<Q>(

json_annotation/mono_pkg.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# See https://github.com/google/mono_repo.dart for details on this file
2-
sdk:
3-
- pubspec
4-
- dev
5-
62
stages:
73
- analyzer_and_format:
84
- group:
95
- format
106
- analyze: --fatal-infos .
7+
sdk: dev
8+
- group:
9+
- analyze
10+
sdk: pubspec

tool/ci.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,14 @@ for PKG in ${PKGS}; do
6767
echo
6868
echo -e "\033[1mPKG: ${PKG}; TASK: ${TASK}\033[22m"
6969
case ${TASK} in
70-
analyze)
70+
analyze_0)
7171
echo 'dart analyze --fatal-infos .'
7272
dart analyze --fatal-infos . || EXIT_CODE=$?
7373
;;
74+
analyze_1)
75+
echo 'dart analyze'
76+
dart analyze || EXIT_CODE=$?
77+
;;
7478
format)
7579
echo 'dart format --output=none --set-exit-if-changed .'
7680
dart format --output=none --set-exit-if-changed . || EXIT_CODE=$?

0 commit comments

Comments
 (0)