Skip to content
Merged
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
50 changes: 48 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,27 @@ jobs:
- name: Regenerate presets.rs
working-directory: tools
run: uv run python generate-rust.py
- name: Verify presets.rs matches committed output
run: git diff --exit-code src/zmanim/presets.rs
- name: Regenerate interop generated files
working-directory: tools
run: uv run python generate-interop.py
- name: Verify generated outputs match committed files
run: git diff --exit-code src/zmanim/presets.rs interop/src/generated interop/src/zman_preset.rs

diplomat-interop:
name: Diplomat interop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.14"
- uses: Swatinem/rust-cache@v2
- name: Regenerate interop files
working-directory: tools
run: uv run python generate-interop.py
- name: Build and test interop crate
run: cargo test -p interop

fmt:
name: Format
Expand Down Expand Up @@ -105,6 +124,33 @@ jobs:
working-directory: interop-tests/js_interop_tests
run: cargo test --test js_interop

typescript-interop:
name: TypeScript interop
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
- uses: astral-sh/setup-uv@v5
with:
python-version: "3.14"
- uses: Swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: "22"
- name: Regenerate interop files
working-directory: tools
run: uv run python generate-interop.py
- name: Install diplomat-tool
run: cargo install diplomat-tool --version 0.15.0 --locked
- name: Test TypeScript package
working-directory: interop/packages/typescript
run: |
npm run generate
npm test
npm run typecheck

java-interop-tests:
name: Java Interop Tests
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dist/
downloads/
eggs/
.eggs/
lib/
# lib/
lib64/
parts/
sdist/
Expand Down
71 changes: 71 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ workspace = true

[workspace]
resolver = "2"
members = ["interop-tests/java_interop_tests", "interop-tests/js_interop_tests"]
members = ["interop","interop-tests/java_interop_tests", "interop-tests/js_interop_tests"]

[workspace.lints.rust]
missing_docs = "warn"
Expand Down
1 change: 1 addition & 0 deletions interop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bindings/
30 changes: 30 additions & 0 deletions interop/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[package]
name = "interop"
version = "0.1.0"
edition = "2024"
publish = false

[lib]
crate-type = ["cdylib", "staticlib", "rlib"]

[dependencies]
diplomat = "0.15.0"
diplomat-runtime = "0.15.1"
icu_calendar = { version = "2.2.0", default-features = false }
jiff = { version = "0.2.0", features = ["std", "alloc", "tzdb-bundle-always"] }
jiff-icu = { version = "0.2.0", default-features = false }
kosher-rust = { path = "..", features = ["alloc"] }
num_enum = { version = "0.7.0", default-features = false }

[build-dependencies]

[dev-dependencies]
kosher-rust = { path = "..", features = ["alloc"] }
jiff = { version = "0.2.0", features = ["std", "alloc", "tzdb-bundle-always"] }

[lints]
workspace = true

[[test]]
name = "adapter_tests"
path = "tests/adapter_tests.rs"
34 changes: 34 additions & 0 deletions interop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# kosher-rust Diplomat interop

Multi-language FFI bridge for [`kosher-rust`](../README.md), built with [Diplomat](https://rust-diplomat.github.io/diplomat/).

## Regeneration

Preset IDs and dispatch tables are generated from the same DSL as [`src/zmanim/presets.rs`](../src/zmanim/presets.rs):

```bash
cd tools
uv run python generate-interop.py
```

This runs automatically from [`build.rs`](build.rs) on every `cargo build -p interop`.

## TypeScript / JavaScript package

Bindings live in [`packages/typescript`](packages/typescript/). Regenerate and test:

```bash
cd interop/packages/typescript
npm install
npm run generate # diplomat-tool js → lib/
npm run build:wasm # cargo build -p interop --target wasm32-unknown-unknown
npm test
```

WASM path is configured in [`packages/typescript/diplomat.config.mjs`](packages/typescript/diplomat.config.mjs) (relative to the repo `target/` directory).

## Dart package

See [`packages/dart`](packages/dart/) — run `dart pub get && dart test` after building the native library via the package hook.


7 changes: 7 additions & 0 deletions interop/packages/dart/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://dart.dev/tools/private-files
# Created by `dart pub`
.dart_tool/

# Avoid committing pubspec.lock for library packages; see
# https://dart.dev/tools/pub/private-files#pubspec-lock.
pubspec.lock
30 changes: 30 additions & 0 deletions interop/packages/dart/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml

# Uncomment the following section to specify additional rules.

# linter:
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

# For additional information about configuring this file, see
# https://dart.dev/tools/analysis
Loading
Loading