Skip to content

Commit

Permalink
run cargo deny check on build
Browse files Browse the repository at this point in the history
  • Loading branch information
kazuk committed May 20, 2022
1 parent 8b2cbf8 commit 11e9e58
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ regex = "1.5"
float-cmp = "0.9"

tempfile = "3.3"

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

0 comments on commit 11e9e58

Please sign in to comment.