You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This contains the ObjectBoxCore static libraries and the [ObjectBox Swift code generator](https://github.com/objectbox/objectbox-swift-generator).
12
13
13
14
**Scripts** and how they depend on each other (subject to future simplifications):
14
15
15
-
-`ios-framework/Makefile`: combines `fetch_dependencies.command` and a Carthage build to create the Swift framework.
16
16
-`fetch_dependencies.command`: populates `external/objectbox-static` with libObjectBoxCore.
17
17
libObjectBoxCore is a crucial requirement build the Swift framework.
18
+
-`ios-framework/Makefile`: combines `fetch_dependencies.command` and a Carthage build to create the Swift framework.
18
19
-`create-xcframework.sh`: builds the multi-platform archive containing binaries for multiple platforms and architectures.
19
20
20
21
### Tests
21
22
22
23
ObjectBox comes with a couple of tests of different categories:
23
24
24
25
* Unit tests: `ios-framework/CommonTests`, based on XCTestCase
25
-
* Integration tests "CodeGen": `ios-framework/CodeGenTests` run via script (for now only via Xcode/xcodebuild);
26
-
uses a separate Xcode project and an ObjectBox generator executable to generate actual binding classes.
27
-
[README](ios-framework/CodeGenTests/README.md)
28
-
* Integration tests "IntegrationTests": `ios-framework/IntegrationTests`, currently not maintained, run via script;
29
-
somewhat similar to CodeGen; subject to a general clean up; see also its [README](ios-framework/IntegrationTests/Readme.md)
26
+
* Integration tests (see [README](ios-framework/CodeGenTests/README.md)): `ios-framework/CodeGenTests` are run by building the CodenGenTests target with Xcode/xcodebuild (which runs a script that must be launched by Xcode/xcodebuild);
27
+
uses a separate Xcode project and an ObjectBox generator executable to generate actual binding classes and assert the generator and database operations.
28
+
* (Outdated) Integration tests "IntegrationTests": `ios-framework/IntegrationTests`, currently not maintained, run via script;
29
+
somewhat similar to CodeGen; subject to a general clean up; see [README](ios-framework/IntegrationTests/Readme.md)
30
30
* External integration test project: https://github.com/objectbox/objectbox-swift-integration-test
31
31
runs "real projects" with "full ObjectBox round-trip" on internal CI and CircleCI
32
32
33
+
### Xcode Project Organization
34
+
35
+
You look at and build the framework itself via `ios-framework/ObjectBox.xcodeproj`.
36
+
37
+
*`ObjectBox.xcproject` targets
38
+
*`ObjectBox-macOS`, `ObjectBox-iOS` and `ObjectBox-iOS Simulator` build the `ObjectBox.framework` for each platform
39
+
*`ObjectBoxTests-macOS`, `ObjectBoxTests-iOS` and `ObjectBoxTests-iOS Simulator` build unit tests for each platforms framework
40
+
*`iOS-Fat-Framework` builds a universal binary of the iOS framework needed for distribution, with code both for device and simulator
41
+
*`CodeGenTests` runs a script that runs generator and integration tests, see notes for tests above
42
+
*`ObjectBox.xcproject` main groups and directories
43
+
*`CommonSource` contains all code to be shared by the framework of the macOS and iOS platforms.
44
+
* `ObjectBox.h` is the framework umbrella header where all public C and ObjC header files are listed. These are either intended for use by app developers, or required to be visible for the Swift extensions.
45
+
* `objectbox-c.h` and `objectbox-c-sync.h` are modified copies of the C API's header files created by the `fetch_dependencies.command` script so they can be imported into Swift and do not collide with `ObjectBox.h` on case-insensitive file systems.
46
+
* The directory itself contains general purpose types like `Store` and `Box`. The important sub-groups are `Entities`, `Relation`, and `Query`.
47
+
*`CommonTests` contains all code to be shared by tests for the macOS and iOS platforms, see notes on tests above
48
+
*`ObjectBox-macOS`, `ObjectBox-iOS` and `ObjectBox-iOS Simulator` contain platform-specific files, including the framework's Info.plist
49
+
33
50
## Development
34
51
35
52
* Ensure the latest Xcode is installed (Swift 5.3+, command line tools should be included).
@@ -39,7 +56,7 @@ ObjectBox comes with a couple of tests of different categories:
39
56
* Runs `brew bundle` to install or update basic build tools including [Carthage](https://github.com/Carthage/Carthage) (see [Brewfile](Brewfile)).
40
57
* Runs `bundle install` to install or update cocoapods and jazzy (see [Gemfile](Gemfile)).
41
58
42
-
Open the Xcode project in `ios-framework/ObjectBox.xcodeproj`. See section below on how it is organized.
59
+
Open the Xcode project in `ios-framework/ObjectBox.xcodeproj`.
43
60
44
61
From the command line:
45
62
@@ -59,6 +76,20 @@ make unit_tests
59
76
make integration_tests
60
77
```
61
78
79
+
**To execute a specific test** change the last argument to specify your test. You can also execute a group/class by removing the last one/two parts of the filter.
80
+
Note: `xcpretty` cleans up the output so you won't see all the compiler calls but it also hides failed tests output. So once you see a failure, run without `xcpretty` to read the error.
**To run tests with an in-memory database** set the following environment variable before running an xcodebuild command:
87
+
```
88
+
export OBX_IN_MEMORY=true
89
+
make u_tests
90
+
```
91
+
In Xcode, set this by editing the scheme: under Test look for Arguments.
92
+
62
93
### Generate the Documentation
63
94
64
95
Inside `ios-framework/` jazzy is configured inside [Makefile](ios-framework/Makefile):
@@ -72,30 +103,36 @@ Jazzy uses the [README.md](ios-framework/README.md) as a front page.
72
103
73
104
The result is stored inside `ios-framework/docs/swift_output/`.
74
105
75
-
### Xcode Project Organization
106
+
### Ruby version
76
107
77
-
You look at and build the framework itself via `ios-framework/ObjectBox.xcodeproj`.
108
+
The Ruby version on macOS is outdated, e.g. Cocoapods may have a problem.
109
+
Use [rbenv](https://github.com/rbenv/rbenv) to install the required version:
78
110
79
-
*`ObjectBox.xcproject` targets
80
-
*`ObjectBox-macOS` builds the `ObjectBox.framework` for the macOS platform
81
-
*`ObjectBoxTests-macOS` builds the unit tests for the macOS framework
82
-
*`ObjectBox-iOS` builds the `ObjectBox.framework` for the iOS platform
83
-
*`ObjectBoxTests-iOS` builds the unit tests for the iOS framework
84
-
*`iOS-Fat-Framework` builds a universal binary of the iOS framework needed for distribution, with code both for device and simulator
85
-
*`CodeGenTests` Runs a shell script that performs integration tests for various features. This will run the Sourcery code generator over files and then compile the result against the framework.
86
-
*`ObjectBox.xcproject` main groups and directories
87
-
*`CommonSource` contains all code to be shared by the framework of the macOS and iOS platforms.
88
-
* `ObjectBox.h` is the framework umbrella header where all public C and ObjC header files are listed. These are either intended for use by app developers, or required to be visible for the Swift extensions.
89
-
* `ObjectBoxC.h` is a modified version of the C API's `objectbox.h` header generated by the `generate_ObjectBoxC_header.rb` script so it can be imported into Swift and doesn't have a name collision with `ObjectBox.h` on case-insensitive file systems.
90
-
* The directory itself contains general purpose types like `Store` and `Box`. The important sub-groups are `Entities`, `Relation`, and `Query`.
91
-
*`CommonTests` contains all code to be shared by tests for the macOS and iOS platforms
92
-
*`ObjectBox-macOS` contains macOS-specific files, including the framework's Info.plist
93
-
*`ObjectBox-iOS` contains iOS-specific files, including the framework's Info.plist
111
+
# Print current version
112
+
ruby -v
113
+
# Install rbenv and build plugin to install ruby versions
114
+
brew update && brew install rbenv ruby-build
115
+
# Print the version configured in .ruby-version
116
+
rbenv local
117
+
# Install that version, e.g.
118
+
rbenv install 3.0.5
119
+
# Ensure it is the expected version
120
+
ruby -v
121
+
122
+
To change the required ruby version, see https://www.ruby-lang.org/en/downloads/releases/ and set
123
+
it with e.g. `rbenv local 3.0.5`. This will update the `.ruby-version` file. Then install
124
+
it with rbenv like above.
125
+
126
+
### Updating gems: CocoaPods, Jazzy
127
+
128
+
If needed, change the allowed version in [Gemfile](Gemfile).
129
+
130
+
Run `bundle update` and commit the changed [lock file](Gemfile.lock).
0 commit comments