Remove solana-crate-features
This commit is contained in:
parent
a0d490d98e
commit
0937e407fa
|
@ -206,7 +206,6 @@ dependencies = [
|
|||
"miniz_oxide",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -519,7 +518,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"either",
|
||||
"iovec",
|
||||
]
|
||||
|
||||
|
@ -1157,7 +1155,6 @@ version = "1.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4620d40f6d2601794401d6dd95a5cf69b6c157852539470eeda433a99b3c0efc"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"signature",
|
||||
]
|
||||
|
||||
|
@ -1171,7 +1168,6 @@ dependencies = [
|
|||
"ed25519",
|
||||
"rand 0.7.3",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"sha2",
|
||||
"zeroize",
|
||||
]
|
||||
|
@ -2236,9 +2232,6 @@ name = "lazy_static"
|
|||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazycell"
|
||||
|
@ -4717,28 +4710,6 @@ dependencies = [
|
|||
"trees",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-crate-features"
|
||||
version = "1.9.0"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes 0.4.12",
|
||||
"cc",
|
||||
"curve25519-dalek 3.2.0",
|
||||
"ed25519-dalek",
|
||||
"either",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"regex-syntax",
|
||||
"reqwest",
|
||||
"ring",
|
||||
"serde",
|
||||
"syn 0.15.44",
|
||||
"syn 1.0.81",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-dos"
|
||||
version = "1.9.0"
|
||||
|
@ -5650,7 +5621,6 @@ dependencies = [
|
|||
"serde_json",
|
||||
"sha2",
|
||||
"sha3",
|
||||
"solana-crate-features",
|
||||
"solana-frozen-abi 1.9.0",
|
||||
"solana-frozen-abi-macro 1.9.0",
|
||||
"solana-logger 1.9.0",
|
||||
|
|
|
@ -87,6 +87,3 @@ exclude = [
|
|||
# dependency is supported on Apple M1. v2 of the feature resolver is needed to
|
||||
# specify arch-specific features.
|
||||
resolver = "2"
|
||||
|
||||
[profile.dev]
|
||||
split-debuginfo = "unpacked"
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
/target/
|
||||
/farf/
|
|
@ -1,44 +0,0 @@
|
|||
From 64514728f549719b8b42af1570404d5f51730e8c Mon Sep 17 00:00:00 2001
|
||||
From: Michael Vines <mvines@gmail.com>
|
||||
Date: Fri, 13 Sep 2019 17:34:43 -0700
|
||||
Subject: [PATCH] Print package features
|
||||
|
||||
---
|
||||
src/cargo/core/compiler/context/compilation_files.rs | 8 ++++++++
|
||||
src/cargo/core/compiler/fingerprint.rs | 2 +-
|
||||
2 files changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cargo/core/compiler/context/compilation_files.rs b/src/cargo/core/compiler/context/compilation_files.rs
|
||||
index ed3232ea..c98da4ca 100644
|
||||
--- a/src/cargo/core/compiler/context/compilation_files.rs
|
||||
+++ b/src/cargo/core/compiler/context/compilation_files.rs
|
||||
@@ -591,5 +591,13 @@ fn compute_metadata<'a, 'cfg>(
|
||||
if let Ok(ref channel) = __cargo_default_lib_metadata {
|
||||
channel.hash(&mut hasher);
|
||||
}
|
||||
+
|
||||
+ eprintln!(
|
||||
+ "package {}: {} #{} features={:?}",
|
||||
+ unit.pkg.package_id(),
|
||||
+ unit.target,
|
||||
+ hasher.finish(),
|
||||
+ bcx.resolve.features_sorted(unit.pkg.package_id()),
|
||||
+ );
|
||||
Some(Metadata(hasher.finish()))
|
||||
}
|
||||
diff --git a/src/cargo/core/compiler/fingerprint.rs b/src/cargo/core/compiler/fingerprint.rs
|
||||
index 3738bcdd..de78ffb4 100644
|
||||
--- a/src/cargo/core/compiler/fingerprint.rs
|
||||
+++ b/src/cargo/core/compiler/fingerprint.rs
|
||||
@@ -830,7 +830,7 @@ impl Fingerprint {
|
||||
// for a discussion of why it's `>` see the discussion about #5918
|
||||
// below in `find_stale`.
|
||||
if dep_mtime > max_mtime {
|
||||
- log::info!("dependency on `{}` is newer than we are", dep.name);
|
||||
+ eprintln!("dependency on `{}` is newer than we are", dep.name);
|
||||
return Ok(());
|
||||
}
|
||||
}
|
||||
--
|
||||
2.20.1 (Apple Git-117)
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
[package]
|
||||
name = "solana-crate-features"
|
||||
version = "1.9.0"
|
||||
description = "Solana Crate Features"
|
||||
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
homepage = "https://solana.com/"
|
||||
documentation = "https://docs.rs/solana-crate-features"
|
||||
license = "Apache-2.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
backtrace = { version = "0.3.33", features = ["serialize-serde"] }
|
||||
bytes = { version = "0.4.12", features = ["either"] }
|
||||
cc = { version = "1.0.67", features = ["jobserver", "parallel"]}
|
||||
curve25519-dalek = { version = "3" }
|
||||
either= { version = "1.5.2" }
|
||||
lazy_static = { version = "1.4.0", features = ["spin", "spin_no_std"] }
|
||||
libc = { version = "0.2.62", features = ["extra_traits"] }
|
||||
rand_chacha = { version = "0.2.2" }
|
||||
regex-syntax = { version = "0.6.12" }
|
||||
serde = { version = "1.0.100", features = ["rc"] }
|
||||
ed25519-dalek = { version = "=1.0.1", features = ["serde"] }
|
||||
syn_0_15 = { package = "syn", version = "0.15.42", features = ["extra-traits", "fold", "full"] }
|
||||
syn_1_0 = { package = "syn", version = "1.0.3", features = ["extra-traits", "fold", "full"] }
|
||||
winapi = { version = "0.3.8", features=["basetsd", "consoleapi", "errhandlingapi", "fileapi", "handleapi", "impl-debug", "impl-default", "knownfolders", "libloaderapi", "memoryapi", "minwinbase", "minwindef", "ntdef", "ntsecapi", "ntstatus", "objbase", "processenv", "processthreadsapi", "profileapi", "shlobj", "std", "synchapi", "sysinfoapi", "timezoneapi", "utilapiset", "winbase", "wincon", "windef", "winerror", "winnls", "winnt", "winreg", "winsock2", "winuser", "ws2def", "ws2ipdef", "ws2tcpip", "wtypesbase"] }
|
||||
|
||||
|
||||
[target.'cfg(not(target_family = "wasm"))'.dependencies]
|
||||
reqwest = { version = "0.11.2", default-features = false, features = ["blocking", "rustls-tls", "json"] }
|
||||
ring = { version = "0.16.17" }
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
|
@ -1,58 +0,0 @@
|
|||
|
||||
Cargo (as of 1.37) does not nicely handle the scenario where features of a
|
||||
dependent crate of multiple other crates in the tree vary.
|
||||
|
||||
To illustrate the problem consider crates A, B and C arranged as follows:
|
||||
* Crate A and B are both members of a Cargo virtual manifest
|
||||
* Crate C provides two features, F1 and F2
|
||||
* Crate A requests feature F1 of C, crate B requests F2 of C
|
||||
|
||||
When crate A and B are built together, `cargo` builds C with both feature F1 and
|
||||
F2 enabled (the union of all enabled features). However when A or B are built
|
||||
individually, `cargo` builds C with only feature F1 or F2 enabled.
|
||||
|
||||
Unfortunately in all these cases, `cargo` will build crate C in the same target
|
||||
location and the outputs for C will be recreated every time the features for crate C
|
||||
change.
|
||||
|
||||
From a clean workspace, building A individually first will cause C to be built
|
||||
as expected. Then build B individually and C will be re-built because F2 was
|
||||
enabled instead of F1. Now rebuild A and observe that C will be re-built again
|
||||
because F1 was re-enabled.
|
||||
|
||||
In practice this problem is much less obvious as both A and B likely to not have
|
||||
a direct dependency on C, indirectly causing rebuilds of numerous other crates as well.
|
||||
|
||||
The `solana-crate-features` offers a workaround to this "feature thrashing"
|
||||
problem by explicitly declaring all "C-like crates" with the union of all features
|
||||
that any other crate in the tree (either explicitly or implicitly) enable. All
|
||||
crates in the Solana source tree should depend on `solana-crate-features`.
|
||||
|
||||
### Adding new dependent crates
|
||||
When unnecessary `cargo` rebuilds are observed, the first step is to figure what
|
||||
dependent crate is suffering from feature thrashing.
|
||||
|
||||
This information is not readily available from the stock `cargo` program, so use
|
||||
the following steps to produce a custom `cargo` program that will output the
|
||||
necessary feature information to stderr during a build:
|
||||
```bash
|
||||
$ git clone git@github.com:rust-lang/cargo.git -b rust-1.38.0
|
||||
$ cd cargo
|
||||
$ git apply 0001-Print-package-features.patch
|
||||
$ cargo build
|
||||
$ mv ~/.cargo/bin/cargo ~/.cargo/bin/cargo.org
|
||||
$ cp ./target/debug/cargo ~/.cargo/bin/cargo
|
||||
```
|
||||
|
||||
Rebuild with the custom `cargo` and search for indications of crates getting
|
||||
built with different features (repeated runs of `./scripts/cargo-install-all.sh`
|
||||
work great for this). When the problematic crate is identified, add it as a
|
||||
dependency of `solana-crate-features` with the union of all observed enabled
|
||||
features for that crate.
|
||||
|
||||
### Appendix
|
||||
This command will enable some additional cargo log output that can help debug
|
||||
dependency problems as well:
|
||||
```bash
|
||||
export CARGO_LOG=cargo::core::compiler::fingerprint=info
|
||||
```
|
|
@ -1 +0,0 @@
|
|||
|
|
@ -132,7 +132,6 @@ dependencies = [
|
|||
"libc",
|
||||
"object",
|
||||
"rustc-demangle",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -319,17 +318,6 @@ version = "1.4.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "0.4.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c"
|
||||
dependencies = [
|
||||
"byteorder 1.4.3",
|
||||
"either",
|
||||
"iovec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytes"
|
||||
version = "0.5.4"
|
||||
|
@ -726,7 +714,6 @@ version = "1.0.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf038a7b6fd7ef78ad3348b63f3a17550877b0e28f8d68bcc94894d1412158bc"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"signature",
|
||||
]
|
||||
|
||||
|
@ -740,7 +727,6 @@ dependencies = [
|
|||
"ed25519",
|
||||
"rand 0.7.3",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"sha2",
|
||||
"zeroize",
|
||||
]
|
||||
|
@ -1338,15 +1324,6 @@ dependencies = [
|
|||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iovec"
|
||||
version = "0.1.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.3.0"
|
||||
|
@ -1421,9 +1398,6 @@ name = "lazy_static"
|
|||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
dependencies = [
|
||||
"spin",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
|
@ -3038,28 +3012,6 @@ dependencies = [
|
|||
"solana-sdk",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-crate-features"
|
||||
version = "1.9.0"
|
||||
dependencies = [
|
||||
"backtrace",
|
||||
"bytes 0.4.12",
|
||||
"cc",
|
||||
"curve25519-dalek 3.2.0",
|
||||
"ed25519-dalek",
|
||||
"either",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"rand_chacha 0.2.2",
|
||||
"regex-syntax",
|
||||
"reqwest",
|
||||
"ring",
|
||||
"serde",
|
||||
"syn 0.15.44",
|
||||
"syn 1.0.67",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "solana-faucet"
|
||||
version = "1.9.0"
|
||||
|
@ -3449,7 +3401,6 @@ dependencies = [
|
|||
"serde_json",
|
||||
"sha2",
|
||||
"sha3",
|
||||
"solana-crate-features",
|
||||
"solana-frozen-abi 1.9.0",
|
||||
"solana-frozen-abi-macro 1.9.0",
|
||||
"solana-logger 1.9.0",
|
||||
|
|
|
@ -31,7 +31,6 @@ full = [
|
|||
"ed25519-dalek",
|
||||
"ed25519-dalek-bip32",
|
||||
"solana-logger",
|
||||
"solana-crate-features",
|
||||
"libsecp256k1",
|
||||
"sha3",
|
||||
"digest",
|
||||
|
@ -72,7 +71,6 @@ serde_derive = "1.0.103"
|
|||
serde_json = { version = "1.0.72", optional = true }
|
||||
sha2 = "0.9.8"
|
||||
sha3 = { version = "0.9.1", optional = true }
|
||||
solana-crate-features = { path = "../crate-features", version = "=1.9.0", optional = true }
|
||||
solana-logger = { path = "../logger", version = "=1.9.0", optional = true }
|
||||
solana-frozen-abi = { path = "../frozen-abi", version = "=1.9.0" }
|
||||
solana-frozen-abi-macro = { path = "../frozen-abi/macro", version = "=1.9.0" }
|
||||
|
|
Loading…
Reference in New Issue