Skip to content
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
merged 4 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,21 @@ members = [
exclude = [
"fluent-cli",
]

[workspace.dependencies]
criterion = "0.3"
fluent-langneg = "0.13"
Copy link
Member

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?

Copy link
Collaborator

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!

futures = "0.3"
iai = "0.1"
intl_pluralrules = "7.0.1"
rustc-hash = "1"
serde = "1.0"
serde_json = "1.0"
thiserror = "1.0"
tokio = "1.0"
unic-langid = "0.9"

fluent-bundle = { path = "fluent-bundle" }
fluent-fallback = { path = "fluent-fallback" }
fluent-pseudo = { path = "fluent-pseudo" }
fluent-syntax = { path = "fluent-syntax" }
54 changes: 54 additions & 0 deletions docs/local-testing-firefox.md
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&regexp=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`.
22 changes: 11 additions & 11 deletions fluent-bundle/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ include = [
]

[dependencies]
fluent-langneg = "0.13"
fluent-syntax = { version = "0.11", path = "../fluent-syntax" }
intl_pluralrules = "7.0.1"
intl-memoizer = { version = "0.5", path = "../intl-memoizer" }
rustc-hash = "1"
fluent-langneg.workspace = true
fluent-syntax.workspace = true
intl_pluralrules.workspace = true
rustc-hash.workspace = true
unic-langid.workspace = true
intl-memoizer = { path = "../intl-memoizer" }
self_cell = "0.10"
smallvec = "1"
unic-langid = "0.9"

[dev-dependencies]
criterion = "0.3"
iai = "0.1"
serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.8"
criterion.workspace = true
iai.workspace = true
serde = { workspace = true, features = ["derive"]}
unic-langid = { workspace = true, features = ["macros"] }
rand = "0.8"
unic-langid = { version = "0.9", features = ["macros"] }
serde_yaml = "0.8"

[features]
default = []
Expand Down
10 changes: 5 additions & 5 deletions fluent-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ name = "parser-cli"
path = "src/main.rs"

[dependencies]
annotate-snippets = {version = "0.6", features = ["color"]}
fluent-bundle.workspace = true
fluent-syntax.workspace = true
serde = { workspace = true, features = ["derive"]}
serde_json.workspace = true
annotate-snippets = { version = "0.6", features = ["color"] }
clap = "2.33"
fluent-syntax = "0.11"
fluent-bundle = "0.15"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
16 changes: 8 additions & 8 deletions fluent-fallback/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ keywords = ["localization", "l10n", "i18n", "intl", "internationalization"]
categories = ["localization", "internationalization"]

[dependencies]
chunky-vec = "0.1"
fluent-bundle = { version = "0.15.2", path = "../fluent-bundle" }
futures = "0.3"
fluent-bundle.workspace = true
futures.workspace = true
rustc-hash.workspace = true
unic-langid.workspace = true
async-trait = "0.1"
unic-langid = { version = "0.9" }
chunky-vec = "0.1"
once_cell = "1.9"
rustc-hash = "1"

[dev-dependencies]
fluent-langneg = "0.13"
unic-langid = { version = "0.9", features = ["macros"] }
fluent-langneg.workspace = true
unic-langid = { workspace = true, features = ["macros"] }
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
fluent-resmgr = { path = "../fluent-resmgr" }
tokio = { version = "1.0", features = ["rt-multi-thread", "macros"] }
16 changes: 8 additions & 8 deletions fluent-resmgr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The 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"] }
14 changes: 7 additions & 7 deletions fluent-syntax/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ include = [
]

[dependencies]
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
thiserror = "1.0"
serde = { workspace = true, optional = true, features = ["derive"] }
serde_json = { workspace = true, optional = true }
thiserror.workspace = true

[dev-dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
criterion.workspace = true
iai.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_json.workspace = true
glob = "0.3"
criterion = "0.3"
iai = "0.1"

[features]
default = []
Expand Down
6 changes: 3 additions & 3 deletions fluent-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ include = [
]

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

[features]
default = ["sync"]
Expand Down
6 changes: 3 additions & 3 deletions fluent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ include = [
]

[dependencies]
fluent-bundle = { version = "0.15", path = "../fluent-bundle" }
unic-langid = "0.9"
fluent-pseudo = { version = "0.3", optional = true }
fluent-bundle.workspace = true
fluent-pseudo = { workspace = true, optional = true }
unic-langid.workspace = true
6 changes: 3 additions & 3 deletions intl-memoizer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ include = [
]

[dependencies]
unic-langid.workspace = true
type-map = "0.5"
unic-langid = "0.9"

[dev-dependencies]
intl_pluralrules = "7.0.1"
fluent-langneg = "0.13"
intl_pluralrules.workspace = true
fluent-langneg.workspace = true