mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 21:43:37 +00:00
Package release artifacts as ZIP
This commit is contained in:
parent
643bc02ded
commit
34bc240e94
4 changed files with 86 additions and 1 deletions
47
Cargo.lock
generated
47
Cargo.lock
generated
|
@ -112,6 +112,12 @@ version = "1.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "byteorder"
|
||||||
|
version = "1.4.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "camino"
|
name = "camino"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
|
@ -1775,6 +1781,33 @@ dependencies = [
|
||||||
"tikv-jemalloc-sys",
|
"tikv-jemalloc-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time"
|
||||||
|
version = "0.3.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
|
||||||
|
dependencies = [
|
||||||
|
"itoa",
|
||||||
|
"serde",
|
||||||
|
"time-core",
|
||||||
|
"time-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-core"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-macros"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2"
|
||||||
|
dependencies = [
|
||||||
|
"time-core",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tinyvec"
|
name = "tinyvec"
|
||||||
version = "1.6.0"
|
version = "1.6.0"
|
||||||
|
@ -2173,4 +2206,18 @@ dependencies = [
|
||||||
"write-json",
|
"write-json",
|
||||||
"xflags",
|
"xflags",
|
||||||
"xshell",
|
"xshell",
|
||||||
|
"zip",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zip"
|
||||||
|
version = "0.6.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "537ce7411d25e54e8ae21a7ce0b15840e7bfcff15b51d697ec3266cc76bdf080"
|
||||||
|
dependencies = [
|
||||||
|
"byteorder",
|
||||||
|
"crc32fast",
|
||||||
|
"crossbeam-utils",
|
||||||
|
"flate2",
|
||||||
|
"time",
|
||||||
]
|
]
|
||||||
|
|
|
@ -194,6 +194,7 @@ MIT OR Apache-2.0
|
||||||
MIT OR Apache-2.0 OR Zlib
|
MIT OR Apache-2.0 OR Zlib
|
||||||
MIT OR Zlib OR Apache-2.0
|
MIT OR Zlib OR Apache-2.0
|
||||||
MIT/Apache-2.0
|
MIT/Apache-2.0
|
||||||
|
Unlicense OR MIT
|
||||||
Unlicense/MIT
|
Unlicense/MIT
|
||||||
Zlib OR Apache-2.0 OR MIT
|
Zlib OR Apache-2.0 OR MIT
|
||||||
"
|
"
|
||||||
|
|
|
@ -12,4 +12,5 @@ flate2 = "1.0.24"
|
||||||
write-json = "0.1.2"
|
write-json = "0.1.2"
|
||||||
xshell = "0.2.2"
|
xshell = "0.2.2"
|
||||||
xflags = "0.3.0"
|
xflags = "0.3.0"
|
||||||
|
zip = { version = "0.6", default-features = false, features = ["deflate", "time"] }
|
||||||
# Avoid adding more dependencies to this crate
|
# Avoid adding more dependencies to this crate
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
use std::{
|
use std::{
|
||||||
env,
|
env,
|
||||||
fs::File,
|
fs::File,
|
||||||
io,
|
io::{self, BufWriter},
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
use flate2::{write::GzEncoder, Compression};
|
use flate2::{write::GzEncoder, Compression};
|
||||||
use xshell::{cmd, Shell};
|
use xshell::{cmd, Shell};
|
||||||
|
use zip::{write::FileOptions, DateTime, ZipWriter};
|
||||||
|
|
||||||
use crate::{date_iso, flags, project_root};
|
use crate::{date_iso, flags, project_root};
|
||||||
|
|
||||||
|
@ -89,6 +90,9 @@ fn dist_server(sh: &Shell, release: &str, target: &Target) -> anyhow::Result<()>
|
||||||
|
|
||||||
let dst = Path::new("dist").join(&target.artifact_name);
|
let dst = Path::new("dist").join(&target.artifact_name);
|
||||||
gzip(&target.server_path, &dst.with_extension("gz"))?;
|
gzip(&target.server_path, &dst.with_extension("gz"))?;
|
||||||
|
if target_name.contains("-windows-") {
|
||||||
|
zip(&target.server_path, target.symbols_path.as_ref(), &dst.with_extension("zip"))?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -101,6 +105,38 @@ fn gzip(src_path: &Path, dest_path: &Path) -> anyhow::Result<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn zip(src_path: &Path, symbols_path: Option<&PathBuf>, dest_path: &Path) -> anyhow::Result<()> {
|
||||||
|
let file = File::create(dest_path)?;
|
||||||
|
let mut writer = ZipWriter::new(BufWriter::new(file));
|
||||||
|
writer.start_file(
|
||||||
|
src_path.file_name().unwrap().to_str().unwrap(),
|
||||||
|
FileOptions::default()
|
||||||
|
.last_modified_time(
|
||||||
|
DateTime::from_time(std::fs::metadata(src_path)?.modified()?.into()).unwrap(),
|
||||||
|
)
|
||||||
|
.unix_permissions(0o755)
|
||||||
|
.compression_method(zip::CompressionMethod::Deflated)
|
||||||
|
.compression_level(Some(9)),
|
||||||
|
)?;
|
||||||
|
let mut input = io::BufReader::new(File::open(src_path)?);
|
||||||
|
io::copy(&mut input, &mut writer)?;
|
||||||
|
if let Some(symbols_path) = symbols_path {
|
||||||
|
writer.start_file(
|
||||||
|
symbols_path.file_name().unwrap().to_str().unwrap(),
|
||||||
|
FileOptions::default()
|
||||||
|
.last_modified_time(
|
||||||
|
DateTime::from_time(std::fs::metadata(src_path)?.modified()?.into()).unwrap(),
|
||||||
|
)
|
||||||
|
.compression_method(zip::CompressionMethod::Deflated)
|
||||||
|
.compression_level(Some(9)),
|
||||||
|
)?;
|
||||||
|
let mut input = io::BufReader::new(File::open(symbols_path)?);
|
||||||
|
io::copy(&mut input, &mut writer)?;
|
||||||
|
}
|
||||||
|
writer.finish()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
struct Target {
|
struct Target {
|
||||||
name: String,
|
name: String,
|
||||||
server_path: PathBuf,
|
server_path: PathBuf,
|
||||||
|
|
Loading…
Reference in a new issue