summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2022-03-16 20:25:44 -0400
committerGitHub <noreply@github.com>2022-03-17 01:25:44 +0100
commitf7ab41583e2bb4425ce7ac89b123089d0f07836a (patch)
tree1a4bbe2052499f36a202270e950dae067343b3fc /cli
parent418c1eb4b3d65a9573030a074170a344723608de (diff)
fix: cargo publish fails without absolute paths (#13993)
This reverts commit 4e3ed37037a2aa1edeac260dc3463a81d9cf9b88. Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/Cargo.toml14
-rw-r--r--cli/build.rs86
2 files changed, 73 insertions, 27 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index e79431e86..5920ffacb 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -25,10 +25,20 @@ harness = false
path = "./bench/lsp_bench_standalone.rs"
[build-dependencies]
+deno_broadcast_channel = { version = "0.35.0", path = "../ext/broadcast_channel" }
+deno_console = { version = "0.41.0", path = "../ext/console" }
deno_core = { version = "0.123.0", path = "../core" }
+deno_crypto = { version = "0.55.0", path = "../ext/crypto" }
+deno_fetch = { version = "0.64.0", path = "../ext/fetch" }
+deno_net = { version = "0.33.0", path = "../ext/net" }
+deno_url = { version = "0.41.0", path = "../ext/url" }
+deno_web = { version = "0.72.0", path = "../ext/web" }
+deno_webgpu = { version = "0.42.0", path = "../ext/webgpu" }
+deno_websocket = { version = "0.46.0", path = "../ext/websocket" }
+deno_webstorage = { version = "0.36.0", path = "../ext/webstorage" }
regex = "=1.5.5"
serde = { version = "=1.0.133", features = ["derive"] }
-zstd = { version = '=0.9.2', default-features = false }
+zstd = '=0.9.2'
[target.'cfg(windows)'.build-dependencies]
winapi = "=0.3.9"
@@ -88,7 +98,7 @@ tokio-util = "=0.6.9"
typed-arena = "2.0.1"
uuid = { version = "=0.8.2", features = ["v4", "serde"] }
walkdir = "=2.3.2"
-zstd = { version = '=0.9.2', default-features = false }
+zstd = '=0.9.2'
[target.'cfg(windows)'.dependencies]
fwdansi = "=1.1.0"
diff --git a/cli/build.rs b/cli/build.rs
index 7b56dbcbd..e5b626d76 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -81,33 +81,22 @@ fn create_compiler_snapshot(
) {
// libs that are being provided by op crates.
let mut op_crate_libs = HashMap::new();
- op_crate_libs.insert("deno.console", "../ext/console/lib.deno_console.d.ts");
- op_crate_libs.insert("deno.url", "../ext/url/lib.deno_url.d.ts");
- op_crate_libs.insert("deno.web", "../ext/web/lib.deno_web.d.ts");
- op_crate_libs.insert("deno.fetch", "../ext/fetch/lib.deno_fetch.d.ts");
- op_crate_libs.insert("deno.webgpu", "./dts/lib.deno_webgpu.d.ts");
- op_crate_libs
- .insert("deno.websocket", "../ext/websocket/lib.deno_websocket.d.ts");
- op_crate_libs.insert(
- "deno.webstorage",
- "../ext/webstorage/lib.deno_webstorage.d.ts",
- );
- op_crate_libs.insert("deno.crypto", "../ext/crypto/lib.deno_crypto.d.ts");
+ op_crate_libs.insert("deno.console", deno_console::get_declaration());
+ op_crate_libs.insert("deno.url", deno_url::get_declaration());
+ op_crate_libs.insert("deno.web", deno_web::get_declaration());
+ op_crate_libs.insert("deno.fetch", deno_fetch::get_declaration());
+ op_crate_libs.insert("deno.webgpu", deno_webgpu_get_declaration());
+ op_crate_libs.insert("deno.websocket", deno_websocket::get_declaration());
+ op_crate_libs.insert("deno.webstorage", deno_webstorage::get_declaration());
+ op_crate_libs.insert("deno.crypto", deno_crypto::get_declaration());
op_crate_libs.insert(
"deno.broadcast_channel",
- "../ext/broadcast_channel/lib.deno_broadcast_channel.d.ts",
+ deno_broadcast_channel::get_declaration(),
);
- op_crate_libs.insert("deno.net", "../ext/net/lib.deno_net.d.ts");
+ op_crate_libs.insert("deno.net", deno_net::get_declaration());
+
// ensure we invalidate the build properly.
- for (name, path) in op_crate_libs.iter() {
- let path = std::fs::canonicalize(path)
- .map_err(|e| format!("{}: {}", path, e))
- .unwrap();
- println!(
- "cargo:rustc-env={}_LIB_PATH={}",
- name.replace('.', "_").to_uppercase(),
- path.display()
- );
+ for (_, path) in op_crate_libs.iter() {
println!("cargo:rerun-if-changed={}", path.display());
}
@@ -215,7 +204,7 @@ fn create_compiler_snapshot(
// using the same op that is used in `tsc.rs` for loading modules and reading
// files, but a slightly different implementation at build time.
fn op_load(state: &mut OpState, args: LoadArgs) -> Result<Value, AnyError> {
- let op_crate_libs = state.borrow::<HashMap<&str, &str>>();
+ let op_crate_libs = state.borrow::<HashMap<&str, PathBuf>>();
let path_dts = state.borrow::<PathBuf>();
let re_asset =
Regex::new(r"asset:/{3}lib\.(\S+)\.d\.ts").expect("bad regex");
@@ -339,13 +328,55 @@ fn main() {
println!("cargo:rustc-env=DENO_CANARY={}", c);
}
println!("cargo:rerun-if-env-changed=DENO_CANARY");
+
println!("cargo:rustc-env=GIT_COMMIT_HASH={}", git_commit_hash());
println!("cargo:rerun-if-env-changed=GIT_COMMIT_HASH");
println!("cargo:rustc-env=TS_VERSION={}", ts_version());
println!("cargo:rerun-if-env-changed=TS_VERSION");
- println!("cargo:rustc-env=TARGET={}", target);
+ println!(
+ "cargo:rustc-env=DENO_CONSOLE_LIB_PATH={}",
+ deno_console::get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_URL_LIB_PATH={}",
+ deno_url::get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_WEB_LIB_PATH={}",
+ deno_web::get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_FETCH_LIB_PATH={}",
+ deno_fetch::get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_WEBGPU_LIB_PATH={}",
+ deno_webgpu_get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_WEBSOCKET_LIB_PATH={}",
+ deno_websocket::get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_WEBSTORAGE_LIB_PATH={}",
+ deno_webstorage::get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_CRYPTO_LIB_PATH={}",
+ deno_crypto::get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_BROADCAST_CHANNEL_LIB_PATH={}",
+ deno_broadcast_channel::get_declaration().display()
+ );
+ println!(
+ "cargo:rustc-env=DENO_NET_LIB_PATH={}",
+ deno_net::get_declaration().display()
+ );
+
+ println!("cargo:rustc-env=TARGET={}", env::var("TARGET").unwrap());
println!("cargo:rustc-env=PROFILE={}", env::var("PROFILE").unwrap());
let c = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap());
@@ -369,6 +400,11 @@ fn main() {
}
}
+fn deno_webgpu_get_declaration() -> PathBuf {
+ let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
+ manifest_dir.join("dts").join("lib.deno_webgpu.d.ts")
+}
+
fn get_js_files(d: &str) -> Vec<PathBuf> {
let manifest_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let mut js_files = std::fs::read_dir(d)