Skip to content

Commit

Permalink
Version 0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
skhamis committed Sep 2, 2021
1 parent e3fbe25 commit 6c36bed
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 20 deletions.
6 changes: 6 additions & 0 deletions MozillaRustComponentsWrapper/dummy.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

// Swift Package Manager needs at least one source file.
7 changes: 7 additions & 0 deletions MozillaRustComponentsWrapper/include/ dummy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

// Swift Package Manager needs at least one header to prevent a warning. See
// https://github.com/mozilla/application-services/issues/4422.
48 changes: 30 additions & 18 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,55 @@ let package = Package(
//.package(name: "SwiftKeychainWrapper", url: "https://github.com/jrendel/SwiftKeychainWrapper", from: "4.0.1")
],
targets: [
/*
* A placeholder wrapper for our binaryTarget so that XCode will ensure this is
* downloaded/built before trying to use it in the build process
* A bit hacky but necessary for now https://github.com/mozilla/application-services/issues/4422
*/
.target(
name: "MozillaRustComponentsWrapper",
dependencies: [
.target(name: "MozillaRustComponents", condition: .when(platforms: [.iOS]))
],
path: "MozillaRustComponentsWrapper"
),
.binaryTarget(
name: "MozillaRustComponents",
//
// For release artifacts, reference the MozillaRustComponents as a URL with checksum.
//
url: "https://112912-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
checksum: "a67cfdab5e9a52eeb93435b20a4fc2813fe0486113c6eab5d7fa77fcbcb4fa07"
//
// For local testing, you can point at an (unzipped) XCFramework that's part of the repo.
// Note that you have to actually check it in and make a tag for it to work correctly.
//
//path: "./MozillaRustComponents.xcframework"
),
.target(
name: "Sync15",
path: "external/application-services/components/sync15/ios"
),
.target(
name: "RustLog",
dependencies: ["MozillaRustComponents"],
dependencies: ["MozillaRustComponentsWrapper"],
path: "external/application-services/components/rc_log/ios"
),
.target(
name: "Viaduct",
dependencies: ["MozillaRustComponents"],
dependencies: ["MozillaRustComponentsWrapper"],
path: "external/application-services/components/viaduct/ios"
),
.target(
name: "Nimbus",
dependencies: ["MozillaRustComponents", "Glean"],
dependencies: ["MozillaRustComponentsWrapper", "Glean"],
path: "generated/nimbus"
),
.target(
name: "CrashTest",
dependencies: ["MozillaRustComponents"],
dependencies: ["MozillaRustComponentsWrapper"],
path: "generated/crashtest"
),
)
// TODO: other components will go here over time.
//.target(
// name: "Logins",
Expand All @@ -56,18 +81,5 @@ let package = Package(
// dependencies: ["MozillaRustComponents", "SwiftKeychainWrapper"],
// path: "external/application-services/components/fxa-client/ios"
//),
.binaryTarget(
name: "MozillaRustComponents",
//
// For release artifacts, reference the MozillaRustComponents as a URL with checksum.
//
url: "https://112912-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
checksum: "a67cfdab5e9a52eeb93435b20a4fc2813fe0486113c6eab5d7fa77fcbcb4fa07"
//
// For local testing, you can point at an (unzipped) XCFramework that's part of the repo.
// Note that you have to actually check it in and make a tag for it to work correctly.
//
//path: "./MozillaRustComponents.xcframework"
)
]
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Key points:
* The `Package.swift` file references `MozillaRustComponents.xcframework.zip` as a Swift binary target.
* The `Package.swift` file defines an individual module for the Swift wrapper code of each component.
* Each module references its Swift source code directly as files in the repo.
* Each module depends on `MozillaRustComponents` to provide the pre-compiled Rust code.
* Each module depends on `MozillaRustComponentsWrapper` which wraps `MozillaRustComponents` to provide the pre-compiled Rust code.

## Cutting a new release

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

Expand Down

0 comments on commit 6c36bed

Please sign in to comment.