Browse Source

Fix build on most recent crates.io version

releases/0.17
jedel1043 1 year ago
parent
commit
932670d824
No known key found for this signature in database
  1. 2
      Cargo.lock
  2. 2
      Cargo.toml
  3. 2
      boa_engine/Cargo.toml
  4. 10
      boa_engine/src/builtins/string/mod.rs
  5. 13
      boa_icu_provider/Cargo.toml
  6. BIN
      boa_icu_provider/data/normalization.postcard
  7. 15
      boa_icu_provider/src/bin/datagen.rs
  8. 40
      boa_icu_provider/src/lib.rs
  9. 3
      boa_parser/Cargo.toml
  10. 5
      boa_parser/src/lexer/identifier.rs

2
Cargo.lock generated

@ -492,7 +492,6 @@ dependencies = [
"log",
"once_cell",
"simple_logger",
"zerovec",
]
[[package]]
@ -542,6 +541,7 @@ dependencies = [
"boa_profiler",
"fast-float",
"icu_properties",
"icu_provider",
"num-bigint",
"num-traits",
"once_cell",

2
Cargo.toml

@ -19,7 +19,7 @@ members = [
[workspace.package]
edition = "2021"
version = "0.17.0"
rust-version = "1.66"
rust-version = "1.69"
authors = ["boa-dev"]
repository = "https://github.com/boa-dev/boa"
license = "Unlicense/MIT"

2
boa_engine/Cargo.toml

@ -76,7 +76,7 @@ num_enum = "0.6.1"
pollster = "0.3.0"
thin-vec = "0.2.12"
itertools = { version = "0.11.0", default-features = false }
icu_normalizer = "1.2.0"
icu_normalizer = { version = "1.2.0", features = ["serde"] }
# intl deps
icu_locid_transform = { version = "1.2.1", features = ["std", "serde"], optional = true }

10
boa_engine/src/builtins/string/mod.rs

@ -2077,14 +2077,14 @@ impl String {
{
use once_cell::sync::Lazy;
static NORMALIZERS: Lazy<StringNormalizers> = Lazy::new(|| {
let provider = &boa_icu_provider::minimal();
let nfc = ComposingNormalizer::try_new_nfc_unstable(provider)
let provider = boa_icu_provider::minimal();
let nfc = ComposingNormalizer::try_new_nfc_with_buffer_provider(provider)
.expect("minimal data should always be updated");
let nfkc = ComposingNormalizer::try_new_nfkc_unstable(provider)
let nfkc = ComposingNormalizer::try_new_nfkc_with_buffer_provider(provider)
.expect("minimal data should always be updated");
let nfd = DecomposingNormalizer::try_new_nfd_unstable(provider)
let nfd = DecomposingNormalizer::try_new_nfd_with_buffer_provider(provider)
.expect("minimal data should always be updated");
let nfkd = DecomposingNormalizer::try_new_nfkd_unstable(provider)
let nfkd = DecomposingNormalizer::try_new_nfkd_with_buffer_provider(provider)
.expect("minimal data should always be updated");
StringNormalizers {

13
boa_icu_provider/Cargo.toml

@ -17,22 +17,19 @@ icu_provider = { version = "1.2.0", features = ["serde", "sync"] }
icu_collections = "1.2.0"
icu_normalizer = "1.2.0"
icu_properties = "1.2.0"
zerovec = "0.9.4"
icu_provider_blob = { version = "1.2.0" }
icu_provider_adapters = { version = "1.2.0", features = ["serde"] }
once_cell = { version = "1.18.0", default-features = false, features = ["critical-section"] }
icu_datagen = { version = "1.2.5", optional = true }
icu_provider_blob = { version = "1.2.0", optional = true }
icu_provider_adapters = { version = "1.2.0", features = ["serde"], optional = true }
once_cell = { version = "1.18.0", default-features = false, features = [
"critical-section",
], optional = true }
log = { version = "0.4.19", optional = true }
simple_logger = { version = "4.2.0", optional = true }
icu_casemapping = { version = "0.7.2", optional = true }
[features]
default = ["std"]
full = ["dep:once_cell", "dep:icu_provider_blob", "dep:icu_provider_adapters"]
std = ["once_cell?/std"]
full = []
std = ["once_cell/std"]
bin = ["dep:icu_datagen", "dep:simple_logger", "dep:log", "dep:icu_casemapping"]
[[bin]]

BIN
boa_icu_provider/data/normalization.postcard

Binary file not shown.

15
boa_icu_provider/src/bin/datagen.rs

@ -7,7 +7,7 @@ use std::{error::Error, fs::File};
use boa_icu_provider::data_root;
use icu_casemapping::provider::CaseMappingV1Marker;
use icu_datagen::{all_keys, datagen, BakedOptions, CoverageLevel, Out, SourceData};
use icu_datagen::{all_keys, datagen, CoverageLevel, Out, SourceData};
use icu_normalizer::provider::{
CanonicalCompositionsV1Marker, CanonicalDecompositionDataV1Marker,
CanonicalDecompositionTablesV1Marker, CompatibilityDecompositionSupplementV1Marker,
@ -31,16 +31,9 @@ fn main() -> Result<(), Box<dyn Error>> {
data_root().join("icudata.postcard"),
)?));
let normalization_out = Out::Baked {
mod_directory: data_root().join("min"),
options: {
let mut opt = BakedOptions::default();
opt.use_separate_crates = true;
opt.overwrite = true;
opt.pretty = true;
opt
},
};
let normalization_out = Out::Blob(Box::new(File::create(
data_root().join("normalization.postcard"),
)?));
let locales = source_data.locales(&[CoverageLevel::Modern])?;

40
boa_icu_provider/src/lib.rs

@ -70,6 +70,10 @@
#![allow(elided_lifetimes_in_paths)]
#![cfg_attr(not(feature = "bin"), no_std)]
use icu_provider_adapters::fallback::LocaleFallbackProvider;
use icu_provider_blob::BlobDataProvider;
use once_cell::sync::Lazy;
/// Gets the path to the directory where the generated data is stored.
#[cfg(feature = "bin")]
#[must_use]
@ -80,11 +84,20 @@ pub fn data_root() -> std::path::PathBuf {
/// Gets a minimal data provider that is used when the `intl` feature of `boa_engine` is
/// disabled.
// Could use `LocaleFallbackProvider` in the future, which would disallow the `const`.
#[must_use]
#[allow(clippy::missing_const_for_fn)]
pub fn minimal() -> MinimalDataProvider {
MinimalDataProvider
pub fn minimal() -> &'static impl icu_provider::BufferProvider {
static PROVIDER: Lazy<LocaleFallbackProvider<BlobDataProvider>> = Lazy::new(|| {
let blob = BlobDataProvider::try_new_from_static_blob(include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
"/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.")
});
&*PROVIDER
}
/// Gets the default data provider stored as a [`BufferProvider`].
@ -93,10 +106,6 @@ pub fn minimal() -> MinimalDataProvider {
#[cfg(feature = "full")]
#[must_use]
pub fn buffer() -> &'static impl icu_provider::BufferProvider {
use icu_provider_adapters::fallback::LocaleFallbackProvider;
use icu_provider_blob::BlobDataProvider;
use once_cell::sync::Lazy;
static PROVIDER: Lazy<LocaleFallbackProvider<BlobDataProvider>> = Lazy::new(|| {
let blob = BlobDataProvider::try_new_from_static_blob(include_bytes!(concat!(
env!("CARGO_MANIFEST_DIR"),
@ -109,20 +118,3 @@ pub fn buffer() -> &'static impl icu_provider::BufferProvider {
&*PROVIDER
}
#[doc(hidden)]
#[non_exhaustive]
#[derive(Clone, Copy, Debug)]
pub struct MinimalDataProvider;
#[allow(
unreachable_pub,
clippy::unreadable_literal,
clippy::unnecessary_lazy_evaluations,
clippy::module_name_repetitions,
rustdoc::private_doc_tests
)]
mod baked {
include!("../data/min/mod.rs");
impl_data_provider!(super::MinimalDataProvider);
}

3
boa_parser/Cargo.toml

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

5
boa_parser/src/lexer/identifier.rs

@ -7,6 +7,7 @@ use boa_ast::{Keyword, Position, Span};
use boa_interner::Interner;
use boa_profiler::Profiler;
use icu_properties::sets::{CodePointSetData, CodePointSetDataBorrowed};
use icu_provider::serde::AsDeserializingBufferProvider;
use once_cell::sync::Lazy;
use std::io::Read;
@ -21,11 +22,11 @@ struct PropertySets {
/// Static `PropertySets` derived from Boa's default ICU4X data.
static PROPERTY_SETS: Lazy<PropertySets> = Lazy::new(|| {
static ID_START: Lazy<CodePointSetData> = Lazy::new(|| {
icu_properties::sets::load_id_start(&boa_icu_provider::minimal())
icu_properties::sets::load_id_start(&boa_icu_provider::minimal().as_deserializing())
.expect("data should be valid")
});
static ID_CONTINUE: Lazy<CodePointSetData> = Lazy::new(|| {
icu_properties::sets::load_id_continue(&boa_icu_provider::minimal())
icu_properties::sets::load_id_continue(&boa_icu_provider::minimal().as_deserializing())
.expect("data should be valid")
});

Loading…
Cancel
Save