Move generated submodules into a subdir
This will avoid possibility of them colliding with generated.rs
This commit is contained in:
parent
2c766e917d
commit
381df2e644
5
build.rs
5
build.rs
|
@ -37,6 +37,7 @@ fn main() {
|
||||||
|
|
||||||
let dbus_paths_raw =
|
let dbus_paths_raw =
|
||||||
env::var("DBUS_XML_PATH").unwrap_or("/usr/share/dbus-1/interfaces".to_string());
|
env::var("DBUS_XML_PATH").unwrap_or("/usr/share/dbus-1/interfaces".to_string());
|
||||||
|
fs::create_dir_all(out_dir.join("generated")).unwrap();
|
||||||
dbus_paths_raw
|
dbus_paths_raw
|
||||||
.split(':')
|
.split(':')
|
||||||
.map(fs::read_dir)
|
.map(fs::read_dir)
|
||||||
|
@ -64,7 +65,7 @@ fn main() {
|
||||||
.strip_suffix(".xml")
|
.strip_suffix(".xml")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.replace('.', "_");
|
.replace('.', "_");
|
||||||
let out_path = out_dir.join(module_name.clone() + ".rs");
|
let out_path = out_dir.join(format!("generated/{module_name}.rs"));
|
||||||
fs::File::create(out_path)
|
fs::File::create(out_path)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.write_all(code.as_bytes())
|
.write_all(code.as_bytes())
|
||||||
|
@ -74,7 +75,7 @@ fn main() {
|
||||||
.write_all(
|
.write_all(
|
||||||
format!(
|
format!(
|
||||||
r#"mod {module_name} {{
|
r#"mod {module_name} {{
|
||||||
include!(concat!(env!("OUT_DIR"), "/{module_name}.rs"));
|
include!(concat!(env!("OUT_DIR"), "/generated/{module_name}.rs"));
|
||||||
}}
|
}}
|
||||||
pub use {module_name}::*;
|
pub use {module_name}::*;
|
||||||
"#
|
"#
|
||||||
|
|
Loading…
Reference in a new issue