mirror of
https://github.com/GreptimeTeam/greptimedb.git
synced 2025-12-22 22:20:02 +00:00
build: Download assets to cargo output dir (#1476)
* build: Download assets to cargo output dir Also remove the output from the build script and only print the output on failure * chore: Update src/servers/build.rs Co-authored-by: Ruihang Xia <waynestxia@gmail.com> * build: replace pushd by cd --------- Co-authored-by: Ruihang Xia <waynestxia@gmail.com>
This commit is contained in:
@@ -7,9 +7,12 @@ set -e
|
||||
declare -r SCRIPT_DIR=$(cd $(dirname ${0}) >/dev/null 2>&1 && pwd)
|
||||
declare -r ROOT_DIR=$(dirname ${SCRIPT_DIR})
|
||||
declare -r STATIC_DIR="$ROOT_DIR/src/servers/dashboard"
|
||||
OUT_DIR="${1:-$SCRIPT_DIR}"
|
||||
|
||||
RELEASE_VERSION="$(cat $STATIC_DIR/VERSION)"
|
||||
|
||||
echo "Downloading assets to dir: $OUT_DIR"
|
||||
cd $OUT_DIR
|
||||
# Download the SHA256 checksum attached to the release. To verify the integrity
|
||||
# of the download, this checksum will be used to check the download tar file
|
||||
# containing the built dashboard assets.
|
||||
|
||||
@@ -21,33 +21,28 @@ fn main() {
|
||||
fn fetch_dashboard_assets() {
|
||||
use std::process::{Command, Stdio};
|
||||
|
||||
macro_rules! p {
|
||||
($($tokens: tt)*) => {
|
||||
println!("cargo:warning={}", format!($($tokens)*))
|
||||
}
|
||||
}
|
||||
|
||||
let message = "Failed to fetch dashboard assets";
|
||||
let help = r#"
|
||||
You can manually execute './scripts/fetch-dashboard-assets.sh' to see why,
|
||||
or it's a network error, just try again or enable/disable some proxy."#;
|
||||
let out_dir = std::env::var("OUT_DIR").unwrap();
|
||||
let output = Command::new("./fetch-dashboard-assets.sh")
|
||||
.arg(&out_dir)
|
||||
.current_dir("../../scripts")
|
||||
.stdout(Stdio::piped())
|
||||
.spawn()
|
||||
.and_then(|p| p.wait_with_output());
|
||||
match output {
|
||||
Ok(output) => {
|
||||
String::from_utf8_lossy(&output.stdout)
|
||||
.lines()
|
||||
.for_each(|x| p!("{}", x));
|
||||
let script_output = String::from_utf8_lossy(&output.stdout);
|
||||
|
||||
assert!(output.status.success());
|
||||
assert!(
|
||||
output.status.success(),
|
||||
"{message}.\n{script_output}\n{help}"
|
||||
);
|
||||
}
|
||||
Err(e) => {
|
||||
let e = format!(
|
||||
r#"
|
||||
Failed to fetch dashboard assets: {}.
|
||||
You can manually execute './scripts/fetch-dashboard-assets.sh' to see why,
|
||||
or it's a network error, just try again or enable/disable some proxy."#,
|
||||
e
|
||||
);
|
||||
let e = format!("{message}: {e}.\n{help}");
|
||||
panic!("{}", e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user