Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a SwiftPM package #6187

Merged
merged 10 commits into from
Jun 28, 2019
Merged

Add a SwiftPM package #6187

merged 10 commits into from
Jun 28, 2019

Conversation

tgoyne
Copy link
Member

@tgoyne tgoyne commented Jun 25, 2019

Swift Package Manager has Opinions about how projects must be structured and does not like it when projects deviate from that, so this ends up being a bit complicated.

Using a custom modulemap (which we do for the Realm.Private and Realm.Dynamic subpackages) requires that the modulemap and headers be outside of the source root for whatever reason. To avoid breaking everything else, this is done by putting a directory full of symlinks to the actual source files in the include directory.

The package currently doesn't support sync, as that can't be (publicly) built from source and swiftpm doesn't support binary packages. We previously didn't support building with sync disabled, so some changes to the source files were needed to support that.

SwiftPM supports Swift targets and objc/c++ targets, but you can't have both swift and objc/c++ in a single target. This required restructing our tests: the obj-c tests had tests for using the obj-c API from Swift, and the Swift tests had some obj-c helpers. There's now a shared support library with the obj-c helpers, and three separate test targets, for obj-c, swift tests of obj-c, and swift tests of swift. This required renaming many of the types used in the tests, as both the obj-c and swift test suites had types using the same names. It also exposed some bugs where loading RealmSwift would make Swift subclasses of RLMObject behave strangely.

Depends on realm/realm-core#3308.

@tgoyne tgoyne self-assigned this Jun 25, 2019
@tgoyne tgoyne mentioned this pull request Jun 25, 2019
10 tasks
@bmunkholm
Copy link
Contributor

Awesome work Thomas - that took quite a few changes to make happen. And having a non-sync version is an additional side benefit.
Seems to miss an update to the changelog and then we also need a reference to a doc-update.

@tgoyne tgoyne merged commit 93fca58 into master Jun 28, 2019
@tgoyne tgoyne deleted the tg/spm branch February 4, 2021 23:55
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants