remove anyhow dep from build.rs
This commit is contained in:
parent
9242cbb09e
commit
310886f2ca
|
@ -18,5 +18,4 @@ serde = { version = "1", features = ["derive"] }
|
|||
tokio = { version = "1", features = ["rt-multi-thread"] }
|
||||
|
||||
[build-dependencies]
|
||||
anyhow = "1"
|
||||
zip = { version = "0.6", default-features = false, features = ["deflate"] }
|
||||
|
|
24
build.rs
24
build.rs
|
@ -1,31 +1,33 @@
|
|||
use anyhow::{ensure, Result};
|
||||
use std::fs::File;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use zip::ZipWriter;
|
||||
|
||||
fn main() -> Result<()> {
|
||||
fn main() {
|
||||
let out_dir = PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
|
||||
|
||||
let output = Command::new("cargo")
|
||||
.args(["package", "--list", "--allow-dirty"])
|
||||
.output()?;
|
||||
ensure!(output.status.success(), "unsuccessful");
|
||||
.output()
|
||||
.unwrap();
|
||||
if !output.status.success() {
|
||||
panic!("cargo package failed");
|
||||
}
|
||||
|
||||
let mut writer = ZipWriter::new(File::create(out_dir.join("source.zip"))?);
|
||||
for path in String::from_utf8(output.stdout)?.lines() {
|
||||
let mut writer = ZipWriter::new(File::create(out_dir.join("source.zip")).unwrap());
|
||||
for path in String::from_utf8(output.stdout).unwrap().lines() {
|
||||
if path == "Cargo.toml.orig" {
|
||||
continue;
|
||||
}
|
||||
|
||||
writer.start_file(path, Default::default())?;
|
||||
writer.start_file(path, Default::default()).unwrap();
|
||||
io::copy(
|
||||
&mut File::open(Path::new(env!("CARGO_MANIFEST_DIR")).join(path))?,
|
||||
&mut File::open(Path::new(env!("CARGO_MANIFEST_DIR")).join(path)).unwrap(),
|
||||
&mut writer,
|
||||
)?;
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
writer.finish()?;
|
||||
Ok(())
|
||||
writer.finish().unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue