Repository navigation
refactor(windows): 新增过渡 crate lithe-legacy-java,把仅 Windows 使用的旧 Java/Maven Core 命令移出 Core (#1495) - #1739
Merged
Conversation
xiaoyumuxi
marked this pull request as ready for review
November 4, 2026 23:12
Lithe Review⏳ 正在以标准模式审查代码,完成或失败后会更新本评论。 |
Lithe 运行验收版本: 对照:共同祖先
未覆盖:
工作副本与运行状态已清理;可复用编译缓存按 12 GiB / 7 天预算保留。 |
…ven Core 命令 Issue #1495 把 Java/Maven 逻辑迁出 Rust Core 和宿主。Windows 前端仍通过旧命令名调用这些能力, 本提交把它们放进 Windows 专属的过渡 crate,对外只有 try_execute:命中旧命令名时返回与 Core 原先逐字节一致的 JSON 响应和错误码,其余命令返回 None,由调用方继续交给 Core。Windows 前端因此无需改动。 覆盖的命令:maven.scan、maven.launchPlan、maven.dependencyPlan、maven.dependencies、maven.diagnostics、 maven.testResults、java.workspacePolicy、java.jdtCacheRetention、java.jdtWorkspaceFingerprint、 java.sourceDefinition、java.runMarkers、spring.index、mybatis.index。 同时提供 Windows 宿主直接调用的函数:超长类路径 jar 规划、启动命令规划、JDK 选择、JDT 工作区键、 Maven settings 本地仓库改写、运行源码枚举。对应的 Core 单元测试一并移入 crate 的 src/tests。 crate 文档说明了它是过渡实现以及删除条件:Windows 的 Java/Maven 能力改由插件提供之后整体删除。 try_execute 仅模拟 Core 的取消作用域,不经过 request_trace、远程工作区作用域和 Git 执行策略作用域。 (cherry picked from commit 20fbe23)
Issue #1495:这些能力已搬入 windows/tauri/crates/lithe-legacy-java,macOS 从未调用,Core 不再保留。 删除(已用 grep 确认 macOS 和 Core 其他模块没有引用): - maven.launchPlan、maven.dependencyPlan、maven.diagnostics 三个命令,以及 maven.scan、maven.dependencies、 maven.testResults 在 dispatcher 和 CoreCommand 中的分支;Core 内部仍使用的 scan、dependencies、 test_results 函数保留,供构建提供者调用 - 仅服务这些命令的 launch_plan、dependency_plan、diagnostics 实现与诊断响应类型 - execution::classpath_jar(超长类路径 jar 规划) - execution::workspace_scan 中的 list_run_java_sources 及其测试 - lib.rs 里的 jdt_workspace_key 包装;project 对 settings_with_local_repository 的公开导出改为 crate 内可见 (JDT Maven settings 仍在 Core 内使用) 保留并开放: - lithe_core::check_cancellation 与 CancellationScope,供 crate 的 try_execute 复用 Core 的取消语义 - execution 下版本比较与工具链需求相关的少量函数改为 pub,并从 execution 重新导出 - is_run_scan_excluded_directory 对外重新导出;launch_command 的内部常量改回私有 tests/languages.rs 中仍覆盖 scan、dependencies、test_results 的测试保留,经测试专用的 execute_json 垫片 直接调用 project 中的函数;已删除命令对应的测试随实现迁到 crate。 (cherry picked from commit 70c2fe0)
…测与功能矩阵 Issue #1495:Windows 前端不变,原先发给 Core 的旧命令在宿主入口先交给 lithe_legacy_java::try_execute。 - core_execute 与 platform_invoke 两个入口都先调用 try_execute,命中旧命令名即返回,否则继续走 Core - run.rs、run/launch_arguments.rs、lsp.rs、lsp/jdt_workspace.rs、maven/user_settings.rs 中对已迁出函数 (超长类路径 jar、启动命令规划、JDK 选择、JDT 工作区键、运行源码枚举、本地仓库 settings 改写)的调用 改为 lithe_legacy_java - Cargo.toml 增加 lithe-legacy-java 路径依赖;Cargo.lock 同步增加该包及其依赖项 - test-stability-windows.ps1 的 WindowsRust 范围新增 lithe-legacy-java 的计时测试,依赖包测试不会被 宿主包的 cargo test 带上 - 功能矩阵中 Windows 的证据文件从 Core 已删除或不再被 Windows 使用的路径改为 crate 路径: run-java-long-classpath、run-discovery、java-runtime-discovery、java-maven-profiles-dependencies、 maven-user-settings-editing (cherry picked from commit 7b2a8fe)
启动计划只需要确认模块属于当前 reactor,因此只收集模块相对路径; 插件继承、坐标校验等仅 Core 运行标记用过的解析一并删除。 parent 的 groupId/version 仍按 Maven 规则补给未声明的子模块。 (cherry picked from commit 42dcf29)
#1739 的四个提交移植到最新 preview 后仍过不了 `verify-no-host-language-specifics`:它让 reviewer 跑 `--update-baseline`, 但闸门是严格棘轮,baseline 只降、allowlist 只减,搬代码引起的计数上升不能 用改基线绕开。两处真正的原因都已修掉: - 过渡 crate 改名为 `lithe-legacy-tooling`。crate 名叫 `lithe-legacy-java` 时,宿主引用它就会把 `java` 这个词带进 `windows/tauri/src-tauri/src` 的 七个文件(core.rs、platform.rs、run.rs、lsp.rs 等共 12 处词命中)。宿主 说的是“处理遗留命令”,不需要知道是哪门语言,改名后计数回落到基线以下。 - `tests/languages.rs` 不再用 `maven.scan`/`maven.dependencies`/ `maven.testResults` 三个命令名做分派(那三个 match 臂是 +3 nameComparisons),改为 `maven_json` 直接调用 Core 仍保留的 `project::scan`/`dependencies`/`test_results`。测试覆盖不变。 同批补上 #1739 把几个函数改成 `pub` 后缺的 Rustdoc (`validate_sidecar_version`、`version_satisfies`、`version_parts`、 `cancellation::check`、`ToolchainRequirementsDocument` 的字段)。 验证(macOS 本地): - `cargo test -p lithe-core`:全绿 - `cargo test -p lithe-legacy-tooling`:132 个通过 - `verify-no-host-language-specifics.mjs --base origin/preview`:Ratchet verified - `verify-rust-core-comments.sh`:通过 - `cargo check --bin lithe-windows`:只剩 preview 既有的 2 个 Windows 专用错误 - `verify-platform-feature-matrix-change.sh origin/preview HEAD`:通过 未执行:Windows 实机单测与 Parallels 冒烟,需要在 Windows CI 或实机确认。
xiaoyumuxi
force-pushed
the
feat/1495-windows-legacy-java
branch
from
November 6, 2026 12:12
42dcf29 to
0991449
Compare
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
做了什么
Issue #1495 要把 Java/Maven 逻辑迁出 Rust Core 和宿主。macOS 侧这半还没动(见文末“范围”),本 PR 先把仅 Windows 使用的部分移出 Core,Windows TypeScript 不变。
windows/tauri/crates/lithe-legacy-tooling,对外入口是try_execute(request) -> Option<String>:请求命中旧命令名时,返回与 Core 原先逐字节一致的响应和错误码;其余请求返回None,继续交给 Core。maven.scan/launchPlan/dependencyPlan/dependencies/diagnostics/testResults,java.workspacePolicy/jdtCacheRetention/jdtWorkspaceFingerprint/sourceDefinition/runMarkers,spring.index,mybatis.index。maven.*命令的分发分支、execution::classpath_jar、list_run_java_sources、jdt_workspace_key包装。check_cancellation/CancellationScope、execution的版本与工具链需求函数、is_run_scan_excluded_directory;这些新公开项的 Rustdoc 一并补上。core_execute和platform_invoke先调用try_execute;run / lsp / Maven 用户 settings 的调用点改为过渡 crate;Cargo.toml/Cargo.lock增加依赖。test-stability-windows.ps1新增过渡 crate 的计时测试;功能矩阵中 5 个条目的 Windows 证据路径改到 crate。为什么 crate 叫
lithe-legacy-tooling而不是lithe-legacy-javaverify-no-host-language-specifics是严格棘轮:baseline 只降、allowlist 只减,没有用--update-baseline给“搬代码导致的计数上升”开口子的余地。上一版 crate 名叫lithe-legacy-java时,Windows 宿主一引用它就把java这个词带进 7 个文件(core.rs、platform.rs、run.rs、lsp.rs等,共 12 处词命中),闸门必然红。宿主需要知道的是“这里要调用处理遗留命令的 crate”,不需要知道是哪门语言,所以 crate 改名为lithe-legacy-tooling,计数回落到基线以下。同一版本的
tests/languages.rs用maven.scan/maven.dependencies/maven.testResults三个命令名做分派(三个 match 臂 = +3 nameComparisons),同样过不了闸门。改为用maven_json直接调用 Core 仍保留的project::scan/dependencies/test_results,测试覆盖不变。保留在 Core 的部分
java.*命令、spring.index、mybatis.index、java_selection、launch_command、JDT 键推导、settings_with_local_repository,以及 Maven scan / dependencies / test_results 的函数,仍被 macOS 或 Core 内部的 Maven build provider 使用。crate 里这些是复制,不是移动;等 macOS 侧也迁进独立插件后再从 Core 删除。需要评审注意
try_execute不经过request_trace、远程工作区作用域和 Git 执行策略作用域。这些旧命令此前也只在本地工作区使用,但评审时请确认可以接受。lsp/jdt_workspace.rs仍直接调用 Core 的java.jdt*命令,留给后续。shared/contracts/rust-core-api.md、shared/contracts/application-boundary.md、几条相关 Agent Note、.agents/skills/develop-litethe/SKILL.md。范围(重要)
本 PR 只做 Windows 这半。macOS 侧 14 个
java.*命令仍在直连 Core,其中宿主当前只有 3 个具备通用插件通道(sourceDefinition→ definition provider、codeVision→ codeLens provider、jdtCacheRetention→languageServers.stateRetention),其余 11 个(run/navigation marker、prepareLaunch、workspacePolicy、jdtWorkspaceFingerprint、structure、className、serverPort、spring.index、mybatis.index)还没有对应扩展点。在补上这些通用能力或明确接受功能回退之前,不动 macOS 侧,避免删掉 Core 逻辑导致功能直接失效。验证
在 macOS 本地:
cargo test -p lithe-core:全部通过。cargo test --manifest-path windows/tauri/src-tauri/Cargo.toml -p lithe-legacy-tooling:132 个测试通过,crate 无警告。node scripts/architecture/verify-no-host-language-specifics.mjs --base origin/preview:Ratchet verified。./scripts/rust-core/verify-rust-core-comments.sh:通过。./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/preview HEAD:通过。cargo check --manifest-path windows/tauri/src-tauri/Cargo.toml --bin lithe-windows:只剩 preview 上本来就有的 2 个 Windows 专用错误(project_window_registry.rs的os::windows和as_raw_handle,macOS 上无法编译),没有新增错误或警告。未执行:Windows 实机单测(
test-stability-windows.ps1)和 Parallels 冒烟(Maven 工具窗口、长类路径 Java 运行与调试、JDT 缓存清理、Spring / MyBatis 索引),需要在 Windows CI 或实机上确认。