Skip to content

Commit ec23f50

Browse files
README: update and match with internal version
1 parent 42e664d commit ec23f50

File tree

1 file changed

+45
-40
lines changed

1 file changed

+45
-40
lines changed

Source/README.md

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
This folder contains the Swift sources for ObjectBox. This is the API you primarily touch when working with ObjectBox.
44

5-
These Swift classes internally use [ObjectBox's C API](https://github.com/objectbox/objectbox-c), implemented by the libObjectBoxCore library.
5+
These Swift classes internally use [ObjectBox's C API](https://github.com/objectbox/objectbox-c), implemented by the libObjectBoxCore library.
66

77
## Repository Contents
88

99
- `ios-framework/`: The ObjectBox Swift framework. Uses a special static ObjectBox C library for macOS/iOS, see `fetch_dependencies.command` below.
10-
- `docs/swift_output/`: The generated framework documentation.
10+
- `docs/swift_output/`: The generated framework documentation.
1111
- `external/`: git submodule and/or pre-built binary container.
1212
This contains the ObjectBoxCore static libraries and the [ObjectBox Swift code generator](https://github.com/objectbox/objectbox-swift-generator).
1313

@@ -22,39 +22,39 @@ These Swift classes internally use [ObjectBox's C API](https://github.com/object
2222

2323
ObjectBox comes with a couple of tests of different categories:
2424

25-
* Unit tests: `ios-framework/CommonTests`, based on XCTestCase
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);
25+
- Unit tests: `ios-framework/CommonTests`, based on XCTestCase
26+
- Generator 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);
2727
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;
28+
- (Outdated) Integration tests "IntegrationTests": `ios-framework/IntegrationTests`, currently not maintained, run via script;
2929
somewhat similar to CodeGen; subject to a general clean up; see [README](ios-framework/IntegrationTests/Readme.md)
30-
* External integration test project: https://github.com/objectbox/objectbox-swift-integration-test
30+
- External integration test project: https://github.com/objectbox/objectbox-swift-integration-test
3131
runs "real projects" with "full ObjectBox round-trip" on internal CI and CircleCI
3232

3333
### Xcode Project Organization
3434

3535
You look at and build the framework itself via `ios-framework/ObjectBox.xcodeproj`.
3636

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
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 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
4949

5050
## Development
5151

52-
* Ensure the latest Xcode is installed (Swift 5.3+, command line tools should be included).
53-
* Ensure [homebrew](https://brew.sh/) is installed, e.g. setup.sh uses it.
54-
* Ensure [rbenv](https://github.com/rbenv/rbenv) and ruby is installed, see section below.
55-
* Run `./setup.sh` or see [setup.sh](setup.sh) and only run what is needed.
56-
* Runs `brew bundle` to install or update basic build tools including [Carthage](https://github.com/Carthage/Carthage) (see [Brewfile](Brewfile)).
57-
* Runs `bundle install` to install or update cocoapods and jazzy (see [Gemfile](Gemfile)).
52+
- Ensure the latest Xcode is installed (Swift 5.3+, command line tools should be included).
53+
- Ensure [homebrew](https://brew.sh/) is installed, e.g. setup.sh uses it.
54+
- Ensure [rbenv](https://github.com/rbenv/rbenv) and ruby is installed, see section below.
55+
- Run `./setup.sh` or see [setup.sh](setup.sh) and only run what is needed.
56+
- Runs `brew bundle` to install or update basic build tools including [Carthage](https://github.com/Carthage/Carthage) (see [Brewfile](Brewfile)).
57+
- Runs `bundle install` to install or update cocoapods and jazzy (see [Gemfile](Gemfile)).
5858

5959
Open the Xcode project in `ios-framework/ObjectBox.xcodeproj`.
6060

@@ -73,21 +73,24 @@ make build_framework
7373
make test
7474
# Execute specific tests
7575
make unit_tests
76-
make integration_tests
76+
make generator_tests
7777
```
7878

7979
**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.
81-
```shell script
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.
81+
82+
```shell
8283
xcodebuild -derivedDataPath ./DerivedData test -project ObjectBox.xcodeproj -scheme ObjectBox-macOS -destination 'platform=OS X,arch=x86_64' -only-testing ObjectBoxTests-macOS/StoreTests/test32vs64BitForOs | xcpretty
8384
xcodebuild -derivedDataPath ./DerivedData test -project ObjectBox.xcodeproj -scheme ObjectBox-iOS -destination 'platform=iOS Simulator,name=iPhone 11' -only-testing ObjectBoxTests-iOS/StoreTests/test32vs64BitForOs | xcpretty
8485
```
8586

8687
**To run tests with an in-memory database** set the following environment variable before running an xcodebuild command:
87-
```
88+
89+
```shell
8890
export OBX_IN_MEMORY=true
8991
make u_tests
9092
```
93+
9194
In Xcode, set this by editing the scheme: under Test look for Arguments.
9295

9396
### Generate the Documentation
@@ -108,16 +111,18 @@ The result is stored inside `ios-framework/docs/swift_output/`.
108111
The Ruby version on macOS is outdated, e.g. Cocoapods may have a problem.
109112
Use [rbenv](https://github.com/rbenv/rbenv) to install the required version:
110113

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
114+
```shell
115+
# Print current version
116+
ruby -v
117+
# Install rbenv and build plugin to install ruby versions
118+
brew update && brew install rbenv ruby-build
119+
# Print the version configured in .ruby-version
120+
rbenv local
121+
# Install that version, e.g.
122+
rbenv install 3.0.5
123+
# Ensure it is the expected version
124+
ruby -v
125+
```
121126

122127
To change the required ruby version, see https://www.ruby-lang.org/en/downloads/releases/ and set
123128
it with e.g. `rbenv local 3.0.5`. This will update the `.ruby-version` file. Then install
@@ -131,8 +136,8 @@ Run `bundle update` and commit the changed [lock file](Gemfile.lock).
131136

132137
### Build notes
133138

134-
* SwiftLint: target `ObjectBox-macOS` has a build phase that runs `swiftlint lint --config .swiftlint.yml`
135-
* Edit `.swiftlint.yml` file to customize
139+
- SwiftLint: target `ObjectBox-macOS` has a build phase that runs `swiftlint lint --config .swiftlint.yml`
140+
- Edit `.swiftlint.yml` file to customize
136141

137142
## Caveats
138143

0 commit comments

Comments
 (0)