Skip to content

Commit 15cf374

Browse files
committed
fix(packages/flutter): split ios simulator binary per architecture and bump version to 0.8.68
1 parent 63f936a commit 15cf374

2 files changed

Lines changed: 53 additions & 2 deletions

File tree

packages/flutter/hook/build.dart

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,68 @@ void main(List<String> args) async {
3434
);
3535
}
3636

37+
output.dependencies.add(file.uri);
38+
39+
final assetFile = await _prepareAssetFile(
40+
input: input,
41+
os: os,
42+
arch: arch,
43+
config: codeConfig,
44+
file: file,
45+
);
46+
3747
output.assets.code.add(
3848
CodeAsset(
3949
package: input.packageName,
4050
name: 'src/native/sqlite_sync_extension.dart',
4151
linkMode: DynamicLoadingBundled(),
42-
file: file.uri,
52+
file: assetFile.uri,
4353
),
4454
);
4555
});
4656
}
4757

58+
Future<File> _prepareAssetFile({
59+
required BuildInput input,
60+
required OS os,
61+
required Architecture arch,
62+
required CodeConfig config,
63+
required File file,
64+
}) async {
65+
if (os != OS.iOS || config.iOS.targetSdk == IOSSdk.iPhoneOS) {
66+
return file;
67+
}
68+
69+
final thinArch = switch (arch) {
70+
Architecture.arm64 => 'arm64',
71+
Architecture.x64 => 'x86_64',
72+
_ => null,
73+
};
74+
if (thinArch == null) {
75+
return file;
76+
}
77+
78+
final outputName = 'cloudsync_ios_sim_$thinArch.dylib';
79+
final outputFile = File.fromUri(input.outputDirectory.resolve(outputName));
80+
await outputFile.parent.create(recursive: true);
81+
82+
final result = await Process.run('/usr/bin/lipo', [
83+
file.path,
84+
'-thin',
85+
thinArch,
86+
'-output',
87+
outputFile.path,
88+
]);
89+
if (result.exitCode != 0) {
90+
throw StateError(
91+
'Failed to thin sqlite_sync iOS simulator binary for $thinArch: '
92+
'${result.stderr}',
93+
);
94+
}
95+
96+
return outputFile;
97+
}
98+
4899
String? _resolveBinaryPath(OS os, Architecture arch, CodeConfig config) {
49100
if (os == OS.android) {
50101
return switch (arch) {

src/cloudsync.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
extern "C" {
2121
#endif
2222

23-
#define CLOUDSYNC_VERSION "0.8.67"
23+
#define CLOUDSYNC_VERSION "0.8.68"
2424

2525
int sqlite3_cloudsync_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
2626

0 commit comments

Comments
 (0)