Unverified Commit bb6c3f81 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Remove flutter_tools support for old AOT snapshotting (#34895)

Android now exclusively uses ELF shared libraries, and
iOS uses assembly.
parent 1a64e765
...@@ -268,13 +268,6 @@ class FlutterPlugin implements Plugin<Project> { ...@@ -268,13 +268,6 @@ class FlutterPlugin implements Plugin<Project> {
} }
} }
private static Boolean getBuildShareLibrary(Project project) {
if (project.hasProperty('build-shared-library')) {
return project.property('build-shared-library').toBoolean()
}
return false;
}
private static Boolean splitPerAbi(Project project) { private static Boolean splitPerAbi(Project project) {
if (project.hasProperty('split-per-abi')) { if (project.hasProperty('split-per-abi')) {
return project.property('split-per-abi').toBoolean() return project.property('split-per-abi').toBoolean()
...@@ -645,7 +638,6 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -645,7 +638,6 @@ abstract class BaseFlutterTask extends DefaultTask {
args "build", "aot" args "build", "aot"
args "--suppress-analytics" args "--suppress-analytics"
args "--quiet" args "--quiet"
args "--build-shared-library"
args "--target", targetPath args "--target", targetPath
args "--output-dir", "${intermediateDir}" args "--output-dir", "${intermediateDir}"
args "--target-platform", "${targetPlatform}" args "--target-platform", "${targetPlatform}"
......
...@@ -92,7 +92,6 @@ class AOTSnapshotter { ...@@ -92,7 +92,6 @@ class AOTSnapshotter {
@required String mainPath, @required String mainPath,
@required String packagesPath, @required String packagesPath,
@required String outputPath, @required String outputPath,
@required bool buildSharedLibrary,
IOSArch iosArch, IOSArch iosArch,
List<String> extraGenSnapshotOptions = const <String>[], List<String> extraGenSnapshotOptions = const <String>[],
}) async { }) async {
...@@ -107,10 +106,6 @@ class AOTSnapshotter { ...@@ -107,10 +106,6 @@ class AOTSnapshotter {
// TODO(cbracken): replace IOSArch with TargetPlatform.ios_{armv7,arm64}. // TODO(cbracken): replace IOSArch with TargetPlatform.ios_{armv7,arm64}.
assert(platform != TargetPlatform.ios || iosArch != null); assert(platform != TargetPlatform.ios || iosArch != null);
// buildSharedLibrary is ignored for iOS builds.
if (platform == TargetPlatform.ios)
buildSharedLibrary = false;
final PackageMap packageMap = PackageMap(packagesPath); final PackageMap packageMap = PackageMap(packagesPath);
final String packageMapError = packageMap.checkValid(); final String packageMapError = packageMap.checkValid();
if (packageMapError != null) { if (packageMapError != null) {
...@@ -143,26 +138,12 @@ class AOTSnapshotter { ...@@ -143,26 +138,12 @@ class AOTSnapshotter {
outputPaths.add(assembly); outputPaths.add(assembly);
genSnapshotArgs.add('--snapshot_kind=app-aot-assembly'); genSnapshotArgs.add('--snapshot_kind=app-aot-assembly');
genSnapshotArgs.add('--assembly=$assembly'); genSnapshotArgs.add('--assembly=$assembly');
} else if (buildSharedLibrary) { } else {
final String aotSharedLibrary = fs.path.join(outputDir.path, 'app.so'); final String aotSharedLibrary = fs.path.join(outputDir.path, 'app.so');
outputPaths.add(aotSharedLibrary); outputPaths.add(aotSharedLibrary);
genSnapshotArgs.add('--snapshot_kind=app-aot-elf'); genSnapshotArgs.add('--snapshot_kind=app-aot-elf');
genSnapshotArgs.add('--elf=$aotSharedLibrary'); genSnapshotArgs.add('--elf=$aotSharedLibrary');
genSnapshotArgs.add('--strip'); genSnapshotArgs.add('--strip');
} else {
// Blob AOT snapshot.
final String vmSnapshotData = fs.path.join(outputDir.path, 'vm_snapshot_data');
final String isolateSnapshotData = fs.path.join(outputDir.path, 'isolate_snapshot_data');
final String vmSnapshotInstructions = fs.path.join(outputDir.path, 'vm_snapshot_instr');
final String isolateSnapshotInstructions = fs.path.join(outputDir.path, 'isolate_snapshot_instr');
outputPaths.addAll(<String>[vmSnapshotData, isolateSnapshotData, vmSnapshotInstructions, isolateSnapshotInstructions]);
genSnapshotArgs.addAll(<String>[
'--snapshot_kind=app-aot-blobs',
'--vm_snapshot_data=$vmSnapshotData',
'--isolate_snapshot_data=$isolateSnapshotData',
'--vm_snapshot_instructions=$vmSnapshotInstructions',
'--isolate_snapshot_instructions=$isolateSnapshotInstructions',
]);
} }
if (platform == TargetPlatform.android_arm || iosArch == IOSArch.armv7) { if (platform == TargetPlatform.android_arm || iosArch == IOSArch.armv7) {
...@@ -192,7 +173,6 @@ class AOTSnapshotter { ...@@ -192,7 +173,6 @@ class AOTSnapshotter {
'buildMode': buildMode.toString(), 'buildMode': buildMode.toString(),
'targetPlatform': platform.toString(), 'targetPlatform': platform.toString(),
'entryPoint': mainPath, 'entryPoint': mainPath,
'sharedLib': buildSharedLibrary.toString(),
'extraGenSnapshotOptions': extraGenSnapshotOptions.join(' '), 'extraGenSnapshotOptions': extraGenSnapshotOptions.join(' '),
'engineHash': Cache.instance.engineRevision, 'engineHash': Cache.instance.engineRevision,
'buildersUsed': '${flutterProject != null ? flutterProject.hasBuilders : false}', 'buildersUsed': '${flutterProject != null ? flutterProject.hasBuilders : false}',
......
...@@ -28,11 +28,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen ...@@ -28,11 +28,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
allowed: <String>['android-arm', 'android-arm64', 'ios'], allowed: <String>['android-arm', 'android-arm64', 'ios'],
) )
..addFlag('quiet', defaultsTo: false) ..addFlag('quiet', defaultsTo: false)
..addFlag('build-shared-library',
negatable: false,
defaultsTo: false,
help: 'Compile to a *.so file (requires NDK when building for Android).',
)
..addFlag('report-timings', ..addFlag('report-timings',
negatable: false, negatable: false,
defaultsTo: false, defaultsTo: false,
...@@ -122,7 +117,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen ...@@ -122,7 +117,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
mainPath: mainPath, mainPath: mainPath,
packagesPath: PackageMap.globalPackagesPath, packagesPath: PackageMap.globalPackagesPath,
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions], extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions],
).then<int>((int buildExitCode) { ).then<int>((int buildExitCode) {
return buildExitCode; return buildExitCode;
...@@ -152,7 +146,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen ...@@ -152,7 +146,6 @@ class BuildAotCommand extends BuildSubCommand with TargetPlatformBasedDevelopmen
mainPath: mainPath, mainPath: mainPath,
packagesPath: PackageMap.globalPackagesPath, packagesPath: PackageMap.globalPackagesPath,
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: argResults['build-shared-library'],
extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions], extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions],
); );
if (snapshotExitCode != 0) { if (snapshotExitCode != 0) {
......
...@@ -135,7 +135,6 @@ void main() { ...@@ -135,7 +135,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
), isNot(equals(0))); ), isNot(equals(0)));
}, overrides: contextOverrides); }, overrides: contextOverrides);
...@@ -147,7 +146,6 @@ void main() { ...@@ -147,7 +146,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
), isNot(0)); ), isNot(0));
}, overrides: contextOverrides); }, overrides: contextOverrides);
...@@ -159,7 +157,6 @@ void main() { ...@@ -159,7 +157,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
), isNot(0)); ), isNot(0));
}, overrides: contextOverrides); }, overrides: contextOverrides);
...@@ -183,7 +180,6 @@ void main() { ...@@ -183,7 +180,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
iosArch: IOSArch.armv7, iosArch: IOSArch.armv7,
); );
...@@ -221,7 +217,6 @@ void main() { ...@@ -221,7 +217,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
iosArch: IOSArch.arm64, iosArch: IOSArch.arm64,
); );
...@@ -237,90 +232,6 @@ void main() { ...@@ -237,90 +232,6 @@ void main() {
]); ]);
}, overrides: contextOverrides); }, overrides: contextOverrides);
testUsingContext('builds Android arm profile AOT snapshot', () async {
fs.file('main.dill').writeAsStringSync('binary magic');
final String outputPath = fs.path.join('build', 'foo');
fs.directory(outputPath).createSync(recursive: true);
genSnapshot.outputs = <String, String>{
fs.path.join(outputPath, 'vm_snapshot_data'): '',
fs.path.join(outputPath, 'isolate_snapshot_data'): '',
fs.path.join(outputPath, 'vm_snapshot_instr'): '',
fs.path.join(outputPath, 'isolate_snapshot_instr'): '',
};
final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']);
when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
final int genSnapshotExitCode = await snapshotter.build(
platform: TargetPlatform.android_arm,
buildMode: BuildMode.profile,
mainPath: 'main.dill',
packagesPath: '.packages',
outputPath: outputPath,
buildSharedLibrary: false,
);
expect(genSnapshotExitCode, 0);
expect(genSnapshot.callCount, 1);
expect(genSnapshot.snapshotType.platform, TargetPlatform.android_arm);
expect(genSnapshot.snapshotType.mode, BuildMode.profile);
expect(genSnapshot.additionalArgs, <String>[
'--deterministic',
'--snapshot_kind=app-aot-blobs',
'--vm_snapshot_data=build/foo/vm_snapshot_data',
'--isolate_snapshot_data=build/foo/isolate_snapshot_data',
'--vm_snapshot_instructions=build/foo/vm_snapshot_instr',
'--isolate_snapshot_instructions=build/foo/isolate_snapshot_instr',
'--no-sim-use-hardfp',
'--no-use-integer-division',
'main.dill',
]);
}, overrides: contextOverrides);
testUsingContext('builds Android arm64 profile AOT snapshot', () async {
fs.file('main.dill').writeAsStringSync('binary magic');
final String outputPath = fs.path.join('build', 'foo');
fs.directory(outputPath).createSync(recursive: true);
genSnapshot.outputs = <String, String>{
fs.path.join(outputPath, 'vm_snapshot_data'): '',
fs.path.join(outputPath, 'isolate_snapshot_data'): '',
fs.path.join(outputPath, 'vm_snapshot_instr'): '',
fs.path.join(outputPath, 'isolate_snapshot_instr'): '',
};
final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']);
when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
final int genSnapshotExitCode = await snapshotter.build(
platform: TargetPlatform.android_arm64,
buildMode: BuildMode.profile,
mainPath: 'main.dill',
packagesPath: '.packages',
outputPath: outputPath,
buildSharedLibrary: false,
);
expect(genSnapshotExitCode, 0);
expect(genSnapshot.callCount, 1);
expect(genSnapshot.snapshotType.platform, TargetPlatform.android_arm64);
expect(genSnapshot.snapshotType.mode, BuildMode.profile);
expect(genSnapshot.additionalArgs, <String>[
'--deterministic',
'--snapshot_kind=app-aot-blobs',
'--vm_snapshot_data=build/foo/vm_snapshot_data',
'--isolate_snapshot_data=build/foo/isolate_snapshot_data',
'--vm_snapshot_instructions=build/foo/vm_snapshot_instr',
'--isolate_snapshot_instructions=build/foo/isolate_snapshot_instr',
'main.dill',
]);
}, overrides: contextOverrides);
testUsingContext('builds iOS release armv7 AOT snapshot', () async { testUsingContext('builds iOS release armv7 AOT snapshot', () async {
fs.file('main.dill').writeAsStringSync('binary magic'); fs.file('main.dill').writeAsStringSync('binary magic');
...@@ -341,7 +252,6 @@ void main() { ...@@ -341,7 +252,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
iosArch: IOSArch.armv7, iosArch: IOSArch.armv7,
); );
...@@ -379,7 +289,6 @@ void main() { ...@@ -379,7 +289,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
iosArch: IOSArch.arm64, iosArch: IOSArch.arm64,
); );
...@@ -407,7 +316,6 @@ void main() { ...@@ -407,7 +316,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: true,
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
...@@ -437,7 +345,6 @@ void main() { ...@@ -437,7 +345,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: true,
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
...@@ -453,90 +360,6 @@ void main() { ...@@ -453,90 +360,6 @@ void main() {
]); ]);
}, overrides: contextOverrides); }, overrides: contextOverrides);
testUsingContext('builds Android arm release AOT snapshot', () async {
fs.file('main.dill').writeAsStringSync('binary magic');
final String outputPath = fs.path.join('build', 'foo');
fs.directory(outputPath).createSync(recursive: true);
genSnapshot.outputs = <String, String>{
fs.path.join(outputPath, 'vm_snapshot_data'): '',
fs.path.join(outputPath, 'isolate_snapshot_data'): '',
fs.path.join(outputPath, 'vm_snapshot_instr'): '',
fs.path.join(outputPath, 'isolate_snapshot_instr'): '',
};
final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']);
when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
final int genSnapshotExitCode = await snapshotter.build(
platform: TargetPlatform.android_arm,
buildMode: BuildMode.release,
mainPath: 'main.dill',
packagesPath: '.packages',
outputPath: outputPath,
buildSharedLibrary: false,
);
expect(genSnapshotExitCode, 0);
expect(genSnapshot.callCount, 1);
expect(genSnapshot.snapshotType.platform, TargetPlatform.android_arm);
expect(genSnapshot.snapshotType.mode, BuildMode.release);
expect(genSnapshot.additionalArgs, <String>[
'--deterministic',
'--snapshot_kind=app-aot-blobs',
'--vm_snapshot_data=build/foo/vm_snapshot_data',
'--isolate_snapshot_data=build/foo/isolate_snapshot_data',
'--vm_snapshot_instructions=build/foo/vm_snapshot_instr',
'--isolate_snapshot_instructions=build/foo/isolate_snapshot_instr',
'--no-sim-use-hardfp',
'--no-use-integer-division',
'main.dill',
]);
}, overrides: contextOverrides);
testUsingContext('builds Android arm64 release AOT snapshot', () async {
fs.file('main.dill').writeAsStringSync('binary magic');
final String outputPath = fs.path.join('build', 'foo');
fs.directory(outputPath).createSync(recursive: true);
genSnapshot.outputs = <String, String>{
fs.path.join(outputPath, 'vm_snapshot_data'): '',
fs.path.join(outputPath, 'isolate_snapshot_data'): '',
fs.path.join(outputPath, 'vm_snapshot_instr'): '',
fs.path.join(outputPath, 'isolate_snapshot_instr'): '',
};
final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']);
when(xcode.cc(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
when(xcode.clang(any)).thenAnswer((_) => Future<RunResult>.value(successResult));
final int genSnapshotExitCode = await snapshotter.build(
platform: TargetPlatform.android_arm64,
buildMode: BuildMode.release,
mainPath: 'main.dill',
packagesPath: '.packages',
outputPath: outputPath,
buildSharedLibrary: false,
);
expect(genSnapshotExitCode, 0);
expect(genSnapshot.callCount, 1);
expect(genSnapshot.snapshotType.platform, TargetPlatform.android_arm64);
expect(genSnapshot.snapshotType.mode, BuildMode.release);
expect(genSnapshot.additionalArgs, <String>[
'--deterministic',
'--snapshot_kind=app-aot-blobs',
'--vm_snapshot_data=build/foo/vm_snapshot_data',
'--isolate_snapshot_data=build/foo/isolate_snapshot_data',
'--vm_snapshot_instructions=build/foo/vm_snapshot_instr',
'--isolate_snapshot_instructions=build/foo/isolate_snapshot_instr',
'main.dill',
]);
}, overrides: contextOverrides);
testUsingContext('reports timing', () async { testUsingContext('reports timing', () async {
fs.file('main.dill').writeAsStringSync('binary magic'); fs.file('main.dill').writeAsStringSync('binary magic');
...@@ -544,10 +367,7 @@ void main() { ...@@ -544,10 +367,7 @@ void main() {
fs.directory(outputPath).createSync(recursive: true); fs.directory(outputPath).createSync(recursive: true);
genSnapshot.outputs = <String, String>{ genSnapshot.outputs = <String, String>{
fs.path.join(outputPath, 'vm_snapshot_data'): '', fs.path.join(outputPath, 'app.so'): '',
fs.path.join(outputPath, 'isolate_snapshot_data'): '',
fs.path.join(outputPath, 'vm_snapshot_instr'): '',
fs.path.join(outputPath, 'isolate_snapshot_instr'): '',
}; };
final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']); final RunResult successResult = RunResult(ProcessResult(1, 0, '', ''), <String>['command name', 'arguments...']);
...@@ -560,7 +380,6 @@ void main() { ...@@ -560,7 +380,6 @@ void main() {
mainPath: 'main.dill', mainPath: 'main.dill',
packagesPath: '.packages', packagesPath: '.packages',
outputPath: outputPath, outputPath: outputPath,
buildSharedLibrary: false,
); );
expect(genSnapshotExitCode, 0); expect(genSnapshotExitCode, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment