feat: add no_icu feature to build V8 without i18n/ICU support#1996
Open
bartlomieju wants to merge 3 commits into
Open
feat: add no_icu feature to build V8 without i18n/ICU support#1996bartlomieju wants to merge 3 commits into
no_icu feature to build V8 without i18n/ICU support#1996bartlomieju wants to merge 3 commits into
Conversation
Adds an opt-out `no_icu` cargo feature that builds V8 with `v8_enable_i18n_support=false`. This drops the embedded ICU data (~10MB) and the `Intl` API from the resulting static library, producing a slimmer build for consumers that do not need internationalization. The feature is modelled as an opt-out (rather than a default-on `icu` feature) so existing consumers, including those that set `default-features = false`, keep ICU without any changes and their prebuilt archive names are unchanged. A new `rusty_v8_enable_i18n` GN arg gates the ICU bindings in `src/binding.cc`. When i18n is disabled, `icu_get_default_locale` and `icu_set_default_locale` fall back to stub implementations that report a fixed `en-US` tag and ignore locale changes, so the static library still links without ICU. `set_common_data_77` (and its underlying ICU symbol) is compiled out, since there is no ICU to hand data to. The prebuilt download suffix gains a `_noicu` component, and CI builds a `simdutf + no_icu` release variant across the targets the Deno CLI ships so a `librusty_v8_simdutf_noicu_release_<target>.a` archive is published.
Adds a `build-windows-arm64-simdutf-noicu` cross-compile job mirroring the existing simdutf aarch64-windows job, building with `--features simdutf --features no_icu` and publishing the `_simdutf_noicu` archive and src binding. Also adds it to the `publish` job's `needs` so the crate publish waits for it.
The no_icu stubs make set_default_locale a no-op and get_language_tag return a fixed en-US tag, so the locale round-trip assertion does not hold without ICU.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an opt-out
no_icucargo feature that builds V8 withv8_enable_i18n_support=false. This drops the embedded ICU data (around10MB) and the
IntlAPI from the resulting static library, producing aslimmer build for consumers that do not need internationalization. The
motivation is a slim
denortvariant for the Deno CLI, where the ICU andIntlsurface is rarely used.The feature is an opt-out rather than a default-on
icufeature onpurpose. A default-on feature would silently drop ICU for every consumer
that sets
default-features = false(which the Deno CLI does), and itwould change existing prebuilt archive names. Modelling it as
no_icukeeps all current consumers and their archive names unchanged, and only
the slim build opts in.
A new
rusty_v8_enable_i18nGN arg gates the ICU bindings insrc/binding.cc. When i18n is disabled,icu_get_default_localeandicu_set_default_localefall back to stub implementations that report afixed
en-UStag and ignore locale changes, so the static library stilllinks without ICU.
set_common_data_77and its underlying ICU symbol arecompiled out, since there is no ICU to hand data to. The ICU-specific
tests are gated behind
not(feature = "no_icu").The prebuilt download suffix gains a
_noicucomponent. CI builds asimdutf + no_icurelease variant across the targets the Deno CLI ships(including the separate
aarch64-pc-windows-msvccross-compile job), so alibrusty_v8_simdutf_noicu_release_<target>.aarchive is published. Thisis the exact feature combo the CLI consumes (it always builds with
simdutf), so it does not expand the matrix into a full cross product.
Note: this is a prototype/experiment. The slim deno consumer plumbing (a
no_icucargo feature threaded throughdeno_core/deno_runtimeand adenort-slimtarget) lives in the Deno repo and consumes the archivesproduced here.
A possible future cleanup is to make simdutf a separately linkable
archive so it stops being a build-matrix axis: #1997.