Skip to content

Commit 96e984c

Browse files
C library: add script to update version, update instructions #12
1 parent df01e61 commit 96e984c

File tree

2 files changed

+46
-24
lines changed

2 files changed

+46
-24
lines changed

dev-doc/updating-c-library.md

+21-24
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,23 @@ Dart won't error on C function signature mismatch, leading to obscure memory bug
55

66
## C libraries
77

8-
For Dart Native and unit tests:
8+
For Dart Native and unit tests and for Flutter (`flutter_libs` and `sync_flutter_libs` plugins)
9+
on Linux and Windows:
10+
```
11+
./tool/set-c-version.sh 0.20.0
12+
```
913

10-
- Update [install.sh](../install.sh).
14+
For the Flutter plugins on Android ([view releases](https://github.com/objectbox/objectbox-java/releases)):
15+
```
16+
./tool/set-android-version.sh 3.7.1
17+
```
1118

12-
For Flutter (`flutter_libs` and `sync_flutter_libs` plugins):
19+
For the Flutter plugins on iOS/macOS ([view releases](https://github.com/objectbox/objectbox-swift/releases))
20+
```
21+
./tool/set-swift-version.sh 1.9.1
22+
```
1323

14-
- Linux and Windows
15-
- Shortcut: search and replace e.g. `set(OBJECTBOX_VERSION 0.20.0)` in `CMakeLists.txt`.
16-
- [flutter_libs Linux](../flutter_libs/linux/CMakeLists.txt)
17-
- [flutter_libs Windows](../flutter_libs/windows/CMakeLists.txt)
18-
- [sync_flutter_libs Linux](../sync_flutter_libs/linux/CMakeLists.txt)
19-
- [sync_flutter_libs Windows](../sync_flutter_libs/windows/CMakeLists.txt)
20-
- Android ([view releases](https://github.com/objectbox/objectbox-java/releases))
21-
```
22-
./tool/set-android-version.sh 3.7.1
23-
```
24-
- Swift (iOS/macOS) ([view releases](https://github.com/objectbox/objectbox-swift/releases))
25-
```
26-
./tool/set-swift-version.sh 1.9.1
27-
```
28-
29-
Note: the embedded C library and core version can be looked up
30-
for Android from the relevant core repository release tag and
31-
for Swift from its repos release tag and the core commit it points to.
24+
For each, add an entry (see previous releases) to the [CHANGELOG](../objectbox/CHANGELOG.md).
3225

3326
## Dart C API bindings
3427
Download source code of an [objectbox-c release version](https://github.com/objectbox/objectbox-c/releases).
@@ -40,7 +33,11 @@ Download source code of an [objectbox-c release version](https://github.com/obje
4033
- Execute `dart run ffigen` in the `objectbox` directory. This requires LLVM libraries
4134
(see [ffigen docs](https://pub.dev/packages/ffigen#installing-llvm)
4235
and the ffigen section in [pubspec.yaml](../objectbox/pubspec.yaml)).
43-
- Copy/update enums from [objectbox_c.dart](../objectbox/lib/src/native/bindings/objectbox_c.dart)
44-
in [enums.dart](../objectbox/lib/src/modelinfo/enums.dart) that need to be exposed to users.
36+
- Copy/update enums that need to be exposed to users from [objectbox_c.dart](../objectbox/lib/src/native/bindings/objectbox_c.dart)
37+
to [enums.dart](../objectbox/lib/src/modelinfo/enums.dart).
4538
- Have a look at the changed files to see if some call sites need to be updated.
46-
- Update minimum C library and core version and notes in [bindings.dart](../objectbox/lib/src/native/bindings/bindings.dart).
39+
- ⚠️ Update minimum C library and core version and notes as needed in [bindings.dart](../objectbox/lib/src/native/bindings/bindings.dart).
40+
41+
Note: the embedded C library and core version can be looked up
42+
for Android from the relevant core repository release tag and
43+
for Swift from its repos release tag and the core commit it points to.

tool/set-c-version.sh

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
. "$(dirname "$0")"/common.sh
3+
4+
# Changes the C library version used in
5+
# - the install script (for Dart Native and unit tests) and
6+
# - both Flutter plugins (for Flutter on Linux, Windows).
7+
8+
if [[ "$#" -ne "1" ]]; then
9+
echo "usage: $0 <version>"
10+
echo "e.g. $0 0.20.0"
11+
exit 1
12+
fi
13+
14+
version=$1
15+
16+
echo "Setting cLibVersion and OBJECTBOX_VERSION version: $version"
17+
18+
versionExpr="s/cLibVersion=[0-9]\+\.[0-9]\+\.[0-9]\+/cLibVersion=${version}/g"
19+
update install.sh "${versionExpr}"
20+
21+
versionExpr="s/OBJECTBOX_VERSION [0-9]\+\.[0-9]\+\.[0-9]\+/OBJECTBOX_VERSION ${version}/g"
22+
update flutter_libs/linux/CMakeLists.txt "${versionExpr}"
23+
update flutter_libs/windows/CMakeLists.txt "${versionExpr}"
24+
update sync_flutter_libs/linux/CMakeLists.txt "${versionExpr}"
25+
update sync_flutter_libs/windows/CMakeLists.txt "${versionExpr}"

0 commit comments

Comments
 (0)