-
Notifications
You must be signed in to change notification settings - Fork 679
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5399 from stacks-network/feat/update-cargo-versions
Add default version to `version_string` function
- Loading branch information
Showing
14 changed files
with
67 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use std::path::Path; | ||
use std::{env, fs}; | ||
|
||
use toml::Value; | ||
|
||
fn main() { | ||
let toml_file = "../versions.toml"; | ||
let toml_content = fs::read_to_string(toml_file).expect("Failed to read versions.toml"); | ||
|
||
let config: Value = toml::from_str(&toml_content).expect("Failed to parse TOML"); | ||
|
||
let mut rust_code = String::from("// Auto-generated code from versions.toml\n\n"); | ||
|
||
let Value::Table(table) = config else { | ||
panic!("Invalid value type in versions.toml: {config:?}"); | ||
}; | ||
for (key, val) in table { | ||
let Value::String(s) = val else { | ||
panic!("Invalid value type in versions.toml: {val:?}"); | ||
}; | ||
rust_code.push_str(&format!( | ||
"pub const {}: &str = {s:?};\n", | ||
key.to_uppercase() | ||
)); | ||
} | ||
|
||
let out_dir = env::var_os("OUT_DIR").unwrap(); | ||
let dest_path = Path::new(&out_dir).join("versions.rs"); | ||
fs::write(&dest_path, rust_code).expect("Failed to write generated code"); | ||
|
||
// Tell Cargo to rerun this script if the TOML file changes | ||
println!("cargo:rerun-if-changed={toml_file}"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Update these values when a new release is created. | ||
# `stacks-common/build.rs` will automatically update `versions.rs` with these values. | ||
stacks_node_version = "3.1.0.0.4" | ||
stacks_signer_version = "3.1.0.0.4.0" |