Anki version needs to be resolved at configure run time, not build time
Fixes incorrect info in wheels when version bumped
This commit is contained in:
parent
d1004ddcfd
commit
0a870f75a4
@ -421,7 +421,7 @@ impl BuildAction for BuildWindowsInstallers {
|
|||||||
});
|
});
|
||||||
|
|
||||||
build.add_inputs("", inputs![":bundle:folder:std", ":bundle:folder:alt"]);
|
build.add_inputs("", inputs![":bundle:folder:std", ":bundle:folder:alt"]);
|
||||||
build.add_variable("version", version);
|
build.add_variable("version", &version);
|
||||||
build.add_variable("bundle_root", "$builddir/bundle");
|
build.add_variable("bundle_root", "$builddir/bundle");
|
||||||
build.add_outputs("out", outputs);
|
build.add_outputs("out", outputs);
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,11 @@ use web::check_sql;
|
|||||||
|
|
||||||
use crate::proto::check_proto;
|
use crate::proto::check_proto;
|
||||||
|
|
||||||
fn anki_version() -> &'static str {
|
fn anki_version() -> String {
|
||||||
include_str!("../../../.version").trim()
|
std::fs::read_to_string(".version")
|
||||||
|
.unwrap()
|
||||||
|
.trim()
|
||||||
|
.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
@ -13,6 +13,7 @@ use ninja_gen::python::PythonTest;
|
|||||||
use ninja_gen::Build;
|
use ninja_gen::Build;
|
||||||
use ninja_gen::Result;
|
use ninja_gen::Result;
|
||||||
|
|
||||||
|
use crate::anki_version;
|
||||||
use crate::platform::overriden_python_target_platform;
|
use crate::platform::overriden_python_target_platform;
|
||||||
use crate::python::BuildWheel;
|
use crate::python::BuildWheel;
|
||||||
use crate::python::GenPythonProto;
|
use crate::python::GenPythonProto;
|
||||||
@ -88,14 +89,14 @@ pub fn build_pylib(build: &mut Build) -> Result<()> {
|
|||||||
"wheels:anki",
|
"wheels:anki",
|
||||||
BuildWheel {
|
BuildWheel {
|
||||||
name: "anki",
|
name: "anki",
|
||||||
version: include_str!("../../../.version").trim(),
|
version: anki_version(),
|
||||||
src_folder: "pylib/anki",
|
src_folder: "pylib/anki",
|
||||||
gen_folder: "$builddir/pylib/anki",
|
gen_folder: "$builddir/pylib/anki",
|
||||||
platform: overriden_python_target_platform().or(Some(build.host_platform)),
|
platform: overriden_python_target_platform().or(Some(build.host_platform)),
|
||||||
deps: inputs![
|
deps: inputs![
|
||||||
":pylib/anki",
|
":pylib/anki",
|
||||||
glob!("pylib/anki/**"),
|
glob!("pylib/anki/**"),
|
||||||
"python/requirements.anki.in"
|
"python/requirements.anki.in",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
@ -117,7 +117,7 @@ impl BuildAction for GenPythonProto {
|
|||||||
|
|
||||||
pub struct BuildWheel {
|
pub struct BuildWheel {
|
||||||
pub name: &'static str,
|
pub name: &'static str,
|
||||||
pub version: &'static str,
|
pub version: String,
|
||||||
pub src_folder: &'static str,
|
pub src_folder: &'static str,
|
||||||
pub gen_folder: &'static str,
|
pub gen_folder: &'static str,
|
||||||
pub platform: Option<Platform>,
|
pub platform: Option<Platform>,
|
||||||
@ -149,7 +149,7 @@ impl BuildAction for BuildWheel {
|
|||||||
"py3-none-any".into()
|
"py3-none-any".into()
|
||||||
};
|
};
|
||||||
let name = self.name;
|
let name = self.name;
|
||||||
let version = self.version;
|
let version = &self.version;
|
||||||
let wheel_path = format!("wheels/{name}-{version}-{tag}.whl");
|
let wheel_path = format!("wheels/{name}-{version}-{tag}.whl");
|
||||||
build.add_outputs("out", vec![wheel_path]);
|
build.add_outputs("out", vec![wheel_path]);
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ impl BuildAction for ConfigureBuild {
|
|||||||
|
|
||||||
fn files(&mut self, build: &mut impl FilesHandle) {
|
fn files(&mut self, build: &mut impl FilesHandle) {
|
||||||
build.add_inputs("cmd", inputs![":build:configure"]);
|
build.add_inputs("cmd", inputs![":build:configure"]);
|
||||||
// reconfigure when env changes
|
// reconfigure when external inputs change
|
||||||
build.add_inputs("", inputs!["$builddir/env"]);
|
build.add_inputs("", inputs!["$builddir/env", ".version"]);
|
||||||
build.add_outputs("", ["build.ninja"])
|
build.add_outputs("", ["build.ninja"])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user