Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
A bundled tool's row is named by the tool, not by Homebrew
The row says zstd, spirv-cross, xcodegen or glslangValidator with the detail bundled; the brew: label stays on rows that refer to a Homebrew copy (installed there, or missing with the install button).
  • Loading branch information
v0lumehi committed Oct 28, 2026
commit fcde2405c0197ee5f74c2afc22e4fae2de4c7797
4 changes: 3 additions & 1 deletion frontend/Sources/NSPortBuilder/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2123,7 +2123,9 @@ final class BuildModel: ObservableObject {
let path = bundled ? nil : installed(binary)
if !bundled && path == nil { needsBrew = true }
if bundled { anyBundled = true }
rows.append(Dep(id: "brew:" + pkg, name: key, hint: key + ".hint", present: bundled || path != nil,
// A bundled tool is named by the tool; "brew: …" says where a Homebrew copy comes from, so it stays for the rows that
// refer to one (installed there, or missing with the install button)
rows.append(Dep(id: "brew:" + pkg, name: bundled ? "dep.tool." + binary : key, hint: key + ".hint", present: bundled || path != nil,
detail: bundled ? "dep.bundled" : (path ?? ""),
installCmd: [(brew ?? "/opt/homebrew/bin/brew"), "install", pkg]))
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/Sources/NSPortBuilder/Localization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,10 @@ enum L10n {
"checks that metal.exe produces a metallib"),
"dep.optionalMissing": ("可选,未安装", "optional, not installed"),
"dep.bundled": ("随 App 附带", "bundled"),
"dep.tool.xcodegen": ("xcodegen", "xcodegen"),
"dep.tool.zstd": ("zstd", "zstd"),
"dep.tool.spirv-cross": ("spirv-cross", "spirv-cross"),
"dep.tool.glslangValidator": ("glslangValidator", "glslangValidator"),
"dep.glslang": ("brew: glslang", "brew: glslang"),
"dep.glslang.hint": ("编译 OpenGL 游戏的着色器;打包脚本的环境检查要求它", "compiles OpenGL games' shaders; the NSP script's environment check requires it"),
"dep.installTimeout": ("安装超时(30 分钟)——网络太慢或卡住了",
Expand Down
7 changes: 7 additions & 0 deletions frontend/Tests/NSPortBuilderTests/BundledToolsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ final class BundledToolsTests: XCTestCase {
XCTAssertNil(rows.first { $0.id == "brew" }, "nothing needs Homebrew")
XCTAssertEqual(rows.count, BuildModel.brewDeps.count)
XCTAssertTrue(rows.allSatisfy { $0.present && $0.detail == "dep.bundled" })
XCTAssertEqual(rows.map { $0.name }, BuildModel.brewDeps.map { "dep.tool." + $0.binary }, "named by the tool, not \"brew: …\"")
for (_, binary, _) in BuildModel.brewDeps {
for lang in [Lang.en, .zh] { XCTAssertEqual(L10n.string("dep.tool." + binary, lang), binary) }
}
}

func testBundledWinsOverHomebrews() throws {
Expand All @@ -121,6 +125,8 @@ final class BundledToolsTests: XCTestCase {
XCTAssertFalse(rows.first!.present)
XCTAssertEqual(row(rows, "spirv-cross")?.present, false)
XCTAssertEqual(row(rows, "zstd")?.detail, "dep.bundled")
XCTAssertEqual(row(rows, "zstd")?.name, "dep.tool.zstd")
XCTAssertEqual(row(rows, "spirv-cross")?.name, "dep.spirv", "missing: the Homebrew row keeps its label")
}

func testAMissingBundledToolFallsBackToHomebrewsCopy() throws {
Expand All @@ -130,6 +136,7 @@ final class BundledToolsTests: XCTestCase {
brew: "/opt/homebrew/bin/brew")
XCTAssertEqual(row(rows, "xcodegen")?.detail, "/opt/homebrew/bin/xcodegen")
XCTAssertEqual(row(rows, "xcodegen")?.present, true)
XCTAssertEqual(row(rows, "xcodegen")?.name, "dep.xcodegen", "a Homebrew copy keeps the Homebrew label")
XCTAssertNil(rows.first { $0.id == "brew" }, "every tool is bundled or installed")
}

Expand Down