From 8ac5d27f96902b703b8437d4878bccee13a36a11 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Fri, 20 Nov 2026 23:22:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(toolchain):=20=E5=9B=BA=E5=AE=9A=20Lith?= =?UTF-8?q?e-core-rust#135=EF=BC=8Crustup=20=E7=9A=84=20cargo=20=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E6=8C=89=E5=8E=9F=E5=90=8D=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rustup 把 ~/.cargo/bin/cargo、rust-analyzer 链接到自身,按启动时的名字决定运行哪个工具。 固定的 Core 把它们解析成 rustup,版本探针跑的是 rustup --version,工具定义永远找不到 cargo。 #135 让布局文件链接到另一个文件名时返回布局路径。 --- scripts/desktop/build-desktop-core.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/desktop/build-desktop-core.sh b/scripts/desktop/build-desktop-core.sh index 34887fd2f..3c1495aa5 100755 --- a/scripts/desktop/build-desktop-core.sh +++ b/scripts/desktop/build-desktop-core.sh @@ -297,7 +297,10 @@ PINNED_CORE_REPOSITORY="https://github.com/Lithe-IDEA/Lithe-core-rust.git" # contract, resolveSource.recommendationsURL, and plugins.marketplace.recommendForWorkspace (#2228). # Core #132, merged into main: reviewed-tip force deletion and first-primary-click selection. # Core #133, merged into main: commandInstallers 1 pinned archive downloads (API-23). -PINNED_CORE_REVISION="72036de379e4a71bb995c81a8f574859937bc616" +# Lithe-core-rust #135 (branch fix/toolchain-keep-invoked-name at 8291f3c, on top of main 72036de): +# an external installation whose layout file links to another file name (rustup's cargo and +# rust-analyzer proxies) resolves to the layout path, so probes and launches start cargo, not rustup. +PINNED_CORE_REVISION="8291f3c26f0aa8bc5db8a948608bdf7e8f9c5ad6" PROFILE="debug" CHECKOUT_ONLY="no" while [[ $# -gt 0 ]]; do From 7204b1ae6074126a5c42ad734e281a0a9c733a85 Mon Sep 17 00:00:00 2001 From: Yao Jingxi <23722032@bjtu.edu.cn> Date: Fri, 20 Nov 2026 23:41:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?test(toolchain):=20=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E9=93=BE=E6=8E=A5=E5=88=B0=E5=A4=9A=E5=85=A5?= =?UTF-8?q?=E5=8F=A3=E7=A8=8B=E5=BA=8F=E6=97=B6=E6=8C=89=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E5=90=8D=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用合成工具定义把 jre/bin/vm 链接到同目录的 multiplexer,断言宿主选中的可执行文件是 vm, 版本来自对 vm 的探针。对应 rustup 把 cargo、rust-analyzer 链接到自身的情况(Lithe-core-rust#135)。 --- .../toolchain/multicall_link_other_test.go | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 desktop/internal/toolchain/multicall_link_other_test.go diff --git a/desktop/internal/toolchain/multicall_link_other_test.go b/desktop/internal/toolchain/multicall_link_other_test.go new file mode 100644 index 000000000..56aa1a79f --- /dev/null +++ b/desktop/internal/toolchain/multicall_link_other_test.go @@ -0,0 +1,56 @@ +//go:build !windows + +package toolchain + +import ( + "context" + "encoding/json" + "os" + "path/filepath" + "testing" + "time" + + "github.com/1lck/Lithe-IDEA/desktop/internal/core" +) + +// A version manager can install every tool as a link to one multi-call +// executable that picks the tool by the name it was started under (rustup's +// cargo and rust-analyzer). The probe and the launch must start the layout +// name; the link target answers for itself, so its output never matches the +// tool's version pattern and the installation would never be found. +func TestALayoutLinkedToAMultiCallExecutableIsStartedByItsLayoutName(t *testing.T) { + root, home, vmHome := t.TempDir(), t.TempDir(), t.TempDir() + bin := filepath.Join(vmHome, "jre", "bin") + multiplexer := filepath.Join(bin, "multiplexer") + writeExecutable(t, multiplexer) + if err := os.Symlink("multiplexer", filepath.Join(bin, "vm")); err != nil { + t.Fatal(err) + } + canonicalHome := canonical(t, vmHome) + vm := filepath.Join(canonicalHome, "jre", "bin", "vm") + options := fixtureOptions(home, vmHome, map[string]string{ + vm: "vm 7.1\n", + filepath.Join(canonicalHome, "jre", "bin", "multiplexer"): "multiplexer 1.0\n", + }) + ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) + defer cancel() + snapshot, err := Load(ctx, core.NewClient(), root, ".", []json.RawMessage{readManifest(t, "runtime.plugin.json")}, options) + if err != nil { + t.Fatal(err) + } + if len(snapshot.Tools) != 1 { + t.Fatalf("tools = %+v", snapshot.Tools) + } + effective := snapshot.Tools[0].Effective + if effective == nil { + for _, trace := range snapshot.Tools[0].Trace { + if trace.Reason != nil { + t.Logf("trace reason = %s", trace.Reason.Code) + } + } + t.Fatal("the linked installation was not selected") + } + if filepath.Clean(effective.Executable) != vm || effective.Version != "7.1" { + t.Fatalf("selection = %s %s, want %s 7.1", effective.Executable, effective.Version, vm) + } +}