Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core/runtime): Feature gate ICU #10114

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ repository = "https://github.com/denoland/deno"
[lib]
path = "lib.rs"

[features]
no_icu = []
default = []

[dependencies]
anyhow = "1.0.40"
futures = "0.3.13"
Expand Down
13 changes: 8 additions & 5 deletions core/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,14 @@ impl JsRuntime {
pub fn new(mut options: RuntimeOptions) -> Self {
static DENO_INIT: Once = Once::new();
DENO_INIT.call_once(|| {
// Include 10MB ICU data file.
#[repr(C, align(16))]
struct IcuData([u8; 10413584]);
static ICU_DATA: IcuData = IcuData(*include_bytes!("icudtl.dat"));
v8::icu::set_common_data(&ICU_DATA.0).unwrap();
#[cfg(not(feature = "no_icu"))]
{
// Include 10MB ICU data file.
#[repr(C, align(16))]
struct IcuData([u8; 10413584]);
static ICU_DATA: IcuData = IcuData(*include_bytes!("icudtl.dat"));
v8::icu::set_common_data(&ICU_DATA.0).unwrap();
}
unsafe { v8_init() };
});

Expand Down