mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Use a build input instead of build var for substituted binaries
The vars were not resolved when listed as inputs to other rules, which was causing problems when using n2, and this approach is simpler.
This commit is contained in:
parent
324ef330e8
commit
0bf4fddf40
6 changed files with 11 additions and 13 deletions
|
@ -35,8 +35,7 @@ pub fn setup_protoc(build: &mut Build) -> Result<()> {
|
|||
inputs![":extract:protoc:bin"]
|
||||
}
|
||||
};
|
||||
let protoc_binary = build.expand_inputs(protoc_binary);
|
||||
build.variable("protoc_binary", &protoc_binary[0]);
|
||||
build.add_dependency("protoc_binary", protoc_binary);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ impl BuildAction for GenPythonProto {
|
|||
})
|
||||
.collect();
|
||||
build.add_inputs("in", &self.proto_files);
|
||||
build.add_inputs("protoc", inputs!["$protoc_binary"]);
|
||||
build.add_inputs("protoc", inputs![":protoc_binary"]);
|
||||
build.add_inputs("protoc-gen-mypy", inputs![":pyenv:protoc-gen-mypy"]);
|
||||
build.add_outputs("", python_outputs);
|
||||
// not a direct dependency, but we include the output interface in our declared
|
||||
|
|
|
@ -87,7 +87,7 @@ fn prepare_proto_descriptors(build: &mut Build) -> Result<()> {
|
|||
build.add_action(
|
||||
"rslib:proto",
|
||||
CargoBuild {
|
||||
inputs: inputs![glob!["{proto,rslib/proto}/**"], "$protoc_binary",],
|
||||
inputs: inputs![glob!["{proto,rslib/proto}/**"], ":protoc_binary",],
|
||||
outputs: &[RustOutput::Data(
|
||||
"descriptors.bin",
|
||||
"$builddir/rslib/proto/descriptors.bin",
|
||||
|
|
|
@ -144,7 +144,8 @@ rule {action_name}
|
|||
|
||||
/// Allows you to add dependencies on files or build steps that aren't
|
||||
/// required to build the group itself, but are required by consumers of
|
||||
/// that group.
|
||||
/// that group. Can also be used to allow substitution of local binaries
|
||||
/// for downloaded ones (eg :node_binary).
|
||||
pub fn add_dependency(&mut self, group: &str, deps: BuildInput) {
|
||||
let files = self.expand_inputs(deps);
|
||||
let groups = split_groups(group);
|
||||
|
|
|
@ -52,7 +52,7 @@ impl BuildAction for YarnSetup {
|
|||
}
|
||||
|
||||
fn files(&mut self, build: &mut impl build::FilesHandle) {
|
||||
build.add_inputs("", inputs!["$node_binary"]);
|
||||
build.add_inputs("", inputs![":node_binary"]);
|
||||
build.add_outputs_ext(
|
||||
"bin",
|
||||
vec![if cfg!(windows) {
|
||||
|
@ -128,8 +128,7 @@ pub fn setup_node(
|
|||
inputs![":extract:node:bin"]
|
||||
}
|
||||
};
|
||||
let node_binary = build.expand_inputs(node_binary);
|
||||
build.variable("node_binary", &node_binary[0]);
|
||||
build.add_dependency("node_binary", node_binary);
|
||||
|
||||
match std::env::var("YARN_BINARY") {
|
||||
Ok(path) => {
|
||||
|
@ -176,7 +175,7 @@ impl BuildAction for EsbuildScript<'_> {
|
|||
}
|
||||
|
||||
fn files(&mut self, build: &mut impl build::FilesHandle) {
|
||||
build.add_inputs("node_bin", inputs!["$node_binary"]);
|
||||
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]);
|
||||
|
@ -368,7 +367,7 @@ impl BuildAction for GenTypescriptProto<'_> {
|
|||
.map(|d| format!("-I {d}"))
|
||||
.join(" "),
|
||||
);
|
||||
build.add_inputs("protoc", inputs!["$protoc_binary"]);
|
||||
build.add_inputs("protoc", inputs![":protoc_binary"]);
|
||||
build.add_inputs("gen-es", inputs![":node_modules:protoc-gen-es"]);
|
||||
if cfg!(windows) {
|
||||
build.add_env_var(
|
||||
|
|
|
@ -75,8 +75,7 @@ pub fn setup_python(build: &mut Build) -> Result<()> {
|
|||
inputs![":extract:python:bin"]
|
||||
}
|
||||
};
|
||||
let python_binary = build.expand_inputs(python_binary);
|
||||
build.variable("python_binary", &python_binary[0]);
|
||||
build.add_dependency("python_binary", python_binary);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
@ -103,7 +102,7 @@ impl BuildAction for PythonEnvironment {
|
|||
vec![path]
|
||||
};
|
||||
|
||||
build.add_inputs("python_binary", inputs!["$python_binary"]);
|
||||
build.add_inputs("python_binary", inputs![":python_binary"]);
|
||||
build.add_inputs("base_requirements", &self.base_requirements_txt);
|
||||
build.add_inputs("requirements", &self.requirements_txt);
|
||||
build.add_variable("pyenv_folder", self.folder);
|
||||
|
|
Loading…
Reference in a new issue