Add Luau version to `Artifacts` and env variable

This commit is contained in:
Alex Orlenko 2022-12-02 23:00:38 +00:00
parent e06294c4b0
commit 19d97491ab
No known key found for this signature in database
GPG Key ID: 4C150C250863B96D
1 changed files with 9 additions and 0 deletions

View File

@ -179,6 +179,15 @@ impl Artifacts {
if let Some(ref cpp_stdlib) = self.cpp_stdlib {
println!("cargo:rustc-link-lib={}", cpp_stdlib);
}
if let Some(version) = self.version() {
println!("cargo:rustc-env=LUAU_VERSION={}", version);
}
}
pub fn version(&self) -> Option<String> {
let pkg_version = env!("CARGO_PKG_VERSION");
let (_, luau_version) = pkg_version.split_once("+luau")?;
Some(format!("0.{luau_version}"))
}
}