Skip to content

Commit 0750fef

Browse files
authored
Adding Logins, FxA, Autofill, Tabs, Push as swift packages (#5)
* update a-s submodule and added logins, fxa, autofill, tabs, push as swift packages
1 parent d37abe8 commit 0750fef

27 files changed

+8314
-35
lines changed

Package.swift

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ let package = Package(
99
.library(name: "Viaduct", targets: ["Viaduct"]),
1010
.library(name: "Nimbus", targets: ["Nimbus"]),
1111
.library(name: "CrashTest", targets: ["CrashTest"]),
12-
// TODO: more of our components here, once they support M1 builds.
13-
//.library(name: "Logins", targets: ["Logins"]),
14-
//.library(name: "FxAClient", targets: ["FxAClient"]),
12+
.library(name: "Logins", targets: ["Logins"]),
13+
.library(name: "FxAClient", targets: ["FxAClient"]),
14+
.library(name: "Autofill", targets: ["Autofill"]),
15+
.library(name: "Push", targets: ["Push"]),
16+
.library(name: "Tabs", targets: ["Tabs"]),
1517
],
1618
dependencies: [
1719
// TODO: ship Glean via this same bundle?
1820
.package(name: "Glean", url: "https://github.com/mozilla/glean-swift", from: "39.0.4"),
19-
// TODO: this external dependency is required for FxAClient,
20-
// leaving it here as an example for now.
21-
//.package(name: "SwiftKeychainWrapper", url: "https://github.com/jrendel/SwiftKeychainWrapper", from: "4.0.1")
21+
.package(name: "SwiftKeychainWrapper", url: "https://github.com/jrendel/SwiftKeychainWrapper", from: "4.0.1")
2222
],
2323
targets: [
2424
/*
@@ -38,9 +38,9 @@ let package = Package(
3838
//
3939
// For release artifacts, reference the MozillaRustComponents as a URL with checksum.
4040
//
41-
url: "https://112912-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
42-
checksum: "a67cfdab5e9a52eeb93435b20a4fc2813fe0486113c6eab5d7fa77fcbcb4fa07"
43-
//
41+
url: "https://116964-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
42+
checksum: "87c570f0f14055020263a38cf45726bee0b890a77a3359c76499756905ca30cc"
43+
4444
// For local testing, you can point at an (unzipped) XCFramework that's part of the repo.
4545
// Note that you have to actually check it in and make a tag for it to work correctly.
4646
//
@@ -69,17 +69,31 @@ let package = Package(
6969
name: "CrashTest",
7070
dependencies: ["MozillaRustComponentsWrapper"],
7171
path: "generated/crashtest"
72+
),
73+
.target(
74+
name: "Logins",
75+
dependencies: ["MozillaRustComponentsWrapper", "Sync15"],
76+
path: "generated/logins"
77+
),
78+
.target(
79+
name: "FxAClient",
80+
dependencies: ["MozillaRustComponentsWrapper", "SwiftKeychainWrapper"],
81+
path: "generated/fxa-client"
82+
),
83+
.target(
84+
name: "Autofill",
85+
dependencies: ["MozillaRustComponentsWrapper"],
86+
path: "generated/autofill"
87+
),
88+
.target(
89+
name: "Push",
90+
dependencies: ["MozillaRustComponentsWrapper"],
91+
path: "generated/push"
92+
),
93+
.target(
94+
name: "Tabs",
95+
dependencies: ["MozillaRustComponentsWrapper"],
96+
path: "generated/tabs"
7297
)
73-
// TODO: other components will go here over time.
74-
//.target(
75-
// name: "Logins",
76-
// dependencies: ["MozillaRustComponentsWrapper", "Sync15"],
77-
// path: "external/application-services/components/logins/ios"
78-
//),
79-
//.target(
80-
// name: "FxAClient",
81-
// dependencies: ["MozillaRustComponentsWrapper", "SwiftKeychainWrapper"],
82-
// path: "external/application-services/components/fxa-client/ios"
83-
//),
8498
]
8599
)

external/application-services

generate.sh

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,15 @@
99

1010
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
1111

12-
UNIFFI_BINDGEN=(cargo run --manifest-path "$THIS_DIR/external/application-services/tools/embedded-uniffi-bindgen/Cargo.toml")
13-
GLEAN_GENERATOR="$THIS_DIR/external/application-services/components/external/glean/glean-core/ios/sdk_generator.sh"
12+
# Allow the option to use a local copy of application-services
13+
if [ -n "$1" ]; then
14+
APP_SERVICES_DIR=$1
15+
else
16+
APP_SERVICES_DIR="$THIS_DIR/external/application-services"
17+
fi
18+
19+
UNIFFI_BINDGEN=(cargo run --manifest-path "$APP_SERVICES_DIR/tools/embedded-uniffi-bindgen/Cargo.toml")
20+
GLEAN_GENERATOR="$APP_SERVICES_DIR/components/external/glean/glean-core/ios/sdk_generator.sh"
1421

1522
set -euvx
1623

@@ -25,11 +32,11 @@ rm -rf "$NIMBUS_DIR" && mkdir -p "$NIMBUS_DIR"
2532
# Glean metrics.
2633
# Run this first, because it appears to delete any other .swift files in the output directory.
2734
# Also, it wants to be run from inside Xcode, so we set some env vars to fake it out.
28-
SOURCE_ROOT="$THIS_DIR" PROJECT="nimbus" "$GLEAN_GENERATOR" -o "$NIMBUS_DIR/Generated" "$THIS_DIR/external/application-services/components/nimbus/metrics.yaml"
35+
SOURCE_ROOT="$THIS_DIR" PROJECT="nimbus" "$GLEAN_GENERATOR" -o "$NIMBUS_DIR/Generated" "$APP_SERVICES_DIR/components/nimbus/metrics.yaml"
2936
# UniFFI bindings.
30-
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$NIMBUS_DIR/Generated" "$THIS_DIR/external/application-services/components/nimbus/src/nimbus.udl"
37+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$NIMBUS_DIR/Generated" "$APP_SERVICES_DIR/components/nimbus/src/nimbus.udl"
3138
# Copy the hand-written Swift, since it all needs to be together in one directory.
32-
cp -r "$THIS_DIR/external/application-services/components/nimbus/ios/Nimbus" "$NIMBUS_DIR/Nimbus"
39+
cp -r "$APP_SERVICES_DIR/components/nimbus/ios/Nimbus" "$NIMBUS_DIR/Nimbus"
3340

3441
###
3542
#
@@ -39,4 +46,63 @@ cp -r "$THIS_DIR/external/application-services/components/nimbus/ios/Nimbus" "$N
3946

4047
CRASHTEST_DIR="$THIS_DIR/generated/crashtest"
4148
rm -rf "$CRASHTEST_DIR" && mkdir -p "$CRASHTEST_DIR"
42-
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$CRASHTEST_DIR" "$THIS_DIR/external/application-services/components/crashtest/src/crashtest.udl"
49+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$CRASHTEST_DIR" "$APP_SERVICES_DIR/components/crashtest/src/crashtest.udl"
50+
51+
###
52+
#
53+
# FxaClient
54+
#
55+
###
56+
57+
FXA_CLIENT_DIR="$THIS_DIR/generated/fxa-client"
58+
rm -rf "$FXA_CLIENT_DIR" && mkdir -p "$FXA_CLIENT_DIR"
59+
# UniFFI bindings.
60+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$FXA_CLIENT_DIR/Generated" "$APP_SERVICES_DIR/components/fxa-client/src/fxa_client.udl"
61+
# Copy the hand-written Swift, since it all needs to be together in one directory.
62+
cp -r "$APP_SERVICES_DIR/components/fxa-client/ios/FxAClient" "$FXA_CLIENT_DIR/FxAClient"
63+
64+
###
65+
#
66+
# Logins
67+
#
68+
###
69+
70+
LOGINS_DIR="$THIS_DIR/generated/logins"
71+
rm -rf "$LOGINS_DIR" && mkdir -p "$LOGINS_DIR"
72+
# UniFFI bindings.
73+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$LOGINS_DIR/Generated" "$APP_SERVICES_DIR/components/logins/src/logins.udl"
74+
# Copy the hand-written Swift, since it all needs to be together in one directory.
75+
cp -r "$APP_SERVICES_DIR/components/logins/ios/Logins" "$LOGINS_DIR/Logins"
76+
77+
###
78+
#
79+
# Autofill
80+
#
81+
###
82+
83+
AUTOFILL_DIR="generated/autofill"
84+
rm -rf "$AUTOFILL_DIR" && mkdir -p "$AUTOFILL_DIR"
85+
# UniFFI bindings.
86+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$AUTOFILL_DIR/Generated" "$APP_SERVICES_DIR/components/autofill/src/autofill.udl"
87+
88+
###
89+
#
90+
# Push
91+
#
92+
###
93+
94+
PUSH_DIR="$THIS_DIR/generated/push"
95+
rm -rf "$PUSH_DIR" && mkdir -p "$PUSH_DIR"
96+
# UniFFI bindings.
97+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$PUSH_DIR/Generated" "$APP_SERVICES_DIR/components/push/src/push.udl"
98+
99+
###
100+
#
101+
# Tabs
102+
#
103+
###
104+
105+
TABS_DIR="$THIS_DIR/generated/tabs"
106+
rm -rf "$TABS_DIR" && mkdir -p "$TABS_DIR"
107+
# UniFFI bindings.
108+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$TABS_DIR/Generated" "$APP_SERVICES_DIR/components/tabs/src/tabs.udl"

0 commit comments

Comments
 (0)