Skip to content

Commit fa20e3c

Browse files
committed
wip: debugging sigchat build fail due to missing translations
1 parent 701e5b4 commit fa20e3c

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

locales/build.rs

+18-4
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,30 @@ type Locale = String;
1818
type Value = String;
1919
type Translations = HashMap<Key, HashMap<Locale, Value>>;
2020

21+
macro_rules! build_debug {
22+
($($tokens: tt)*) => {
23+
println!("cargo:warning={}", format!($($tokens)*))
24+
}
25+
}
26+
2127
fn read_locales() -> Translations {
2228
let mut translations: Translations = HashMap::new();
2329

24-
let project_dir = project_root();
30+
let mut project_dir = project_root();
2531
let build_directory = project_dir.to_str().unwrap();
2632
let locales = format!("{}/**/i18n.json", build_directory);
27-
println!("Reading {}", &locales);
28-
29-
for entry in glob(&locales).expect("Failed to read glob pattern") {
33+
build_debug!("Reading {}", &locales);
34+
// TODO: once this works, get from external directory/location arguments from xtask script
35+
project_dir.pop(); //sibling directory
36+
project_dir.push("sigchat");
37+
let external_directory = project_dir.to_str().unwrap();
38+
let external_locales = format!("{}/**/i18n.json", external_directory);
39+
build_debug!("Reading external {}", &external_locales);
40+
let paths = glob(&locales).expect("Failed to read glob pattern for in tree fiels");
41+
let external_paths = glob(&external_locales).expect("Filed to read glob pattern for external files");
42+
for entry in paths.chain(external_paths) {
3043
let entry = entry.unwrap();
44+
build_debug!("{:?}",entry);
3145
println!("cargo:rerun-if-changed={}", entry.display());
3246
let file = File::open(entry).expect("Failed to open the file");
3347
let mut reader = std::io::BufReader::new(file);

0 commit comments

Comments
 (0)