Skip to content

Commit

Permalink
Merge pull request #140 from gimli-rs/smaller-dist-package
Browse files Browse the repository at this point in the history
Don't include tests and AFL seeds in distributed package
  • Loading branch information
fitzgen authored May 11, 2018
2 parents 383444e + 6ecc777 commit b4c18bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ build = "build.rs"
categories = ["development-tools::debugging", "development-tools::ffi"]
description = "A crate for demangling C++ symbols"
documentation = "https://docs.rs/cpp_demangle"
exclude = ["tests/**", "in/**"]
keywords = ["demangle", "symbolicate", "c-plus-plus", "itanium"]
license = "Apache-2.0/MIT"
name = "cpp_demangle"
Expand Down
14 changes: 13 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ use std::io::Read;

let mut in_dir = get_crate_dir()?;
in_dir.push("in");
assert!(in_dir.is_dir());
if !in_dir.is_dir() {
// We are in `cargo publish` and the `in/` directory isn't included in
// the distributed package.
return Ok(());
}

let entries = fs::read_dir(in_dir)?;

Expand Down Expand Up @@ -104,6 +108,14 @@ fn test_afl_seed_{}() {{
fn generate_compatibility_tests_from_libiberty() -> io::Result<()> {
println!("cargo:rerun-if-changed=tests/libiberty-demangle-expected");

let mut tests_dir = get_crate_dir()?;
tests_dir.push("tests");
if !tests_dir.is_dir() {
// We are in `cargo publish` and the `in/` directory isn't included in
// the distributed package.
return Ok(());
}

let test_path = get_test_path("libiberty.rs")?;
let _ = fs::remove_file(&test_path);
let mut test_file = fs::File::create(test_path)?;
Expand Down

0 comments on commit b4c18bd

Please sign in to comment.