-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an RGB_LIB_IDs.toml file, and build script to auto-generate it (#270
) * Add an RGB_LIB_IDs.toml file, and build script to auto-generate it. * Add LIB_ID_RGB to build.rs. * bump: update dependencies --------- Co-authored-by: Armando Dutra <[email protected]>
- Loading branch information
1 parent
b3a82ad
commit 23da169
Showing
7 changed files
with
123 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Auto-generated semantic IDs for RGB consensus-critical libraries and their corresponding versions of bitmask-core. | ||
|
||
[LIB_ID_RGB] | ||
memphis_asia_crash_4fGZWR5mH5zZzRZ1r7CSRe776zm3hLBUngfXc4s3vm3V = "0.6.0-rc.6" | ||
|
||
[LIB_ID_RGB20] | ||
dragon_table_game_GVz4mvYE94aQ9q2HPtV9VuoppcDdduP54BMKffF7YoFH = "0.6.0-rc.6" | ||
|
||
[LIB_ID_RGB21] | ||
benny_horse_salad_E3AsDKsHSqAPQLvJke3DcPrkErbS2Jxf8pQ8jYBQYJPA = "0.6.0-rc.6" | ||
|
||
[LIB_ID_RGB25] | ||
ritual_mask_next_4JmGrg7oTgwuCQtyC4ezC38ToHMzgMCVS5kMSDPwo2ee = "0.6.0-rc.6" | ||
|
||
[LIB_ID_RGB_CONTRACT] | ||
price_canvas_oliver_9Te5P6nq3oaDHMgttLEbkojbeQPTqqZLhjxZ3my1F8aJ = "0.6.0-rc.6" | ||
|
||
[LIB_ID_RGB_STD] | ||
patent_iris_torch_Firwvn75qng8cm4n7iHXXiFDsG1V476vYGqdfwwFRT1b = "0.6.0-rc.6" |
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,67 @@ | ||
use std::{collections::BTreeMap, fs}; | ||
|
||
use anyhow::Result; | ||
use rgbstd::{ | ||
interface::{LIB_ID_RGB20, LIB_ID_RGB21, LIB_ID_RGB25}, | ||
stl::{LIB_ID_RGB, LIB_ID_RGB_CONTRACT, LIB_ID_RGB_STD}, | ||
}; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
type IdVersionMap = BTreeMap<String, String>; | ||
|
||
#[allow(non_snake_case)] | ||
#[derive(Deserialize, Serialize)] | ||
struct LibIds { | ||
LIB_ID_RGB: IdVersionMap, | ||
LIB_ID_RGB20: IdVersionMap, | ||
LIB_ID_RGB21: IdVersionMap, | ||
LIB_ID_RGB25: IdVersionMap, | ||
LIB_ID_RGB_CONTRACT: IdVersionMap, | ||
LIB_ID_RGB_STD: IdVersionMap, | ||
} | ||
|
||
const LIB_IDS_FILE: &str = "RGB_LIB_IDs.toml"; | ||
const NOTE_COMMENT: &str = | ||
"# Auto-generated semantic IDs for RGB consensus-critical libraries and their corresponding versions of bitmask-core.\n\n"; | ||
|
||
fn main() -> Result<()> { | ||
const BMC_VERSION: &str = env!("CARGO_PKG_VERSION"); | ||
|
||
let lib_ids_file = fs::read_to_string(LIB_IDS_FILE)?; | ||
let mut lib_ids: LibIds = toml::from_str(&lib_ids_file)?; | ||
|
||
lib_ids | ||
.LIB_ID_RGB | ||
.entry(LIB_ID_RGB.to_owned()) | ||
.or_insert(BMC_VERSION.to_owned()); | ||
|
||
lib_ids | ||
.LIB_ID_RGB20 | ||
.entry(LIB_ID_RGB20.to_owned()) | ||
.or_insert(BMC_VERSION.to_owned()); | ||
|
||
lib_ids | ||
.LIB_ID_RGB21 | ||
.entry(LIB_ID_RGB21.to_owned()) | ||
.or_insert(BMC_VERSION.to_owned()); | ||
|
||
lib_ids | ||
.LIB_ID_RGB25 | ||
.entry(LIB_ID_RGB25.to_owned()) | ||
.or_insert(BMC_VERSION.to_owned()); | ||
|
||
lib_ids | ||
.LIB_ID_RGB_CONTRACT | ||
.entry(LIB_ID_RGB_CONTRACT.to_owned()) | ||
.or_insert(BMC_VERSION.to_owned()); | ||
|
||
lib_ids | ||
.LIB_ID_RGB_STD | ||
.entry(LIB_ID_RGB_STD.to_owned()) | ||
.or_insert(BMC_VERSION.to_owned()); | ||
|
||
let toml = toml::to_string(&lib_ids)?; | ||
fs::write(LIB_IDS_FILE, format!("{NOTE_COMMENT}{toml}"))?; | ||
|
||
Ok(()) | ||
} |
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