mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Use arm deploy (#3374)
* download android-arm-deploy * wire up --deploy to android-arm-deploy * fix interpolation
This commit is contained in:
parent
f132acaf1d
commit
12cac94cda
2
bin/cache/engine.version
vendored
2
bin/cache/engine.version
vendored
@ -1 +1 @@
|
||||
c3504b519fcd95179ea832460758712ecd0e433d
|
||||
57043227981727ae8ceb1d51514a2e0d14bf53f9
|
||||
|
@ -48,7 +48,6 @@ export PATH="$DART_SDK_PATH/bin:$PATH"
|
||||
set +e
|
||||
|
||||
if [ $FLUTTER_DEV ]; then
|
||||
echo -e "(FLUTTER_DEV set - ignoring $SNAPSHOT_PATH)\n"
|
||||
"$DART" --packages="$FLUTTER_TOOLS_DIR/.packages" "$SCRIPT_PATH" "$@"
|
||||
else
|
||||
"$DART" "$SNAPSHOT_PATH" "$@"
|
||||
|
@ -214,7 +214,7 @@ class _AnsiStatus extends Status {
|
||||
_AnsiStatus(this.message) {
|
||||
stopwatch = new Stopwatch()..start();
|
||||
|
||||
stdout.write('${message.padRight(44)} ');
|
||||
stdout.write('${message.padRight(50)} ');
|
||||
stdout.write('${_progress[0]}');
|
||||
|
||||
timer = new Timer.periodic(new Duration(milliseconds: 100), _callback);
|
||||
|
@ -184,18 +184,31 @@ class FlutterEngine {
|
||||
|
||||
final Cache cache;
|
||||
|
||||
List<String> _getPackageDirs() => <String>['sky_engine', 'sky_services'];
|
||||
|
||||
List<String> _getEngineDirs() {
|
||||
List<String> dirs = <String>['android-arm', 'android-x64'];
|
||||
List<String> dirs = <String>[
|
||||
'android-arm',
|
||||
'android-arm-deploy',
|
||||
'android-x64'
|
||||
];
|
||||
|
||||
if (Platform.isMacOS)
|
||||
dirs.addAll(<String>['ios', 'darwin-x64']);
|
||||
dirs.add('ios');
|
||||
else if (Platform.isLinux)
|
||||
dirs.add('linux-x64');
|
||||
|
||||
return dirs;
|
||||
}
|
||||
|
||||
List<String> _getPackageDirs() => <String>['sky_engine', 'sky_services'];
|
||||
List<String> _getToolsDirs() {
|
||||
if (Platform.isMacOS)
|
||||
return <String>['darwin-x64'];
|
||||
else if (Platform.isLinux)
|
||||
return <String>['linux-x64'];
|
||||
else
|
||||
return <String>[];
|
||||
}
|
||||
|
||||
bool isUpToDate() {
|
||||
Directory pkgDir = cache.getCacheDir('pkg');
|
||||
@ -212,6 +225,12 @@ class FlutterEngine {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (String dirName in _getToolsDirs()) {
|
||||
Directory dir = new Directory(path.join(engineDir.path, dirName));
|
||||
if (!dir.existsSync())
|
||||
return false;
|
||||
}
|
||||
|
||||
return cache.getVersionFor(kName) == cache.getStampFor(kName);
|
||||
}
|
||||
|
||||
@ -236,6 +255,14 @@ class FlutterEngine {
|
||||
if (!dir.existsSync() || allDirty) {
|
||||
await _downloadItem('Downloading engine artifacts $dirName...',
|
||||
url + dirName + '/artifacts.zip', dir);
|
||||
}
|
||||
}
|
||||
|
||||
for (String dirName in _getToolsDirs()) {
|
||||
Directory dir = new Directory(path.join(engineDir.path, dirName));
|
||||
if (!dir.existsSync() || allDirty) {
|
||||
await _downloadItem('Downloading engine tools $dirName...',
|
||||
url + dirName + '/artifacts.zip', dir);
|
||||
_makeFilesExecutable(dir);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ import 'dart:io';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import '../android/android_sdk.dart';
|
||||
import '../artifacts.dart';
|
||||
import '../base/file_system.dart' show ensureDirectoryExists;
|
||||
import '../base/os.dart';
|
||||
import '../base/process.dart';
|
||||
@ -207,8 +206,6 @@ class BuildApkCommand extends FlutterCommand {
|
||||
TargetPlatform.android_arm,
|
||||
variant,
|
||||
toolchain: toolchain,
|
||||
configs: buildConfigurations,
|
||||
enginePath: runner.enginePath,
|
||||
force: true,
|
||||
manifest: argResults['manifest'],
|
||||
resources: argResults['resources'],
|
||||
@ -227,51 +224,43 @@ class BuildApkCommand extends FlutterCommand {
|
||||
|
||||
Future<_ApkComponents> _findApkComponents(
|
||||
TargetPlatform platform,
|
||||
BuildConfiguration config,
|
||||
String enginePath,
|
||||
BuildVariant buildVariant,
|
||||
String manifest,
|
||||
String resources,
|
||||
BuildVariant buildVariant
|
||||
String resources
|
||||
) async {
|
||||
// TODO(devoncarew): Get the right artifacts for [buildVariant].
|
||||
|
||||
List<String> artifactPaths;
|
||||
if (enginePath != null) {
|
||||
String abiDir = platform == TargetPlatform.android_arm ? 'armeabi-v7a' : 'x86_64';
|
||||
artifactPaths = [
|
||||
'$enginePath/third_party/icu/android/icudtl.dat',
|
||||
'${config.buildDir}/gen/sky/shell/shell/classes.dex.jar',
|
||||
'${config.buildDir}/gen/sky/shell/shell/shell/libs/$abiDir/libsky_shell.so',
|
||||
'$enginePath/build/android/ant/chromium-debug.keystore',
|
||||
];
|
||||
} else {
|
||||
List<ArtifactType> artifactTypes = <ArtifactType>[
|
||||
ArtifactType.androidIcuData,
|
||||
ArtifactType.androidClassesJar,
|
||||
ArtifactType.androidLibSkyShell,
|
||||
ArtifactType.androidKeystore,
|
||||
];
|
||||
artifactPaths = artifactTypes.map((ArtifactType type) {
|
||||
return ArtifactStore.getPath(ArtifactStore.getArtifact(
|
||||
type: type,
|
||||
targetPlatform: config.targetPlatform
|
||||
));
|
||||
}).toList();
|
||||
}
|
||||
|
||||
_ApkComponents components = new _ApkComponents();
|
||||
components.manifest = new File(manifest);
|
||||
components.icuData = new File(artifactPaths[0]);
|
||||
components.jars = [new File(artifactPaths[1])];
|
||||
components.libSkyShell = new File(artifactPaths[2]);
|
||||
components.debugKeystore = new File(artifactPaths[3]);
|
||||
components.resources = resources == null ? null : new Directory(resources);
|
||||
|
||||
if (tools.isLocalEngine) {
|
||||
String abiDir = platform == TargetPlatform.android_arm ? 'armeabi-v7a' : 'x86_64';
|
||||
String enginePath = tools.engineSrcPath;
|
||||
String buildDir = tools.getEngineArtifactsDirectory(platform, buildVariant).path;
|
||||
|
||||
components.icuData = new File('$enginePath/third_party/icu/android/icudtl.dat');
|
||||
components.jars = <File>[
|
||||
new File('$buildDir/gen/sky/shell/shell/classes.dex.jar')
|
||||
];
|
||||
components.libSkyShell = new File('$buildDir/gen/sky/shell/shell/shell/libs/$abiDir/libsky_shell.so');
|
||||
components.debugKeystore = new File('$enginePath/build/android/ant/chromium-debug.keystore');
|
||||
} else {
|
||||
Directory artifacts = tools.getEngineArtifactsDirectory(platform, buildVariant);
|
||||
|
||||
components.icuData = new File(path.join(artifacts.path, 'icudtl.dat'));
|
||||
components.jars = <File>[
|
||||
new File(path.join(artifacts.path, 'classes.dex.jar'))
|
||||
];
|
||||
components.libSkyShell = new File(path.join(artifacts.path, 'libsky_shell.so'));
|
||||
components.debugKeystore = new File(path.join(artifacts.path, 'chromium-debug.keystore'));
|
||||
}
|
||||
|
||||
await parseServiceConfigs(components.services, jars: components.jars);
|
||||
|
||||
for (File file in <File>[
|
||||
List<File> allFiles = <File>[
|
||||
components.manifest, components.icuData, components.libSkyShell, components.debugKeystore
|
||||
]..addAll(components.jars)) {
|
||||
]..addAll(components.jars);
|
||||
|
||||
for (File file in allFiles) {
|
||||
if (!file.existsSync()) {
|
||||
printError('Cannot locate file: ${file.path}');
|
||||
return null;
|
||||
@ -333,7 +322,8 @@ int _buildApk(
|
||||
File apkShaFile = new File('$outputFile.sha1');
|
||||
apkShaFile.writeAsStringSync(calculateSha(finalApk));
|
||||
|
||||
printStatus('Generated APK to ${finalApk.path}.');
|
||||
double size = finalApk.lengthSync() / (1024 * 1024);
|
||||
printStatus('Built ${finalApk.path} (${size.toStringAsFixed(1)}MB).');
|
||||
|
||||
return 0;
|
||||
} finally {
|
||||
@ -403,8 +393,6 @@ Future<int> buildAndroid(
|
||||
TargetPlatform platform,
|
||||
BuildVariant buildVariant, {
|
||||
Toolchain toolchain,
|
||||
List<BuildConfiguration> configs,
|
||||
String enginePath,
|
||||
bool force: false,
|
||||
String manifest: _kDefaultAndroidManifestPath,
|
||||
String resources,
|
||||
@ -441,17 +429,17 @@ Future<int> buildAndroid(
|
||||
resources = _kDefaultResourcesPath;
|
||||
}
|
||||
|
||||
BuildConfiguration config = configs.firstWhere((BuildConfiguration bc) => bc.targetPlatform == platform);
|
||||
_ApkComponents components = await _findApkComponents(
|
||||
platform, config, enginePath, manifest, resources, buildVariant
|
||||
platform, buildVariant, manifest, resources
|
||||
);
|
||||
|
||||
if (components == null) {
|
||||
printError('Failure building APK. Unable to find components.');
|
||||
printError('Failure building APK: unable to find components.');
|
||||
return 1;
|
||||
}
|
||||
|
||||
printStatus('Building APK in ${getVariantName(buildVariant)} mode...');
|
||||
String typeName = path.basename(tools.getEngineArtifactsDirectory(platform, buildVariant).path);
|
||||
printStatus('Building APK in ${getVariantName(buildVariant)} mode ($typeName)...');
|
||||
|
||||
if (flxPath != null && flxPath.isNotEmpty) {
|
||||
if (!FileSystemEntity.isFileSync(flxPath)) {
|
||||
@ -475,14 +463,12 @@ Future<int> buildAndroid(
|
||||
|
||||
Future<int> buildApk(
|
||||
TargetPlatform platform,
|
||||
Toolchain toolchain,
|
||||
List<BuildConfiguration> configs, {
|
||||
String enginePath,
|
||||
Toolchain toolchain, {
|
||||
String target,
|
||||
BuildVariant buildVariant: BuildVariant.develop
|
||||
}) async {
|
||||
if (!FileSystemEntity.isFileSync(_kDefaultAndroidManifestPath)) {
|
||||
printError('Cannot build APK. Missing $_kDefaultAndroidManifestPath.');
|
||||
printError('Cannot build APK: missing $_kDefaultAndroidManifestPath.');
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -490,8 +476,6 @@ Future<int> buildApk(
|
||||
platform,
|
||||
buildVariant,
|
||||
toolchain: toolchain,
|
||||
configs: configs,
|
||||
enginePath: enginePath,
|
||||
force: false,
|
||||
target: target
|
||||
);
|
||||
|
@ -30,7 +30,7 @@ class BuildIOSCommand extends FlutterCommand {
|
||||
return 1;
|
||||
}
|
||||
|
||||
IOSApp app = applicationPackages.iOS;
|
||||
IOSApp app = applicationPackages.getPackageForPlatform(TargetPlatform.ios);
|
||||
|
||||
if (app == null) {
|
||||
printError('Application not configured for iOS');
|
||||
@ -47,7 +47,7 @@ class BuildIOSCommand extends FlutterCommand {
|
||||
|
||||
String logTarget = forSimulator ? "simulator" : "device";
|
||||
|
||||
printStatus('Building the application for $logTarget.');
|
||||
printStatus('Building $app for $logTarget...');
|
||||
|
||||
bool result = await buildIOSXcodeProject(app,
|
||||
buildForDevice: !forSimulator, codesign: shouldCodesign);
|
||||
|
@ -265,7 +265,6 @@ class AppDomain extends Domain {
|
||||
int result = await startApp(
|
||||
device,
|
||||
command.toolchain,
|
||||
command.buildConfigurations,
|
||||
stop: true,
|
||||
target: args['target'],
|
||||
route: args['route'],
|
||||
|
@ -243,8 +243,9 @@ Future<int> startApp(DriveCommand command) async {
|
||||
if (command.device is AndroidDevice) {
|
||||
printTrace('Building an APK.');
|
||||
int result = await build_apk.buildApk(
|
||||
command.device.platform, command.toolchain, command.buildConfigurations,
|
||||
enginePath: command.runner.enginePath, target: command.target
|
||||
command.device.platform,
|
||||
command.toolchain,
|
||||
target: command.target
|
||||
);
|
||||
|
||||
if (result != 0)
|
||||
|
@ -59,7 +59,6 @@ class ListenCommand extends RunCommandBase {
|
||||
result = await startApp(
|
||||
deviceForCommand,
|
||||
toolchain,
|
||||
buildConfigurations,
|
||||
target: target,
|
||||
install: firstTime,
|
||||
stop: true,
|
||||
|
@ -97,7 +97,6 @@ class RunCommand extends RunCommandBase {
|
||||
int result = await startApp(
|
||||
deviceForCommand,
|
||||
toolchain,
|
||||
buildConfigurations,
|
||||
target: target,
|
||||
enginePath: runner.enginePath,
|
||||
install: true,
|
||||
@ -127,8 +126,7 @@ String _getMissingPackageHintForPlatform(TargetPlatform platform) {
|
||||
|
||||
Future<int> startApp(
|
||||
Device device,
|
||||
Toolchain toolchain,
|
||||
List<BuildConfiguration> configs, {
|
||||
Toolchain toolchain, {
|
||||
String target,
|
||||
String enginePath,
|
||||
bool stop: true,
|
||||
@ -165,8 +163,8 @@ Future<int> startApp(
|
||||
printTrace('Running build command.');
|
||||
|
||||
int result = await buildApk(
|
||||
device.platform, toolchain, configs,
|
||||
enginePath: enginePath,
|
||||
device.platform,
|
||||
toolchain,
|
||||
target: target,
|
||||
buildVariant: BuildVariant.develop
|
||||
);
|
||||
|
@ -98,6 +98,8 @@ class ToolConfiguration {
|
||||
/// Used to override the directory calculated from engineSrcPath (--engine-out-dir).
|
||||
String engineOutDir;
|
||||
|
||||
bool get isLocalEngine => engineSrcPath != null || engineOutDir != null;
|
||||
|
||||
String get _modeStr => release ? 'Release' : 'Debug';
|
||||
|
||||
/// The directory that contains development tools for the given platform. This
|
||||
@ -159,9 +161,11 @@ class ToolConfiguration {
|
||||
// Return something like 'out/android_Release'.
|
||||
return new Directory(path.join(engineSrcPath, 'out/${type}_$_modeStr'));
|
||||
} else {
|
||||
// TODO(devoncarew): We'll want to suffix the directory name with the variant.
|
||||
// For now, only suffix for deploy variants.
|
||||
String suffix = variant == BuildVariant.deploy ? '-${getVariantName(variant)}' : '';
|
||||
|
||||
String dirName = getNameForTargetPlatform(platform);
|
||||
// Create something like `android-arm` or `android-arm-deploy`.
|
||||
String dirName = getNameForTargetPlatform(platform) + suffix;
|
||||
Directory engineDir = _cache.getArtifactDirectory('engine');
|
||||
return new Directory(path.join(engineDir.path, dirName));
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ void main() {
|
||||
);
|
||||
expect(
|
||||
toolConfig.getEngineArtifactsDirectory(TargetPlatform.android_arm, BuildVariant.deploy).path,
|
||||
endsWith('cache/artifacts/engine/android-arm')
|
||||
endsWith('cache/artifacts/engine/android-arm-deploy')
|
||||
);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user