Skip to content

Commit

Permalink
Allow Realm to be built as a dynamic library when installing via SPM
Browse files Browse the repository at this point in the history
This is required for compliance with the new privacy manifest rules. While App
Store Connect supports static libraries, Xcode doesn't actually build static
libraries for static targets; it just links the object files directly into the
app. It also doesn't implement the xcprivacy manifest merging that the
documentation claims exists, so our privacy manfiest is never actually used.
  • Loading branch information
tgoyne committed Apr 30, 2024
1 parent e7f82d1 commit ab14408
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 39 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
10.48.2 Release notes (2024-04-30)
=============================================================

### Enhancements

* Enable building RealmSwift as a dynamic framework when installing via SPM, which
lets us supply a privacy manifest. When RealmSwift is built as a static
library you must supply your own manifest, as Xcode does not build static
libraries in a way compatible with xcprivacy embedding. Due to some bugs in
Xcode, this may require manual changes to your project:
- Targets must now depend on only Realm or RealmSwift. If you use both the
obj-c and swift API, depending on RealmSwift will let you import Realm.
Trying to directly depend on both will give the error "Swift package
target 'Realm' is linked as a static library by 'App' and 'Realm', but
cannot be built dynamically because there is a package product with the
same name."
- To actually build RealmSwift as a dynamic framework, change "Do Not Embed"
to "Embed & Sign" in the "Frameworks, Libraries, and Embedded Content"
section on the General tab of your target's settings.
([#8561](https://github.com/realm/realm-swift/pull/8561)).

### Compatibility

* Realm Studio: 14.0.1 or later.
* APIs are backwards compatible with all previous releases in the 10.x.y series.
* Carthage release for Swift is built with Xcode 15.3.0.
* CocoaPods: 1.10 or later.
* Xcode: 14.2-15.3.0.

10.48.1 Release notes (2024-03-15)
=============================================================

Expand Down
6 changes: 4 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PackageDescription
import Foundation

let coreVersion = Version("13.26.0")
let cocoaVersion = Version("10.48.1")
let cocoaVersion = Version("10.48.2")

let cxxSettings: [CXXSetting] = [
.headerSearchPath("."),
Expand Down Expand Up @@ -147,10 +147,12 @@ let package = Package(
products: [
.library(
name: "Realm",
type: .dynamic,
targets: ["Realm"]),
.library(
name: "RealmSwift",
targets: ["Realm", "RealmSwift"]),
type: .dynamic,
targets: ["RealmSwift"]),
],
dependencies: [
.package(url: "https://github.com/realm/realm-core.git", exact: coreVersion)
Expand Down
2 changes: 1 addition & 1 deletion Realm/NSError+RLMSync.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//
////////////////////////////////////////////////////////////////////////////

#import "NSError+RLMSync.h"
#import <Realm/NSError+RLMSync.h>

#import "RLMError.h"

Expand Down
4 changes: 2 additions & 2 deletions Realm/Realm-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>10.48.1</string>
<string>10.48.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>10.48.1</string>
<string>10.48.2</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2014-2021 Realm. All rights reserved.</string>
<key>NSPrincipalClass</key>
Expand Down
19 changes: 18 additions & 1 deletion RealmSwift/PrivacyInfo.xcprivacy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,24 @@
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
</dict>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>E174.1</string>
</array>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
</dict>
</array>
<key>NSPrivacyTracking</key>
<false/>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion dependencies.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION=10.48.1
VERSION=10.48.2
REALM_CORE_VERSION=13.26.0
STITCH_VERSION=8bf8ebcff6e804586c30a6ccbadb060753071a42
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
3FEC916A2A4D3B140044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };
3FEC916E2A4D3B150044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };
3FEC91722A4D3B150044BFF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */; };
3FEC917A2A4D3DB90044BFF5 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC91792A4D3DB90044BFF5 /* Realm */; };
3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC917B2A4D3DB90044BFF5 /* RealmSwift */; };
/* End PBXBuildFile section */

Expand All @@ -27,7 +26,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3FEC917A2A4D3DB90044BFF5 /* Realm in Frameworks */,
3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -87,7 +85,6 @@
);
name = App;
packageProductDependencies = (
3FEC91792A4D3DB90044BFF5 /* Realm */,
3FEC917B2A4D3DB90044BFF5 /* RealmSwift */,
);
productName = SwiftPM;
Expand Down Expand Up @@ -383,11 +380,6 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
3FEC91792A4D3DB90044BFF5 /* Realm */ = {
isa = XCSwiftPackageProductDependency;
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
productName = Realm;
};
3FEC917B2A4D3DB90044BFF5 /* RealmSwift */ = {
isa = XCSwiftPackageProductDependency;
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,12 @@
3FEC916A2A4D3B140044BFF5 /* SwiftExampleApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3FEC91692A4D3B140044BFF5 /* SwiftExampleApp.swift */; };
3FEC916E2A4D3B150044BFF5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC916D2A4D3B150044BFF5 /* Assets.xcassets */; };
3FEC91722A4D3B150044BFF5 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3FEC91712A4D3B150044BFF5 /* Preview Assets.xcassets */; };
3FEC917A2A4D3DB90044BFF5 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC91792A4D3DB90044BFF5 /* Realm */; };
3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FEC917B2A4D3DB90044BFF5 /* RealmSwift */; };
3FF673252A684E4400500A25 /* Framework1.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF6731F2A684E4400500A25 /* Framework1.framework */; };
3FF673262A684E4400500A25 /* Framework1.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF6731F2A684E4400500A25 /* Framework1.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3FF673362A684E4E00500A25 /* Framework2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF673302A684E4E00500A25 /* Framework2.framework */; };
3FF673372A684E4E00500A25 /* Framework2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3FF673302A684E4E00500A25 /* Framework2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
3FF6733D2A684E7200500A25 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF6733C2A684E7200500A25 /* Realm */; };
3FF6733F2A684E7200500A25 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF6733E2A684E7200500A25 /* RealmSwift */; };
3FF673412A684E7700500A25 /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF673402A684E7700500A25 /* Realm */; };
3FF673432A684E7700500A25 /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 3FF673422A684E7700500A25 /* RealmSwift */; };
/* End PBXBuildFile section */

Expand Down Expand Up @@ -71,7 +68,6 @@
files = (
3FF673252A684E4400500A25 /* Framework1.framework in Frameworks */,
3FF673362A684E4E00500A25 /* Framework2.framework in Frameworks */,
3FEC917A2A4D3DB90044BFF5 /* Realm in Frameworks */,
3FEC917C2A4D3DB90044BFF5 /* RealmSwift in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -80,7 +76,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3FF6733D2A684E7200500A25 /* Realm in Frameworks */,
3FF6733F2A684E7200500A25 /* RealmSwift in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -89,7 +84,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
3FF673412A684E7700500A25 /* Realm in Frameworks */,
3FF673432A684E7700500A25 /* RealmSwift in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -179,7 +173,6 @@
);
name = App;
packageProductDependencies = (
3FEC91792A4D3DB90044BFF5 /* Realm */,
3FEC917B2A4D3DB90044BFF5 /* RealmSwift */,
);
productName = SwiftPM;
Expand All @@ -201,7 +194,6 @@
);
name = Framework1;
packageProductDependencies = (
3FF6733C2A684E7200500A25 /* Realm */,
3FF6733E2A684E7200500A25 /* RealmSwift */,
);
productName = Framework1;
Expand All @@ -223,7 +215,6 @@
);
name = Framework2;
packageProductDependencies = (
3FF673402A684E7700500A25 /* Realm */,
3FF673422A684E7700500A25 /* RealmSwift */,
);
productName = Framework2;
Expand Down Expand Up @@ -743,31 +734,16 @@
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
3FEC91792A4D3DB90044BFF5 /* Realm */ = {
isa = XCSwiftPackageProductDependency;
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
productName = Realm;
};
3FEC917B2A4D3DB90044BFF5 /* RealmSwift */ = {
isa = XCSwiftPackageProductDependency;
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
productName = RealmSwift;
};
3FF6733C2A684E7200500A25 /* Realm */ = {
isa = XCSwiftPackageProductDependency;
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
productName = Realm;
};
3FF6733E2A684E7200500A25 /* RealmSwift */ = {
isa = XCSwiftPackageProductDependency;
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
productName = RealmSwift;
};
3FF673402A684E7700500A25 /* Realm */ = {
isa = XCSwiftPackageProductDependency;
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
productName = Realm;
};
3FF673422A684E7700500A25 /* RealmSwift */ = {
isa = XCSwiftPackageProductDependency;
package = 3FEC91782A4D3DB90044BFF5 /* XCRemoteSwiftPackageReference "realm-swift" */;
Expand Down

0 comments on commit ab14408

Please sign in to comment.