Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 52 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ commands:
cargo metadata --locked > /dev/null
python3 ./tools/dependency_summary.py --check ./DEPENDENCIES.md
python3 ./tools/dependency_summary.py --all-ios-targets --package megazord_ios --check megazords/ios/DEPENDENCIES.md
python3 ./tools/dependency_summary.py --all-ios-targets --package ios_rust --check megazords/ios-rust/DEPENDENCIES.md
python3 ./tools/dependency_summary.py --all-android-targets --package megazord --check megazords/full/DEPENDENCIES.md
python3 ./tools/dependency_summary.py --all-android-targets --package megazord --format pom --check megazords/full/android/dependency-licenses.xml
bench-all:
Expand Down Expand Up @@ -380,6 +381,21 @@ jobs:
- store_artifacts:
path: raw_xcodebuild.log
destination: logs/raw_xcodebuild.log
- run:
name: Build XCFramework archive
command: |
# For now we need the nightly toolchain to build for the M1 simulator.
rustup install nightly
# For now we need to build the Rust stdlib from source for the M1 simulator.
rustup component add rust-src --toolchain nightly-x86_64-apple-darwin
if [ -z "${CIRCLE_TAG}" ]; then
# XCode tests build in Debug configuration, save us a full
# Rust rebuild in Release mode by forcing Debug mode on
# non-release builds.
bash megazords/ios-rust/build-xcframework.sh --build-profile debug
else
bash megazords/ios-rust/build-xcframework.sh --build-profile release
fi
- save_cache:
name: Save sccache cache
key: sccache-cache-macos-{{ arch }}-{{ epoch }}
Expand All @@ -392,21 +408,33 @@ jobs:
ZIP_URL=https://circleci.com/api/v1.1/project/github/mozilla/application-services/$CIRCLE_BUILD_NUM/artifacts/0/dist/MozillaAppServices.framework.zip
echo "{\"0.0.1\":\"$ZIP_URL\"}" > mozilla.app-services.json
- store_artifacts:
name: Store Carthage framework in workspace
path: MozillaAppServices.framework.zip
destination: dist/MozillaAppServices.framework.zip
- store_artifacts:
name: Store Carthage bin-only project specification in workspace
path: mozilla.app-services.json
destination: dist/mozilla.app-services.json
- store_artifacts:
name: Store XCFramework bundle in workspace
path: megazords/ios-rust/MozillaRustComponents.xcframework.zip
destination: dist/MozillaRustComponents.xcframework.zip
- run:
name: "Carthage binary snapshot URL"
command: |
JSON_URL=https://circleci.com/api/v1.1/project/github/mozilla/application-services/$CIRCLE_BUILD_NUM/artifacts/0/dist/mozilla.app-services.json
echo "Add the following line to your Cartfile:"
echo "binary \"$JSON_URL\" ~> 0.0.1-snapshot # mozilla/application-services@$CIRCLE_SHA1"
- run:
name: "XCFramework bundle checksum"
command: |
shasum -a 256 ./megazords/ios-rust/MozillaRustComponents.xcframework.zip
echo "Use the above checksum to depend on MozillaRustComponents.xcframework.zip as a Swift Package binary target"
- persist_to_workspace:
root: .
paths:
- MozillaAppServices.framework.zip
- megazords/ios-rust/MozillaRustComponents.xcframework.zip
Carthage release:
executor: macos
steps:
Expand All @@ -422,6 +450,21 @@ jobs:
echo "${GHR_SHA256} *${GHR}.zip" | shasum -a 256 -c -
unzip "${GHR}.zip"
./${GHR}/ghr -replace "${CIRCLE_TAG}" MozillaAppServices.framework.zip
XCFramework release:
executor: macos
steps:
- full-checkout
- attach_workspace:
at: .
- run:
name: Release XCFramework archive on GitHub
command: |
GHR=ghr_v0.12.0_darwin_amd64
GHR_SHA256=c868ef9fc5dd8c8a397b74d84051d83693c42dd59041cb17b66f90f563477249
curl -sfSL --retry 5 --retry-delay 10 -O "https://github.com/tcnksm/ghr/releases/download/v0.12.0/${GHR}.zip"
echo "${GHR_SHA256} *${GHR}.zip" | shasum -a 256 -c -
unzip "${GHR}.zip"
./${GHR}/ghr -replace "${CIRCLE_TAG}" megazords/ios-rust/MozillaRustComponents.xcframework.zip

workflows:
version: 2
Expand Down Expand Up @@ -473,7 +516,7 @@ workflows:
coverage:
jobs:
- Generate code coverage
carthage-framework:
ios-artifacts:
jobs:
- iOS build and test:
filters: # required since `Release` has tag filters AND requires `Build`
Expand All @@ -487,3 +530,11 @@ workflows:
ignore: /.*/
tags:
only: /^v.*/
- XCFramework release:
requires:
- iOS build and test
filters:
branches:
ignore: /.*/
tags:
only: /^v.*/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ components/**/ios/Generated
# Glean generated artifacts
megazords/ios/MozillaAppServices/Generated/Metrics.swift
megazords/ios/.venv
megazords/ios-rust/MozillaRustComponents.xcframework*

# Carthage generated artifacts
Carthage
Expand All @@ -49,4 +50,5 @@ build/docs/*
docs/book

# Generated rustdocs
docs/rust-docs
docs/rust-docs

11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ members = [
"components/webext-storage/ffi",
"megazords/full",
"megazords/ios/rust",
"megazords/ios-rust",
# Disabled for intermittent failures; see SDK-233 and #3909 for details.
# "testing/sync-test",
"tools/protobuf-gen",
Expand Down
4 changes: 3 additions & 1 deletion components/crashtest/uniffi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package_name = "mozilla.appservices.crashtest"
cdylib_name = "megazord"


[bindings.swift]
ffi_module_name = "MozillaRustComponents"
ffi_module_filename = "crashtestFFI"
generate_module_map = false

3 changes: 3 additions & 0 deletions components/logins/ios/Logins/LoginsStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

import Foundation
import UIKit
#if canImport(Sync15)
import Sync15
#endif

typealias LoginsStoreError = LoginsStorageError

Expand Down
1 change: 1 addition & 0 deletions components/nimbus/ios/Nimbus/FeatureVariables.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Foundation
import UIKit

/// `Variables` provides a type safe key-value style interface to configure application features
///
Expand Down
2 changes: 2 additions & 0 deletions components/nimbus/uniffi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ package_name = "org.mozilla.experiments.nimbus.internal"
cdylib = "megazord"

[bindings.swift]
ffi_module_name = "MozillaRustComponents"
ffi_module_filename = "nimbusFFI"
generate_module_map = false
3 changes: 3 additions & 0 deletions components/rc_log/ios/RustLog.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Foundation
#if canImport(MozillaRustComponents)
import MozillaRustComponents
#endif

/// The level of a log message
public enum LogLevel: Int32 {
Expand Down
3 changes: 3 additions & 0 deletions components/viaduct/ios/Viaduct.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

import Foundation
#if canImport(MozillaRustComponents)
import MozillaRustComponents
#endif

/// The public interface to viaduct.
/// Right now it doesn't do any "true" viaduct things,
Expand Down
6 changes: 4 additions & 2 deletions docs/build-and-publish-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ The key points:
* Releases are made by [manually creating a new release](./howtos/cut-a-new-release.md) via github,
which triggers various CI jobs:
* [CircleCI](../.circleci/config.yml) is used to build an iOS binary release on every release,
and publish it as a GitHub release artifact.
and publish it as GitHub release artifacts.
* [TaskCluster](../automation/taskcluster/README.md) is used to:
* Build an Android binary release.
* Upload Android library symbols to [Socorro](https://wiki.mozilla.org/Socorro).
Expand Down Expand Up @@ -75,7 +75,9 @@ For iOS consumers the corresponding steps are:
* TODO: could this step check for signed tags as an additional integrity measure?
* TODO: can we prevent these steps from being able to see the tokens used
for publishing in subsequent steps?
4. CircleCI runs Carthage to assemble a zipfile of built frameworks.
4. CircleCI builds two binary artifacts:
* A Carthage framework containing both Rust and Swift code compiled together, as a zipfile.
* An XCFramework containing just Rust code and header files, as a zipfile, for use by Swift Packags.
* TODO: could a malicious dev dependency from step (3) influence the build environment here?
5. CircleCI uses [dpl](https://github.com/travis-ci/dpl) to publish to GitHub as a release artifact.
* CircleCI config contains a github token (owned by the @appsvc-moz GitHub account) with appropriate permissions to add release artifacts.
Expand Down
24 changes: 24 additions & 0 deletions megazords/ios-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "ios_rust"
edition = "2018"
version = "0.1.0"
authors = ["application-services <application-services@mozilla.com>"]
license = "MPL-2.0"

[lib]
crate-type = ["staticlib"]

[dependencies]
rc_log_ffi = { path = "../../components/rc_log" }
viaduct = { path = "../../components/viaduct" }
viaduct-reqwest = { path = "../../components/support/viaduct-reqwest" }
nimbus-sdk = { path = "../../components/nimbus" }
crashtest = { path = "../../components/crashtest" }

# TODO: can't include fxa-client until we get NSS working on M1 simulator,
# ref https://github.com/mozilla/application-services/issues/4352.
#fxa-client = { path = "../../components/fxa-client" }
# TODO: can't include logins until we get SQLCipher working on M1 simulator,
# ref https://github.com/mozilla/application-services/issues/4352.
# (or until we entirely get rid of SQLCipher)
#logins = { path = "../../components/logins" }
Loading