Skip to content

Commit 09aafa6

Browse files
committed
build: Check for download failure in Deno, Python and curl individually
1 parent 8da857d commit 09aafa6

1 file changed

Lines changed: 12 additions & 21 deletions

File tree

build.rs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -619,26 +619,6 @@ fn build_dir() -> PathBuf {
619619
.to_path_buf()
620620
}
621621

622-
/// Checks if the target is available as a pre-built archive from the rusty_v8 GitHub.
623-
/// Should only be called when `RUSTY_V8_MIRROR` is unset.
624-
fn is_target_prebuilt(target: &str, profile: &str) -> bool {
625-
const PREBUILT_TARGETS: [&str; 6] = [
626-
"aarch64-apple-darwin",
627-
"aarch64-pc-windows-msvc",
628-
"aarch64-unknown-linux-gnu",
629-
"x86_64-apple-darwin",
630-
"x86_64-pc-windows-msvc",
631-
"x86_64-unknown-linux-gnu",
632-
];
633-
634-
// No pre-built archives for Windows on debug builds.
635-
if target.contains("windows") && profile != "release" {
636-
return false;
637-
}
638-
639-
PREBUILT_TARGETS.contains(&target)
640-
}
641-
642622
fn replace_non_alphanumeric(url: &str) -> String {
643623
url
644624
.chars()
@@ -684,6 +664,11 @@ fn download_file(url: &str, filename: &Path) {
684664
.arg(
685665
"const [url, path] = Deno.args; \
686666
const resp = await fetch(url); \
667+
if (resp.status === 404) { \
668+
console.error(`Failed to download prebuilt V8 archive from ${url}`); \
669+
console.error(`If no prebuilt archive is available for your target, compile V8 from source by setting V8_FROM_SOURCE=1`); \
670+
Deno.exit(1); \
671+
} \
687672
if (!resp.ok) Deno.exit(1); \
688673
const file = await Deno.open(path, { write: true, create: true }); \
689674
await resp.body.pipeTo(file.writable);",
@@ -733,7 +718,13 @@ fn download_file(url: &str, filename: &Path) {
733718
};
734719

735720
// Assert DL was successful
736-
assert!(status.success());
721+
if !status.success() {
722+
panic!(
723+
"Failed to download V8 prebuilt archive from {url}\n\
724+
If no prebuilt archive is available for your target, \
725+
compile V8 from source by setting V8_FROM_SOURCE=1"
726+
);
727+
}
737728
assert!(tmpfile.exists());
738729

739730
// Write checksum (i.e url) & move file

0 commit comments

Comments
 (0)