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 {
|
} else {
|
||||||
String artifactsDir = tools.getEngineArtifactsDirectory(platform, buildMode).path;
|
String artifactsDir = tools.getEngineArtifactsDirectory(platform, buildMode).path;
|
||||||
entryPointsDir = artifactsDir;
|
entryPointsDir = artifactsDir;
|
||||||
String hostToolsDir = path.join(artifactsDir, getNameForHostPlatform(getCurrentHostPlatform()));
|
if (platform == TargetPlatform.ios) {
|
||||||
genSnapshot = path.join(hostToolsDir, 'gen_snapshot');
|
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);
|
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
|
// On iOS, we use Xcode to compile the snapshot into a static library that the
|
||||||
// end-developer can link into their app.
|
// end-developer can link into their app.
|
||||||
if (platform == TargetPlatform.ios) {
|
if (platform == TargetPlatform.ios) {
|
||||||
printStatus('Building app.a...');
|
printStatus('Building app.so...');
|
||||||
|
|
||||||
// These names are known to from the engine.
|
// These names are known to from the engine.
|
||||||
const String kDartVmIsolateSnapshotBuffer = 'kDartVmIsolateSnapshotBuffer';
|
const String kDartVmIsolateSnapshotBuffer = 'kDartVmIsolateSnapshotBuffer';
|
||||||
@ -252,17 +256,16 @@ String buildAotSnapshot(
|
|||||||
runCheckedSync(<String>['xcrun', 'cc', '-c', kDartVmIsolateSnapshotBufferC, '-o', kDartVmIsolateSnapshotBufferO]);
|
runCheckedSync(<String>['xcrun', 'cc', '-c', kDartVmIsolateSnapshotBufferC, '-o', kDartVmIsolateSnapshotBufferO]);
|
||||||
runCheckedSync(<String>['xcrun', 'cc', '-c', kDartIsolateSnapshotBufferC, '-o', kDartIsolateSnapshotBufferO]);
|
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> linkCommand = <String>[
|
||||||
List<String> archiveCommand = <String>[
|
'xcrun', 'ld', '-dylib', '-o', appSo,
|
||||||
'xcrun', 'ar', 'rcs', appLib,
|
|
||||||
kDartVmIsolateSnapshotBufferO,
|
kDartVmIsolateSnapshotBufferO,
|
||||||
kDartIsolateSnapshotBufferO,
|
kDartIsolateSnapshotBufferO,
|
||||||
];
|
];
|
||||||
if (!interpreter)
|
if (!interpreter)
|
||||||
archiveCommand.add(assemblyO);
|
linkCommand.add(assemblyO);
|
||||||
runCheckedSync(archiveCommand);
|
runCheckedSync(linkCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
return outputPath;
|
return outputPath;
|
||||||
|
Loading…
Reference in New Issue
Block a user