Skip to content

Commit

Permalink
Remove rust-version.workspace = true from published crates (#10292)
Browse files Browse the repository at this point in the history
This comes at the request of dev-hub, where dependencies downstream have
been having issues with our aggressive rust-version policy. Supporting
only the latest rust-version is not enough for them.

As a consequence, we’re removing rust-version here. This sounds like a
more semantically reasonable use for rust-version anyway: a crate
without rust-version set should be assumed to work with the latest
stable version anyway, and maybe more without guarantees… which is
exactly our guarantees.

Also update the themis tool to make sure we don’t make this mistake
again.
  • Loading branch information
Ekleog-NEAR authored Dec 5, 2023
1 parent 71d0ea8 commit 2fcbeb7
Show file tree
Hide file tree
Showing 26 changed files with 12 additions and 29 deletions.
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ repository = "https://github.com/near/nearcore"
license = "MIT OR Apache-2.0"

[workspace.metadata.workspaces]
# shared version of all public crates in the workspace
# Shared version of all public crates in the workspace.
# This is only used for crates that are not stable.
# Most crates are not stable on purpose, as maintaining API compatibility is a
# significant developer time expense. Please think thoroughly before adding
# anything to the list of stable crates.
version = "0.17.0"
exclude = ["neard"]

Expand Down
1 change: 0 additions & 1 deletion chain/chain-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-chain-primitives"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate hosts NEAR chain-related error types"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion chain/chunks-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-chunks-primitives"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate hosts NEAR chunks-related error types"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion chain/client-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-client-primitives"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate hosts NEAR client-related error types"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion chain/indexer-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-indexer-primitives"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate hosts structures for the NEAR Indexer Framework types"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion chain/jsonrpc-primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-jsonrpc-primitives"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate hosts structures for the NEAR JSON RPC Requests, Responses and Error types"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion core/chain-configs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-chain-configs"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate provides typed interfaces to the NEAR Genesis and Chain Configs"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion core/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-crypto"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This is an internal crate for common cryptographic types"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion core/dyn-configs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-dyn-configs"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "Dynamic configure helpers for the near codebase"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion core/o11y/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-o11y"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "Observability helpers for the near codebase"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion core/primitives-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-primitives-core"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate provides the core set of primitives used by other nearcore crates including near-primitives"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion core/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-primitives"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate provides the base set of primitives used by other nearcore crates"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion runtime/near-vm-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-vm-runner"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate implements the specification of the interface that Near blockchain exposes to the smart contracts."
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion runtime/near-vm/compiler-singlepass/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ license = "MIT"
readme = "README.md"
edition = "2021"
publish = true
rust-version.workspace = true

[lints]
workspace = true
Expand Down
1 change: 0 additions & 1 deletion runtime/near-vm/compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ license = "MIT OR Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition = "2021"
publish = true
rust-version.workspace = true

[lints]
workspace = true
Expand Down
1 change: 0 additions & 1 deletion runtime/near-vm/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ license = "MIT OR Apache-2.0 WITH LLVM-exception "
readme = "README.md"
edition = "2021"
publish = true
rust-version.workspace = true

[lints]
workspace = true
Expand Down
1 change: 0 additions & 1 deletion runtime/near-vm/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ license = "MIT OR Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition = "2021"
publish = true
rust-version.workspace = true

[lints]
workspace = true
Expand Down
1 change: 0 additions & 1 deletion runtime/near-vm/vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ license = "MIT OR Apache-2.0 WITH LLVM-exception"
readme = "README.md"
edition = "2021"
publish = true
rust-version.workspace = true

[lints]
workspace = true
Expand Down
1 change: 0 additions & 1 deletion tools/rpctypegen/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-rpc-error-core"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate generates schema for Rust structs which can be used by TypeScript."
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion tools/rpctypegen/macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-rpc-error-macro"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate generates schema for Rust structs which can be used by TypeScript."
repository.workspace = true
license.workspace = true
Expand Down
11 changes: 7 additions & 4 deletions tools/themis/src/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@ pub fn has_publish_spec(workspace: &Workspace) -> anyhow::Result<()> {
Ok(())
}

/// Ensure all crates specify a MSRV if they are publishable
/// Ensure all publishable crates do not both specify version and rust-version as being workspace-wide
pub fn has_rust_version(workspace: &Workspace) -> anyhow::Result<()> {
let outliers: Vec<_> = workspace
.members
.iter()
.filter(|pkg| {
pkg.parsed.rust_version.is_none()
&& pkg.manifest.read(&["package", "publish"]) != Some(&toml::Value::Boolean(false))
pkg.manifest.read(&["package", "publish"]) == Some(&toml::Value::Boolean(true))
&& pkg.manifest.read(&["package", "version", "workspace"])
== Some(&toml::Value::Boolean(true))
&& pkg.manifest.read(&["package", "rust-version", "workspace"])
== Some(&toml::Value::Boolean(true))
})
.map(|pkg| Outlier { path: pkg.parsed.manifest_path.clone(), found: None, extra: None })
.collect();

if !outliers.is_empty() {
bail!(ComplianceError {
msg: "These packages should specify a Minimum Supported Rust Version (MSRV)"
msg: "These publishable packages have Minimum Supported Rust Version (MSRV) and version both set from workspace"
.to_string(),
expected: None,
outliers,
Expand Down
1 change: 0 additions & 1 deletion utils/config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-config-utils"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This is an internal crate to provide utils for reading config files"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion utils/fmt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-fmt"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "Helpers for pretty formatting."
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion utils/near-cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-cache"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "do not use this, new versions can stop being published at literally any time"
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion utils/near-stable-hasher/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-stable-hasher"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "`near-stable-hasher` is a library that is essentially a wrapper around, now deprecated, `std::hash::SipHasher`."
repository.workspace = true
license.workspace = true
Expand Down
1 change: 0 additions & 1 deletion utils/stdx/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name = "near-stdx"
version.workspace = true
authors.workspace = true
edition.workspace = true
rust-version.workspace = true
description = "This crate contains polyfills which should really be in std, but currently aren't for one reason or another."
repository.workspace = true
license.workspace = true
Expand Down

0 comments on commit 2fcbeb7

Please sign in to comment.