-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Start using workspace dependencies #297
Merged
gregtatum
merged 4 commits into
projectfluent:main
from
adriantombu:task/workspace-dependencies
Dec 13, 2022
+120
−48
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Local testing against the Firefox codebase | ||
|
||
Testing `fluent-rs` locally against a local copy of the Firefox codebase can be done with the following steps. | ||
|
||
## 1. Clone Firefox locally | ||
|
||
Bootstrap a copy of the Firefox source code without the Artifact Builds (it is needed to be able to modify the Rust dependencies). | ||
|
||
See the [Firefox Contributors’ Quick Reference](https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html) for more information on how to achieve that on your operating system. | ||
|
||
## 2. Delete the `fluent-rs` vendored packages | ||
|
||
Remove the following packages from the `mozilla-unified/third_party/rust` directory: | ||
|
||
- fluent | ||
- fluent-bundle | ||
- fluent-fallback | ||
- fluent-pseudo | ||
- fluent-syntax | ||
- fluent-testing | ||
- intl-memoizer | ||
|
||
## 3. Bump version numbers | ||
|
||
To avoid the `Some non-crates.io-fetched packages match published crates.io versions` error while checking the `fluent-rs` dependencies in the Firefox codebase, we must first bump the version of all the `fluent-rs` packages. | ||
|
||
To update a package, use the `cargo-release` tool. It can be installed with `cargo install cargo-release`. | ||
|
||
Run the following command in the `fluent-rs` directory to bump the version of all its packages: | ||
|
||
``` | ||
cargo release version patch -p fluent -p fluent-bundle -p fluent-fallback -p fluent-pseudo -p fluent-syntax -p fluent-testing -p intl-memoizer --execute` | ||
``` | ||
|
||
## 4. Upgrade dependencies | ||
|
||
Now we need to upgrade all the dependencies to `fluent-rs` in the Firefox codebase to match our local copy. | ||
|
||
- [Search for all references](https://searchfox.org/mozilla-central/search?q=%5E%28fluent%28-%5Cw%2B%29%3F%7Cintl-memoizer%29+%3D+%22.*%22&path=&case=false®exp=true) | ||
- Update all the references to our local packages by using `{ path = "..." }` in the `Cargo.toml` file of the impacted packages. | ||
|
||
### Exemple | ||
|
||
If both `fluent-rs` and `mozilla_unified` directories are on the same root directory, you can update the `fluent-fallback` entry from `fluent-fallback = "0.7.0"` to `fluent-fallback = { path = "../../../../../fluent-rs/fluent-fallback" }` in the `mozilla-unified/intl/l10n/rust/l10nregistry-ffi/Cargo.toml` file. | ||
|
||
## 5. Check the local `fluent-rs` dependencies | ||
|
||
It is done by running `./mach vendor rust` at the root of the `mozilla-unified` directory. If the `./mach vendor rust` command runs without any problems, you're good to go! | ||
|
||
### Vetting a dependency | ||
|
||
If you see an error similar to `intel-memoizer type-map = "0.5" must be vetted (current vetted version at 0.4) =`, it means that the current vetted version of the `type-map` package is `0.4` but we're using the `0.5` version in `fluent-rs`. | ||
|
||
It can be fixed in the `supply-chain/config.toml` file by bumping the version in the `[[exemptions.type-map]]` to `0.5`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,14 @@ keywords = ["localization", "l10n", "i18n", "intl", "internationalization"] | |
categories = ["localization", "internationalization"] | ||
|
||
[dependencies] | ||
fluent-bundle = { version = "0.15.2", path = "../fluent-bundle" } | ||
fluent-fallback = { version = "0.7.0", path = "../fluent-fallback" } | ||
unic-langid = "0.9" | ||
fluent-bundle.workspace = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Praise: Yes, this is much nicer. |
||
fluent-fallback.workspace = true | ||
futures.workspace = true | ||
rustc-hash.workspace = true | ||
thiserror.workspace = true | ||
unic-langid.workspace = true | ||
elsa = "1.5" | ||
futures = "0.3" | ||
rustc-hash = "1" | ||
thiserror = "1.0" | ||
|
||
[dev-dependencies] | ||
unic-langid = { version = "0.9", features = ["macros"]} | ||
fluent-langneg = "0.13" | ||
fluent-langneg.workspace = true | ||
unic-langid = { workspace = true, features = ["macros"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought: I'm not sure why this isn't in this repo, or if we should migrate to icu4x. @zbraniecki do you know?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fluent-langneg
should migrate to icu4x. But I'm not confident that icu4x should be providing language negotiation.In terms of moving that into this repo - sure!