Dániel Buga 2438d03b21
Simplify generated code to save on build time, yeet a few dependencies (#3643)
* Reduce use of iter::chain

* Cache all symbols

* Trim xtensa-lx-rt deps

* Remove unused dep

* Replace chrono with jiff

* Yeet minijinja

* Save a bit on toml_edit

* Disable some default features

* Disable regex log filters

* Reduce xtensa-lx-rt build script

* Remove unnecessary dependencies

* Remove darling

* Update embedded-test

* lol

* Clean up

* Only validate loaded config once

* fmt

* Changelog
2025-06-17 20:35:00 +00:00

26 lines
946 B
Rust

use std::env;
use esp_config::generate_config_from_yaml_definition;
use jiff::Timestamp;
fn main() {
println!("cargo::rustc-check-cfg=cfg(embedded_test)");
let build_time = match env::var("SOURCE_DATE_EPOCH") {
Ok(val) => Timestamp::from_microsecond(val.parse::<i64>().unwrap()).unwrap(),
Err(_) => Timestamp::now(),
};
let build_time_formatted = build_time.strftime("%H:%M:%S");
let build_date_formatted = build_time.strftime("%Y-%m-%d");
println!("cargo::rustc-env=ESP_BOOTLOADER_BUILD_TIME={build_time_formatted}");
println!("cargo::rustc-env=ESP_BOOTLOADER_BUILD_DATE={build_date_formatted}");
// emit config
println!("cargo:rerun-if-changed=./esp_config.yml");
let cfg_yaml = std::fs::read_to_string("./esp_config.yml")
.expect("Failed to read esp_config.yml for esp-bootloader-esp-idf");
generate_config_from_yaml_definition(&cfg_yaml, true, true, None).unwrap();
}