Skip to content

Commit cdce2ba

Browse files
author
Anna Gringauze
committed
Keep only changes related to SDK paths update
1 parent fe4a795 commit cdce2ba

File tree

62 files changed

+1547
-1743
lines changed

Some content is hidden

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

62 files changed

+1547
-1743
lines changed

dwds/CHANGELOG.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
- Include an optional param to `Dwds.start` to indicate whether it a Flutter
2525
app or not.
2626
- Remove deprecated `ChromeProxyService.setExceptionPauseMode()`.
27-
- Refactor `SdkConfiguration`:
28-
- Constructor now takes `SdkLayout` as a parameter.
29-
- Rename `SdkConfiguration.unsoundSdkSummaryPath` with
30-
`SdkConfiguration.weakSummaryPath`.
31-
- Rename `SdkConfiguration.soundSdkSummaryPath` with
32-
`SdkConfiguration.soundSummaryPath`.
3327
- Support dart 3.0-alpha breaking changes:
3428
- Generate missing SDK assets for tests.
3529
- Enable frontend server null safe tests.

dwds/debug_extension/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: >-
66
A chrome extension for Dart debugging.
77
88
environment:
9-
sdk: '>=2.12.0 <3.0.0'
9+
sdk: '>=3.0.0-134.0.dev <3.0.0'
1010

1111
dependencies:
1212
async: ^2.3.0

dwds/debug_extension_mv3/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: >-
66
A Chrome extension for Dart debugging.
77
88
environment:
9-
sdk: '>=2.18.0 <3.0.0'
9+
sdk: '>=3.0.0-134.0.dev <3.0.0'
1010

1111
dependencies:
1212
built_value: ^8.3.0

dwds/lib/dwds.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@ export 'src/services/expression_compiler.dart'
2929
export 'src/services/expression_compiler_service.dart'
3030
show ExpressionCompilerService;
3131
export 'src/utilities/sdk_configuration.dart'
32-
show SdkConfiguration, SdkConfigurationProvider;
33-
export 'src/utilities/sdk_layout.dart' show SdkLayout;
32+
show SdkLayout, SdkConfiguration, SdkConfigurationProvider;

dwds/lib/sdk_configuration.dart

Lines changed: 0 additions & 6 deletions
This file was deleted.

dwds/lib/src/injected/client.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dwds/lib/src/services/expression_compiler_service.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class _Compiler {
7676
final librariesUri = sdkConfiguration.librariesUri!;
7777
final workerUri = sdkConfiguration.compilerWorkerUri!;
7878
final sdkSummaryUri = soundNullSafety
79-
? sdkConfiguration.soundSummaryUri!
80-
: sdkConfiguration.weakSummaryUri!;
79+
? sdkConfiguration.soundSdkSummaryUri!
80+
: sdkConfiguration.weakSdkSummaryUri!;
8181

8282
final args = [
8383
'--experimental-expression-compiler',

dwds/lib/src/utilities/sdk_configuration.dart

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

55
import 'dart:async';
6+
import 'dart:io';
67

78
import 'package:file/file.dart';
89
import 'package:file/local.dart';
910
import 'package:path/path.dart' as p;
1011

11-
import 'sdk_layout.dart';
12-
1312
class InvalidSdkConfigurationException implements Exception {
1413
final String? message;
1514

@@ -33,36 +32,164 @@ abstract class SdkConfigurationProvider {
3332
Future<SdkConfiguration> get configuration;
3433
}
3534

36-
/// SDK configuration.
35+
/// Sdk layout.
36+
///
37+
/// Contains definition of the default SDK layout.
38+
/// We keep all the path constants in one place for ease of update.
39+
class SdkLayout {
40+
static final sdkDir = p.dirname(p.dirname(Platform.resolvedExecutable));
41+
static final defaultSdkLayout = createDefault(sdkDir);
42+
43+
static SdkLayout createDefault(String sdkDirectory) {
44+
final sdkJsWeakFileName = 'dart_sdk.js';
45+
final sdkJsMapWeakFileName = 'dart_sdk.js.map';
46+
final sdkJsSoundFileName = 'dart_sdk_sound.js';
47+
final sdkJsMapSoundFileName = 'dart_sdk_sound.js.map';
48+
final sdkSummarySoundFileName = 'ddc_outline.dill';
49+
final sdkSummaryWeakFileName = 'ddc_outline_unsound.dill';
50+
final sdkFullDillSoundFileName = 'ddc_platform.dill';
51+
final sdkFullDillWeakFileName = 'ddc_platform_unsound.dill';
52+
53+
final sdkSummaryDirectory = p.join(sdkDirectory, 'lib', '_internal');
54+
final sdkJsDirectory =
55+
p.join(sdkDirectory, 'lib', 'dev_compiler', 'kernel', 'amd');
56+
57+
final soundSummaryPath =
58+
p.join(sdkSummaryDirectory, sdkSummarySoundFileName);
59+
final soundFullDillPath =
60+
p.join(sdkSummaryDirectory, sdkFullDillSoundFileName);
61+
final soundJsPath = p.join(sdkJsDirectory, sdkJsSoundFileName);
62+
final soundJsMapPath = p.join(sdkJsDirectory, sdkJsMapSoundFileName);
63+
64+
final weakSummaryPath = p.join(sdkSummaryDirectory, sdkSummaryWeakFileName);
65+
final weakFullDillPath =
66+
p.join(sdkSummaryDirectory, sdkFullDillWeakFileName);
67+
final weakJsPath = p.join(sdkJsDirectory, sdkJsWeakFileName);
68+
final weakJsMapPath = p.join(sdkJsDirectory, sdkJsMapWeakFileName);
69+
70+
final librariesPath = p.join(sdkDirectory, 'lib', 'libraries.json');
71+
final dartdevcSnapshotPath =
72+
p.join(sdkDirectory, 'bin', 'snapshots', 'dartdevc.dart.snapshot');
73+
final kernelWorkerSnapshotPath =
74+
p.join(sdkDirectory, 'bin', 'snapshots', 'kernel_worker.dart.snapshot');
75+
76+
return SdkLayout(
77+
sdkJsWeakFileName: sdkJsWeakFileName,
78+
sdkJsMapWeakFileName: sdkJsMapWeakFileName,
79+
sdkJsSoundFileName: sdkJsSoundFileName,
80+
sdkJsMapSoundFileName: sdkJsMapSoundFileName,
81+
sdkSummarySoundFileName: sdkSummarySoundFileName,
82+
sdkSummaryWeakFileName: sdkSummaryWeakFileName,
83+
sdkFullDillSoundFileName: sdkFullDillSoundFileName,
84+
sdkFullDillWeakFileName: sdkFullDillWeakFileName,
85+
sdkDirectory: sdkDirectory,
86+
soundSummaryPath: soundSummaryPath,
87+
soundFullDillPath: soundFullDillPath,
88+
soundJsPath: soundJsPath,
89+
soundJsMapPath: soundJsMapPath,
90+
weakSummaryPath: weakSummaryPath,
91+
weakFullDillPath: weakFullDillPath,
92+
weakJsPath: weakJsPath,
93+
weakJsMapPath: weakJsMapPath,
94+
librariesPath: librariesPath,
95+
dartdevcSnapshotPath: dartdevcSnapshotPath,
96+
kernelWorkerSnapshotPath: kernelWorkerSnapshotPath,
97+
);
98+
}
99+
100+
final String sdkJsWeakFileName;
101+
final String sdkJsMapWeakFileName;
102+
final String sdkJsSoundFileName;
103+
final String sdkJsMapSoundFileName;
104+
final String sdkSummarySoundFileName;
105+
final String sdkSummaryWeakFileName;
106+
final String sdkFullDillSoundFileName;
107+
final String sdkFullDillWeakFileName;
108+
109+
final String sdkDirectory;
110+
111+
final String soundSummaryPath;
112+
final String soundFullDillPath;
113+
final String soundJsPath;
114+
final String soundJsMapPath;
115+
116+
final String weakSummaryPath;
117+
final String weakFullDillPath;
118+
final String weakJsPath;
119+
final String weakJsMapPath;
120+
121+
final String librariesPath;
122+
123+
final String dartdevcSnapshotPath;
124+
final String kernelWorkerSnapshotPath;
125+
126+
SdkLayout({
127+
required this.sdkJsWeakFileName,
128+
required this.sdkJsMapWeakFileName,
129+
required this.sdkJsSoundFileName,
130+
required this.sdkJsMapSoundFileName,
131+
required this.sdkSummarySoundFileName,
132+
required this.sdkSummaryWeakFileName,
133+
required this.sdkFullDillSoundFileName,
134+
required this.sdkFullDillWeakFileName,
135+
required this.sdkDirectory,
136+
required this.soundSummaryPath,
137+
required this.soundFullDillPath,
138+
required this.soundJsPath,
139+
required this.soundJsMapPath,
140+
required this.weakSummaryPath,
141+
required this.weakFullDillPath,
142+
required this.weakJsPath,
143+
required this.weakJsMapPath,
144+
required this.librariesPath,
145+
required this.dartdevcSnapshotPath,
146+
required this.kernelWorkerSnapshotPath,
147+
});
148+
}
149+
150+
/// Data class describing the SDK layout.
37151
///
38152
/// Provides helpers to convert paths to uris that work on all platforms.
39153
///
40154
/// Call [validate] method to make sure the files in the configuration
41155
/// layout exist before reading the files.
42156
class SdkConfiguration {
43157
static final defaultSdkLayout = SdkLayout.defaultSdkLayout;
44-
static final defaultConfiguration = SdkConfiguration(defaultSdkLayout);
158+
static final defaultConfiguration =
159+
SdkConfiguration.fromSdkLayout(defaultSdkLayout);
45160

46-
SdkLayout? sdkLayout;
161+
String? sdkDirectory;
162+
String? weakSdkSummaryPath;
163+
String? soundSdkSummaryPath;
164+
String? librariesPath;
165+
String? compilerWorkerPath;
47166

48-
SdkConfiguration(this.sdkLayout);
167+
SdkConfiguration({
168+
this.sdkDirectory,
169+
this.weakSdkSummaryPath,
170+
this.soundSdkSummaryPath,
171+
this.librariesPath,
172+
this.compilerWorkerPath,
173+
});
49174

50-
SdkConfiguration.empty() : this(null);
175+
SdkConfiguration.empty() : this();
176+
177+
SdkConfiguration.fromSdkLayout(SdkLayout sdkLayout)
178+
: this(
179+
sdkDirectory: sdkLayout.sdkDirectory,
180+
weakSdkSummaryPath: sdkLayout.weakSummaryPath,
181+
soundSdkSummaryPath: sdkLayout.soundSummaryPath,
182+
librariesPath: sdkLayout.librariesPath,
183+
compilerWorkerPath: sdkLayout.dartdevcSnapshotPath,
184+
);
51185

52186
static Uri? _toUri(String? path) => path == null ? null : p.toUri(path);
53187
static Uri? _toAbsoluteUri(String? path) =>
54188
path == null ? null : p.toUri(p.absolute(path));
55189

56-
String get dartPath => sdkLayout!.dartPath;
57-
String? get sdkDirectory => sdkLayout?.sdkDirectory;
58-
String? get soundSummaryPath => sdkLayout?.soundSummaryPath;
59-
String? get weakSummaryPath => sdkLayout?.weakSummaryPath;
60-
String? get librariesPath => sdkLayout?.librariesPath;
61-
String? get compilerWorkerPath => sdkLayout?.dartdevcSnapshotPath;
62-
63190
Uri? get sdkDirectoryUri => _toUri(sdkDirectory);
64-
Uri? get soundSummaryUri => _toUri(soundSummaryPath);
65-
Uri? get weakSummaryUri => _toUri(weakSummaryPath);
191+
Uri? get soundSdkSummaryUri => _toUri(soundSdkSummaryPath);
192+
Uri? get weakSdkSummaryUri => _toUri(weakSdkSummaryPath);
66193
Uri? get librariesUri => _toUri(librariesPath);
67194

68195
/// Note: has to be ///file: Uri to run in an isolate.
@@ -72,7 +199,6 @@ class SdkConfiguration {
72199
/// exist on disk.
73200
void validate({FileSystem fileSystem = const LocalFileSystem()}) {
74201
validateSdkDir(fileSystem: fileSystem);
75-
validateDartExecutable(fileSystem: fileSystem);
76202
validateSummaries(fileSystem: fileSystem);
77203
validateLibrariesSpec(fileSystem: fileSystem);
78204
validateCompilerWorker(fileSystem: fileSystem);
@@ -88,36 +214,26 @@ class SdkConfiguration {
88214
}
89215
}
90216

91-
/// Throws [InvalidSdkConfigurationException] if SDK root does not
92-
/// exist on the disk.
93-
void validateDartExecutable(
94-
{FileSystem fileSystem = const LocalFileSystem()}) {
95-
if (!fileSystem.file(dartPath).existsSync()) {
96-
throw InvalidSdkConfigurationException(
97-
'Dart executable $dartPath does not exist');
98-
}
99-
}
100-
101217
void validateSummaries({FileSystem fileSystem = const LocalFileSystem()}) {
102218
validateSoundSummaries(fileSystem: fileSystem);
103219
validateWeakSummaries(fileSystem: fileSystem);
104220
}
105221

106222
void validateWeakSummaries(
107223
{FileSystem fileSystem = const LocalFileSystem()}) {
108-
if (weakSummaryPath == null ||
109-
!fileSystem.file(weakSummaryPath).existsSync()) {
224+
if (weakSdkSummaryPath == null ||
225+
!fileSystem.file(weakSdkSummaryPath).existsSync()) {
110226
throw InvalidSdkConfigurationException(
111-
'Sdk summary $weakSummaryPath does not exist');
227+
'Sdk summary $weakSdkSummaryPath does not exist');
112228
}
113229
}
114230

115231
void validateSoundSummaries(
116232
{FileSystem fileSystem = const LocalFileSystem()}) {
117-
if ((soundSummaryPath == null ||
118-
!fileSystem.file(soundSummaryPath).existsSync())) {
233+
if ((soundSdkSummaryPath == null ||
234+
!fileSystem.file(soundSdkSummaryPath).existsSync())) {
119235
throw InvalidSdkConfigurationException(
120-
'Sdk summary $soundSummaryPath does not exist');
236+
'Sdk summary $soundSdkSummaryPath does not exist');
121237
}
122238
}
123239

0 commit comments

Comments
 (0)