Skip to content

Commit 2c42e92

Browse files
committed
1.0rc10 source drop.
1 parent 4c3fe69 commit 2c42e92

File tree

194 files changed

+10385
-3235
lines changed

Some content is hidden

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

194 files changed

+10385
-3235
lines changed

Source/download_dependencies.command

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
#!/usr/bin/env bash
22

3-
# Script that is used by CI to download a recent build of the static libs, or by external users to download a build from
3+
# Script that is used by CI to build the static libs, or by external users to download a build from
44
# Github. Will do nothing if there already is a copy of the static libs in external.
55
#
6-
# Set the CI_API_TOKEN and OBXLIB_URL_apple_static environment variables to have it download from CI instead of Github.
7-
#
86
# Adjust the 'version' variable as needed to get the right version for the current code.
97
#
108

119
set -e
1210

13-
version=0.9.1
14-
core_version=0.6.1
11+
version=1.0
12+
core_version=0.7.0
1513

16-
my_dir=$(realpath `dirname "$0"`)
14+
my_dir=`dirname "$0"`
15+
my_dir=`realpath "${my_dir}"`
1716

1817
cd $my_dir
19-
dest_dir="${my_dir}/external/objectbox-static/"
18+
code_dir="${my_dir}/external/objectbox/"
19+
dest_dir="../../../objectbox-static/"
2020
archive_path="${my_dir}/external/objectbox-static.zip"
21+
OBXLIB_URL_apple_static="https://github.com/objectbox/objectbox-swift/releases/download/v${version}/ObjectBoxCore-static-${core_version}.zip"
2122

22-
#if [ "${OBXLIB_URL_apple_static}" == "" ]; then
23-
OBXLIB_URL_apple_static="https://github.com/objectbox/objectbox-swift/releases/download/v${version}/ObjectBoxCore-static-${core_version}.zip"
24-
CI_API_TOKEN=""
25-
extra_header=""
26-
#else
27-
# extra_header="-H 'PRIVATE-TOKEN: ${CI_API_TOKEN}'"
28-
#fi
23+
if [ -d "$code_dir" ]; then
24+
echo "Have repository, building."
25+
"$code_dir/xcode/build_objectbox_core.command" "$dest_dir" release
26+
exit
27+
fi
2928

3029
if [ ! -d "${dest_dir}" ] || [ ! -e "${dest_dir}/libObjectBoxCore-iOS.a" ]; then
3130
mkdir -p "${dest_dir}"
3231

33-
curl -L ${extra_header} --fail "${OBXLIB_URL_apple_static}" --output "${archive_path}"
32+
curl -L --fail "${OBXLIB_URL_apple_static}" --output "${archive_path}"
3433

3534
cd "${dest_dir}"
3635
unzip "${archive_path}"

Source/ios-framework/CodeGenTests/EntityInfo.generated1.swift

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ extension BusRoute: ObjectBox.Entity {}
1111
extension BusRoute: ObjectBox.__EntityRelatable {
1212
internal typealias EntityType = BusRoute
1313

14-
internal var _id: Id<BusRoute> {
15-
return self.id
14+
internal var _id: EntityId<BusRoute> {
15+
return EntityId<BusRoute>(self.id.value)
1616
}
1717
}
1818

@@ -24,9 +24,9 @@ extension BusRoute: ObjectBox.EntityInspectable {
2424

2525
internal static var entityBinding = EntityBindingType()
2626

27-
fileprivate static func buildEntity(modelBuilder: ModelBuilder) throws {
27+
fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws {
2828
let entityBuilder = try modelBuilder.entityBuilder(for: BusRoute.self, id: 1, uid: 5107964062888457216)
29-
try entityBuilder.addProperty(name: "id", type: Id<BusRoute>.entityPropertyType, flags: [.id], id: 1, uid: 7895576389419683840)
29+
try entityBuilder.addProperty(name: "id", type: EntityId<BusRoute>.entityPropertyType, flags: [.id], id: 1, uid: 7895576389419683840)
3030
try entityBuilder.addProperty(name: "lineName", type: String.entityPropertyType, id: 2, uid: 6687926154759915520)
3131

3232
try entityBuilder.lastProperty(id: 2, uid: 6687926154759915520)
@@ -39,16 +39,16 @@ extension BusRoute {
3939
/// You may want to use this in queries to specify fetch conditions, for example:
4040
///
4141
/// box.query { BusRoute.id == myId }
42-
internal static var id: Property<BusRoute, Id<BusRoute>> { return Property<BusRoute, Id<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
42+
internal static var id: Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>> { return Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
4343
/// Generated entity property information.
4444
///
4545
/// You may want to use this in queries to specify fetch conditions, for example:
4646
///
4747
/// box.query { BusRoute.lineName.startsWith("X") }
48-
internal static var lineName: Property<BusRoute, String> { return Property<BusRoute, String>(propertyId: 2, isPrimaryKey: false) }
48+
internal static var lineName: Property<BusRoute, String, Void> { return Property<BusRoute, String, Void>(propertyId: 2, isPrimaryKey: false) }
4949

50-
fileprivate func __setId(identifier: ObjectBox.EntityId) {
51-
self.id = Id(identifier)
50+
fileprivate func __setId(identifier: ObjectBox.Id) {
51+
self.id = EntityId(identifier)
5252
}
5353
}
5454

@@ -59,36 +59,36 @@ extension ObjectBox.Property where E == BusRoute {
5959
///
6060
/// box.query { .id == myId }
6161

62-
static var id: Property<BusRoute, Id<BusRoute>> { return Property<BusRoute, Id<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
62+
internal static var id: Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>> { return Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
6363

6464
/// Generated entity property information.
6565
///
6666
/// You may want to use this in queries to specify fetch conditions, for example:
6767
///
6868
/// box.query { .lineName.startsWith("X") }
6969

70-
static var lineName: Property<BusRoute, String> { return Property<BusRoute, String>(propertyId: 2, isPrimaryKey: false) }
71-
70+
internal static var lineName: Property<BusRoute, String, Void> { return Property<BusRoute, String, Void>(propertyId: 2, isPrimaryKey: false) }
7271

7372
}
7473

7574

7675
/// Generated service type to handle persisting and reading entity data. Exposed through `BusRoute.EntityBindingType`.
7776
internal class BusRouteBinding: NSObject, ObjectBox.EntityBinding {
7877
internal typealias EntityType = BusRoute
78+
internal typealias IdType = EntityId<BusRoute>
7979

8080
override internal required init() {}
8181

82-
internal func setEntityId(of entity: EntityType, to entityId: ObjectBox.EntityId) {
82+
internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) {
8383
entity.__setId(identifier: entityId)
8484
}
8585

86-
internal func entityId(of entity: EntityType) -> ObjectBox.EntityId {
86+
internal func entityId(of entity: EntityType) -> ObjectBox.Id {
8787
return entity.id.value
8888
}
8989

90-
internal func collect(fromEntity entity: EntityType, id: EntityId, propertyCollector: PropertyCollector, store: Store) {
91-
90+
internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id,
91+
propertyCollector: ObjectBox.PropertyCollector, store: ObjectBox.Store) {
9292
var offsets: [(offset: OBXDataOffset, index: UInt16)] = []
9393
offsets.append((propertyCollector.prepare(string: entity.lineName, at: 2 + 2 * 2), 2 + 2 * 2))
9494

@@ -100,14 +100,12 @@ internal class BusRouteBinding: NSObject, ObjectBox.EntityBinding {
100100
}
101101
}
102102

103-
internal func createEntity(entityReader: EntityReader, store: Store) -> EntityType {
103+
internal func createEntity(entityReader: ObjectBox.EntityReader, store: ObjectBox.Store) -> EntityType {
104104
let entity = BusRoute()
105105

106106
entity.id = entityReader.read(at: 2 + 2 * 1)
107107
entity.lineName = entityReader.read(at: 2 + 2 * 2)
108108

109-
110-
111109
return entity
112110
}
113111
}
@@ -122,7 +120,7 @@ fileprivate func optConstruct<T: RawRepresentable>(_ type: T.Type, rawValue: T.R
122120
// MARK: - Store setup
123121

124122
fileprivate func cModel() throws -> OpaquePointer {
125-
let modelBuilder = try ModelBuilder()
123+
let modelBuilder = try ObjectBox.ModelBuilder()
126124
try BusRoute.buildEntity(modelBuilder: modelBuilder)
127125
modelBuilder.lastEntity(id: 1, uid: 5107964062888457216)
128126
return modelBuilder.finish()

Source/ios-framework/CodeGenTests/EntityInfo.generated12.swift

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import ObjectBox
1010
extension BusRoute: ObjectBox.__EntityRelatable {
1111
internal typealias EntityType = BusRoute
1212

13-
internal var _id: Id<BusRoute> {
14-
return self.id
13+
internal var _id: EntityId<BusRoute> {
14+
return EntityId<BusRoute>(self.id.value)
1515
}
1616
}
1717

@@ -23,9 +23,9 @@ extension BusRoute: ObjectBox.EntityInspectable {
2323

2424
internal static var entityBinding = EntityBindingType()
2525

26-
fileprivate static func buildEntity(modelBuilder: ModelBuilder) throws {
26+
fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws {
2727
let entityBuilder = try modelBuilder.entityBuilder(for: BusRoute.self, id: 1, uid: 5107964062888457216)
28-
try entityBuilder.addProperty(name: "id", type: Id<BusRoute>.entityPropertyType, flags: [.id], id: 1, uid: 7895576389419683840)
28+
try entityBuilder.addProperty(name: "id", type: EntityId<BusRoute>.entityPropertyType, flags: [.id], id: 1, uid: 7895576389419683840)
2929

3030
try entityBuilder.lastProperty(id: 2, uid: 6687926154759915520)
3131
}
@@ -37,10 +37,10 @@ extension BusRoute {
3737
/// You may want to use this in queries to specify fetch conditions, for example:
3838
///
3939
/// box.query { BusRoute.id == myId }
40-
internal static var id: Property<BusRoute, Id<BusRoute>> { return Property<BusRoute, Id<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
40+
internal static var id: Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>> { return Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
4141

42-
fileprivate func __setId(identifier: ObjectBox.EntityId) {
43-
self.id = Id(identifier)
42+
fileprivate func __setId(identifier: ObjectBox.Id) {
43+
self.id = EntityId(identifier)
4444
}
4545
}
4646

@@ -51,41 +51,39 @@ extension ObjectBox.Property where E == BusRoute {
5151
///
5252
/// box.query { .id == myId }
5353

54-
static var id: Property<BusRoute, Id<BusRoute>> { return Property<BusRoute, Id<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
55-
54+
internal static var id: Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>> { return Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
5655

5756
}
5857

5958

6059
/// Generated service type to handle persisting and reading entity data. Exposed through `BusRoute.EntityBindingType`.
6160
internal class BusRouteBinding: NSObject, ObjectBox.EntityBinding {
6261
internal typealias EntityType = BusRoute
62+
internal typealias IdType = EntityId<BusRoute>
6363

6464
override internal required init() {}
6565

66-
internal func setEntityId(of entity: EntityType, to entityId: ObjectBox.EntityId) {
66+
internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) {
6767
entity.__setId(identifier: entityId)
6868
}
6969

70-
internal func entityId(of entity: EntityType) -> ObjectBox.EntityId {
70+
internal func entityId(of entity: EntityType) -> ObjectBox.Id {
7171
return entity.id.value
7272
}
7373

74-
internal func collect(fromEntity entity: EntityType, id: EntityId, propertyCollector: PropertyCollector, store: Store) {
75-
74+
internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id,
75+
propertyCollector: ObjectBox.PropertyCollector, store: ObjectBox.Store) {
7676

7777
propertyCollector.collect(id, at: 2 + 2 * 1)
7878

7979

8080
}
8181

82-
internal func createEntity(entityReader: EntityReader, store: Store) -> EntityType {
82+
internal func createEntity(entityReader: ObjectBox.EntityReader, store: ObjectBox.Store) -> EntityType {
8383
let entity = BusRoute()
8484

8585
entity.id = entityReader.read(at: 2 + 2 * 1)
8686

87-
88-
8987
return entity
9088
}
9189
}
@@ -100,7 +98,7 @@ fileprivate func optConstruct<T: RawRepresentable>(_ type: T.Type, rawValue: T.R
10098
// MARK: - Store setup
10199

102100
fileprivate func cModel() throws -> OpaquePointer {
103-
let modelBuilder = try ModelBuilder()
101+
let modelBuilder = try ObjectBox.ModelBuilder()
104102
try BusRoute.buildEntity(modelBuilder: modelBuilder)
105103
modelBuilder.lastEntity(id: 1, uid: 5107964062888457216)
106104
return modelBuilder.finish()

Source/ios-framework/CodeGenTests/EntityInfo.generated13.swift

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import ObjectBox
1010
extension BusRoute: ObjectBox.__EntityRelatable {
1111
internal typealias EntityType = BusRoute
1212

13-
internal var _id: Id<BusRoute> {
14-
return self.id
13+
internal var _id: EntityId<BusRoute> {
14+
return EntityId<BusRoute>(self.id.value)
1515
}
1616
}
1717

@@ -23,9 +23,9 @@ extension BusRoute: ObjectBox.EntityInspectable {
2323

2424
internal static var entityBinding = EntityBindingType()
2525

26-
fileprivate static func buildEntity(modelBuilder: ModelBuilder) throws {
26+
fileprivate static func buildEntity(modelBuilder: ObjectBox.ModelBuilder) throws {
2727
let entityBuilder = try modelBuilder.entityBuilder(for: BusRoute.self, id: 1, uid: 5107964062888457216)
28-
try entityBuilder.addProperty(name: "id", type: Id<BusRoute>.entityPropertyType, flags: [.id], id: 1, uid: 7895576389419683840)
28+
try entityBuilder.addProperty(name: "id", type: EntityId<BusRoute>.entityPropertyType, flags: [.id], id: 1, uid: 7895576389419683840)
2929
try entityBuilder.addProperty(name: "newProperty", type: String.entityPropertyType, id: 3, uid: 14592)
3030

3131
try entityBuilder.lastProperty(id: 3, uid: 14592)
@@ -38,16 +38,16 @@ extension BusRoute {
3838
/// You may want to use this in queries to specify fetch conditions, for example:
3939
///
4040
/// box.query { BusRoute.id == myId }
41-
internal static var id: Property<BusRoute, Id<BusRoute>> { return Property<BusRoute, Id<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
41+
internal static var id: Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>> { return Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
4242
/// Generated entity property information.
4343
///
4444
/// You may want to use this in queries to specify fetch conditions, for example:
4545
///
4646
/// box.query { BusRoute.newProperty.startsWith("X") }
47-
internal static var newProperty: Property<BusRoute, String> { return Property<BusRoute, String>(propertyId: 3, isPrimaryKey: false) }
47+
internal static var newProperty: Property<BusRoute, String, Void> { return Property<BusRoute, String, Void>(propertyId: 3, isPrimaryKey: false) }
4848

49-
fileprivate func __setId(identifier: ObjectBox.EntityId) {
50-
self.id = Id(identifier)
49+
fileprivate func __setId(identifier: ObjectBox.Id) {
50+
self.id = EntityId(identifier)
5151
}
5252
}
5353

@@ -58,36 +58,36 @@ extension ObjectBox.Property where E == BusRoute {
5858
///
5959
/// box.query { .id == myId }
6060

61-
static var id: Property<BusRoute, Id<BusRoute>> { return Property<BusRoute, Id<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
61+
internal static var id: Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>> { return Property<BusRoute, EntityId<BusRoute>, EntityId<BusRoute>>(propertyId: 1, isPrimaryKey: true) }
6262

6363
/// Generated entity property information.
6464
///
6565
/// You may want to use this in queries to specify fetch conditions, for example:
6666
///
6767
/// box.query { .newProperty.startsWith("X") }
6868

69-
static var newProperty: Property<BusRoute, String> { return Property<BusRoute, String>(propertyId: 3, isPrimaryKey: false) }
70-
69+
internal static var newProperty: Property<BusRoute, String, Void> { return Property<BusRoute, String, Void>(propertyId: 3, isPrimaryKey: false) }
7170

7271
}
7372

7473

7574
/// Generated service type to handle persisting and reading entity data. Exposed through `BusRoute.EntityBindingType`.
7675
internal class BusRouteBinding: NSObject, ObjectBox.EntityBinding {
7776
internal typealias EntityType = BusRoute
77+
internal typealias IdType = EntityId<BusRoute>
7878

7979
override internal required init() {}
8080

81-
internal func setEntityId(of entity: EntityType, to entityId: ObjectBox.EntityId) {
81+
internal func setEntityIdUnlessStruct(of entity: EntityType, to entityId: ObjectBox.Id) {
8282
entity.__setId(identifier: entityId)
8383
}
8484

85-
internal func entityId(of entity: EntityType) -> ObjectBox.EntityId {
85+
internal func entityId(of entity: EntityType) -> ObjectBox.Id {
8686
return entity.id.value
8787
}
8888

89-
internal func collect(fromEntity entity: EntityType, id: EntityId, propertyCollector: PropertyCollector, store: Store) {
90-
89+
internal func collect(fromEntity entity: EntityType, id: ObjectBox.Id,
90+
propertyCollector: ObjectBox.PropertyCollector, store: ObjectBox.Store) {
9191
var offsets: [(offset: OBXDataOffset, index: UInt16)] = []
9292
offsets.append((propertyCollector.prepare(string: entity.newProperty, at: 2 + 2 * 3), 2 + 2 * 3))
9393

@@ -99,14 +99,12 @@ internal class BusRouteBinding: NSObject, ObjectBox.EntityBinding {
9999
}
100100
}
101101

102-
internal func createEntity(entityReader: EntityReader, store: Store) -> EntityType {
102+
internal func createEntity(entityReader: ObjectBox.EntityReader, store: ObjectBox.Store) -> EntityType {
103103
let entity = BusRoute()
104104

105105
entity.id = entityReader.read(at: 2 + 2 * 1)
106106
entity.newProperty = entityReader.read(at: 2 + 2 * 3)
107107

108-
109-
110108
return entity
111109
}
112110
}
@@ -121,7 +119,7 @@ fileprivate func optConstruct<T: RawRepresentable>(_ type: T.Type, rawValue: T.R
121119
// MARK: - Store setup
122120

123121
fileprivate func cModel() throws -> OpaquePointer {
124-
let modelBuilder = try ModelBuilder()
122+
let modelBuilder = try ObjectBox.ModelBuilder()
125123
try BusRoute.buildEntity(modelBuilder: modelBuilder)
126124
modelBuilder.lastEntity(id: 1, uid: 5107964062888457216)
127125
return modelBuilder.finish()

0 commit comments

Comments
 (0)