You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/howtos/adding-a-new-component.md
+9-23Lines changed: 9 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,21 +114,16 @@ You will end up with a directory structure something like this:
114
114
115
115
> *For more information on our how we ship components using the Swift Package Manager, check the [ADR that introduced the Swift Package Manager](../adr/0003-swift-packaging.md)*
116
116
117
-
> [!CRITICAL]
118
-
> This section will be soon outdated as all swift wrappers and related tests will be moving to the firefox-ios repository.
119
-
120
117
Add your component into the iOS ["megazord"](../design/megazords.md) through the local Swift Package Manager (SPM) package `MozillaRustComponentsWrapper`. Note this SPM is for ease of testing APIs locally. The official SPM that is consumed by firefox-ios is a [local package in their repo](https://github.com/mozilla-mobile/firefox-ios/tree/main/MozillaRustComponents).
121
118
122
-
1. Place any hand-written Swift wrapper code for your component in:
> Note: swift-specific tests are ideally suited in the consuming app as there is better integration coverage and ensures we're accurately testing how it's being consumed
126
+
132
127
That's it! At this point, if you don't intend on writing tests _(are you sure?)_ you can skip this next section.
133
128
134
129
### Writing and Running Tests
@@ -150,26 +145,17 @@ To test your component:
150
145
151
146
The script will:
152
147
1. Build the XCFramework (combines all rust binaries for SPM)
153
-
2. Generate UniFFi bindings (artifacts can be found in `megazords/ios-rust/sources/MozillaRustComponentsWrapper/Generated/`)
148
+
2. Generate UniFFi bindings (generated files will be found in `megazords/ios-rust/sources/MozillaRustComponentsWrapper/Generated/`)
154
149
3. Generate Glean metrics
155
150
4. Run any tests found in the test dir mentioned above
156
151
157
-
TODO: Update this section??
158
-
159
-
To ensure distribution of this code, edit `taskcluster/scripts/build-and-test-swift.py`:
160
-
161
-
- Add your component's directory path to `SOURCE_TO_COPY`
162
-
- Optionally, add the path to `FOCUS_SOURCE_TO_COPY` if your component targets Firefox Focus.
163
-
164
-
165
152
166
-
Make sure that this code gets distributed. Edit `taskcluster/scripts/build-and-test-swift.py` and:
153
+
### Distribution of the component
167
154
168
-
- Add the path to the directory containing any hand-written swift code to `SOURCE_TO_COPY`
169
-
- Optionally also to `FOCUS_SOURCE_TO_COPY` if your component is also targeting Firefox Focus
155
+
The UniFFi files will be generated & packaged via `taskcluster/scripts/build-and-test-swift.py`.
170
156
157
+
Consumers (eg: Firefox iOS) pull the latest artifacts via a nightly [Gitub action](https://github.com/mozilla-mobile/firefox-ios/actions/workflows/update-appservices-nightly.yml). Once your changes are pulled via a nightly release you'll be able to use your new APIs!
171
158
172
-
### Distribute your component with `rust-components-swift`
173
-
The Swift source code and generated UniFFI bindings are distributed to consumers (eg: Firefox iOS) through [`rust-components-swift`](https://github.com/mozilla/rust-components-swift).
159
+
> Note: If you don't want to wait for a nightly, once the CI finishes your build -- you can request the action run in firefox-ios to get it sooner
174
160
175
-
Your component should now automatically get included in the next `rust-component-swift` nightly release.
161
+
> Note pt2: If you want to locally test against firefox-ios, follow [this guide](https://github.com/mozilla/application-services/blob/main/docs/howtos/locally-published-components-in-firefox-ios.md)
0 commit comments