Unverified Commit 9f4f6c47 authored by Jackson Gardner's avatar Jackson Gardner Committed by GitHub

Use platform dill from the engine when compiling with dart2wasm. (#134970)

This is the final change needed to address https://github.com/flutter/flutter/issues/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).
parent 878a48fa
......@@ -238,7 +238,8 @@ class Dart2WasmTarget extends Dart2WebTarget {
);
final File depFile = environment.buildDir.childFile('dart2wasm.d');
final String dartSdkPath = artifacts.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript);
final String dartSdkRoot = environment.fileSystem.directory(dartSdkPath).parent.path;
final String platformBinariesPath = getWebPlatformBinariesDirectory(artifacts, webRenderer).path;
final String platformFilePath = environment.fileSystem.path.join(platformBinariesPath, 'dart2wasm_platform.dill');
final List<String> compilationArgs = <String>[
artifacts.getArtifactPath(Artifact.engineDartAotRuntime, platform: TargetPlatform.web_javascript),
......@@ -246,14 +247,7 @@ class Dart2WasmTarget extends Dart2WebTarget {
artifacts.getArtifactPath(Artifact.dart2wasmSnapshot, platform: TargetPlatform.web_javascript),
'--packages=.dart_tool/package_config.json',
'--dart-sdk=$dartSdkPath',
'--multi-root-scheme',
'org-dartlang-sdk',
'--multi-root',
artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path,
'--multi-root',
dartSdkRoot,
'--libraries-spec',
artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).path,
'--platform=$platformFilePath',
if (buildMode == BuildMode.profile)
'-Ddart.vm.profile=true'
else
......
......@@ -36,14 +36,7 @@ const List<String> _kDart2WasmLinuxArgs = <String> [
'Artifact.dart2wasmSnapshot.TargetPlatform.web_javascript',
'--packages=.dart_tool/package_config.json',
'--dart-sdk=Artifact.engineDartSdkPath.TargetPlatform.web_javascript',
'--multi-root-scheme',
'org-dartlang-sdk',
'--multi-root',
'HostArtifact.flutterWebSdk',
'--multi-root',
_kDartSdkRoot,
'--libraries-spec',
'HostArtifact.flutterWebLibrariesJson',
'--platform=HostArtifact.webPlatformKernelFolder/dart2wasm_platform.dill',
];
const List<String> _kWasmOptLinuxArgrs = <String> [
......@@ -58,10 +51,6 @@ const List<String> _kWasmOptLinuxArgrs = <String> [
'--type-merging',
];
/// The result of calling `.parent` on a Memory directory pointing to
/// `'Artifact.engineDartSdkPath.TargetPlatform.web_javascript'`.
const String _kDartSdkRoot = '.';
void main() {
late Testbed testbed;
late Environment environment;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment