mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Build app.so instead of app.a on iOS (#4168)
The app.a wasn't getting pulled into the main executable because we weren't referencing any of its symbols. Instead, create a dylib that can be packaged with the application and loaded at runtime.
This commit is contained in:
parent
bacd3d2cb0
commit
2d726fc0c5
@ -100,8 +100,12 @@ String buildAotSnapshot(
|
||||
} else {
|
||||
String artifactsDir = tools.getEngineArtifactsDirectory(platform, buildMode).path;
|
||||
entryPointsDir = artifactsDir;
|
||||
String hostToolsDir = path.join(artifactsDir, getNameForHostPlatform(getCurrentHostPlatform()));
|
||||
genSnapshot = path.join(hostToolsDir, 'gen_snapshot');
|
||||
if (platform == TargetPlatform.ios) {
|
||||
genSnapshot = path.join(artifactsDir, 'gen_snapshot');
|
||||
} else {
|
||||
String hostToolsDir = path.join(artifactsDir, getNameForHostPlatform(getCurrentHostPlatform()));
|
||||
genSnapshot = path.join(hostToolsDir, 'gen_snapshot');
|
||||
}
|
||||
}
|
||||
|
||||
Directory outputDir = new Directory(outputPath);
|
||||
@ -224,7 +228,7 @@ String buildAotSnapshot(
|
||||
// On iOS, we use Xcode to compile the snapshot into a static library that the
|
||||
// end-developer can link into their app.
|
||||
if (platform == TargetPlatform.ios) {
|
||||
printStatus('Building app.a...');
|
||||
printStatus('Building app.so...');
|
||||
|
||||
// These names are known to from the engine.
|
||||
const String kDartVmIsolateSnapshotBuffer = 'kDartVmIsolateSnapshotBuffer';
|
||||
@ -252,17 +256,16 @@ String buildAotSnapshot(
|
||||
runCheckedSync(<String>['xcrun', 'cc', '-c', kDartVmIsolateSnapshotBufferC, '-o', kDartVmIsolateSnapshotBufferO]);
|
||||
runCheckedSync(<String>['xcrun', 'cc', '-c', kDartIsolateSnapshotBufferC, '-o', kDartIsolateSnapshotBufferO]);
|
||||
|
||||
String appLib = path.join(outputDir.path, 'app.a');
|
||||
String appSo = path.join(outputDir.path, 'app.so');
|
||||
|
||||
runCheckedSync(<String>['rm', '-f', appLib]);
|
||||
List<String> archiveCommand = <String>[
|
||||
'xcrun', 'ar', 'rcs', appLib,
|
||||
List<String> linkCommand = <String>[
|
||||
'xcrun', 'ld', '-dylib', '-o', appSo,
|
||||
kDartVmIsolateSnapshotBufferO,
|
||||
kDartIsolateSnapshotBufferO,
|
||||
];
|
||||
if (!interpreter)
|
||||
archiveCommand.add(assemblyO);
|
||||
runCheckedSync(archiveCommand);
|
||||
linkCommand.add(assemblyO);
|
||||
runCheckedSync(linkCommand);
|
||||
}
|
||||
|
||||
return outputPath;
|
||||
|
Loading…
Reference in New Issue
Block a user