mirror of
https://github.com/flutter/flutter
synced 2024-10-04 07:19:46 +00:00
Platform binaries reland (#115502)
You can now specify a --local-web-sdk flag to point to a wasm_release folder. This will make it so that only artifacts that pertain to the web sdk are overridden to point to the wasm_release folder. Other artifacts (such as impellerc) will pull from the cache, or from the --local-engine path if that is specified. This also uses precompiled platform kernel files for both ddc and dart2js
This commit is contained in:
parent
08a2635e2b
commit
db1c3e208d
|
@ -107,7 +107,7 @@ Future<void> main(List<String> args) async {
|
||||||
// devtools source code.
|
// devtools source code.
|
||||||
DevtoolsLauncher: () => DevtoolsServerLauncher(
|
DevtoolsLauncher: () => DevtoolsServerLauncher(
|
||||||
processManager: globals.processManager,
|
processManager: globals.processManager,
|
||||||
dartExecutable: globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
dartExecutable: globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||||
logger: globals.logger,
|
logger: globals.logger,
|
||||||
botDetector: globals.botDetector,
|
botDetector: globals.botDetector,
|
||||||
),
|
),
|
||||||
|
|
|
@ -277,22 +277,22 @@ class AndroidGradleBuilder implements AndroidBuilder {
|
||||||
if (!buildInfo.androidGradleDaemon) {
|
if (!buildInfo.androidGradleDaemon) {
|
||||||
command.add('--no-daemon');
|
command.add('--no-daemon');
|
||||||
}
|
}
|
||||||
if (_artifacts is LocalEngineArtifacts) {
|
final LocalEngineInfo? localEngineInfo = _artifacts.localEngineInfo;
|
||||||
final LocalEngineArtifacts localEngineArtifacts = _artifacts as LocalEngineArtifacts;
|
if (localEngineInfo != null) {
|
||||||
final Directory localEngineRepo = _getLocalEngineRepo(
|
final Directory localEngineRepo = _getLocalEngineRepo(
|
||||||
engineOutPath: localEngineArtifacts.engineOutPath,
|
engineOutPath: localEngineInfo.engineOutPath,
|
||||||
androidBuildInfo: androidBuildInfo,
|
androidBuildInfo: androidBuildInfo,
|
||||||
fileSystem: _fileSystem,
|
fileSystem: _fileSystem,
|
||||||
);
|
);
|
||||||
_logger.printTrace(
|
_logger.printTrace(
|
||||||
'Using local engine: ${localEngineArtifacts.engineOutPath}\n'
|
'Using local engine: ${localEngineInfo.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=${localEngineArtifacts.engineOutPath}');
|
command.add('-Plocal-engine-out=${localEngineInfo.engineOutPath}');
|
||||||
command.add('-Ptarget-platform=${_getTargetPlatformByLocalEnginePath(
|
command.add('-Ptarget-platform=${_getTargetPlatformByLocalEnginePath(
|
||||||
localEngineArtifacts.engineOutPath)}');
|
localEngineInfo.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 {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_artifacts is LocalEngineArtifacts) {
|
final LocalEngineInfo? localEngineInfo = _artifacts.localEngineInfo;
|
||||||
final LocalEngineArtifacts localEngineArtifacts = _artifacts as LocalEngineArtifacts;
|
if (localEngineInfo != null) {
|
||||||
final Directory localEngineRepo = _getLocalEngineRepo(
|
final Directory localEngineRepo = _getLocalEngineRepo(
|
||||||
engineOutPath: localEngineArtifacts.engineOutPath,
|
engineOutPath: localEngineInfo.engineOutPath,
|
||||||
androidBuildInfo: androidBuildInfo,
|
androidBuildInfo: androidBuildInfo,
|
||||||
fileSystem: _fileSystem,
|
fileSystem: _fileSystem,
|
||||||
);
|
);
|
||||||
_logger.printTrace(
|
_logger.printTrace(
|
||||||
'Using local engine: ${localEngineArtifacts.engineOutPath}\n'
|
'Using local engine: ${localEngineInfo.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=${localEngineArtifacts.engineOutPath}');
|
command.add('-Plocal-engine-out=${localEngineInfo.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(
|
||||||
localEngineArtifacts.engineOutPath)}');
|
localEngineInfo.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(',');
|
||||||
|
|
|
@ -29,7 +29,16 @@ enum Artifact {
|
||||||
platformKernelDill,
|
platformKernelDill,
|
||||||
platformLibrariesJson,
|
platformLibrariesJson,
|
||||||
flutterPatchedSdkPath,
|
flutterPatchedSdkPath,
|
||||||
|
|
||||||
|
/// The root directory of the dart SDK.
|
||||||
|
engineDartSdkPath,
|
||||||
|
/// The dart binary used to execute any of the required snapshots.
|
||||||
|
engineDartBinary,
|
||||||
|
/// The snapshot of frontend_server compiler.
|
||||||
frontendServerSnapshotForEngineDartSdk,
|
frontendServerSnapshotForEngineDartSdk,
|
||||||
|
/// The dart snapshot of the dart2js compiler.
|
||||||
|
dart2jsSnapshot,
|
||||||
|
|
||||||
/// The root of the Linux desktop sources.
|
/// The root of the Linux desktop sources.
|
||||||
linuxDesktopPath,
|
linuxDesktopPath,
|
||||||
// The root of the cpp headers for Linux desktop.
|
// The root of the cpp headers for Linux desktop.
|
||||||
|
@ -53,24 +62,22 @@ enum Artifact {
|
||||||
|
|
||||||
/// A subset of [Artifact]s that are platform and build mode independent
|
/// A subset of [Artifact]s that are platform and build mode independent
|
||||||
enum HostArtifact {
|
enum HostArtifact {
|
||||||
/// The root directory of the dart SDK.
|
|
||||||
engineDartSdkPath,
|
|
||||||
/// The dart binary used to execute any of the required snapshots.
|
|
||||||
engineDartBinary,
|
|
||||||
/// The dart snapshot of the dart2js compiler.
|
|
||||||
dart2jsSnapshot,
|
|
||||||
/// The dart snapshot of the dartdev compiler.
|
|
||||||
dartdevcSnapshot,
|
|
||||||
/// The dart snapshot of the kernel worker compiler.
|
|
||||||
kernelWorkerSnapshot,
|
|
||||||
/// The root of the web implementation of the dart SDK.
|
/// The root of the web implementation of the dart SDK.
|
||||||
flutterWebSdk,
|
flutterWebSdk,
|
||||||
/// The libraries JSON file for web release builds.
|
/// The libraries JSON file for web release builds.
|
||||||
flutterWebLibrariesJson,
|
flutterWebLibrariesJson,
|
||||||
|
|
||||||
|
/// Folder that contains platform dill files for the web sdk.
|
||||||
|
webPlatformKernelFolder,
|
||||||
|
|
||||||
/// The summary dill for the dartdevc target.
|
/// The summary dill for the dartdevc target.
|
||||||
webPlatformKernelDill,
|
webPlatformDDCKernelDill,
|
||||||
|
/// The summary dill with null safety enabled for the dartdevc target.g
|
||||||
|
webPlatformDDCSoundKernelDill,
|
||||||
|
/// The summary dill for the dartdevc target.
|
||||||
|
webPlatformDart2JSKernelDill,
|
||||||
/// The summary dill with null safety enabled for the dartdevc target.
|
/// The summary dill with null safety enabled for the dartdevc target.
|
||||||
webPlatformSoundKernelDill,
|
webPlatformDart2JSSoundKernelDill,
|
||||||
|
|
||||||
/// The precompiled SDKs and sourcemaps for web debug builds.
|
/// The precompiled SDKs and sourcemaps for web debug builds.
|
||||||
webPrecompiledSdk,
|
webPrecompiledSdk,
|
||||||
|
@ -131,30 +138,8 @@ TargetPlatform? _mapTargetPlatform(TargetPlatform? targetPlatform) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _isWindows(TargetPlatform? platform) {
|
String? _artifactToFileName(Artifact artifact, Platform hostPlatform, [ BuildMode? mode ]) {
|
||||||
switch (platform) {
|
final String exe = hostPlatform.isWindows ? '.exe' : '';
|
||||||
case TargetPlatform.windows_x64:
|
|
||||||
return true;
|
|
||||||
case TargetPlatform.android:
|
|
||||||
case TargetPlatform.android_arm:
|
|
||||||
case TargetPlatform.android_arm64:
|
|
||||||
case TargetPlatform.android_x64:
|
|
||||||
case TargetPlatform.android_x86:
|
|
||||||
case TargetPlatform.darwin:
|
|
||||||
case TargetPlatform.fuchsia_arm64:
|
|
||||||
case TargetPlatform.fuchsia_x64:
|
|
||||||
case TargetPlatform.ios:
|
|
||||||
case TargetPlatform.linux_arm64:
|
|
||||||
case TargetPlatform.linux_x64:
|
|
||||||
case TargetPlatform.tester:
|
|
||||||
case TargetPlatform.web_javascript:
|
|
||||||
case null:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String? _artifactToFileName(Artifact artifact, [ TargetPlatform? platform, BuildMode? mode ]) {
|
|
||||||
final String exe = _isWindows(platform) ? '.exe' : '';
|
|
||||||
switch (artifact) {
|
switch (artifact) {
|
||||||
case Artifact.genSnapshot:
|
case Artifact.genSnapshot:
|
||||||
return 'gen_snapshot';
|
return 'gen_snapshot';
|
||||||
|
@ -179,6 +164,12 @@ String? _artifactToFileName(Artifact artifact, [ TargetPlatform? platform, Build
|
||||||
case Artifact.flutterPatchedSdkPath:
|
case Artifact.flutterPatchedSdkPath:
|
||||||
assert(false, 'No filename for sdk path, should not be invoked');
|
assert(false, 'No filename for sdk path, should not be invoked');
|
||||||
return null;
|
return null;
|
||||||
|
case Artifact.engineDartSdkPath:
|
||||||
|
return 'dart-sdk';
|
||||||
|
case Artifact.engineDartBinary:
|
||||||
|
return 'dart$exe';
|
||||||
|
case Artifact.dart2jsSnapshot:
|
||||||
|
return 'dart2js.dart.snapshot';
|
||||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||||
return 'frontend_server.dart.snapshot';
|
return 'frontend_server.dart.snapshot';
|
||||||
case Artifact.linuxDesktopPath:
|
case Artifact.linuxDesktopPath:
|
||||||
|
@ -215,16 +206,6 @@ String _hostArtifactToFileName(HostArtifact artifact, Platform platform) {
|
||||||
switch (artifact) {
|
switch (artifact) {
|
||||||
case HostArtifact.flutterWebSdk:
|
case HostArtifact.flutterWebSdk:
|
||||||
return '';
|
return '';
|
||||||
case HostArtifact.engineDartSdkPath:
|
|
||||||
return 'dart-sdk';
|
|
||||||
case HostArtifact.engineDartBinary:
|
|
||||||
return 'dart$exe';
|
|
||||||
case HostArtifact.dart2jsSnapshot:
|
|
||||||
return 'dart2js.dart.snapshot';
|
|
||||||
case HostArtifact.dartdevcSnapshot:
|
|
||||||
return 'dartdevc.dart.snapshot';
|
|
||||||
case HostArtifact.kernelWorkerSnapshot:
|
|
||||||
return 'kernel_worker.dart.snapshot';
|
|
||||||
case HostArtifact.iosDeploy:
|
case HostArtifact.iosDeploy:
|
||||||
return 'ios-deploy';
|
return 'ios-deploy';
|
||||||
case HostArtifact.idevicesyslog:
|
case HostArtifact.idevicesyslog:
|
||||||
|
@ -235,10 +216,16 @@ String _hostArtifactToFileName(HostArtifact artifact, Platform platform) {
|
||||||
return 'iproxy';
|
return 'iproxy';
|
||||||
case HostArtifact.skyEnginePath:
|
case HostArtifact.skyEnginePath:
|
||||||
return 'sky_engine';
|
return 'sky_engine';
|
||||||
case HostArtifact.webPlatformKernelDill:
|
case HostArtifact.webPlatformKernelFolder:
|
||||||
return 'flutter_ddc_sdk.dill';
|
return 'kernel';
|
||||||
case HostArtifact.webPlatformSoundKernelDill:
|
case HostArtifact.webPlatformDDCKernelDill:
|
||||||
return 'flutter_ddc_sdk_sound.dill';
|
return 'ddc_outline.dill';
|
||||||
|
case HostArtifact.webPlatformDDCSoundKernelDill:
|
||||||
|
return 'ddc_outline_sound.dill';
|
||||||
|
case HostArtifact.webPlatformDart2JSKernelDill:
|
||||||
|
return 'dart2js_platform_unsound.dill';
|
||||||
|
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
||||||
|
return 'dart2js_platform.dill';
|
||||||
case HostArtifact.flutterWebLibrariesJson:
|
case HostArtifact.flutterWebLibrariesJson:
|
||||||
return 'libraries.json';
|
return 'libraries.json';
|
||||||
case HostArtifact.webPrecompiledSdk:
|
case HostArtifact.webPrecompiledSdk:
|
||||||
|
@ -266,11 +253,23 @@ class EngineBuildPaths {
|
||||||
const EngineBuildPaths({
|
const EngineBuildPaths({
|
||||||
required this.targetEngine,
|
required this.targetEngine,
|
||||||
required this.hostEngine,
|
required this.hostEngine,
|
||||||
}) : assert(targetEngine != null),
|
required this.webSdk,
|
||||||
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.
|
||||||
|
@ -289,16 +288,35 @@ abstract class Artifacts {
|
||||||
return _TestArtifacts(fileSystem);
|
return _TestArtifacts(fileSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalEngineArtifacts getLocalEngine(EngineBuildPaths engineBuildPaths) {
|
static Artifacts getLocalEngine(EngineBuildPaths engineBuildPaths) {
|
||||||
return LocalEngineArtifacts(
|
Artifacts artifacts = CachedArtifacts(
|
||||||
engineBuildPaths.targetEngine,
|
|
||||||
engineBuildPaths.hostEngine,
|
|
||||||
cache: globals.cache,
|
|
||||||
fileSystem: globals.fs,
|
fileSystem: globals.fs,
|
||||||
processManager: globals.processManager,
|
|
||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
operatingSystemUtils: globals.os,
|
cache: globals.cache,
|
||||||
|
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.
|
||||||
|
@ -321,6 +339,10 @@ 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.
|
||||||
|
@ -340,27 +362,27 @@ 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,
|
||||||
) {
|
) {
|
||||||
switch (artifact) {
|
switch (artifact) {
|
||||||
case HostArtifact.engineDartSdkPath:
|
|
||||||
final String path = _dartSdkPath(_cache);
|
|
||||||
return _fileSystem.directory(path);
|
|
||||||
case HostArtifact.engineDartBinary:
|
|
||||||
final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', _hostArtifactToFileName(artifact, _platform));
|
|
||||||
return _fileSystem.file(path);
|
|
||||||
case HostArtifact.flutterWebSdk:
|
case HostArtifact.flutterWebSdk:
|
||||||
final String path = _getFlutterWebSdkPath();
|
final String path = _getFlutterWebSdkPath();
|
||||||
return _fileSystem.directory(path);
|
return _fileSystem.directory(path);
|
||||||
case HostArtifact.flutterWebLibrariesJson:
|
case HostArtifact.flutterWebLibrariesJson:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, _platform));
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
case HostArtifact.webPlatformKernelDill:
|
case HostArtifact.webPlatformKernelFolder:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel');
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
case HostArtifact.webPlatformSoundKernelDill:
|
case HostArtifact.webPlatformDDCKernelDill:
|
||||||
|
case HostArtifact.webPlatformDDCSoundKernelDill:
|
||||||
|
case HostArtifact.webPlatformDart2JSKernelDill:
|
||||||
|
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
||||||
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.webPrecompiledSdk:
|
case HostArtifact.webPrecompiledSdk:
|
||||||
|
@ -395,11 +417,6 @@ class CachedArtifacts implements Artifacts {
|
||||||
final Directory dartPackageDirectory = _cache.getCacheDir('pkg');
|
final Directory dartPackageDirectory = _cache.getCacheDir('pkg');
|
||||||
final String path = _fileSystem.path.join(dartPackageDirectory.path, _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(dartPackageDirectory.path, _hostArtifactToFileName(artifact, _platform));
|
||||||
return _fileSystem.directory(path);
|
return _fileSystem.directory(path);
|
||||||
case HostArtifact.dart2jsSnapshot:
|
|
||||||
case HostArtifact.dartdevcSnapshot:
|
|
||||||
case HostArtifact.kernelWorkerSnapshot:
|
|
||||||
final String path = _fileSystem.path.join(_dartSdkPath(_cache), 'bin', 'snapshots', _hostArtifactToFileName(artifact, _platform));
|
|
||||||
return _fileSystem.file(path);
|
|
||||||
case HostArtifact.iosDeploy:
|
case HostArtifact.iosDeploy:
|
||||||
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
final String artifactFileName = _hostArtifactToFileName(artifact, _platform);
|
||||||
return _cache.getArtifactDirectory('ios-deploy').childFile(artifactFileName);
|
return _cache.getArtifactDirectory('ios-deploy').childFile(artifactFileName);
|
||||||
|
@ -457,7 +474,7 @@ class CachedArtifacts implements Artifacts {
|
||||||
// and not the gen_snapshot for darwin as a target platform.
|
// and not the gen_snapshot for darwin as a target platform.
|
||||||
if (platform != null && artifact == Artifact.genSnapshot) {
|
if (platform != null && artifact == Artifact.genSnapshot) {
|
||||||
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
||||||
return _fileSystem.path.join(engineDir, _artifactToFileName(artifact));
|
return _fileSystem.path.join(engineDir, _artifactToFileName(artifact, _platform));
|
||||||
}
|
}
|
||||||
return _getHostArtifactPath(artifact, platform ?? _currentHostPlatform(_platform, _operatingSystemUtils), mode);
|
return _getHostArtifactPath(artifact, platform ?? _currentHostPlatform(_platform, _operatingSystemUtils), mode);
|
||||||
}
|
}
|
||||||
|
@ -468,7 +485,10 @@ class CachedArtifacts implements Artifacts {
|
||||||
case Artifact.genSnapshot:
|
case Artifact.genSnapshot:
|
||||||
assert(mode != BuildMode.debug, 'Artifact $artifact only available in non-debug mode.');
|
assert(mode != BuildMode.debug, 'Artifact $artifact only available in non-debug mode.');
|
||||||
final String hostPlatform = getNameForHostPlatform(getCurrentHostPlatform());
|
final String hostPlatform = getNameForHostPlatform(getCurrentHostPlatform());
|
||||||
return _fileSystem.path.join(engineDir, hostPlatform, _artifactToFileName(artifact));
|
return _fileSystem.path.join(engineDir, hostPlatform, _artifactToFileName(artifact, _platform));
|
||||||
|
case Artifact.engineDartSdkPath:
|
||||||
|
case Artifact.engineDartBinary:
|
||||||
|
case Artifact.dart2jsSnapshot:
|
||||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||||
case Artifact.constFinder:
|
case Artifact.constFinder:
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
|
@ -497,12 +517,15 @@ class CachedArtifacts implements Artifacts {
|
||||||
switch (artifact) {
|
switch (artifact) {
|
||||||
case Artifact.genSnapshot:
|
case Artifact.genSnapshot:
|
||||||
case Artifact.flutterXcframework:
|
case Artifact.flutterXcframework:
|
||||||
final String artifactFileName = _artifactToFileName(artifact)!;
|
final String artifactFileName = _artifactToFileName(artifact, _platform)!;
|
||||||
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
||||||
return _fileSystem.path.join(engineDir, artifactFileName);
|
return _fileSystem.path.join(engineDir, artifactFileName);
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
final String engineDir = _getEngineArtifactsPath(platform, mode)!;
|
||||||
return _getIosEngineArtifactPath(engineDir, environmentType, _fileSystem);
|
return _getIosEngineArtifactPath(engineDir, environmentType, _fileSystem, _platform);
|
||||||
|
case Artifact.engineDartSdkPath:
|
||||||
|
case Artifact.engineDartBinary:
|
||||||
|
case Artifact.dart2jsSnapshot:
|
||||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||||
case Artifact.constFinder:
|
case Artifact.constFinder:
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
|
@ -541,13 +564,13 @@ class CachedArtifacts implements Artifacts {
|
||||||
const String artifactFileName = 'flutter_runner_patched_sdk';
|
const String artifactFileName = 'flutter_runner_patched_sdk';
|
||||||
return _fileSystem.path.join(root, runtime, artifactFileName);
|
return _fileSystem.path.join(root, runtime, artifactFileName);
|
||||||
case Artifact.platformKernelDill:
|
case Artifact.platformKernelDill:
|
||||||
final String artifactFileName = _artifactToFileName(artifact, platform, mode)!;
|
final String artifactFileName = _artifactToFileName(artifact, _platform, mode)!;
|
||||||
return _fileSystem.path.join(root, runtime, 'flutter_runner_patched_sdk', artifactFileName);
|
return _fileSystem.path.join(root, runtime, 'flutter_runner_patched_sdk', artifactFileName);
|
||||||
case Artifact.fuchsiaKernelCompiler:
|
case Artifact.fuchsiaKernelCompiler:
|
||||||
final String artifactFileName = _artifactToFileName(artifact, platform, mode)!;
|
final String artifactFileName = _artifactToFileName(artifact, _platform, mode)!;
|
||||||
return _fileSystem.path.join(root, runtime, 'dart_binaries', artifactFileName);
|
return _fileSystem.path.join(root, runtime, 'dart_binaries', artifactFileName);
|
||||||
case Artifact.fuchsiaFlutterRunner:
|
case Artifact.fuchsiaFlutterRunner:
|
||||||
final String artifactFileName = _artifactToFileName(artifact, platform, mode)!;
|
final String artifactFileName = _artifactToFileName(artifact, _platform, mode)!;
|
||||||
return _fileSystem.path.join(root, runtime, artifactFileName);
|
return _fileSystem.path.join(root, runtime, artifactFileName);
|
||||||
case Artifact.constFinder:
|
case Artifact.constFinder:
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
|
@ -555,6 +578,9 @@ class CachedArtifacts implements Artifacts {
|
||||||
case Artifact.flutterTester:
|
case Artifact.flutterTester:
|
||||||
case Artifact.flutterXcframework:
|
case Artifact.flutterXcframework:
|
||||||
case Artifact.fontSubset:
|
case Artifact.fontSubset:
|
||||||
|
case Artifact.engineDartSdkPath:
|
||||||
|
case Artifact.engineDartBinary:
|
||||||
|
case Artifact.dart2jsSnapshot:
|
||||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||||
case Artifact.icuData:
|
case Artifact.icuData:
|
||||||
case Artifact.isolateSnapshotData:
|
case Artifact.isolateSnapshotData:
|
||||||
|
@ -586,10 +612,11 @@ class CachedArtifacts implements Artifacts {
|
||||||
// For script snapshots any gen_snapshot binary will do. Returning gen_snapshot for
|
// For script snapshots any gen_snapshot binary will do. Returning gen_snapshot for
|
||||||
// android_arm in profile mode because it is available on all supported host platforms.
|
// android_arm in profile mode because it is available on all supported host platforms.
|
||||||
return _getAndroidArtifactPath(artifact, TargetPlatform.android_arm, BuildMode.profile);
|
return _getAndroidArtifactPath(artifact, TargetPlatform.android_arm, BuildMode.profile);
|
||||||
|
case Artifact.dart2jsSnapshot:
|
||||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||||
return _fileSystem.path.join(
|
return _fileSystem.path.join(
|
||||||
_dartSdkPath(_cache), 'bin', 'snapshots',
|
_dartSdkPath(_cache), 'bin', 'snapshots',
|
||||||
_artifactToFileName(artifact),
|
_artifactToFileName(artifact, _platform),
|
||||||
);
|
);
|
||||||
case Artifact.flutterTester:
|
case Artifact.flutterTester:
|
||||||
case Artifact.vmSnapshotData:
|
case Artifact.vmSnapshotData:
|
||||||
|
@ -597,13 +624,17 @@ class CachedArtifacts implements Artifacts {
|
||||||
case Artifact.icuData:
|
case Artifact.icuData:
|
||||||
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
|
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
|
||||||
final String platformDirName = _enginePlatformDirectoryName(platform);
|
final String platformDirName = _enginePlatformDirectoryName(platform);
|
||||||
return _fileSystem.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact, platform, mode));
|
return _fileSystem.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact, _platform, mode));
|
||||||
case Artifact.platformKernelDill:
|
case Artifact.platformKernelDill:
|
||||||
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), _artifactToFileName(artifact));
|
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), _artifactToFileName(artifact, _platform));
|
||||||
case Artifact.platformLibrariesJson:
|
case Artifact.platformLibrariesJson:
|
||||||
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), 'lib', _artifactToFileName(artifact));
|
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), 'lib', _artifactToFileName(artifact, _platform));
|
||||||
case Artifact.flutterPatchedSdkPath:
|
case Artifact.flutterPatchedSdkPath:
|
||||||
return _getFlutterPatchedSdkPath(mode);
|
return _getFlutterPatchedSdkPath(mode);
|
||||||
|
case Artifact.engineDartSdkPath:
|
||||||
|
return _dartSdkPath(_cache);
|
||||||
|
case Artifact.engineDartBinary:
|
||||||
|
return _fileSystem.path.join(_dartSdkPath(_cache), 'bin', _artifactToFileName(artifact, _platform));
|
||||||
case Artifact.flutterMacOSFramework:
|
case Artifact.flutterMacOSFramework:
|
||||||
case Artifact.linuxDesktopPath:
|
case Artifact.linuxDesktopPath:
|
||||||
case Artifact.windowsDesktopPath:
|
case Artifact.windowsDesktopPath:
|
||||||
|
@ -616,18 +647,18 @@ class CachedArtifacts implements Artifacts {
|
||||||
platformDirName = '$platformDirName-${getNameForBuildMode(mode!)}';
|
platformDirName = '$platformDirName-${getNameForBuildMode(mode!)}';
|
||||||
}
|
}
|
||||||
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
|
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
|
||||||
return _fileSystem.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact, platform, mode));
|
return _fileSystem.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact, _platform, mode));
|
||||||
case Artifact.windowsCppClientWrapper:
|
case Artifact.windowsCppClientWrapper:
|
||||||
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
|
final String engineArtifactsPath = _cache.getArtifactDirectory('engine').path;
|
||||||
return _fileSystem.path.join(engineArtifactsPath, 'windows-x64', _artifactToFileName(artifact, platform, mode));
|
return _fileSystem.path.join(engineArtifactsPath, 'windows-x64', _artifactToFileName(artifact, _platform, mode));
|
||||||
case Artifact.skyEnginePath:
|
case Artifact.skyEnginePath:
|
||||||
final Directory dartPackageDirectory = _cache.getCacheDir('pkg');
|
final Directory dartPackageDirectory = _cache.getCacheDir('pkg');
|
||||||
return _fileSystem.path.join(dartPackageDirectory.path, _artifactToFileName(artifact));
|
return _fileSystem.path.join(dartPackageDirectory.path, _artifactToFileName(artifact, _platform));
|
||||||
case Artifact.fontSubset:
|
case Artifact.fontSubset:
|
||||||
case Artifact.constFinder:
|
case Artifact.constFinder:
|
||||||
return _cache.getArtifactDirectory('engine')
|
return _cache.getArtifactDirectory('engine')
|
||||||
.childDirectory(_enginePlatformDirectoryName(platform))
|
.childDirectory(_enginePlatformDirectoryName(platform))
|
||||||
.childFile(_artifactToFileName(artifact, platform, mode)!)
|
.childFile(_artifactToFileName(artifact, _platform, mode)!)
|
||||||
.path;
|
.path;
|
||||||
case Artifact.flutterFramework:
|
case Artifact.flutterFramework:
|
||||||
case Artifact.flutterXcframework:
|
case Artifact.flutterXcframework:
|
||||||
|
@ -692,10 +723,10 @@ TargetPlatform _currentHostPlatform(Platform platform, OperatingSystemUtils oper
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getIosEngineArtifactPath(String engineDirectory,
|
String _getIosEngineArtifactPath(String engineDirectory,
|
||||||
EnvironmentType? environmentType, FileSystem fileSystem) {
|
EnvironmentType? environmentType, FileSystem fileSystem, Platform hostPlatform) {
|
||||||
final Directory xcframeworkDirectory = fileSystem
|
final Directory xcframeworkDirectory = fileSystem
|
||||||
.directory(engineDirectory)
|
.directory(engineDirectory)
|
||||||
.childDirectory(_artifactToFileName(Artifact.flutterXcframework)!);
|
.childDirectory(_artifactToFileName(Artifact.flutterXcframework, hostPlatform)!);
|
||||||
|
|
||||||
if (!xcframeworkDirectory.existsSync()) {
|
if (!xcframeworkDirectory.existsSync()) {
|
||||||
throwToolExit('No xcframework found at ${xcframeworkDirectory.path}. Try running "flutter precache --ios".');
|
throwToolExit('No xcframework found at ${xcframeworkDirectory.path}. Try running "flutter precache --ios".');
|
||||||
|
@ -718,47 +749,41 @@ String _getIosEngineArtifactPath(String engineDirectory,
|
||||||
}
|
}
|
||||||
|
|
||||||
return flutterFrameworkSource
|
return flutterFrameworkSource
|
||||||
.childDirectory(_artifactToFileName(Artifact.flutterFramework)!)
|
.childDirectory(_artifactToFileName(Artifact.flutterFramework, hostPlatform)!)
|
||||||
.path;
|
.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class LocalEngineArtifacts implements Artifacts {
|
|
||||||
factory LocalEngineArtifacts(String engineOutPath, String hostEngineOutPath, {
|
|
||||||
required FileSystem fileSystem,
|
|
||||||
required Cache cache,
|
|
||||||
required ProcessManager processManager,
|
|
||||||
required Platform platform,
|
|
||||||
required OperatingSystemUtils operatingSystemUtils,
|
|
||||||
}) = CachedLocalEngineArtifacts;
|
|
||||||
|
|
||||||
String get engineOutPath;
|
|
||||||
|
|
||||||
String get localEngineName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Manages the artifacts of a locally built engine.
|
/// Manages the artifacts of a locally built engine.
|
||||||
class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
class CachedLocalEngineArtifacts implements Artifacts {
|
||||||
CachedLocalEngineArtifacts(
|
CachedLocalEngineArtifacts(
|
||||||
this.engineOutPath,
|
|
||||||
this._hostEngineOutPath, {
|
this._hostEngineOutPath, {
|
||||||
|
required String engineOutPath,
|
||||||
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,
|
||||||
localEngineName = fileSystem.path.basename(engineOutPath),
|
localEngineInfo =
|
||||||
|
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 = CachedArtifacts(fileSystem: fileSystem, platform: platform, cache: cache, operatingSystemUtils: operatingSystemUtils);
|
_backupCache = parent ??
|
||||||
|
CachedArtifacts(
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
platform: platform,
|
||||||
|
cache: cache,
|
||||||
|
operatingSystemUtils: operatingSystemUtils
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String engineOutPath;
|
final LocalEngineInfo localEngineInfo;
|
||||||
|
|
||||||
@override
|
|
||||||
final String localEngineName;
|
|
||||||
|
|
||||||
final String _hostEngineOutPath;
|
final String _hostEngineOutPath;
|
||||||
final FileSystem _fileSystem;
|
final FileSystem _fileSystem;
|
||||||
|
@ -766,36 +791,24 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
final ProcessManager _processManager;
|
final ProcessManager _processManager;
|
||||||
final Platform _platform;
|
final Platform _platform;
|
||||||
final OperatingSystemUtils _operatingSystemUtils;
|
final OperatingSystemUtils _operatingSystemUtils;
|
||||||
final CachedArtifacts _backupCache;
|
final Artifacts _backupCache;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSystemEntity getHostArtifact(HostArtifact artifact) {
|
FileSystemEntity getHostArtifact(HostArtifact artifact) {
|
||||||
switch (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:
|
case HostArtifact.flutterWebSdk:
|
||||||
final String path = _getFlutterWebSdkPath();
|
final String path = _getFlutterWebSdkPath();
|
||||||
return _fileSystem.directory(path);
|
return _fileSystem.directory(path);
|
||||||
case HostArtifact.flutterWebLibrariesJson:
|
case HostArtifact.flutterWebLibrariesJson:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), _hostArtifactToFileName(artifact, _platform));
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
case HostArtifact.webPlatformKernelDill:
|
case HostArtifact.webPlatformKernelFolder:
|
||||||
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _hostArtifactToFileName(artifact, _platform));
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel');
|
||||||
return _fileSystem.file(path);
|
return _fileSystem.file(path);
|
||||||
case HostArtifact.webPlatformSoundKernelDill:
|
case HostArtifact.webPlatformDDCKernelDill:
|
||||||
|
case HostArtifact.webPlatformDDCSoundKernelDill:
|
||||||
|
case HostArtifact.webPlatformDart2JSKernelDill:
|
||||||
|
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
||||||
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.webPrecompiledSdk:
|
case HostArtifact.webPrecompiledSdk:
|
||||||
|
@ -857,7 +870,7 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
platform ??= _currentHostPlatform(_platform, _operatingSystemUtils);
|
platform ??= _currentHostPlatform(_platform, _operatingSystemUtils);
|
||||||
platform = _mapTargetPlatform(platform);
|
platform = _mapTargetPlatform(platform);
|
||||||
final bool isDirectoryArtifact = artifact == Artifact.flutterPatchedSdkPath;
|
final bool isDirectoryArtifact = artifact == Artifact.flutterPatchedSdkPath;
|
||||||
final String? artifactFileName = isDirectoryArtifact ? null : _artifactToFileName(artifact, platform, mode);
|
final String? artifactFileName = isDirectoryArtifact ? null : _artifactToFileName(artifact, _platform, mode);
|
||||||
switch (artifact) {
|
switch (artifact) {
|
||||||
case Artifact.genSnapshot:
|
case Artifact.genSnapshot:
|
||||||
return _genSnapshotPath();
|
return _genSnapshotPath();
|
||||||
|
@ -865,28 +878,28 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
return _flutterTesterPath(platform!);
|
return _flutterTesterPath(platform!);
|
||||||
case Artifact.isolateSnapshotData:
|
case Artifact.isolateSnapshotData:
|
||||||
case Artifact.vmSnapshotData:
|
case Artifact.vmSnapshotData:
|
||||||
return _fileSystem.path.join(engineOutPath, 'gen', 'flutter', 'lib', 'snapshot', artifactFileName);
|
return _fileSystem.path.join(localEngineInfo.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(engineOutPath, artifactFileName);
|
return _fileSystem.path.join(localEngineInfo.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(engineOutPath, 'flutter_runner_patched_sdk', artifactFileName);
|
return _fileSystem.path.join(localEngineInfo.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(
|
||||||
engineOutPath, environmentType, _fileSystem);
|
localEngineInfo.engineOutPath, environmentType, _fileSystem, _platform);
|
||||||
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(engineOutPath, 'flutter_runner_patched_sdk');
|
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter_runner_patched_sdk');
|
||||||
}
|
}
|
||||||
return _getFlutterPatchedSdkPath(BuildMode.debug);
|
return _getFlutterPatchedSdkPath(BuildMode.debug);
|
||||||
case Artifact.skyEnginePath:
|
case Artifact.skyEnginePath:
|
||||||
|
@ -895,11 +908,11 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
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(engineOutPath, 'host_bundle', dartBinaries, 'kernel_compiler.dart.snapshot');
|
return _fileSystem.path.join(localEngineInfo.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(engineOutPath, 'flutter$jitOrAot${productOrNo}_runner-0.far');
|
return _fileSystem.path.join(localEngineInfo.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:
|
||||||
|
@ -909,6 +922,12 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
case Artifact.windowsDesktopPath:
|
case Artifact.windowsDesktopPath:
|
||||||
case Artifact.windowsCppClientWrapper:
|
case Artifact.windowsCppClientWrapper:
|
||||||
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
|
return _fileSystem.path.join(_hostEngineOutPath, artifactFileName);
|
||||||
|
case Artifact.engineDartSdkPath:
|
||||||
|
return _getDartSdkPath();
|
||||||
|
case Artifact.engineDartBinary:
|
||||||
|
return _fileSystem.path.join(_getDartSdkPath(), 'bin', artifactFileName);
|
||||||
|
case Artifact.dart2jsSnapshot:
|
||||||
|
return _fileSystem.path.join(_getDartSdkPath(), 'bin', 'snapshots', artifactFileName);
|
||||||
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||||
return _fileSystem.path.join(
|
return _fileSystem.path.join(
|
||||||
_getDartSdkPath(), 'bin', 'snapshots', artifactFileName,
|
_getDartSdkPath(), 'bin', 'snapshots', artifactFileName,
|
||||||
|
@ -918,11 +937,11 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String getEngineType(TargetPlatform platform, [ BuildMode? mode ]) {
|
String getEngineType(TargetPlatform platform, [ BuildMode? mode ]) {
|
||||||
return _fileSystem.path.basename(engineOutPath);
|
return _fileSystem.path.basename(localEngineInfo.engineOutPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getFlutterPatchedSdkPath(BuildMode? buildMode) {
|
String _getFlutterPatchedSdkPath(BuildMode? buildMode) {
|
||||||
return _fileSystem.path.join(engineOutPath,
|
return _fileSystem.path.join(localEngineInfo.engineOutPath,
|
||||||
buildMode == BuildMode.release ? 'flutter_patched_sdk_product' : 'flutter_patched_sdk');
|
buildMode == BuildMode.release ? 'flutter_patched_sdk_product' : 'flutter_patched_sdk');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -972,14 +991,14 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
}
|
}
|
||||||
|
|
||||||
String _getFlutterWebSdkPath() {
|
String _getFlutterWebSdkPath() {
|
||||||
return _fileSystem.path.join(engineOutPath, 'flutter_web_sdk');
|
return _fileSystem.path.join(localEngineInfo.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, _platform)!;
|
||||||
for (final String clangDir in clangDirs) {
|
for (final String clangDir in clangDirs) {
|
||||||
final String genSnapshotPath = _fileSystem.path.join(engineOutPath, clangDir, genSnapshotName);
|
final String genSnapshotPath = _fileSystem.path.join(localEngineInfo.engineOutPath, clangDir, genSnapshotName);
|
||||||
if (_processManager.canRun(genSnapshotPath)) {
|
if (_processManager.canRun(genSnapshotPath)) {
|
||||||
return genSnapshotPath;
|
return genSnapshotPath;
|
||||||
}
|
}
|
||||||
|
@ -989,11 +1008,11 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
|
|
||||||
String _flutterTesterPath(TargetPlatform platform) {
|
String _flutterTesterPath(TargetPlatform platform) {
|
||||||
if (_platform.isLinux) {
|
if (_platform.isLinux) {
|
||||||
return _fileSystem.path.join(engineOutPath, _artifactToFileName(Artifact.flutterTester));
|
return _fileSystem.path.join(localEngineInfo.engineOutPath, _artifactToFileName(Artifact.flutterTester, _platform));
|
||||||
} else if (_platform.isMacOS) {
|
} else if (_platform.isMacOS) {
|
||||||
return _fileSystem.path.join(engineOutPath, 'flutter_tester');
|
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter_tester');
|
||||||
} else if (_platform.isWindows) {
|
} else if (_platform.isWindows) {
|
||||||
return _fileSystem.path.join(engineOutPath, 'flutter_tester.exe');
|
return _fileSystem.path.join(localEngineInfo.engineOutPath, 'flutter_tester.exe');
|
||||||
}
|
}
|
||||||
throw Exception('Unsupported platform $platform.');
|
throw Exception('Unsupported platform $platform.');
|
||||||
}
|
}
|
||||||
|
@ -1002,6 +1021,175 @@ class CachedLocalEngineArtifacts implements LocalEngineArtifacts {
|
||||||
bool get isLocalEngine => true;
|
bool get isLocalEngine => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CachedLocalWebSdkArtifacts implements Artifacts {
|
||||||
|
CachedLocalWebSdkArtifacts({
|
||||||
|
required Artifacts parent,
|
||||||
|
required String webSdkPath,
|
||||||
|
required FileSystem fileSystem,
|
||||||
|
required Platform platform,
|
||||||
|
required OperatingSystemUtils operatingSystemUtils
|
||||||
|
}) : _parent = parent,
|
||||||
|
_webSdkPath = webSdkPath,
|
||||||
|
_fileSystem = fileSystem,
|
||||||
|
_platform = platform,
|
||||||
|
_operatingSystemUtils = 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) {
|
||||||
|
switch (artifact) {
|
||||||
|
case Artifact.engineDartSdkPath:
|
||||||
|
return _getDartSdkPath();
|
||||||
|
case Artifact.engineDartBinary:
|
||||||
|
return _fileSystem.path.join(
|
||||||
|
_getDartSdkPath(), 'bin',
|
||||||
|
_artifactToFileName(artifact, _platform, mode));
|
||||||
|
case Artifact.dart2jsSnapshot:
|
||||||
|
case Artifact.frontendServerSnapshotForEngineDartSdk:
|
||||||
|
return _fileSystem.path.join(
|
||||||
|
_getDartSdkPath(), 'bin', 'snapshots',
|
||||||
|
_artifactToFileName(artifact, _platform, mode),
|
||||||
|
);
|
||||||
|
case Artifact.genSnapshot:
|
||||||
|
case Artifact.flutterTester:
|
||||||
|
case Artifact.flutterFramework:
|
||||||
|
case Artifact.flutterXcframework:
|
||||||
|
case Artifact.flutterMacOSFramework:
|
||||||
|
case Artifact.vmSnapshotData:
|
||||||
|
case Artifact.isolateSnapshotData:
|
||||||
|
case Artifact.icuData:
|
||||||
|
case Artifact.platformKernelDill:
|
||||||
|
case Artifact.platformLibrariesJson:
|
||||||
|
case Artifact.flutterPatchedSdkPath:
|
||||||
|
case Artifact.linuxDesktopPath:
|
||||||
|
case Artifact.linuxHeaders:
|
||||||
|
case Artifact.windowsDesktopPath:
|
||||||
|
case Artifact.windowsCppClientWrapper:
|
||||||
|
case Artifact.skyEnginePath:
|
||||||
|
case Artifact.fuchsiaKernelCompiler:
|
||||||
|
case Artifact.fuchsiaFlutterRunner:
|
||||||
|
case Artifact.fontSubset:
|
||||||
|
case Artifact.constFinder:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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.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.webPlatformKernelFolder:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel');
|
||||||
|
return _fileSystem.file(path);
|
||||||
|
case HostArtifact.webPlatformDDCKernelDill:
|
||||||
|
case HostArtifact.webPlatformDDCSoundKernelDill:
|
||||||
|
case HostArtifact.webPlatformDart2JSKernelDill:
|
||||||
|
case HostArtifact.webPlatformDart2JSSoundKernelDill:
|
||||||
|
final String path = _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _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.
|
||||||
|
@ -1023,6 +1211,9 @@ 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, {
|
||||||
|
@ -1030,6 +1221,9 @@ class OverrideArtifacts implements Artifacts {
|
||||||
BuildMode? mode,
|
BuildMode? mode,
|
||||||
EnvironmentType? environmentType,
|
EnvironmentType? environmentType,
|
||||||
}) {
|
}) {
|
||||||
|
if (artifact == Artifact.engineDartBinary && engineDartBinary != null) {
|
||||||
|
return engineDartBinary!.path;
|
||||||
|
}
|
||||||
if (artifact == Artifact.frontendServerSnapshotForEngineDartSdk && frontendServer != null) {
|
if (artifact == Artifact.frontendServerSnapshotForEngineDartSdk && frontendServer != null) {
|
||||||
return frontendServer!.path;
|
return frontendServer!.path;
|
||||||
}
|
}
|
||||||
|
@ -1055,9 +1249,6 @@ class OverrideArtifacts implements Artifacts {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
FileSystemEntity getHostArtifact(HostArtifact artifact) {
|
FileSystemEntity getHostArtifact(HostArtifact artifact) {
|
||||||
if (artifact == HostArtifact.engineDartBinary && engineDartBinary != null) {
|
|
||||||
return engineDartBinary!;
|
|
||||||
}
|
|
||||||
return parent.getHostArtifact(
|
return parent.getHostArtifact(
|
||||||
artifact,
|
artifact,
|
||||||
);
|
);
|
||||||
|
@ -1074,6 +1265,9 @@ 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, {
|
||||||
|
@ -1109,15 +1303,17 @@ class _TestArtifacts implements Artifacts {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TestLocalEngine extends _TestArtifacts implements LocalEngineArtifacts {
|
class _TestLocalEngine extends _TestArtifacts {
|
||||||
_TestLocalEngine(this.engineOutPath, FileSystem fileSystem) : super(fileSystem);
|
_TestLocalEngine(String engineOutPath, super.fileSystem) :
|
||||||
|
localEngineInfo =
|
||||||
|
LocalEngineInfo(
|
||||||
|
engineOutPath: engineOutPath,
|
||||||
|
localEngineName: fileSystem.path.basename(engineOutPath)
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get isLocalEngine => true;
|
bool get isLocalEngine => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final String engineOutPath;
|
final LocalEngineInfo localEngineInfo;
|
||||||
|
|
||||||
@override
|
|
||||||
String get localEngineName => fileSystem.path.basename(engineOutPath);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,10 +310,12 @@ 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 runnerLocalEngineRequired =>
|
String get runnerLocalEngineOrWebSdkRequired =>
|
||||||
'You must specify --local-engine if you are using a locally built engine.';
|
'You must specify --local-engine or --local-web-sdk if you are using a locally built engine or web sdk.';
|
||||||
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,6 +13,7 @@ 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;
|
||||||
|
@ -35,6 +36,7 @@ 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,
|
||||||
|
@ -124,6 +126,9 @@ 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.
|
||||||
///
|
///
|
||||||
|
@ -606,8 +611,9 @@ List<DarwinArch> defaultIOSArchsForEnvironment(
|
||||||
Artifacts artifacts,
|
Artifacts artifacts,
|
||||||
) {
|
) {
|
||||||
// Handle single-arch local engines.
|
// Handle single-arch local engines.
|
||||||
if (artifacts is LocalEngineArtifacts) {
|
final LocalEngineInfo? localEngineInfo = artifacts.localEngineInfo;
|
||||||
final String localEngineName = artifacts.localEngineName;
|
if (localEngineInfo != null) {
|
||||||
|
final String localEngineName = localEngineInfo.localEngineName;
|
||||||
if (localEngineName.contains('_arm64')) {
|
if (localEngineName.contains('_arm64')) {
|
||||||
return <DarwinArch>[ DarwinArch.arm64 ];
|
return <DarwinArch>[ DarwinArch.arm64 ];
|
||||||
}
|
}
|
||||||
|
@ -628,8 +634,9 @@ 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.
|
||||||
if (artifacts is LocalEngineArtifacts) {
|
final LocalEngineInfo? localEngineInfo = artifacts.localEngineInfo;
|
||||||
if (artifacts.localEngineName.contains('_arm64')) {
|
if (localEngineInfo != null) {
|
||||||
|
if (localEngineInfo.localEngineName.contains('_arm64')) {
|
||||||
return <DarwinArch>[ DarwinArch.arm64 ];
|
return <DarwinArch>[ DarwinArch.arm64 ];
|
||||||
}
|
}
|
||||||
return <DarwinArch>[ DarwinArch.x86_64 ];
|
return <DarwinArch>[ DarwinArch.x86_64 ];
|
||||||
|
@ -855,6 +862,10 @@ HostPlatform getCurrentHostPlatform() {
|
||||||
return HostPlatform.linux_x64;
|
return HostPlatform.linux_x64;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileSystemEntity getWebPlatformBinariesDirectory(Artifacts artifacts, WebRendererMode webRenderer) {
|
||||||
|
return artifacts.getHostArtifact(HostArtifact.webPlatformKernelFolder);
|
||||||
|
}
|
||||||
|
|
||||||
/// 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
|
||||||
|
|
|
@ -182,7 +182,7 @@ class AndroidAot extends AotElfBase {
|
||||||
List<Source> get inputs => <Source>[
|
List<Source> get inputs => <Source>[
|
||||||
const Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/android.dart'),
|
const Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/android.dart'),
|
||||||
const Source.pattern('{BUILD_DIR}/app.dill'),
|
const Source.pattern('{BUILD_DIR}/app.dill'),
|
||||||
const Source.hostArtifact(HostArtifact.engineDartBinary),
|
const Source.artifact(Artifact.engineDartBinary),
|
||||||
const Source.artifact(Artifact.skyEnginePath),
|
const Source.artifact(Artifact.skyEnginePath),
|
||||||
Source.artifact(Artifact.genSnapshot,
|
Source.artifact(Artifact.genSnapshot,
|
||||||
mode: buildMode,
|
mode: buildMode,
|
||||||
|
|
|
@ -132,7 +132,7 @@ class KernelSnapshot extends Target {
|
||||||
Source.pattern('{PROJECT_DIR}/.dart_tool/package_config_subset'),
|
Source.pattern('{PROJECT_DIR}/.dart_tool/package_config_subset'),
|
||||||
Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/common.dart'),
|
Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/common.dart'),
|
||||||
Source.artifact(Artifact.platformKernelDill),
|
Source.artifact(Artifact.platformKernelDill),
|
||||||
Source.hostArtifact(HostArtifact.engineDartBinary),
|
Source.artifact(Artifact.engineDartBinary),
|
||||||
Source.artifact(Artifact.frontendServerSnapshotForEngineDartSdk),
|
Source.artifact(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ class AotElfProfile extends AotElfBase {
|
||||||
List<Source> get inputs => <Source>[
|
List<Source> get inputs => <Source>[
|
||||||
const Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/common.dart'),
|
const Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/common.dart'),
|
||||||
const Source.pattern('{BUILD_DIR}/app.dill'),
|
const Source.pattern('{BUILD_DIR}/app.dill'),
|
||||||
const Source.hostArtifact(HostArtifact.engineDartBinary),
|
const Source.artifact(Artifact.engineDartBinary),
|
||||||
const Source.artifact(Artifact.skyEnginePath),
|
const Source.artifact(Artifact.skyEnginePath),
|
||||||
Source.artifact(Artifact.genSnapshot,
|
Source.artifact(Artifact.genSnapshot,
|
||||||
platform: targetPlatform,
|
platform: targetPlatform,
|
||||||
|
@ -349,7 +349,7 @@ class AotElfRelease extends AotElfBase {
|
||||||
List<Source> get inputs => <Source>[
|
List<Source> get inputs => <Source>[
|
||||||
const Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/common.dart'),
|
const Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/common.dart'),
|
||||||
const Source.pattern('{BUILD_DIR}/app.dill'),
|
const Source.pattern('{BUILD_DIR}/app.dill'),
|
||||||
const Source.hostArtifact(HostArtifact.engineDartBinary),
|
const Source.artifact(Artifact.engineDartBinary),
|
||||||
const Source.artifact(Artifact.skyEnginePath),
|
const Source.artifact(Artifact.skyEnginePath),
|
||||||
Source.artifact(Artifact.genSnapshot,
|
Source.artifact(Artifact.genSnapshot,
|
||||||
platform: targetPlatform,
|
platform: targetPlatform,
|
||||||
|
|
|
@ -106,7 +106,7 @@ class IconTreeShaker {
|
||||||
_artifacts.getArtifactPath(Artifact.constFinder),
|
_artifacts.getArtifactPath(Artifact.constFinder),
|
||||||
);
|
);
|
||||||
final File dart = _fs.file(
|
final File dart = _fs.file(
|
||||||
_artifacts.getHostArtifact(HostArtifact.engineDartBinary),
|
_artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
);
|
);
|
||||||
|
|
||||||
final Map<String, List<int>> iconData = await _findConstants(
|
final Map<String, List<int>> iconData = await _findConstants(
|
||||||
|
|
|
@ -142,7 +142,7 @@ class AotAssemblyRelease extends AotAssemblyBase {
|
||||||
List<Source> get inputs => const <Source>[
|
List<Source> get inputs => const <Source>[
|
||||||
Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/ios.dart'),
|
Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/ios.dart'),
|
||||||
Source.pattern('{BUILD_DIR}/app.dill'),
|
Source.pattern('{BUILD_DIR}/app.dill'),
|
||||||
Source.hostArtifact(HostArtifact.engineDartBinary),
|
Source.artifact(Artifact.engineDartBinary),
|
||||||
Source.artifact(Artifact.skyEnginePath),
|
Source.artifact(Artifact.skyEnginePath),
|
||||||
// TODO(zanderso): cannot reference gen_snapshot with artifacts since
|
// TODO(zanderso): cannot reference gen_snapshot with artifacts since
|
||||||
// it resolves to a file (ios/gen_snapshot) that never exists. This was
|
// it resolves to a file (ios/gen_snapshot) that never exists. This was
|
||||||
|
@ -177,7 +177,7 @@ class AotAssemblyProfile extends AotAssemblyBase {
|
||||||
List<Source> get inputs => const <Source>[
|
List<Source> get inputs => const <Source>[
|
||||||
Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/ios.dart'),
|
Source.pattern('{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/ios.dart'),
|
||||||
Source.pattern('{BUILD_DIR}/app.dill'),
|
Source.pattern('{BUILD_DIR}/app.dill'),
|
||||||
Source.hostArtifact(HostArtifact.engineDartBinary),
|
Source.artifact(Artifact.engineDartBinary),
|
||||||
Source.artifact(Artifact.skyEnginePath),
|
Source.artifact(Artifact.skyEnginePath),
|
||||||
// TODO(zanderso): cannot reference gen_snapshot with artifacts since
|
// TODO(zanderso): cannot reference gen_snapshot with artifacts since
|
||||||
// it resolves to a file (ios/gen_snapshot) that never exists. This was
|
// it resolves to a file (ios/gen_snapshot) that never exists. This was
|
||||||
|
|
|
@ -18,6 +18,7 @@ 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;
|
||||||
|
@ -141,7 +142,9 @@ 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();
|
const Dart2JSTarget(this.webRenderer);
|
||||||
|
|
||||||
|
final WebRendererMode webRenderer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'dart2js';
|
String get name => 'dart2js';
|
||||||
|
@ -155,8 +158,8 @@ class Dart2JSTarget extends Target {
|
||||||
@override
|
@override
|
||||||
List<Source> get inputs => const <Source>[
|
List<Source> get inputs => const <Source>[
|
||||||
Source.hostArtifact(HostArtifact.flutterWebSdk),
|
Source.hostArtifact(HostArtifact.flutterWebSdk),
|
||||||
Source.hostArtifact(HostArtifact.dart2jsSnapshot),
|
Source.artifact(Artifact.dart2jsSnapshot),
|
||||||
Source.hostArtifact(HostArtifact.engineDartBinary),
|
Source.artifact(Artifact.engineDartBinary),
|
||||||
Source.pattern('{BUILD_DIR}/main.dart'),
|
Source.pattern('{BUILD_DIR}/main.dart'),
|
||||||
Source.pattern('{PROJECT_DIR}/.dart_tool/package_config_subset'),
|
Source.pattern('{PROJECT_DIR}/.dart_tool/package_config_subset'),
|
||||||
];
|
];
|
||||||
|
@ -189,12 +192,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 librariesSpec = (artifacts.getHostArtifact(HostArtifact.flutterWebSdk) as Directory).childFile('libraries.json').path;
|
final String platformBinariesPath = getWebPlatformBinariesDirectory(artifacts, webRenderer).path;
|
||||||
final List<String> sharedCommandOptions = <String>[
|
final List<String> sharedCommandOptions = <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getHostArtifact(HostArtifact.dart2jsSnapshot).path,
|
artifacts.getArtifactPath(Artifact.dart2jsSnapshot, platform: TargetPlatform.web_javascript),
|
||||||
'--libraries-spec=$librariesSpec',
|
'--platform-binaries=$platformBinariesPath',
|
||||||
...decodeCommaSeparated(environment.defines, kExtraFrontEndOptions),
|
...decodeCommaSeparated(environment.defines, kExtraFrontEndOptions),
|
||||||
if (nativeNullAssertions)
|
if (nativeNullAssertions)
|
||||||
'--native-null-assertions',
|
'--native-null-assertions',
|
||||||
|
@ -269,14 +272,16 @@ 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();
|
const WebReleaseBundle(this.webRenderer);
|
||||||
|
|
||||||
|
final WebRendererMode webRenderer;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get name => 'web_release_bundle';
|
String get name => 'web_release_bundle';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
List<Target> get dependencies => const <Target>[
|
List<Target> get dependencies => <Target>[
|
||||||
Dart2JSTarget(),
|
Dart2JSTarget(webRenderer),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -454,18 +459,19 @@ 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);
|
const WebServiceWorker(this.fileSystem, this.cache, this.webRenderer);
|
||||||
|
|
||||||
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>[
|
||||||
const Dart2JSTarget(),
|
Dart2JSTarget(webRenderer),
|
||||||
const WebReleaseBundle(),
|
WebReleaseBundle(webRenderer),
|
||||||
WebBuiltInAssets(fileSystem, cache),
|
WebBuiltInAssets(fileSystem, cache),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ abstract class AnalyzeBase {
|
||||||
if (dartSdk != null) {
|
if (dartSdk != null) {
|
||||||
return dartSdk;
|
return dartSdk;
|
||||||
}
|
}
|
||||||
return artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path;
|
return artifacts.getArtifactPath(Artifact.engineDartSdkPath);
|
||||||
}
|
}
|
||||||
bool get isBenchmarking => argResults['benchmark'] as bool;
|
bool get isBenchmarking => argResults['benchmark'] as bool;
|
||||||
String? get protocolTrafficLog => argResults['protocol-traffic-log'] as String?;
|
String? get protocolTrafficLog => argResults['protocol-traffic-log'] as String?;
|
||||||
|
|
|
@ -18,7 +18,6 @@ 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';
|
||||||
|
@ -48,8 +47,6 @@ 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(),
|
||||||
|
|
|
@ -237,7 +237,7 @@ class DriveCommand extends RunCommandBase {
|
||||||
applicationPackageFactory: ApplicationPackageFactory.instance!,
|
applicationPackageFactory: ApplicationPackageFactory.instance!,
|
||||||
logger: _logger,
|
logger: _logger,
|
||||||
processUtils: globals.processUtils,
|
processUtils: globals.processUtils,
|
||||||
dartSdkPath: globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
dartSdkPath: globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||||
devtoolsLauncher: DevtoolsLauncher.instance!,
|
devtoolsLauncher: DevtoolsLauncher.instance!,
|
||||||
);
|
);
|
||||||
final PackageConfig packageConfig = await loadPackageConfigWithLogging(
|
final PackageConfig packageConfig = await loadPackageConfigWithLogging(
|
||||||
|
|
|
@ -45,7 +45,7 @@ class FormatCommand extends FlutterCommand {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
final String dartBinary = globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path;
|
final String dartBinary = globals.artifacts!.getArtifactPath(Artifact.engineDartBinary);
|
||||||
final List<String> command = <String>[
|
final List<String> command = <String>[
|
||||||
dartBinary,
|
dartBinary,
|
||||||
'format',
|
'format',
|
||||||
|
|
|
@ -301,7 +301,7 @@ class GenerateLocalizationsCommand extends FlutterCommand {
|
||||||
if (outputFileList.isEmpty) {
|
if (outputFileList.isEmpty) {
|
||||||
return FlutterCommandResult.success();
|
return FlutterCommandResult.success();
|
||||||
}
|
}
|
||||||
final String dartBinary = _artifacts.getHostArtifact(HostArtifact.engineDartBinary).path;
|
final String dartBinary = _artifacts.getArtifactPath(Artifact.engineDartBinary);
|
||||||
final List<String> command = <String>[dartBinary, 'format', ...outputFileList];
|
final List<String> command = <String>[dartBinary, 'format', ...outputFileList];
|
||||||
final ProcessResult result = await _processManager.run(command);
|
final ProcessResult result = await _processManager.run(command);
|
||||||
if (result.exitCode != 0) {
|
if (result.exitCode != 0) {
|
||||||
|
|
|
@ -248,14 +248,16 @@ class KernelCompiler {
|
||||||
required List<String> dartDefines,
|
required List<String> dartDefines,
|
||||||
required PackageConfig packageConfig,
|
required PackageConfig packageConfig,
|
||||||
}) async {
|
}) async {
|
||||||
|
final TargetPlatform? platform = targetModel == TargetModel.dartdevc ? TargetPlatform.web_javascript : null;
|
||||||
final String frontendServer = _artifacts.getArtifactPath(
|
final String frontendServer = _artifacts.getArtifactPath(
|
||||||
Artifact.frontendServerSnapshotForEngineDartSdk
|
Artifact.frontendServerSnapshotForEngineDartSdk,
|
||||||
|
platform: platform,
|
||||||
);
|
);
|
||||||
// This is a URI, not a file path, so the forward slash is correct even on Windows.
|
// This is a URI, not a file path, so the forward slash is correct even on Windows.
|
||||||
if (!sdkRoot.endsWith('/')) {
|
if (!sdkRoot.endsWith('/')) {
|
||||||
sdkRoot = '$sdkRoot/';
|
sdkRoot = '$sdkRoot/';
|
||||||
}
|
}
|
||||||
final String engineDartPath = _artifacts.getHostArtifact(HostArtifact.engineDartBinary).path;
|
final String engineDartPath = _artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform);
|
||||||
if (!_processManager.canRun(engineDartPath)) {
|
if (!_processManager.canRun(engineDartPath)) {
|
||||||
throwToolExit('Unable to find Dart binary at $engineDartPath');
|
throwToolExit('Unable to find Dart binary at $engineDartPath');
|
||||||
}
|
}
|
||||||
|
@ -740,11 +742,13 @@ class DefaultResidentCompiler implements ResidentCompiler {
|
||||||
String? outputPath,
|
String? outputPath,
|
||||||
{String? additionalSourceUri}
|
{String? additionalSourceUri}
|
||||||
) async {
|
) async {
|
||||||
|
final TargetPlatform? platform = (targetModel == TargetModel.dartdevc) ? TargetPlatform.web_javascript : null;
|
||||||
final String frontendServer = _artifacts.getArtifactPath(
|
final String frontendServer = _artifacts.getArtifactPath(
|
||||||
Artifact.frontendServerSnapshotForEngineDartSdk
|
Artifact.frontendServerSnapshotForEngineDartSdk,
|
||||||
|
platform: platform,
|
||||||
);
|
);
|
||||||
final List<String> command = <String>[
|
final List<String> command = <String>[
|
||||||
_artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
_artifacts.getArtifactPath(Artifact.engineDartBinary, platform: platform),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
frontendServer,
|
frontendServer,
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
|
|
@ -208,7 +208,7 @@ Future<T> runInContext<T>(
|
||||||
),
|
),
|
||||||
DevtoolsLauncher: () => DevtoolsServerLauncher(
|
DevtoolsLauncher: () => DevtoolsServerLauncher(
|
||||||
processManager: globals.processManager,
|
processManager: globals.processManager,
|
||||||
dartExecutable: globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
dartExecutable: globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||||
logger: globals.logger,
|
logger: globals.logger,
|
||||||
botDetector: globals.botDetector,
|
botDetector: globals.botDetector,
|
||||||
),
|
),
|
||||||
|
|
|
@ -70,7 +70,7 @@ class FuchsiaKernelCompiler {
|
||||||
'$multiRootScheme:///$target',
|
'$multiRootScheme:///$target',
|
||||||
];
|
];
|
||||||
|
|
||||||
final String? engineDartBinaryPath = globals.artifacts?.getHostArtifact(HostArtifact.engineDartBinary).path;
|
final String? engineDartBinaryPath = globals.artifacts?.getArtifactPath(Artifact.engineDartBinary);
|
||||||
if (engineDartBinaryPath == null) {
|
if (engineDartBinaryPath == null) {
|
||||||
throwToolExit('Engine dart binary not found at "$engineDartBinaryPath"');
|
throwToolExit('Engine dart binary not found at "$engineDartBinaryPath"');
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,13 +170,12 @@ 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 Artifacts? artifacts = globals.artifacts;
|
final LocalEngineInfo? localEngineInfo = globals.artifacts?.localEngineInfo;
|
||||||
if (artifacts is LocalEngineArtifacts) {
|
if (localEngineInfo != null) {
|
||||||
final LocalEngineArtifacts localEngineArtifacts = artifacts;
|
final String engineOutPath = localEngineInfo.engineOutPath;
|
||||||
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 = localEngineArtifacts.localEngineName;
|
final String localEngineName = localEngineInfo.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
|
||||||
|
|
|
@ -561,8 +561,9 @@ class WebAssetServer implements AssetReader {
|
||||||
|
|
||||||
// Otherwise it must be a Dart SDK source or a Flutter Web SDK source.
|
// Otherwise it must be a Dart SDK source or a Flutter Web SDK source.
|
||||||
final Directory dartSdkParent = globals.fs
|
final Directory dartSdkParent = globals.fs
|
||||||
.directory(
|
.directory(globals.artifacts!.getArtifactPath(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath))
|
Artifact.engineDartSdkPath,
|
||||||
|
platform: TargetPlatform.web_javascript))
|
||||||
.parent;
|
.parent;
|
||||||
final File dartSdkFile = globals.fs.file(dartSdkParent.uri.resolve(path));
|
final File dartSdkFile = globals.fs.file(dartSdkParent.uri.resolve(path));
|
||||||
if (dartSdkFile.existsSync()) {
|
if (dartSdkFile.existsSync()) {
|
||||||
|
@ -926,7 +927,7 @@ class WebDevFS implements DevFS {
|
||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
final File requireJS = globals.fs.file(globals.fs.path.join(
|
final File requireJS = globals.fs.file(globals.fs.path.join(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
|
||||||
'lib',
|
'lib',
|
||||||
'dev_compiler',
|
'dev_compiler',
|
||||||
'kernel',
|
'kernel',
|
||||||
|
@ -936,7 +937,7 @@ class WebDevFS implements DevFS {
|
||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
final File stackTraceMapper = globals.fs.file(globals.fs.path.join(
|
final File stackTraceMapper = globals.fs.file(globals.fs.path.join(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
|
||||||
'lib',
|
'lib',
|
||||||
'dev_compiler',
|
'dev_compiler',
|
||||||
'web',
|
'web',
|
||||||
|
|
|
@ -24,8 +24,8 @@ class SdkWebConfigurationProvider extends SdkConfigurationProvider {
|
||||||
Future<SdkConfiguration> get configuration async {
|
Future<SdkConfiguration> get configuration async {
|
||||||
if (_configuration == null) {
|
if (_configuration == null) {
|
||||||
final String sdkDir = _artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path;
|
final String sdkDir = _artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path;
|
||||||
final String unsoundSdkSummaryPath = _artifacts.getHostArtifact(HostArtifact.webPlatformKernelDill).path;
|
final String unsoundSdkSummaryPath = _artifacts.getHostArtifact(HostArtifact.webPlatformDDCKernelDill).path;
|
||||||
final String soundSdkSummaryPath = _artifacts.getHostArtifact(HostArtifact.webPlatformSoundKernelDill).path;
|
final String soundSdkSummaryPath = _artifacts.getHostArtifact(HostArtifact.webPlatformDDCSoundKernelDill).path;
|
||||||
final String librariesPath = _artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).path;
|
final String librariesPath = _artifacts.getHostArtifact(HostArtifact.flutterWebLibrariesJson).path;
|
||||||
|
|
||||||
_configuration = SdkConfiguration(
|
_configuration = SdkConfiguration(
|
||||||
|
|
|
@ -53,12 +53,11 @@ 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 Artifacts? artifacts = globals.artifacts;
|
final LocalEngineInfo? localEngineInfo = globals.artifacts?.localEngineInfo;
|
||||||
if (artifacts is LocalEngineArtifacts) {
|
if (localEngineInfo != null) {
|
||||||
final LocalEngineArtifacts localEngineArtifacts = artifacts;
|
final String engineOutPath = localEngineInfo.engineOutPath;
|
||||||
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'] = localEngineArtifacts.localEngineName;
|
environmentConfig['LOCAL_ENGINE'] = localEngineInfo.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 HostArtifact platformDillArtifact;
|
late String platformDillName;
|
||||||
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) {
|
||||||
platformDillArtifact = HostArtifact.webPlatformKernelDill;
|
platformDillName = 'ddc_outline.dill';
|
||||||
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) {
|
||||||
platformDillArtifact = HostArtifact.webPlatformSoundKernelDill;
|
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');
|
||||||
}
|
}
|
||||||
|
@ -123,6 +123,11 @@ 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,
|
||||||
|
@ -139,9 +144,7 @@ class FlutterDevice {
|
||||||
assumeInitializeFromDillUpToDate: buildInfo.assumeInitializeFromDillUpToDate,
|
assumeInitializeFromDillUpToDate: buildInfo.assumeInitializeFromDillUpToDate,
|
||||||
targetModel: TargetModel.dartdevc,
|
targetModel: TargetModel.dartdevc,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
platformDill: globals.fs.file(globals.artifacts!
|
platformDill: globals.fs.file(platformDillPath).absolute.uri.toString(),
|
||||||
.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,6 +29,7 @@ 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;
|
||||||
|
@ -122,6 +123,7 @@ 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.
|
||||||
|
@ -149,17 +151,25 @@ 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';
|
||||||
|
|
||||||
/// The map used to convert web-renderer option to a List of dart-defines.
|
/// Maps command line web renderer strings to the corresponding web renderer mode
|
||||||
static const Map<String, Iterable<String>> _webRendererDartDefines =
|
static const Map<String, WebRendererMode> _webRendererModeMap =
|
||||||
<String, Iterable<String>> {
|
<String, WebRendererMode> {
|
||||||
'auto': <String>[
|
'auto': WebRendererMode.autoDetect,
|
||||||
|
'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',
|
||||||
],
|
],
|
||||||
'canvaskit': <String>[
|
WebRendererMode.canvaskit: <String>[
|
||||||
'FLUTTER_WEB_AUTO_DETECT=false',
|
'FLUTTER_WEB_AUTO_DETECT=false',
|
||||||
'FLUTTER_WEB_USE_SKIA=true',
|
'FLUTTER_WEB_USE_SKIA=true',
|
||||||
],
|
],
|
||||||
'html': <String>[
|
WebRendererMode.html: <String>[
|
||||||
'FLUTTER_WEB_AUTO_DETECT=false',
|
'FLUTTER_WEB_AUTO_DETECT=false',
|
||||||
'FLUTTER_WEB_USE_SKIA=false',
|
'FLUTTER_WEB_USE_SKIA=false',
|
||||||
],
|
],
|
||||||
|
@ -620,7 +630,8 @@ abstract class FlutterCommand extends Command<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void usesWebRendererOption() {
|
void usesWebRendererOption() {
|
||||||
argParser.addOption('web-renderer',
|
argParser.addOption(
|
||||||
|
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.',
|
||||||
|
@ -1144,8 +1155,13 @@ abstract class FlutterCommand extends Command<void> {
|
||||||
? stringsArg(FlutterOptions.kDartDefinesOption)
|
? stringsArg(FlutterOptions.kDartDefinesOption)
|
||||||
: <String>[];
|
: <String>[];
|
||||||
|
|
||||||
if (argParser.options.containsKey('web-renderer')) {
|
WebRendererMode webRenderer = WebRendererMode.autoDetect;
|
||||||
dartDefines = updateDartDefines(dartDefines, stringArgDeprecated('web-renderer')!);
|
if (argParser.options.containsKey(FlutterOptions.kWebRendererFlag)) {
|
||||||
|
final WebRendererMode? mappedMode = _webRendererModeMap[stringArgDeprecated(FlutterOptions.kWebRendererFlag)!];
|
||||||
|
if (mappedMode != null) {
|
||||||
|
webRenderer = mappedMode;
|
||||||
|
}
|
||||||
|
dartDefines = updateDartDefines(dartDefines, webRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object>? defineConfigJsonMap;
|
Map<String, Object>? defineConfigJsonMap;
|
||||||
|
@ -1192,6 +1208,7 @@ 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'),
|
||||||
|
@ -1285,7 +1302,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, String webRenderer) {
|
static List<String> updateDartDefines(List<String> dartDefines, WebRendererMode 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,7 +96,13 @@ 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" or "--local-engine-src-out" (q.v.).');
|
'This path is relative to "--local-engine-src-path" (see above).');
|
||||||
|
|
||||||
|
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:');
|
||||||
|
@ -216,9 +222,10 @@ 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(
|
||||||
topLevelResults['local-engine-src-path'] as String?,
|
engineSourcePath: topLevelResults['local-engine-src-path'] as String?,
|
||||||
topLevelResults['local-engine'] as String?,
|
localEngine: topLevelResults['local-engine'] as String?,
|
||||||
topLevelResults['packages'] as String?,
|
localWebSdk: topLevelResults['local-web-sdk'] as String?,
|
||||||
|
packagePath: topLevelResults['packages'] as String?,
|
||||||
);
|
);
|
||||||
if (engineBuildPaths != null) {
|
if (engineBuildPaths != null) {
|
||||||
contextOverrides.addAll(<Type, Object?>{
|
contextOverrides.addAll(<Type, Object?>{
|
||||||
|
|
|
@ -46,17 +46,26 @@ 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? packagePath) async {
|
Future<EngineBuildPaths?> findEnginePath({String? engineSourcePath, String? localEngine, String? localWebSdk, String? packagePath}) async {
|
||||||
engineSourcePath ??= _platform.environment[kFlutterEngineEnvironmentVariableName];
|
engineSourcePath ??= _platform.environment[kFlutterEngineEnvironmentVariableName];
|
||||||
|
if (engineSourcePath == null && localEngine == null && localWebSdk == null && packagePath == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (engineSourcePath == null && localEngine != null) {
|
if (engineSourcePath == null) {
|
||||||
try {
|
try {
|
||||||
engineSourcePath = _findEngineSourceByLocalEngine(localEngine);
|
if (localEngine != null) {
|
||||||
|
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'),
|
||||||
|
@ -72,9 +81,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, engineSourcePath);
|
return _findEngineBuildPath(localEngine, localWebSdk, engineSourcePath);
|
||||||
}
|
}
|
||||||
if (localEngine != null) {
|
if (localEngine != null || localWebSdk != null) {
|
||||||
throwToolExit(
|
throwToolExit(
|
||||||
_userMessages.runnerNoEngineSrcDir(
|
_userMessages.runnerNoEngineSrcDir(
|
||||||
kFlutterEnginePackageName,
|
kFlutterEnginePackageName,
|
||||||
|
@ -86,15 +95,15 @@ class LocalEngineLocator {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _findEngineSourceByLocalEngine(String localEngine) {
|
String? _findEngineSourceByBuildPath(String buildPath) {
|
||||||
// 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(localEngine)) {
|
if (_fileSystem.path.isAbsolute(buildPath)) {
|
||||||
final Directory localEngineDirectory = _fileSystem.directory(localEngine);
|
final Directory buildDirectory = _fileSystem.directory(buildPath);
|
||||||
final Directory outDirectory = localEngineDirectory.parent;
|
final Directory outDirectory = buildDirectory.parent;
|
||||||
final Directory srcDirectory = outDirectory.parent;
|
final Directory srcDirectory = outDirectory.parent;
|
||||||
if (localEngineDirectory.existsSync() && outDirectory.basename == 'out' && srcDirectory.basename == 'src') {
|
if (buildDirectory.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;
|
||||||
}
|
}
|
||||||
|
@ -167,26 +176,38 @@ class LocalEngineLocator {
|
||||||
return 'host_$tmpBasename';
|
return 'host_$tmpBasename';
|
||||||
}
|
}
|
||||||
|
|
||||||
EngineBuildPaths _findEngineBuildPath(String? localEngine, String enginePath) {
|
EngineBuildPaths _findEngineBuildPath(String? localEngine, String? localWebSdk, String enginePath) {
|
||||||
if (localEngine == null) {
|
if (localEngine == null && localWebSdk == null) {
|
||||||
throwToolExit(_userMessages.runnerLocalEngineRequired, exitCode: 2);
|
throwToolExit(_userMessages.runnerLocalEngineOrWebSdkRequired, exitCode: 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
final String engineBuildPath = _fileSystem.path.normalize(_fileSystem.path.join(enginePath, 'out', localEngine));
|
String? engineBuildPath;
|
||||||
if (!_fileSystem.isDirectorySync(engineBuildPath)) {
|
String? engineHostBuildPath;
|
||||||
throwToolExit(_userMessages.runnerNoEngineBuild(engineBuildPath), exitCode: 2);
|
if (localEngine != null) {
|
||||||
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final String basename = _fileSystem.path.basename(engineBuildPath);
|
String? webSdkPath;
|
||||||
final String hostBasename = _getHostEngineBasename(basename);
|
if (localWebSdk != null) {
|
||||||
final String engineHostBuildPath = _fileSystem.path.normalize(
|
webSdkPath = _fileSystem.path.normalize(_fileSystem.path.join(enginePath, 'out', localWebSdk));
|
||||||
_fileSystem.path.join(_fileSystem.path.dirname(engineBuildPath), hostBasename),
|
if (!_fileSystem.isDirectorySync(webSdkPath)) {
|
||||||
);
|
throwToolExit(_userMessages.runnerNoWebSdk(webSdkPath), exitCode: 2);
|
||||||
if (!_fileSystem.isDirectorySync(engineHostBuildPath)) {
|
}
|
||||||
throwToolExit(_userMessages.runnerNoEngineBuild(engineHostBuildPath), exitCode: 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EngineBuildPaths(targetEngine: engineBuildPath, hostEngine: engineHostBuildPath);
|
return EngineBuildPaths(targetEngine: engineBuildPath, webSdk: webSdkPath, hostEngine: engineHostBuildPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
String? _tryEnginePath(String enginePath) {
|
String? _tryEnginePath(String enginePath) {
|
||||||
|
|
|
@ -188,7 +188,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
||||||
|
|
||||||
/// The require js binary.
|
/// The require js binary.
|
||||||
File get _requireJs => _fileSystem.file(_fileSystem.path.join(
|
File get _requireJs => _fileSystem.file(_fileSystem.path.join(
|
||||||
_artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
_artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
|
||||||
'lib',
|
'lib',
|
||||||
'dev_compiler',
|
'dev_compiler',
|
||||||
'kernel',
|
'kernel',
|
||||||
|
@ -198,7 +198,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
||||||
|
|
||||||
/// The ddc to dart stack trace mapper.
|
/// The ddc to dart stack trace mapper.
|
||||||
File get _stackTraceMapper => _fileSystem.file(_fileSystem.path.join(
|
File get _stackTraceMapper => _fileSystem.file(_fileSystem.path.join(
|
||||||
_artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
_artifacts!.getArtifactPath(Artifact.engineDartSdkPath, platform: TargetPlatform.web_javascript),
|
||||||
'lib',
|
'lib',
|
||||||
'dev_compiler',
|
'dev_compiler',
|
||||||
'web',
|
'web',
|
||||||
|
|
|
@ -50,22 +50,29 @@ class WebTestCompiler {
|
||||||
required BuildInfo buildInfo,
|
required BuildInfo buildInfo,
|
||||||
}) async {
|
}) async {
|
||||||
LanguageVersion languageVersion = LanguageVersion(2, 8);
|
LanguageVersion languageVersion = LanguageVersion(2, 8);
|
||||||
HostArtifact platformDillArtifact = HostArtifact.webPlatformSoundKernelDill;
|
late final String platformDillName;
|
||||||
|
|
||||||
// TODO(zanderso): to support autodetect this would need to partition the source code into a
|
// 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) {
|
||||||
platformDillArtifact = HostArtifact.webPlatformKernelDill;
|
platformDillName = 'ddc_outline.dill';
|
||||||
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>[];
|
||||||
|
@ -116,9 +123,7 @@ class WebTestCompiler {
|
||||||
initializeFromDill: cachedKernelPath,
|
initializeFromDill: cachedKernelPath,
|
||||||
targetModel: TargetModel.dartdevc,
|
targetModel: TargetModel.dartdevc,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
platformDill: _artifacts
|
platformDill: platformDillPath,
|
||||||
.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,
|
||||||
|
|
|
@ -50,42 +50,44 @@ 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(WebServiceWorker(globals.fs, globals.cache), Environment(
|
final BuildResult result = await globals.buildSystem.build(
|
||||||
projectDir: globals.fs.currentDirectory,
|
WebServiceWorker(globals.fs, globals.cache, buildInfo.webRenderer),
|
||||||
outputDir: outputDirectory,
|
Environment(
|
||||||
buildDir: flutterProject.directory
|
projectDir: globals.fs.currentDirectory,
|
||||||
.childDirectory('.dart_tool')
|
outputDir: outputDirectory,
|
||||||
.childDirectory('flutter_build'),
|
buildDir: flutterProject.directory
|
||||||
defines: <String, String>{
|
.childDirectory('.dart_tool')
|
||||||
kTargetFile: target,
|
.childDirectory('flutter_build'),
|
||||||
kHasWebPlugins: hasWebPlugins.toString(),
|
defines: <String, String>{
|
||||||
kCspMode: csp.toString(),
|
kTargetFile: target,
|
||||||
if (baseHref != null)
|
kHasWebPlugins: hasWebPlugins.toString(),
|
||||||
kBaseHref : baseHref,
|
kCspMode: csp.toString(),
|
||||||
kSourceMapsEnabled: sourceMaps.toString(),
|
if (baseHref != null)
|
||||||
kNativeNullAssertions: nativeNullAssertions.toString(),
|
kBaseHref : baseHref,
|
||||||
if (serviceWorkerStrategy != null)
|
kSourceMapsEnabled: sourceMaps.toString(),
|
||||||
kServiceWorkerStrategy: serviceWorkerStrategy,
|
kNativeNullAssertions: nativeNullAssertions.toString(),
|
||||||
if (dart2jsOptimization != null)
|
if (serviceWorkerStrategy != null)
|
||||||
kDart2jsOptimization: dart2jsOptimization,
|
kServiceWorkerStrategy: serviceWorkerStrategy,
|
||||||
kDart2jsDumpInfo: dumpInfo.toString(),
|
if (dart2jsOptimization != null)
|
||||||
kDart2jsNoFrequencyBasedMinification: noFrequencyBasedMinification.toString(),
|
kDart2jsOptimization: dart2jsOptimization,
|
||||||
...buildInfo.toBuildSystemEnvironment(),
|
kDart2jsDumpInfo: dumpInfo.toString(),
|
||||||
},
|
kDart2jsNoFrequencyBasedMinification: noFrequencyBasedMinification.toString(),
|
||||||
artifacts: globals.artifacts!,
|
...buildInfo.toBuildSystemEnvironment(),
|
||||||
fileSystem: globals.fs,
|
},
|
||||||
logger: globals.logger,
|
artifacts: globals.artifacts!,
|
||||||
processManager: globals.processManager,
|
fileSystem: globals.fs,
|
||||||
platform: globals.platform,
|
logger: globals.logger,
|
||||||
usage: globals.flutterUsage,
|
processManager: globals.processManager,
|
||||||
cacheDir: globals.cache.getRoot(),
|
platform: globals.platform,
|
||||||
engineVersion: globals.artifacts!.isLocalEngine
|
usage: globals.flutterUsage,
|
||||||
? null
|
cacheDir: globals.cache.getRoot(),
|
||||||
: globals.flutterVersion.engineRevision,
|
engineVersion: globals.artifacts!.isLocalEngine
|
||||||
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
|
? null
|
||||||
// Web uses a different Dart plugin registry.
|
: globals.flutterVersion.engineRevision,
|
||||||
// https://github.com/flutter/flutter/issues/80406
|
flutterRootDir: globals.fs.directory(Cache.flutterRoot),
|
||||||
generateDartPluginRegistry: false,
|
// Web uses a different Dart plugin registry.
|
||||||
|
// 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 Artifacts artifacts = globals.artifacts!;
|
final LocalEngineInfo? localEngineInfo = globals.artifacts?.localEngineInfo;
|
||||||
if (artifacts is LocalEngineArtifacts) {
|
if (localEngineInfo != null) {
|
||||||
final String engineOutPath = artifacts.engineOutPath;
|
final String engineOutPath = localEngineInfo.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'] = artifacts.localEngineName;
|
environment['LOCAL_ENGINE'] = localEngineInfo.localEngineName;
|
||||||
}
|
}
|
||||||
writeGeneratedCmakeConfig(Cache.flutterRoot!, windowsProject, buildInfo, environment);
|
writeGeneratedCmakeConfig(Cache.flutterRoot!, windowsProject, buildInfo, environment);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
final AnalysisServer server = AnalysisServer(
|
final AnalysisServer server = AnalysisServer(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartSdkPath),
|
||||||
<String>[tempDir.path],
|
<String>[tempDir.path],
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: platform,
|
platform: platform,
|
||||||
|
@ -132,7 +132,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
final AnalysisServer server = AnalysisServer(
|
final AnalysisServer server = AnalysisServer(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartSdkPath),
|
||||||
<String>[tempDir.path],
|
<String>[tempDir.path],
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: platform,
|
platform: platform,
|
||||||
|
@ -159,7 +159,7 @@ void main() {
|
||||||
const String contents = "StringBuffer bar = StringBuffer('baz');";
|
const String contents = "StringBuffer bar = StringBuffer('baz');";
|
||||||
tempDir.childFile('main.dart').writeAsStringSync(contents);
|
tempDir.childFile('main.dart').writeAsStringSync(contents);
|
||||||
final AnalysisServer server = AnalysisServer(
|
final AnalysisServer server = AnalysisServer(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartSdkPath),
|
||||||
<String>[tempDir.path],
|
<String>[tempDir.path],
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: platform,
|
platform: platform,
|
||||||
|
@ -185,13 +185,13 @@ void main() {
|
||||||
<FakeCommand>[
|
<FakeCommand>[
|
||||||
FakeCommand(
|
FakeCommand(
|
||||||
command: const <String>[
|
command: const <String>[
|
||||||
'HostArtifact.engineDartSdkPath/bin/dart',
|
'Artifact.engineDartSdkPath/bin/dart',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'HostArtifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||||
'--disable-server-feature-completion',
|
'--disable-server-feature-completion',
|
||||||
'--disable-server-feature-search',
|
'--disable-server-feature-search',
|
||||||
'--sdk',
|
'--sdk',
|
||||||
'HostArtifact.engineDartSdkPath',
|
'Artifact.engineDartSdkPath',
|
||||||
],
|
],
|
||||||
stdin: IOSink(stdin.sink),
|
stdin: IOSink(stdin.sink),
|
||||||
),
|
),
|
||||||
|
@ -228,13 +228,13 @@ void main() {
|
||||||
<FakeCommand>[
|
<FakeCommand>[
|
||||||
FakeCommand(
|
FakeCommand(
|
||||||
command: const <String>[
|
command: const <String>[
|
||||||
'HostArtifact.engineDartSdkPath/bin/dart',
|
'Artifact.engineDartSdkPath/bin/dart',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'HostArtifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||||
'--disable-server-feature-completion',
|
'--disable-server-feature-completion',
|
||||||
'--disable-server-feature-search',
|
'--disable-server-feature-search',
|
||||||
'--sdk',
|
'--sdk',
|
||||||
'HostArtifact.engineDartSdkPath',
|
'Artifact.engineDartSdkPath',
|
||||||
],
|
],
|
||||||
stdin: IOSink(stdin.sink),
|
stdin: IOSink(stdin.sink),
|
||||||
stdout: '''
|
stdout: '''
|
||||||
|
@ -281,13 +281,13 @@ void main() {
|
||||||
<FakeCommand>[
|
<FakeCommand>[
|
||||||
FakeCommand(
|
FakeCommand(
|
||||||
command: const <String>[
|
command: const <String>[
|
||||||
'HostArtifact.engineDartSdkPath/bin/dart',
|
'Artifact.engineDartSdkPath/bin/dart',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'HostArtifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||||
'--disable-server-feature-completion',
|
'--disable-server-feature-completion',
|
||||||
'--disable-server-feature-search',
|
'--disable-server-feature-search',
|
||||||
'--sdk',
|
'--sdk',
|
||||||
'HostArtifact.engineDartSdkPath',
|
'Artifact.engineDartSdkPath',
|
||||||
],
|
],
|
||||||
stdin: IOSink(stdin.sink),
|
stdin: IOSink(stdin.sink),
|
||||||
stdout: '''
|
stdout: '''
|
||||||
|
|
|
@ -88,13 +88,13 @@ void main() {
|
||||||
const FakeCommand(
|
const FakeCommand(
|
||||||
// artifact paths are from Artifacts.test() and stable
|
// artifact paths are from Artifacts.test() and stable
|
||||||
command: <String>[
|
command: <String>[
|
||||||
'HostArtifact.engineDartSdkPath/bin/dart',
|
'Artifact.engineDartSdkPath/bin/dart',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'HostArtifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
'Artifact.engineDartSdkPath/bin/snapshots/analysis_server.dart.snapshot',
|
||||||
'--disable-server-feature-completion',
|
'--disable-server-feature-completion',
|
||||||
'--disable-server-feature-search',
|
'--disable-server-feature-search',
|
||||||
'--sdk',
|
'--sdk',
|
||||||
'HostArtifact.engineDartSdkPath',
|
'Artifact.engineDartSdkPath',
|
||||||
],
|
],
|
||||||
exitCode: SIGABRT,
|
exitCode: SIGABRT,
|
||||||
stderr: stderr,
|
stderr: stderr,
|
||||||
|
|
|
@ -195,7 +195,7 @@ void main() {
|
||||||
processManager.addCommand(
|
processManager.addCommand(
|
||||||
const FakeCommand(
|
const FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'format',
|
'format',
|
||||||
'/.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart',
|
'/.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart',
|
||||||
'/.dart_tool/flutter_gen/gen_l10n/app_localizations.dart',
|
'/.dart_tool/flutter_gen/gen_l10n/app_localizations.dart',
|
||||||
|
@ -241,7 +241,7 @@ format: true
|
||||||
processManager.addCommand(
|
processManager.addCommand(
|
||||||
const FakeCommand(
|
const FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'format',
|
'format',
|
||||||
'/.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart',
|
'/.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart',
|
||||||
'/.dart_tool/flutter_gen/gen_l10n/app_localizations.dart',
|
'/.dart_tool/flutter_gen/gen_l10n/app_localizations.dart',
|
||||||
|
|
|
@ -29,6 +29,7 @@ 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';
|
||||||
|
|
||||||
|
@ -673,35 +674,35 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('auto web-renderer with no dart-defines', () {
|
test('auto web-renderer with no dart-defines', () {
|
||||||
dartDefines = FlutterCommand.updateDartDefines(dartDefines, 'auto');
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.autoDetect);
|
||||||
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, 'canvaskit');
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.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, 'html');
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.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, 'auto');
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.autoDetect);
|
||||||
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, 'canvaskit');
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.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, 'html');
|
dartDefines = FlutterCommand.updateDartDefines(dartDefines, WebRendererMode.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']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1180,7 +1180,7 @@ void main() {
|
||||||
final String original = file.readAsStringSync();
|
final String original = file.readAsStringSync();
|
||||||
|
|
||||||
final Process process = await Process.start(
|
final Process process = await Process.start(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||||
<String>['format', '--output=show', file.path],
|
<String>['format', '--output=show', file.path],
|
||||||
workingDirectory: projectDir.path,
|
workingDirectory: projectDir.path,
|
||||||
);
|
);
|
||||||
|
@ -1277,7 +1277,7 @@ void main() {
|
||||||
final String original = file.readAsStringSync();
|
final String original = file.readAsStringSync();
|
||||||
|
|
||||||
final Process process = await Process.start(
|
final Process process = await Process.start(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||||
<String>['format', '--output=show', file.path],
|
<String>['format', '--output=show', file.path],
|
||||||
workingDirectory: projectDir.path,
|
workingDirectory: projectDir.path,
|
||||||
);
|
);
|
||||||
|
@ -3138,7 +3138,7 @@ Future<void> _analyzeProject(String workingDir, { List<String> expectedFailures
|
||||||
];
|
];
|
||||||
|
|
||||||
final ProcessResult exec = await Process.run(
|
final ProcessResult exec = await Process.run(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||||
args,
|
args,
|
||||||
workingDirectory: workingDir,
|
workingDirectory: workingDir,
|
||||||
);
|
);
|
||||||
|
@ -3195,7 +3195,7 @@ Future<void> _getPackages(Directory workingDir) async {
|
||||||
// While flutter test does get packages, it doesn't write version
|
// While flutter test does get packages, it doesn't write version
|
||||||
// files anymore.
|
// files anymore.
|
||||||
await Process.run(
|
await Process.run(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||||
<String>[
|
<String>[
|
||||||
flutterToolsSnapshotPath,
|
flutterToolsSnapshotPath,
|
||||||
'packages',
|
'packages',
|
||||||
|
@ -3224,7 +3224,7 @@ Future<void> _runFlutterTest(Directory workingDir, { String? target }) async {
|
||||||
];
|
];
|
||||||
|
|
||||||
final ProcessResult exec = await Process.run(
|
final ProcessResult exec = await Process.run(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary),
|
||||||
args,
|
args,
|
||||||
workingDirectory: workingDir.path,
|
workingDirectory: workingDir.path,
|
||||||
);
|
);
|
||||||
|
|
|
@ -199,7 +199,7 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
group('LocalEngineArtifacts', () {
|
group('LocalEngineArtifacts', () {
|
||||||
late LocalEngineArtifacts artifacts;
|
late Artifacts artifacts;
|
||||||
late Cache cache;
|
late Cache cache;
|
||||||
late FileSystem fileSystem;
|
late FileSystem fileSystem;
|
||||||
late Platform platform;
|
late Platform platform;
|
||||||
|
@ -217,15 +217,20 @@ void main() {
|
||||||
osUtils: FakeOperatingSystemUtils(),
|
osUtils: FakeOperatingSystemUtils(),
|
||||||
artifacts: <ArtifactSet>[],
|
artifacts: <ArtifactSet>[],
|
||||||
);
|
);
|
||||||
artifacts = LocalEngineArtifacts(
|
artifacts = CachedLocalWebSdkArtifacts(
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
parent: CachedLocalEngineArtifacts(
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||||
cache: cache,
|
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||||
|
cache: cache,
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
platform: platform,
|
||||||
|
processManager: FakeProcessManager.any(),
|
||||||
|
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||||
|
),
|
||||||
|
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: platform,
|
platform: platform,
|
||||||
processManager: FakeProcessManager.any(),
|
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('getArtifactPath', () {
|
testWithoutContext('getArtifactPath', () {
|
||||||
|
@ -314,7 +319,7 @@ void main() {
|
||||||
fileSystem.path.join('/out', 'android_debug_unopt', 'flutter_tester'),
|
fileSystem.path.join('/out', 'android_debug_unopt', 'flutter_tester'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
artifacts.getArtifactPath(Artifact.engineDartSdkPath),
|
||||||
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk'),
|
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
|
@ -350,34 +355,32 @@ void main() {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('falls back to prebuilt dart sdk', () {
|
testWithoutContext('uses prebuilt dart sdk for web platform', () {
|
||||||
final String failureMessage = 'Unable to find a built dart sdk at:'
|
final String failureMessage = 'Unable to find a prebuilt dart sdk at:'
|
||||||
' "${fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk')}"'
|
|
||||||
' or a prebuilt dart sdk at:'
|
|
||||||
' "${fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk')}"';
|
' "${fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk')}"';
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
() => artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
() => artifacts.getArtifactPath(
|
||||||
|
Artifact.frontendServerSnapshotForEngineDartSdk,
|
||||||
|
platform: TargetPlatform.web_javascript),
|
||||||
throwsToolExit(message: failureMessage),
|
throwsToolExit(message: failureMessage),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
() => artifacts.getHostArtifact(HostArtifact.engineDartSdkPath),
|
() => artifacts.getArtifactPath(
|
||||||
|
Artifact.engineDartSdkPath,
|
||||||
|
platform: TargetPlatform.web_javascript),
|
||||||
throwsToolExit(message: failureMessage),
|
throwsToolExit(message: failureMessage),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
() => artifacts.getHostArtifact(HostArtifact.engineDartBinary),
|
() => artifacts.getArtifactPath(
|
||||||
|
Artifact.engineDartBinary,
|
||||||
|
platform: TargetPlatform.web_javascript),
|
||||||
throwsToolExit(message: failureMessage),
|
throwsToolExit(message: failureMessage),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
() => artifacts.getHostArtifact(HostArtifact.dart2jsSnapshot),
|
() => artifacts.getArtifactPath(
|
||||||
throwsToolExit(message: failureMessage),
|
Artifact.dart2jsSnapshot,
|
||||||
);
|
platform: TargetPlatform.web_javascript),
|
||||||
expect(
|
|
||||||
() => artifacts.getHostArtifact(HostArtifact.dartdevcSnapshot),
|
|
||||||
throwsToolExit(message: failureMessage),
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
() => artifacts.getHostArtifact(HostArtifact.kernelWorkerSnapshot),
|
|
||||||
throwsToolExit(message: failureMessage),
|
throwsToolExit(message: failureMessage),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -390,33 +393,31 @@ void main() {
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
artifacts.getArtifactPath(
|
||||||
|
Artifact.frontendServerSnapshotForEngineDartSdk,
|
||||||
|
platform: TargetPlatform.web_javascript),
|
||||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin',
|
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin',
|
||||||
'snapshots', 'frontend_server.dart.snapshot'),
|
'snapshots', 'frontend_server.dart.snapshot'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartSdkPath).path,
|
artifacts.getArtifactPath(
|
||||||
|
Artifact.engineDartSdkPath,
|
||||||
|
platform: TargetPlatform.web_javascript),
|
||||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk'),
|
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(
|
||||||
|
Artifact.engineDartBinary,
|
||||||
|
platform: TargetPlatform.web_javascript),
|
||||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin', 'dart'),
|
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk', 'bin', 'dart'),
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.dart2jsSnapshot).path,
|
artifacts.getArtifactPath(
|
||||||
|
Artifact.dart2jsSnapshot,
|
||||||
|
platform: TargetPlatform.web_javascript),
|
||||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk',
|
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk',
|
||||||
'bin', 'snapshots', 'dart2js.dart.snapshot'),
|
'bin', 'snapshots', 'dart2js.dart.snapshot'),
|
||||||
);
|
);
|
||||||
expect(
|
|
||||||
artifacts.getHostArtifact(HostArtifact.dartdevcSnapshot).path,
|
|
||||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk',
|
|
||||||
'bin', 'snapshots', 'dartdevc.dart.snapshot'),
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
artifacts.getHostArtifact(HostArtifact.kernelWorkerSnapshot).path,
|
|
||||||
fileSystem.path.join('/flutter', 'prebuilts', 'linux-x64', 'dart-sdk',
|
|
||||||
'bin', 'snapshots', 'kernel_worker.dart.snapshot'),
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('getEngineType', () {
|
testWithoutContext('getEngineType', () {
|
||||||
|
@ -435,15 +436,20 @@ void main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Looks up dart.exe on windows platforms', () async {
|
testWithoutContext('Looks up dart.exe on windows platforms', () async {
|
||||||
artifacts = LocalEngineArtifacts(
|
artifacts = CachedLocalWebSdkArtifacts(
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
parent: CachedLocalEngineArtifacts(
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||||
cache: cache,
|
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||||
|
cache: cache,
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
platform: FakePlatform(operatingSystem: 'windows'),
|
||||||
|
processManager: FakeProcessManager.any(),
|
||||||
|
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||||
|
),
|
||||||
|
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: FakePlatform(operatingSystem: 'windows'),
|
platform: FakePlatform(operatingSystem: 'windows'),
|
||||||
processManager: FakeProcessManager.any(),
|
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
|
||||||
);
|
|
||||||
|
|
||||||
fileSystem
|
fileSystem
|
||||||
.directory('out')
|
.directory('out')
|
||||||
|
@ -453,7 +459,7 @@ void main() {
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin', 'dart.exe'),
|
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin', 'dart.exe'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -467,21 +473,26 @@ void main() {
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin', 'dart'),
|
fileSystem.path.join('/out', 'host_debug_unopt', 'dart-sdk', 'bin', 'dart'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Finds dart-sdk in windows prebuilts', () async {
|
testWithoutContext('Finds dart-sdk in windows prebuilts for web platform', () async {
|
||||||
artifacts = LocalEngineArtifacts(
|
artifacts = CachedLocalWebSdkArtifacts(
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
parent: CachedLocalEngineArtifacts(
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||||
cache: cache,
|
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||||
|
cache: cache,
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
platform: FakePlatform(operatingSystem: 'windows'),
|
||||||
|
processManager: FakeProcessManager.any(),
|
||||||
|
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||||
|
),
|
||||||
|
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: FakePlatform(operatingSystem: 'windows'),
|
platform: FakePlatform(operatingSystem: 'windows'),
|
||||||
processManager: FakeProcessManager.any(),
|
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
|
||||||
);
|
|
||||||
|
|
||||||
fileSystem
|
fileSystem
|
||||||
.directory('/flutter')
|
.directory('/flutter')
|
||||||
|
@ -492,21 +503,26 @@ void main() {
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||||
fileSystem.path.join('/flutter', 'prebuilts', 'windows-x64', 'dart-sdk', 'bin', 'dart.exe'),
|
fileSystem.path.join('/flutter', 'prebuilts', 'windows-x64', 'dart-sdk', 'bin', 'dart.exe'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
testWithoutContext('Finds dart-sdk in macos prebuilts', () async {
|
testWithoutContext('Finds dart-sdk in macos prebuilts for web platform', () async {
|
||||||
artifacts = LocalEngineArtifacts(
|
artifacts = CachedLocalWebSdkArtifacts(
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
parent: CachedLocalEngineArtifacts(
|
||||||
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
|
||||||
cache: cache,
|
engineOutPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'android_debug_unopt'),
|
||||||
|
cache: cache,
|
||||||
|
fileSystem: fileSystem,
|
||||||
|
platform: FakePlatform(operatingSystem: 'macos'),
|
||||||
|
processManager: FakeProcessManager.any(),
|
||||||
|
operatingSystemUtils: FakeOperatingSystemUtils(),
|
||||||
|
),
|
||||||
|
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
|
||||||
fileSystem: fileSystem,
|
fileSystem: fileSystem,
|
||||||
platform: FakePlatform(operatingSystem: 'macos'),
|
platform: FakePlatform(operatingSystem: 'macos'),
|
||||||
processManager: FakeProcessManager.any(),
|
operatingSystemUtils: FakeOperatingSystemUtils());
|
||||||
operatingSystemUtils: FakeOperatingSystemUtils(),
|
|
||||||
);
|
|
||||||
|
|
||||||
fileSystem
|
fileSystem
|
||||||
.directory('/flutter')
|
.directory('/flutter')
|
||||||
|
@ -517,7 +533,7 @@ void main() {
|
||||||
.createSync(recursive: true);
|
.createSync(recursive: true);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||||
fileSystem.path.join('/flutter', 'prebuilts', 'macos-x64', 'dart-sdk', 'bin', 'dart'),
|
fileSystem.path.join('/flutter', 'prebuilts', 'macos-x64', 'dart-sdk', 'bin', 'dart'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -83,7 +83,7 @@ void main() {
|
||||||
);
|
);
|
||||||
processManager.addCommands(<FakeCommand>[
|
processManager.addCommands(<FakeCommand>[
|
||||||
FakeCommand(command: <String>[
|
FakeCommand(command: <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -121,7 +121,7 @@ void main() {
|
||||||
);
|
);
|
||||||
processManager.addCommands(<FakeCommand>[
|
processManager.addCommands(<FakeCommand>[
|
||||||
FakeCommand(command: <String>[
|
FakeCommand(command: <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -160,7 +160,7 @@ void main() {
|
||||||
);
|
);
|
||||||
processManager.addCommands(<FakeCommand>[
|
processManager.addCommands(<FakeCommand>[
|
||||||
FakeCommand(command: <String>[
|
FakeCommand(command: <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -200,7 +200,7 @@ void main() {
|
||||||
);
|
);
|
||||||
processManager.addCommands(<FakeCommand>[
|
processManager.addCommands(<FakeCommand>[
|
||||||
FakeCommand(command: <String>[
|
FakeCommand(command: <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -242,7 +242,7 @@ void main() {
|
||||||
);
|
);
|
||||||
processManager.addCommands(<FakeCommand>[
|
processManager.addCommands(<FakeCommand>[
|
||||||
FakeCommand(command: <String>[
|
FakeCommand(command: <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -284,7 +284,7 @@ void main() {
|
||||||
);
|
);
|
||||||
processManager.addCommands(<FakeCommand>[
|
processManager.addCommands(<FakeCommand>[
|
||||||
FakeCommand(command: <String>[
|
FakeCommand(command: <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -338,7 +338,7 @@ void main() {
|
||||||
);
|
);
|
||||||
processManager.addCommands(<FakeCommand>[
|
processManager.addCommands(<FakeCommand>[
|
||||||
FakeCommand(command: <String>[
|
FakeCommand(command: <String>[
|
||||||
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
|
|
@ -79,7 +79,7 @@ void main() {
|
||||||
artifacts = Artifacts.test();
|
artifacts = Artifacts.test();
|
||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
logger = BufferLogger.test();
|
logger = BufferLogger.test();
|
||||||
dartPath = artifacts.getHostArtifact(HostArtifact.engineDartBinary).path;
|
dartPath = artifacts.getArtifactPath(Artifact.engineDartBinary);
|
||||||
constFinderPath = artifacts.getArtifactPath(Artifact.constFinder);
|
constFinderPath = artifacts.getArtifactPath(Artifact.constFinder);
|
||||||
fontSubsetPath = artifacts.getArtifactPath(Artifact.fontSubset);
|
fontSubsetPath = artifacts.getArtifactPath(Artifact.fontSubset);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ 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';
|
||||||
|
|
||||||
|
@ -24,7 +25,6 @@ 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().build(environment);
|
await const WebReleaseBundle(WebRendererMode.autoDetect).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().build(environment);
|
await const WebReleaseBundle(WebRendererMode.autoDetect).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().build(environment);
|
await const WebReleaseBundle(WebRendererMode.autoDetect).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().build(environment);
|
await const WebReleaseBundle(WebRendererMode.autoDetect).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().build(environment);
|
await const WebReleaseBundle(WebRendererMode.autoDetect).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().build(environment);
|
await const WebReleaseBundle(WebRendererMode.autoDetect).build(environment);
|
||||||
|
|
||||||
expect(environment.outputDir.childFile('foo.txt')
|
expect(environment.outputDir.childFile('foo.txt')
|
||||||
.readAsStringSync(), 'B');
|
.readAsStringSync(), 'B');
|
||||||
|
@ -333,6 +333,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
|
@ -345,6 +346,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O4',
|
'-O4',
|
||||||
|
@ -356,7 +358,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -368,6 +370,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'--enable-experiment=non-nullable',
|
'--enable-experiment=non-nullable',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
|
@ -381,6 +384,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'--enable-experiment=non-nullable',
|
'--enable-experiment=non-nullable',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
|
@ -392,7 +396,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -402,6 +406,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
|
@ -414,6 +419,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O4',
|
'-O4',
|
||||||
|
@ -424,7 +430,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -434,6 +440,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
|
@ -446,6 +453,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O4',
|
'-O4',
|
||||||
|
@ -455,7 +463,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -466,6 +474,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'--native-null-assertions',
|
'--native-null-assertions',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
|
@ -479,6 +488,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'--native-null-assertions',
|
'--native-null-assertions',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
|
@ -489,7 +499,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -500,6 +510,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
|
@ -512,6 +523,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O3',
|
'-O3',
|
||||||
|
@ -521,7 +533,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -531,6 +543,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
|
@ -543,7 +556,7 @@ void main() {
|
||||||
.writeAsStringSync('file:///a.dart');
|
.writeAsStringSync('file:///a.dart');
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).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'));
|
||||||
|
@ -561,6 +574,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'-DFOO=bar',
|
'-DFOO=bar',
|
||||||
'-DBAZ=qux',
|
'-DBAZ=qux',
|
||||||
|
@ -575,6 +589,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'-DFOO=bar',
|
'-DFOO=bar',
|
||||||
'-DBAZ=qux',
|
'-DBAZ=qux',
|
||||||
|
@ -586,7 +601,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -597,6 +612,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'-o',
|
'-o',
|
||||||
environment.buildDir.childFile('app.dill').absolute.path,
|
environment.buildDir.childFile('app.dill').absolute.path,
|
||||||
|
@ -608,6 +624,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.product=true',
|
'-Ddart.vm.product=true',
|
||||||
'-O4',
|
'-O4',
|
||||||
'-o',
|
'-o',
|
||||||
|
@ -616,7 +633,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -628,6 +645,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'-DFOO=bar',
|
'-DFOO=bar',
|
||||||
'-DBAZ=qux',
|
'-DBAZ=qux',
|
||||||
|
@ -642,6 +660,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'-DFOO=bar',
|
'-DFOO=bar',
|
||||||
'-DBAZ=qux',
|
'-DBAZ=qux',
|
||||||
|
@ -654,7 +673,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.autoDetect).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -665,6 +684,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
|
@ -677,6 +697,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O4',
|
'-O4',
|
||||||
|
@ -688,7 +709,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.canvaskit).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -699,6 +720,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-o',
|
'-o',
|
||||||
|
@ -711,6 +733,7 @@ void main() {
|
||||||
processManager.addCommand(FakeCommand(
|
processManager.addCommand(FakeCommand(
|
||||||
command: <String>[
|
command: <String>[
|
||||||
...kDart2jsLinuxArgs,
|
...kDart2jsLinuxArgs,
|
||||||
|
'--platform-binaries=bin/cache/flutter_web_sdk/kernel',
|
||||||
'-Ddart.vm.profile=true',
|
'-Ddart.vm.profile=true',
|
||||||
'--no-source-maps',
|
'--no-source-maps',
|
||||||
'-O4',
|
'-O4',
|
||||||
|
@ -722,7 +745,7 @@ void main() {
|
||||||
]
|
]
|
||||||
));
|
));
|
||||||
|
|
||||||
await const Dart2JSTarget().build(environment);
|
await const Dart2JSTarget(WebRendererMode.canvaskit).build(environment);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
ProcessManager: () => processManager,
|
ProcessManager: () => processManager,
|
||||||
}));
|
}));
|
||||||
|
@ -749,7 +772,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).build(environment);
|
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).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.
|
||||||
|
@ -768,7 +791,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).build(environment);
|
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).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.
|
||||||
|
@ -786,7 +809,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).build(environment);
|
await WebServiceWorker(globals.fs, globals.cache, WebRendererMode.autoDetect).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(),
|
||||||
|
|
|
@ -53,7 +53,7 @@ void main() {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||||
FakeCommand(command: const <String>[
|
FakeCommand(command: const <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -99,7 +99,7 @@ void main() {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||||
FakeCommand(command: const <String>[
|
FakeCommand(command: const <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -145,7 +145,7 @@ void main() {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||||
FakeCommand(command: const <String>[
|
FakeCommand(command: const <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -191,7 +191,7 @@ void main() {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||||
FakeCommand(command: const <String>[
|
FakeCommand(command: const <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -240,7 +240,7 @@ void main() {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||||
FakeCommand(command: const <String>[
|
FakeCommand(command: const <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -289,7 +289,7 @@ void main() {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||||
FakeCommand(command: const <String>[
|
FakeCommand(command: const <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -341,7 +341,7 @@ void main() {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||||
FakeCommand(command: const <String>[
|
FakeCommand(command: const <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
@ -391,7 +391,7 @@ void main() {
|
||||||
logger: logger,
|
logger: logger,
|
||||||
processManager: FakeProcessManager.list(<FakeCommand>[
|
processManager: FakeProcessManager.list(<FakeCommand>[
|
||||||
FakeCommand(command: const <String>[
|
FakeCommand(command: const <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
|
|
@ -30,7 +30,7 @@ void main() {
|
||||||
late FakeProcessManager fakeProcessManager;
|
late FakeProcessManager fakeProcessManager;
|
||||||
|
|
||||||
const List<String> frontendServerCommand = <String>[
|
const List<String> frontendServerCommand = <String>[
|
||||||
'HostArtifact.engineDartBinary',
|
'Artifact.engineDartBinary',
|
||||||
'--disable-dart-dev',
|
'--disable-dart-dev',
|
||||||
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
'Artifact.frontendServerSnapshotForEngineDartSdk',
|
||||||
'--sdk-root',
|
'--sdk-root',
|
||||||
|
|
|
@ -1943,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.webPlatformKernelDill');
|
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelFolder/ddc_outline.dill');
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Artifacts: () => Artifacts.test(),
|
Artifacts: () => Artifacts.test(),
|
||||||
FileSystem: () => MemoryFileSystem.test(),
|
FileSystem: () => MemoryFileSystem.test(),
|
||||||
|
@ -1974,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.webPlatformSoundKernelDill');
|
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelFolder/ddc_outline_sound.dill');
|
||||||
}, 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(null, 'ios_debug', null),
|
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
||||||
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(null, 'ios_debug', null),
|
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
||||||
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('$kArbitraryEngineRoot/src', 'ios_debug', null),
|
await localEngineLocator.findEnginePath(engineSourcePath: '$kArbitraryEngineRoot/src', localEngine: 'ios_debug'),
|
||||||
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(null, localEngine.path, null),
|
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||||
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(null, localEngine.path, null),
|
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||||
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',
|
||||||
|
@ -162,7 +162,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(null, localEngine.path, null),
|
await localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||||
matchesEngineBuildPaths(
|
matchesEngineBuildPaths(
|
||||||
hostEngine: '/arbitrary/engine/src/out/host_debug_unopt_arm64',
|
hostEngine: '/arbitrary/engine/src/out/host_debug_unopt_arm64',
|
||||||
targetEngine: '/arbitrary/engine/src/out/host_debug_unopt_arm64',
|
targetEngine: '/arbitrary/engine/src/out/host_debug_unopt_arm64',
|
||||||
|
@ -185,7 +185,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
await expectToolExitLater(
|
await expectToolExitLater(
|
||||||
localEngineLocator.findEnginePath(null, localEngine.path, null),
|
localEngineLocator.findEnginePath(localEngine: localEngine.path),
|
||||||
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'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -214,7 +214,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localEngineLocator.findEnginePath(null, 'ios_debug', null),
|
await localEngineLocator.findEnginePath(localEngine: 'ios_debug'),
|
||||||
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',
|
||||||
|
@ -236,7 +236,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
await expectToolExitLater(
|
await expectToolExitLater(
|
||||||
localEngineLocator.findEnginePath(null, '/path/to/nothing', null),
|
localEngineLocator.findEnginePath(localEngine: '/path/to/nothing'),
|
||||||
contains('Unable to detect local Flutter engine src directory'),
|
contains('Unable to detect local Flutter engine src directory'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -260,7 +260,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localWasmEngineLocator.findEnginePath(null, localWasmEngine.path, null),
|
await localWasmEngineLocator.findEnginePath(localEngine: localWasmEngine.path),
|
||||||
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',
|
||||||
|
@ -278,7 +278,7 @@ void main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
await localWebEngineLocator.findEnginePath(null, localWebEngine.path, null),
|
await localWebEngineLocator.findEnginePath(localEngine: localWebEngine.path),
|
||||||
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',
|
||||||
|
@ -286,6 +286,34 @@ void main() {
|
||||||
);
|
);
|
||||||
expect(webLogger.traceText, contains('Local engine source at /arbitrary/engine/src'));
|
expect(webLogger.traceText, contains('Local engine source at /arbitrary/engine/src'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('returns null without throwing if nothing is specified', () async {
|
||||||
|
final LocalEngineLocator localWebEngineLocator = LocalEngineLocator(
|
||||||
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
flutterRoot: 'flutter/flutter',
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
userMessages: UserMessages(),
|
||||||
|
platform: FakePlatform(environment: <String, String>{}),
|
||||||
|
);
|
||||||
|
|
||||||
|
final EngineBuildPaths? paths = await localWebEngineLocator.findEnginePath();
|
||||||
|
expect(paths, isNull);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('throws if nothing is specified but the FLUTTER_ENGINE environment variable is set', () async {
|
||||||
|
final LocalEngineLocator localWebEngineLocator = LocalEngineLocator(
|
||||||
|
fileSystem: MemoryFileSystem.test(),
|
||||||
|
flutterRoot: 'flutter/flutter',
|
||||||
|
logger: BufferLogger.test(),
|
||||||
|
userMessages: UserMessages(),
|
||||||
|
platform: FakePlatform(environment: <String, String>{'FLUTTER_ENGINE': 'blah'}),
|
||||||
|
);
|
||||||
|
|
||||||
|
await expectToolExitLater(
|
||||||
|
localWebEngineLocator.findEnginePath(),
|
||||||
|
contains('Unable to detect a Flutter engine build directory in blah'),
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Matcher matchesEngineBuildPaths({
|
Matcher matchesEngineBuildPaths({
|
||||||
|
|
|
@ -9,6 +9,7 @@ import 'package:file_testing/file_testing.dart';
|
||||||
import 'package:flutter_tools/src/artifacts.dart';
|
import 'package:flutter_tools/src/artifacts.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
import 'package:flutter_tools/src/cache.dart';
|
import 'package:flutter_tools/src/cache.dart';
|
||||||
import 'package:flutter_tools/src/commands/create.dart';
|
import 'package:flutter_tools/src/commands/create.dart';
|
||||||
import 'package:flutter_tools/src/dart/pub.dart';
|
import 'package:flutter_tools/src/dart/pub.dart';
|
||||||
|
@ -412,7 +413,7 @@ Future<void> _analyzeEntity(FileSystemEntity target) async {
|
||||||
];
|
];
|
||||||
|
|
||||||
final ProcessResult exec = await Process.run(
|
final ProcessResult exec = await Process.run(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||||
args,
|
args,
|
||||||
workingDirectory: target is Directory ? target.path : target.dirname,
|
workingDirectory: target is Directory ? target.path : target.dirname,
|
||||||
);
|
);
|
||||||
|
@ -451,7 +452,7 @@ Future<void> _runFlutterSnapshot(List<String> flutterCommandArgs, Directory work
|
||||||
];
|
];
|
||||||
|
|
||||||
final ProcessResult exec = await Process.run(
|
final ProcessResult exec = await Process.run(
|
||||||
globals.artifacts!.getHostArtifact(HostArtifact.engineDartBinary).path,
|
globals.artifacts!.getArtifactPath(Artifact.engineDartBinary, platform: TargetPlatform.web_javascript),
|
||||||
args,
|
args,
|
||||||
workingDirectory: workingDir.path,
|
workingDirectory: workingDir.path,
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,8 +19,8 @@ void main() {
|
||||||
setUp(() async {
|
setUp(() async {
|
||||||
fileSystem = MemoryFileSystem.test();
|
fileSystem = MemoryFileSystem.test();
|
||||||
fileSystem.directory('HostArtifact.flutterWebSdk').createSync();
|
fileSystem.directory('HostArtifact.flutterWebSdk').createSync();
|
||||||
fileSystem.file('HostArtifact.webPlatformKernelDill').createSync();
|
fileSystem.file('HostArtifact.webPlatformDDCKernelDill').createSync();
|
||||||
fileSystem.file('HostArtifact.webPlatformSoundKernelDill').createSync();
|
fileSystem.file('HostArtifact.webPlatformDDCSoundKernelDill').createSync();
|
||||||
fileSystem.file('HostArtifact.flutterWebLibrariesJson').createSync();
|
fileSystem.file('HostArtifact.flutterWebLibrariesJson').createSync();
|
||||||
|
|
||||||
final SdkWebConfigurationProvider provider =
|
final SdkWebConfigurationProvider provider =
|
||||||
|
@ -34,8 +34,8 @@ void main() {
|
||||||
|
|
||||||
testWithoutContext('is correct', () {
|
testWithoutContext('is correct', () {
|
||||||
expect(configuration.sdkDirectory, 'HostArtifact.flutterWebSdk');
|
expect(configuration.sdkDirectory, 'HostArtifact.flutterWebSdk');
|
||||||
expect(configuration.unsoundSdkSummaryPath, 'HostArtifact.webPlatformKernelDill');
|
expect(configuration.unsoundSdkSummaryPath, 'HostArtifact.webPlatformDDCKernelDill');
|
||||||
expect(configuration.soundSdkSummaryPath, 'HostArtifact.webPlatformSoundKernelDill');
|
expect(configuration.soundSdkSummaryPath, 'HostArtifact.webPlatformDDCSoundKernelDill');
|
||||||
expect(configuration.librariesPath, 'HostArtifact.flutterWebLibrariesJson');
|
expect(configuration.librariesPath, 'HostArtifact.flutterWebLibrariesJson');
|
||||||
expect(configuration.compilerWorkerPath, isNull);
|
expect(configuration.compilerWorkerPath, isNull);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue