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
293 changes: 152 additions & 141 deletions Cargo.lock

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
[workspace]
members = ["rust-bindings"]
resolver = "2"

# ── Local-development overrides (opt-in) ──────────────────────────────
# Redirect the openjd-* crates to a sibling ~/openjd-rs checkout so the
# bindings build against the in-flight Rust workspace instead of crates.io.
# Cargo only honors [patch] at the workspace root, so it lives here rather
# than in rust-bindings/Cargo.toml. Paths are relative to this file.
# Re-comment before committing so CI/published wheels resolve from crates.io.
# [patch.crates-io]
# openjd-expr = { path = "../openjd-rs/crates/openjd-expr" }
# openjd-model = { path = "../openjd-rs/crates/openjd-model" }
# openjd-sessions = { path = "../openjd-rs/crates/openjd-sessions" }
95 changes: 48 additions & 47 deletions THIRD-PARTY-LICENSES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


** annotated-types; version 0.7.0 -- https://pypi.org/project/annotated-types/
** annotated-types; version 0.8.0 -- https://pypi.org/project/annotated-types/
The MIT License (MIT)

Copyright (c) 2022 the contributors
Expand Down Expand Up @@ -611,7 +611,7 @@ PERFORMANCE OF THIS SOFTWARE.
** encoding_rs; version 0.8.35 -- https://crates.io/crates/encoding_rs
** nohash-hasher; version 0.2.0 -- https://crates.io/crates/nohash-hasher
** static_assertions; version 1.1.0 -- https://crates.io/crates/static_assertions
** tinyvec; version 1.11.0 -- https://crates.io/crates/tinyvec
** tinyvec; version 1.12.0 -- https://crates.io/crates/tinyvec

Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -1447,7 +1447,7 @@ PERFORMANCE OF THIS SOFTWARE.


------
** zerocopy; version 0.8.52 -- https://crates.io/crates/zerocopy
** zerocopy; version 0.8.55 -- https://crates.io/crates/zerocopy
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -1860,11 +1860,11 @@ PERFORMANCE OF THIS SOFTWARE.


------
** futures-core; version 0.3.32 -- https://crates.io/crates/futures-core
** futures-macro; version 0.3.32 -- https://crates.io/crates/futures-macro
** futures-sink; version 0.3.32 -- https://crates.io/crates/futures-sink
** futures-task; version 0.3.32 -- https://crates.io/crates/futures-task
** futures-util; version 0.3.32 -- https://crates.io/crates/futures-util
** futures-core; version 0.3.33 -- https://crates.io/crates/futures-core
** futures-macro; version 0.3.33 -- https://crates.io/crates/futures-macro
** futures-sink; version 0.3.33 -- https://crates.io/crates/futures-sink
** futures-task; version 0.3.33 -- https://crates.io/crates/futures-task
** futures-util; version 0.3.33 -- https://crates.io/crates/futures-util
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -2071,10 +2071,10 @@ limitations under the License.

------
** ahash; version 0.8.12 -- https://crates.io/crates/ahash
** arc-swap; version 1.9.1 -- https://crates.io/crates/arc-swap
** arc-swap; version 1.9.2 -- https://crates.io/crates/arc-swap
** base64; version 0.22.1 -- https://crates.io/crates/base64
** bitflags; version 2.13.0 -- https://crates.io/crates/bitflags
** bstr; version 1.12.1 -- https://crates.io/crates/bstr
** bitflags; version 2.13.1 -- https://crates.io/crates/bitflags
** bstr; version 1.13.0 -- https://crates.io/crates/bstr
** bumpalo; version 3.20.3 -- https://crates.io/crates/bumpalo
** cfg-if; version 1.0.4 -- https://crates.io/crates/cfg-if
** either; version 1.16.0 -- https://crates.io/crates/either
Expand All @@ -2086,28 +2086,28 @@ limitations under the License.
** heck; version 0.5.0 -- https://crates.io/crates/heck
** indexmap; version 2.14.0 -- https://crates.io/crates/indexmap
** itertools; version 0.14.0 -- https://crates.io/crates/itertools
** js-sys; version 0.3.102 -- https://crates.io/crates/js-sys
** log; version 0.4.32 -- https://crates.io/crates/log
** js-sys; version 0.3.103 -- https://crates.io/crates/js-sys
** log; version 0.4.33 -- https://crates.io/crates/log
** num-traits; version 0.2.19 -- https://crates.io/crates/num-traits
** once_cell; version 1.21.4 -- https://crates.io/crates/once_cell
** ordermap; version 1.2.0 -- https://crates.io/crates/ordermap
** pyo3-log; version 0.13.4 -- https://crates.io/crates/pyo3-log
** regex-automata; version 0.4.14 -- https://crates.io/crates/regex-automata
** regex-automata; version 0.4.16 -- https://crates.io/crates/regex-automata
** regex-syntax; version 0.8.11 -- https://crates.io/crates/regex-syntax
** regex; version 1.12.4 -- https://crates.io/crates/regex
** regex; version 1.13.1 -- https://crates.io/crates/regex
** signal-hook-registry; version 1.4.8 -- https://crates.io/crates/signal-hook-registry
** smallvec; version 1.15.2 -- https://crates.io/crates/smallvec
** unicode-normalization; version 0.1.25 -- https://crates.io/crates/unicode-normalization
** unicode-width; version 0.2.2 -- https://crates.io/crates/unicode-width
** unicode_names2; version 1.3.0 -- https://crates.io/crates/unicode_names2
** uuid; version 1.23.3 -- https://crates.io/crates/uuid
** value-bag; version 1.12.0 -- https://crates.io/crates/value-bag
** uuid; version 1.24.0 -- https://crates.io/crates/uuid
** value-bag; version 1.13.1 -- https://crates.io/crates/value-bag
** wasi; version 0.11.1+wasi-snapshot-preview1 -- https://crates.io/crates/wasi
** wasip2; version 1.0.4+wasi-0.2.12 -- https://crates.io/crates/wasip2
** wasm-bindgen-macro-support; version 0.2.125 -- https://crates.io/crates/wasm-bindgen-macro-support
** wasm-bindgen-macro; version 0.2.125 -- https://crates.io/crates/wasm-bindgen-macro
** wasm-bindgen-shared; version 0.2.125 -- https://crates.io/crates/wasm-bindgen-shared
** wasm-bindgen; version 0.2.125 -- https://crates.io/crates/wasm-bindgen
** wasm-bindgen-macro-support; version 0.2.126 -- https://crates.io/crates/wasm-bindgen-macro-support
** wasm-bindgen-macro; version 0.2.126 -- https://crates.io/crates/wasm-bindgen-macro
** wasm-bindgen-shared; version 0.2.126 -- https://crates.io/crates/wasm-bindgen-shared
** wasm-bindgen; version 0.2.126 -- https://crates.io/crates/wasm-bindgen
** wit-bindgen; version 0.57.1 -- https://crates.io/crates/wit-bindgen
Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -2522,36 +2522,37 @@ limitations under the License.
** arraydeque; version 0.5.1 -- https://crates.io/crates/arraydeque
** get-size-derive2; version 0.7.4 -- https://crates.io/crates/get-size-derive2
** get-size2; version 0.7.4 -- https://crates.io/crates/get-size2
** granit-parser; version 0.0.3 -- https://crates.io/crates/granit-parser
** granit-parser; version 0.0.7 -- https://crates.io/crates/granit-parser
** itoa; version 1.0.18 -- https://crates.io/crates/itoa
** libc; version 0.2.186 -- https://crates.io/crates/libc
** libc; version 0.2.189 -- https://crates.io/crates/libc
** manyhow-macros; version 0.11.4 -- https://crates.io/crates/manyhow-macros
** openjd-expr; version 0.1.2 -- https://crates.io/crates/openjd-expr
** openjd-model; version 0.3.0 -- https://crates.io/crates/openjd-model
** openjd-sessions; version 0.3.1 -- https://crates.io/crates/openjd-sessions
** openjd-expr; version 0.2.1 -- https://crates.io/crates/openjd-expr
** openjd-model; version 0.4.0 -- https://crates.io/crates/openjd-model
** openjd-sessions; version 0.4.0 -- https://crates.io/crates/openjd-sessions
** pin-project-lite; version 0.2.17 -- https://crates.io/crates/pin-project-lite
** portable-atomic; version 1.13.1 -- https://crates.io/crates/portable-atomic
** proc-macro2; version 1.0.106 -- https://crates.io/crates/proc-macro2
** portable-atomic; version 1.14.0 -- https://crates.io/crates/portable-atomic
** proc-macro2; version 1.0.107 -- https://crates.io/crates/proc-macro2
** pyo3-ffi; version 0.29.0 -- https://crates.io/crates/pyo3-ffi
** pyo3-macros-backend; version 0.29.0 -- https://crates.io/crates/pyo3-macros-backend
** pyo3-macros; version 0.29.0 -- https://crates.io/crates/pyo3-macros
** pyo3; version 0.29.0 -- https://crates.io/crates/pyo3
** quote; version 1.0.45 -- https://crates.io/crates/quote
** quote; version 1.0.47 -- https://crates.io/crates/quote
** r-efi; version 5.3.0 -- https://crates.io/crates/r-efi
** r-efi; version 6.0.0 -- https://crates.io/crates/r-efi
** rustc-hash; version 2.1.2 -- https://crates.io/crates/rustc-hash
** rustversion; version 1.0.22 -- https://crates.io/crates/rustversion
** rustc-hash; version 2.1.3 -- https://crates.io/crates/rustc-hash
** rustversion; version 1.0.23 -- https://crates.io/crates/rustversion
** ryu; version 1.0.23 -- https://crates.io/crates/ryu
** serde-saphyr; version 0.0.27 -- https://crates.io/crates/serde-saphyr
** serde; version 1.0.228 -- https://crates.io/crates/serde
** serde_core; version 1.0.228 -- https://crates.io/crates/serde_core
** serde_derive; version 1.0.228 -- https://crates.io/crates/serde_derive
** serde_json; version 1.0.150 -- https://crates.io/crates/serde_json
** serde-saphyr; version 0.0.29 -- https://crates.io/crates/serde-saphyr
** serde; version 1.0.229 -- https://crates.io/crates/serde
** serde_core; version 1.0.229 -- https://crates.io/crates/serde_core
** serde_derive; version 1.0.229 -- https://crates.io/crates/serde_derive
** serde_json; version 1.0.151 -- https://crates.io/crates/serde_json
** shlex; version 2.0.1 -- https://crates.io/crates/shlex
** siphasher; version 1.0.3 -- https://crates.io/crates/siphasher
** syn; version 2.0.118 -- https://crates.io/crates/syn
** thiserror-impl; version 2.0.18 -- https://crates.io/crates/thiserror-impl
** thiserror; version 2.0.18 -- https://crates.io/crates/thiserror
** syn; version 2.0.119 -- https://crates.io/crates/syn
** syn; version 3.0.3 -- https://crates.io/crates/syn
** thiserror-impl; version 2.0.19 -- https://crates.io/crates/thiserror-impl
** thiserror; version 2.0.19 -- https://crates.io/crates/thiserror
** unicode-ident; version 1.0.24 -- https://crates.io/crates/unicode-ident
Apache License
Version 2.0, January 2004
Expand Down Expand Up @@ -2659,7 +2660,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


------
** mio; version 1.2.1 -- https://crates.io/crates/mio
** mio; version 1.2.2 -- https://crates.io/crates/mio
Copyright (c) 2014 Carl Lerche and other MIO contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -2682,7 +2683,7 @@ THE SOFTWARE.


------
** which; version 8.0.4 -- https://crates.io/crates/which
** which; version 8.0.5 -- https://crates.io/crates/which
Copyright (c) 2015 fangyuanziti

Permission is hereby granted, free of charge, to any person obtaining a copy
Expand All @@ -2705,7 +2706,7 @@ THE SOFTWARE.


------
** bytes; version 1.11.1 -- https://crates.io/crates/bytes
** bytes; version 1.12.1 -- https://crates.io/crates/bytes
Copyright (c) 2018 Carl Lerche

Permission is hereby granted, free of charge, to any
Expand Down Expand Up @@ -2792,7 +2793,7 @@ DEALINGS IN THE SOFTWARE.


------
** tokio-macros; version 2.7.0 -- https://crates.io/crates/tokio-macros
** tokio-macros; version 2.7.1 -- https://crates.io/crates/tokio-macros
MIT License

Copyright (c) 2019 Yoshua Wuyts
Expand Down Expand Up @@ -2921,8 +2922,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.


------
** tokio-util; version 0.7.18 -- https://crates.io/crates/tokio-util
** tokio; version 1.52.3 -- https://crates.io/crates/tokio
** tokio-util; version 0.7.19 -- https://crates.io/crates/tokio-util
** tokio; version 1.53.1 -- https://crates.io/crates/tokio
MIT License

Copyright (c) Tokio Contributors
Expand All @@ -2947,7 +2948,7 @@ SOFTWARE.


------
** zmij; version 1.0.21 -- https://crates.io/crates/zmij
** zmij; version 1.0.23 -- https://crates.io/crates/zmij
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Expand Down Expand Up @@ -3000,7 +3001,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

------
** aho-corasick; version 1.1.4 -- https://crates.io/crates/aho-corasick
** memchr; version 2.8.2 -- https://crates.io/crates/memchr
** memchr; version 2.8.3 -- https://crates.io/crates/memchr
The MIT License (MIT)

Copyright (c) 2015 Andrew Gallant
Expand Down
10 changes: 7 additions & 3 deletions rust-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ name = "_openjd_rs"
crate-type = ["cdylib", "rlib"]

[dependencies]
openjd-expr = "0.1.2"
openjd-model = "0.3.0"
openjd-sessions = "0.3.1"
openjd-expr = "0.2.1"
openjd-model = "0.4.0"
openjd-sessions = "0.4.0"
tokio = { version = "1", features = ["rt-multi-thread"] }
uuid = { version = "1", features = ["v4"] }
serde_json = "1"
Expand Down Expand Up @@ -52,6 +52,10 @@ windows = { version = "0.62", features = [
# wheel is built against the crates.io versions, which is what the
# Cargo.lock file pins.
#
# NOTE: the [patch.crates-io] block that redirects these to a sibling
# ~/openjd-rs checkout must live at the *workspace root* Cargo.toml — cargo
# ignores `[patch]` in non-root package manifests. See ../Cargo.toml.
#
# [patch.crates-io]
# openjd-expr = { path = "../../openjd-rs/crates/openjd-expr" }
# openjd-model = { path = "../../openjd-rs/crates/openjd-model" }
Expand Down
15 changes: 12 additions & 3 deletions rust-bindings/src/model/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ impl PyEmbeddedFile {
fn new(
name: String,
r#type: String,
filename: Option<crate::expr::PyFormatString>,
filename: Option<String>,
data: Option<crate::expr::PyFormatString>,
runnable: Option<bool>,
#[allow(non_snake_case)] endOfLine: Option<String>,
Expand Down Expand Up @@ -586,7 +586,9 @@ impl PyEmbeddedFile {
inner: job::EmbeddedFile {
name,
file_type,
filename: filename.map(|f| f.inner),
// Plain string per the 2023-09 schema: the field is not
// @fmtstring, so "{{ }}" sequences are literal text.
filename,
data: data.map(|d| d.inner),
runnable,
end_of_line,
Expand All @@ -607,7 +609,7 @@ impl PyEmbeddedFile {

#[getter]
fn filename(&self) -> Option<String> {
self.inner.filename.as_ref().map(|f| f.raw().to_string())
self.inner.filename.clone()
}

#[getter]
Expand Down Expand Up @@ -1085,6 +1087,9 @@ impl PyCancelationMode {
match &self.inner {
job::CancelationMode::Terminate => "TERMINATE",
job::CancelationMode::NotifyThenTerminate { .. } => "NOTIFY_THEN_TERMINATE",
// The raw format string; the mode decision is deferred to run
// time. Matches the openjd-rs serialization of DeferredMode.
job::CancelationMode::DeferredMode { mode, .. } => mode.raw(),
}
}

Expand All @@ -1093,6 +1098,10 @@ impl PyCancelationMode {
match &self.inner {
job::CancelationMode::NotifyThenTerminate {
notify_period_in_seconds,
}
| job::CancelationMode::DeferredMode {
notify_period_in_seconds,
..
} => notify_period_in_seconds
.as_ref()
.map(|t| t.raw().to_string()),
Expand Down
45 changes: 38 additions & 7 deletions rust-bindings/src/model/template_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,18 @@ impl PyCancelationMode {
"NOTIFY_THEN_TERMINATE" => CancelationMode::NotifyThenTerminate {
notify_period_in_seconds: notify_period_in_seconds.map(|fs| fs.inner),
},
// A format-string mode (FEATURE_BUNDLE_1) defers the
// TERMINATE-vs-NOTIFY_THEN_TERMINATE decision to run time.
// Mirrors the openjd-rs serde impl, which routes any mode
// containing "{{" to CancelationMode::DeferredMode.
other if other.contains("{{") => CancelationMode::DeferredMode {
mode: openjd_expr::FormatString::new(other).map_err(|e| {
pyo3::exceptions::PyValueError::new_err(format!(
"invalid cancelation mode format string: {e}"
))
})?,
notify_period_in_seconds: notify_period_in_seconds.map(|fs| fs.inner),
},
other => {
return Err(pyo3::exceptions::PyValueError::new_err(format!(
"unknown cancelation mode: {other}"
Expand All @@ -173,6 +185,9 @@ impl PyCancelationMode {
match &self.inner {
CancelationMode::Terminate => "TERMINATE",
CancelationMode::NotifyThenTerminate { .. } => "NOTIFY_THEN_TERMINATE",
// The raw format string; the mode decision is deferred to run
// time. Matches the openjd-rs serialization of DeferredMode.
CancelationMode::DeferredMode { mode, .. } => mode.raw(),
}
}

Expand All @@ -182,6 +197,10 @@ impl PyCancelationMode {
CancelationMode::Terminate => None,
CancelationMode::NotifyThenTerminate {
notify_period_in_seconds,
}
| CancelationMode::DeferredMode {
notify_period_in_seconds,
..
} => notify_period_in_seconds
.as_ref()
.map(|fs| PyFormatString { inner: fs.clone() }),
Expand All @@ -208,6 +227,19 @@ impl PyCancelationMode {
"CancelationMode(mode='NOTIFY_THEN_TERMINATE', notify_period_in_seconds={raw})"
)
}
CancelationMode::DeferredMode {
mode,
notify_period_in_seconds,
} => {
let raw = notify_period_in_seconds
.as_ref()
.map(|fs| format!("{:?}", fs.raw()))
.unwrap_or_else(|| "None".to_string());
format!(
"CancelationMode(mode={:?}, notify_period_in_seconds={raw})",
mode.raw()
)
}
}
}

Expand Down Expand Up @@ -524,7 +556,7 @@ impl PyEmbeddedFile {
fn new(
name: String,
r#type: &str,
filename: Option<PyFormatString>,
filename: Option<String>,
data: Option<PyFormatString>,
runnable: Option<bool>,
end_of_line: Option<&str>,
Expand All @@ -533,7 +565,9 @@ impl PyEmbeddedFile {
inner: EmbeddedFile {
name,
file_type: parse_file_type(r#type)?,
filename: filename.map(|fs| fs.inner),
// Plain string per the 2023-09 schema: the field is not
// @fmtstring, so "{{ }}" sequences are literal text.
filename,
data: data.map(|fs| fs.inner),
runnable,
end_of_line: end_of_line.map(parse_eol).transpose()?,
Expand All @@ -553,11 +587,8 @@ impl PyEmbeddedFile {
}

#[getter]
fn filename(&self) -> Option<PyFormatString> {
self.inner
.filename
.as_ref()
.map(|fs| PyFormatString { inner: fs.clone() })
fn filename(&self) -> Option<String> {
self.inner.filename.clone()
}

#[getter]
Expand Down
Loading
Loading