Skip to content

Commit 860b1f0

Browse files
authored
Start using workspace dependencies (#297)
1 parent db27e7d commit 860b1f0

File tree

10 files changed

+120
-48
lines changed

10 files changed

+120
-48
lines changed

Cargo.toml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,21 @@ members = [
1313
exclude = [
1414
"fluent-cli",
1515
]
16+
17+
[workspace.dependencies]
18+
criterion = "0.3"
19+
fluent-langneg = "0.13"
20+
futures = "0.3"
21+
iai = "0.1"
22+
intl_pluralrules = "7.0.1"
23+
rustc-hash = "1"
24+
serde = "1.0"
25+
serde_json = "1.0"
26+
thiserror = "1.0"
27+
tokio = "1.0"
28+
unic-langid = "0.9"
29+
30+
fluent-bundle = { path = "fluent-bundle" }
31+
fluent-fallback = { path = "fluent-fallback" }
32+
fluent-pseudo = { path = "fluent-pseudo" }
33+
fluent-syntax = { path = "fluent-syntax" }

docs/local-testing-firefox.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Local testing against the Firefox codebase
2+
3+
Testing `fluent-rs` locally against a local copy of the Firefox codebase can be done with the following steps.
4+
5+
## 1. Clone Firefox locally
6+
7+
Bootstrap a copy of the Firefox source code without the Artifact Builds (it is needed to be able to modify the Rust dependencies).
8+
9+
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.
10+
11+
## 2. Delete the `fluent-rs` vendored packages
12+
13+
Remove the following packages from the `mozilla-unified/third_party/rust` directory:
14+
15+
- fluent
16+
- fluent-bundle
17+
- fluent-fallback
18+
- fluent-pseudo
19+
- fluent-syntax
20+
- fluent-testing
21+
- intl-memoizer
22+
23+
## 3. Bump version numbers
24+
25+
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.
26+
27+
To update a package, use the `cargo-release` tool. It can be installed with `cargo install cargo-release`.
28+
29+
Run the following command in the `fluent-rs` directory to bump the version of all its packages:
30+
31+
```
32+
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`
33+
```
34+
35+
## 4. Upgrade dependencies
36+
37+
Now we need to upgrade all the dependencies to `fluent-rs` in the Firefox codebase to match our local copy.
38+
39+
- [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&regexp=true)
40+
- Update all the references to our local packages by using `{ path = "..." }` in the `Cargo.toml` file of the impacted packages.
41+
42+
### Exemple
43+
44+
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.
45+
46+
## 5. Check the local `fluent-rs` dependencies
47+
48+
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!
49+
50+
### Vetting a dependency
51+
52+
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`.
53+
54+
It can be fixed in the `supply-chain/config.toml` file by bumping the version in the `[[exemptions.type-map]]` to `0.5`.

fluent-bundle/Cargo.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ include = [
2626
]
2727

2828
[dependencies]
29-
fluent-langneg = "0.13"
30-
fluent-syntax = { version = "0.11", path = "../fluent-syntax" }
31-
intl_pluralrules = "7.0.1"
32-
intl-memoizer = { version = "0.5", path = "../intl-memoizer" }
33-
rustc-hash = "1"
29+
fluent-langneg.workspace = true
30+
fluent-syntax.workspace = true
31+
intl_pluralrules.workspace = true
32+
rustc-hash.workspace = true
33+
unic-langid.workspace = true
34+
intl-memoizer = { path = "../intl-memoizer" }
3435
self_cell = "0.10"
3536
smallvec = "1"
36-
unic-langid = "0.9"
3737

3838
[dev-dependencies]
39-
criterion = "0.3"
40-
iai = "0.1"
41-
serde = { version = "1.0", features = ["derive"] }
42-
serde_yaml = "0.8"
39+
criterion.workspace = true
40+
iai.workspace = true
41+
serde = { workspace = true, features = ["derive"]}
42+
unic-langid = { workspace = true, features = ["macros"] }
4343
rand = "0.8"
44-
unic-langid = { version = "0.9", features = ["macros"] }
44+
serde_yaml = "0.8"
4545

4646
[features]
4747
default = []

fluent-cli/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ name = "parser-cli"
2626
path = "src/main.rs"
2727

2828
[dependencies]
29-
annotate-snippets = {version = "0.6", features = ["color"]}
29+
fluent-bundle.workspace = true
30+
fluent-syntax.workspace = true
31+
serde = { workspace = true, features = ["derive"]}
32+
serde_json.workspace = true
33+
annotate-snippets = { version = "0.6", features = ["color"] }
3034
clap = "2.33"
31-
fluent-syntax = "0.11"
32-
fluent-bundle = "0.15"
33-
serde = { version = "1.0", features = ["derive"] }
34-
serde_json = "1.0"

fluent-fallback/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ keywords = ["localization", "l10n", "i18n", "intl", "internationalization"]
1818
categories = ["localization", "internationalization"]
1919

2020
[dependencies]
21-
chunky-vec = "0.1"
22-
fluent-bundle = { version = "0.15.2", path = "../fluent-bundle" }
23-
futures = "0.3"
21+
fluent-bundle.workspace = true
22+
futures.workspace = true
23+
rustc-hash.workspace = true
24+
unic-langid.workspace = true
2425
async-trait = "0.1"
25-
unic-langid = { version = "0.9" }
26+
chunky-vec = "0.1"
2627
once_cell = "1.9"
27-
rustc-hash = "1"
2828

2929
[dev-dependencies]
30-
fluent-langneg = "0.13"
31-
unic-langid = { version = "0.9", features = ["macros"] }
30+
fluent-langneg.workspace = true
31+
unic-langid = { workspace = true, features = ["macros"] }
32+
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
3233
fluent-resmgr = { path = "../fluent-resmgr" }
33-
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }

fluent-resmgr/Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ keywords = ["localization", "l10n", "i18n", "intl", "internationalization"]
1717
categories = ["localization", "internationalization"]
1818

1919
[dependencies]
20-
fluent-bundle = { version = "0.15.2", path = "../fluent-bundle" }
21-
fluent-fallback = { version = "0.7.0", path = "../fluent-fallback" }
22-
unic-langid = "0.9"
20+
fluent-bundle.workspace = true
21+
fluent-fallback.workspace = true
22+
futures.workspace = true
23+
rustc-hash.workspace = true
24+
thiserror.workspace = true
25+
unic-langid.workspace = true
2326
elsa = "1.5"
24-
futures = "0.3"
25-
rustc-hash = "1"
26-
thiserror = "1.0"
2727

2828
[dev-dependencies]
29-
unic-langid = { version = "0.9", features = ["macros"]}
30-
fluent-langneg = "0.13"
29+
fluent-langneg.workspace = true
30+
unic-langid = { workspace = true, features = ["macros"] }

fluent-syntax/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ include = [
2525
]
2626

2727
[dependencies]
28-
serde = { version = "1.0", features = ["derive"], optional = true }
29-
serde_json = { version = "1.0", optional = true }
30-
thiserror = "1.0"
28+
serde = { workspace = true, optional = true, features = ["derive"] }
29+
serde_json = { workspace = true, optional = true }
30+
thiserror.workspace = true
3131

3232
[dev-dependencies]
33-
serde = { version = "1.0", features = ["derive"] }
34-
serde_json = "1.0"
33+
criterion.workspace = true
34+
iai.workspace = true
35+
serde = { workspace = true, features = ["derive"] }
36+
serde_json.workspace = true
3537
glob = "0.3"
36-
criterion = "0.3"
37-
iai = "0.1"
3838

3939
[features]
4040
default = []

fluent-testing/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ include = [
2525
]
2626

2727
[dependencies]
28-
fluent-bundle = { version = "0.15.2", path = "../fluent-bundle" }
29-
fluent-fallback = { version = "0.7.0", path = "../fluent-fallback" }
30-
tokio = { version = "1.0", optional = true, features = ["fs", "rt-multi-thread", "macros", "io-util"] }
28+
fluent-bundle.workspace = true
29+
fluent-fallback.workspace = true
30+
tokio = { workspace = true, optional = true, features = ["fs", "rt-multi-thread", "macros", "io-util"] }
3131

3232
[features]
3333
default = ["sync"]

fluent/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ include = [
2626
]
2727

2828
[dependencies]
29-
fluent-bundle = { version = "0.15", path = "../fluent-bundle" }
30-
unic-langid = "0.9"
31-
fluent-pseudo = { version = "0.3", optional = true }
29+
fluent-bundle.workspace = true
30+
fluent-pseudo = { workspace = true, optional = true }
31+
unic-langid.workspace = true

intl-memoizer/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ include = [
2626
]
2727

2828
[dependencies]
29+
unic-langid.workspace = true
2930
type-map = "0.5"
30-
unic-langid = "0.9"
3131

3232
[dev-dependencies]
33-
intl_pluralrules = "7.0.1"
34-
fluent-langneg = "0.13"
33+
intl_pluralrules.workspace = true
34+
fluent-langneg.workspace = true

0 commit comments

Comments
 (0)