Skip to content

Commit abf429c

Browse files
authored
Implement IANA normalizer baked data provider (#251)
This PR begins the initial work for implementing baked data providers. There is probably going to be a lot more work to be done on this topic overall (especially for tzif support). This is meant as a minimum proof of concept that adds support for IANA identifier normalization, and adds that support to `FsTzdbProvider`. List of changes: - Adds bakeddata internal tool (this will need to be iterated on and further built out probably). - Adds a `temporal_provider` crate for sourcing zoneinfo data and bakeddata struct definitions. - Adds the newly baked `SINGLETON_IANA_NORMALIZER` to `FsTzdbProvider` General points of consideration: - I'm not entirely sure how much of an infrastructure we want to build out to begin with, so the goal here was to be fairly minimal in the approach. - My assumption is that the large diff here is from adding in the zoneinfo files into the repository. We can long term request the data from IANA as they are publicly hosted, but I do think that the locality of having the files in the project for reference is nice. There is a good argument for removing the makefile, newsfile, and a couple things like that. - For bakeddata's output, I've added both a debug and file path. I think this is probably going to be a good approach for maintenance long term. The thought approach here is that we should ideally not be committing generated binary without having a debug view of it.
1 parent ff28feb commit abf429c

File tree

13 files changed

+1703
-22
lines changed

13 files changed

+1703
-22
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
# will have compiled files and executables
33
debug/
44
target/
5+
tzdata/
6+
7+
# Include the data debug view
8+
!/provider/src/data/debug
59

610
# These are backup files generated by rustfmt
711
**/*.rs.bk
@@ -10,3 +14,6 @@ target/
1014
*.pdb
1115

1216
.vscode/
17+
18+
# Ignore log files
19+
*.log

Cargo.lock

+144-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[workspace]
22
resolver = "2"
3-
members = ["diplomat-gen", "temporal_capi"]
3+
members = ["diplomat-gen", "bakeddata", "provider", "temporal_capi"]
44

55
[workspace.package]
66
edition = "2021"
@@ -13,13 +13,18 @@ readme = "./README.md"
1313
exclude = [
1414
"docs/*",
1515
".github/*",
16+
"debug/",
1617
".gitignore",
1718
"CONTRIBUTING.md",
1819
"cliff.toml",
1920
]
2021

2122
[workspace.dependencies]
23+
# Self
2224
temporal_rs = { version = "~0.0.6", path = ".", default-features = false }
25+
temporal_provider = { version = "~0.0.6", path = "./provider" }
26+
27+
# Dependencies
2328
tinystr = "0.8.1"
2429
icu_calendar = { version = "2.0.0-beta2", default-features = false }
2530
rustc-hash = "2.1.0"
@@ -47,6 +52,8 @@ readme.workspace = true
4752
exclude.workspace = true
4853

4954
[dependencies]
55+
temporal_provider = { workspace = true, optional = true}
56+
5057
tinystr.workspace = true
5158
icu_calendar = { workspace = true, features = ["compiled_data"] }
5259
num-traits.workspace = true
@@ -70,7 +77,7 @@ default = ["sys"]
7077
log = ["dep:log"]
7178
compiled_data = ["tzdb"]
7279
sys = ["std", "dep:web-time"]
73-
tzdb = ["dep:tzif", "std", "dep:jiff-tzdb", "dep:combine"]
80+
tzdb = ["dep:tzif", "std", "dep:jiff-tzdb", "dep:combine", "dep:temporal_provider"]
7481
std = []
7582

7683
[package.metadata.cargo-all-features]

bakeddata/Cargo.toml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "bakeddata"
3+
edition.workspace = true
4+
version.workspace = true
5+
rust-version.workspace = true
6+
authors.workspace = true
7+
license.workspace = true
8+
repository.workspace = true
9+
readme.workspace = true
10+
exclude.workspace = true
11+
publish = false
12+
13+
[dependencies]
14+
databake = "0.2.0"
15+
serde_json = "1.0.140"
16+
temporal_provider = { workspace = true }

bakeddata/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Temporal Databake
2+
3+
This tool is intended to be for internal tool for regenerating baked data files.
4+
5+
To use, run:
6+
7+
```bash
8+
cargo run -p bakeddata
9+
```

0 commit comments

Comments
 (0)