Platform binaries reland (#115502)

You can now specify a --local-web-sdk flag to point to a wasm_release folder. This will make it so that only artifacts that pertain to the web sdk are overridden to point to the wasm_release folder. Other artifacts (such as impellerc) will pull from the cache, or from the --local-engine path if that is specified.

This also uses precompiled platform kernel files for both ddc and dart2js
This commit is contained in:
Jackson Gardner
2022-12-02 14:13:40 -08:00
committed by GitHub
parent 08a2635e2b
commit db1c3e208d
45 changed files with 810 additions and 471 deletions

View File

@@ -188,7 +188,7 @@ class FlutterWebPlatform extends PlatformPlugin {
/// The require js binary.
File get _requireJs => _fileSystem.file(_fileSystem.path.join(
_artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
_artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
'lib',
'dev_compiler',
'kernel',
@@ -198,7 +198,7 @@ class FlutterWebPlatform extends PlatformPlugin {
/// The ddc to dart stack trace mapper.
File get _stackTraceMapper => _fileSystem.file(_fileSystem.path.join(
_artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
_artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
'lib',
'dev_compiler',
'web',

View File

@@ -50,22 +50,29 @@ class WebTestCompiler {
required BuildInfo buildInfo,
}) async {
LanguageVersion languageVersion = LanguageVersion(2, 8);
HostArtifact platformDillArtifact = HostArtifact.webPlatformSoundKernelDill;
late final String platformDillName;
// TODO(zanderso): to support autodetect this would need to partition the source code into a
// a sound and unsound set and perform separate compilations.
// a sound and unsound set and perform separate compilations
final List<String> extraFrontEndOptions = List<String>.of(buildInfo.extraFrontEndOptions);
if (buildInfo.nullSafetyMode == NullSafetyMode.unsound || buildInfo.nullSafetyMode == NullSafetyMode.autodetect) {
platformDillArtifact = HostArtifact.webPlatformKernelDill;
platformDillName = 'ddc_outline.dill';
if (!extraFrontEndOptions.contains('--no-sound-null-safety')) {
extraFrontEndOptions.add('--no-sound-null-safety');
}
} else if (buildInfo.nullSafetyMode == NullSafetyMode.sound) {
languageVersion = currentLanguageVersion(_fileSystem, Cache.flutterRoot!);
platformDillName = 'ddc_outline_sound.dill';
if (!extraFrontEndOptions.contains('--sound-null-safety')) {
extraFrontEndOptions.add('--sound-null-safety');
}
}
final String platformDillPath = _fileSystem.path.join(
getWebPlatformBinariesDirectory(_artifacts, buildInfo.webRenderer).path,
platformDillName
);
final Directory outputDirectory = _fileSystem.directory(testOutputDir)
..createSync(recursive: true);
final List<File> generatedFiles = <File>[];
@@ -116,9 +123,7 @@ class WebTestCompiler {
initializeFromDill: cachedKernelPath,
targetModel: TargetModel.dartdevc,
extraFrontEndOptions: extraFrontEndOptions,
platformDill: _artifacts
.getHostArtifact(platformDillArtifact)
.absolute.uri.toString(),
platformDill: platformDillPath,
dartDefines: buildInfo.dartDefines,
librariesSpec: _artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).uri.toString(),
packagesPath: buildInfo.packagesPath,