Pass selected JDK to backend builds

This commit is contained in:
王鹏
2026-10-09 14:44:09 +08:00
parent c2d124cc09
commit 11cec27774
4 changed files with 73 additions and 6 deletions

View File

@@ -145,7 +145,11 @@ def discover_executable(name: str, search_roots: Iterable[Path] | None = None) -
for root in roots:
if not root.exists() or not root.is_dir():
continue
for candidate in _direct_candidates(name, root):
candidates = _direct_candidates(name, root)
if name == "JDK":
javac_name = "javac.exe" if os.name == "nt" else "javac"
candidates.sort(key=lambda candidate: not (candidate.parent / javac_name).is_file())
for candidate in candidates:
if candidate.exists() and candidate.name.lower() in executable_names:
return candidate
return None