Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian committed Jan 4, 2023
1 parent 1f5255a commit 4b77e6f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
5 changes: 3 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions ffi/diplomat/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ zerovec = { version = "*", path = "../../utils/zerovec", optional = true}
diplomat = { git = "https://github.com/rust-diplomat/diplomat", rev = "d3010a4b88a0f37d23e3c64cf5500cedc4e8cdf0" }
diplomat-runtime = { git = "https://github.com/rust-diplomat/diplomat", rev = "d3010a4b88a0f37d23e3c64cf5500cedc4e8cdf0" }

[build-dependencies]
icu_datagen = { version = "1.0", path = "../../provider/datagen", features = ["icu_segmenter"]}
simple_logger = { version = "1.12" }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
# Logging is automagical in wasm, we only need this for native
Expand Down
32 changes: 25 additions & 7 deletions ffi/diplomat/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,31 @@
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

use icu_datagen::*;
use std::path::PathBuf;

fn main() {
if std::env::var("ICU4X_FFI_BAKED_ROOT").is_err() {
// Default generated with
// $ cargo run -p icu_datagen --features bin,icu_segmenter -- --key-file /dev/null --format mod --use-separate-crates --pretty --out empty_bake
println!(
"cargo:rustc-env=ICU4X_FFI_BAKED_ROOT={}/empty_bake",
std::env!("CARGO_MANIFEST_DIR")
);
if std::env::var("CARGO_FEATURE_BAKED_PROVIDER").is_ok()
&& std::env::var("ICU4X_FFI_BAKED_ROOT").is_err()
{
simple_logger::SimpleLogger::new()
.with_level(log::LevelFilter::Trace)
.init()
.unwrap();
let mod_directory = PathBuf::from(std::env::var_os("OUT_DIR").unwrap()).join("empty_bake");
println!("cargo:rustc-env=ICU4X_FFI_BAKED_ROOT={}", mod_directory.display());
icu_datagen::datagen(
Some(&[]),
&[],
&SourceData::default(),
vec![Out::Module {
mod_directory,
insert_feature_gates: false,
use_separate_crates: true,
overwrite: false,
pretty: false,
}],
)
.unwrap();
}
}

0 comments on commit 4b77e6f

Please sign in to comment.