diff --git a/pdl-live-react/src-tauri/Cargo.toml b/pdl-live-react/src-tauri/Cargo.toml index c477183ea..eec0bcde5 100644 --- a/pdl-live-react/src-tauri/Cargo.toml +++ b/pdl-live-react/src-tauri/Cargo.toml @@ -14,6 +14,9 @@ edition = "2024" name = "tauri_app_lib" crate-type = ["staticlib", "cdylib", "rlib"] +[features] +interpreter = ["dep:rustpython-vm", "dep:rustpython-stdlib", "dep:rustpython-pylib"] + [build-dependencies] tauri-build = { version = "2", features = [] } @@ -37,13 +40,13 @@ serde_norway = "0.9.42" minijinja = { version = "2.9.0", features = ["custom_syntax"] } ollama-rs = { version = "0.3.1", features = ["stream"] } owo-colors = "4.2.0" -rustpython-vm = { git="https://github.com/RustPython/RustPython.git", features= ["importlib", "threading", "encodings"] } # "0.4.0" +rustpython-vm = { git="https://github.com/RustPython/RustPython.git", features= ["importlib", "threading", "encodings"], optional = true } # "0.4.0" async-recursion = "1.1.1" tokio-stream = "0.1.17" tokio = { version = "1.44.1", features = ["io-std"] } indexmap = { version = "2.9.0", features = ["serde"] } -rustpython-stdlib = { git="https://github.com/RustPython/RustPython.git", features = ["ssl-vendor"] } # 0.4.0 -rustpython-pylib = { git="https://github.com/RustPython/RustPython.git", features = ["freeze-stdlib"] } # 0.4.0 +rustpython-stdlib = { git="https://github.com/RustPython/RustPython.git", features = ["ssl-vendor"], optional = true } # 0.4.0 +rustpython-pylib = { git="https://github.com/RustPython/RustPython.git", features = ["freeze-stdlib"], optional = true } # 0.4.0 schemars = "0.8.22" fs4 = "0.13.1" derive_builder = "0.20.2" diff --git a/pdl-live-react/src-tauri/src/cli.rs b/pdl-live-react/src-tauri/src/cli.rs index a85a6b6fd..9aba03a0e 100644 --- a/pdl-live-react/src-tauri/src/cli.rs +++ b/pdl-live-react/src-tauri/src/cli.rs @@ -5,6 +5,7 @@ use urlencoding::encode; use crate::compile; use crate::gui::new_window; +#[cfg(feature = "interpreter")] use crate::pdl::interpreter::{RunOptions, load_scope, run_file_sync}; #[cfg(desktop)] @@ -49,6 +50,7 @@ pub fn setup(app: &mut tauri::App) -> Result> _ => Err(Box::from("Unsupported compile command")), } } + #[cfg(feature = "interpreter")] "run" => run_file_sync( subcommand_args .get("source") diff --git a/pdl-live-react/src-tauri/src/commands/mod.rs b/pdl-live-react/src-tauri/src/commands/mod.rs index 5c98f7441..f78e96cdd 100644 --- a/pdl-live-react/src-tauri/src/commands/mod.rs +++ b/pdl-live-react/src-tauri/src/commands/mod.rs @@ -1,3 +1,5 @@ +#[cfg(feature = "interpreter")] pub mod interpreter; + pub mod read_trace; pub mod replay_prep; diff --git a/pdl-live-react/src-tauri/src/lib.rs b/pdl-live-react/src-tauri/src/lib.rs index 86b0b444c..1589720de 100644 --- a/pdl-live-react/src-tauri/src/lib.rs +++ b/pdl-live-react/src-tauri/src/lib.rs @@ -33,6 +33,7 @@ pub fn run() { .invoke_handler(tauri::generate_handler![ commands::read_trace::read_trace, commands::replay_prep::replay_prep, + #[cfg(feature = "interpreter")] commands::interpreter::run_pdl_program, ]) .run(tauri::generate_context!()) diff --git a/pdl-live-react/src-tauri/src/pdl/mod.rs b/pdl-live-react/src-tauri/src/pdl/mod.rs index 179cb9e10..b8580f387 100644 --- a/pdl-live-react/src-tauri/src/pdl/mod.rs +++ b/pdl-live-react/src-tauri/src/pdl/mod.rs @@ -1,6 +1,8 @@ pub mod ast; pub mod extract; +#[cfg(feature = "interpreter")] pub mod interpreter; +#[cfg(feature = "interpreter")] mod interpreter_tests; pub mod pip; pub mod pull;