Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/flutter_tools/lib/src/base/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class AOTSnapshotter {
final Directory outputDir = _fileSystem.directory(outputPath);
outputDir.createSync(recursive: true);

final List<String> iosGenSnapshotArgs = <String>[
final List<String> dumpClassTableLinkInfoArgs = <String>[
// Shorebird dumps the class table information during snapshot compilation which is later used during linking.
'--print_class_table_link_debug_info_to=${_fileSystem.path.join(outputDir.parent.path, 'App.class_table.json')}',
'--print_class_table_link_info_to=${_fileSystem.path.join(outputDir.parent.path, 'App.ct.link')}',
Expand All @@ -139,7 +139,7 @@ class AOTSnapshotter {
// Shorebird uses --deterministic to improve snapshot stability and increase linking.
'--deterministic',
// Only use the default Shorebird gen_snapshot args on iOS.
if (platform == TargetPlatform.ios) ...iosGenSnapshotArgs,
if (platform == TargetPlatform.ios || platform == TargetPlatform.darwin) ...dumpClassTableLinkInfoArgs,
];

final bool targetingApplePlatform =
Expand Down
16 changes: 16 additions & 0 deletions packages/flutter_tools/lib/src/build_system/targets/macos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,22 @@ class CompileMacOSFramework extends Target {
throw Exception('AOT snapshotter exited with code ${results.join()}');
}

// If the shorebird directory exists, delete it first.
final Directory shorebirdDir = environment.fileSystem.directory(environment.fileSystem.path.join(getMacOSBuildDirectory(), 'shorebird'));
if (shorebirdDir.existsSync()) {
shorebirdDir.deleteSync(recursive: true);
}

// Copy the class table link information (generated by gen_snapshot) from the buildOutputPath to the macos build directory.
final File classTableLink = environment.fileSystem.file(environment.fileSystem.path.join(buildOutputPath, 'App.ct.link'));
final File classTableLinkDebug = environment.fileSystem.file(environment.fileSystem.path.join(buildOutputPath, 'App.class_table.json'));
if (classTableLink.existsSync()) {
classTableLink.copySync(environment.fileSystem.path.join(shorebirdDir.path, 'App.ct.link'));
}
if (classTableLinkDebug.existsSync()) {
classTableLinkDebug.copySync(environment.fileSystem.path.join(shorebirdDir.path, 'App.class_table.json'));
}

// Combine the app lib into a fat framework.
await Lipo.create(
environment,
Expand Down
Loading