Ships a seperate megazord for focus-ios (#4953)
* Ship a focus specific megazord * fix bash lint * Fix rustfmt * Fixes broken script * Fixes script lint * Adds changelog
This commit is contained in:
Родитель
15c96abd84
Коммит
53d8020e1f
|
@ -334,6 +334,58 @@ jobs:
|
|||
root: .
|
||||
paths:
|
||||
- megazords/ios-rust/MozillaRustComponents.xcframework.zip
|
||||
Focus build XCFramework:
|
||||
executor: macos
|
||||
steps:
|
||||
- full-checkout
|
||||
- restore-sccache-cache
|
||||
- install-rust
|
||||
- setup-rust-target-version
|
||||
- setup-sccache
|
||||
- setup-ios-environment
|
||||
- run:
|
||||
name: Build XCFramework archive
|
||||
command: |
|
||||
bash megazords/ios-rust/build-xcframework.sh --build-profile release --focus
|
||||
- save-sccache-cache:
|
||||
path: "~/Library/Caches/Mozilla.sccache"
|
||||
- store_artifacts:
|
||||
name: Store XCFramework bundle in workspace
|
||||
path: megazords/ios-rust/focus/FocusRustComponents.xcframework.zip
|
||||
destination: dist/FocusRustComponents.xcframework.zip
|
||||
- run:
|
||||
name: "XCFramework bundle checksum"
|
||||
command: |
|
||||
shasum -a 256 ./megazords/ios-rust/focus/FocusRustComponents.xcframework.zip
|
||||
echo "Use the above checksum to depend on FocusRustComponents.xcframework.zip as a Swift Package binary target"
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- megazords/ios-rust/focus/FocusRustComponents.xcframework.zip
|
||||
|
||||
XCFramework release:
|
||||
executor: macos
|
||||
steps:
|
||||
- full-checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- install-ghr
|
||||
- run:
|
||||
name: Release XCFramework archive on GitHub
|
||||
command: |
|
||||
ghr -replace "${CIRCLE_TAG}" megazords/ios-rust/MozillaRustComponents.xcframework.zip
|
||||
|
||||
Focus XCFramework release:
|
||||
executor: macos
|
||||
steps:
|
||||
- full-checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- install-ghr
|
||||
- run:
|
||||
name: Release XCFramework archive on GitHub
|
||||
command: |
|
||||
ghr -replace "${CIRCLE_TAG}" megazords/ios-rust/focus/FocusRustComponents.xcframework.zip
|
||||
|
||||
iOS test:
|
||||
executor: macos
|
||||
|
@ -352,17 +404,7 @@ jobs:
|
|||
destination: logs/raw_xcodetest.log
|
||||
- save-sccache-cache:
|
||||
path: "~/Library/Caches/Mozilla.sccache"
|
||||
XCFramework release:
|
||||
executor: macos
|
||||
steps:
|
||||
- full-checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- install-ghr
|
||||
- run:
|
||||
name: Release XCFramework archive on GitHub
|
||||
command: |
|
||||
ghr -replace "${CIRCLE_TAG}" megazords/ios-rust/MozillaRustComponents.xcframework.zip
|
||||
|
||||
build-nimbus-fml:
|
||||
executor: macos
|
||||
steps:
|
||||
|
@ -447,6 +489,7 @@ workflows:
|
|||
filters: # required since `XCFramework release` has tag filters AND requires this job
|
||||
tags:
|
||||
only: /.*/
|
||||
#### The following iOS jobs will only run on release
|
||||
- XCFramework release:
|
||||
requires:
|
||||
- iOS build xcframework
|
||||
|
@ -455,6 +498,22 @@ workflows:
|
|||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v.*/
|
||||
- Focus build XCFramework:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v.*/ # We only build Focus on release since Focus
|
||||
# only uses a subset of the components the full iOS build
|
||||
# covers.
|
||||
- Focus XCFramework release:
|
||||
requires:
|
||||
- Focus build XCFramework
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /^v.*/
|
||||
nimbus-artifacts:
|
||||
jobs:
|
||||
- build-nimbus-fml:
|
||||
|
|
|
@ -28,6 +28,8 @@ components/**/ios/Generated
|
|||
|
||||
# XCFramework artifact
|
||||
megazords/ios-rust/MozillaRustComponents.xcframework*
|
||||
megazords/ios-rust/focus/FocusRustComponents.xcframework*
|
||||
|
||||
|
||||
# Glean generated artifacts
|
||||
megazords/ios-rust/MozillaTestServices/MozillaTestServices/Generated/Metrics.swift
|
||||
|
|
|
@ -18,3 +18,6 @@ Use the template below to make assigning a version number during the release cut
|
|||
- Description of the change with a link to the pull request ([#0000](https://github.com/mozilla/application-services/pull/0000))
|
||||
|
||||
-->
|
||||
## General
|
||||
### What's new
|
||||
- Application services now releases an xcframework with only the components needed by focus-ios (namely Nimbus, Viaduct and Rustlog). ([#4953](https://github.com/mozilla/application-services/pull/4953))
|
|
@ -1739,6 +1739,16 @@ dependencies = [
|
|||
"viaduct",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "megazord_focus"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"nimbus-sdk",
|
||||
"rc_log_ffi",
|
||||
"viaduct",
|
||||
"viaduct-reqwest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "megazord_ios"
|
||||
version = "0.1.0"
|
||||
|
|
|
@ -34,6 +34,7 @@ members = [
|
|||
"components/webext-storage/ffi",
|
||||
"megazords/full",
|
||||
"megazords/ios-rust",
|
||||
"megazords/ios-rust/focus",
|
||||
# Disabled for intermittent failures; see SDK-233 and #3909 for details.
|
||||
# "testing/sync-test",
|
||||
"tools/protobuf-gen",
|
||||
|
|
|
@ -4,19 +4,35 @@
|
|||
|
||||
BUILD_PROFILE="release"
|
||||
FRAMEWORK_NAME="MozillaRustComponents"
|
||||
|
||||
IS_FOCUS=
|
||||
# FRAMEWORK_FILENAME exist purely because we would like to ship
|
||||
# multiple frameworks that have the same swift code
|
||||
# namely for focus. However, componenets that use
|
||||
# uniffi, can only declare a single framework name.
|
||||
#
|
||||
# So we keep the framework the same, but store them
|
||||
# under different file names.
|
||||
FRAMEWORK_FILENAME=$FRAMEWORK_NAME
|
||||
while [[ "$#" -gt 0 ]]; do case $1 in
|
||||
--build-profile) BUILD_PROFILE="$2"; shift;shift;;
|
||||
--focus) IS_FOCUS="true"; FRAMEWORK_FILENAME="FocusRustComponents";shift;;
|
||||
--framework-name) FRAMEWORK_NAME="$2"; shift;shift;;
|
||||
*) echo "Unknown parameter: $1"; exit 1;
|
||||
esac; done
|
||||
|
||||
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
WORKING_DIR=
|
||||
if [[ -n $IS_FOCUS ]]; then
|
||||
WORKING_DIR="$THIS_DIR/focus"
|
||||
else
|
||||
WORKING_DIR=$THIS_DIR
|
||||
fi
|
||||
REPO_ROOT="$( dirname "$( dirname "$THIS_DIR" )" )"
|
||||
|
||||
MANIFEST_PATH="$THIS_DIR/Cargo.toml"
|
||||
MANIFEST_PATH="$WORKING_DIR/Cargo.toml"
|
||||
|
||||
if [[ ! -f "$MANIFEST_PATH" ]]; then
|
||||
echo "Could not locate Cargo.toml relative to script"
|
||||
echo "Could not locate Cargo.toml in $MANIFEST_PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -106,7 +122,7 @@ CFLAGS_aarch64_apple_ios_sim="--target aarch64-apple-ios-sim" \
|
|||
####
|
||||
|
||||
TARGET_DIR="$REPO_ROOT/target"
|
||||
XCFRAMEWORK_ROOT="$THIS_DIR/$FRAMEWORK_NAME.xcframework"
|
||||
XCFRAMEWORK_ROOT="$WORKING_DIR/$FRAMEWORK_FILENAME.xcframework"
|
||||
|
||||
# Start from a clean slate.
|
||||
|
||||
|
@ -118,30 +134,40 @@ rm -rf "$XCFRAMEWORK_ROOT"
|
|||
COMMON="$XCFRAMEWORK_ROOT/common/$FRAMEWORK_NAME.framework"
|
||||
|
||||
mkdir -p "$COMMON/Modules"
|
||||
cp "$THIS_DIR/module.modulemap" "$COMMON/Modules/"
|
||||
cp "$WORKING_DIR/module.modulemap" "$COMMON/Modules/"
|
||||
|
||||
cp "$THIS_DIR/DEPENDENCIES.md" "$COMMON/DEPENDENCIES.md"
|
||||
cp "$WORKING_DIR/DEPENDENCIES.md" "$COMMON/DEPENDENCIES.md"
|
||||
|
||||
mkdir -p "$COMMON/Headers"
|
||||
cp "$THIS_DIR/MozillaRustComponents.h" "$COMMON/Headers"
|
||||
|
||||
# First we move the files that are common between both
|
||||
# firefox-ios and Focus
|
||||
cp "$WORKING_DIR/$FRAMEWORK_NAME.h" "$COMMON/Headers"
|
||||
cp "$REPO_ROOT/components/rc_log/ios/RustLogFFI.h" "$COMMON/Headers"
|
||||
cp "$REPO_ROOT/components/viaduct/ios/RustViaductFFI.h" "$COMMON/Headers"
|
||||
cp "$REPO_ROOT/components/external/glean/glean-core/ffi/glean.h" "$COMMON/Headers"
|
||||
# TODO: https://github.com/mozilla/uniffi-rs/issues/1060
|
||||
# it would be neat if there was a single UniFFI command that would spit out
|
||||
# all of the generated headers for all UniFFIed dependencies of a given crate.
|
||||
# For now we generate the Swift bindings to get the headers as a side effect,
|
||||
# then delete the generated Swift code. Bleh.
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/nimbus/src/nimbus.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/crashtest/src/crashtest.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/fxa-client/src/fxa_client.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/logins/src/logins.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/autofill/src/autofill.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/push/src/push.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/tabs/src/tabs.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/places/src/places.udl" -l swift -o "$COMMON/Headers"
|
||||
|
||||
# We now only move/generate the rest of the headers if we are generating a full
|
||||
# iOS megazord
|
||||
if [ -z $IS_FOCUS ]; then
|
||||
cp "$REPO_ROOT/components/external/glean/glean-core/ffi/glean.h" "$COMMON/Headers"
|
||||
# TODO: https://github.com/mozilla/uniffi-rs/issues/1060
|
||||
# it would be neat if there was a single UniFFI command that would spit out
|
||||
# all of the generated headers for all UniFFIed dependencies of a given crate.
|
||||
# For now we generate the Swift bindings to get the headers as a side effect,
|
||||
# then delete the generated Swift code. Bleh.
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/crashtest/src/crashtest.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/fxa-client/src/fxa_client.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/logins/src/logins.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/autofill/src/autofill.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/push/src/push.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/tabs/src/tabs.udl" -l swift -o "$COMMON/Headers"
|
||||
$CARGO uniffi-bindgen generate "$REPO_ROOT/components/places/src/places.udl" -l swift -o "$COMMON/Headers"
|
||||
fi
|
||||
rm -rf "$COMMON"/Headers/*.swift
|
||||
|
||||
|
||||
|
||||
# Flesh out the framework for each architecture based on the common files.
|
||||
# It's a little fiddly, because we apparently need to put all the simulator targets
|
||||
# together into a single fat binary, but keep the hardware target separate.
|
||||
|
@ -163,11 +189,11 @@ lipo -create \
|
|||
|
||||
# Set up the metadata for the XCFramework as a whole.
|
||||
|
||||
cp "$THIS_DIR/Info.plist" "$XCFRAMEWORK_ROOT/Info.plist"
|
||||
cp "$THIS_DIR/DEPENDENCIES.md" "$XCFRAMEWORK_ROOT/DEPENDENCIES.md"
|
||||
cp "$WORKING_DIR/Info.plist" "$XCFRAMEWORK_ROOT/Info.plist"
|
||||
cp "$WORKING_DIR/DEPENDENCIES.md" "$XCFRAMEWORK_ROOT/DEPENDENCIES.md"
|
||||
|
||||
rm -rf "$XCFRAMEWORK_ROOT/common"
|
||||
|
||||
# Zip it all up into a bundle for distribution.
|
||||
|
||||
(cd "$THIS_DIR" && zip -9 -r "$FRAMEWORK_NAME.xcframework.zip" "$FRAMEWORK_NAME.xcframework")
|
||||
(cd "$WORKING_DIR" && zip -9 -r "$FRAMEWORK_FILENAME.xcframework.zip" "$FRAMEWORK_FILENAME.xcframework")
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
[package]
|
||||
name = "megazord_focus"
|
||||
edition = "2021"
|
||||
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" }
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,53 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>AvailableLibraries</key>
|
||||
<array>
|
||||
<!-- If we want to add desktop builds in future, this is the required snippet:
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>macos-x86_64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>MozillaRustComponents.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>macos</string>
|
||||
</dict>-->
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>MozillaRustComponents.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>LibraryIdentifier</key>
|
||||
<string>ios-arm64_x86_64-simulator</string>
|
||||
<key>LibraryPath</key>
|
||||
<string>MozillaRustComponents.framework</string>
|
||||
<key>SupportedArchitectures</key>
|
||||
<array>
|
||||
<string>arm64</string>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
<key>SupportedPlatform</key>
|
||||
<string>ios</string>
|
||||
<key>SupportedPlatformVariant</key>
|
||||
<string>simulator</string>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XFWK</string>
|
||||
<key>XCFrameworkFormatVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -0,0 +1,10 @@
|
|||
/* 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/. */
|
||||
|
||||
// This is the "umbrella header" for our combined Rust code library.
|
||||
// It needs to import all of the individual headers.
|
||||
|
||||
#import "RustLogFFI.h"
|
||||
#import "RustViaductFFI.h"
|
||||
#import "nimbusFFI.h"
|
|
@ -0,0 +1,6 @@
|
|||
framework module MozillaRustComponents {
|
||||
umbrella header "MozillaRustComponents.h"
|
||||
|
||||
export *
|
||||
module * { export * }
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
/* 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/. */
|
||||
|
||||
#![allow(unknown_lints)]
|
||||
#![warn(rust_2018_idioms)]
|
||||
|
||||
pub use nimbus;
|
||||
pub use rc_log_ffi;
|
||||
pub use viaduct_reqwest;
|
|
@ -1289,7 +1289,7 @@ if __name__ == "__main__":
|
|||
# Default to listing dependencies for the "megazord" and "megazord_ios" packages,
|
||||
# which together include everything we might possibly incorporate into in a built distribution.
|
||||
if not args.packages:
|
||||
args.packages = ["megazord", "megazord_ios"]
|
||||
args.packages = ["megazord", "megazord_ios", "megazord_focus"]
|
||||
|
||||
if args.targets:
|
||||
# Flatten the lists introduced by --all-XXX-targets options.
|
||||
|
|
|
@ -5,6 +5,7 @@ set -euvx
|
|||
python3 ./tools/dependency_summary.py > ./DEPENDENCIES.md
|
||||
|
||||
python3 ./tools/dependency_summary.py --all-ios-targets --package megazord_ios > megazords/ios-rust/DEPENDENCIES.md
|
||||
python3 ./tools/dependency_summary.py --all-ios-targets --package megazord_focus > megazords/ios-rust/focus/DEPENDENCIES.md
|
||||
|
||||
python3 ./tools/dependency_summary.py --all-android-targets --package megazord > megazords/full/DEPENDENCIES.md
|
||||
python3 ./tools/dependency_summary.py --all-android-targets --package megazord --format pom > megazords/full/android/dependency-licenses.xml
|
||||
|
|
Загрузка…
Ссылка в новой задаче