
* add appveyor, travis, remove libsnark as default, add push to gh * fix appveyor * change appveyor to nightly * use cargo for build job * change to build everywhere * update token, reduce targets * add more targets * add on liner script * remove rustc dep * add need_cmd * add check cmd * simple brackets * use check_cmd for curl * copy stdlib to OUT_DIR * ship stdlib in archive * install stdlib, give PATH hints after build script * clean * comment * scripts: ensure one-liner install script works with FreeBSD * remove appveyor for now * clean, remove windows, remove appveyor, remove travis test * put back cross install * fix stdlib test generation * disable tests in travis * restore test script to prevent tests to run.. * change scripts to keep same behaviour now that libsnark is disabled by default * update docs with installer * change docker to dockerhub * change repo
55 lines
1.3 KiB
Rust
55 lines
1.3 KiB
Rust
use fs_extra::copy_items;
|
|
use fs_extra::dir::CopyOptions;
|
|
use std::env;
|
|
use std::fs::File;
|
|
use std::io::Write;
|
|
use std::path::{Path, PathBuf};
|
|
|
|
fn main() {
|
|
// export stdlib folder to OUT_DIR
|
|
export_stdlib();
|
|
|
|
// generate tests
|
|
write_tests();
|
|
}
|
|
|
|
fn export_stdlib() {
|
|
let out_dir = env::var("OUT_DIR").unwrap();
|
|
let mut options = CopyOptions::new();
|
|
options.overwrite = true;
|
|
copy_items(&vec!["stdlib"], out_dir, &options).unwrap();
|
|
}
|
|
|
|
fn write_tests() {
|
|
use glob::glob;
|
|
|
|
let out_dir = env::var("OUT_DIR").unwrap();
|
|
let destination = Path::new(&out_dir).join("tests.rs");
|
|
let mut test_file = File::create(&destination).unwrap();
|
|
|
|
for directory in glob("./tests/bench/**/*.json").unwrap() {
|
|
write_test(&mut test_file, &directory.unwrap());
|
|
}
|
|
}
|
|
|
|
fn write_test(test_file: &mut File, test_path: &PathBuf) {
|
|
let test_name = format!(
|
|
"test_{}",
|
|
test_path
|
|
.strip_prefix("tests/bench")
|
|
.unwrap()
|
|
.display()
|
|
.to_string()
|
|
.replace("/", "_")
|
|
.replace(".json", "")
|
|
.replace(".", "")
|
|
);
|
|
|
|
write!(
|
|
test_file,
|
|
include_str!("./tests/test_template"),
|
|
test_name = test_name,
|
|
test_path = test_path.display()
|
|
)
|
|
.unwrap();
|
|
}
|