Skip to content

Commit 28865a3

Browse files
committed
feat: feature flag in rust interpreter
Signed-off-by: Nick Mitchell <[email protected]>
1 parent e84afe8 commit 28865a3

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

pdl-live-react/src-tauri/Cargo.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ edition = "2024"
1414
name = "tauri_app_lib"
1515
crate-type = ["staticlib", "cdylib", "rlib"]
1616

17+
[features]
18+
interpreter = ["dep:rustpython-vm", "dep:rustpython-stdlib", "dep:rustpython-pylib"]
19+
1720
[build-dependencies]
1821
tauri-build = { version = "2", features = [] }
1922

@@ -37,13 +40,13 @@ serde_norway = "0.9.42"
3740
minijinja = { version = "2.9.0", features = ["custom_syntax"] }
3841
ollama-rs = { version = "0.3.1", features = ["stream"] }
3942
owo-colors = "4.2.0"
40-
rustpython-vm = { git="https://github.com/RustPython/RustPython.git", features= ["importlib", "threading", "encodings"] } # "0.4.0"
43+
rustpython-vm = { git="https://github.com/RustPython/RustPython.git", features= ["importlib", "threading", "encodings"], optional = true } # "0.4.0"
4144
async-recursion = "1.1.1"
4245
tokio-stream = "0.1.17"
4346
tokio = { version = "1.44.1", features = ["io-std"] }
4447
indexmap = { version = "2.9.0", features = ["serde"] }
45-
rustpython-stdlib = { git="https://github.com/RustPython/RustPython.git", features = ["ssl-vendor"] } # 0.4.0
46-
rustpython-pylib = { git="https://github.com/RustPython/RustPython.git", features = ["freeze-stdlib"] } # 0.4.0
48+
rustpython-stdlib = { git="https://github.com/RustPython/RustPython.git", features = ["ssl-vendor"], optional = true } # 0.4.0
49+
rustpython-pylib = { git="https://github.com/RustPython/RustPython.git", features = ["freeze-stdlib"], optional = true } # 0.4.0
4750
schemars = "0.8.22"
4851
fs4 = "0.13.1"
4952
derive_builder = "0.20.2"

pdl-live-react/src-tauri/src/cli.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use urlencoding::encode;
55

66
use crate::compile;
77
use crate::gui::new_window;
8+
#[cfg(feature = "interpreter")]
89
use crate::pdl::interpreter::{RunOptions, load_scope, run_file_sync};
910

1011
#[cfg(desktop)]
@@ -49,6 +50,7 @@ pub fn setup(app: &mut tauri::App) -> Result<bool, Box<dyn ::std::error::Error>>
4950
_ => Err(Box::from("Unsupported compile command")),
5051
}
5152
}
53+
#[cfg(feature = "interpreter")]
5254
"run" => run_file_sync(
5355
subcommand_args
5456
.get("source")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[cfg(feature = "interpreter")]
12
pub mod interpreter;
3+
24
pub mod read_trace;
35
pub mod replay_prep;

pdl-live-react/src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ pub fn run() {
3333
.invoke_handler(tauri::generate_handler![
3434
commands::read_trace::read_trace,
3535
commands::replay_prep::replay_prep,
36+
#[cfg(feature = "interpreter")]
3637
commands::interpreter::run_pdl_program,
3738
])
3839
.run(tauri::generate_context!())

pdl-live-react/src-tauri/src/pdl/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
pub mod ast;
22
pub mod extract;
3+
#[cfg(feature = "interpreter")]
34
pub mod interpreter;
5+
#[cfg(feature = "interpreter")]
46
mod interpreter_tests;
57
pub mod pip;
68
pub mod pull;

0 commit comments

Comments
 (0)