Skip to content

Commit 6b5cfd6

Browse files
authored
Support null safety (#740)
Fixes #712
1 parent d7099dc commit 6b5cfd6

File tree

175 files changed

+17783
-6905
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+17783
-6905
lines changed

.github/workflows/dart.yml

Lines changed: 47 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ jobs:
3636
- run: pub global activate mono_repo 3.3.0
3737
- run: pub global run mono_repo generate --validate
3838
job_002:
39-
name: "OS: linux; SDK: dev; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; TASKS: [`dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-warnings --fatal-infos .`]"
39+
name: "OS: linux; SDK: dev; PKGS: _test_yaml, checked_yaml, json_annotation, json_serializable; TASKS: [`dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-warnings --fatal-infos .`]"
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: Cache Pub hosted dependencies
4343
uses: actions/cache@v2
4444
with:
4545
path: "~/.pub-cache/hosted"
46-
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:dartfmt-dartanalyzer_0"
46+
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:_test_yaml-checked_yaml-json_annotation-json_serializable;commands:dartfmt-dartanalyzer_0"
4747
restore-keys: |
48-
os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable
48+
os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:_test_yaml-checked_yaml-json_annotation-json_serializable
4949
os:ubuntu-latest;pub-cache-hosted;dart:dev
5050
os:ubuntu-latest;pub-cache-hosted
5151
os:ubuntu-latest
@@ -55,20 +55,20 @@ jobs:
5555
- run: dart --version
5656
- uses: actions/checkout@v2
5757
- env:
58-
PKGS: _test_yaml checked_yaml example json_annotation json_serializable
58+
PKGS: _test_yaml checked_yaml json_annotation json_serializable
5959
TRAVIS_OS_NAME: linux
6060
run: tool/ci.sh dartfmt dartanalyzer_0
61-
job_003:
62-
name: "OS: linux; SDK: 2.7.0; PKGS: _test_yaml, checked_yaml, example, json_annotation, json_serializable; TASKS: `dartanalyzer --fatal-warnings .`"
61+
job_005:
62+
name: "OS: linux; SDK: 2.7.0; PKG: checked_yaml; TASKS: `dartanalyzer --fatal-warnings .`"
6363
runs-on: ubuntu-latest
6464
steps:
6565
- name: Cache Pub hosted dependencies
6666
uses: actions/cache@v2
6767
with:
6868
path: "~/.pub-cache/hosted"
69-
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable;commands:dartanalyzer_1"
69+
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:checked_yaml;commands:dartanalyzer_1"
7070
restore-keys: |
71-
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:_test_yaml-checked_yaml-example-json_annotation-json_serializable
71+
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:checked_yaml
7272
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0
7373
os:ubuntu-latest;pub-cache-hosted
7474
os:ubuntu-latest
@@ -79,38 +79,33 @@ jobs:
7979
- run: dart --version
8080
- uses: actions/checkout@v2
8181
- env:
82-
PKGS: _test_yaml checked_yaml example json_annotation json_serializable
82+
PKGS: checked_yaml
8383
TRAVIS_OS_NAME: linux
8484
run: tool/ci.sh dartanalyzer_1
85-
job_004:
86-
name: "OS: linux; SDK: 2.7.0; PKGS: _test_yaml, checked_yaml, example, json_serializable; TASKS: `pub run test`"
85+
job_008:
86+
name: "OS: linux; SDK: dev; PKG: example; TASKS: [`dartfmt -n --set-exit-if-changed .`, `dartanalyzer --fatal-warnings .`]"
8787
runs-on: ubuntu-latest
8888
steps:
8989
- name: Cache Pub hosted dependencies
9090
uses: actions/cache@v2
9191
with:
9292
path: "~/.pub-cache/hosted"
93-
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_0"
93+
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:example;commands:dartfmt-dartanalyzer_1"
9494
restore-keys: |
95-
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:_test_yaml-checked_yaml-example-json_serializable
96-
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0
95+
os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:example
96+
os:ubuntu-latest;pub-cache-hosted;dart:dev
9797
os:ubuntu-latest;pub-cache-hosted
9898
os:ubuntu-latest
9999
- uses: cedx/setup-dart@v2
100100
with:
101-
release-channel: stable
102-
version: "2.7.0"
101+
release-channel: dev
103102
- run: dart --version
104103
- uses: actions/checkout@v2
105104
- env:
106-
PKGS: _test_yaml checked_yaml example json_serializable
105+
PKGS: example
107106
TRAVIS_OS_NAME: linux
108-
run: tool/ci.sh test_0
109-
needs:
110-
- job_001
111-
- job_002
112-
- job_003
113-
job_005:
107+
run: tool/ci.sh dartfmt dartanalyzer_1
108+
job_003:
114109
name: "OS: linux; SDK: dev; PKGS: _test_yaml, checked_yaml, example, json_serializable; TASKS: `pub run test`"
115110
runs-on: ubuntu-latest
116111
steps:
@@ -136,18 +131,19 @@ jobs:
136131
needs:
137132
- job_001
138133
- job_002
139-
- job_003
140-
job_008:
141-
name: "OS: linux; SDK: 2.7.0; PKG: json_serializable; TASKS: `pub run test -p chrome`"
134+
- job_005
135+
- job_008
136+
job_006:
137+
name: "OS: linux; SDK: 2.7.0; PKG: checked_yaml; TASKS: `pub run test`"
142138
runs-on: ubuntu-latest
143139
steps:
144140
- name: Cache Pub hosted dependencies
145141
uses: actions/cache@v2
146142
with:
147143
path: "~/.pub-cache/hosted"
148-
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:json_serializable;commands:test_2"
144+
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:checked_yaml;commands:test_0"
149145
restore-keys: |
150-
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:json_serializable
146+
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:checked_yaml
151147
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0
152148
os:ubuntu-latest;pub-cache-hosted
153149
os:ubuntu-latest
@@ -158,13 +154,14 @@ jobs:
158154
- run: dart --version
159155
- uses: actions/checkout@v2
160156
- env:
161-
PKGS: json_serializable
157+
PKGS: checked_yaml
162158
TRAVIS_OS_NAME: linux
163-
run: tool/ci.sh test_2
159+
run: tool/ci.sh test_0
164160
needs:
165161
- job_001
166162
- job_002
167-
- job_003
163+
- job_005
164+
- job_008
168165
job_009:
169166
name: "OS: linux; SDK: dev; PKG: json_serializable; TASKS: `pub run test -p chrome`"
170167
runs-on: ubuntu-latest
@@ -191,61 +188,60 @@ jobs:
191188
needs:
192189
- job_001
193190
- job_002
194-
- job_003
195-
job_006:
196-
name: "OS: linux; SDK: 2.7.0; PKGS: _test_yaml, checked_yaml, example, json_serializable; TASKS: `pub run test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
191+
- job_005
192+
- job_008
193+
job_004:
194+
name: "OS: linux; SDK: dev; PKGS: _test_yaml, checked_yaml, example, json_serializable; TASKS: `pub run test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
197195
runs-on: ubuntu-latest
198196
steps:
199197
- name: Cache Pub hosted dependencies
200198
uses: actions/cache@v2
201199
with:
202200
path: "~/.pub-cache/hosted"
203-
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_1"
201+
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_1"
204202
restore-keys: |
205-
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:_test_yaml-checked_yaml-example-json_serializable
206-
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0
203+
os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:_test_yaml-checked_yaml-example-json_serializable
204+
os:ubuntu-latest;pub-cache-hosted;dart:dev
207205
os:ubuntu-latest;pub-cache-hosted
208206
os:ubuntu-latest
209207
- uses: cedx/setup-dart@v2
210208
with:
211-
release-channel: stable
212-
version: "2.7.0"
209+
release-channel: dev
213210
- run: dart --version
214211
- uses: actions/checkout@v2
215212
- env:
216213
PKGS: _test_yaml checked_yaml example json_serializable
217214
TRAVIS_OS_NAME: linux
218215
run: tool/ci.sh test_1
219216
needs:
220-
- job_004
221-
- job_005
222-
- job_008
217+
- job_003
218+
- job_006
223219
- job_009
224220
job_007:
225-
name: "OS: linux; SDK: dev; PKGS: _test_yaml, checked_yaml, example, json_serializable; TASKS: `pub run test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
221+
name: "OS: linux; SDK: 2.7.0; PKG: checked_yaml; TASKS: `pub run test --run-skipped -t presubmit-only test/ensure_build_test.dart`"
226222
runs-on: ubuntu-latest
227223
steps:
228224
- name: Cache Pub hosted dependencies
229225
uses: actions/cache@v2
230226
with:
231227
path: "~/.pub-cache/hosted"
232-
key: "os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:_test_yaml-checked_yaml-example-json_serializable;commands:test_1"
228+
key: "os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:checked_yaml;commands:test_1"
233229
restore-keys: |
234-
os:ubuntu-latest;pub-cache-hosted;dart:dev;packages:_test_yaml-checked_yaml-example-json_serializable
235-
os:ubuntu-latest;pub-cache-hosted;dart:dev
230+
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0;packages:checked_yaml
231+
os:ubuntu-latest;pub-cache-hosted;dart:2.7.0
236232
os:ubuntu-latest;pub-cache-hosted
237233
os:ubuntu-latest
238234
- uses: cedx/setup-dart@v2
239235
with:
240-
release-channel: dev
236+
release-channel: stable
237+
version: "2.7.0"
241238
- run: dart --version
242239
- uses: actions/checkout@v2
243240
- env:
244-
PKGS: _test_yaml checked_yaml example json_serializable
241+
PKGS: checked_yaml
245242
TRAVIS_OS_NAME: linux
246243
run: tool/ci.sh test_1
247244
needs:
248-
- job_004
249-
- job_005
250-
- job_008
245+
- job_003
246+
- job_006
251247
- job_009

_test_yaml/mono_pkg.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# See https://github.com/google/mono_repo.dart for details on this file
22
dart:
3-
- 2.7.0
43
- dev
54

65
stages:
@@ -9,9 +8,6 @@ stages:
98
- dartfmt
109
- dartanalyzer: --fatal-warnings --fatal-infos .
1110
dart: [dev]
12-
- group:
13-
- dartanalyzer: --fatal-warnings .
14-
dart: [2.7.0]
1511
- unit_test:
1612
- test
1713
- ensure_build:

_test_yaml/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: _test_yaml
22
publish_to: none
33

44
environment:
5-
sdk: '>=2.7.0 <3.0.0'
5+
sdk: '>=2.12.0-0 <3.0.0'
66

77
dev_dependencies:
88
build_runner: ^1.0.0

_test_yaml/test/ensure_build_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
// @dart=2.9
6+
57
@TestOn('vm')
68
@Tags(['presubmit-only'])
79
import 'package:build_verify/build_verify.dart';

_test_yaml/test/src/build_config.dart

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:json_annotation/json_annotation.dart';
6-
import 'package:meta/meta.dart';
76

87
part 'build_config.g.dart';
98

@@ -13,9 +12,9 @@ class Config {
1312
final Map<String, Builder> builders;
1413

1514
// Verifying enum keys in map
16-
Map<AutoApply, int> weights;
15+
Map<AutoApply, int>? weights;
1716

18-
Config({@required this.builders});
17+
Config({required this.builders});
1918

2019
factory Config.fromJson(Map map) => _$ConfigFromJson(map);
2120

@@ -28,49 +27,49 @@ class Config {
2827
checked: true,
2928
anyMap: true)
3029
class Builder {
31-
@JsonKey(nullable: true)
32-
final String target;
30+
final String? target;
3331

3432
final String import;
3533

3634
@JsonKey(name: 'is_optional')
37-
final bool isOptional;
35+
final bool? isOptional;
3836

3937
@JsonKey(disallowNullValue: true)
40-
final Uri configLocation;
38+
final Uri? configLocation;
4139

4240
@JsonKey(name: 'auto_apply', disallowNullValue: true)
43-
final AutoApply autoApply;
41+
final AutoApply? autoApply;
4442

4543
@JsonKey(name: 'build_to')
46-
final BuildTo buildTo;
44+
final BuildTo? buildTo;
4745

48-
final AutoApply defaultEnumTest;
46+
final AutoApply? defaultEnumTest;
4947

50-
@JsonKey(name: 'builder_factories', nullable: false)
48+
@JsonKey(name: 'builder_factories')
5149
final List<String> builderFactories;
5250

5351
@JsonKey(name: 'applies_builders')
54-
final List<String> appliesBuilders;
52+
final List<String>? appliesBuilders;
5553

5654
@JsonKey(name: 'required_inputs')
57-
final List<String> requiredInputs;
55+
final List<String>? requiredInputs;
5856

5957
@JsonKey(name: 'build_extensions')
60-
final Map<String, List<String>> buildExtensions;
61-
62-
Builder(
63-
{@required this.import,
64-
this.target,
65-
this.isOptional,
66-
this.autoApply,
67-
this.buildTo,
68-
this.defaultEnumTest,
69-
this.builderFactories,
70-
this.appliesBuilders,
71-
this.requiredInputs,
72-
this.buildExtensions,
73-
this.configLocation}) {
58+
final Map<String, List<String>>? buildExtensions;
59+
60+
Builder({
61+
required this.import,
62+
this.target,
63+
this.isOptional,
64+
this.autoApply,
65+
this.buildTo,
66+
this.defaultEnumTest,
67+
required this.builderFactories,
68+
this.appliesBuilders,
69+
this.requiredInputs,
70+
this.buildExtensions,
71+
this.configLocation,
72+
}) {
7473
if (builderFactories.isEmpty) {
7574
throw ArgumentError.value(builderFactories, 'builderFactories',
7675
'Must have at least one value.');

0 commit comments

Comments
 (0)