mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Use a ninja variable for node binary (#2346)
* Use a ninja variable for node binary * Update docs (dae)
This commit is contained in:
parent
96a9dba67d
commit
5bc75a7885
3 changed files with 22 additions and 4 deletions
|
@ -114,6 +114,22 @@ pub fn setup_node(
|
|||
"npm" => vec![if cfg!(windows) { "npm.cmd " } else { "bin/npm" }]
|
||||
},
|
||||
)?;
|
||||
|
||||
let node_binary = match std::env::var("NODE_BINARY") {
|
||||
Ok(path) => {
|
||||
assert!(
|
||||
Utf8Path::new(&path).is_absolute(),
|
||||
"NODE_BINARY must be absolute"
|
||||
);
|
||||
path.into()
|
||||
}
|
||||
Err(_) => {
|
||||
inputs![":extract:node:bin"]
|
||||
}
|
||||
};
|
||||
let node_binary = build.expand_inputs(node_binary);
|
||||
build.variable("node_binary", &node_binary[0]);
|
||||
|
||||
build.add("yarn", YarnSetup {})?;
|
||||
|
||||
for binary in binary_exports {
|
||||
|
@ -148,7 +164,7 @@ impl BuildAction for EsbuildScript<'_> {
|
|||
}
|
||||
|
||||
fn files(&mut self, build: &mut impl build::FilesHandle) {
|
||||
build.add_inputs("node_bin", inputs![":extract:node:bin"]);
|
||||
build.add_inputs("node_bin", inputs!["$node_binary"]);
|
||||
build.add_inputs("script", &self.script);
|
||||
build.add_inputs("entrypoint", &self.entrypoint);
|
||||
build.add_inputs("", inputs!["yarn.lock", ":node_modules", &self.deps]);
|
||||
|
|
|
@ -34,3 +34,7 @@ If you run into trouble with the build process:
|
|||
- You can browse the build graph via e.g. `./ninja -- -t browse wheels`
|
||||
- You can profile build performance with
|
||||
https://discourse.cmake.org/t/profiling-build-performance/2443/3.
|
||||
|
||||
## Packaging considerations
|
||||
|
||||
See [this page](./linux.md).
|
||||
|
|
|
@ -77,9 +77,7 @@ There are a few things to be aware of:
|
|||
## Packaging considerations
|
||||
|
||||
Python, node and protoc are downloaded as part of the build. You can optionally define
|
||||
PYTHON_BINARY and PROTOC_BINARY as the full path to a Python binary and Protoc binary respectively,
|
||||
to use it instead of the downloaded version. A similar approach could be done with node in the future; a PR would be
|
||||
welcome.
|
||||
PYTHON_BINARY, NODE_BINARY and/or PROTOC_BINARY to use locally-installed versions instead.
|
||||
|
||||
If rust-toolchain.toml is removed, newer Rust versions can be used. Older versions
|
||||
may or may not compile the code.
|
||||
|
|
Loading…
Reference in a new issue