дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-08 19:02:17 +02:00
Temporary run configurations were kept with what settings derived when they were made (absolute mvn, -s / -Dmaven.repo.local, JAVA_HOME), and never went through the backend again, so after a Maven home / settings file / JDK change they and gutter test runs narrowed from them still ran the old ones. They are now kept without derived values (run_without_derived) and get the current settings applied when the run list loads (run_apply_settings). Maven's settings file and local repository apply to every Maven configuration unless it sets them itself. Earlier stored entries are dropped once. Refs #822
253 рядки
8.2 KiB
Rust
253 рядки
8.2 KiB
Rust
//! IPC commands of `ide_host::ops::run` (the shared implementation).
|
|
|
|
use crate::state::AppState;
|
|
use ide_core::{IdeResult, RunId};
|
|
#[allow(unused_imports)]
|
|
pub use ide_host::ops::run::*;
|
|
use ide_run::{OutputChunk, RunConfig, RunInfo};
|
|
use tauri::ipc::Channel;
|
|
use tauri::{State, Window};
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_dotnet_resolve(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
config: RunConfig,
|
|
debug: bool,
|
|
) -> IdeResult<RunConfig> {
|
|
ide_host::ops::run::run_dotnet_resolve(&state.host, window.label(), config, debug).await
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_application_build(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
config: RunConfig,
|
|
module: std::path::PathBuf,
|
|
) -> IdeResult<RunConfig> {
|
|
ide_host::ops::run::run_application_build(&state.host, window.label(), config, module).await
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_application_publish(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
config: RunConfig,
|
|
class_paths: Vec<String>,
|
|
main_class: String,
|
|
) -> IdeResult<()> {
|
|
ide_host::ops::run::run_application_publish(&state.host, window.label(), config, class_paths, main_class).await
|
|
}
|
|
|
|
/// Detected configs followed by user-defined ones (user ids win on conflict).
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_configs(window: Window, state: State<'_, AppState>) -> IdeResult<Vec<RunConfig>> {
|
|
// Detection reads build files (and Spring Boot sources): off the command thread.
|
|
let (host, label) = (state.host.clone(), window.label().to_owned());
|
|
tauri::async_runtime::spawn_blocking(move || ide_host::ops::run::configs(&host, &label))
|
|
.await
|
|
.map_err(|e| ide_core::IdeError::internal(e.to_string()))?
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_save_configs(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
configs: Vec<RunConfig>,
|
|
removed_detected_ids: Option<Vec<String>>,
|
|
) -> IdeResult<()> {
|
|
ide_host::ops::run::save_configs(&state.host, window.label(), &configs, &removed_detected_ids.unwrap_or_default())
|
|
}
|
|
|
|
/// Temporary configurations as they are kept between sessions: without what settings derived.
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_without_derived(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
configs: Vec<RunConfig>,
|
|
) -> IdeResult<Vec<RunConfig>> {
|
|
let (host, label) = (state.host.clone(), window.label().to_owned());
|
|
tauri::async_runtime::spawn_blocking(move || ide_host::ops::run::without_derived(&host, &label, configs))
|
|
.await
|
|
.map_err(|e| ide_core::IdeError::internal(e.to_string()))?
|
|
}
|
|
|
|
/// Kept temporary configurations with the current settings applied.
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_apply_settings(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
configs: Vec<RunConfig>,
|
|
) -> IdeResult<Vec<RunConfig>> {
|
|
let (host, label) = (state.host.clone(), window.label().to_owned());
|
|
tauri::async_runtime::spawn_blocking(move || ide_host::ops::run::apply_settings(&host, &label, configs))
|
|
.await
|
|
.map_err(|e| ide_core::IdeError::internal(e.to_string()))?
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_start(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
config: RunConfig,
|
|
on_output: Channel<OutputChunk>,
|
|
) -> IdeResult<RunInfo> {
|
|
let emit = std::sync::Arc::new(move |chunk| {
|
|
let _ = on_output.send(chunk);
|
|
});
|
|
ide_host::ops::run::start(&state.host, window.label(), config, emit).await
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_stop(window: Window, state: State<'_, AppState>, id: RunId) -> IdeResult<()> {
|
|
ide_host::ops::run::stop(&state.host, window.label(), id)
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_stdin(state: State<'_, AppState>, id: RunId, data: String) -> IdeResult<()> {
|
|
ide_host::ops::run::stdin(&state.host, id, &data)
|
|
}
|
|
|
|
/// Terminal size of a run started with "Emulate terminal in output console".
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_resize(state: State<'_, AppState>, id: RunId, cols: u16, rows: u16) -> IdeResult<()> {
|
|
ide_host::ops::run::resize(&state.host, id, cols, rows)
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_list(state: State<'_, AppState>) -> Vec<RunInfo> {
|
|
ide_host::ops::run::list(&state.host)
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_close_stdin(state: State<'_, AppState>, id: RunId) -> IdeResult<()> {
|
|
ide_host::ops::run::close_stdin(&state.host, id)
|
|
}
|
|
/// Configuration templates: per-type defaults applied to new configurations.
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_templates(window: Window, state: State<'_, AppState>) -> IdeResult<Vec<RunConfig>> {
|
|
ide_host::ops::run::run_templates(&state.host, window.label())
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_save_templates(window: Window, state: State<'_, AppState>, templates: Vec<RunConfig>) -> IdeResult<()> {
|
|
ide_host::ops::run::run_save_templates(&state.host, window.label(), templates)
|
|
}
|
|
|
|
/// Project files run configurations can be imported from (`.vscode/launch.json`).
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_import_sources(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
) -> IdeResult<Vec<ide_run::import::RunImportSource>> {
|
|
ide_host::ops::run::run_import_sources(&state.host, window.label())
|
|
}
|
|
|
|
/// Configurations read from `source`, not saved; names already in `existing` are skipped.
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_import_configs(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
source: ide_run::import::RunImportSource,
|
|
existing: Vec<RunConfig>,
|
|
) -> IdeResult<ide_run::import::RunImport> {
|
|
ide_host::ops::run::run_import_configs(&state.host, window.label(), source, existing)
|
|
}
|
|
|
|
/// The environment runs inherit when "Include system environment variables" is on.
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub fn run_system_env(state: State<'_, AppState>) -> std::collections::BTreeMap<String, String> {
|
|
ide_host::ops::run::run_system_env(&state.host, "")
|
|
}
|
|
|
|
/// Writes the Gradle init script adding `jvm_args` to the JVMs the build forks; returns its path.
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_gradle_jvm_args_script(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
jvm_args: Vec<String>,
|
|
) -> IdeResult<String> {
|
|
ide_host::ops::run::run_gradle_jvm_args_script(&state.host, window.label(), jvm_args).await
|
|
}
|
|
|
|
/// Results from the JUnit XML reports (Surefire, Failsafe, Gradle) of the module at
|
|
/// `module` (relative to the project root) written since `since_ms` (Unix epoch, ms).
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_test_reports(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
module: Option<std::path::PathBuf>,
|
|
since_ms: f64,
|
|
) -> IdeResult<Vec<ide_run::junit::TestCaseReport>> {
|
|
ide_host::ops::run::run_test_reports(&state.host, window.label(), module, since_ms).await
|
|
}
|
|
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_tomcat_home(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
home: String,
|
|
) -> IdeResult<ide_run::tomcat::TomcatHome> {
|
|
ide_host::ops::run::run_tomcat_home(&state.host, window.label(), home).await
|
|
}
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_tomcat_artifacts(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
) -> IdeResult<Vec<ide_build::web::WebArtifact>> {
|
|
ide_host::ops::run::run_tomcat_artifacts(&state.host, window.label()).await
|
|
}
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_tomcat_build(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
config: RunConfig,
|
|
) -> IdeResult<Option<RunConfig>> {
|
|
ide_host::ops::run::run_tomcat_build(&state.host, window.label(), config).await
|
|
}
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_tomcat_sync(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
config: RunConfig,
|
|
module: std::path::PathBuf,
|
|
class_paths: Vec<String>,
|
|
resources_only: bool,
|
|
) -> IdeResult<bool> {
|
|
ide_host::ops::run::run_tomcat_sync(&state.host, window.label(), config, module, class_paths, resources_only).await
|
|
}
|
|
#[tauri::command]
|
|
#[specta::specta]
|
|
pub async fn run_tomcat_update(
|
|
window: Window,
|
|
state: State<'_, AppState>,
|
|
config: RunConfig,
|
|
mode: String,
|
|
) -> IdeResult<()> {
|
|
ide_host::ops::run::run_tomcat_update(&state.host, window.label(), config, mode).await
|
|
}
|