Файли
openidea/src-tauri/src/commands/sdk.rs
T
l0ng-ai ba9ce1d842
CI / Changes (push) Successful in 1s
Language smoke / Language smoke (go) (push) Failing after 6s
Language smoke / Language smoke (java) (push) Failing after 5s
Language smoke / Language smoke (kotlin) (push) Failing after 5s
Language smoke / Language smoke (python) (push) Failing after 4s
Language smoke / Language smoke (typescript) (push) Failing after 4s
Language smoke / Language smoke (rust) (push) Failing after 5s
CI / Rust (ubuntu-22.04) (push) Failing after 43s
CI / Plugins (SDK, official, fixtures) (push) Failing after 1m19s
CI / Remote server (linux musl) (push) Failing after 1m32s
CI / Cargo deny (push) Successful in 54s
CI / E2E (push) Successful in 15m57s
CI / Frontend (push) Successful in 24m49s
CI / Rust (macos-latest) (push) Canceled after 0s
CI / Rust (windows-latest) (push) Canceled after 0s
fix(workspace): unify nested project discovery and run ownership (#1716)
* fix(build): scope Kotlin bridge to linked Maven modules

* fix(run): resolve nested Go modules for context runs

* fix(gradle): discover nested builds and select compatible JVMs

* fix(workspace): share project discovery and module ownership

* fix(run): keep root toolchains for nested modules and resolve them once per module

- Python run configurations of a nested module without its own virtualenv use the closest one up to the project root.
- Gradle builds and runs fall back to the JDK matching the project's Java version when the Gradle version is unknown.
- Module-local interpreters and toolchains are resolved lazily, once per owning module.
- Tests build expected paths per segment so they hold on Windows.
2026-11-06 15:51:41 +08:00

142 рядки
4.3 KiB
Rust
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
//! IPC commands of `ide_host::ops::sdk` (the shared implementation).
use crate::state::AppState;
use ide_core::{IdeResult, RequestId};
#[allow(unused_imports)]
pub use ide_host::ops::sdk::*;
use ide_sdk::python::PythonPackage;
use ide_sdk::{Sdk, SdkKind};
use std::path::PathBuf;
use tauri::ipc::Channel;
use tauri::{State, Window};
/// Installed interpreters / toolchains of `kind`; project-local ones first.
#[tauri::command]
#[specta::specta]
pub async fn sdk_detect(window: Window, state: State<'_, AppState>, kind: SdkKind) -> IdeResult<Vec<Sdk>> {
ide_host::ops::sdk::sdk_detect(&state.host, window.label(), kind).await
}
/// The interpreter the project uses: the configured one, else its virtualenv.
#[tauri::command]
#[specta::specta]
pub fn sdk_python_effective(
window: Window,
state: State<'_, AppState>,
near: Option<PathBuf>,
) -> IdeResult<Option<ide_core::IpcPath>> {
ide_host::ops::sdk::sdk_python_effective(&state.host, window.label(), near)
}
/// The PHP interpreter chosen in Settings › Languages & Frameworks › PHP; `None`: the `php` on `PATH`.
#[tauri::command]
#[specta::specta]
pub fn sdk_php_effective(window: Window, state: State<'_, AppState>) -> IdeResult<Option<ide_core::IpcPath>> {
ide_host::ops::sdk::sdk_php_effective(&state.host, window.label())
}
/// The PHP language level of the project `path` belongs to: the effective one and Auto's.
#[tauri::command]
#[specta::specta]
pub async fn sdk_php_language_level(
window: Window,
state: State<'_, AppState>,
path: PathBuf,
) -> IdeResult<ide_host::ops::sdk::PhpLanguageLevels> {
ide_host::ops::sdk::sdk_php_language_level(&state.host, window.label(), path).await
}
/// The Composer project `path` belongs to, when its dependencies need `composer install`.
#[tauri::command]
#[specta::specta]
pub async fn sdk_php_composer_install(
window: Window,
state: State<'_, AppState>,
path: PathBuf,
) -> IdeResult<Option<ide_host::ops::sdk::ComposerInstallState>> {
ide_host::ops::sdk::sdk_php_composer_install(&state.host, window.label(), path).await
}
/// SDK / library source folders shown under "External Libraries" in the Project view,
/// with the Maven / Gradle dependency jars of the build model.
#[tauri::command]
#[specta::specta]
pub async fn sdk_project_libraries(
window: Window,
state: State<'_, AppState>,
) -> IdeResult<Vec<ide_sdk::libraries::LibraryGroup>> {
ide_host::ops::sdk::sdk_project_libraries(&state.host, window.label()).await
}
/// Looks up `names` (bare command names): `node_modules/.bin` above `near`, then the search path.
#[tauri::command]
#[specta::specta]
pub async fn sdk_locate_tools(
window: Window,
state: State<'_, AppState>,
names: Vec<String>,
near: Option<PathBuf>,
) -> IdeResult<LocatedTools> {
ide_host::ops::sdk::sdk_locate_tools(&state.host, window.label(), names, near).await
}
/// `base -m venv location`; output lines stream through `on_output`.
#[tauri::command]
#[specta::specta]
pub async fn sdk_python_create_venv(
window: Window,
state: State<'_, AppState>,
base: PathBuf,
location: PathBuf,
request: RequestId,
on_output: Channel<String>,
) -> IdeResult<Sdk> {
ide_host::ops::sdk::sdk_python_create_venv(
&state.host,
window.label(),
base,
location,
request,
crate::commands::sender(on_output),
)
.await
}
#[tauri::command]
#[specta::specta]
pub async fn sdk_python_packages(
window: Window,
state: State<'_, AppState>,
python: PathBuf,
request: RequestId,
) -> IdeResult<Vec<PythonPackage>> {
ide_host::ops::sdk::sdk_python_packages(&state.host, window.label(), python, request).await
}
/// Installs (`uninstall = false`) or removes a package; output streams through `on_output`.
#[tauri::command]
#[specta::specta]
#[allow(clippy::too_many_arguments)]
pub async fn sdk_python_pip(
window: Window,
state: State<'_, AppState>,
python: PathBuf,
requirement: String,
uninstall: bool,
upgrade: bool,
request: RequestId,
on_output: Channel<String>,
) -> IdeResult<()> {
ide_host::ops::sdk::sdk_python_pip(
&state.host,
window.label(),
python,
requirement,
uninstall,
upgrade,
request,
crate::commands::sender(on_output),
)
.await
}