Update flutter_tools for the "unoptimized" engine build flag and the new output directory naming scheme (#3832)

This commit is contained in:
Jason Simmons 2016-05-10 12:02:09 -07:00
parent 6e48824991
commit 6ab77622e4
3 changed files with 17 additions and 59 deletions

View File

@ -101,13 +101,13 @@ class FlutterCommandRunner extends CommandRunner {
help: help:
'Path to your Android Debug out directory, if you are building Flutter locally.\n' '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.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/android_Debug/'); defaultsTo: 'out/android_debug_unopt/');
argParser.addOption('android-release-build-path', argParser.addOption('android-release-build-path',
hide: !verboseHelp, hide: !verboseHelp,
help: help:
'Path to your Android Release out directory, if you are building Flutter locally.\n' '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.', 'This path is relative to --engine-src-path. Not normally required.',
defaultsTo: 'out/android_Release/'); defaultsTo: 'out/android_debug/');
argParser.addOption('ios-debug-build-path', argParser.addOption('ios-debug-build-path',
hide: !verboseHelp, hide: !verboseHelp,
help: help:

View File

@ -98,34 +98,7 @@ class ToolConfiguration {
/// The engine mode to use (only relevent when [engineSrcPath] is set). /// The engine mode to use (only relevent when [engineSrcPath] is set).
bool engineRelease; bool engineRelease;
/// Used to override the directory calculated from engineSrcPath (--engine-out-dir). bool get isLocalEngine => engineSrcPath != null;
String engineOutDir;
bool get isLocalEngine => engineSrcPath != null || engineOutDir != null;
String get _modeStr => engineRelease ? 'Release' : 'Debug';
/// The directory that contains development tools for the given platform. This
/// includes things like `sky_shell` and `sky_snapshot`.
///
/// If [platform] is not specified it defaults to [getCurrentHostPlatform].
Directory getToolsDirectory({ HostPlatform platform }) {
Directory dir = _getToolsDirectory(platform: platform);
if (dir != null)
printTrace('Using engine tools dir: ${dir.path}');
return dir;
}
Directory _getToolsDirectory({ HostPlatform platform }) {
platform ??= getCurrentHostPlatform();
if (engineSrcPath != null) {
return new Directory(path.join(engineSrcPath, 'out/$_modeStr'));
} else {
Directory engineDir = _cache.getArtifactDirectory('engine');
return new Directory(path.join(engineDir.path, getNameForHostPlatform(platform)));
}
}
/// Return the directory that contains engine artifacts for the given targets. /// Return the directory that contains engine artifacts for the given targets.
/// This directory might contain artifacts like `libsky_shell.so`. /// This directory might contain artifacts like `libsky_shell.so`.
@ -137,47 +110,46 @@ class ToolConfiguration {
} }
Directory _getEngineArtifactsDirectory(TargetPlatform platform, BuildMode mode) { Directory _getEngineArtifactsDirectory(TargetPlatform platform, BuildMode mode) {
if (engineOutDir != null) { if (engineSrcPath != null) {
return new Directory(engineOutDir); List<String> buildDir = <String>[];
} else if (engineSrcPath != null) {
String type;
switch (platform) { switch (platform) {
case TargetPlatform.android_arm: case TargetPlatform.android_arm:
case TargetPlatform.android_x64: case TargetPlatform.android_x64:
case TargetPlatform.android_x86: case TargetPlatform.android_x86:
type = 'android'; buildDir.add('android');
break; break;
// TODO(devoncarew): We will need an ios vs ios_x86 target (for ios vs. ios_sim). // TODO(devoncarew): We will need an ios vs ios_x86 target (for ios vs. ios_sim).
case TargetPlatform.ios: case TargetPlatform.ios:
type = 'ios'; buildDir.add('ios');
break; break;
// These targets don't have engine artifacts. // These targets don't have engine artifacts.
case TargetPlatform.darwin_x64: case TargetPlatform.darwin_x64:
case TargetPlatform.linux_x64: case TargetPlatform.linux_x64:
return null; buildDir.add('host');
break;
} }
// Return something like 'out/android_Release'. buildDir.add(getModeName(mode));
String buildOutputPath = 'out/${type}_$_modeStr';
if (isAotBuildMode(mode)) if (!engineRelease)
buildOutputPath += '_Deploy'; buildDir.add('unopt');
// Add a suffix for the target architecture. // Add a suffix for the target architecture.
switch (platform) { switch (platform) {
case TargetPlatform.android_x64: case TargetPlatform.android_x64:
buildOutputPath += '_x64'; buildDir.add('x64');
break; break;
case TargetPlatform.android_x86: case TargetPlatform.android_x86:
buildOutputPath += '_x86'; buildDir.add('x86');
break; break;
default: default:
break; break;
} }
return new Directory(path.join(engineSrcPath, buildOutputPath)); return new Directory(path.join(engineSrcPath, 'out', buildDir.join('_')));
} else { } else {
String suffix = mode != BuildMode.debug ? '-${getModeName(mode)}' : ''; String suffix = mode != BuildMode.debug ? '-${getModeName(mode)}' : '';

View File

@ -28,10 +28,6 @@ void main() {
overrideCache: new Cache(rootOverride: tempDir) overrideCache: new Cache(rootOverride: tempDir)
); );
expect(
toolConfig.getToolsDirectory(platform: HostPlatform.linux_x64).path,
endsWith('cache/artifacts/engine/linux-x64')
);
expect( expect(
toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.debug).path, toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.debug).path,
endsWith('cache/artifacts/engine/android-arm') endsWith('cache/artifacts/engine/android-arm')
@ -47,19 +43,9 @@ void main() {
toolConfig.engineSrcPath = 'engine'; toolConfig.engineSrcPath = 'engine';
toolConfig.engineRelease = true; toolConfig.engineRelease = true;
expect(
toolConfig.getToolsDirectory(platform: HostPlatform.linux_x64).path,
'engine/out/Release'
);
expect( expect(
toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.debug).path, toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildMode.debug).path,
'engine/out/android_Release' 'engine/out/android_debug'
);
toolConfig.engineRelease = false;
expect(
toolConfig.getToolsDirectory(platform: HostPlatform.linux_x64).path,
'engine/out/Debug'
); );
}); });
}); });