Bug 1499196 - Introduce a mozilla-central-workspace-hack crate to unify features seen by rust deps. r=ted,firefox-build-system-reviewers

This is the equivalent of the rustc-workspace-hack used by the rust build to
ensure cargo and RLS see the same set of features for dependencies so that
these dependencies may be reused by invocations of cargo for these two
projects. The trivial crate added specifies the union of the set of
features activated for a particular crate for each time it appears in the
dependency tree so that cargo will understand these dependencies to be
re-usable across cargo implementations. This eliminates re-building jsrust
and some of its dependencies twice, and reduces the number of crates compiled
in the tree by about 90 in testing on linux.

Differential Revision: https://phabricator.services.mozilla.com/D9041

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Chris Manchester 2018-10-18 10:39:05 +00:00
Родитель bc2df2539b
Коммит 4b9fc11dc1
5 изменённых файлов: 83 добавлений и 0 удалений

16
Cargo.lock сгенерированный
Просмотреть файл

@ -1012,6 +1012,7 @@ name = "gkrust"
version = "0.1.0"
dependencies = [
"gkrust-shared 0.1.0",
"mozilla-central-workspace-hack 0.1.0",
"stylo_tests 0.0.1",
]
@ -1223,6 +1224,7 @@ name = "jsrust"
version = "0.1.0"
dependencies = [
"jsrust_shared 0.1.0",
"mozilla-central-workspace-hack 0.1.0",
]
[[package]]
@ -1539,6 +1541,20 @@ name = "moz_cbor"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "mozilla-central-workspace-hack"
version = "0.1.0"
dependencies = [
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.66 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.66 (git+https://github.com/servo/serde?branch=deserialize_from_enums8)",
"syn 0.14.6 (registry+https://github.com/rust-lang/crates.io-index)",
"void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "mozjs_sys"
version = "0.0.0"

Просмотреть файл

@ -0,0 +1,58 @@
[package]
name = "mozilla-central-workspace-hack"
version = "0.1.0"
# This is a hack to help rust code in the tree that are built by different
# invocations of cargo share dependencies rather than rebuilding them. This is
# based on the "rustc-workspace-hack" used by the rustc build system to achieve
# the same. From the description of the issue given there:
#
# "Each time Cargo runs a build it will re-resolve the dependency graph, "
# "notably selecting different features sometimes for each build."
#
# We work around this by specifying the union of the set of features selected
# by dependencies in each cargo invocation for each instance they would differ.
[build-dependencies]
void = { features = ["std", "default"], version = "1.0.2" }
syn = { features = ["extra-traits", "fold", "full"], version = "0.14" }
log = { features = ["release_max_level_info", "release_max_level_warn", "std"], version = "0.4.5" }
serde = { features = ["default", "rc", "serde_derive", "std"], version = "1.0.66" }
serde_derive = { features = ["default", "deserialize_in_place"], version = "1.0.66" }
quote = { features = ["default", "proc-macro"], version = "0.5.2" }
proc-macro2 = { features = ["default", "proc-macro"], version = "0.3.5" }
[target."cfg(windows)".dependencies.winapi]
version = "0.3.6"
features = [
"basetsd",
"consoleapi",
"dwrite",
"dwrite_1",
"dwrite_3",
"errhandlingapi",
"fileapi",
"handleapi",
"hidclass",
"hidpi",
"hidusage",
"libloaderapi",
"memoryapi",
"minwinbase",
"minwindef",
"ntdef",
"ntsecapi",
"ntstatus",
"processenv",
"profileapi",
"setupapi",
"std",
"sysinfoapi",
"timezoneapi",
"unknwnbase",
"winbase",
"wincon",
"winerror",
"winnls",
"winnt"
]

Просмотреть файл

@ -0,0 +1,7 @@
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

Просмотреть файл

@ -10,3 +10,4 @@ path = "lib.rs"
[dependencies]
jsrust_shared = { path = "./shared" }
mozilla-central-workspace-hack = { path = "../../../build/workspace-hack" }

Просмотреть файл

@ -20,6 +20,7 @@ gecko_profiler_parse_elf = ["gkrust-shared/gecko_profiler_parse_elf"]
[dependencies]
gkrust-shared = { path = "shared" }
mozilla-central-workspace-hack = { path = "../../../build/workspace-hack" }
[dev-dependencies]
stylo_tests = { path = "../../../servo/ports/geckolib/tests/" }