mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-12-01 01:04:00 +00:00
build: Sort toml preset files (#5352)
build: Sort toml input file list for reproducible build results. See https://reproducible-builds.org/ for why this is good. This patch was done while working on reproducible builds for openSUSE.
This commit is contained in:
parent
fcf4298ea3
commit
7ff5f6ad22
6
build.rs
6
build.rs
@ -1,4 +1,5 @@
|
|||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
|
use std::io;
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
|
|
||||||
use shadow_rs::SdResult;
|
use shadow_rs::SdResult;
|
||||||
@ -20,11 +21,12 @@ fn main() -> SdResult<()> {
|
|||||||
fn gen_presets_hook(mut file: &File) -> SdResult<()> {
|
fn gen_presets_hook(mut file: &File) -> SdResult<()> {
|
||||||
println!("cargo:rerun-if-changed=docs/.vuepress/public/presets/toml");
|
println!("cargo:rerun-if-changed=docs/.vuepress/public/presets/toml");
|
||||||
let paths = fs::read_dir("docs/.vuepress/public/presets/toml")?;
|
let paths = fs::read_dir("docs/.vuepress/public/presets/toml")?;
|
||||||
|
let mut sortedpaths = paths.collect::<io::Result<Vec<_>>>()?;
|
||||||
|
sortedpaths.sort_by_key(|e| e.path());
|
||||||
|
|
||||||
let mut presets = String::new();
|
let mut presets = String::new();
|
||||||
let mut match_arms = String::new();
|
let mut match_arms = String::new();
|
||||||
for path in paths {
|
for unwrapped in sortedpaths {
|
||||||
let unwrapped = path?;
|
|
||||||
let file_name = unwrapped.file_name();
|
let file_name = unwrapped.file_name();
|
||||||
let full_path = dunce::canonicalize(unwrapped.path())?;
|
let full_path = dunce::canonicalize(unwrapped.path())?;
|
||||||
let full_path = full_path.to_str().expect("failed to convert to string");
|
let full_path = full_path.to_str().expect("failed to convert to string");
|
||||||
|
Loading…
Reference in New Issue
Block a user