Skip to content

Commit 9f4f6c4

Browse files
Use platform dill from the engine when compiling with dart2wasm. (flutter#134970)
This is the final change needed to address flutter#133467 This allows us to use the platform dill that is built by the engine when compiling apps. This also fixes the `--local-web-sdk` flag when compiling to wasm (which previously didn't work without some serious tweaking of the engine build output).
1 parent 878a48f commit 9f4f6c4

File tree

2 files changed

+4
-21
lines changed
  • packages/flutter_tools

2 files changed

+4
-21
lines changed

packages/flutter_tools/lib/src/build_system/targets/web.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,22 +238,16 @@ class Dart2WasmTarget extends Dart2WebTarget {
238238
);
239239
final File depFile = environment.buildDir.childFile('dart2wasm.d');
240240
final String dartSdkPath = artifacts.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript);
241-
final String dartSdkRoot = environment.fileSystem.directory(dartSdkPath).parent.path;
241+
final String platformBinariesPath = getWebPlatformBinariesDirectory(artifacts, webRenderer).path;
242+
final String platformFilePath = environment.fileSystem.path.join(platformBinariesPath, 'dart2wasm_platform.dill');
242243

243244
final List<String> compilationArgs = <String>[
244245
artifacts.getArtifactPath(Artifact.engineDartAotRuntime, platform: TargetPlatform.web_javascript),
245246
'--disable-dart-dev',
246247
artifacts.getArtifactPath(Artifact.dart2wasmSnapshot, platform: TargetPlatform.web_javascript),
247248
'--packages=.dart_tool/package_config.json',
248249
'--dart-sdk=$dartSdkPath',
249-
'--multi-root-scheme',
250-
'org-dartlang-sdk',
251-
'--multi-root',
252-
artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path,
253-
'--multi-root',
254-
dartSdkRoot,
255-
'--libraries-spec',
256-
artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).path,
250+
'--platform=$platformFilePath',
257251
if (buildMode == BuildMode.profile)
258252
'-Ddart.vm.profile=true'
259253
else

packages/flutter_tools/test/general.shard/build_system/targets/web_test.dart

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ const List<String> _kDart2WasmLinuxArgs = <String> [
3636
'Artifact.dart2wasmSnapshot.TargetPlatform.web_javascript',
3737
'--packages=.dart_tool/package_config.json',
3838
'--dart-sdk=Artifact.engineDartSdkPath.TargetPlatform.web_javascript',
39-
'--multi-root-scheme',
40-
'org-dartlang-sdk',
41-
'--multi-root',
42-
'HostArtifact.flutterWebSdk',
43-
'--multi-root',
44-
_kDartSdkRoot,
45-
'--libraries-spec',
46-
'HostArtifact.flutterWebLibrariesJson',
39+
'--platform=HostArtifact.webPlatformKernelFolder/dart2wasm_platform.dill',
4740
];
4841

4942
const List<String> _kWasmOptLinuxArgrs = <String> [
@@ -58,10 +51,6 @@ const List<String> _kWasmOptLinuxArgrs = <String> [
5851
'--type-merging',
5952
];
6053

61-
/// The result of calling `.parent` on a Memory directory pointing to
62-
/// `'Artifact.engineDartSdkPath.TargetPlatform.web_javascript'`.
63-
const String _kDartSdkRoot = '.';
64-
6554
void main() {
6655
late Testbed testbed;
6756
late Environment environment;

0 commit comments

Comments
 (0)