Skip to content

Commit 6c36bed

Browse files
committed
Version 0.0.3
1 parent e3fbe25 commit 6c36bed

File tree

4 files changed

+45
-20
lines changed

4 files changed

+45
-20
lines changed

MozillaRustComponentsWrapper/dummy.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
*/
5+
6+
// Swift Package Manager needs at least one source file.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
4+
*/
5+
6+
// Swift Package Manager needs at least one header to prevent a warning. See
7+
// https://github.com/mozilla/application-services/issues/4422.

Package.swift

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,55 @@ let package = Package(
2121
//.package(name: "SwiftKeychainWrapper", url: "https://github.com/jrendel/SwiftKeychainWrapper", from: "4.0.1")
2222
],
2323
targets: [
24+
/*
25+
* A placeholder wrapper for our binaryTarget so that XCode will ensure this is
26+
* downloaded/built before trying to use it in the build process
27+
* A bit hacky but necessary for now https://github.com/mozilla/application-services/issues/4422
28+
*/
29+
.target(
30+
name: "MozillaRustComponentsWrapper",
31+
dependencies: [
32+
.target(name: "MozillaRustComponents", condition: .when(platforms: [.iOS]))
33+
],
34+
path: "MozillaRustComponentsWrapper"
35+
),
36+
.binaryTarget(
37+
name: "MozillaRustComponents",
38+
//
39+
// For release artifacts, reference the MozillaRustComponents as a URL with checksum.
40+
//
41+
url: "https://112912-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
42+
checksum: "a67cfdab5e9a52eeb93435b20a4fc2813fe0486113c6eab5d7fa77fcbcb4fa07"
43+
//
44+
// For local testing, you can point at an (unzipped) XCFramework that's part of the repo.
45+
// Note that you have to actually check it in and make a tag for it to work correctly.
46+
//
47+
//path: "./MozillaRustComponents.xcframework"
48+
),
2449
.target(
2550
name: "Sync15",
2651
path: "external/application-services/components/sync15/ios"
2752
),
2853
.target(
2954
name: "RustLog",
30-
dependencies: ["MozillaRustComponents"],
55+
dependencies: ["MozillaRustComponentsWrapper"],
3156
path: "external/application-services/components/rc_log/ios"
3257
),
3358
.target(
3459
name: "Viaduct",
35-
dependencies: ["MozillaRustComponents"],
60+
dependencies: ["MozillaRustComponentsWrapper"],
3661
path: "external/application-services/components/viaduct/ios"
3762
),
3863
.target(
3964
name: "Nimbus",
40-
dependencies: ["MozillaRustComponents", "Glean"],
65+
dependencies: ["MozillaRustComponentsWrapper", "Glean"],
4166
path: "generated/nimbus"
4267
),
4368
.target(
4469
name: "CrashTest",
45-
dependencies: ["MozillaRustComponents"],
70+
dependencies: ["MozillaRustComponentsWrapper"],
4671
path: "generated/crashtest"
47-
),
72+
)
4873
// TODO: other components will go here over time.
4974
//.target(
5075
// name: "Logins",
@@ -56,18 +81,5 @@ let package = Package(
5681
// dependencies: ["MozillaRustComponents", "SwiftKeychainWrapper"],
5782
// path: "external/application-services/components/fxa-client/ios"
5883
//),
59-
.binaryTarget(
60-
name: "MozillaRustComponents",
61-
//
62-
// For release artifacts, reference the MozillaRustComponents as a URL with checksum.
63-
//
64-
url: "https://112912-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
65-
checksum: "a67cfdab5e9a52eeb93435b20a4fc2813fe0486113c6eab5d7fa77fcbcb4fa07"
66-
//
67-
// For local testing, you can point at an (unzipped) XCFramework that's part of the repo.
68-
// Note that you have to actually check it in and make a tag for it to work correctly.
69-
//
70-
//path: "./MozillaRustComponents.xcframework"
71-
)
7284
]
7385
)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Key points:
3636
* The `Package.swift` file references `MozillaRustComponents.xcframework.zip` as a Swift binary target.
3737
* The `Package.swift` file defines an individual module for the Swift wrapper code of each component.
3838
* Each module references its Swift source code directly as files in the repo.
39-
* Each module depends on `MozillaRustComponents` to provide the pre-compiled Rust code.
39+
* Each module depends on `MozillaRustComponentsWrapper` which wraps `MozillaRustComponents` to provide the pre-compiled Rust code.
4040

4141
## Cutting a new release
4242

@@ -62,7 +62,7 @@ To add a new component to be distributed via this repo, you'll need to:
6262
* Edit `./Package.swift` to add the new component.
6363
* Add a new library product for the component under "products".
6464
* Add a corresponding target for the component under "targets".
65-
* Make sure it depends on "MozillaRustComponents" to pull in the pre-compiled Rust code,
65+
* Make sure it depends on "MozillaRustComponentsWrapper" to pull in the pre-compiled Rust code,
6666
as well as on any third-party Swift packages that it may require.
6767
* Follow the instructions below to test it out locally.
6868

0 commit comments

Comments
 (0)