Remove BuildConfigurations (#3879)
Artifacts from local engine builds will be found based on the --local-engine flag
This commit is contained in:
parent
7072c8f255
commit
a590ee2671
@ -10,7 +10,7 @@ import '../android/android_sdk.dart';
|
||||
import '../application_package.dart';
|
||||
import '../base/os.dart';
|
||||
import '../base/process.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../device.dart';
|
||||
import '../flx.dart' as flx;
|
||||
import '../globals.dart';
|
||||
|
@ -7,7 +7,7 @@ import 'dart:io';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:xml/xml.dart' as xml;
|
||||
|
||||
import 'build_configuration.dart';
|
||||
import 'build_info.dart';
|
||||
import 'ios/plist_utils.dart';
|
||||
|
||||
abstract class ApplicationPackage {
|
||||
|
@ -6,7 +6,7 @@ import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import 'build_configuration.dart';
|
||||
import 'build_info.dart';
|
||||
import 'globals.dart';
|
||||
|
||||
enum ArtifactType {
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import 'base/utils.dart';
|
||||
import 'globals.dart';
|
||||
|
||||
@ -81,37 +79,3 @@ HostPlatform getCurrentHostPlatform() {
|
||||
|
||||
return HostPlatform.linux_x64;
|
||||
}
|
||||
|
||||
TargetPlatform getCurrentHostPlatformAsTarget() {
|
||||
if (Platform.isMacOS)
|
||||
return TargetPlatform.darwin_x64;
|
||||
if (Platform.isLinux)
|
||||
return TargetPlatform.linux_x64;
|
||||
printError('Unsupported host platform, defaulting to Linux');
|
||||
return TargetPlatform.linux_x64;
|
||||
}
|
||||
|
||||
class BuildConfiguration {
|
||||
BuildConfiguration.prebuilt({
|
||||
this.hostPlatform,
|
||||
this.targetPlatform,
|
||||
this.testable: false
|
||||
}) : type = BuildType.prebuilt, buildDir = null;
|
||||
|
||||
BuildConfiguration.local({
|
||||
this.type,
|
||||
this.hostPlatform,
|
||||
this.targetPlatform,
|
||||
String enginePath,
|
||||
String buildPath,
|
||||
this.testable: false
|
||||
}) : buildDir = path.normalize(path.join(enginePath, buildPath)) {
|
||||
assert(type == BuildType.debug || type == BuildType.release);
|
||||
}
|
||||
|
||||
final BuildType type;
|
||||
final HostPlatform hostPlatform;
|
||||
final TargetPlatform targetPlatform;
|
||||
final String buildDir;
|
||||
final bool testable;
|
||||
}
|
@ -12,7 +12,6 @@ import 'package:yaml/yaml.dart' as yaml;
|
||||
|
||||
import '../artifacts.dart';
|
||||
import '../base/utils.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../dart/analysis.dart';
|
||||
import '../dart/sdk.dart';
|
||||
import '../globals.dart';
|
||||
@ -181,10 +180,9 @@ class AnalyzeCommand extends FlutterCommand {
|
||||
Map<String, String> packages = dependencies.asPackageMap();
|
||||
|
||||
// override the sky_engine and sky_services packages if the user is using a local build
|
||||
String buildDir = buildConfigurations.firstWhere((BuildConfiguration config) => config.testable, orElse: () => null)?.buildDir;
|
||||
if (buildDir != null) {
|
||||
packages['sky_engine'] = path.join(buildDir, 'gen/dart-pkg/sky_engine/lib');
|
||||
packages['sky_services'] = path.join(buildDir, 'gen/dart-pkg/sky_services/lib');
|
||||
if (tools.engineBuildPath != null) {
|
||||
packages['sky_engine'] = path.join(tools.engineBuildPath, 'gen/dart-pkg/sky_engine/lib');
|
||||
packages['sky_services'] = path.join(tools.engineBuildPath, 'gen/dart-pkg/sky_services/lib');
|
||||
}
|
||||
|
||||
if (argResults['preamble']) {
|
||||
|
@ -8,7 +8,7 @@ import 'dart:io';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import '../base/process.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../globals.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
import 'run.dart';
|
||||
@ -132,7 +132,7 @@ String buildAotSnapshot(
|
||||
'--no-sim-use-hardfp',
|
||||
];
|
||||
|
||||
if (!(tools.engineRelease || buildMode == BuildMode.release)) {
|
||||
if (buildMode != BuildMode.release) {
|
||||
genSnapshotCmd.addAll(<String>[
|
||||
'--no-checked',
|
||||
'--conditional_directives',
|
||||
|
@ -12,7 +12,7 @@ import '../base/file_system.dart' show ensureDirectoryExists;
|
||||
import '../base/os.dart';
|
||||
import '../base/process.dart';
|
||||
import '../base/utils.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../flx.dart' as flx;
|
||||
import '../globals.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
|
@ -5,7 +5,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import '../application_package.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../globals.dart';
|
||||
import '../ios/mac.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
|
@ -10,7 +10,7 @@ import '../android/android_device.dart';
|
||||
import '../application_package.dart';
|
||||
import '../base/context.dart';
|
||||
import '../base/logger.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../device.dart';
|
||||
import '../globals.dart';
|
||||
import '../ios/devices.dart';
|
||||
|
@ -13,7 +13,7 @@ import '../application_package.dart';
|
||||
import '../base/file_system.dart';
|
||||
import '../base/common.dart';
|
||||
import '../base/os.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../device.dart';
|
||||
import '../globals.dart';
|
||||
import '../ios/simulators.dart' show SimControl, IOSSimulatorUtils;
|
||||
|
@ -8,7 +8,7 @@ import 'dart:io';
|
||||
import '../base/os.dart';
|
||||
import '../base/process.dart';
|
||||
import '../device.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../globals.dart';
|
||||
import 'run.dart';
|
||||
|
||||
|
@ -11,7 +11,7 @@ import 'package:path/path.dart' as path;
|
||||
import '../application_package.dart';
|
||||
import '../base/common.dart';
|
||||
import '../base/logger.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../device.dart';
|
||||
import '../globals.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
|
@ -7,9 +7,8 @@ import 'dart:io';
|
||||
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import '../artifacts.dart';
|
||||
import '../base/process.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../flx.dart' as flx;
|
||||
import '../globals.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
@ -73,19 +72,6 @@ class RunMojoCommand extends FlutterCommand {
|
||||
return _makePathAbsolute(path.join(argResults['mojo-path'], 'out', mojoBuildType, 'mojo_shell'));
|
||||
}
|
||||
|
||||
BuildConfiguration _getCurrentHostConfig() {
|
||||
BuildConfiguration result;
|
||||
TargetPlatform target = argResults['android'] ?
|
||||
TargetPlatform.android_arm : getCurrentHostPlatformAsTarget();
|
||||
for (BuildConfiguration config in buildConfigurations) {
|
||||
if (config.targetPlatform == target) {
|
||||
result = config;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Future<List<String>> _getShellConfig(String targetApp) async {
|
||||
List<String> args = <String>[];
|
||||
|
||||
@ -93,17 +79,8 @@ class RunMojoCommand extends FlutterCommand {
|
||||
final String command = useDevtools ? _getDevtoolsPath() : _getMojoShellPath();
|
||||
args.add(command);
|
||||
|
||||
BuildConfiguration config = _getCurrentHostConfig();
|
||||
|
||||
String flutterPath;
|
||||
if (config == null || config.type == BuildType.prebuilt) {
|
||||
TargetPlatform targetPlatform = argResults['android'] ? TargetPlatform.android_arm : TargetPlatform.linux_x64;
|
||||
Artifact artifact = ArtifactStore.getArtifact(type: ArtifactType.mojo, targetPlatform: targetPlatform);
|
||||
flutterPath = _makePathAbsolute(ArtifactStore.getPath(artifact));
|
||||
} else {
|
||||
String localPath = path.join(config.buildDir, 'flutter.mojo');
|
||||
flutterPath = _makePathAbsolute(localPath);
|
||||
}
|
||||
TargetPlatform targetPlatform = argResults['android'] ? TargetPlatform.android_arm : TargetPlatform.linux_x64;
|
||||
String flutterPath = path.join(tools.getEngineArtifactsDirectory(targetPlatform, BuildMode.debug).path, 'flutter.mojo');
|
||||
|
||||
if (argResults['android'])
|
||||
args.add('--android');
|
||||
|
@ -8,11 +8,10 @@ import 'dart:io';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:test/src/executable.dart' as executable; // ignore: implementation_imports
|
||||
|
||||
import '../artifacts.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../globals.dart';
|
||||
import '../runner/flutter_command.dart';
|
||||
import '../test/flutter_platform.dart' as loader;
|
||||
import '../toolchain.dart';
|
||||
|
||||
class TestCommand extends FlutterCommand {
|
||||
TestCommand() {
|
||||
@ -41,23 +40,6 @@ class TestCommand extends FlutterCommand {
|
||||
return true;
|
||||
};
|
||||
|
||||
Future<String> _getShellPath(BuildConfiguration config) async {
|
||||
if (config.type == BuildType.prebuilt) {
|
||||
Artifact artifact = ArtifactStore.getArtifact(
|
||||
type: ArtifactType.shell, targetPlatform: config.targetPlatform);
|
||||
return ArtifactStore.getPath(artifact);
|
||||
} else {
|
||||
switch (config.targetPlatform) {
|
||||
case TargetPlatform.linux_x64:
|
||||
return path.join(config.buildDir, 'sky_shell');
|
||||
case TargetPlatform.darwin_x64:
|
||||
return path.join(config.buildDir, 'SkyShell.app', 'Contents', 'MacOS', 'SkyShell');
|
||||
default:
|
||||
throw new Exception('Unsupported platform.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Iterable<String> _findTests(Directory directory) {
|
||||
return directory.listSync(recursive: true, followLinks: false)
|
||||
.where((FileSystemEntity entity) => entity.path.endsWith('_test.dart') &&
|
||||
@ -102,27 +84,13 @@ class TestCommand extends FlutterCommand {
|
||||
testArgs.insert(0, '--');
|
||||
if (Platform.environment['TERM'] == 'dumb')
|
||||
testArgs.insert(0, '--no-color');
|
||||
List<BuildConfiguration> configs = buildConfigurations;
|
||||
bool foundOne = false;
|
||||
|
||||
loader.installHook();
|
||||
for (BuildConfiguration config in configs) {
|
||||
if (!config.testable)
|
||||
continue;
|
||||
foundOne = true;
|
||||
loader.shellPath = path.absolute(await _getShellPath(config));
|
||||
if (!FileSystemEntity.isFileSync(loader.shellPath)) {
|
||||
printError('Cannot find Flutter shell at ${loader.shellPath}');
|
||||
return 1;
|
||||
}
|
||||
await _runTests(testArgs, testDir);
|
||||
if (exitCode != 0)
|
||||
return exitCode;
|
||||
}
|
||||
if (!foundOne) {
|
||||
printError('At least one of --engine-debug or --engine-release must be set, to specify the local build products to test.');
|
||||
loader.shellPath = tools.getHostToolPath(HostTool.SkyShell);
|
||||
if (!FileSystemEntity.isFileSync(loader.shellPath)) {
|
||||
printError('Cannot find Flutter shell at ${loader.shellPath}');
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return await _runTests(testArgs, testDir);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import 'application_package.dart';
|
||||
import 'base/common.dart';
|
||||
import 'base/os.dart';
|
||||
import 'base/utils.dart';
|
||||
import 'build_configuration.dart';
|
||||
import 'build_info.dart';
|
||||
import 'globals.dart';
|
||||
import 'ios/devices.dart';
|
||||
import 'ios/simulators.dart';
|
||||
|
@ -11,7 +11,7 @@ import 'package:path/path.dart' as path;
|
||||
import '../application_package.dart';
|
||||
import '../base/os.dart';
|
||||
import '../base/process.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../device.dart';
|
||||
import '../globals.dart';
|
||||
import 'mac.dart';
|
||||
|
@ -9,7 +9,7 @@ import 'package:path/path.dart' as path;
|
||||
|
||||
import '../artifacts.dart';
|
||||
import '../base/process.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../globals.dart';
|
||||
import '../runner/flutter_command_runner.dart';
|
||||
|
||||
|
@ -11,7 +11,7 @@ import 'package:path/path.dart' as path;
|
||||
import '../application_package.dart';
|
||||
import '../base/context.dart';
|
||||
import '../base/process.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../device.dart';
|
||||
import '../flx.dart' as flx;
|
||||
import '../globals.dart';
|
||||
|
@ -8,7 +8,7 @@ import 'dart:io';
|
||||
import 'package:args/command_runner.dart';
|
||||
|
||||
import '../application_package.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../build_info.dart';
|
||||
import '../dart/pub.dart';
|
||||
import '../device.dart';
|
||||
import '../flx.dart' as flx;
|
||||
@ -43,8 +43,6 @@ abstract class FlutterCommand extends Command {
|
||||
|
||||
bool get shouldRunPub => _usesPubOption && argResults['pub'];
|
||||
|
||||
List<BuildConfiguration> get buildConfigurations => runner.buildConfigurations;
|
||||
|
||||
void usesTargetOption() {
|
||||
argParser.addOption('target',
|
||||
abbr: 't',
|
||||
|
@ -14,7 +14,6 @@ import '../artifacts.dart';
|
||||
import '../base/context.dart';
|
||||
import '../base/logger.dart';
|
||||
import '../base/process.dart';
|
||||
import '../build_configuration.dart';
|
||||
import '../globals.dart';
|
||||
import '../package_map.dart';
|
||||
import '../toolchain.dart';
|
||||
@ -61,20 +60,7 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
if (verboseHelp)
|
||||
argParser.addSeparator('Local build selection options (not normally required):');
|
||||
|
||||
argParser.addFlag('engine-debug',
|
||||
negatable: false,
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Set this if you are building Flutter locally and want to use the debug build products.\n'
|
||||
'Defaults to true if --engine-src-path is specified and --engine-release is not, otherwise false.');
|
||||
argParser.addFlag('engine-release',
|
||||
negatable: false,
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Set this if you are building Flutter locally and want to use the release build products.\n'
|
||||
'The --engine-release option is not compatible with the listen command on iOS devices and simulators.');
|
||||
|
||||
argParser.addOption('engine-src-path',
|
||||
argParser.addOption('local-engine-src-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your engine src directory, if you are building Flutter locally.\n'
|
||||
@ -87,59 +73,7 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
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'
|
||||
'This path is relative to --engine-src-path/out.');
|
||||
|
||||
argParser.addOption('host-debug-build-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your host Debug out directory (i.e. the one that runs on your workstation, not a device),\n'
|
||||
'if you are building Flutter locally.\n'
|
||||
'This path is relative to --engine-src-path. Not normally required.',
|
||||
defaultsTo: 'out/host_debug_unopt/');
|
||||
argParser.addOption('host-release-build-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your host Release out directory (i.e. the one that runs on your workstation, not a device),\n'
|
||||
'if you are building Flutter locally.\n'
|
||||
'This path is relative to --engine-src-path. Not normally required.',
|
||||
defaultsTo: 'out/host_debug/');
|
||||
|
||||
argParser.addOption('android-debug-build-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your Android Debug out directory, if you are building Flutter locally.\n'
|
||||
'This path is relative to --engine-src-path. Not normally required.',
|
||||
defaultsTo: 'out/android_debug_unopt/');
|
||||
argParser.addOption('android-release-build-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your Android Release out directory, if you are building Flutter locally.\n'
|
||||
'This path is relative to --engine-src-path. Not normally required.',
|
||||
defaultsTo: 'out/android_debug/');
|
||||
argParser.addOption('ios-debug-build-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your iOS Debug out directory, if you are building Flutter locally.\n'
|
||||
'This path is relative to --engine-src-path. Not normally required.',
|
||||
defaultsTo: 'out/ios_Debug/');
|
||||
argParser.addOption('ios-release-build-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your iOS Release out directory, if you are building Flutter locally.\n'
|
||||
'This path is relative to --engine-src-path. Not normally required.',
|
||||
defaultsTo: 'out/ios_Release/');
|
||||
argParser.addOption('ios-sim-debug-build-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your iOS Simulator Debug out directory, if you are building Flutter locally.\n'
|
||||
'This path is relative to --engine-src-path. Not normally required.',
|
||||
defaultsTo: 'out/ios_sim_Debug/');
|
||||
argParser.addOption('ios-sim-release-build-path',
|
||||
hide: !verboseHelp,
|
||||
help:
|
||||
'Path to your iOS Simulator Release out directory, if you are building Flutter locally.\n'
|
||||
'This path is relative to --engine-src-path. Not normally required.',
|
||||
defaultsTo: 'out/ios_sim_Release/');
|
||||
'This path is relative to --local-engine-src-path/out.');
|
||||
}
|
||||
|
||||
@override
|
||||
@ -147,22 +81,6 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
return 'Run "flutter -h -v" for verbose help output, including less commonly used options.';
|
||||
}
|
||||
|
||||
List<BuildConfiguration> get buildConfigurations {
|
||||
if (_buildConfigurations == null)
|
||||
_buildConfigurations = _createBuildConfigurations(_globalResults);
|
||||
return _buildConfigurations;
|
||||
}
|
||||
List<BuildConfiguration> _buildConfigurations;
|
||||
|
||||
String get enginePath {
|
||||
assert(ArtifactStore.flutterRoot != null);
|
||||
_enginePath ??= _findEnginePath(_globalResults);
|
||||
return _enginePath;
|
||||
}
|
||||
String _enginePath;
|
||||
|
||||
ArgResults _globalResults;
|
||||
|
||||
static String get _defaultFlutterRoot {
|
||||
if (Platform.environment.containsKey(kFlutterRootEnvironmentVariableName))
|
||||
return Platform.environment[kFlutterRootEnvironmentVariableName];
|
||||
@ -203,8 +121,6 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
|
||||
@override
|
||||
Future<int> runCommand(ArgResults globalResults) {
|
||||
_globalResults = globalResults;
|
||||
|
||||
// Check for verbose.
|
||||
if (globalResults['verbose'])
|
||||
context[Logger] = new VerboseLogger();
|
||||
@ -226,14 +142,10 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
deviceManager.specifiedDeviceId = globalResults['device-id'];
|
||||
|
||||
// Set up the tooling configuration.
|
||||
String enginePath = _findEnginePath(globalResults);
|
||||
if (enginePath != null) {
|
||||
ToolConfiguration.instance.engineSrcPath = enginePath;
|
||||
ToolConfiguration.instance.engineBuildPath = _findEngineBuildPath(globalResults, enginePath);
|
||||
|
||||
if (globalResults.wasParsed('engine-release'))
|
||||
ToolConfiguration.instance.engineRelease = globalResults['engine-release'];
|
||||
if (globalResults.wasParsed('engine-debug'))
|
||||
ToolConfiguration.instance.engineRelease = !globalResults['engine-debug'];
|
||||
}
|
||||
|
||||
// The Android SDK could already have been set by tests.
|
||||
@ -261,11 +173,9 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
}
|
||||
|
||||
String _findEnginePath(ArgResults globalResults) {
|
||||
String engineSourcePath = globalResults['engine-src-path'] ?? Platform.environment[kFlutterEngineEnvironmentVariableName];
|
||||
bool isDebug = globalResults['engine-debug'];
|
||||
bool isRelease = globalResults['engine-release'];
|
||||
String engineSourcePath = globalResults['local-engine-src-path'] ?? Platform.environment[kFlutterEngineEnvironmentVariableName];
|
||||
|
||||
if (engineSourcePath == null && (isDebug || isRelease)) {
|
||||
if (engineSourcePath == null && globalResults['local-engine'] != null) {
|
||||
try {
|
||||
Uri engineUri = PackageMap.instance.map[kFlutterEnginePackageName];
|
||||
engineSourcePath = path.dirname(path.dirname(path.dirname(path.dirname(engineUri.path))));
|
||||
@ -281,7 +191,7 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
printError('Unable to detect local Flutter engine build directory.\n'
|
||||
'Either specify a dependency_override for the $kFlutterEnginePackageName package in your pubspec.yaml and\n'
|
||||
'ensure --package-root is set if necessary, or set the \$$kFlutterEngineEnvironmentVariableName environment variable, or\n'
|
||||
'use --engine-src-path to specify the path to the root of your flutter/engine repository.');
|
||||
'use --local-engine-src-path to specify the path to the root of your flutter/engine repository.');
|
||||
throw new ProcessExit(2);
|
||||
}
|
||||
}
|
||||
@ -301,19 +211,8 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
if (globalResults['local-engine'] != null) {
|
||||
localEngine = globalResults['local-engine'];
|
||||
} else {
|
||||
// This is a temporary hack to find an engine build in the same way that we found the toolchain.
|
||||
// TODO(jsimmons): delete this and make --local-engine mandatory when BuildConfigurations are removed.
|
||||
for (BuildConfiguration config in buildConfigurations) {
|
||||
if (FileSystemEntity.isDirectorySync(config.buildDir)) {
|
||||
localEngine = path.basename(config.buildDir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (localEngine == null) {
|
||||
printError('You must specify --local-engine if you are using a locally built engine.');
|
||||
throw new ProcessExit(2);
|
||||
}
|
||||
printError('You must specify --local-engine if you are using a locally built engine.');
|
||||
throw new ProcessExit(2);
|
||||
}
|
||||
|
||||
String engineBuildPath = path.join(enginePath, 'out', localEngine);
|
||||
@ -325,124 +224,6 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
return engineBuildPath;
|
||||
}
|
||||
|
||||
List<BuildConfiguration> _createBuildConfigurations(ArgResults globalResults) {
|
||||
bool isDebug = globalResults['engine-debug'];
|
||||
bool isRelease = globalResults['engine-release'];
|
||||
HostPlatform hostPlatform = getCurrentHostPlatform();
|
||||
TargetPlatform hostPlatformAsTarget = getCurrentHostPlatformAsTarget();
|
||||
|
||||
List<BuildConfiguration> configs = <BuildConfiguration>[];
|
||||
|
||||
if (enginePath == null) {
|
||||
configs.add(new BuildConfiguration.prebuilt(
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: TargetPlatform.android_arm
|
||||
));
|
||||
|
||||
configs.add(new BuildConfiguration.prebuilt(
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: TargetPlatform.android_x64
|
||||
));
|
||||
|
||||
if (hostPlatform == HostPlatform.linux_x64) {
|
||||
configs.add(new BuildConfiguration.prebuilt(
|
||||
hostPlatform: HostPlatform.linux_x64,
|
||||
targetPlatform: TargetPlatform.linux_x64,
|
||||
testable: true
|
||||
));
|
||||
}
|
||||
|
||||
if (hostPlatform == HostPlatform.darwin_x64) {
|
||||
configs.add(new BuildConfiguration.prebuilt(
|
||||
hostPlatform: HostPlatform.darwin_x64,
|
||||
targetPlatform: TargetPlatform.ios
|
||||
));
|
||||
}
|
||||
} else {
|
||||
if (!FileSystemEntity.isDirectorySync(enginePath))
|
||||
printError('$enginePath is not a valid directory');
|
||||
|
||||
if (!isDebug && !isRelease)
|
||||
isDebug = true;
|
||||
|
||||
if (isDebug) {
|
||||
configs.add(new BuildConfiguration.local(
|
||||
type: BuildType.debug,
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: TargetPlatform.android_arm,
|
||||
enginePath: enginePath,
|
||||
buildPath: globalResults['android-debug-build-path']
|
||||
));
|
||||
|
||||
configs.add(new BuildConfiguration.local(
|
||||
type: BuildType.debug,
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: hostPlatformAsTarget,
|
||||
enginePath: enginePath,
|
||||
buildPath: globalResults['host-debug-build-path'],
|
||||
testable: true
|
||||
));
|
||||
|
||||
if (Platform.isMacOS) {
|
||||
configs.add(new BuildConfiguration.local(
|
||||
type: BuildType.debug,
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: TargetPlatform.ios,
|
||||
enginePath: enginePath,
|
||||
buildPath: globalResults['ios-debug-build-path']
|
||||
));
|
||||
|
||||
configs.add(new BuildConfiguration.local(
|
||||
type: BuildType.debug,
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: TargetPlatform.ios,
|
||||
enginePath: enginePath,
|
||||
buildPath: globalResults['ios-sim-debug-build-path']
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
if (isRelease) {
|
||||
configs.add(new BuildConfiguration.local(
|
||||
type: BuildType.release,
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: TargetPlatform.android_arm,
|
||||
enginePath: enginePath,
|
||||
buildPath: globalResults['android-release-build-path']
|
||||
));
|
||||
|
||||
configs.add(new BuildConfiguration.local(
|
||||
type: BuildType.release,
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: hostPlatformAsTarget,
|
||||
enginePath: enginePath,
|
||||
buildPath: globalResults['host-release-build-path'],
|
||||
testable: true
|
||||
));
|
||||
|
||||
if (Platform.isMacOS) {
|
||||
configs.add(new BuildConfiguration.local(
|
||||
type: BuildType.release,
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: TargetPlatform.ios,
|
||||
enginePath: enginePath,
|
||||
buildPath: globalResults['ios-release-build-path']
|
||||
));
|
||||
|
||||
configs.add(new BuildConfiguration.local(
|
||||
type: BuildType.release,
|
||||
hostPlatform: hostPlatform,
|
||||
targetPlatform: TargetPlatform.ios,
|
||||
enginePath: enginePath,
|
||||
buildPath: globalResults['ios-sim-release-build-path']
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return configs;
|
||||
}
|
||||
|
||||
static void initFlutterRoot() {
|
||||
if (ArtifactStore.flutterRoot == null)
|
||||
ArtifactStore.flutterRoot = _defaultFlutterRoot;
|
||||
|
@ -7,14 +7,20 @@ import 'dart:io';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import 'base/context.dart';
|
||||
import 'build_configuration.dart';
|
||||
import 'build_info.dart';
|
||||
import 'cache.dart';
|
||||
import 'globals.dart';
|
||||
|
||||
enum HostTool {
|
||||
SkySnapshot,
|
||||
SkyShell,
|
||||
}
|
||||
|
||||
const Map<HostTool, String> _kHostToolFileName = const <HostTool, String>{
|
||||
HostTool.SkySnapshot: 'sky_snapshot',
|
||||
HostTool.SkyShell: 'sky_shell',
|
||||
};
|
||||
|
||||
/// A ToolConfiguration can return the tools directory for the current host platform
|
||||
/// and the engine artifact directory for a given target platform. It is configurable
|
||||
/// via command-line arguments in order to support local engine builds.
|
||||
@ -38,9 +44,6 @@ class ToolConfiguration {
|
||||
/// Path to a local engine build acting as a source for artifacts (--local-engine).
|
||||
String engineBuildPath;
|
||||
|
||||
/// The engine mode to use (only relevent when [engineSrcPath] is set).
|
||||
bool engineRelease;
|
||||
|
||||
bool get isLocalEngine => engineSrcPath != null;
|
||||
|
||||
/// Return the directory that contains engine artifacts for the given targets.
|
||||
@ -53,46 +56,8 @@ class ToolConfiguration {
|
||||
}
|
||||
|
||||
Directory _getEngineArtifactsDirectory(TargetPlatform platform, BuildMode mode) {
|
||||
if (engineSrcPath != null) {
|
||||
List<String> buildDir = <String>[];
|
||||
|
||||
switch (platform) {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
buildDir.add('android');
|
||||
break;
|
||||
|
||||
// TODO(devoncarew): We will need an ios vs ios_x86 target (for ios vs. ios_sim).
|
||||
case TargetPlatform.ios:
|
||||
buildDir.add('ios');
|
||||
break;
|
||||
|
||||
// These targets don't have engine artifacts.
|
||||
case TargetPlatform.darwin_x64:
|
||||
case TargetPlatform.linux_x64:
|
||||
buildDir.add('host');
|
||||
break;
|
||||
}
|
||||
|
||||
buildDir.add(getModeName(mode));
|
||||
|
||||
if (!engineRelease)
|
||||
buildDir.add('unopt');
|
||||
|
||||
// Add a suffix for the target architecture.
|
||||
switch (platform) {
|
||||
case TargetPlatform.android_x64:
|
||||
buildDir.add('x64');
|
||||
break;
|
||||
case TargetPlatform.android_x86:
|
||||
buildDir.add('x86');
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return new Directory(path.join(engineSrcPath, 'out', buildDir.join('_')));
|
||||
if (engineBuildPath != null) {
|
||||
return new Directory(engineBuildPath);
|
||||
} else {
|
||||
String suffix = mode != BuildMode.debug ? '-${getModeName(mode)}' : '';
|
||||
|
||||
@ -104,15 +69,25 @@ class ToolConfiguration {
|
||||
}
|
||||
|
||||
String getHostToolPath(HostTool tool) {
|
||||
if (tool != HostTool.SkySnapshot)
|
||||
throw new Exception('Unexpected host tool: $tool');
|
||||
|
||||
if (isLocalEngine) {
|
||||
return path.join(engineBuildPath, 'clang_x64', 'sky_snapshot');
|
||||
} else {
|
||||
if (engineBuildPath == null) {
|
||||
return path.join(_cache.getArtifactDirectory('engine').path,
|
||||
getNameForHostPlatform(getCurrentHostPlatform()),
|
||||
'sky_snapshot');
|
||||
_kHostToolFileName[tool]);
|
||||
}
|
||||
|
||||
if (tool == HostTool.SkySnapshot) {
|
||||
String clangPath = path.join(engineBuildPath, 'clang_x64', 'sky_snapshot');
|
||||
if (FileSystemEntity.isFileSync(clangPath))
|
||||
return clangPath;
|
||||
return path.join(engineBuildPath, 'sky_snapshot');
|
||||
} else if (tool == HostTool.SkyShell) {
|
||||
if (getCurrentHostPlatform() == HostPlatform.linux_x64) {
|
||||
return path.join(engineBuildPath, 'sky_shell');
|
||||
} else if (getCurrentHostPlatform() == HostPlatform.darwin_x64) {
|
||||
return path.join(engineBuildPath, 'SkyShell.app', 'Contents', 'MacOS', 'SkyShell');
|
||||
}
|
||||
}
|
||||
|
||||
throw 'Unexpected host tool: $tool';
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter_tools/src/android/android_device.dart';
|
||||
import 'package:flutter_tools/src/application_package.dart';
|
||||
import 'package:flutter_tools/src/build_configuration.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/ios/devices.dart';
|
||||
import 'package:flutter_tools/src/ios/simulators.dart';
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_tools/src/build_configuration.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/toolchain.dart';
|
||||
import 'package:test/test.dart';
|
||||
@ -41,7 +41,7 @@ void main() {
|
||||
testUsingContext('using enginePath', () {
|
||||
ToolConfiguration toolConfig = new ToolConfiguration();
|
||||
toolConfig.engineSrcPath = 'engine';
|
||||
toolConfig.engineRelease = true;
|
||||
toolConfig.engineBuildPath = 'engine/out/android_debug';
|
||||
|
||||
expect(
|
||||
toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.debug).path,
|
||||
|
Loading…
x
Reference in New Issue
Block a user