Skip to content

Commit e9ef3fb

Browse files
ObjectBox Swift database 4.3.0
1 parent d8fcee3 commit e9ef3fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+873
-198
lines changed

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@ Notable changes to the ObjectBox Swift library.
44

55
For more insights into what changed in the ObjectBox C++ core, [check the ObjectBox C changelog](https://github.com/objectbox/objectbox-c/blob/main/CHANGELOG.md).
66

7-
## Next release
7+
## 4.3.0 - 2025-05-21
88

99
- The generator supports Xcode 16 projects with buildable folders. [#94](https://github.com/objectbox/objectbox-swift/issues/94)
10+
- External property types and names (via [MongoDB connector Data Mapping](https://sync.objectbox.io/mongodb-sync-connector/mongodb-data-mapping))
11+
12+
### Sync
13+
14+
- Add "Log Events" for important server events, which can be viewed on a new Admin page.
15+
- Detect and ignore changes for objects that were put but were unchanged.
16+
- The limit for message size was raised to 32 MB.
17+
- Transactions above the message size limit now already fail on the client (to better enforce the limit).
1018

1119
## 4.2.0 - 2025-04-09
1220

Source/Gemfile.lock

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,32 @@ GEM
55
base64
66
nkf
77
rexml
8-
activesupport (7.1.3.4)
8+
activesupport (7.2.2.1)
99
base64
10+
benchmark (>= 0.3)
1011
bigdecimal
11-
concurrent-ruby (~> 1.0, >= 1.0.2)
12+
concurrent-ruby (~> 1.0, >= 1.3.1)
1213
connection_pool (>= 2.2.5)
1314
drb
1415
i18n (>= 1.6, < 2)
16+
logger (>= 1.4.2)
1517
minitest (>= 5.1)
16-
mutex_m
17-
tzinfo (~> 2.0)
18+
securerandom (>= 0.3)
19+
tzinfo (~> 2.0, >= 2.0.5)
1820
addressable (2.8.7)
1921
public_suffix (>= 2.0.2, < 7.0)
2022
algoliasearch (1.27.5)
2123
httpclient (~> 2.8, >= 2.8.3)
2224
json (>= 1.5.1)
2325
atomos (0.1.3)
2426
base64 (0.2.0)
25-
bigdecimal (3.1.8)
27+
benchmark (0.4.0)
28+
bigdecimal (3.1.9)
2629
claide (1.1.0)
27-
cocoapods (1.15.2)
30+
cocoapods (1.16.2)
2831
addressable (~> 2.8)
2932
claide (>= 1.0.2, < 2.0)
30-
cocoapods-core (= 1.15.2)
33+
cocoapods-core (= 1.16.2)
3134
cocoapods-deintegrate (>= 1.0.3, < 2.0)
3235
cocoapods-downloader (>= 2.1, < 3.0)
3336
cocoapods-plugins (>= 1.0.0, < 2.0)
@@ -41,8 +44,8 @@ GEM
4144
molinillo (~> 0.8.0)
4245
nap (~> 1.0)
4346
ruby-macho (>= 2.3.0, < 3.0)
44-
xcodeproj (>= 1.23.0, < 2.0)
45-
cocoapods-core (1.15.2)
47+
xcodeproj (>= 1.27.0, < 2.0)
48+
cocoapods-core (1.16.2)
4649
activesupport (>= 5.0, < 8)
4750
addressable (~> 2.8)
4851
algoliasearch (~> 1.0)
@@ -62,20 +65,21 @@ GEM
6265
netrc (~> 0.11)
6366
cocoapods-try (1.2.0)
6467
colored2 (3.1.2)
65-
concurrent-ruby (1.3.3)
66-
connection_pool (2.4.1)
68+
concurrent-ruby (1.3.5)
69+
connection_pool (2.5.3)
6770
drb (2.2.1)
6871
escape (0.0.4)
6972
ethon (0.16.0)
7073
ffi (>= 1.15.0)
71-
ffi (1.17.0)
74+
ffi (1.17.2)
7275
fourflusher (2.3.1)
7376
fuzzy_match (2.0.4)
7477
gh_inspector (1.1.3)
75-
httpclient (2.8.3)
76-
i18n (1.14.5)
78+
httpclient (2.9.0)
79+
mutex_m
80+
i18n (1.14.7)
7781
concurrent-ruby (~> 1.0)
78-
jazzy (0.15.1)
82+
jazzy (0.15.3)
7983
cocoapods (~> 1.5)
8084
mustache (~> 1.1)
8185
open4 (~> 1.3)
@@ -85,42 +89,42 @@ GEM
8589
sassc (~> 2.1)
8690
sqlite3 (~> 1.3)
8791
xcinvoke (~> 0.3.0)
88-
json (2.7.2)
92+
json (2.12.0)
8993
liferaft (0.0.6)
90-
mini_portile2 (2.8.7)
91-
minitest (5.24.1)
94+
logger (1.7.0)
95+
mini_portile2 (2.8.9)
96+
minitest (5.25.5)
9297
molinillo (0.8.0)
9398
mustache (1.1.1)
94-
mutex_m (0.2.0)
95-
nanaimo (0.3.0)
99+
mutex_m (0.3.0)
100+
nanaimo (0.4.0)
96101
nap (1.1.0)
97102
netrc (0.11.0)
98103
nkf (0.2.0)
99104
open4 (1.3.4)
100105
public_suffix (4.0.7)
101-
redcarpet (3.6.0)
102-
rexml (3.2.9)
103-
strscan
104-
rouge (4.3.0)
106+
redcarpet (3.6.1)
107+
rexml (3.4.1)
108+
rouge (4.5.2)
105109
ruby-macho (2.5.1)
106110
sassc (2.4.0)
107111
ffi (~> 1.9)
112+
securerandom (0.4.1)
108113
sqlite3 (1.7.3)
109114
mini_portile2 (~> 2.8.0)
110-
strscan (3.1.0)
111115
typhoeus (1.4.1)
112116
ethon (>= 0.9.0)
113117
tzinfo (2.0.6)
114118
concurrent-ruby (~> 1.0)
115119
xcinvoke (0.3.0)
116120
liferaft (~> 0.0.6)
117-
xcodeproj (1.24.0)
121+
xcodeproj (1.27.0)
118122
CFPropertyList (>= 2.3.3, < 4.0)
119123
atomos (~> 0.1.3)
120124
claide (>= 1.0.2, < 2.0)
121125
colored2 (~> 3.1)
122-
nanaimo (~> 0.3.0)
123-
rexml (~> 3.2.4)
126+
nanaimo (~> 0.4.0)
127+
rexml (>= 3.3.6, < 4.0)
124128

125129
PLATFORMS
126130
ruby

Source/fetch_dependencies.command

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ set -e
1313

1414
# objectbox-swift release version on GitHub:
1515
# https://github.com/objectbox/objectbox-swift/releases/download/v${version}
16-
version=4.2.0
16+
version=4.3.0
1717

1818
# C library version attached to the GitHub release:
1919
# ObjectBoxCore-static-${c_version}.zip
20-
c_version=4.2.0
20+
c_version=4.3.0
2121

2222
# Params supported by apple-build-static-libs.sh
2323
if [ -n "$OBX_SKIP_STATIC_C_TESTS" ]; then

Source/ios-framework/CodeGenTests/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ Adding a test case requires the following steps:
2525
1. Open `ToolTestProject.xcodeproj` in Xcode.
2626
2. Duplicate one of the `ToolTestProjectN` command line tool targets and increase to next highest number `N`.
2727
3. In `RunToolTests.sh` at the bottom add a command to run the test (replace `<N>` with the chosen number):
28+
2829
```bash
2930
# If the code generator should succeed
3031
test_target_num "Test Name" <N> || ((FAIL++))
3132
# If the code generator should fail
3233
fail_codegen_target_num "Test Name" <N> || ((FAIL++))
3334
```
35+
3436
4. Add a `ToolTestProjectN.swift` source file (replace `N` again) to the command line tool target. It should look like:
37+
3538
```swift
3639
import ObjectBox
3740

@@ -47,7 +50,16 @@ Adding a test case requires the following steps:
4750
5. If the code generator should succeed, add the generated `EntityInfo.generatedN.swift` to the `ToolTestProjectN`
4851
command line tool target as well (so it's verified it compiles).
4952

50-
The `RunToolTests.sh` script will run the code generator and pass the "Test Name" as the first parameter. It will also check the code generator output against a file named `Entity.generatedN.swift`, the model file against a `modelN.json` and such.
53+
The `RunToolTests.sh` script will run the code generator and pass the "Test Name" as the first parameter. It will also
54+
check the code generator output against files in the `expected` folder:
55+
56+
- (only if expected to fail) that generator output messages contain messages in a file named like `messages/messagesN.log`,
57+
- the model file against a file named like `model/modelN.json`,
58+
- the generated code against a file named like `entity-info/Entity.generatedN.swift`,
59+
- a dump of the generator schema against a file named like `schema-dump/schemaDumpN.txt`
60+
61+
Note: by default a test will copy the expected model file before running the generator (to avoid UIDs from changing).
62+
To start with a different model file, add a file like `model/modelN.before.json`.
5163

5264
### Command line tool target settings
5365
For reference, all of the command line targets have these settings:

Source/ios-framework/CodeGenTests/RunToolTests.sh

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
22

3-
# Run this script from Xcode (target & scheme "CodeGenTests"):
4-
# it has a dependency and also relies on variables set by Xcode
3+
# This script is run from Xcode (target & scheme "CodeGenTests"):
4+
# it has a dependency and also relies on variables set by Xcode.
5+
# See README for details.
56

67
echo -n "note: Starting tests at $(date)"
78

@@ -19,8 +20,8 @@ if [ -z ${PROJECT_DIR} ]; then
1920
fi
2021

2122
MYDIR="${PROJECT_DIR}/CodeGenTests" # Xcode copies our script into DerivedData before running it, so hard-code our path.
22-
23-
SOURCERY_APP="${PROJECT_DIR}/../external/objectbox-swift-generator/bin/Sourcery.app"
23+
PARENT_DIR="$(dirname "$PROJECT_DIR")"
24+
SOURCERY_APP="${PARENT_DIR}/external/objectbox-swift-generator/bin/Sourcery.app"
2425
SOURCERY="${SOURCERY_APP}/Contents/MacOS/Sourcery"
2526

2627
EXPECTED_DIR="${MYDIR}/expected"
@@ -173,11 +174,10 @@ fail_codegen_target_num () {
173174
echo "note: ******************** $2: $1 ********************"
174175

175176
MODEL_FILE_EXPECTED="${EXPECTED_DIR}/model/model${2}.json"
176-
ORIGINALMESSAGESFILE="${EXPECTED_DIR}/messages/messages${2}.log"
177177
MODEL_FILE_BEFORE="${EXPECTED_DIR}/model/model${2}.before.json"
178178
MODEL_FILE_ACTUAL="${BUILT_PRODUCTS_DIR}/model${2}.json"
179-
TESTMESSAGESFILE="${BUILT_PRODUCTS_DIR}/messages${2}.log"
180-
DUMP_FILE_EXPECTED="${EXPECTED_DIR}/schema-dump/schemaDump${2}.txt"
179+
EXPECTED_MESSAGES_FILE="${EXPECTED_DIR}/messages/messages${2}.log"
180+
GENERATOR_LOG_FILE="${BUILT_PRODUCTS_DIR}/generator${2}.log"
181181
DUMP_FILE_ACTUAL="${MYOUTPUTDIR}/schemaDump${2}.txt"
182182
ENTITY_INFO_FILE_ACTUAL="${MYOUTPUTDIR}/EntityInfo.generated${2}.swift"
183183
ORIGINALXCODELOGFILE="${MYDIR}/xcode${2}.log"
@@ -196,21 +196,23 @@ fail_codegen_target_num () {
196196
# Setting --debug-parsetree for the generator also makes it generate non-random UIDs,
197197
# see objectbox-swift-generator/Sourcery/main.swift runCLI().
198198
echo "$SOURCERY --xcode-project \"$TESTPROJECT\" --xcode-target \"ToolTestProject${2}\" --model-json \"$MODEL_FILE_ACTUAL\" --debug-parsetree \"$DUMP_FILE_ACTUAL\" --output \"${ENTITY_INFO_FILE_ACTUAL}\" --disableCache"
199-
$SOURCERY --xcode-project "$TESTPROJECT" --xcode-target "ToolTestProject${2}" --model-json "$MODEL_FILE_ACTUAL" --debug-parsetree "$DUMP_FILE_ACTUAL" --output "${ENTITY_INFO_FILE_ACTUAL}" --disableCache > "$TESTMESSAGESFILE" 2>&1
200-
201-
if [ -e "$ORIGINALMESSAGESFILE" ]; then
202-
cmp --silent "$TESTMESSAGESFILE" "$ORIGINALMESSAGESFILE"
203-
if [ $? -eq 0 ]; then
204-
echo "note: $2: $1: Output as expected."
199+
$SOURCERY --xcode-project "$TESTPROJECT" --xcode-target "ToolTestProject${2}" --model-json "$MODEL_FILE_ACTUAL" --debug-parsetree "$DUMP_FILE_ACTUAL" --output "${ENTITY_INFO_FILE_ACTUAL}" --disableCache > "$GENERATOR_LOG_FILE" 2>&1
200+
201+
if [ -e "$EXPECTED_MESSAGES_FILE" ]; then
202+
# Check if the generator output contains the expected messages.
203+
# Note: as grep can not handle new lines, remove them before searching.
204+
EXPECTED_MESSAGES=$(tr -d '\n' < "$EXPECTED_MESSAGES_FILE")
205+
FULL_OUTPUT=$(tr -d '\n' < "$GENERATOR_LOG_FILE")
206+
# Use grep --fixed-strings to avoid interpreting the expected string as a regex.
207+
# Use --quiet to only return an exit code (0 if there is a match, 1 or greater otherwise).
208+
if echo "$FULL_OUTPUT" | grep --quiet --fixed-strings "$EXPECTED_MESSAGES"; then
209+
echo "note: $2: $1: Generator logs contain the expected messages."
205210
else
206-
echo "error: $2: $1: Output DIFFERENT!"
207-
208-
echo "====="
209-
echo "opendiff \"$TESTMESSAGESFILE\" \"$ORIGINALMESSAGESFILE\" -merge \"$ORIGINALMESSAGESFILE\""
210-
# echo "===== $TESTMESSAGESFILE ====="
211-
# cat "$TESTMESSAGESFILE"
212-
# echo "===== $ORIGINALMESSAGESFILE ====="
213-
# cat "$ORIGINALMESSAGESFILE"
211+
echo "error: $2: $1: Generator logs do NOT contain the expected messages!"
212+
echo "===== Generator logs $GENERATOR_LOG_FILE ====="
213+
cat "$GENERATOR_LOG_FILE"
214+
echo "===== Expected to contain $EXPECTED_MESSAGES_FILE ====="
215+
cat "$EXPECTED_MESSAGES_FILE"
214216
echo "====="
215217
FAIL=1
216218
fi
@@ -270,7 +272,7 @@ fail_codegen_target_num () {
270272
rm -f "$MODEL_FILE_ACTUAL"
271273
rm -f "$ENTITY_INFO_FILE_ACTUAL"
272274
rm -f "$DUMP_FILE_ACTUAL"
273-
rm -f "$TESTMESSAGESFILE"
275+
rm -f "$GENERATOR_LOG_FILE"
274276
rm -f "$TESTXCODELOGFILE"
275277

276278
echo "note: $2: $1: Cleaning up."
@@ -339,7 +341,7 @@ test_target_num "Untyped IDs and queries 1" 49 || ((FAIL++))
339341
test_target_num "Untyped IDs and queries 2" 50 || ((FAIL++))
340342
#fail_codegen_target_num "Typed IDs still enforce type?" 51 || ((FAIL++))
341343

342-
fail_codegen_target_num "Ensure we don't write JSON before ID errors" 52 || ((FAIL++))
344+
fail_codegen_target_num "Model JSON is not written on ID errors" 52 || ((FAIL++))
343345
test_target_num "ToOne Backlink ensure applyToDb is needed" 53 || ((FAIL++))
344346
test_target_num "ToMany ensure applyToDb is needed" 54 || ((FAIL++))
345347
test_target_num "ToMany Backlink ensure applyToDb is needed" 55 || ((FAIL++))
@@ -348,6 +350,7 @@ test_target_num "Optional Template Syntax recognized as optional" 57 || ((FAIL++
348350

349351
fail_codegen_target_num "HNSW index not on float array" 58 || ((FAIL++))
350352
test_target_num "HNSW index" 59 || ((FAIL++))
353+
test_target_num "ExternalType and ExternalName annotations" 60 || ((FAIL++))
351354

352355
echo "note: Finished tests with $FAIL failures"
353356

0 commit comments

Comments
 (0)