diff --git a/src/rust/Cargo.lock b/Cargo.lock similarity index 100% rename from src/rust/Cargo.lock rename to Cargo.lock diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 000000000000..05bc91caa1fd --- /dev/null +++ b/Cargo.toml @@ -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 "] +edition = "2021" +publish = false +# This specifies the MSRV +rust-version = "1.65.0" + +[profile.release] +overflow-checks = true diff --git a/noxfile.py b/noxfile.py index 912e79b6b6bb..93ac329a0001 100644 --- a/noxfile.py +++ b/noxfile.py @@ -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) @@ -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", @@ -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( diff --git a/pyproject.toml b/pyproject.toml index 28eb931e507f..2e17f895f57c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index f990fb84f513..92064793e1cd 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -1,11 +1,3 @@ -[workspace.package] -version = "0.1.0" -authors = ["The cryptography developers "] -edition = "2021" -publish = false -# This specifies the MSRV -rust-version = "1.65.0" - [package] name = "cryptography-rust" version.workspace = true @@ -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"))'] }