Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run cargo-deny at build (experimental/proposal) #148

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Expand Up @@ -5,4 +5,5 @@ members = [
"foreign-service",
"test-logger",
"test-web-console-mock",
"springql-build",
]
3 changes: 3 additions & 0 deletions deny.toml
Expand Up @@ -106,6 +106,9 @@ exceptions = [
# Each entry is the crate and version constraint, and its specific allow
# list
#{ allow = ["Zlib"], name = "adler32", version = "*" },

# used on build-dependencies, no code to include in this repo
{allow=["CC0-1.0"] , name="dunce"}
]

# Some crates don't have (easily) machine readable licensing information,
Expand Down
11 changes: 11 additions & 0 deletions springql-build/Cargo.toml
@@ -0,0 +1,11 @@
[package]
name = "springql-build"
version = "0.1.0"
edition = "2021"
license="MIT OR Apache-2.0"

[dependencies]

[build-dependencies]
anyhow = "1.0.57"
run_script = "0.9.0"
29 changes: 29 additions & 0 deletions springql-build/build.rs
@@ -0,0 +1,29 @@
use std::path::PathBuf;

use anyhow::Result;
use run_script::ScriptOptions;

fn main() -> Result<()> {
let mut options = ScriptOptions::new();
options.working_directory = Some(PathBuf::from(std::env::var("CARGO_MANIFEST_DIR")?));
let args = vec![];
let (code, output, error) = run_script::run(
r#"
WORKSPACE_MANIFEST=$(cargo locate-project --workspace | jq -r '.root')
WORKSPACE_DIR=$(dirname ${WORKSPACE_MANIFEST})
cd ${WORKSPACE_DIR}
cargo deny check
"#,
&args,
&options,
)
.unwrap();
if code != 0 {
eprintln!("==== STDOUT: cargo deny check ");
eprintln!("{0}", output);
eprintln!("==== STDERR: cargo deny check ");
eprintln!("{0}", error);
panic!("`cargo deny check` failed code={0}", code);
}
Ok(())
}
1 change: 1 addition & 0 deletions springql-build/src/lib.rs
@@ -0,0 +1 @@
// this crate is a build script crate. dont have any lib code.
3 changes: 3 additions & 0 deletions springql-core/Cargo.toml
Expand Up @@ -59,3 +59,6 @@ regex = "1.5"
float-cmp = "0.9"

tempfile = "3.3"

[build-dependencies]
springql-build = {path = "../springql-build"}