Skip to content

Commit faeab43

Browse files
committed
fix(ci): publish flutter package workflow, split ios simulator binaries for flutter package and bump version to 1.3.1
1 parent 27f1472 commit faeab43

File tree

4 files changed

+54
-12
lines changed

4 files changed

+54
-12
lines changed

.github/workflows/flutter-package.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,4 @@ jobs:
7979
# Publish to pub.dev
8080
cd $FLUTTER_DIR
8181
dart pub get
82-
dart pub publish --dry-run
8382
dart pub publish --force

packages/flutter/CHANGELOG.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/flutter/hook/build.dart

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ void main(List<String> args) async {
1717

1818
final binaryPath = _resolveBinaryPath(os, arch, codeConfig);
1919
if (binaryPath == null) {
20-
throw UnsupportedError(
21-
'sqlite_js does not support $os $arch.',
22-
);
20+
throw UnsupportedError('sqlite_js does not support $os $arch.');
2321
}
2422

2523
final nativeLibDir = p.join(
@@ -34,17 +32,68 @@ void main(List<String> args) async {
3432
);
3533
}
3634

35+
output.dependencies.add(file.uri);
36+
37+
final assetFile = await _prepareAssetFile(
38+
input: input,
39+
os: os,
40+
arch: arch,
41+
config: codeConfig,
42+
file: file,
43+
);
44+
3745
output.assets.code.add(
3846
CodeAsset(
3947
package: input.packageName,
4048
name: 'src/native/sqlite_js_extension.dart',
4149
linkMode: DynamicLoadingBundled(),
42-
file: file.uri,
50+
file: assetFile.uri,
4351
),
4452
);
4553
});
4654
}
4755

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

src/sqlitejs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "sqlite3.h"
1717
#endif
1818

19-
#define SQLITE_JS_VERSION "1.3.0"
19+
#define SQLITE_JS_VERSION "1.3.1"
2020

2121
int sqlite3_js_init (sqlite3 *db, char **pzErrMsg, const sqlite3_api_routines *pApi);
2222
const char *sqlitejs_version (void);

0 commit comments

Comments
 (0)