Browse Source

Fix Intl build

releases/0.17
jedel1043 1 year ago
parent
commit
fda03ea792
No known key found for this signature in database
  1. 2
      Cargo.lock
  2. 32
      boa_engine/Cargo.toml
  3. 16
      boa_icu_provider/Cargo.toml
  4. 2
      boa_icu_provider/data/min/any.rs
  5. 177
      boa_icu_provider/data/min/mod.rs
  6. 6
      boa_icu_provider/data/min/normalizer/comp_v1/mod.rs
  7. 7
      boa_icu_provider/data/min/normalizer/comp_v1/und.rs.data
  8. 6
      boa_icu_provider/data/min/normalizer/mod.rs
  9. 6
      boa_icu_provider/data/min/normalizer/nfd_v1/mod.rs
  10. 19
      boa_icu_provider/data/min/normalizer/nfd_v1/und.rs.data
  11. 6
      boa_icu_provider/data/min/normalizer/nfdex_v1/mod.rs
  12. 8
      boa_icu_provider/data/min/normalizer/nfdex_v1/und.rs.data
  13. 6
      boa_icu_provider/data/min/normalizer/nfkd_v1/mod.rs
  14. 21
      boa_icu_provider/data/min/normalizer/nfkd_v1/und.rs.data
  15. 6
      boa_icu_provider/data/min/normalizer/nfkdex_v1/mod.rs
  16. 8
      boa_icu_provider/data/min/normalizer/nfkdex_v1/und.rs.data
  17. 7
      boa_icu_provider/data/min/props/idc_v1/mod.rs
  18. 9
      boa_icu_provider/data/min/props/idc_v1/und.rs.data
  19. 7
      boa_icu_provider/data/min/props/ids_v1/mod.rs
  20. 9
      boa_icu_provider/data/min/props/ids_v1/und.rs.data
  21. 3
      boa_icu_provider/data/min/props/mod.rs
  22. 8
      boa_icu_provider/src/lib.rs
  23. 4
      boa_parser/Cargo.toml

2
Cargo.lock generated

@ -425,6 +425,7 @@ dependencies = [
"icu_normalizer", "icu_normalizer",
"icu_plurals", "icu_plurals",
"icu_provider", "icu_provider",
"icu_provider_macros",
"icu_segmenter", "icu_segmenter",
"indexmap 2.0.0", "indexmap 2.0.0",
"indoc", "indoc",
@ -449,6 +450,7 @@ dependencies = [
"textwrap", "textwrap",
"thin-vec", "thin-vec",
"thiserror", "thiserror",
"tinystr",
"writeable", "writeable",
"yoke", "yoke",
"zerofrom", "zerofrom",

32
boa_engine/Cargo.toml

@ -32,6 +32,8 @@ intl = [
"dep:sys-locale", "dep:sys-locale",
"dep:yoke", "dep:yoke",
"dep:zerofrom", "dep:zerofrom",
"dep:tinystr",
"dep:icu_provider_macros"
] ]
fuzz = ["boa_ast/arbitrary", "boa_interner/arbitrary"] fuzz = ["boa_ast/arbitrary", "boa_interner/arbitrary"]
@ -76,23 +78,25 @@ num_enum = "0.6.1"
pollster = "0.3.0" pollster = "0.3.0"
thin-vec = "0.2.12" thin-vec = "0.2.12"
itertools = { version = "0.11.0", default-features = false } itertools = { version = "0.11.0", default-features = false }
icu_normalizer = { version = "1.2.0", features = ["serde"] } icu_normalizer = { version = "~1.2.0", features = ["serde"] }
# intl deps # intl deps
icu_locid_transform = { version = "1.2.1", features = ["std", "serde"], optional = true }
icu_locid = { version = "1.2.0", features = ["serde"], optional = true }
icu_datetime = { version = "1.2.1", features = ["serde", "experimental"], optional = true }
icu_calendar = { version = "1.2.0", optional = true }
icu_collator = { version = "1.2.0", features = ["serde"], optional = true }
icu_plurals = { version = "1.2.0", features = ["serde"], optional = true }
icu_provider = { version = "1.2.0", optional = true }
icu_list = { version = "1.2.0", features = ["serde"], optional = true }
icu_casemapping = { version = "0.7.2", features = ["serde"], optional = true}
icu_segmenter = { version = "1.2.1", features = ["serde"], optional = true }
writeable = { version = "0.5.2", optional = true }
yoke = { version = "0.7.1", optional = true }
zerofrom = { version = "0.1.2", optional = true }
sys-locale = { version = "0.3.0", optional = true } sys-locale = { version = "0.3.0", optional = true }
icu_locid_transform = { version = "~1.2.1", features = ["std", "serde"], optional = true }
icu_locid = { version = "~1.2.0", features = ["serde"], optional = true }
icu_datetime = { version = "~1.2.1", features = ["serde", "experimental"], optional = true }
icu_calendar = { version = "~1.2.0", optional = true }
icu_collator = { version = "~1.2.0", features = ["serde"], optional = true }
icu_plurals = { version = "~1.2.0", features = ["serde"], optional = true }
icu_provider = { version = "~1.2.0", optional = true }
icu_list = { version = "~1.2.0", features = ["serde"], optional = true }
icu_casemapping = { version = "~0.7.2", features = ["serde"], optional = true}
icu_segmenter = { version = "~1.2.1", features = ["serde"], optional = true }
writeable = { version = "~0.5.2", optional = true }
yoke = { version = "~0.7.1", optional = true }
zerofrom = { version = "~0.1.2", optional = true }
tinystr = { version = ">=0.7.0, <0.7.3", optional = true }
icu_provider_macros = { version = "~1.2.0", optional = true }
[dev-dependencies] [dev-dependencies]
criterion = "0.5.1" criterion = "0.5.1"

16
boa_icu_provider/Cargo.toml

@ -13,18 +13,18 @@ rust-version.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
icu_provider = { version = "1.2.0", features = ["serde", "sync"] } icu_provider = { version = "~1.2.0", features = ["serde", "sync"] }
icu_collections = "1.2.0" icu_collections = "~1.2.0"
icu_normalizer = "1.2.0" icu_normalizer = "~1.2.0"
icu_properties = "1.2.0" icu_properties = "~1.2.0"
icu_provider_blob = { version = "1.2.0" } icu_provider_blob = { version = "~1.2.0" }
icu_provider_adapters = { version = "1.2.0", features = ["serde"] } icu_provider_adapters = { version = "~1.2.0", features = ["serde"] }
once_cell = { version = "1.18.0", default-features = false, features = ["critical-section"] } once_cell = { version = "1.18.0", default-features = false, features = ["critical-section"] }
icu_datagen = { version = "1.2.5", optional = true } icu_datagen = { version = "~1.2.5", optional = true }
log = { version = "0.4.19", optional = true } log = { version = "0.4.19", optional = true }
simple_logger = { version = "4.2.0", optional = true } simple_logger = { version = "4.2.0", optional = true }
icu_casemapping = { version = "0.7.2", optional = true } icu_casemapping = { version = "~0.7.2", optional = true }
[features] [features]
default = ["std"] default = ["std"]

2
boa_icu_provider/data/min/any.rs

@ -1,2 +0,0 @@
// @generated
impl_any_provider!(BakedDataProvider);

177
boa_icu_provider/data/min/mod.rs

@ -1,177 +0,0 @@
// @generated
#[clippy::msrv = "1.61"]
mod normalizer;
#[clippy::msrv = "1.61"]
mod props;
#[clippy::msrv = "1.61"]
use icu_provider::prelude::*;
/// Implement [`DataProvider<M>`] on the given struct using the data
/// hardcoded in this module. This allows the struct to be used with
/// `icu`'s `_unstable` constructors.
///
/// This macro can only be called from its definition-site, i.e. right
/// after `include!`-ing the generated module.
///
/// ```compile_fail
/// struct MyDataProvider;
/// include!("/path/to/generated/mod.rs");
/// impl_data_provider(MyDataProvider);
/// ```
#[allow(unused_macros)]
macro_rules! impl_data_provider {
($ provider : path) => {
#[clippy::msrv = "1.61"]
impl DataProvider<::icu_normalizer::provider::CanonicalCompositionsV1Marker> for $provider {
fn load(&self, req: DataRequest) -> Result<DataResponse<::icu_normalizer::provider::CanonicalCompositionsV1Marker>, DataError> {
normalizer::comp_v1::lookup(&req.locale)
.map(zerofrom::ZeroFrom::zero_from)
.map(DataPayload::from_owned)
.map(|payload| DataResponse {
metadata: Default::default(),
payload: Some(payload),
})
.ok_or_else(|| DataErrorKind::MissingLocale.with_req(::icu_normalizer::provider::CanonicalCompositionsV1Marker::KEY, req))
}
}
#[clippy::msrv = "1.61"]
impl DataProvider<::icu_normalizer::provider::CanonicalDecompositionDataV1Marker> for $provider {
fn load(&self, req: DataRequest) -> Result<DataResponse<::icu_normalizer::provider::CanonicalDecompositionDataV1Marker>, DataError> {
normalizer::nfd_v1::lookup(&req.locale)
.map(zerofrom::ZeroFrom::zero_from)
.map(DataPayload::from_owned)
.map(|payload| DataResponse {
metadata: Default::default(),
payload: Some(payload),
})
.ok_or_else(|| DataErrorKind::MissingLocale.with_req(::icu_normalizer::provider::CanonicalDecompositionDataV1Marker::KEY, req))
}
}
#[clippy::msrv = "1.61"]
impl DataProvider<::icu_normalizer::provider::CanonicalDecompositionTablesV1Marker> for $provider {
fn load(&self, req: DataRequest) -> Result<DataResponse<::icu_normalizer::provider::CanonicalDecompositionTablesV1Marker>, DataError> {
normalizer::nfdex_v1::lookup(&req.locale)
.map(zerofrom::ZeroFrom::zero_from)
.map(DataPayload::from_owned)
.map(|payload| DataResponse {
metadata: Default::default(),
payload: Some(payload),
})
.ok_or_else(|| DataErrorKind::MissingLocale.with_req(::icu_normalizer::provider::CanonicalDecompositionTablesV1Marker::KEY, req))
}
}
#[clippy::msrv = "1.61"]
impl DataProvider<::icu_normalizer::provider::CompatibilityDecompositionSupplementV1Marker> for $provider {
fn load(
&self,
req: DataRequest,
) -> Result<DataResponse<::icu_normalizer::provider::CompatibilityDecompositionSupplementV1Marker>, DataError> {
normalizer::nfkd_v1::lookup(&req.locale)
.map(zerofrom::ZeroFrom::zero_from)
.map(DataPayload::from_owned)
.map(|payload| DataResponse {
metadata: Default::default(),
payload: Some(payload),
})
.ok_or_else(|| {
DataErrorKind::MissingLocale.with_req(::icu_normalizer::provider::CompatibilityDecompositionSupplementV1Marker::KEY, req)
})
}
}
#[clippy::msrv = "1.61"]
impl DataProvider<::icu_normalizer::provider::CompatibilityDecompositionTablesV1Marker> for $provider {
fn load(
&self,
req: DataRequest,
) -> Result<DataResponse<::icu_normalizer::provider::CompatibilityDecompositionTablesV1Marker>, DataError> {
normalizer::nfkdex_v1::lookup(&req.locale)
.map(zerofrom::ZeroFrom::zero_from)
.map(DataPayload::from_owned)
.map(|payload| DataResponse {
metadata: Default::default(),
payload: Some(payload),
})
.ok_or_else(|| {
DataErrorKind::MissingLocale.with_req(::icu_normalizer::provider::CompatibilityDecompositionTablesV1Marker::KEY, req)
})
}
}
#[clippy::msrv = "1.61"]
impl DataProvider<::icu_properties::provider::IdContinueV1Marker> for $provider {
fn load(&self, req: DataRequest) -> Result<DataResponse<::icu_properties::provider::IdContinueV1Marker>, DataError> {
props::idc_v1::lookup(&req.locale)
.map(zerofrom::ZeroFrom::zero_from)
.map(DataPayload::from_owned)
.map(|payload| DataResponse {
metadata: Default::default(),
payload: Some(payload),
})
.ok_or_else(|| DataErrorKind::MissingLocale.with_req(::icu_properties::provider::IdContinueV1Marker::KEY, req))
}
}
#[clippy::msrv = "1.61"]
impl DataProvider<::icu_properties::provider::IdStartV1Marker> for $provider {
fn load(&self, req: DataRequest) -> Result<DataResponse<::icu_properties::provider::IdStartV1Marker>, DataError> {
props::ids_v1::lookup(&req.locale)
.map(zerofrom::ZeroFrom::zero_from)
.map(DataPayload::from_owned)
.map(|payload| DataResponse {
metadata: Default::default(),
payload: Some(payload),
})
.ok_or_else(|| DataErrorKind::MissingLocale.with_req(::icu_properties::provider::IdStartV1Marker::KEY, req))
}
}
};
}
/// Implement [`AnyProvider`] on the given struct using the data
/// hardcoded in this module. This allows the struct to be used with
/// `icu`'s `_any` constructors.
///
/// This macro can only be called from its definition-site, i.e. right
/// after `include!`-ing the generated module.
///
/// ```compile_fail
/// struct MyAnyProvider;
/// include!("/path/to/generated/mod.rs");
/// impl_any_provider(MyAnyProvider);
/// ```
#[allow(unused_macros)]
macro_rules! impl_any_provider {
($ provider : path) => {
#[clippy::msrv = "1.61"]
impl AnyProvider for $provider {
fn load_any(&self, key: DataKey, req: DataRequest) -> Result<AnyResponse, DataError> {
const CANONICALCOMPOSITIONSV1MARKER: ::icu_provider::DataKeyHash =
::icu_normalizer::provider::CanonicalCompositionsV1Marker::KEY.hashed();
const CANONICALDECOMPOSITIONDATAV1MARKER: ::icu_provider::DataKeyHash =
::icu_normalizer::provider::CanonicalDecompositionDataV1Marker::KEY.hashed();
const CANONICALDECOMPOSITIONTABLESV1MARKER: ::icu_provider::DataKeyHash =
::icu_normalizer::provider::CanonicalDecompositionTablesV1Marker::KEY.hashed();
const COMPATIBILITYDECOMPOSITIONSUPPLEMENTV1MARKER: ::icu_provider::DataKeyHash =
::icu_normalizer::provider::CompatibilityDecompositionSupplementV1Marker::KEY.hashed();
const COMPATIBILITYDECOMPOSITIONTABLESV1MARKER: ::icu_provider::DataKeyHash =
::icu_normalizer::provider::CompatibilityDecompositionTablesV1Marker::KEY.hashed();
const IDCONTINUEV1MARKER: ::icu_provider::DataKeyHash = ::icu_properties::provider::IdContinueV1Marker::KEY.hashed();
const IDSTARTV1MARKER: ::icu_provider::DataKeyHash = ::icu_properties::provider::IdStartV1Marker::KEY.hashed();
match key.hashed() {
CANONICALCOMPOSITIONSV1MARKER => normalizer::comp_v1::lookup(&req.locale).map(AnyPayload::from_static_ref),
CANONICALDECOMPOSITIONDATAV1MARKER => normalizer::nfd_v1::lookup(&req.locale).map(AnyPayload::from_static_ref),
CANONICALDECOMPOSITIONTABLESV1MARKER => normalizer::nfdex_v1::lookup(&req.locale).map(AnyPayload::from_static_ref),
COMPATIBILITYDECOMPOSITIONSUPPLEMENTV1MARKER => normalizer::nfkd_v1::lookup(&req.locale).map(AnyPayload::from_static_ref),
COMPATIBILITYDECOMPOSITIONTABLESV1MARKER => normalizer::nfkdex_v1::lookup(&req.locale).map(AnyPayload::from_static_ref),
IDCONTINUEV1MARKER => props::idc_v1::lookup(&req.locale).map(AnyPayload::from_static_ref),
IDSTARTV1MARKER => props::ids_v1::lookup(&req.locale).map(AnyPayload::from_static_ref),
_ => return Err(DataErrorKind::MissingDataKey.with_req(key, req)),
}
.map(|payload| AnyResponse {
payload: Some(payload),
metadata: Default::default(),
})
.ok_or_else(|| DataErrorKind::MissingLocale.with_req(key, req))
}
}
};
}
#[clippy::msrv = "1.61"]
pub struct BakedDataProvider;
impl_data_provider!(BakedDataProvider);

6
boa_icu_provider/data/min/normalizer/comp_v1/mod.rs

@ -1,6 +0,0 @@
// @generated
type DataStruct = < :: icu_normalizer :: provider :: CanonicalCompositionsV1Marker as :: icu_provider :: DataMarker > :: Yokeable ;
pub fn lookup(locale: &icu_provider::DataLocale) -> Option<&'static DataStruct> {
locale.is_empty().then(|| &UND)
}
static UND: DataStruct = include!("und.rs.data");

7
boa_icu_provider/data/min/normalizer/comp_v1/und.rs.data

File diff suppressed because one or more lines are too long

6
boa_icu_provider/data/min/normalizer/mod.rs

@ -1,6 +0,0 @@
// @generated
pub mod comp_v1;
pub mod nfd_v1;
pub mod nfdex_v1;
pub mod nfkd_v1;
pub mod nfkdex_v1;

6
boa_icu_provider/data/min/normalizer/nfd_v1/mod.rs

@ -1,6 +0,0 @@
// @generated
type DataStruct = < :: icu_normalizer :: provider :: CanonicalDecompositionDataV1Marker as :: icu_provider :: DataMarker > :: Yokeable ;
pub fn lookup(locale: &icu_provider::DataLocale) -> Option<&'static DataStruct> {
locale.is_empty().then(|| &UND)
}
static UND: DataStruct = include!("und.rs.data");

19
boa_icu_provider/data/min/normalizer/nfd_v1/und.rs.data

File diff suppressed because one or more lines are too long

6
boa_icu_provider/data/min/normalizer/nfdex_v1/mod.rs

@ -1,6 +0,0 @@
// @generated
type DataStruct = < :: icu_normalizer :: provider :: CanonicalDecompositionTablesV1Marker as :: icu_provider :: DataMarker > :: Yokeable ;
pub fn lookup(locale: &icu_provider::DataLocale) -> Option<&'static DataStruct> {
locale.is_empty().then(|| &UND)
}
static UND: DataStruct = include!("und.rs.data");

8
boa_icu_provider/data/min/normalizer/nfdex_v1/und.rs.data

File diff suppressed because one or more lines are too long

6
boa_icu_provider/data/min/normalizer/nfkd_v1/mod.rs

@ -1,6 +0,0 @@
// @generated
type DataStruct = < :: icu_normalizer :: provider :: CompatibilityDecompositionSupplementV1Marker as :: icu_provider :: DataMarker > :: Yokeable ;
pub fn lookup(locale: &icu_provider::DataLocale) -> Option<&'static DataStruct> {
locale.is_empty().then(|| &UND)
}
static UND: DataStruct = include!("und.rs.data");

21
boa_icu_provider/data/min/normalizer/nfkd_v1/und.rs.data

File diff suppressed because one or more lines are too long

6
boa_icu_provider/data/min/normalizer/nfkdex_v1/mod.rs

@ -1,6 +0,0 @@
// @generated
type DataStruct = < :: icu_normalizer :: provider :: CompatibilityDecompositionTablesV1Marker as :: icu_provider :: DataMarker > :: Yokeable ;
pub fn lookup(locale: &icu_provider::DataLocale) -> Option<&'static DataStruct> {
locale.is_empty().then(|| &UND)
}
static UND: DataStruct = include!("und.rs.data");

8
boa_icu_provider/data/min/normalizer/nfkdex_v1/und.rs.data

File diff suppressed because one or more lines are too long

7
boa_icu_provider/data/min/props/idc_v1/mod.rs

@ -1,7 +0,0 @@
// @generated
type DataStruct =
<::icu_properties::provider::IdContinueV1Marker as ::icu_provider::DataMarker>::Yokeable;
pub fn lookup(locale: &icu_provider::DataLocale) -> Option<&'static DataStruct> {
locale.is_empty().then(|| &UND)
}
static UND: DataStruct = include!("und.rs.data");

9
boa_icu_provider/data/min/props/idc_v1/und.rs.data

File diff suppressed because one or more lines are too long

7
boa_icu_provider/data/min/props/ids_v1/mod.rs

@ -1,7 +0,0 @@
// @generated
type DataStruct =
<::icu_properties::provider::IdStartV1Marker as ::icu_provider::DataMarker>::Yokeable;
pub fn lookup(locale: &icu_provider::DataLocale) -> Option<&'static DataStruct> {
locale.is_empty().then(|| &UND)
}
static UND: DataStruct = include!("und.rs.data");

9
boa_icu_provider/data/min/props/ids_v1/und.rs.data

File diff suppressed because one or more lines are too long

3
boa_icu_provider/data/min/props/mod.rs

@ -1,3 +0,0 @@
// @generated
pub mod idc_v1;
pub mod ids_v1;

8
boa_icu_provider/src/lib.rs

@ -75,7 +75,6 @@
#![allow(elided_lifetimes_in_paths)] #![allow(elided_lifetimes_in_paths)]
#![cfg_attr(not(feature = "bin"), no_std)] #![cfg_attr(not(feature = "bin"), no_std)]
use icu_provider_adapters::fallback::LocaleFallbackProvider;
use icu_provider_blob::BlobDataProvider; use icu_provider_blob::BlobDataProvider;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
@ -92,13 +91,11 @@ pub fn data_root() -> std::path::PathBuf {
#[must_use] #[must_use]
#[allow(clippy::missing_const_for_fn)] #[allow(clippy::missing_const_for_fn)]
pub fn minimal() -> &'static impl icu_provider::BufferProvider { pub fn minimal() -> &'static impl icu_provider::BufferProvider {
static PROVIDER: Lazy<LocaleFallbackProvider<BlobDataProvider>> = Lazy::new(|| { static PROVIDER: Lazy<BlobDataProvider> = Lazy::new(|| {
let blob = BlobDataProvider::try_new_from_static_blob(include_bytes!(concat!( BlobDataProvider::try_new_from_static_blob(include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"), env!("CARGO_MANIFEST_DIR"),
"/data/normalization.postcard" "/data/normalization.postcard"
))) )))
.expect("The statically compiled data file should be valid.");
LocaleFallbackProvider::try_new_with_buffer_provider(blob)
.expect("The statically compiled data file should be valid.") .expect("The statically compiled data file should be valid.")
}); });
@ -111,6 +108,7 @@ pub fn minimal() -> &'static impl icu_provider::BufferProvider {
#[cfg(feature = "full")] #[cfg(feature = "full")]
#[must_use] #[must_use]
pub fn buffer() -> &'static impl icu_provider::BufferProvider { pub fn buffer() -> &'static impl icu_provider::BufferProvider {
use icu_provider_adapters::fallback::LocaleFallbackProvider;
static PROVIDER: Lazy<LocaleFallbackProvider<BlobDataProvider>> = Lazy::new(|| { static PROVIDER: Lazy<LocaleFallbackProvider<BlobDataProvider>> = Lazy::new(|| {
let blob = BlobDataProvider::try_new_from_static_blob(include_bytes!(concat!( let blob = BlobDataProvider::try_new_from_static_blob(include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"), env!("CARGO_MANIFEST_DIR"),

4
boa_parser/Cargo.toml

@ -22,8 +22,8 @@ num-traits = "0.2.15"
bitflags = "2.3.3" bitflags = "2.3.3"
num-bigint = "0.4.3" num-bigint = "0.4.3"
regress = "0.6.0" regress = "0.6.0"
icu_properties = {version = "1.2.0", features = ["serde"] } icu_properties = {version = "~1.2.0", features = ["serde"] }
icu_provider = "1.2.0" icu_provider = "~1.2.0"
once_cell = "1.18.0" once_cell = "1.18.0"
[features] [features]

Loading…
Cancel
Save