Skip to content

Commit 607cb54

Browse files
committed
1.6.0 (using lib 0.15.2)
1 parent e291c34 commit 607cb54

18 files changed

+961
-467
lines changed

Source/Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ GEM
7979
nap (1.1.0)
8080
netrc (0.11.0)
8181
open4 (1.3.4)
82-
redcarpet (3.5.1)
82+
redcarpet (3.5.0)
8383
rouge (3.22.0)
8484
ruby-macho (1.4.0)
8585
sassc (2.4.0)

Source/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Repository Contents
1616

1717
- `fetch_dependencies.command`: populates `external/objectbox-static` with libObjectBoxCore.
1818
libObjectBoxCore is a crucial requirement build the Swift framework.
19+
- `ios-framework/Makefile`: combines `fetch_dependencies.command` and a Carthage build to create the Swift framework.
20+
- `.gitlab-ci.yml` calls make targets of `ios-framework/Makefile`
1921
- `create-xcframework.sh`: builds the multi-platform archive containing binaries for multiple platforms and architectures.
2022

2123
Tests
@@ -43,7 +45,7 @@ Setup
4345
To build the project for release:
4446

4547
* Run `cd ios-framework/; make all` to build the frameworks from source with Carthage
46-
* The `ios-framework/cocoapod/make-release.command` script can be double-clicked to build a release-ready archive and Podspec file.
48+
* The `ios-framework/cocoapod/make-release.command` script can be double-clicked to build a release-ready archive and Podspec & SPM files.
4749

4850
### Generate the Documentation
4951

Source/create-xcframework.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ mkdir -p "$dir_build"
1010
derived_data_path=$( mktemp -d )
1111
mkdir -p $derived_data_path
1212

13+
xcodebuild -version
14+
1315
function build() {
1416
echo "************* Building archive for $1 $2 (${3:-$1}) *************"
1517
xcrun xcodebuild build \

Source/fetch_dependencies.command

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ else
1515
verify_only=false
1616
fi
1717

18+
if [ "${1:-}" == "--staging" ]; then
19+
staging_repo=true
20+
shift
21+
else
22+
staging_repo=false
23+
fi
24+
1825
# macOS does not have realpath and readlink does not have -f option, so do this instead:
1926
my_dir=$( cd "$(dirname "$0")" ; pwd -P )
2027

@@ -26,14 +33,17 @@ if [ "$verify_only" = true ]; then
2633
echo "Skipping fetch, only verifying"
2734
else
2835

29-
if [ -d "$code_dir" ]; then # Do we have an existing code repo?
36+
if [ -d "$code_dir" ] && [ "$staging_repo" != "true" ]; then # Do we have an existing code repo? Then build it...
37+
xcode_version="$(xcodebuild -version | head -n 1 | tr -cd '[a-zA-Z0-9]._-')"
38+
echo "Xcode version: $xcode_version"
39+
3040
pushd "$code_dir" # note: this also "fixed" building into cbuild dir in "our" objectbox-swift dir
31-
build_params="" # must also part of the cache key
41+
build_params="--skip-apple-silicon" # must also part of the cache key
3242
commit_id=$(git rev-parse HEAD)
3343
cache_dir="$HOME/Library/Caches/ObjectBox"
3444
mkdir -p "${cache_dir}"
3545
find "${cache_dir}" -name "objectbox-static-*.zip" -type f -mtime +30 # -delete # TODO enable delete once this looks good
36-
cache_key="${commit_id}"
46+
cache_key="${commit_id}-$xcode_version"
3747
if [ -n "$build_params" ]; then
3848
cache_key="${cache_key}-$(echo "$build_params" | tr -cd '[a-zA-Z0-9]._-')"
3949
fi
@@ -56,7 +66,7 @@ if [ -d "$code_dir" ]; then # Do we have an existing code repo?
5666
echo "⚪ ObjectBox core is clean but no cache ZIP found for ${cache_key}."
5767
echo "🏗️ Building..."
5868
sleep 0.5
59-
fi
69+
fi
6070
else
6171
git status
6272
echo "🔴 ObjectBox core is not clean, won't use caching. 🏗️ Building..."
@@ -78,10 +88,15 @@ if [ -d "$code_dir" ]; then # Do we have an existing code repo?
7888
popd
7989
else # Download static public release and unzip into $dest
8090
if [ ! -d "${dest_dir}" ] || [ ! -e "${dest_dir}/libObjectBoxCore-iOS.a" ]; then
81-
version=1.5.0
82-
c_version=0.13.0
91+
version=1.7.0
92+
c_version=0.15.2
8393
archive_path="${my_dir}/external/objectbox-static.zip"
84-
OBXLIB_URL_apple_static="https://github.com/objectbox/objectbox-swift/releases/download/v${version}/ObjectBoxCore-static-${c_version}.zip"
94+
if [ "$staging_repo" == "true" ]; then
95+
release_url_path="https://github.com/objectbox/objectbox-swift-spec-staging/releases/download/v1.x"
96+
else
97+
release_url_path="https://github.com/objectbox/objectbox-swift/releases/download/v${version}"
98+
fi
99+
OBXLIB_URL_apple_static="release_url_path/ObjectBoxCore-static-${c_version}.zip"
85100

86101
mkdir -p "${dest_dir}"
87102

Source/ios-framework/CodeGenTests/RunToolTests.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# Run this script from Xcode (target & scheme "CodeGenTests"):
44
# it has a dependency and also relies on variables set by Xcode
55

6-
echo -n "note: Starting tests at "
7-
date
6+
echo -n "note: Starting tests at $(date)"
87

98
if [ -z ${PROJECT_DIR} ]; then
109
echo "PROJECT_DIR unavailable; please run from Xcode"

Source/ios-framework/CodeGenTests/expected/entity-info/EntityInfo.generated3.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ extension BusRoute: ObjectBox.EntityInspectable {
2828
fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws {
2929
let entityBuilder = try modelBuilder.entityBuilder(for: BusRoute.self, id: 1, uid: 5107964062888457216)
3030
try entityBuilder.flags([.syncEnabled, .sharedGlobalIds])
31-
try entityBuilder.addProperty(name: "id", type: EntityId<BusRoute>.entityPropertyType, flags: [.id], id: 1, uid: 7895576389419683840)
31+
try entityBuilder.addProperty(name: "id", type: PropertyType.long, flags: [.id], id: 1, uid: 7895576389419683840)
3232

3333
try entityBuilder.lastProperty(id: 2, uid: 6687926154759915520)
3434
}

Source/ios-framework/CommonSource/Errors.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ public enum ObjectBoxError: Swift.Error {
7272
case filePagesCorrupt(message: String)
7373
/// Attempted to establish a relation to an entity that hasn't been assigned an ID yet.
7474
case cannotRelateToUnsavedEntities(message: String)
75+
76+
/// Typically when there's no open store available at the given directory
77+
case cannotAttachToStore(message: String)
78+
7579
/// Unexpected error, should never occur in practice, but for pragmatic reasons, we cover the case.
7680
/// Used in some cases where ObjectBox e.g. calls a function (which can only say throws and not what it throws)
7781
/// If you encounter this error in your use of ObjectBox, please report it to us, as it's likely a bug in the

Source/ios-framework/CommonSource/Internal/Transaction.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ class Transaction {
2828
init(store: Store, writable: Bool) throws {
2929
isWritable = writable
3030
if isWritable {
31-
cTransaction = obx_txn_write(store.cStore)
31+
cTransaction = obx_txn_write(try store.ensureCStore())
3232
} else {
33-
cTransaction = obx_txn_read(store.cStore)
33+
cTransaction = obx_txn_read(try store.ensureCStore())
3434
}
3535
try checkLastError()
3636
}

0 commit comments

Comments
 (0)