mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 05:52:22 -04:00

Workspace deps were introduced in Rust 1.64. They don't cover all the
cases that Hakari did unfortunately, but they are simpler to maintain,
and they avoid a couple of issues that Hakari had:
- It sometimes made updating dependencies harder due to the locked versions,
so you had to disable Hakari, do the updates, and then re-generate (
e.g. 943dddf28f
)
- The current Hakari config was breaking AnkiDroid's build, as it was
stopping a cross-compile from functioning correctly.
40 lines
1.2 KiB
Rust
40 lines
1.2 KiB
Rust
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
use crate::action::BuildAction;
|
|
use crate::build::FilesHandle;
|
|
use crate::cargo::CargoBuild;
|
|
use crate::cargo::RustOutput;
|
|
use crate::glob;
|
|
use crate::inputs;
|
|
use crate::Build;
|
|
use crate::Result;
|
|
|
|
pub struct ConfigureBuild {}
|
|
|
|
impl BuildAction for ConfigureBuild {
|
|
fn command(&self) -> &str {
|
|
"$cmd"
|
|
}
|
|
|
|
fn files(&mut self, build: &mut impl FilesHandle) {
|
|
build.add_inputs("cmd", inputs![":build:configure"]);
|
|
// reconfigure when external inputs change
|
|
build.add_inputs("", inputs!["$builddir/env", ".version", ".git"]);
|
|
build.add_outputs("", ["build.ninja"])
|
|
}
|
|
|
|
fn on_first_instance(&self, build: &mut Build) -> Result<()> {
|
|
build.add_action(
|
|
"build:configure",
|
|
CargoBuild {
|
|
inputs: inputs![glob!["build/**/*"]],
|
|
outputs: &[RustOutput::Binary("configure")],
|
|
target: None,
|
|
extra_args: "-p configure",
|
|
release_override: Some(false),
|
|
},
|
|
)?;
|
|
Ok(())
|
|
}
|
|
}
|