refactor: ensure consistent ABI iteration order in build files (#131)
Previously, build files iterated through ABIs in an inconsistent order, causing unwanted changes when the build was rerun, as the iteration order would differ. This commit resolves the issue by sorting ABIs by name, ensuring consistent formatting and preventing unintended changes in future commits. Co-authored-by: zizou <111426680+flopell@users.noreply.github.com>
This commit is contained in:
@@ -6,12 +6,17 @@ fn main() -> Result<()> {
|
|||||||
let abi_folder = "abi";
|
let abi_folder = "abi";
|
||||||
let output_folder = "src/abi";
|
let output_folder = "src/abi";
|
||||||
|
|
||||||
let files = fs::read_dir(abi_folder)?;
|
let abis = fs::read_dir(abi_folder)?;
|
||||||
|
|
||||||
|
let mut files = abis.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
|
// Sort the files by their name
|
||||||
|
files.sort_by_key(|a| a.file_name());
|
||||||
|
|
||||||
let mut mod_rs_content = String::new();
|
let mut mod_rs_content = String::new();
|
||||||
mod_rs_content.push_str("#![allow(clippy::all)]\n");
|
mod_rs_content.push_str("#![allow(clippy::all)]\n");
|
||||||
|
|
||||||
for file in files {
|
for file in files {
|
||||||
let file = file?;
|
|
||||||
let file_name = file.file_name();
|
let file_name = file.file_name();
|
||||||
let file_name = file_name.to_string_lossy();
|
let file_name = file_name.to_string_lossy();
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
#![allow(clippy::all)]
|
#![allow(clippy::all)]
|
||||||
|
pub mod composable_stable_pool_factory;
|
||||||
pub mod erc_linear_pool_factory;
|
pub mod erc_linear_pool_factory;
|
||||||
pub mod gearbox_linear_pool_factory;
|
|
||||||
pub mod weighted_pool_tokens_factory;
|
|
||||||
pub mod vault;
|
|
||||||
pub mod yearn_linear_pool_factory;
|
|
||||||
pub mod managed_pool_factory;
|
|
||||||
pub mod weighted_pool_factory_v1;
|
|
||||||
pub mod euler_linear_pool_factory;
|
pub mod euler_linear_pool_factory;
|
||||||
|
pub mod gearbox_linear_pool_factory;
|
||||||
|
pub mod managed_pool_factory;
|
||||||
|
pub mod silo_linear_pool_factory;
|
||||||
|
pub mod vault;
|
||||||
|
pub mod weighted_pool_factory_v1;
|
||||||
pub mod weighted_pool_factory_v2;
|
pub mod weighted_pool_factory_v2;
|
||||||
pub mod weighted_pool_factory_v3;
|
pub mod weighted_pool_factory_v3;
|
||||||
pub mod weighted_pool_factory_v4;
|
pub mod weighted_pool_factory_v4;
|
||||||
pub mod silo_linear_pool_factory;
|
pub mod weighted_pool_tokens_factory;
|
||||||
pub mod composable_stable_pool_factory;
|
pub mod yearn_linear_pool_factory;
|
||||||
|
|||||||
@@ -6,12 +6,17 @@ fn main() -> Result<()> {
|
|||||||
let abi_folder = "abi";
|
let abi_folder = "abi";
|
||||||
let output_folder = "src/abi";
|
let output_folder = "src/abi";
|
||||||
|
|
||||||
let files = fs::read_dir(abi_folder)?;
|
let abis = fs::read_dir(abi_folder)?;
|
||||||
|
|
||||||
|
let mut files = abis.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
|
// Sort the files by their name
|
||||||
|
files.sort_by_key(|a| a.file_name());
|
||||||
let mut mod_rs_content = String::new();
|
let mut mod_rs_content = String::new();
|
||||||
mod_rs_content.push_str("#![allow(clippy::all)]\n");
|
mod_rs_content.push_str("#![allow(clippy::all)]\n");
|
||||||
|
|
||||||
for file in files {
|
for file in files {
|
||||||
let file = file?;
|
let file = file;
|
||||||
let file_name = file.file_name();
|
let file_name = file.file_name();
|
||||||
let file_name = file_name.to_string_lossy();
|
let file_name = file_name.to_string_lossy();
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#![allow(clippy::all)]
|
#![allow(clippy::all)]
|
||||||
pub mod crypto_pool_factory;
|
pub mod crypto_pool_factory;
|
||||||
pub mod erc20;
|
|
||||||
pub mod crypto_swap_ng_factory;
|
pub mod crypto_swap_ng_factory;
|
||||||
|
pub mod erc20;
|
||||||
|
pub mod meta_pool_factory;
|
||||||
pub mod meta_registry;
|
pub mod meta_registry;
|
||||||
pub mod stableswap_factory;
|
pub mod stableswap_factory;
|
||||||
pub mod tricrypto_factory;
|
pub mod tricrypto_factory;
|
||||||
pub mod twocrypto_factory;
|
pub mod twocrypto_factory;
|
||||||
pub mod meta_pool_factory;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user