Skip to content

Commit 9bb544d

Browse files
committed
removed remaining use of sound/weak null safety
1 parent f8b60d9 commit 9bb544d

File tree

7 files changed

+73
-133
lines changed

7 files changed

+73
-133
lines changed

dwds/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- Replace deprecated JS code `this.__proto__` with `Object.getPrototypeOf(this)`. - [#2500](https://github.com/dart-lang/webdev/pull/2500)
44
- Migrate injected client code to `package:web`. - [#2491](https://github.com/dart-lang/webdev/pull/2491)
5-
- Deprecated MetadataProvider's & CompilerOptions' soundNullSafety. - [#2427](https://github.com/dart-lang/webdev/issues/2427)
5+
- Deprecated MetadataProvider's, CompilerOptions' & SdkConfiguration's soundNullSafety. - [#2427](https://github.com/dart-lang/webdev/issues/2427)
66

77
## 24.1.0
88

frontend_server_common/lib/src/devfs.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,13 @@ class WebDevFS {
192192
fileSystem.file(sdkLayout.ddcModuleLoaderJsPath);
193193
File get requireJS => fileSystem.file(sdkLayout.requireJsPath);
194194
File get dartSdk => fileSystem.file(switch (ddcModuleFormat) {
195-
ModuleFormat.amd => sdkLayout.soundAmdJsPath,
196-
ModuleFormat.ddc => sdkLayout.soundDdcJsPath,
195+
ModuleFormat.amd => sdkLayout.amdJsPath,
196+
ModuleFormat.ddc => sdkLayout.ddcJsPath,
197197
_ => throw Exception('Unsupported DDC module format $ddcModuleFormat.')
198198
});
199199
File get dartSdkSourcemap => fileSystem.file(switch (ddcModuleFormat) {
200-
ModuleFormat.amd => sdkLayout.soundAmdJsMapPath,
201-
ModuleFormat.ddc => sdkLayout.soundDdcJsMapPath,
200+
ModuleFormat.amd => sdkLayout.amdJsMapPath,
201+
ModuleFormat.ddc => sdkLayout.ddcJsMapPath,
202202
_ => throw Exception('Unsupported DDC module format $ddcModuleFormat.')
203203
});
204204
File get stackTraceMapper => fileSystem.file(sdkLayout.stackTraceMapperPath);

frontend_server_common/lib/src/resident_runner.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class ResidentWebRunner {
3333
required this.sdkLayout,
3434
bool verbose = false,
3535
}) {
36-
final platformDillUri = Uri.file(sdkLayout.soundSummaryPath);
36+
final platformDillUri = Uri.file(sdkLayout.summaryPath);
3737

3838
generator = ResidentCompiler(
3939
sdkLayout.sdkDirectory,

test_common/lib/sdk_asset_generator.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import 'package:test_common/test_sdk_layout.dart';
1111
/// Generates sdk.js, sdk.map, sdk full dill, and sdk summary files.
1212
///
1313
/// Generates following missing assets if needed:
14-
/// - sound null safety: js, source map, full dill.
15-
/// - weak null safety: js, source map, full dill, summary.
14+
/// - js, source map, full dill.
15+
1616
class SdkAssetGenerator {
1717
bool _sdkAssetsGenerated = false;
1818
final _logger = Logger('SdkAssetGenerator');
@@ -57,26 +57,26 @@ class SdkAssetGenerator {
5757
required bool canaryFeatures,
5858
}) =>
5959
switch (ddcModuleFormat) {
60-
ModuleFormat.amd => sdkLayout.soundAmdJsPath,
61-
ModuleFormat.ddc => sdkLayout.soundDdcJsPath,
60+
ModuleFormat.amd => sdkLayout.amdJsPath,
61+
ModuleFormat.ddc => sdkLayout.ddcJsPath,
6262
_ => throw Exception('Unsupported DDC module format $ddcModuleFormat.')
6363
};
6464

6565
String resolveSdkSourcemapPath({
6666
required bool canaryFeatures,
6767
}) =>
6868
switch (ddcModuleFormat) {
69-
ModuleFormat.amd => sdkLayout.soundAmdJsMapPath,
70-
ModuleFormat.ddc => sdkLayout.soundDdcJsMapPath,
69+
ModuleFormat.amd => sdkLayout.amdJsMapPath,
70+
ModuleFormat.ddc => sdkLayout.ddcJsMapPath,
7171
_ => throw Exception('Unsupported DDC module format $ddcModuleFormat.')
7272
};
7373

7474
String resolveSdkJsFilename({
7575
required bool canaryFeatures,
7676
}) =>
7777
switch (ddcModuleFormat) {
78-
ModuleFormat.amd => sdkLayout.soundAmdJsFileName,
79-
ModuleFormat.ddc => sdkLayout.soundDdcJsFileName,
78+
ModuleFormat.amd => sdkLayout.amdJsFileName,
79+
ModuleFormat.ddc => sdkLayout.ddcJsFileName,
8080
_ => throw Exception('Unsupported DDC module format $ddcModuleFormat.')
8181
};
8282

@@ -89,7 +89,7 @@ class SdkAssetGenerator {
8989
final outputJsPath = resolveSdkJsPath(canaryFeatures: canaryFeatures);
9090
final outputJsMapPath =
9191
resolveSdkSourcemapPath(canaryFeatures: canaryFeatures);
92-
final outputFullDillPath = sdkLayout.soundFullDillPath;
92+
final outputFullDillPath = sdkLayout.fullDillPath;
9393

9494
final hasJsAsset = _exists(outputJsPath);
9595
final hasJsMapAsset = _exists(outputJsMapPath);
@@ -180,7 +180,7 @@ class SdkAssetGenerator {
180180
Directory? outputDir;
181181
try {
182182
// Files to copy generated files to.
183-
final outputSummaryPath = sdkLayout.soundSummaryPath;
183+
final outputSummaryPath = sdkLayout.summaryPath;
184184
final hasAssets = _exists(outputSummaryPath);
185185

186186
// Files already exist.
@@ -189,7 +189,7 @@ class SdkAssetGenerator {
189189
// Generate missing files.
190190
outputDir = fileSystem.systemTempDirectory.createTempSync();
191191
final summaryPath =
192-
p.join(outputDir.path, sdkLayout.soundSummaryFileName);
192+
p.join(outputDir.path, sdkLayout.summaryFileName);
193193

194194
_logger.info('Generating SDK summary files...');
195195

test_common/lib/test_sdk_configuration.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ import 'package:test_common/test_sdk_layout.dart';
1414
/// Implementation for SDK configuration for tests that can generate
1515
/// missing assets.
1616
///
17-
/// - Generate SDK js, source map, and full dill for weak and sound
18-
/// modes (normally included in flutter SDK or produced by build).
19-
/// - Need to generate SDK summary for weak null safety mode as it
20-
/// is not provided by the SDK installation.
17+
/// - Generate SDK js, source map, and full dill (normally included in flutter
18+
/// SDK or produced by build).
2119
///
2220
/// TODO(annagrin): update to only generating missing sound artifacts
2321
/// for frontend server after we have no uses of weak null safety.

test_common/test/sdk_asset_generator_test.dart

Lines changed: 41 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,16 @@ void main() {
2020

2121
late Directory tempDir;
2222
late String sdkDirectory;
23-
late String soundSdkSummaryPath;
23+
late String sdkSummaryPath;
2424
late String compilerWorkerPath;
2525

26-
// Missing sound assets
27-
late String soundSdkFullDillPath;
28-
late String soundAmdSdkJsPath;
29-
late String soundAmdSdkJsMapPath;
30-
late String soundDdcSdkJsPath;
31-
late String soundDdcSdkJsMapPath;
32-
33-
// Missing weak assets
34-
late String weakSdkSummaryPath;
35-
late String weakSdkFullDillPath;
36-
late String weakAmdSdkJsPath;
37-
late String weakAmdSdkJsMapPath;
38-
late String weakDdcSdkJsPath;
39-
late String weakDdcSdkJsMapPath;
26+
// Missing assets
27+
late String sdkFullDillPath;
28+
late String amdSdkJsPath;
29+
late String amdSdkJsMapPath;
30+
late String ddcSdkJsPath;
31+
late String ddcSdkJsMapPath;
32+
4033

4134
setUp(() async {
4235
setCurrentLogWriter(debug: debug);
@@ -45,39 +38,24 @@ void main() {
4538
sdkDirectory = tempDir.path;
4639
final copySdkLayout = TestSdkLayout.createDefault(sdkDirectory);
4740

48-
soundSdkSummaryPath = copySdkLayout.soundSummaryPath;
41+
sdkSummaryPath = copySdkLayout.summaryPath;
4942
compilerWorkerPath = copySdkLayout.dartdevcSnapshotPath;
5043

5144
// Copy the SDK directory into a temp directory.
5245
await copyDirectory(TestSdkLayout.defaultSdkDirectory, sdkDirectory);
5346

54-
// Simulate missing sound assets.
55-
soundSdkFullDillPath = copySdkLayout.soundFullDillPath;
56-
soundAmdSdkJsPath = copySdkLayout.soundAmdJsPath;
57-
soundAmdSdkJsMapPath = copySdkLayout.soundAmdJsMapPath;
58-
soundDdcSdkJsPath = copySdkLayout.soundDdcJsPath;
59-
soundDdcSdkJsMapPath = copySdkLayout.soundDdcJsMapPath;
60-
61-
_deleteIfExists(soundSdkFullDillPath);
62-
_deleteIfExists(soundAmdSdkJsPath);
63-
_deleteIfExists(soundAmdSdkJsMapPath);
64-
_deleteIfExists(soundDdcSdkJsPath);
65-
_deleteIfExists(soundDdcSdkJsMapPath);
66-
67-
// Simulate missing weak assets.
68-
weakSdkSummaryPath = copySdkLayout.weakSummaryPath;
69-
weakSdkFullDillPath = copySdkLayout.weakFullDillPath;
70-
weakAmdSdkJsPath = copySdkLayout.weakAmdJsPath;
71-
weakAmdSdkJsMapPath = copySdkLayout.weakAmdJsMapPath;
72-
weakDdcSdkJsPath = copySdkLayout.weakDdcJsPath;
73-
weakDdcSdkJsMapPath = copySdkLayout.weakDdcJsMapPath;
74-
75-
_deleteIfExists(weakSdkSummaryPath);
76-
_deleteIfExists(weakSdkFullDillPath);
77-
_deleteIfExists(weakAmdSdkJsPath);
78-
_deleteIfExists(weakAmdSdkJsMapPath);
79-
_deleteIfExists(weakDdcSdkJsPath);
80-
_deleteIfExists(weakDdcSdkJsMapPath);
47+
// Simulate missing assets.
48+
sdkFullDillPath = copySdkLayout.fullDillPath;
49+
amdSdkJsPath = copySdkLayout.amdJsPath;
50+
amdSdkJsMapPath = copySdkLayout.amdJsMapPath;
51+
ddcSdkJsPath = copySdkLayout.ddcJsPath;
52+
ddcSdkJsMapPath = copySdkLayout.ddcJsMapPath;
53+
54+
_deleteIfExists(sdkFullDillPath);
55+
_deleteIfExists(amdSdkJsPath);
56+
_deleteIfExists(amdSdkJsMapPath);
57+
_deleteIfExists(ddcSdkJsPath);
58+
_deleteIfExists(ddcSdkJsMapPath);
8159
});
8260

8361
tearDown(() {
@@ -102,30 +80,20 @@ void main() {
10280
expect(configuration.sdkDirectory, equals(sdkDirectory));
10381
expect(configuration.compilerWorkerPath, equals(compilerWorkerPath));
10482

105-
expect(sdkLayout.soundSummaryPath, equals(soundSdkSummaryPath));
106-
expect(sdkLayout.soundFullDillPath, equals(soundSdkFullDillPath));
107-
expect(sdkLayout.soundAmdJsPath, equals(soundAmdSdkJsPath));
108-
expect(sdkLayout.soundAmdJsMapPath, equals(soundAmdSdkJsMapPath));
109-
110-
expect(sdkLayout.weakSummaryPath, equals(weakSdkSummaryPath));
111-
expect(sdkLayout.weakFullDillPath, equals(weakSdkFullDillPath));
112-
expect(sdkLayout.weakAmdJsPath, equals(weakAmdSdkJsPath));
113-
expect(sdkLayout.weakAmdJsMapPath, equals(weakAmdSdkJsMapPath));
83+
expect(sdkLayout.summaryPath, equals(sdkSummaryPath));
84+
expect(sdkLayout.fullDillPath, equals(sdkFullDillPath));
85+
expect(sdkLayout.amdJsPath, equals(amdSdkJsPath));
86+
expect(sdkLayout.amdJsMapPath, equals(amdSdkJsMapPath));
11487

11588
// Validate that configuration files exist.
11689
configuration.validateSdkDir();
11790
configuration.validate();
11891

11992
// Validate all assets exist.
120-
expect(sdkLayout.soundSummaryPath, _exists);
121-
expect(sdkLayout.soundFullDillPath, _exists);
122-
expect(sdkLayout.soundAmdJsPath, _exists);
123-
expect(sdkLayout.soundAmdJsMapPath, _exists);
124-
125-
expect(sdkLayout.weakSummaryPath, _exists);
126-
expect(sdkLayout.weakFullDillPath, _exists);
127-
expect(sdkLayout.weakAmdJsPath, _exists);
128-
expect(sdkLayout.weakAmdJsMapPath, _exists);
93+
expect(sdkLayout.summaryPath, _exists);
94+
expect(sdkLayout.fullDillPath, _exists);
95+
expect(sdkLayout.amdJsPath, _exists);
96+
expect(sdkLayout.amdJsMapPath, _exists);
12997
});
13098

13199
test(
@@ -146,30 +114,20 @@ void main() {
146114
expect(configuration.sdkDirectory, equals(sdkDirectory));
147115
expect(configuration.compilerWorkerPath, equals(compilerWorkerPath));
148116

149-
expect(sdkLayout.soundSummaryPath, equals(soundSdkSummaryPath));
150-
expect(sdkLayout.soundFullDillPath, equals(soundSdkFullDillPath));
151-
expect(sdkLayout.soundDdcJsPath, equals(soundDdcSdkJsPath));
152-
expect(sdkLayout.soundDdcJsMapPath, equals(soundDdcSdkJsMapPath));
153-
154-
expect(sdkLayout.weakSummaryPath, equals(weakSdkSummaryPath));
155-
expect(sdkLayout.weakFullDillPath, equals(weakSdkFullDillPath));
156-
expect(sdkLayout.weakDdcJsPath, equals(weakDdcSdkJsPath));
157-
expect(sdkLayout.weakDdcJsMapPath, equals(weakDdcSdkJsMapPath));
117+
expect(sdkLayout.summaryPath, equals(sdkSummaryPath));
118+
expect(sdkLayout.fullDillPath, equals(sdkFullDillPath));
119+
expect(sdkLayout.ddcJsPath, equals(ddcSdkJsPath));
120+
expect(sdkLayout.ddcJsMapPath, equals(ddcSdkJsMapPath));
158121

159122
// Validate that configuration files exist.
160123
configuration.validateSdkDir();
161124
configuration.validate();
162125

163126
// Validate all assets exist.
164-
expect(sdkLayout.soundSummaryPath, _exists);
165-
expect(sdkLayout.soundFullDillPath, _exists);
166-
expect(sdkLayout.soundDdcJsPath, _exists);
167-
expect(sdkLayout.soundDdcJsMapPath, _exists);
168-
169-
expect(sdkLayout.weakSummaryPath, _exists);
170-
expect(sdkLayout.weakFullDillPath, _exists);
171-
expect(sdkLayout.weakDdcJsPath, _exists);
172-
expect(sdkLayout.weakDdcJsMapPath, _exists);
127+
expect(sdkLayout.summaryPath, _exists);
128+
expect(sdkLayout.fullDillPath, _exists);
129+
expect(sdkLayout.ddcJsPath, _exists);
130+
expect(sdkLayout.ddcJsMapPath, _exists);
173131
});
174132

175133
test('Can generate missing SDK assets with canary features enabled',
@@ -184,11 +142,8 @@ void main() {
184142
);
185143
await assetGenerator.generateSdkAssets();
186144

187-
final soundSdk = File(soundAmdSdkJsPath).readAsStringSync();
188-
expect(soundSdk, contains('canary'));
189-
190-
final weakSdk = File(weakAmdSdkJsPath).readAsStringSync();
191-
expect(weakSdk, contains('canary'));
145+
final sdk = File(amdSdkJsPath).readAsStringSync();
146+
expect(sdk, contains('canary'));
192147
});
193148

194149
test(
@@ -204,11 +159,8 @@ void main() {
204159
);
205160
await assetGenerator.generateSdkAssets();
206161

207-
final soundSdk = File(soundDdcSdkJsPath).readAsStringSync();
208-
expect(soundSdk, contains('canary'));
209-
210-
final weakSdk = File(weakDdcSdkJsPath).readAsStringSync();
211-
expect(weakSdk, contains('canary'));
162+
final sdk = File(ddcSdkJsPath).readAsStringSync();
163+
expect(sdk, contains('canary'));
212164
});
213165
});
214166
}

test_common/test/test_sdk_configuration_test.dart

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ void main() {
2424
test('Creates and deletes SDK directory copy', () async {
2525
final provider = TestSdkConfigurationProvider(verbose: debug);
2626
final sdkDirectory = provider.sdkLayout.sdkDirectory;
27-
final weakSdkSummary = provider.sdkLayout.weakSummaryPath;
27+
final sdkSummary = provider.sdkLayout.summaryPath;
2828
try {
2929
expect(sdkDirectory, _directoryExists,
3030
reason: 'SDK directory should be created');
31-
expect(weakSdkSummary, isNot(_fileExists),
32-
reason: 'Weak SDK summary should not be generated yet.');
31+
expect(sdkSummary, isNot(_fileExists),
32+
reason: 'SDK summary should not be generated yet.');
3333

3434
await provider.configuration;
35-
expect(weakSdkSummary, _fileExists,
36-
reason: 'Weak SDK summary should be generated');
35+
expect(sdkSummary, _fileExists,
36+
reason: 'SDK summary should be generated');
3737
} finally {
3838
provider.dispose();
3939
expect(sdkDirectory, isNot(_directoryExists),
@@ -59,15 +59,10 @@ void main() {
5959
final sdkLayout = provider.sdkLayout;
6060

6161
expect(sdkLayout.sdkDirectory, _directoryExists);
62-
expect(sdkLayout.soundDdcJsPath, _fileExists);
63-
expect(sdkLayout.soundDdcJsMapPath, _fileExists);
64-
expect(sdkLayout.soundSummaryPath, _fileExists);
65-
expect(sdkLayout.soundFullDillPath, _fileExists);
66-
67-
expect(sdkLayout.weakDdcJsPath, _fileExists);
68-
expect(sdkLayout.weakDdcJsMapPath, _fileExists);
69-
expect(sdkLayout.weakSummaryPath, _fileExists);
70-
expect(sdkLayout.weakFullDillPath, _fileExists);
62+
expect(sdkLayout.ddcJsPath, _fileExists);
63+
expect(sdkLayout.ddcJsMapPath, _fileExists);
64+
expect(sdkLayout.summaryPath, _fileExists);
65+
expect(sdkLayout.fullDillPath, _fileExists);
7166

7267
expect(sdkLayout.ddcModuleLoaderJsPath, _fileExists);
7368
expect(sdkLayout.stackTraceMapperPath, _fileExists);
@@ -96,15 +91,10 @@ void main() {
9691
final sdkLayout = provider.sdkLayout;
9792

9893
expect(sdkLayout.sdkDirectory, _directoryExists);
99-
expect(sdkLayout.soundAmdJsPath, _fileExists);
100-
expect(sdkLayout.soundAmdJsMapPath, _fileExists);
101-
expect(sdkLayout.soundSummaryPath, _fileExists);
102-
expect(sdkLayout.soundFullDillPath, _fileExists);
103-
104-
expect(sdkLayout.weakAmdJsPath, _fileExists);
105-
expect(sdkLayout.weakAmdJsMapPath, _fileExists);
106-
expect(sdkLayout.weakSummaryPath, _fileExists);
107-
expect(sdkLayout.weakFullDillPath, _fileExists);
94+
expect(sdkLayout.amdJsPath, _fileExists);
95+
expect(sdkLayout.amdJsMapPath, _fileExists);
96+
expect(sdkLayout.summaryPath, _fileExists);
97+
expect(sdkLayout.fullDillPath, _fileExists);
10898

10999
expect(sdkLayout.requireJsPath, _fileExists);
110100
expect(sdkLayout.stackTraceMapperPath, _fileExists);

0 commit comments

Comments
 (0)