Skip to content

Commit de4b054

Browse files
authored
publish places as a swift package (#7)
1 parent 6e190b1 commit de4b054

File tree

13 files changed

+3708
-5
lines changed

13 files changed

+3708
-5
lines changed

Package.swift

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ let package = Package(
1414
.library(name: "Autofill", targets: ["Autofill"]),
1515
.library(name: "Push", targets: ["Push"]),
1616
.library(name: "Tabs", targets: ["Tabs"]),
17+
.library(name: "Places", targets: ["Places"]),
1718
],
1819
dependencies: [
1920
// TODO: ship Glean via this same bundle?
2021
.package(name: "Glean", url: "https://github.com/mozilla/glean-swift", from: "41.1.1"),
21-
.package(name: "SwiftKeychainWrapper", url: "https://github.com/jrendel/SwiftKeychainWrapper", from: "4.0.1")
22+
.package(name: "SwiftKeychainWrapper", url: "https://github.com/jrendel/SwiftKeychainWrapper", from: "4.0.1"),
23+
.package(name: "SwiftProtobuf", url: "https://github.com/apple/swift-protobuf", from: "1.18.0")
2224
],
2325
targets: [
2426
/*
@@ -38,8 +40,8 @@ let package = Package(
3840
//
3941
// For release artifacts, reference the MozillaRustComponents as a URL with checksum.
4042
//
41-
url: "https://116964-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
42-
checksum: "87c570f0f14055020263a38cf45726bee0b890a77a3359c76499756905ca30cc"
43+
url: "https://117909-129966583-gh.circle-artifacts.com/0/dist/MozillaRustComponents.xcframework.zip",
44+
checksum: "92a66ee992a3848dae8319be996833120e9a86f2bc08354d181b81197bf79e4e"
4345

4446
// For local testing, you can point at an (unzipped) XCFramework that's part of the repo.
4547
// Note that you have to actually check it in and make a tag for it to work correctly.
@@ -94,6 +96,11 @@ let package = Package(
9496
name: "Tabs",
9597
dependencies: ["MozillaRustComponentsWrapper"],
9698
path: "generated/tabs"
99+
),
100+
.target(
101+
name: "Places",
102+
dependencies: ["MozillaRustComponentsWrapper", "Sync15", "SwiftProtobuf"],
103+
path: "generated/places"
97104
)
98105
]
99106
)

generate.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,21 @@ rm -rf "$PUSH_DIR" && mkdir -p "$PUSH_DIR"
105105
TABS_DIR="$THIS_DIR/generated/tabs"
106106
rm -rf "$TABS_DIR" && mkdir -p "$TABS_DIR"
107107
# UniFFI bindings.
108-
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$TABS_DIR/Generated" "$APP_SERVICES_DIR/components/tabs/src/tabs.udl"
108+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$TABS_DIR/Generated" "$APP_SERVICES_DIR/components/tabs/src/tabs.udl"
109+
110+
###
111+
#
112+
# Places
113+
#
114+
###
115+
116+
PLACES_DIR="$THIS_DIR/generated/places"
117+
rm -rf "$PLACES_DIR" && mkdir -p "$PLACES_DIR"
118+
# UniFFI bindings.
119+
"${UNIFFI_BINDGEN[@]}" generate -l swift -o "$PLACES_DIR/Generated" "$APP_SERVICES_DIR/components/places/src/places.udl"
120+
121+
## We need to build the protobuf files and copy them over to the places generated section
122+
protoc --proto_path="$APP_SERVICES_DIR/components/places/src" --swift_out="$PLACES_DIR/Generated" "places_msg_types.proto"
123+
124+
# Copy the hand-written Swift, since it all needs to be together in one directory.
125+
cp -r "$APP_SERVICES_DIR/components/places/ios/Places" "$PLACES_DIR/Places"

0 commit comments

Comments
 (0)