Revert "[web] Add --local-web-sdk
flag and use precompiled platform kernels for dart2js and ddc (#114639)" (#115242)
This reverts commit 0e9ee3679cf30a1022b1ed062019d4f7312cef92.
This commit is contained in:
parent
1a460cfb93
commit
8230ef5e85
@ -277,22 +277,22 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
|||||||
if (!buildInfo.androidGradleDaemon) {
|
if (!buildInfo.androidGradleDaemon) {
|
||||||
command.add('--no-daemon');
|
command.add('--no-daemon');
|
||||||
}
|
}
|
||||||
final LocalEngineInfo? localEngineInfo = _artifacts.localEngineInfo;
|
if (_artifacts is LocalEngineArtifacts) {
|
||||||
if (localEngineInfo != null) {
|
final LocalEngineArtifacts localEngineArtifacts = _artifacts as LocalEngineArtifacts;
|
||||||
final Directory localEngineRepo = _getLocalEngineRepo(
|
final Directory localEngineRepo = _getLocalEngineRepo(
|
||||||
engineOutPath: localEngineInfo.engineOutPath,
|
engineOutPath: localEngineArtifacts.engineOutPath,
|
||||||
androidBuildInfo: androidBuildInfo,
|
androidBuildInfo: androidBuildInfo,
|
||||||
fileSystem: _fileSystem,
|
fileSystem: _fileSystem,
|
||||||
);
|
);
|
||||||
_logger.printTrace(
|
_logger.printTrace(
|
||||||
'Using local engine: ${localEngineInfo.engineOutPath}\n'
|
'Using local engine: ${localEngineArtifacts.engineOutPath}\n'
|
||||||
'Local Maven repo: ${localEngineRepo.path}'
|
'Local Maven repo: ${localEngineRepo.path}'
|
||||||
);
|
);
|
||||||
command.add('-Plocal-engine-repo=${localEngineRepo.path}');
|
command.add('-Plocal-engine-repo=${localEngineRepo.path}');
|
||||||
command.add('-Plocal-engine-build-mode=${buildInfo.modeName}');
|
command.add('-Plocal-engine-build-mode=${buildInfo.modeName}');
|
||||||
command.add('-Plocal-engine-out=${localEngineInfo.engineOutPath}');
|
command.add('-Plocal-engine-out=${localEngineArtifacts.engineOutPath}');
|
||||||
command.add('-Ptarget-platform=${_getTargetPlatformByLocalEnginePath(
|
command.add('-Ptarget-platform=${_getTargetPlatformByLocalEnginePath(
|
||||||
localEngineInfo.engineOutPath)}');
|
localEngineArtifacts.engineOutPath)}');
|
||||||
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
||||||
final String targetPlatforms = androidBuildInfo
|
final String targetPlatforms = androidBuildInfo
|
||||||
.targetArchs
|
.targetArchs
|
||||||
@ -611,20 +611,20 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
final LocalEngineInfo? localEngineInfo = _artifacts.localEngineInfo;
|
if (_artifacts is LocalEngineArtifacts) {
|
||||||
if (localEngineInfo != null) {
|
final LocalEngineArtifacts localEngineArtifacts = _artifacts as LocalEngineArtifacts;
|
||||||
final Directory localEngineRepo = _getLocalEngineRepo(
|
final Directory localEngineRepo = _getLocalEngineRepo(
|
||||||
engineOutPath: localEngineInfo.engineOutPath,
|
engineOutPath: localEngineArtifacts.engineOutPath,
|
||||||
androidBuildInfo: androidBuildInfo,
|
androidBuildInfo: androidBuildInfo,
|
||||||
fileSystem: _fileSystem,
|
fileSystem: _fileSystem,
|
||||||
);
|
);
|
||||||
_logger.printTrace(
|
_logger.printTrace(
|
||||||
'Using local engine: ${localEngineInfo.engineOutPath}\n'
|
'Using local engine: ${localEngineArtifacts.engineOutPath}\n'
|
||||||
'Local Maven repo: ${localEngineRepo.path}'
|
'Local Maven repo: ${localEngineRepo.path}'
|
||||||
);
|
);
|
||||||
command.add('-Plocal-engine-repo=${localEngineRepo.path}');
|
command.add('-Plocal-engine-repo=${localEngineRepo.path}');
|
||||||
command.add('-Plocal-engine-build-mode=${buildInfo.modeName}');
|
command.add('-Plocal-engine-build-mode=${buildInfo.modeName}');
|
||||||
command.add('-Plocal-engine-out=${localEngineInfo.engineOutPath}');
|
command.add('-Plocal-engine-out=${localEngineArtifacts.engineOutPath}');
|
||||||
|
|
||||||
// Copy the local engine repo in the output directory.
|
// Copy the local engine repo in the output directory.
|
||||||
try {
|
try {
|
||||||
@ -639,7 +639,7 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
command.add('-Ptarget-platform=${_getTargetPlatformByLocalEnginePath(
|
command.add('-Ptarget-platform=${_getTargetPlatformByLocalEnginePath(
|
||||||
localEngineInfo.engineOutPath)}');
|
localEngineArtifacts.engineOutPath)}');
|
||||||
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
} else if (androidBuildInfo.targetArchs.isNotEmpty) {
|
||||||
final String targetPlatforms = androidBuildInfo.targetArchs
|
final String targetPlatforms = androidBuildInfo.targetArchs
|
||||||
.map(getPlatformNameForAndroidArch).join(',');
|
.map(getPlatformNameForAndroidArch).join(',');
|
||||||
|
@ -72,15 +72,6 @@ enum HostArtifact {
|
|||||||
/// The summary dill with null safety enabled for the dartdevc target.
|
/// The summary dill with null safety enabled for the dartdevc target.
|
||||||
webPlatformSoundKernelDill,
|
webPlatformSoundKernelDill,
|
||||||
|
|
||||||
/// Folder that contains platform dill files for autodetect web renderer.
|
|
||||||
webPlatformAutoDillDirectory,
|
|
||||||
|
|
||||||
/// Folder that contains platform dill files for html web renderer.
|
|
||||||
webPlatformHtmlDillDirectory,
|
|
||||||
|
|
||||||
/// Folder that contains platform dill files for canvaskit web renderer.
|
|
||||||
webPlatformCanvasKitDillDirectory,
|
|
||||||
|
|
||||||
/// The precompiled SDKs and sourcemaps for web debug builds.
|
/// The precompiled SDKs and sourcemaps for web debug builds.
|
||||||
webPrecompiledSdk,
|
webPrecompiledSdk,
|
||||||
webPrecompiledSdkSourcemaps,
|
webPrecompiledSdkSourcemaps,
|
||||||
@ -248,12 +239,6 @@ String _hostArtifactToFileName(HostArtifact artifact, Platform platform) {
|
|||||||
return 'flutter_ddc_sdk.dill';
|
return 'flutter_ddc_sdk.dill';
|
||||||
case HostArtifact.webPlatformSoundKernelDill:
|
case HostArtifact.webPlatformSoundKernelDill:
|
||||||
return 'flutter_ddc_sdk_sound.dill';
|
return 'flutter_ddc_sdk_sound.dill';
|
||||||
case HostArtifact.webPlatformAutoDillDirectory:
|
|
||||||
return 'auto';
|
|
||||||
case HostArtifact.webPlatformHtmlDillDirectory:
|
|
||||||
return 'html';
|
|
||||||
case HostArtifact.webPlatformCanvasKitDillDirectory:
|
|
||||||
return 'canvaskit';
|
|
||||||
case HostArtifact.flutterWebLibrariesJson:
|
case HostArtifact.flutterWebLibrariesJson:
|
||||||
return 'libraries.json';
|
return 'libraries.json';
|
||||||
case HostArtifact.webPrecompiledSdk:
|
case HostArtifact.webPrecompiledSdk:
|
||||||
@ -281,23 +266,11 @@ class EngineBuildPaths {
|
|||||||
const EngineBuildPaths({
|
const EngineBuildPaths({
|
||||||
required this.targetEngine,
|
required this.targetEngine,
|
||||||
required this.hostEngine,
|
required this.hostEngine,
|
||||||
required this.webSdk,
|
}) : assert(targetEngine != null),
|
||||||
});
|
assert(hostEngine != null);
|
||||||
|
|
||||||
final String? targetEngine;
|
final String targetEngine;
|
||||||
final String? hostEngine;
|
final String hostEngine;
|
||||||
final String? webSdk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Information about a local engine build
|
|
||||||
class LocalEngineInfo {
|
|
||||||
const LocalEngineInfo({
|
|
||||||
required this.engineOutPath,
|
|
||||||
required this.localEngineName,
|
|
||||||
});
|
|
||||||
|
|
||||||
final String engineOutPath;
|
|
||||||
final String localEngineName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manages the engine artifacts of Flutter.
|
// Manages the engine artifacts of Flutter.
|
||||||
@ -316,35 +289,16 @@ abstract class Artifacts {
|
|||||||
return _TestArtifacts(fileSystem);
|
return _TestArtifacts(fileSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Artifacts getLocalEngine(EngineBuildPaths engineBuildPaths) {
|
static LocalEngineArtifacts getLocalEngine(EngineBuildPaths engineBuildPaths) {
|
||||||
Artifacts artifacts = CachedArtifacts(
|
return LocalEngineArtifacts(
|
||||||
fileSystem: globals.fs,
|
engineBuildPaths.targetEngine,
|
||||||
platform: globals.platform,
|
engineBuildPaths.hostEngine,
|
||||||
cache: globals.cache,
|
cache: globals.cache,
|
||||||
operatingSystemUtils: globals.os
|
fileSystem: globals.fs,
|
||||||
|
processManager: globals.processManager,
|
||||||
|
platform: globals.platform,
|
||||||
|
operatingSystemUtils: globals.os,
|
||||||
);
|
);
|
||||||
if (engineBuildPaths.hostEngine != null && engineBuildPaths.targetEngine != null) {
|
|
||||||
artifacts = CachedLocalEngineArtifacts(
|
|
||||||
engineBuildPaths.hostEngine!,
|
|
||||||
engineOutPath: engineBuildPaths.targetEngine!,
|
|
||||||
cache: globals.cache,
|
|
||||||
fileSystem: globals.fs,
|
|
||||||
processManager: globals.processManager,
|
|
||||||
platform: globals.platform,
|
|
||||||
operatingSystemUtils: globals.os,
|
|
||||||
parent: artifacts,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (engineBuildPaths.webSdk != null) {
|
|
||||||
artifacts = CachedLocalWebSdkArtifacts(
|
|
||||||
parent: artifacts,
|
|
||||||
webSdkPath: engineBuildPaths.webSdk!,
|
|
||||||
fileSystem: globals.fs,
|
|
||||||
platform: globals.platform,
|
|
||||||
operatingSystemUtils: globals.os
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return artifacts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the requested [artifact] for the [platform], [mode], and [environmentType] combination.
|
/// Returns the requested [artifact] for the [platform], [mode], and [environmentType] combination.
|
||||||
@ -367,10 +321,6 @@ abstract class Artifacts {
|
|||||||
|
|
||||||
/// Whether these artifacts correspond to a non-versioned local engine.
|
/// Whether these artifacts correspond to a non-versioned local engine.
|
||||||
bool get isLocalEngine;
|
bool get isLocalEngine;
|
||||||
|
|
||||||
/// If these artifacts are bound to a local engine build, returns info about
|
|
||||||
/// the location and name of the local engine, otherwise returns null.
|
|
||||||
LocalEngineInfo? get localEngineInfo;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Manages the engine artifacts downloaded to the local cache.
|
/// Manages the engine artifacts downloaded to the local cache.
|
||||||
@ -390,9 +340,6 @@ class CachedArtifacts implements Artifacts {
|
|||||||
final Cache _cache;
|
final Cache _cache;
|
||||||
final OperatingSystemUtils _operatingSystemUtils;
|
final OperatingSystemUtils _operatingSystemUtils;
|
||||||
|
|
||||||
@override
|
|
||||||
LocalEngineInfo? get localEngineInfo => null;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSystemEntity getHostArtifact(
|
FileSystemEntity getHostArtifact(
|
||||||
HostArtifact artifact,
|
HostArtifact artifact,
|
||||||
@ -416,13 +363,6 @@ class CachedArtifacts implements Artifacts {
|
|||||||
case HostArtifact.webPlatformSoundKernelDill:
|
case HostArtifact.webPlatformSoundKernelDill:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
|
|
||||||
case HostArtifact.webPlatformAutoDillDirectory:
|
|
||||||
case HostArtifact.webPlatformHtmlDillDirectory:
|
|
||||||
case HostArtifact.webPlatformCanvasKitDillDirectory:
|
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'platforms', _hostArtifactToFileName(artifact, _platform));
|
|
||||||
return _fileSystem.file(path);
|
|
||||||
|
|
||||||
case HostArtifact.webPrecompiledSdk:
|
case HostArtifact.webPrecompiledSdk:
|
||||||
case HostArtifact.webPrecompiledSdkSourcemaps:
|
case HostArtifact.webPrecompiledSdkSourcemaps:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
|
||||||
@ -782,37 +722,43 @@ String _getIosEngineArtifactPath(String engineDirectory,
|
|||||||
.path;
|
.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Manages the artifacts of a locally built engine.
|
abstract class LocalEngineArtifacts implements Artifacts {
|
||||||
class CachedLocalEngineArtifacts implements Artifacts {
|
factory LocalEngineArtifacts(String engineOutPath, String hostEngineOutPath, {
|
||||||
CachedLocalEngineArtifacts(
|
required FileSystem fileSystem,
|
||||||
this._hostEngineOutPath, {
|
required Cache cache,
|
||||||
required String engineOutPath,
|
required ProcessManager processManager,
|
||||||
|
required Platform platform,
|
||||||
|
required OperatingSystemUtils operatingSystemUtils,
|
||||||
|
}) = CachedLocalEngineArtifacts;
|
||||||
|
|
||||||
|
String get engineOutPath;
|
||||||
|
|
||||||
|
String get localEngineName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Manages the artifacts of a locally built engine.
|
||||||
|
class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
|
CachedLocalEngineArtifacts(
|
||||||
|
this.engineOutPath,
|
||||||
|
this._hostEngineOutPath, {
|
||||||
required FileSystem fileSystem,
|
required FileSystem fileSystem,
|
||||||
required Cache cache,
|
required Cache cache,
|
||||||
required ProcessManager processManager,
|
required ProcessManager processManager,
|
||||||
required Platform platform,
|
required Platform platform,
|
||||||
required OperatingSystemUtils operatingSystemUtils,
|
required OperatingSystemUtils operatingSystemUtils,
|
||||||
Artifacts? parent,
|
|
||||||
}) : _fileSystem = fileSystem,
|
}) : _fileSystem = fileSystem,
|
||||||
localEngineInfo =
|
localEngineName = fileSystem.path.basename(engineOutPath),
|
||||||
LocalEngineInfo(
|
|
||||||
engineOutPath: engineOutPath,
|
|
||||||
localEngineName: fileSystem.path.basename(engineOutPath)
|
|
||||||
),
|
|
||||||
_cache = cache,
|
_cache = cache,
|
||||||
_processManager = processManager,
|
_processManager = processManager,
|
||||||
_platform = platform,
|
_platform = platform,
|
||||||
_operatingSystemUtils = operatingSystemUtils,
|
_operatingSystemUtils = operatingSystemUtils,
|
||||||
_backupCache = parent ??
|
_backupCache = CachedArtifacts(fileSystem: fileSystem, platform: platform, cache: cache, operatingSystemUtils: operatingSystemUtils);
|
||||||
CachedArtifacts(
|
|
||||||
fileSystem: fileSystem,
|
|
||||||
platform: platform,
|
|
||||||
cache: cache,
|
|
||||||
operatingSystemUtils: operatingSystemUtils
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final LocalEngineInfo localEngineInfo;
|
final String engineOutPath;
|
||||||
|
|
||||||
|
@override
|
||||||
|
final String localEngineName;
|
||||||
|
|
||||||
final String _hostEngineOutPath;
|
final String _hostEngineOutPath;
|
||||||
final FileSystem _fileSystem;
|
final FileSystem _fileSystem;
|
||||||
@ -820,7 +766,7 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
final ProcessManager _processManager;
|
final ProcessManager _processManager;
|
||||||
final Platform _platform;
|
final Platform _platform;
|
||||||
final OperatingSystemUtils _operatingSystemUtils;
|
final OperatingSystemUtils _operatingSystemUtils;
|
||||||
final Artifacts _backupCache;
|
final CachedArtifacts _backupCache;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSystemEntity getHostArtifact(HostArtifact artifact) {
|
FileSystemEntity getHostArtifact(HostArtifact artifact) {
|
||||||
@ -852,11 +798,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
case HostArtifact.webPlatformSoundKernelDill:
|
case HostArtifact.webPlatformSoundKernelDill:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
case HostArtifact.webPlatformAutoDillDirectory:
|
|
||||||
case HostArtifact.webPlatformHtmlDillDirectory:
|
|
||||||
case HostArtifact.webPlatformCanvasKitDillDirectory:
|
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'platforms', _hostArtifactToFileName(artifact, _platform));
|
|
||||||
return _fileSystem.file(path);
|
|
||||||
case HostArtifact.webPrecompiledSdk:
|
case HostArtifact.webPrecompiledSdk:
|
||||||
case HostArtifact.webPrecompiledSdkSourcemaps:
|
case HostArtifact.webPrecompiledSdkSourcemaps:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, _platform));
|
||||||
@ -924,28 +865,28 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
return _flutterTesterPath(platform!);
|
return _flutterTesterPath(platform!);
|
||||||
case Artifact.isolateSnapshotData:
|
case Artifact.isolateSnapshotData:
|
||||||
case Artifact.vmSnapshotData:
|
case Artifact.vmSnapshotData:
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'gen', 'flutter', 'lib', 'snapshot', artifactFileName);
|
return _fileSystem.path.join(engineOutPath, 'gen', 'flutter', 'lib', 'snapshot', artifactFileName);
|
||||||
case Artifact.icuData:
|
case Artifact.icuData:
|
||||||
case Artifact.flutterXcframework:
|
case Artifact.flutterXcframework:
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, artifactFileName);
|
return _fileSystem.path.join(engineOutPath, artifactFileName);
|
||||||
case Artifact.platformKernelDill:
|
case Artifact.platformKernelDill:
|
||||||
if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
|
if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter_runner_patched_sdk', artifactFileName);
|
return _fileSystem.path.join(engineOutPath, 'flutter_runner_patched_sdk', artifactFileName);
|
||||||
}
|
}
|
||||||
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), artifactFileName);
|
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), artifactFileName);
|
||||||
case Artifact.platformLibrariesJson:
|
case Artifact.platformLibrariesJson:
|
||||||
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), 'lib', artifactFileName);
|
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), 'lib', artifactFileName);
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
return _getIosEngineArtifactPath(
|
return _getIosEngineArtifactPath(
|
||||||
localEngineInfo.engineOutPath, environmentType, _fileSystem);
|
engineOutPath, environmentType, _fileSystem);
|
||||||
case Artifact.flutterPatchedSdkPath:
|
case Artifact.flutterPatchedSdkPath:
|
||||||
// When using local engine always use [BuildMode.debug] regardless of
|
// When using local engine always use [BuildMode.debug] regardless of
|
||||||
// what was specified in [mode] argument because local engine will
|
// what was specified in [mode] argument because local engine will
|
||||||
// have only one flutter_patched_sdk in standard location, that
|
// have only one flutter_patched_sdk in standard location, that
|
||||||
// is happen to be what debug(non-release) mode is using.
|
// is happen to be what debug(non-release) mode is using.
|
||||||
if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
|
if (platform == TargetPlatform.fuchsia_x64 || platform == TargetPlatform.fuchsia_arm64) {
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter_runner_patched_sdk');
|
return _fileSystem.path.join(engineOutPath, 'flutter_runner_patched_sdk');
|
||||||
}
|
}
|
||||||
return _getFlutterPatchedSdkPath(BuildMode.debug);
|
return _getFlutterPatchedSdkPath(BuildMode.debug);
|
||||||
case Artifact.skyEnginePath:
|
case Artifact.skyEnginePath:
|
||||||
@ -954,11 +895,11 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
final String hostPlatform = getNameForHostPlatform(getCurrentHostPlatform());
|
final String hostPlatform = getNameForHostPlatform(getCurrentHostPlatform());
|
||||||
final String modeName = mode!.isRelease ? 'release' : mode.toString();
|
final String modeName = mode!.isRelease ? 'release' : mode.toString();
|
||||||
final String dartBinaries = 'dart_binaries-$modeName-$hostPlatform';
|
final String dartBinaries = 'dart_binaries-$modeName-$hostPlatform';
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'host_bundle', dartBinaries, 'kernel_compiler.dart.snapshot');
|
return _fileSystem.path.join(engineOutPath, 'host_bundle', dartBinaries, 'kernel_compiler.dart.snapshot');
|
||||||
case Artifact.fuchsiaFlutterRunner:
|
case Artifact.fuchsiaFlutterRunner:
|
||||||
final String jitOrAot = mode!.isJit ? '_jit' : '_aot';
|
final String jitOrAot = mode!.isJit ? '_jit' : '_aot';
|
||||||
final String productOrNo = mode.isRelease ? '_product' : '';
|
final String productOrNo = mode.isRelease ? '_product' : '';
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter$jitOrAot${productOrNo}_runner-0.far');
|
return _fileSystem.path.join(engineOutPath, 'flutter$jitOrAot${productOrNo}_runner-0.far');
|
||||||
case Artifact.fontSubset:
|
case Artifact.fontSubset:
|
||||||
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
|
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
|
||||||
case Artifact.constFinder:
|
case Artifact.constFinder:
|
||||||
@ -977,11 +918,11 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String getEngineType(TargetPlatform platform, [ BuildMode? mode ]) {
|
String getEngineType(TargetPlatform platform, [ BuildMode? mode ]) {
|
||||||
return _fileSystem.path.basename(localEngineInfo.engineOutPath);
|
return _fileSystem.path.basename(engineOutPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getFlutterPatchedSdkPath(BuildMode? buildMode) {
|
String _getFlutterPatchedSdkPath(BuildMode? buildMode) {
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath,
|
return _fileSystem.path.join(engineOutPath,
|
||||||
buildMode == BuildMode.release ? 'flutter_patched_sdk_product' : 'flutter_patched_sdk');
|
buildMode == BuildMode.release ? 'flutter_patched_sdk_product' : 'flutter_patched_sdk');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1031,14 +972,14 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _getFlutterWebSdkPath() {
|
String _getFlutterWebSdkPath() {
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter_web_sdk');
|
return _fileSystem.path.join(engineOutPath, 'flutter_web_sdk');
|
||||||
}
|
}
|
||||||
|
|
||||||
String _genSnapshotPath() {
|
String _genSnapshotPath() {
|
||||||
const List<String> clangDirs = <String>['.', 'clang_x64', 'clang_x86', 'clang_i386', 'clang_arm64'];
|
const List<String> clangDirs = <String>['.', 'clang_x64', 'clang_x86', 'clang_i386', 'clang_arm64'];
|
||||||
final String genSnapshotName = _artifactToFileName(Artifact.genSnapshot)!;
|
final String genSnapshotName = _artifactToFileName(Artifact.genSnapshot)!;
|
||||||
for (final String clangDir in clangDirs) {
|
for (final String clangDir in clangDirs) {
|
||||||
final String genSnapshotPath = _fileSystem.path.join(localEngineInfo.engineOutPath, clangDir, genSnapshotName);
|
final String genSnapshotPath = _fileSystem.path.join(engineOutPath, clangDir, genSnapshotName);
|
||||||
if (_processManager.canRun(genSnapshotPath)) {
|
if (_processManager.canRun(genSnapshotPath)) {
|
||||||
return genSnapshotPath;
|
return genSnapshotPath;
|
||||||
}
|
}
|
||||||
@ -1048,11 +989,11 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
|
|
||||||
String _flutterTesterPath(TargetPlatform platform) {
|
String _flutterTesterPath(TargetPlatform platform) {
|
||||||
if (_platform.isLinux) {
|
if (_platform.isLinux) {
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, _artifactToFileName(Artifact.flutterTester));
|
return _fileSystem.path.join(engineOutPath, _artifactToFileName(Artifact.flutterTester));
|
||||||
} else if (_platform.isMacOS) {
|
} else if (_platform.isMacOS) {
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter_tester');
|
return _fileSystem.path.join(engineOutPath, 'flutter_tester');
|
||||||
} else if (_platform.isWindows) {
|
} else if (_platform.isWindows) {
|
||||||
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter_tester.exe');
|
return _fileSystem.path.join(engineOutPath, 'flutter_tester.exe');
|
||||||
}
|
}
|
||||||
throw Exception('Unsupported platform $platform.');
|
throw Exception('Unsupported platform $platform.');
|
||||||
}
|
}
|
||||||
@ -1061,160 +1002,6 @@ class CachedLocalEngineArtifacts implements Artifacts {
|
|||||||
bool get isLocalEngine => true;
|
bool get isLocalEngine => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
class CachedLocalWebSdkArtifacts implements Artifacts {
|
|
||||||
CachedLocalWebSdkArtifacts({
|
|
||||||
required this.parent,
|
|
||||||
required this.webSdkPath,
|
|
||||||
required this.fileSystem,
|
|
||||||
required this.platform,
|
|
||||||
required this.operatingSystemUtils
|
|
||||||
});
|
|
||||||
|
|
||||||
final Artifacts parent;
|
|
||||||
final String webSdkPath;
|
|
||||||
final FileSystem fileSystem;
|
|
||||||
final Platform platform;
|
|
||||||
final OperatingSystemUtils operatingSystemUtils;
|
|
||||||
|
|
||||||
@override
|
|
||||||
String getArtifactPath(Artifact artifact, {TargetPlatform? platform, BuildMode? mode, EnvironmentType? environmentType}) {
|
|
||||||
if (platform == TargetPlatform.web_javascript) {
|
|
||||||
if (artifact == Artifact.frontendServerSnapshotForEngineDartSdk) {
|
|
||||||
return fileSystem.path.join(
|
|
||||||
_getDartSdkPath(), 'bin', 'snapshots',
|
|
||||||
_artifactToFileName(artifact, platform, mode),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
throw Exception('Unable to find artifact path for $artifact in local web sdk.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return parent.getArtifactPath(artifact, platform: platform, mode: mode, environmentType: environmentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String getEngineType(TargetPlatform platform, [BuildMode? mode]) => parent.getEngineType(platform, mode);
|
|
||||||
|
|
||||||
@override
|
|
||||||
FileSystemEntity getHostArtifact(HostArtifact artifact) {
|
|
||||||
switch (artifact) {
|
|
||||||
case HostArtifact.engineDartSdkPath:
|
|
||||||
final String path = _getDartSdkPath();
|
|
||||||
return fileSystem.directory(path);
|
|
||||||
case HostArtifact.engineDartBinary:
|
|
||||||
final String path = fileSystem.path.join(_getDartSdkPath(), 'bin', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.dart2jsSnapshot:
|
|
||||||
final String path = fileSystem.path.join(_getDartSdkPath(), 'bin', 'snapshots', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.dartdevcSnapshot:
|
|
||||||
final String path = fileSystem.path.join(_getDartSdkPath(), 'bin', 'snapshots', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.kernelWorkerSnapshot:
|
|
||||||
final String path = fileSystem.path.join(_getDartSdkPath(), 'bin', 'snapshots', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.flutterWebSdk:
|
|
||||||
final String path = _getFlutterWebSdkPath();
|
|
||||||
return fileSystem.directory(path);
|
|
||||||
case HostArtifact.flutterWebLibrariesJson:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPlatformKernelDill:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPlatformSoundKernelDill:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPlatformAutoDillDirectory:
|
|
||||||
case HostArtifact.webPlatformHtmlDillDirectory:
|
|
||||||
case HostArtifact.webPlatformCanvasKitDillDirectory:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'platforms', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPrecompiledSdk:
|
|
||||||
case HostArtifact.webPrecompiledSdkSourcemaps:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPrecompiledCanvaskitSdk:
|
|
||||||
case HostArtifact.webPrecompiledCanvaskitSdkSourcemaps:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdk:
|
|
||||||
case HostArtifact.webPrecompiledCanvaskitAndHtmlSdkSourcemaps:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPrecompiledSoundSdk:
|
|
||||||
case HostArtifact.webPrecompiledSoundSdkSourcemaps:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-sound', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPrecompiledCanvaskitSoundSdk:
|
|
||||||
case HostArtifact.webPrecompiledCanvaskitSoundSdkSourcemaps:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-sound', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdk:
|
|
||||||
case HostArtifact.webPrecompiledCanvaskitAndHtmlSoundSdkSourcemaps:
|
|
||||||
final String path = fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', 'amd-canvaskit-html-sound', _hostArtifactToFileName(artifact, platform));
|
|
||||||
return fileSystem.file(path);
|
|
||||||
case HostArtifact.iosDeploy:
|
|
||||||
case HostArtifact.idevicesyslog:
|
|
||||||
case HostArtifact.idevicescreenshot:
|
|
||||||
case HostArtifact.iproxy:
|
|
||||||
case HostArtifact.skyEnginePath:
|
|
||||||
case HostArtifact.impellerc:
|
|
||||||
case HostArtifact.libtessellator:
|
|
||||||
return parent.getHostArtifact(artifact);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String _getDartSdkPath() {
|
|
||||||
// If we couldn't find a built dart sdk, let's look for a prebuilt one.
|
|
||||||
final String prebuiltPath = fileSystem.path.join(_getFlutterPrebuiltsPath(), _getPrebuiltTarget(), 'dart-sdk');
|
|
||||||
if (fileSystem.isDirectorySync(prebuiltPath)) {
|
|
||||||
return prebuiltPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw ToolExit('Unable to find a prebuilt dart sdk at: "$prebuiltPath"');
|
|
||||||
}
|
|
||||||
|
|
||||||
String _getFlutterPrebuiltsPath() {
|
|
||||||
final String engineSrcPath = fileSystem.path.dirname(fileSystem.path.dirname(webSdkPath));
|
|
||||||
return fileSystem.path.join(engineSrcPath, 'flutter', 'prebuilts');
|
|
||||||
}
|
|
||||||
|
|
||||||
String _getPrebuiltTarget() {
|
|
||||||
final TargetPlatform hostPlatform = _currentHostPlatform(platform, operatingSystemUtils);
|
|
||||||
switch (hostPlatform) {
|
|
||||||
case TargetPlatform.darwin:
|
|
||||||
return 'macos-x64';
|
|
||||||
case TargetPlatform.linux_arm64:
|
|
||||||
return 'linux-arm64';
|
|
||||||
case TargetPlatform.linux_x64:
|
|
||||||
return 'linux-x64';
|
|
||||||
case TargetPlatform.windows_x64:
|
|
||||||
return 'windows-x64';
|
|
||||||
case TargetPlatform.ios:
|
|
||||||
case TargetPlatform.android:
|
|
||||||
case TargetPlatform.android_arm:
|
|
||||||
case TargetPlatform.android_arm64:
|
|
||||||
case TargetPlatform.android_x64:
|
|
||||||
case TargetPlatform.android_x86:
|
|
||||||
case TargetPlatform.fuchsia_arm64:
|
|
||||||
case TargetPlatform.fuchsia_x64:
|
|
||||||
case TargetPlatform.web_javascript:
|
|
||||||
case TargetPlatform.tester:
|
|
||||||
throwToolExit('Unsupported host platform: $hostPlatform');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String _getFlutterWebSdkPath() {
|
|
||||||
return fileSystem.path.join(webSdkPath, 'flutter_web_sdk');
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
bool get isLocalEngine => parent.isLocalEngine;
|
|
||||||
|
|
||||||
@override
|
|
||||||
LocalEngineInfo? get localEngineInfo => parent.localEngineInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An implementation of [Artifacts] that provides individual overrides.
|
/// An implementation of [Artifacts] that provides individual overrides.
|
||||||
///
|
///
|
||||||
/// If an artifact is not provided, the lookup delegates to the parent.
|
/// If an artifact is not provided, the lookup delegates to the parent.
|
||||||
@ -1236,9 +1023,6 @@ class OverrideArtifacts implements Artifacts {
|
|||||||
final File? platformKernelDill;
|
final File? platformKernelDill;
|
||||||
final File? flutterPatchedSdk;
|
final File? flutterPatchedSdk;
|
||||||
|
|
||||||
@override
|
|
||||||
LocalEngineInfo? get localEngineInfo => parent.localEngineInfo;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getArtifactPath(
|
String getArtifactPath(
|
||||||
Artifact artifact, {
|
Artifact artifact, {
|
||||||
@ -1290,9 +1074,6 @@ class _TestArtifacts implements Artifacts {
|
|||||||
|
|
||||||
final FileSystem fileSystem;
|
final FileSystem fileSystem;
|
||||||
|
|
||||||
@override
|
|
||||||
LocalEngineInfo? get localEngineInfo => null;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getArtifactPath(
|
String getArtifactPath(
|
||||||
Artifact artifact, {
|
Artifact artifact, {
|
||||||
@ -1328,17 +1109,15 @@ class _TestArtifacts implements Artifacts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TestLocalEngine extends _TestArtifacts {
|
class _TestLocalEngine extends _TestArtifacts implements LocalEngineArtifacts {
|
||||||
_TestLocalEngine(String engineOutPath, super.fileSystem) :
|
_TestLocalEngine(this.engineOutPath, FileSystem fileSystem) : super(fileSystem);
|
||||||
localEngineInfo =
|
|
||||||
LocalEngineInfo(
|
|
||||||
engineOutPath: engineOutPath,
|
|
||||||
localEngineName: fileSystem.path.basename(engineOutPath)
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get isLocalEngine => true;
|
bool get isLocalEngine => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final LocalEngineInfo localEngineInfo;
|
final String engineOutPath;
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get localEngineName => fileSystem.path.basename(engineOutPath);
|
||||||
}
|
}
|
||||||
|
@ -310,12 +310,10 @@ class UserMessages {
|
|||||||
'Unable to detect a Flutter engine build directory in $engineSourcePath.\n'
|
'Unable to detect a Flutter engine build directory in $engineSourcePath.\n'
|
||||||
"Please ensure that $engineSourcePath is a Flutter engine 'src' directory and that "
|
"Please ensure that $engineSourcePath is a Flutter engine 'src' directory and that "
|
||||||
"you have compiled the engine in that directory, which should produce an 'out' directory";
|
"you have compiled the engine in that directory, which should produce an 'out' directory";
|
||||||
String get runnerLocalEngineOrWebSdkRequired =>
|
String get runnerLocalEngineRequired =>
|
||||||
'You must specify --local-engine or --local-web-sdk if you are using a locally built engine or web sdk.';
|
'You must specify --local-engine if you are using a locally built engine.';
|
||||||
String runnerNoEngineBuild(String engineBuildPath) =>
|
String runnerNoEngineBuild(String engineBuildPath) =>
|
||||||
'No Flutter engine build found at $engineBuildPath.';
|
'No Flutter engine build found at $engineBuildPath.';
|
||||||
String runnerNoWebSdk(String webSdkPath) =>
|
|
||||||
'No Flutter web sdk found at $webSdkPath.';
|
|
||||||
String runnerWrongFlutterInstance(String flutterRoot, String currentDir) =>
|
String runnerWrongFlutterInstance(String flutterRoot, String currentDir) =>
|
||||||
"Warning: the 'flutter' tool you are currently running is not the one from the current directory:\n"
|
"Warning: the 'flutter' tool you are currently running is not the one from the current directory:\n"
|
||||||
' running Flutter : $flutterRoot\n'
|
' running Flutter : $flutterRoot\n'
|
||||||
|
@ -13,7 +13,6 @@ import 'base/os.dart';
|
|||||||
import 'base/utils.dart';
|
import 'base/utils.dart';
|
||||||
import 'convert.dart';
|
import 'convert.dart';
|
||||||
import 'globals.dart' as globals;
|
import 'globals.dart' as globals;
|
||||||
import 'web/compile.dart';
|
|
||||||
|
|
||||||
/// Whether icon font subsetting is enabled by default.
|
/// Whether icon font subsetting is enabled by default.
|
||||||
const bool kIconTreeShakerEnabledDefault = true;
|
const bool kIconTreeShakerEnabledDefault = true;
|
||||||
@ -36,7 +35,6 @@ class BuildInfo {
|
|||||||
List<String>? dartDefines,
|
List<String>? dartDefines,
|
||||||
this.bundleSkSLPath,
|
this.bundleSkSLPath,
|
||||||
List<String>? dartExperiments,
|
List<String>? dartExperiments,
|
||||||
this.webRenderer = WebRendererMode.autoDetect,
|
|
||||||
required this.treeShakeIcons,
|
required this.treeShakeIcons,
|
||||||
this.performanceMeasurementFile,
|
this.performanceMeasurementFile,
|
||||||
this.dartDefineConfigJsonMap,
|
this.dartDefineConfigJsonMap,
|
||||||
@ -126,9 +124,6 @@ class BuildInfo {
|
|||||||
/// A list of Dart experiments.
|
/// A list of Dart experiments.
|
||||||
final List<String> dartExperiments;
|
final List<String> dartExperiments;
|
||||||
|
|
||||||
/// When compiling to web, which web renderer mode we are using (html, canvaskit, auto)
|
|
||||||
final WebRendererMode webRenderer;
|
|
||||||
|
|
||||||
/// The name of a file where flutter assemble will output performance
|
/// The name of a file where flutter assemble will output performance
|
||||||
/// information in a JSON format.
|
/// information in a JSON format.
|
||||||
///
|
///
|
||||||
@ -611,9 +606,8 @@ List<DarwinArch> defaultIOSArchsForEnvironment(
|
|||||||
Artifacts artifacts,
|
Artifacts artifacts,
|
||||||
) {
|
) {
|
||||||
// Handle single-arch local engines.
|
// Handle single-arch local engines.
|
||||||
final LocalEngineInfo? localEngineInfo = artifacts.localEngineInfo;
|
if (artifacts is LocalEngineArtifacts) {
|
||||||
if (localEngineInfo != null) {
|
final String localEngineName = artifacts.localEngineName;
|
||||||
final String localEngineName = localEngineInfo.localEngineName;
|
|
||||||
if (localEngineName.contains('_arm64')) {
|
if (localEngineName.contains('_arm64')) {
|
||||||
return <DarwinArch>[ DarwinArch.arm64 ];
|
return <DarwinArch>[ DarwinArch.arm64 ];
|
||||||
}
|
}
|
||||||
@ -634,9 +628,8 @@ List<DarwinArch> defaultIOSArchsForEnvironment(
|
|||||||
/// The default set of macOS device architectures to build for.
|
/// The default set of macOS device architectures to build for.
|
||||||
List<DarwinArch> defaultMacOSArchsForEnvironment(Artifacts artifacts) {
|
List<DarwinArch> defaultMacOSArchsForEnvironment(Artifacts artifacts) {
|
||||||
// Handle single-arch local engines.
|
// Handle single-arch local engines.
|
||||||
final LocalEngineInfo? localEngineInfo = artifacts.localEngineInfo;
|
if (artifacts is LocalEngineArtifacts) {
|
||||||
if (localEngineInfo != null) {
|
if (artifacts.localEngineName.contains('_arm64')) {
|
||||||
if (localEngineInfo.localEngineName.contains('_arm64')) {
|
|
||||||
return <DarwinArch>[ DarwinArch.arm64 ];
|
return <DarwinArch>[ DarwinArch.arm64 ];
|
||||||
}
|
}
|
||||||
return <DarwinArch>[ DarwinArch.x86_64 ];
|
return <DarwinArch>[ DarwinArch.x86_64 ];
|
||||||
@ -862,17 +855,6 @@ HostPlatform getCurrentHostPlatform() {
|
|||||||
return HostPlatform.linux_x64;
|
return HostPlatform.linux_x64;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSystemEntity getWebPlatformBinariesDirectory(Artifacts artifacts, WebRendererMode webRenderer) {
|
|
||||||
switch (webRenderer) {
|
|
||||||
case WebRendererMode.autoDetect:
|
|
||||||
return artifacts.getHostArtifact(HostArtifact.webPlatformAutoDillDirectory);
|
|
||||||
case WebRendererMode.canvaskit:
|
|
||||||
return artifacts.getHostArtifact(HostArtifact.webPlatformCanvasKitDillDirectory);
|
|
||||||
case WebRendererMode.html:
|
|
||||||
return artifacts.getHostArtifact(HostArtifact.webPlatformHtmlDillDirectory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Returns the top-level build output directory.
|
/// Returns the top-level build output directory.
|
||||||
String getBuildDirectory([Config? config, FileSystem? fileSystem]) {
|
String getBuildDirectory([Config? config, FileSystem? fileSystem]) {
|
||||||
// TODO(johnmccutchan): Stop calling this function as part of setting
|
// TODO(johnmccutchan): Stop calling this function as part of setting
|
||||||
|
@ -18,7 +18,6 @@ import '../../dart/package_map.dart';
|
|||||||
import '../../flutter_plugins.dart';
|
import '../../flutter_plugins.dart';
|
||||||
import '../../globals.dart' as globals;
|
import '../../globals.dart' as globals;
|
||||||
import '../../project.dart';
|
import '../../project.dart';
|
||||||
import '../../web/compile.dart';
|
|
||||||
import '../../web/file_generators/flutter_js.dart' as flutter_js;
|
import '../../web/file_generators/flutter_js.dart' as flutter_js;
|
||||||
import '../../web/file_generators/flutter_service_worker_js.dart';
|
import '../../web/file_generators/flutter_service_worker_js.dart';
|
||||||
import '../../web/file_generators/main_dart.dart' as main_dart;
|
import '../../web/file_generators/main_dart.dart' as main_dart;
|
||||||
@ -136,9 +135,7 @@ class WebEntrypointTarget extends Target {
|
|||||||
|
|
||||||
/// Compiles a web entry point with dart2js.
|
/// Compiles a web entry point with dart2js.
|
||||||
class Dart2JSTarget extends Target {
|
class Dart2JSTarget extends Target {
|
||||||
const Dart2JSTarget(this.webRenderer);
|
const Dart2JSTarget();
|
||||||
|
|
||||||
final WebRendererMode webRenderer;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'dart2js';
|
String get name => 'dart2js';
|
||||||
@ -186,12 +183,12 @@ class Dart2JSTarget extends Target {
|
|||||||
final bool sourceMapsEnabled = environment.defines[kSourceMapsEnabled] == 'true';
|
final bool sourceMapsEnabled = environment.defines[kSourceMapsEnabled] == 'true';
|
||||||
final bool nativeNullAssertions = environment.defines[kNativeNullAssertions] == 'true';
|
final bool nativeNullAssertions = environment.defines[kNativeNullAssertions] == 'true';
|
||||||
final Artifacts artifacts = globals.artifacts!;
|
final Artifacts artifacts = globals.artifacts!;
|
||||||
final String platformBinariesPath = getWebPlatformBinariesDirectory(artifacts, webRenderer).path;
|
final String librariesSpec = (artifacts.getHostArtifact(HostArtifact.flutterWebSdk) as Directory).childFile('libraries.json').path;
|
||||||
final List<String> sharedCommandOptions = <String>[
|
final List<String> sharedCommandOptions = <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getHostArtifact(HostArtifact.dart2jsSnapshot).path,
|
artifacts.getHostArtifact(HostArtifact.dart2jsSnapshot).path,
|
||||||
'--platform-binaries=$platformBinariesPath',
|
'--libraries-spec=$librariesSpec',
|
||||||
...decodeCommaSeparated(environment.defines, kExtraFrontEndOptions),
|
...decodeCommaSeparated(environment.defines, kExtraFrontEndOptions),
|
||||||
if (nativeNullAssertions)
|
if (nativeNullAssertions)
|
||||||
'--native-null-assertions',
|
'--native-null-assertions',
|
||||||
@ -259,16 +256,14 @@ class Dart2JSTarget extends Target {
|
|||||||
|
|
||||||
/// Unpacks the dart2js compilation and resources to a given output directory.
|
/// Unpacks the dart2js compilation and resources to a given output directory.
|
||||||
class WebReleaseBundle extends Target {
|
class WebReleaseBundle extends Target {
|
||||||
const WebReleaseBundle(this.webRenderer);
|
const WebReleaseBundle();
|
||||||
|
|
||||||
final WebRendererMode webRenderer;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'web_release_bundle';
|
String get name => 'web_release_bundle';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Target> get dependencies => <Target>[
|
List<Target> get dependencies => const <Target>[
|
||||||
Dart2JSTarget(webRenderer),
|
Dart2JSTarget(),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -446,19 +441,18 @@ class WebBuiltInAssets extends Target {
|
|||||||
|
|
||||||
/// Generate a service worker for a web target.
|
/// Generate a service worker for a web target.
|
||||||
class WebServiceWorker extends Target {
|
class WebServiceWorker extends Target {
|
||||||
const WebServiceWorker(this.fileSystem, this.cache, this.webRenderer);
|
const WebServiceWorker(this.fileSystem, this.cache);
|
||||||
|
|
||||||
final FileSystem fileSystem;
|
final FileSystem fileSystem;
|
||||||
final Cache cache;
|
final Cache cache;
|
||||||
final WebRendererMode webRenderer;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'web_service_worker';
|
String get name => 'web_service_worker';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Target> get dependencies => <Target>[
|
List<Target> get dependencies => <Target>[
|
||||||
Dart2JSTarget(webRenderer),
|
const Dart2JSTarget(),
|
||||||
WebReleaseBundle(webRenderer),
|
const WebReleaseBundle(),
|
||||||
WebBuiltInAssets(fileSystem, cache),
|
WebBuiltInAssets(fileSystem, cache),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import '../build_system/targets/deferred_components.dart';
|
|||||||
import '../build_system/targets/ios.dart';
|
import '../build_system/targets/ios.dart';
|
||||||
import '../build_system/targets/linux.dart';
|
import '../build_system/targets/linux.dart';
|
||||||
import '../build_system/targets/macos.dart';
|
import '../build_system/targets/macos.dart';
|
||||||
|
import '../build_system/targets/web.dart';
|
||||||
import '../build_system/targets/windows.dart';
|
import '../build_system/targets/windows.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../convert.dart';
|
import '../convert.dart';
|
||||||
@ -47,6 +48,8 @@ List<Target> _kDefaultTargets = <Target>[
|
|||||||
const ProfileBundleLinuxAssets(TargetPlatform.linux_arm64),
|
const ProfileBundleLinuxAssets(TargetPlatform.linux_arm64),
|
||||||
const ReleaseBundleLinuxAssets(TargetPlatform.linux_x64),
|
const ReleaseBundleLinuxAssets(TargetPlatform.linux_x64),
|
||||||
const ReleaseBundleLinuxAssets(TargetPlatform.linux_arm64),
|
const ReleaseBundleLinuxAssets(TargetPlatform.linux_arm64),
|
||||||
|
// Web targets
|
||||||
|
WebServiceWorker(globals.fs, globals.cache),
|
||||||
const ReleaseAndroidApplication(),
|
const ReleaseAndroidApplication(),
|
||||||
// This is a one-off rule for bundle and aot compat.
|
// This is a one-off rule for bundle and aot compat.
|
||||||
const CopyFlutterBundle(),
|
const CopyFlutterBundle(),
|
||||||
|
@ -741,8 +741,7 @@ class DefaultResidentCompiler implements ResidentCompiler {
|
|||||||
{String? additionalSourceUri}
|
{String? additionalSourceUri}
|
||||||
) async {
|
) async {
|
||||||
final String frontendServer = _artifacts.getArtifactPath(
|
final String frontendServer = _artifacts.getArtifactPath(
|
||||||
Artifact.frontendServerSnapshotForEngineDartSdk,
|
Artifact.frontendServerSnapshotForEngineDartSdk
|
||||||
platform: (targetModel == TargetModel.dartdevc) ? TargetPlatform.web_javascript : null,
|
|
||||||
);
|
);
|
||||||
final List<String> command = <String>[
|
final List<String> command = <String>[
|
||||||
_artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
_artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
||||||
|
@ -170,12 +170,13 @@ Future<List<String>> _xcodeBuildSettingsLines({
|
|||||||
final String buildNumber = parsedBuildNumber(manifest: project.manifest, buildInfo: buildInfo) ?? '1';
|
final String buildNumber = parsedBuildNumber(manifest: project.manifest, buildInfo: buildInfo) ?? '1';
|
||||||
xcodeBuildSettings.add('FLUTTER_BUILD_NUMBER=$buildNumber');
|
xcodeBuildSettings.add('FLUTTER_BUILD_NUMBER=$buildNumber');
|
||||||
|
|
||||||
final LocalEngineInfo? localEngineInfo = globals.artifacts?.localEngineInfo;
|
final Artifacts? artifacts = globals.artifacts;
|
||||||
if (localEngineInfo != null) {
|
if (artifacts is LocalEngineArtifacts) {
|
||||||
final String engineOutPath = localEngineInfo.engineOutPath;
|
final LocalEngineArtifacts localEngineArtifacts = artifacts;
|
||||||
|
final String engineOutPath = localEngineArtifacts.engineOutPath;
|
||||||
xcodeBuildSettings.add('FLUTTER_ENGINE=${globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath))}');
|
xcodeBuildSettings.add('FLUTTER_ENGINE=${globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath))}');
|
||||||
|
|
||||||
final String localEngineName = localEngineInfo.localEngineName;
|
final String localEngineName = localEngineArtifacts.localEngineName;
|
||||||
xcodeBuildSettings.add('LOCAL_ENGINE=$localEngineName');
|
xcodeBuildSettings.add('LOCAL_ENGINE=$localEngineName');
|
||||||
|
|
||||||
// Tell Xcode not to build universal binaries for local engines, which are
|
// Tell Xcode not to build universal binaries for local engines, which are
|
||||||
|
@ -53,11 +53,12 @@ Future<void> buildLinux(
|
|||||||
// step.
|
// step.
|
||||||
final Map<String, String> environmentConfig = buildInfo.toEnvironmentConfig();
|
final Map<String, String> environmentConfig = buildInfo.toEnvironmentConfig();
|
||||||
environmentConfig['FLUTTER_TARGET'] = target;
|
environmentConfig['FLUTTER_TARGET'] = target;
|
||||||
final LocalEngineInfo? localEngineInfo = globals.artifacts?.localEngineInfo;
|
final Artifacts? artifacts = globals.artifacts;
|
||||||
if (localEngineInfo != null) {
|
if (artifacts is LocalEngineArtifacts) {
|
||||||
final String engineOutPath = localEngineInfo.engineOutPath;
|
final LocalEngineArtifacts localEngineArtifacts = artifacts;
|
||||||
|
final String engineOutPath = localEngineArtifacts.engineOutPath;
|
||||||
environmentConfig['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath));
|
environmentConfig['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath));
|
||||||
environmentConfig['LOCAL_ENGINE'] = localEngineInfo.localEngineName;
|
environmentConfig['LOCAL_ENGINE'] = localEngineArtifacts.localEngineName;
|
||||||
}
|
}
|
||||||
writeGeneratedCmakeConfig(Cache.flutterRoot!, linuxProject, buildInfo, environmentConfig);
|
writeGeneratedCmakeConfig(Cache.flutterRoot!, linuxProject, buildInfo, environmentConfig);
|
||||||
|
|
||||||
|
@ -107,15 +107,15 @@ class FlutterDevice {
|
|||||||
// used to file a bug, but the compiler will still start up correctly.
|
// used to file a bug, but the compiler will still start up correctly.
|
||||||
if (targetPlatform == TargetPlatform.web_javascript) {
|
if (targetPlatform == TargetPlatform.web_javascript) {
|
||||||
// TODO(zanderso): consistently provide these flags across platforms.
|
// TODO(zanderso): consistently provide these flags across platforms.
|
||||||
late String platformDillName;
|
late HostArtifact platformDillArtifact;
|
||||||
final List<String> extraFrontEndOptions = List<String>.of(buildInfo.extraFrontEndOptions);
|
final List<String> extraFrontEndOptions = List<String>.of(buildInfo.extraFrontEndOptions);
|
||||||
if (buildInfo.nullSafetyMode == NullSafetyMode.unsound) {
|
if (buildInfo.nullSafetyMode == NullSafetyMode.unsound) {
|
||||||
platformDillName = 'ddc_outline.dill';
|
platformDillArtifact = HostArtifact.webPlatformKernelDill;
|
||||||
if (!extraFrontEndOptions.contains('--no-sound-null-safety')) {
|
if (!extraFrontEndOptions.contains('--no-sound-null-safety')) {
|
||||||
extraFrontEndOptions.add('--no-sound-null-safety');
|
extraFrontEndOptions.add('--no-sound-null-safety');
|
||||||
}
|
}
|
||||||
} else if (buildInfo.nullSafetyMode == NullSafetyMode.sound) {
|
} else if (buildInfo.nullSafetyMode == NullSafetyMode.sound) {
|
||||||
platformDillName = 'ddc_outline_sound.dill';
|
platformDillArtifact = HostArtifact.webPlatformSoundKernelDill;
|
||||||
if (!extraFrontEndOptions.contains('--sound-null-safety')) {
|
if (!extraFrontEndOptions.contains('--sound-null-safety')) {
|
||||||
extraFrontEndOptions.add('--sound-null-safety');
|
extraFrontEndOptions.add('--sound-null-safety');
|
||||||
}
|
}
|
||||||
@ -123,11 +123,6 @@ class FlutterDevice {
|
|||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String platformDillPath = globals.fs.path.join(
|
|
||||||
getWebPlatformBinariesDirectory(globals.artifacts!, buildInfo.webRenderer).path,
|
|
||||||
platformDillName
|
|
||||||
);
|
|
||||||
|
|
||||||
generator = ResidentCompiler(
|
generator = ResidentCompiler(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path,
|
globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path,
|
||||||
buildMode: buildInfo.mode,
|
buildMode: buildInfo.mode,
|
||||||
@ -144,7 +139,9 @@ class FlutterDevice {
|
|||||||
assumeInitializeFromDillUpToDate: buildInfo.assumeInitializeFromDillUpToDate,
|
assumeInitializeFromDillUpToDate: buildInfo.assumeInitializeFromDillUpToDate,
|
||||||
targetModel: TargetModel.dartdevc,
|
targetModel: TargetModel.dartdevc,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
platformDill: globals.fs.file(platformDillPath).absolute.uri.toString(),
|
platformDill: globals.fs.file(globals.artifacts!
|
||||||
|
.getHostArtifact(platformDillArtifact))
|
||||||
|
.absolute.uri.toString(),
|
||||||
dartDefines: buildInfo.dartDefines,
|
dartDefines: buildInfo.dartDefines,
|
||||||
librariesSpec: globals.fs.file(globals.artifacts!
|
librariesSpec: globals.fs.file(globals.artifacts!
|
||||||
.getHostArtifact(HostArtifact.flutterWebLibrariesJson)).uri.toString(),
|
.getHostArtifact(HostArtifact.flutterWebLibrariesJson)).uri.toString(),
|
||||||
|
@ -29,7 +29,6 @@ import '../features.dart';
|
|||||||
import '../globals.dart' as globals;
|
import '../globals.dart' as globals;
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../reporting/reporting.dart';
|
import '../reporting/reporting.dart';
|
||||||
import '../web/compile.dart';
|
|
||||||
import 'flutter_command_runner.dart';
|
import 'flutter_command_runner.dart';
|
||||||
|
|
||||||
export '../cache.dart' show DevelopmentArtifact;
|
export '../cache.dart' show DevelopmentArtifact;
|
||||||
@ -123,7 +122,6 @@ class FlutterOptions {
|
|||||||
static const String kFatalWarnings = 'fatal-warnings';
|
static const String kFatalWarnings = 'fatal-warnings';
|
||||||
static const String kUseApplicationBinary = 'use-application-binary';
|
static const String kUseApplicationBinary = 'use-application-binary';
|
||||||
static const String kWebBrowserFlag = 'web-browser-flag';
|
static const String kWebBrowserFlag = 'web-browser-flag';
|
||||||
static const String kWebRendererFlag = 'web-renderer';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// flutter command categories for usage.
|
/// flutter command categories for usage.
|
||||||
@ -151,25 +149,17 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
/// The flag name for whether or not to use ipv6.
|
/// The flag name for whether or not to use ipv6.
|
||||||
static const String ipv6Flag = 'ipv6';
|
static const String ipv6Flag = 'ipv6';
|
||||||
|
|
||||||
/// Maps command line web renderer strings to the corresponding web renderer mode
|
/// The map used to convert web-renderer option to a List of dart-defines.
|
||||||
static const Map<String, WebRendererMode> _webRendererModeMap =
|
static const Map<String, Iterable<String>> _webRendererDartDefines =
|
||||||
<String, WebRendererMode> {
|
<String, Iterable<String>> {
|
||||||
'auto': WebRendererMode.autoDetect,
|
'auto': <String>[
|
||||||
'canvaskit': WebRendererMode.canvaskit,
|
|
||||||
'html': WebRendererMode.html,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// The map used to convert web renderer mode to a List of dart-defines.
|
|
||||||
static const Map<WebRendererMode, Iterable<String>> _webRendererDartDefines =
|
|
||||||
<WebRendererMode, Iterable<String>> {
|
|
||||||
WebRendererMode.autoDetect: <String>[
|
|
||||||
'FLUTTER_WEB_AUTO_DETECT=true',
|
'FLUTTER_WEB_AUTO_DETECT=true',
|
||||||
],
|
],
|
||||||
WebRendererMode.canvaskit: <String>[
|
'canvaskit': <String>[
|
||||||
'FLUTTER_WEB_AUTO_DETECT=false',
|
'FLUTTER_WEB_AUTO_DETECT=false',
|
||||||
'FLUTTER_WEB_USE_SKIA=true',
|
'FLUTTER_WEB_USE_SKIA=true',
|
||||||
],
|
],
|
||||||
WebRendererMode.html: <String>[
|
'html': <String>[
|
||||||
'FLUTTER_WEB_AUTO_DETECT=false',
|
'FLUTTER_WEB_AUTO_DETECT=false',
|
||||||
'FLUTTER_WEB_USE_SKIA=false',
|
'FLUTTER_WEB_USE_SKIA=false',
|
||||||
],
|
],
|
||||||
@ -630,8 +620,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void usesWebRendererOption() {
|
void usesWebRendererOption() {
|
||||||
argParser.addOption(
|
argParser.addOption('web-renderer',
|
||||||
FlutterOptions.kWebRendererFlag,
|
|
||||||
defaultsTo: 'auto',
|
defaultsTo: 'auto',
|
||||||
allowed: <String>['auto', 'canvaskit', 'html'],
|
allowed: <String>['auto', 'canvaskit', 'html'],
|
||||||
help: 'The renderer implementation to use when building for the web.',
|
help: 'The renderer implementation to use when building for the web.',
|
||||||
@ -1155,13 +1144,8 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
? stringsArg(FlutterOptions.kDartDefinesOption)
|
? stringsArg(FlutterOptions.kDartDefinesOption)
|
||||||
: <String>[];
|
: <String>[];
|
||||||
|
|
||||||
WebRendererMode webRenderer = WebRendererMode.autoDetect;
|
if (argParser.options.containsKey('web-renderer')) {
|
||||||
if (argParser.options.containsKey(FlutterOptions.kWebRendererFlag)) {
|
dartDefines = updateDartDefines(dartDefines, stringArgDeprecated('web-renderer')!);
|
||||||
final WebRendererMode? mappedMode = _webRendererModeMap[stringArgDeprecated(FlutterOptions.kWebRendererFlag)!];
|
|
||||||
if (mappedMode != null) {
|
|
||||||
webRenderer = mappedMode;
|
|
||||||
}
|
|
||||||
dartDefines = updateDartDefines(dartDefines, webRenderer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object>? defineConfigJsonMap;
|
Map<String, Object>? defineConfigJsonMap;
|
||||||
@ -1208,7 +1192,6 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
dartDefines: dartDefines,
|
dartDefines: dartDefines,
|
||||||
bundleSkSLPath: bundleSkSLPath,
|
bundleSkSLPath: bundleSkSLPath,
|
||||||
dartExperiments: experiments,
|
dartExperiments: experiments,
|
||||||
webRenderer: webRenderer,
|
|
||||||
performanceMeasurementFile: performanceMeasurementFile,
|
performanceMeasurementFile: performanceMeasurementFile,
|
||||||
dartDefineConfigJsonMap: defineConfigJsonMap,
|
dartDefineConfigJsonMap: defineConfigJsonMap,
|
||||||
packagesPath: packagesPath ?? globals.fs.path.absolute('.dart_tool', 'package_config.json'),
|
packagesPath: packagesPath ?? globals.fs.path.absolute('.dart_tool', 'package_config.json'),
|
||||||
@ -1299,7 +1282,7 @@ abstract class FlutterCommand extends Command<void> {
|
|||||||
|
|
||||||
/// Updates dart-defines based on [webRenderer].
|
/// Updates dart-defines based on [webRenderer].
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
static List<String> updateDartDefines(List<String> dartDefines, WebRendererMode webRenderer) {
|
static List<String> updateDartDefines(List<String> dartDefines, String webRenderer) {
|
||||||
final Set<String> dartDefinesSet = dartDefines.toSet();
|
final Set<String> dartDefinesSet = dartDefines.toSet();
|
||||||
if (!dartDefines.any((String d) => d.startsWith('FLUTTER_WEB_AUTO_DETECT='))
|
if (!dartDefines.any((String d) => d.startsWith('FLUTTER_WEB_AUTO_DETECT='))
|
||||||
&& dartDefines.any((String d) => d.startsWith('FLUTTER_WEB_USE_SKIA='))) {
|
&& dartDefines.any((String d) => d.startsWith('FLUTTER_WEB_USE_SKIA='))) {
|
||||||
|
@ -96,13 +96,7 @@ class FlutterCommandRunner extends CommandRunner<void> {
|
|||||||
hide: !verboseHelp,
|
hide: !verboseHelp,
|
||||||
help: 'Name of a build output within the engine out directory, if you are building Flutter locally.\n'
|
help: 'Name of a build output within the engine out directory, if you are building Flutter locally.\n'
|
||||||
'Use this to select a specific version of the engine if you have built multiple engine targets.\n'
|
'Use this to select a specific version of the engine if you have built multiple engine targets.\n'
|
||||||
'This path is relative to "--local-engine-src-path" (see above).');
|
'This path is relative to "--local-engine-src-path" or "--local-engine-src-out" (q.v.).');
|
||||||
|
|
||||||
argParser.addOption('local-web-sdk',
|
|
||||||
hide: !verboseHelp,
|
|
||||||
help: 'Name of a build output within the engine out directory, if you are building Flutter locally.\n'
|
|
||||||
'Use this to select a specific version of the web sdk if you have built multiple engine targets.\n'
|
|
||||||
'This path is relative to "--local-engine-src-path" (see above).');
|
|
||||||
|
|
||||||
if (verboseHelp) {
|
if (verboseHelp) {
|
||||||
argParser.addSeparator('Options for testing the "flutter" tool itself:');
|
argParser.addSeparator('Options for testing the "flutter" tool itself:');
|
||||||
@ -222,10 +216,9 @@ class FlutterCommandRunner extends CommandRunner<void> {
|
|||||||
|
|
||||||
// Set up the tooling configuration.
|
// Set up the tooling configuration.
|
||||||
final EngineBuildPaths? engineBuildPaths = await globals.localEngineLocator?.findEnginePath(
|
final EngineBuildPaths? engineBuildPaths = await globals.localEngineLocator?.findEnginePath(
|
||||||
engineSourcePath: topLevelResults['local-engine-src-path'] as String?,
|
topLevelResults['local-engine-src-path'] as String?,
|
||||||
localEngine: topLevelResults['local-engine'] as String?,
|
topLevelResults['local-engine'] as String?,
|
||||||
localWebSdk: topLevelResults['local-web-sdk'] as String?,
|
topLevelResults['packages'] as String?,
|
||||||
packagePath: topLevelResults['packages'] as String?,
|
|
||||||
);
|
);
|
||||||
if (engineBuildPaths != null) {
|
if (engineBuildPaths != null) {
|
||||||
contextOverrides.addAll(<Type, Object?>{
|
contextOverrides.addAll(<Type, Object?>{
|
||||||
|
@ -46,23 +46,17 @@ class LocalEngineLocator {
|
|||||||
final UserMessages _userMessages;
|
final UserMessages _userMessages;
|
||||||
|
|
||||||
/// Returns the engine build path of a local engine if one is located, otherwise `null`.
|
/// Returns the engine build path of a local engine if one is located, otherwise `null`.
|
||||||
Future<EngineBuildPaths?> findEnginePath({String? engineSourcePath, String? localEngine, String? localWebSdk, String? packagePath}) async {
|
Future<EngineBuildPaths?> findEnginePath(String? engineSourcePath, String? localEngine, String? packagePath) async {
|
||||||
engineSourcePath ??= _platform.environment[kFlutterEngineEnvironmentVariableName];
|
engineSourcePath ??= _platform.environment[kFlutterEngineEnvironmentVariableName];
|
||||||
|
|
||||||
if (engineSourcePath == null) {
|
if (engineSourcePath == null && localEngine != null) {
|
||||||
try {
|
try {
|
||||||
if (localEngine != null) {
|
engineSourcePath = _findEngineSourceByLocalEngine(localEngine);
|
||||||
engineSourcePath = _findEngineSourceByBuildPath(localEngine);
|
|
||||||
}
|
|
||||||
if (localWebSdk != null) {
|
|
||||||
engineSourcePath ??= _findEngineSourceByBuildPath(localWebSdk);
|
|
||||||
}
|
|
||||||
engineSourcePath ??= await _findEngineSourceByPackageConfig(packagePath);
|
engineSourcePath ??= await _findEngineSourceByPackageConfig(packagePath);
|
||||||
} on FileSystemException catch (e) {
|
} on FileSystemException catch (e) {
|
||||||
_logger.printTrace('Local engine auto-detection file exception: $e');
|
_logger.printTrace('Local engine auto-detection file exception: $e');
|
||||||
engineSourcePath = null;
|
engineSourcePath = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If engineSourcePath is still not set, try to determine it by flutter root.
|
// If engineSourcePath is still not set, try to determine it by flutter root.
|
||||||
engineSourcePath ??= _tryEnginePath(
|
engineSourcePath ??= _tryEnginePath(
|
||||||
_fileSystem.path.join(_fileSystem.directory(_flutterRoot).parent.path, 'engine', 'src'),
|
_fileSystem.path.join(_fileSystem.directory(_flutterRoot).parent.path, 'engine', 'src'),
|
||||||
@ -78,9 +72,9 @@ class LocalEngineLocator {
|
|||||||
|
|
||||||
if (engineSourcePath != null) {
|
if (engineSourcePath != null) {
|
||||||
_logger.printTrace('Local engine source at $engineSourcePath');
|
_logger.printTrace('Local engine source at $engineSourcePath');
|
||||||
return _findEngineBuildPath(localEngine, localWebSdk, engineSourcePath);
|
return _findEngineBuildPath(localEngine, engineSourcePath);
|
||||||
}
|
}
|
||||||
if (localEngine != null || localWebSdk != null) {
|
if (localEngine != null) {
|
||||||
throwToolExit(
|
throwToolExit(
|
||||||
_userMessages.runnerNoEngineSrcDir(
|
_userMessages.runnerNoEngineSrcDir(
|
||||||
kFlutterEnginePackageName,
|
kFlutterEnginePackageName,
|
||||||
@ -92,15 +86,15 @@ class LocalEngineLocator {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _findEngineSourceByBuildPath(String buildPath) {
|
String? _findEngineSourceByLocalEngine(String localEngine) {
|
||||||
// When the local engine is an absolute path to a variant inside the
|
// When the local engine is an absolute path to a variant inside the
|
||||||
// out directory, parse the engine source.
|
// out directory, parse the engine source.
|
||||||
// --local-engine /path/to/cache/builder/src/out/host_debug_unopt
|
// --local-engine /path/to/cache/builder/src/out/host_debug_unopt
|
||||||
if (_fileSystem.path.isAbsolute(buildPath)) {
|
if (_fileSystem.path.isAbsolute(localEngine)) {
|
||||||
final Directory buildDirectory = _fileSystem.directory(buildPath);
|
final Directory localEngineDirectory = _fileSystem.directory(localEngine);
|
||||||
final Directory outDirectory = buildDirectory.parent;
|
final Directory outDirectory = localEngineDirectory.parent;
|
||||||
final Directory srcDirectory = outDirectory.parent;
|
final Directory srcDirectory = outDirectory.parent;
|
||||||
if (buildDirectory.existsSync() && outDirectory.basename == 'out' && srcDirectory.basename == 'src') {
|
if (localEngineDirectory.existsSync() && outDirectory.basename == 'out' && srcDirectory.basename == 'src') {
|
||||||
_logger.printTrace('Parsed engine source from local engine as ${srcDirectory.path}.');
|
_logger.printTrace('Parsed engine source from local engine as ${srcDirectory.path}.');
|
||||||
return srcDirectory.path;
|
return srcDirectory.path;
|
||||||
}
|
}
|
||||||
@ -171,38 +165,26 @@ class LocalEngineLocator {
|
|||||||
return 'host_$tmpBasename';
|
return 'host_$tmpBasename';
|
||||||
}
|
}
|
||||||
|
|
||||||
EngineBuildPaths _findEngineBuildPath(String? localEngine, String? localWebSdk, String enginePath) {
|
EngineBuildPaths _findEngineBuildPath(String? localEngine, String enginePath) {
|
||||||
if (localEngine == null && localWebSdk == null) {
|
if (localEngine == null) {
|
||||||
throwToolExit(_userMessages.runnerLocalEngineOrWebSdkRequired, exitCode: 2);
|
throwToolExit(_userMessages.runnerLocalEngineRequired, exitCode: 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
String? engineBuildPath;
|
final String engineBuildPath = _fileSystem.path.normalize(_fileSystem.path.join(enginePath, 'out', localEngine));
|
||||||
String? engineHostBuildPath;
|
if (!_fileSystem.isDirectorySync(engineBuildPath)) {
|
||||||
if (localEngine != null) {
|
throwToolExit(_userMessages.runnerNoEngineBuild(engineBuildPath), exitCode: 2);
|
||||||
engineBuildPath = _fileSystem.path.normalize(_fileSystem.path.join(enginePath, 'out', localEngine));
|
|
||||||
if (!_fileSystem.isDirectorySync(engineBuildPath)) {
|
|
||||||
throwToolExit(_userMessages.runnerNoEngineBuild(engineBuildPath), exitCode: 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
final String basename = _fileSystem.path.basename(engineBuildPath);
|
|
||||||
final String hostBasename = _getHostEngineBasename(basename);
|
|
||||||
engineHostBuildPath = _fileSystem.path.normalize(
|
|
||||||
_fileSystem.path.join(_fileSystem.path.dirname(engineBuildPath), hostBasename),
|
|
||||||
);
|
|
||||||
if (!_fileSystem.isDirectorySync(engineHostBuildPath)) {
|
|
||||||
throwToolExit(_userMessages.runnerNoEngineBuild(engineHostBuildPath), exitCode: 2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String? webSdkPath;
|
final String basename = _fileSystem.path.basename(engineBuildPath);
|
||||||
if (localWebSdk != null) {
|
final String hostBasename = _getHostEngineBasename(basename);
|
||||||
webSdkPath = _fileSystem.path.normalize(_fileSystem.path.join(enginePath, 'out', localWebSdk));
|
final String engineHostBuildPath = _fileSystem.path.normalize(
|
||||||
if (!_fileSystem.isDirectorySync(webSdkPath)) {
|
_fileSystem.path.join(_fileSystem.path.dirname(engineBuildPath), hostBasename),
|
||||||
throwToolExit(_userMessages.runnerNoWebSdk(webSdkPath), exitCode: 2);
|
);
|
||||||
}
|
if (!_fileSystem.isDirectorySync(engineHostBuildPath)) {
|
||||||
|
throwToolExit(_userMessages.runnerNoEngineBuild(engineHostBuildPath), exitCode: 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
return EngineBuildPaths(targetEngine: engineBuildPath, webSdk: webSdkPath, hostEngine: engineHostBuildPath);
|
return EngineBuildPaths(targetEngine: engineBuildPath, hostEngine: engineHostBuildPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _tryEnginePath(String enginePath) {
|
String? _tryEnginePath(String enginePath) {
|
||||||
|
@ -50,29 +50,22 @@ class WebTestCompiler {
|
|||||||
required BuildInfo buildInfo,
|
required BuildInfo buildInfo,
|
||||||
}) async {
|
}) async {
|
||||||
LanguageVersion languageVersion = LanguageVersion(2, 8);
|
LanguageVersion languageVersion = LanguageVersion(2, 8);
|
||||||
late final String platformDillName;
|
HostArtifact platformDillArtifact = HostArtifact.webPlatformSoundKernelDill;
|
||||||
|
|
||||||
// TODO(zanderso): to support autodetect this would need to partition the source code into a
|
// 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);
|
final List<String> extraFrontEndOptions = List<String>.of(buildInfo.extraFrontEndOptions);
|
||||||
if (buildInfo.nullSafetyMode == NullSafetyMode.unsound || buildInfo.nullSafetyMode == NullSafetyMode.autodetect) {
|
if (buildInfo.nullSafetyMode == NullSafetyMode.unsound || buildInfo.nullSafetyMode == NullSafetyMode.autodetect) {
|
||||||
platformDillName = 'ddc_outline.dill';
|
platformDillArtifact = HostArtifact.webPlatformKernelDill;
|
||||||
if (!extraFrontEndOptions.contains('--no-sound-null-safety')) {
|
if (!extraFrontEndOptions.contains('--no-sound-null-safety')) {
|
||||||
extraFrontEndOptions.add('--no-sound-null-safety');
|
extraFrontEndOptions.add('--no-sound-null-safety');
|
||||||
}
|
}
|
||||||
} else if (buildInfo.nullSafetyMode == NullSafetyMode.sound) {
|
} else if (buildInfo.nullSafetyMode == NullSafetyMode.sound) {
|
||||||
languageVersion = currentLanguageVersion(_fileSystem, Cache.flutterRoot!);
|
languageVersion = currentLanguageVersion(_fileSystem, Cache.flutterRoot!);
|
||||||
platformDillName = 'ddc_outline_sound.dill';
|
|
||||||
if (!extraFrontEndOptions.contains('--sound-null-safety')) {
|
if (!extraFrontEndOptions.contains('--sound-null-safety')) {
|
||||||
extraFrontEndOptions.add('--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)
|
final Directory outputDirectory = _fileSystem.directory(testOutputDir)
|
||||||
..createSync(recursive: true);
|
..createSync(recursive: true);
|
||||||
final List<File> generatedFiles = <File>[];
|
final List<File> generatedFiles = <File>[];
|
||||||
@ -123,7 +116,9 @@ class WebTestCompiler {
|
|||||||
initializeFromDill: cachedKernelPath,
|
initializeFromDill: cachedKernelPath,
|
||||||
targetModel: TargetModel.dartdevc,
|
targetModel: TargetModel.dartdevc,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
platformDill: platformDillPath,
|
platformDill: _artifacts
|
||||||
|
.getHostArtifact(platformDillArtifact)
|
||||||
|
.absolute.uri.toString(),
|
||||||
dartDefines: buildInfo.dartDefines,
|
dartDefines: buildInfo.dartDefines,
|
||||||
librariesSpec: _artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).uri.toString(),
|
librariesSpec: _artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).uri.toString(),
|
||||||
packagesPath: buildInfo.packagesPath,
|
packagesPath: buildInfo.packagesPath,
|
||||||
|
@ -48,42 +48,40 @@ Future<void> buildWeb(
|
|||||||
final Status status = globals.logger.startProgress('Compiling $target for the Web...');
|
final Status status = globals.logger.startProgress('Compiling $target for the Web...');
|
||||||
final Stopwatch sw = Stopwatch()..start();
|
final Stopwatch sw = Stopwatch()..start();
|
||||||
try {
|
try {
|
||||||
final BuildResult result = await globals.buildSystem.build(
|
final BuildResult result = await globals.buildSystem.build(WebServiceWorker(globals.fs, globals.cache), Environment(
|
||||||
WebServiceWorker(globals.fs, globals.cache, buildInfo.webRenderer),
|
projectDir: globals.fs.currentDirectory,
|
||||||
Environment(
|
outputDir: outputDirectory,
|
||||||
projectDir: globals.fs.currentDirectory,
|
buildDir: flutterProject.directory
|
||||||
outputDir: outputDirectory,
|
.childDirectory('.dart_tool')
|
||||||
buildDir: flutterProject.directory
|
.childDirectory('flutter_build'),
|
||||||
.childDirectory('.dart_tool')
|
defines: <String, String>{
|
||||||
.childDirectory('flutter_build'),
|
kTargetFile: target,
|
||||||
defines: <String, String>{
|
kHasWebPlugins: hasWebPlugins.toString(),
|
||||||
kTargetFile: target,
|
kCspMode: csp.toString(),
|
||||||
kHasWebPlugins: hasWebPlugins.toString(),
|
if (baseHref != null)
|
||||||
kCspMode: csp.toString(),
|
kBaseHref : baseHref,
|
||||||
if (baseHref != null)
|
kSourceMapsEnabled: sourceMaps.toString(),
|
||||||
kBaseHref : baseHref,
|
kNativeNullAssertions: nativeNullAssertions.toString(),
|
||||||
kSourceMapsEnabled: sourceMaps.toString(),
|
if (serviceWorkerStrategy != null)
|
||||||
kNativeNullAssertions: nativeNullAssertions.toString(),
|
kServiceWorkerStrategy: serviceWorkerStrategy,
|
||||||
if (serviceWorkerStrategy != null)
|
if (dart2jsOptimization != null)
|
||||||
kServiceWorkerStrategy: serviceWorkerStrategy,
|
kDart2jsOptimization: dart2jsOptimization,
|
||||||
if (dart2jsOptimization != null)
|
...buildInfo.toBuildSystemEnvironment(),
|
||||||
kDart2jsOptimization: dart2jsOptimization,
|
},
|
||||||
...buildInfo.toBuildSystemEnvironment(),
|
artifacts: globals.artifacts!,
|
||||||
},
|
fileSystem: globals.fs,
|
||||||
artifacts: globals.artifacts!,
|
logger: globals.logger,
|
||||||
fileSystem: globals.fs,
|
processManager: globals.processManager,
|
||||||
logger: globals.logger,
|
platform: globals.platform,
|
||||||
processManager: globals.processManager,
|
usage: globals.flutterUsage,
|
||||||
platform: globals.platform,
|
cacheDir: globals.cache.getRoot(),
|
||||||
usage: globals.flutterUsage,
|
engineVersion: globals.artifacts!.isLocalEngine
|
||||||
cacheDir: globals.cache.getRoot(),
|
? null
|
||||||
engineVersion: globals.artifacts!.isLocalEngine
|
: globals.flutterVersion.engineRevision,
|
||||||
? null
|
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
|
||||||
: globals.flutterVersion.engineRevision,
|
// Web uses a different Dart plugin registry.
|
||||||
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
|
// https://github.com/flutter/flutter/issues/80406
|
||||||
// Web uses a different Dart plugin registry.
|
generateDartPluginRegistry: false,
|
||||||
// https://github.com/flutter/flutter/issues/80406
|
|
||||||
generateDartPluginRegistry: false,
|
|
||||||
));
|
));
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
for (final ExceptionMeasurement measurement in result.exceptions.values) {
|
for (final ExceptionMeasurement measurement in result.exceptions.values) {
|
||||||
|
@ -215,11 +215,11 @@ void _writeGeneratedFlutterConfig(
|
|||||||
'FLUTTER_TARGET': target,
|
'FLUTTER_TARGET': target,
|
||||||
...buildInfo.toEnvironmentConfig(),
|
...buildInfo.toEnvironmentConfig(),
|
||||||
};
|
};
|
||||||
final LocalEngineInfo? localEngineInfo = globals.artifacts?.localEngineInfo;
|
final Artifacts artifacts = globals.artifacts!;
|
||||||
if (localEngineInfo != null) {
|
if (artifacts is LocalEngineArtifacts) {
|
||||||
final String engineOutPath = localEngineInfo.engineOutPath;
|
final String engineOutPath = artifacts.engineOutPath;
|
||||||
environment['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath));
|
environment['FLUTTER_ENGINE'] = globals.fs.path.dirname(globals.fs.path.dirname(engineOutPath));
|
||||||
environment['LOCAL_ENGINE'] = localEngineInfo.localEngineName;
|
environment['LOCAL_ENGINE'] = artifacts.localEngineName;
|
||||||
}
|
}
|
||||||
writeGeneratedCmakeConfig(Cache.flutterRoot!, windowsProject, buildInfo, environment);
|
writeGeneratedCmakeConfig(Cache.flutterRoot!, windowsProject, buildInfo, environment);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ import 'package:flutter_tools/src/reporting/reporting.dart';
|
|||||||
import 'package:flutter_tools/src/resident_runner.dart';
|
import 'package:flutter_tools/src/resident_runner.dart';
|
||||||
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
import 'package:flutter_tools/src/runner/flutter_command.dart';
|
||||||
import 'package:flutter_tools/src/vmservice.dart';
|
import 'package:flutter_tools/src/vmservice.dart';
|
||||||
import 'package:flutter_tools/src/web/compile.dart';
|
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
import 'package:vm_service/vm_service.dart';
|
import 'package:vm_service/vm_service.dart';
|
||||||
|
|
||||||
@ -674,35 +673,35 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('auto web-renderer with no dart-defines', () {
|
test('auto web-renderer with no dart-defines', () {
|
||||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.autoDetect);
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'auto');
|
||||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
|
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('canvaskit web-renderer with no dart-defines', () {
|
test('canvaskit web-renderer with no dart-defines', () {
|
||||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.canvaskit);
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'canvaskit');
|
||||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=true']);
|
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=true']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('html web-renderer with no dart-defines', () {
|
test('html web-renderer with no dart-defines', () {
|
||||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.html);
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'html');
|
||||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=false']);
|
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=false']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('auto web-renderer with existing dart-defines', () {
|
test('auto web-renderer with existing dart-defines', () {
|
||||||
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false'];
|
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false'];
|
||||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.autoDetect);
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'auto');
|
||||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
|
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=true']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('canvaskit web-renderer with no dart-defines', () {
|
test('canvaskit web-renderer with no dart-defines', () {
|
||||||
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false'];
|
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=false'];
|
||||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.canvaskit);
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'canvaskit');
|
||||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=true']);
|
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=true']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('html web-renderer with no dart-defines', () {
|
test('html web-renderer with no dart-defines', () {
|
||||||
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=true'];
|
dartDefines = <String>['FLUTTER_WEB_USE_SKIA=true'];
|
||||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.html);
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'html');
|
||||||
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=false']);
|
expect(dartDefines, <String>['FLUTTER_WEB_AUTO_DETECT=false','FLUTTER_WEB_USE_SKIA=false']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -199,7 +199,7 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('LocalEngineArtifacts', () {
|
group('LocalEngineArtifacts', () {
|
||||||
late Artifacts artifacts;
|
late LocalEngineArtifacts artifacts;
|
||||||
late Cache cache;
|
late Cache cache;
|
||||||
late FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
late Platform platform;
|
late Platform platform;
|
||||||
@ -217,9 +217,9 @@ void main() {
|
|||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
artifacts: <ArtifactSet>[],
|
artifacts: <ArtifactSet>[],
|
||||||
);
|
);
|
||||||
artifacts = CachedLocalEngineArtifacts(
|
artifacts = LocalEngineArtifacts(
|
||||||
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||||
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
|
||||||
cache: cache,
|
cache: cache,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: platform,
|
platform: platform,
|
||||||
@ -435,9 +435,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Looks up dart.exe on windows platforms', () async {
|
testWithoutContext('Looks up dart.exe on windows platforms', () async {
|
||||||
artifacts = CachedLocalEngineArtifacts(
|
artifacts = LocalEngineArtifacts(
|
||||||
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||||
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
|
||||||
cache: cache,
|
cache: cache,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: FakePlatform(operatingSystem: 'windows'),
|
platform: FakePlatform(operatingSystem: 'windows'),
|
||||||
@ -473,9 +473,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Finds dart-sdk in windows prebuilts', () async {
|
testWithoutContext('Finds dart-sdk in windows prebuilts', () async {
|
||||||
artifacts = CachedLocalEngineArtifacts(
|
artifacts = LocalEngineArtifacts(
|
||||||
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||||
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
|
||||||
cache: cache,
|
cache: cache,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: FakePlatform(operatingSystem: 'windows'),
|
platform: FakePlatform(operatingSystem: 'windows'),
|
||||||
@ -498,9 +498,9 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Finds dart-sdk in macos prebuilts', () async {
|
testWithoutContext('Finds dart-sdk in macos prebuilts', () async {
|
||||||
artifacts = CachedLocalEngineArtifacts(
|
artifacts = LocalEngineArtifacts(
|
||||||
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||||
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
|
||||||
cache: cache,
|
cache: cache,
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: FakePlatform(operatingSystem: 'macos'),
|
platform: FakePlatform(operatingSystem: 'macos'),
|
||||||
|
@ -13,7 +13,6 @@ import 'package:flutter_tools/src/build_system/depfile.dart';
|
|||||||
import 'package:flutter_tools/src/build_system/targets/web.dart';
|
import 'package:flutter_tools/src/build_system/targets/web.dart';
|
||||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||||
import 'package:flutter_tools/src/isolated/mustache_template.dart';
|
import 'package:flutter_tools/src/isolated/mustache_template.dart';
|
||||||
import 'package:flutter_tools/src/web/compile.dart';
|
|
||||||
import 'package:flutter_tools/src/web/file_generators/flutter_js.dart' as flutter_js;
|
import 'package:flutter_tools/src/web/file_generators/flutter_js.dart' as flutter_js;
|
||||||
import 'package:flutter_tools/src/web/file_generators/flutter_service_worker_js.dart';
|
import 'package:flutter_tools/src/web/file_generators/flutter_service_worker_js.dart';
|
||||||
|
|
||||||
@ -25,6 +24,7 @@ const List<String> kDart2jsLinuxArgs = <String>[
|
|||||||
'bin/cache/dart-sdk/bin/dart',
|
'bin/cache/dart-sdk/bin/dart',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot',
|
'bin/cache/dart-sdk/bin/snapshots/dart2js.dart.snapshot',
|
||||||
|
'--libraries-spec=bin/cache/flutter_web_sdk/libraries.json',
|
||||||
];
|
];
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@ -100,7 +100,7 @@ void main() {
|
|||||||
webResources.childFile('index.html')
|
webResources.childFile('index.html')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
environment.buildDir.childFile('main.dart.js').createSync();
|
environment.buildDir.childFile('main.dart.js').createSync();
|
||||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
await const WebReleaseBundle().build(environment);
|
||||||
|
|
||||||
expect(environment.outputDir.childFile('version.json'), exists);
|
expect(environment.outputDir.childFile('version.json'), exists);
|
||||||
}));
|
}));
|
||||||
@ -112,7 +112,7 @@ void main() {
|
|||||||
final Directory webResources = environment.projectDir.childDirectory('web');
|
final Directory webResources = environment.projectDir.childDirectory('web');
|
||||||
webResources.childFile('index.html').createSync(recursive: true);
|
webResources.childFile('index.html').createSync(recursive: true);
|
||||||
environment.buildDir.childFile('main.dart.js').createSync();
|
environment.buildDir.childFile('main.dart.js').createSync();
|
||||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
await const WebReleaseBundle().build(environment);
|
||||||
|
|
||||||
final String versionFile = environment.outputDir
|
final String versionFile = environment.outputDir
|
||||||
.childFile('version.json')
|
.childFile('version.json')
|
||||||
@ -130,7 +130,7 @@ void main() {
|
|||||||
<!DOCTYPE html><html><base href="$kBaseHrefPlaceholder"><head></head></html>
|
<!DOCTYPE html><html><base href="$kBaseHrefPlaceholder"><head></head></html>
|
||||||
''');
|
''');
|
||||||
environment.buildDir.childFile('main.dart.js').createSync();
|
environment.buildDir.childFile('main.dart.js').createSync();
|
||||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
await const WebReleaseBundle().build(environment);
|
||||||
|
|
||||||
expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/'));
|
expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/'));
|
||||||
}));
|
}));
|
||||||
@ -143,7 +143,7 @@ void main() {
|
|||||||
<!DOCTYPE html><html><head><base href='/basehreftest/'></head></html>
|
<!DOCTYPE html><html><head><base href='/basehreftest/'></head></html>
|
||||||
''');
|
''');
|
||||||
environment.buildDir.childFile('main.dart.js').createSync();
|
environment.buildDir.childFile('main.dart.js').createSync();
|
||||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
await const WebReleaseBundle().build(environment);
|
||||||
|
|
||||||
expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/'));
|
expect(environment.outputDir.childFile('index.html').readAsStringSync(), contains('/basehreftest/'));
|
||||||
}));
|
}));
|
||||||
@ -165,7 +165,7 @@ void main() {
|
|||||||
.writeAsStringSync('A');
|
.writeAsStringSync('A');
|
||||||
environment.buildDir.childFile('main.dart.js').createSync();
|
environment.buildDir.childFile('main.dart.js').createSync();
|
||||||
|
|
||||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
await const WebReleaseBundle().build(environment);
|
||||||
|
|
||||||
expect(environment.outputDir.childFile('foo.txt')
|
expect(environment.outputDir.childFile('foo.txt')
|
||||||
.readAsStringSync(), 'A');
|
.readAsStringSync(), 'A');
|
||||||
@ -177,7 +177,7 @@ void main() {
|
|||||||
// Update to arbitrary resource file triggers rebuild.
|
// Update to arbitrary resource file triggers rebuild.
|
||||||
webResources.childFile('foo.txt').writeAsStringSync('B');
|
webResources.childFile('foo.txt').writeAsStringSync('B');
|
||||||
|
|
||||||
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
await const WebReleaseBundle().build(environment);
|
||||||
|
|
||||||
expect(environment.outputDir.childFile('foo.txt')
|
expect(environment.outputDir.childFile('foo.txt')
|
||||||
.readAsStringSync(), 'B');
|
.readAsStringSync(), 'B');
|
||||||
@ -333,7 +333,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
@ -346,7 +345,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O4',
|
'-O4',
|
||||||
@ -358,7 +356,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -370,7 +368,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'--enable-experiment=non-nullable',
|
'--enable-experiment=non-nullable',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
@ -384,7 +381,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'--enable-experiment=non-nullable',
|
'--enable-experiment=non-nullable',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
@ -396,7 +392,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -406,7 +402,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
@ -419,7 +414,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O4',
|
'-O4',
|
||||||
@ -430,7 +424,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -440,7 +434,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
@ -453,7 +446,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O4',
|
'-O4',
|
||||||
@ -463,7 +455,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -474,7 +466,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'--native-null-assertions',
|
'--native-null-assertions',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
@ -488,7 +479,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'--native-null-assertions',
|
'--native-null-assertions',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
@ -499,7 +489,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -510,7 +500,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
@ -523,7 +512,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O3',
|
'-O3',
|
||||||
@ -533,7 +521,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -543,7 +531,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
@ -556,7 +543,7 @@ void main() {
|
|||||||
.writeAsStringSync('file:///a.dart');
|
.writeAsStringSync('file:///a.dart');
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
|
|
||||||
expect(environment.buildDir.childFile('dart2js.d'), exists);
|
expect(environment.buildDir.childFile('dart2js.d'), exists);
|
||||||
final Depfile depfile = depfileService.parse(environment.buildDir.childFile('dart2js.d'));
|
final Depfile depfile = depfileService.parse(environment.buildDir.childFile('dart2js.d'));
|
||||||
@ -574,7 +561,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'-DFOO=bar',
|
'-DFOO=bar',
|
||||||
'-DBAZ=qux',
|
'-DBAZ=qux',
|
||||||
@ -589,7 +575,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'-DFOO=bar',
|
'-DFOO=bar',
|
||||||
'-DBAZ=qux',
|
'-DBAZ=qux',
|
||||||
@ -601,7 +586,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -612,7 +597,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'-o',
|
'-o',
|
||||||
environment.buildDir.childFile('app.dill').absolute.path,
|
environment.buildDir.childFile('app.dill').absolute.path,
|
||||||
@ -624,7 +608,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'-O4',
|
'-O4',
|
||||||
'-o',
|
'-o',
|
||||||
@ -633,7 +616,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -645,7 +628,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'-DFOO=bar',
|
'-DFOO=bar',
|
||||||
'-DBAZ=qux',
|
'-DBAZ=qux',
|
||||||
@ -660,7 +642,6 @@ void main() {
|
|||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/auto',
|
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'-DFOO=bar',
|
'-DFOO=bar',
|
||||||
'-DBAZ=qux',
|
'-DBAZ=qux',
|
||||||
@ -673,41 +654,7 @@ void main() {
|
|||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
await const Dart2JSTarget().build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
ProcessManager: () => processManager,
|
|
||||||
}));
|
|
||||||
|
|
||||||
test('Dart2JSTarget uses correct platform binaries with canvaskit web renderer', () => testbed.run(() async {
|
|
||||||
environment.defines[kBuildMode] = 'profile';
|
|
||||||
processManager.addCommand(FakeCommand(
|
|
||||||
command: <String>[
|
|
||||||
...kDart2jsLinuxArgs,
|
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/canvaskit',
|
|
||||||
'-Ddart.vm.profile=true',
|
|
||||||
'--no-source-maps',
|
|
||||||
'-o',
|
|
||||||
environment.buildDir.childFile('app.dill').absolute.path,
|
|
||||||
'--packages=.dart_tool/package_config.json',
|
|
||||||
'--cfe-only',
|
|
||||||
environment.buildDir.childFile('main.dart').absolute.path,
|
|
||||||
]
|
|
||||||
));
|
|
||||||
processManager.addCommand(FakeCommand(
|
|
||||||
command: <String>[
|
|
||||||
...kDart2jsLinuxArgs,
|
|
||||||
'--platform-binaries=bin/cache/flutter_web_sdk/kernel/platforms/canvaskit',
|
|
||||||
'-Ddart.vm.profile=true',
|
|
||||||
'--no-source-maps',
|
|
||||||
'-O4',
|
|
||||||
'--no-minify',
|
|
||||||
'-o',
|
|
||||||
environment.buildDir.childFile('main.dart.js').absolute.path,
|
|
||||||
environment.buildDir.childFile('app.dill').absolute.path,
|
|
||||||
]
|
|
||||||
));
|
|
||||||
|
|
||||||
await const Dart2JSTarget(WebRendererMode.canvaskit).build(environment);
|
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
@ -734,7 +681,7 @@ void main() {
|
|||||||
environment.outputDir.childDirectory('a').childFile('a.txt')
|
environment.outputDir.childDirectory('a').childFile('a.txt')
|
||||||
..createSync(recursive: true)
|
..createSync(recursive: true)
|
||||||
..writeAsStringSync('A');
|
..writeAsStringSync('A');
|
||||||
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).build(environment);
|
await WebServiceWorker(globals.fs, globals.cache).build(environment);
|
||||||
|
|
||||||
expect(environment.outputDir.childFile('flutter_service_worker.js'), exists);
|
expect(environment.outputDir.childFile('flutter_service_worker.js'), exists);
|
||||||
// Contains file hash.
|
// Contains file hash.
|
||||||
@ -753,7 +700,7 @@ void main() {
|
|||||||
environment.outputDir
|
environment.outputDir
|
||||||
.childFile('index.html')
|
.childFile('index.html')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).build(environment);
|
await WebServiceWorker(globals.fs, globals.cache).build(environment);
|
||||||
|
|
||||||
expect(environment.outputDir.childFile('flutter_service_worker.js'), exists);
|
expect(environment.outputDir.childFile('flutter_service_worker.js'), exists);
|
||||||
// Contains file hash for both `/` and index.html.
|
// Contains file hash for both `/` and index.html.
|
||||||
@ -771,7 +718,7 @@ void main() {
|
|||||||
environment.outputDir
|
environment.outputDir
|
||||||
.childFile('main.dart.js.map')
|
.childFile('main.dart.js.map')
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).build(environment);
|
await WebServiceWorker(globals.fs, globals.cache).build(environment);
|
||||||
|
|
||||||
// No caching of source maps.
|
// No caching of source maps.
|
||||||
expect(environment.outputDir.childFile('flutter_service_worker.js').readAsStringSync(),
|
expect(environment.outputDir.childFile('flutter_service_worker.js').readAsStringSync(),
|
||||||
|
@ -33,7 +33,6 @@ import 'package:flutter_tools/src/run_cold.dart';
|
|||||||
import 'package:flutter_tools/src/run_hot.dart';
|
import 'package:flutter_tools/src/run_hot.dart';
|
||||||
import 'package:flutter_tools/src/version.dart';
|
import 'package:flutter_tools/src/version.dart';
|
||||||
import 'package:flutter_tools/src/vmservice.dart';
|
import 'package:flutter_tools/src/vmservice.dart';
|
||||||
import 'package:flutter_tools/src/web/compile.dart' show WebRendererMode;
|
|
||||||
import 'package:package_config/package_config.dart';
|
import 'package:package_config/package_config.dart';
|
||||||
import 'package:test/fake.dart';
|
import 'package:test/fake.dart';
|
||||||
import 'package:vm_service/vm_service.dart' as vm_service;
|
import 'package:vm_service/vm_service.dart' as vm_service;
|
||||||
@ -1921,28 +1920,6 @@ flutter:
|
|||||||
expect(fakeVmServiceHost?.hasRemainingExpectations, false);
|
expect(fakeVmServiceHost?.hasRemainingExpectations, false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
testUsingContext('FlutterDevice uses canvaskit platform dill when canvaskit mode is selected', () async {
|
|
||||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
|
||||||
final FakeDevice device = FakeDevice(targetPlatform: TargetPlatform.web_javascript);
|
|
||||||
final DefaultResidentCompiler? residentCompiler = (await FlutterDevice.create(
|
|
||||||
device,
|
|
||||||
buildInfo: const BuildInfo(
|
|
||||||
BuildMode.debug,
|
|
||||||
'',
|
|
||||||
treeShakeIcons: false,
|
|
||||||
webRenderer: WebRendererMode.canvaskit,
|
|
||||||
),
|
|
||||||
target: null,
|
|
||||||
platform: FakePlatform(),
|
|
||||||
)).generator as DefaultResidentCompiler?;
|
|
||||||
|
|
||||||
expect(residentCompiler!.platformDill, 'file:///HostArtifact.webPlatformCanvasKitDillDirectory/ddc_outline_sound.dill');
|
|
||||||
}, overrides: <Type, Generator>{
|
|
||||||
Artifacts: () => Artifacts.test(),
|
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
|
||||||
});
|
|
||||||
|
|
||||||
testUsingContext('FlutterDevice uses dartdevc configuration when targeting web', () async {
|
testUsingContext('FlutterDevice uses dartdevc configuration when targeting web', () async {
|
||||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
|
||||||
final FakeDevice device = FakeDevice(targetPlatform: TargetPlatform.web_javascript);
|
final FakeDevice device = FakeDevice(targetPlatform: TargetPlatform.web_javascript);
|
||||||
@ -1966,7 +1943,7 @@ flutter:
|
|||||||
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
||||||
expect(residentCompiler.sdkRoot,
|
expect(residentCompiler.sdkRoot,
|
||||||
'${globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
|
'${globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
|
||||||
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformAutoDillDirectory/ddc_outline.dill');
|
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelDill');
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Artifacts: () => Artifacts.test(),
|
Artifacts: () => Artifacts.test(),
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
@ -1997,7 +1974,7 @@ flutter:
|
|||||||
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
expect(residentCompiler.targetModel, TargetModel.dartdevc);
|
||||||
expect(residentCompiler.sdkRoot,
|
expect(residentCompiler.sdkRoot,
|
||||||
'${globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
|
'${globals.artifacts!.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
|
||||||
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformAutoDillDirectory/ddc_outline_sound.dill');
|
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformSoundKernelDill');
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Artifacts: () => Artifacts.test(),
|
Artifacts: () => Artifacts.test(),
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
|
@ -43,7 +43,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
await localEngineLocator.findEnginePath(null, 'ios_debug', null),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||||
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
||||||
@ -58,7 +58,7 @@ void main() {
|
|||||||
.writeAsStringSync('sky_engine:file:///symlink/src/out/ios_debug/gen/dart-pkg/sky_engine/lib/');
|
.writeAsStringSync('sky_engine:file:///symlink/src/out/ios_debug/gen/dart-pkg/sky_engine/lib/');
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
await localEngineLocator.findEnginePath(null, 'ios_debug', null),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: '/symlink/src/out/host_debug',
|
hostEngine: '/symlink/src/out/host_debug',
|
||||||
targetEngine: '/symlink/src/out/ios_debug',
|
targetEngine: '/symlink/src/out/ios_debug',
|
||||||
@ -84,7 +84,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(engineSourcePath: '$kArbitraryEngineRoot/src', localEngine: 'ios_debug'),
|
await localEngineLocator.findEnginePath('$kArbitraryEngineRoot/src', 'ios_debug', null),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||||
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
||||||
@ -111,7 +111,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
await localEngineLocator.findEnginePath(null, localEngine.path, null),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||||
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
targetEngine: '/arbitrary/engine/src/out/ios_debug',
|
||||||
@ -137,7 +137,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
await localEngineLocator.findEnginePath(null, localEngine.path, null),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
hostEngine: '/arbitrary/engine/src/out/host_debug',
|
||||||
targetEngine: '/arbitrary/engine/src/out/host_debug',
|
targetEngine: '/arbitrary/engine/src/out/host_debug',
|
||||||
@ -161,7 +161,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await expectToolExitLater(
|
await expectToolExitLater(
|
||||||
localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
localEngineLocator.findEnginePath(null, localEngine.path, null),
|
||||||
contains('No Flutter engine build found at /arbitrary/engine/src/out/host_debug'),
|
contains('No Flutter engine build found at /arbitrary/engine/src/out/host_debug'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -190,7 +190,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
await localEngineLocator.findEnginePath(null, 'ios_debug', null),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: 'flutter/engine/src/out/host_debug',
|
hostEngine: 'flutter/engine/src/out/host_debug',
|
||||||
targetEngine: 'flutter/engine/src/out/ios_debug',
|
targetEngine: 'flutter/engine/src/out/ios_debug',
|
||||||
@ -212,7 +212,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
await expectToolExitLater(
|
await expectToolExitLater(
|
||||||
localEngineLocator.findEnginePath(localEngine: '/path/to/nothing'),
|
localEngineLocator.findEnginePath(null, '/path/to/nothing', null),
|
||||||
contains('Unable to detect local Flutter engine src directory'),
|
contains('Unable to detect local Flutter engine src directory'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -236,7 +236,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localWasmEngineLocator.findEnginePath(localEngine: localWasmEngine.path),
|
await localWasmEngineLocator.findEnginePath(null, localWasmEngine.path, null),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: '/arbitrary/engine/src/out/wasm_whatever',
|
hostEngine: '/arbitrary/engine/src/out/wasm_whatever',
|
||||||
targetEngine: '/arbitrary/engine/src/out/wasm_whatever',
|
targetEngine: '/arbitrary/engine/src/out/wasm_whatever',
|
||||||
@ -254,7 +254,7 @@ void main() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localWebEngineLocator.findEnginePath(localEngine: localWebEngine.path),
|
await localWebEngineLocator.findEnginePath(null, localWebEngine.path, null),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: '/arbitrary/engine/src/out/web_whatever',
|
hostEngine: '/arbitrary/engine/src/out/web_whatever',
|
||||||
targetEngine: '/arbitrary/engine/src/out/web_whatever',
|
targetEngine: '/arbitrary/engine/src/out/web_whatever',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user