Skip to content

Commit

Permalink
Move Cargo.toml workspace configuration to the root of the repo. (#11836
Browse files Browse the repository at this point in the history
)

This allows cargo commands like check/fmt to work from the root of the repo
  • Loading branch information
alex authored Oct 27, 2024
1 parent 45cf761 commit 7a29627
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 62 deletions.
File renamed without changes.
22 changes: 22 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[workspace]
resolver = "2"
members = [
"src/rust/",
"src/rust/cryptography-cffi",
"src/rust/cryptography-keepalive",
"src/rust/cryptography-key-parsing",
"src/rust/cryptography-openssl",
"src/rust/cryptography-x509",
"src/rust/cryptography-x509-verification",
]

[workspace.package]
version = "0.1.0"
authors = ["The cryptography developers <[email protected]>"]
edition = "2021"
publish = false
# This specifies the MSRV
rust-version = "1.65.0"

[profile.release]
overflow-checks = true
75 changes: 36 additions & 39 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,34 +231,33 @@ def rust(session: nox.Session) -> None:
pyproject_data = load_pyproject_toml()
install(session, *pyproject_data["build-system"]["requires"])

with session.chdir("src/rust/"):
session.run("cargo", "fmt", "--all", "--", "--check", external=True)
if session.name != "rust-noclippy":
session.run(
"cargo",
"clippy",
"--all",
"--",
"-D",
"warnings",
external=True,
)

build_output = session.run(
session.run("cargo", "fmt", "--all", "--", "--check", external=True)
if session.name != "rust-noclippy":
session.run(
"cargo",
"test",
"--no-default-features",
"clippy",
"--all",
"--no-run",
"-q",
"--message-format=json",
"--",
"-D",
"warnings",
external=True,
silent=True,
)
session.run(
"cargo", "test", "--no-default-features", "--all", external=True
)

build_output = session.run(
"cargo",
"test",
"--no-default-features",
"--all",
"--no-run",
"-q",
"--message-format=json",
external=True,
silent=True,
)
session.run(
"cargo", "test", "--no-default-features", "--all", external=True
)

# It's None on install-only invocations
if build_output is not None:
assert isinstance(build_output, str)
Expand Down Expand Up @@ -288,18 +287,17 @@ def local(session):
session.run("ruff", "format", ".")
session.run("ruff", "check", ".")

with session.chdir("src/rust/"):
session.run("cargo", "fmt", "--all", external=True)
session.run("cargo", "check", "--all", "--tests", external=True)
session.run(
"cargo",
"clippy",
"--all",
"--",
"-D",
"warnings",
external=True,
)
session.run("cargo", "fmt", "--all", external=True)
session.run("cargo", "check", "--all", "--tests", external=True)
session.run(
"cargo",
"clippy",
"--all",
"--",
"-D",
"warnings",
external=True,
)

session.run(
"mypy",
Expand Down Expand Up @@ -331,10 +329,9 @@ def local(session):
*tests,
)

with session.chdir("src/rust/"):
session.run(
"cargo", "test", "--no-default-features", "--all", external=True
)
session.run(
"cargo", "test", "--no-default-features", "--all", external=True
)


LCOV_SOURCEFILE_RE = re.compile(
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ include = [
"src/_cffi_src/**/*.c",
"src/_cffi_src/**/*.h",

"src/rust/**/Cargo.toml",
"src/rust/**/Cargo.lock",
"**/Cargo.toml",
"**/Cargo.lock",
"src/rust/**/*.rs",

"tests/**/*.py",
Expand Down
21 changes: 0 additions & 21 deletions src/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
[workspace.package]
version = "0.1.0"
authors = ["The cryptography developers <[email protected]>"]
edition = "2021"
publish = false
# This specifies the MSRV
rust-version = "1.65.0"

[package]
name = "cryptography-rust"
version.workspace = true
Expand Down Expand Up @@ -39,18 +31,5 @@ default = ["extension-module"]
name = "cryptography_rust"
crate-type = ["cdylib"]

[profile.release]
overflow-checks = true

[workspace]
members = [
"cryptography-cffi",
"cryptography-keepalive",
"cryptography-key-parsing",
"cryptography-openssl",
"cryptography-x509",
"cryptography-x509-verification",
]

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(CRYPTOGRAPHY_OPENSSL_300_OR_GREATER)', 'cfg(CRYPTOGRAPHY_OPENSSL_320_OR_GREATER)', 'cfg(CRYPTOGRAPHY_IS_LIBRESSL)', 'cfg(CRYPTOGRAPHY_IS_BORINGSSL)', 'cfg(CRYPTOGRAPHY_OSSLCONF, values("OPENSSL_NO_IDEA", "OPENSSL_NO_CAST", "OPENSSL_NO_BF", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_SEED", "OPENSSL_NO_SM4"))'] }

0 comments on commit 7a29627

Please sign in to comment.