Commit 12947a88 authored by zpc's avatar zpc

Separate release configuration from execution and preserve failed consoles

parent 1d312d6e
......@@ -19,9 +19,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.3.2</string>
<string>1.4.0</string>
<key>CFBundleVersion</key>
<string>9</string>
<string>10</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
<key>LSUIElement</key>
......
......@@ -37,6 +37,8 @@ final class ReleasePaneState: Identifiable {
var error: String?
var paused = false
var stopping = false
var consoleDismissed = false
var viewingLog = false
@ObservationIgnored var control: ReleaseControl?
@ObservationIgnored var onChange: (() -> Void)?
@ObservationIgnored var inventoryTask: Task<Void, Never>?
......@@ -51,7 +53,8 @@ final class ReleasePaneState: Identifiable {
?? available.first.map { [$0] } ?? []
profileID = saved?.profileID ?? project.profiles.first?.id
server = saved?.server
mavenCommand = saved?.mavenCommand ?? project.mavenCommand ?? .automatic
let preferredMaven = saved?.mavenCommand ?? project.mavenCommand ?? .mvnd
mavenCommand = preferredMaven == .automatic ? .mvnd : preferredMaven
useVPC = saved?.useVPC ?? false
verified = saved?.verified ?? false
result = saved?.result
......@@ -60,6 +63,22 @@ final class ReleasePaneState: Identifiable {
}
var selectedCount: Int { modules.count }
var showsConsole: Bool {
if state == .running || state == .queued { return true }
return viewingLog
|| (state == .finished && result?.status != .succeeded && !consoleDismissed)
}
func returnToConfiguration() {
guard state != .running && state != .queued else { return }
viewingLog = false
consoleDismissed = true
}
func showLog() {
guard result != nil else { return }
viewingLog = true
}
func refresh(for project: ReleaseProject) {
guard state != .running && state != .queued else { return }
......@@ -317,6 +336,8 @@ final class SplitReleaseModel {
}
for job in prepared {
let pane = job.pane
pane.consoleDismissed = false
pane.viewingLog = false
pane.state = .queued
pane.result = nil
pane.phase = nil
......
......@@ -11,7 +11,7 @@ struct SplitReleasePanel: View {
private var columnWidth: CGFloat {
let available = (NSScreen.main?.visibleFrame.width ?? 1440) - 32
return min(
383,
model.panes.count == 1 ? 460 : 400,
max(
310,
floor(
......@@ -27,7 +27,9 @@ struct SplitReleasePanel: View {
}
private var columnHeight: CGFloat {
min(650, max(380, (NSScreen.main?.visibleFrame.height ?? 900) - 160))
let desired: CGFloat =
model.panes.contains(where: \.showsConsole) ? 650 : (model.panes.count == 1 ? 440 : 490)
return min(desired, max(380, (NSScreen.main?.visibleFrame.height ?? 900) - 160))
}
var body: some View {
......@@ -61,9 +63,10 @@ struct SplitReleasePanel: View {
Divider()
Button("退出 Java 发布", action: quit)
} label: {
Image(systemName: "gearshape")
.font(.system(size: 17))
.frame(width: 30, height: 29)
Label("项目设置", systemImage: "gearshape")
.font(.system(size: 13))
.padding(.horizontal, 5)
.frame(height: 29)
}
.menuStyle(.borderlessButton)
.menuIndicator(.hidden)
......@@ -98,6 +101,7 @@ struct SplitReleasePanel: View {
.frame(height: columnHeight)
.scrollIndicators(.hidden)
Rectangle().fill(ReleaseColors.border).frame(height: 1)
if model.panes.count > 1 {
HStack {
if model.isRunning {
Text(
......@@ -115,13 +119,15 @@ struct SplitReleasePanel: View {
.frame(height: 46)
}
.disabled(model.isRunning || model.panes.count < 2)
.buttonStyle(ReleaseButtonStyle(base: ReleaseColors.action, prominent: true))
.buttonStyle(
ReleaseButtonStyle(base: ReleaseColors.action, prominent: true))
}
.font(.system(size: 16))
.foregroundStyle(.white.opacity(0.9))
.padding(.horizontal, 18)
.frame(height: 78)
}
}
if let error = model.error {
Text(error).font(.caption).foregroundStyle(.red)
.textSelection(.enabled).padding([.horizontal, .bottom], 14)
......@@ -152,6 +158,7 @@ private struct ProjectReleaseColumn: View {
@State private var showsModules = false
@State private var showsConfiguration = false
@State private var showsProjects = false
@State private var showsServers = false
@FocusState private var moduleSearchFocused: Bool
private var project: ReleaseProject? { model.project(for: pane) }
......@@ -167,24 +174,49 @@ private struct ProjectReleaseColumn: View {
}
var body: some View {
VStack(alignment: .leading, spacing: 18) {
HStack(spacing: 8) {
VStack(alignment: .leading, spacing: 16) {
if model.panes.count > 1 {
HStack {
Text(project?.name ?? "选择项目").font(.system(size: 18, weight: .semibold))
.lineLimit(1)
Spacer(minLength: 4)
Button {
showsProjects.toggle()
model.remove(pane)
} label: {
Text(project?.name ?? "选择项目")
.font(.system(size: 20, weight: .semibold))
.foregroundStyle(.white)
.lineLimit(1)
.minimumScaleFactor(0.75)
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
Label("减少窗口", systemImage: "xmark").font(.system(size: 11))
.padding(6)
}
.buttonStyle(ReleaseButtonStyle())
.disabled(!editable)
}
}
if pane.showsConsole {
console
} else {
configuration
}
}
.padding(18)
.frame(height: height)
.background(pane.state == .running ? ReleaseColors.blue.opacity(0.09) : .clear)
.font(ReleaseTypography.body)
.popover(item: $configurationDraft) { draft in
ConfigurationEditor(profile: draft) { updated in
saveProfile(updated)
configurationDraft = nil
}
}
}
private var configuration: some View {
VStack(alignment: .leading, spacing: 16) {
VStack(spacing: 0) {
formRow("项目", symbol: "folder", value: project?.name ?? "选择项目") {
showsProjects = true
}
.popover(isPresented: $showsProjects) {
VStack(alignment: .leading, spacing: 8) {
Text("选择项目").font(.headline).padding(.bottom, 4)
VStack(alignment: .leading, spacing: 12) {
Text("选择项目").font(.headline)
ForEach(
model.settings.projects.filter { candidate in
!model.panes.contains {
......@@ -195,200 +227,185 @@ private struct ProjectReleaseColumn: View {
Button(candidate.name) {
showsProjects = false
model.replace(pane, with: candidate)
}.buttonStyle(ReleaseButtonStyle())
}
.buttonStyle(ReleaseButtonStyle())
}.padding(18).frame(minWidth: 240, alignment: .leading)
.environment(\.colorScheme, .dark)
}
if project?.type == .cityKeeper {
rowDivider
formRow("发布配置", symbol: "doc.text", value: profile?.title ?? "选择配置") {
showsConfiguration = true
}
.padding(16)
.frame(minWidth: 220, alignment: .leading)
.environment(\.colorScheme, .dark)
.popover(isPresented: $showsConfiguration) { configurationControls }
rowDivider
formRow("服务器", symbol: "server.rack", value: serverTitle) {
showsServers = true
}
Button {
model.remove(pane)
} label: {
Label("减少窗口", systemImage: "xmark")
.font(.system(size: 11))
.padding(.horizontal, 8)
.frame(height: 26)
.popover(isPresented: $showsServers) {
ScrollView {
VStack(alignment: .leading, spacing: 12) {
Text("选择服务器").font(.headline)
ForEach(pane.servers, id: \.name) { target in
Button(target.displayName) {
pane.server = target.name
model.save()
showsServers = false
}.buttonStyle(ReleaseButtonStyle())
}
.buttonStyle(ReleaseButtonStyle())
.overlay {
RoundedRectangle(cornerRadius: 7).strokeBorder(Color.white.opacity(0.35))
if pane.servers.isEmpty { Text("未读取到服务器,请检查项目设置中的 hosts 文件。") }
}.padding(18)
}.frame(width: 310, height: 240)
.environment(\.colorScheme, .dark)
}
.disabled(!editable)
.help("减少窗口")
}
.frame(height: 28)
if project != nil {
Button {
showsConfiguration.toggle()
} label: {
HStack(spacing: 4) {
Text(configurationSummary).lineLimit(1).truncationMode(.middle)
Image(systemName: "chevron.down").font(.system(size: 9))
rowDivider
formRow("模块", symbol: "square.stack", value: moduleTitle) { showsModules = true }
.popover(isPresented: $showsModules) { modulePicker }
if project?.type == .cityKeeper {
rowDivider
HStack(spacing: 12) {
Image(systemName: "hammer").foregroundStyle(ReleaseColors.muted).frame(
width: 20)
Text("Maven").foregroundStyle(ReleaseColors.muted).frame(
width: 66, alignment: .leading)
Picker("Maven", selection: $pane.mavenCommand) {
Text("mvnd").tag(MavenCommand.mvnd)
Text("mvn").tag(MavenCommand.mvn)
}
.foregroundStyle(Color.white.opacity(0.85))
.frame(maxWidth: .infinity, alignment: .leading)
.contentShape(Rectangle())
.labelsHidden().pickerStyle(.segmented)
.onChange(of: pane.mavenCommand) { model.save() }
}.padding(.horizontal, 14).frame(height: 48)
}
.buttonStyle(.plain)
.disabled(!editable)
.help("选择发布配置、服务器和 Maven")
.popover(isPresented: $showsConfiguration) {
configurationControls
}
.background(ReleaseColors.surface, in: RoundedRectangle(cornerRadius: 14))
.overlay { RoundedRectangle(cornerRadius: 14).strokeBorder(Color.white.opacity(0.13)) }
.disabled(!editable)
HStack(spacing: 7) {
Image(systemName: "magnifyingglass")
.foregroundStyle(ReleaseColors.muted)
TextField("搜索模块…", text: $pane.search)
.textFieldStyle(.plain)
.onChange(of: pane.search) { showsModules = true }
if !pane.search.isEmpty {
Button {
pane.search = ""
} label: {
Image(systemName: "xmark.circle.fill")
if project?.type == .cityKeeper {
Toggle("使用 VPC 镜像地址", isOn: $pane.useVPC)
.toggleStyle(.checkbox).disabled(!editable)
.onChange(of: pane.useVPC) { model.save() }
}
.buttonStyle(.plain)
publishButton(title: "发布 \(pane.selectedCount) 个模块")
if let message = pane.error {
Text(message).font(.caption).foregroundStyle(.red).lineLimit(3)
}
Button {
showsModules.toggle()
} label: {
Image(systemName: showsModules ? "chevron.up" : "chevron.down")
if pane.state == .skipped {
Text("前序项目失败,本项目未执行").foregroundStyle(.orange)
}
.buttonStyle(.plain)
.help("选择模块")
if let result = pane.result {
HStack(alignment: .top, spacing: 8) {
Image(
systemName: result.status == .succeeded
? "checkmark.circle.fill" : "exclamationmark.circle.fill"
)
.foregroundStyle(result.status == .succeeded ? .green : .red)
VStack(alignment: .leading, spacing: 4) {
Text("\(result.headline) · 耗时 \(result.duration) 秒")
Text(result.module).font(.caption).foregroundStyle(ReleaseColors.muted)
.lineLimit(1)
}
.font(ReleaseTypography.body)
.padding(.horizontal, 11)
.frame(height: 34)
.background(ReleaseColors.surface, in: RoundedRectangle(cornerRadius: 7))
.overlay {
RoundedRectangle(cornerRadius: 7).strokeBorder(Color.white.opacity(0.32))
Spacer(minLength: 0)
Button("查看日志") { pane.showLog() }.buttonStyle(ReleaseButtonStyle())
}.font(ReleaseTypography.detail)
} else {
Text("选择模块后即可发布").font(ReleaseTypography.detail).foregroundStyle(
ReleaseColors.muted)
}
Spacer(minLength: 0)
}
.disabled(!editable)
.popover(isPresented: $showsModules, arrowEdge: .bottom) {
modulePicker
}
if !pane.modules.isEmpty {
ScrollView(.horizontal) {
HStack(spacing: 6) {
ForEach(pane.modules, id: \.self) { module in
Button {
pane.toggle(module)
} label: {
HStack(spacing: 5) {
Text(module).lineLimit(1)
Image(systemName: "xmark")
.font(.system(size: 9, weight: .semibold))
private var serverTitle: String {
pane.servers.first(where: { $0.name == pane.server })?.displayName ?? "选择服务器"
}
.font(ReleaseTypography.detail)
.foregroundStyle(.white)
.padding(.horizontal, 10)
.frame(height: 30)
.background(
ReleaseColors.action,
in: Capsule())
private var moduleTitle: String {
pane.modules.isEmpty
? "选择模块" : "已选 \(pane.selectedCount) 个 · " + pane.modules.joined(separator: ", ")
}
.buttonStyle(.plain)
.disabled(!editable)
private var rowDivider: some View {
Rectangle().fill(Color.white.opacity(0.12)).frame(height: 1).padding(.horizontal, 14)
}
private func formRow(
_ label: String, symbol: String, value: String, action: @escaping () -> Void
) -> some View {
Button(action: action) {
HStack(spacing: 12) {
Image(systemName: symbol).foregroundStyle(ReleaseColors.muted).frame(width: 20)
Text(label).foregroundStyle(ReleaseColors.muted).frame(
width: 66, alignment: .leading)
Text(value).foregroundStyle(.white.opacity(0.9)).lineLimit(1).truncationMode(.tail)
.frame(maxWidth: .infinity, alignment: .leading)
Image(systemName: "chevron.down").font(.system(size: 11)).foregroundStyle(
ReleaseColors.muted)
}.padding(.horizontal, 14).frame(height: 50).contentShape(Rectangle())
}.buttonStyle(ReleaseButtonStyle())
}
private func publishButton(title: String) -> some View {
Button {
model.publish(pane)
} label: {
Label(title, systemImage: "arrow.up.right")
.font(.system(size: 16, weight: .semibold)).foregroundStyle(.white)
.frame(maxWidth: .infinity).frame(height: 46)
}
.scrollIndicators(.hidden)
.frame(height: 32)
} else {
Text("请选择模块").foregroundStyle(ReleaseColors.muted)
.frame(height: 32)
.buttonStyle(ReleaseButtonStyle(base: ReleaseColors.action, prominent: true))
.disabled(model.isRunning || pane.modules.isEmpty)
.opacity(model.isRunning || pane.modules.isEmpty ? 0.5 : 1)
}
private var console: some View {
VStack(alignment: .leading, spacing: 14) {
Text(configurationSummary).font(.caption).foregroundStyle(ReleaseColors.muted)
.lineLimit(1)
ScrollView(.horizontal) {
HStack(spacing: 6) {
ForEach(pane.modules, id: \.self) { module in
Text(module).font(ReleaseTypography.detail).foregroundStyle(.white)
.padding(.horizontal, 10).padding(.vertical, 6)
.background(ReleaseColors.action, in: Capsule())
}
}
}.frame(height: 30).scrollIndicators(.hidden)
VStack(spacing: 0) {
HStack {
Text("实时输出 · \(paneTitle)")
.font(.system(size: 14, weight: .medium))
.lineLimit(1)
Spacer()
Text("实时输出 · \(paneTitle)").font(.system(size: 13, weight: .medium)).lineLimit(
1)
Spacer(minLength: 4)
if pane.state == .running {
Button(pane.paused ? "继续" : "暂停") { model.togglePause(pane) }
.disabled(pane.stopping)
Button("停止") { model.stop(pane) }
.disabled(pane.stopping)
Button(pane.paused ? "继续" : "暂停") { model.togglePause(pane) }.disabled(
pane.stopping)
Button("停止") { model.stop(pane) }.disabled(pane.stopping)
}
}
.foregroundStyle(.white.opacity(0.9))
.padding(.horizontal, 11)
.frame(height: 34)
.background(ReleaseColors.surface)
}.padding(10).background(ReleaseColors.surface)
LogTextView(
text: pane.log.isEmpty
? (pane.state == .queued ? "等待构建资源…" : "等待发布,命令和输出将在这里显示。")
: pane.log,
errorLine: nil, jumpRequest: 0,
followsOutput: pane.state == .running, fontSize: 13
text: pane.log.isEmpty ? "等待构建资源…" : pane.log,
errorLine: nil, jumpRequest: 0, followsOutput: pane.state == .running,
fontSize: 13
)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.layoutPriority(1)
}
.buttonStyle(ReleaseButtonStyle())
.frame(maxHeight: .infinity)
.background(ReleaseColors.terminal, in: RoundedRectangle(cornerRadius: 8))
.clipShape(RoundedRectangle(cornerRadius: 8))
.overlay {
RoundedRectangle(cornerRadius: 8).strokeBorder(ReleaseColors.border)
}
.overlay { RoundedRectangle(cornerRadius: 8).strokeBorder(ReleaseColors.border) }
if let result = pane.result {
Button("打开完整日志") {
NSWorkspace.shared.open(model.logURL(for: result))
Text("\(result.headline) · 耗时 \(result.duration) 秒")
.font(.caption).foregroundStyle(result.status == .succeeded ? .green : .red)
if let message = result.message {
Text(message).font(.caption).foregroundStyle(.red).lineLimit(2)
}
.font(ReleaseTypography.detail)
.buttonStyle(ReleaseButtonStyle())
}
if let issue = pane.error ?? pane.result?.message, !issue.isEmpty {
Text(issue).font(.caption).foregroundStyle(.red).lineLimit(2)
}
}
Button(action: { model.publish(pane) }) {
Text("发布此项目")
.font(.system(size: 15, weight: .medium))
.foregroundStyle(
editable && !pane.modules.isEmpty ? .white : ReleaseColors.muted
)
.frame(maxWidth: .infinity)
.frame(height: 40)
}
.disabled(model.isRunning || pane.modules.isEmpty)
.buttonStyle(ReleaseButtonStyle())
.overlay {
RoundedRectangle(cornerRadius: 8)
.strokeBorder(Color.white.opacity(0.4))
.allowsHitTesting(false)
}
}
.padding(18)
.frame(height: height)
.background {
if pane.state == .running {
LinearGradient(
colors: [ReleaseColors.blue.opacity(0.18), ReleaseColors.blue.opacity(0.07)],
startPoint: .top, endPoint: .bottom)
}
}
.overlay {
if pane.state == .running {
RoundedRectangle(cornerRadius: 7).strokeBorder(ReleaseColors.blue.opacity(0.45))
.allowsHitTesting(false)
}
}
.font(ReleaseTypography.body)
.popover(item: $configurationDraft) { draft in
ConfigurationEditor(profile: draft) { updated in
saveProfile(updated)
configurationDraft = nil
HStack {
Button("返回配置") { pane.returnToConfiguration() }
Spacer()
Button("完整日志") { NSWorkspace.shared.open(model.logURL(for: result)) }
}
if result.status != .succeeded { publishButton(title: "重试发布") }
} else {
Text(pane.state == .queued ? "排队等待发布" : "发布中,请等待…")
.font(.caption).foregroundStyle(ReleaseColors.muted)
}
}.buttonStyle(ReleaseButtonStyle())
}
private var modulePicker: some View {
......@@ -399,6 +416,10 @@ private struct ProjectReleaseColumn: View {
Button("完成") { showsModules = false }
}
TextField("输入模块名搜索…", text: $pane.search)
.textFieldStyle(.roundedBorder)
.focused($moduleSearchFocused)
.onAppear { moduleSearchFocused = true }
ScrollView {
LazyVStack(spacing: 2) {
ForEach(matches, id: \.self) { module in
......@@ -481,7 +502,7 @@ private struct ProjectReleaseColumn: View {
}
}
menuRow("Maven", value: pane.mavenCommand.title) {
ForEach(MavenCommand.allCases) { command in
ForEach([MavenCommand.mvnd, .mvn]) { command in
Button(command.title) {
pane.mavenCommand = command
model.save()
......
......@@ -286,7 +286,7 @@ public struct ReleaseProject: Codable, Identifiable, Equatable, Sendable {
let name: String
switch preferred {
case .automatic: name = mvnd != nil ? "mvnd" : "mvn"
case .mvnd: name = "mvnd"
case .mvnd: name = mvnd != nil ? "mvnd" : "mvn"
case .mvn: name = "mvn"
}
guard let executable = name == "mvnd" ? mvnd : mvn else {
......
......@@ -12,7 +12,7 @@ final class ReleaseRunnerTests: XCTestCase {
try "sleep 0.5\nprintf 'first task completed\\n'\n".write(
to: first.local.appending(path: "release.sh"), atomically: true, encoding: .utf8
)
try "printf 'second task completed\\n'\n".write(
try "sleep 0.4\nprintf 'second task completed\\n'\n".write(
to: second.local.appending(path: "release.sh"), atomically: true, encoding: .utf8
)
let storage = first.base.appending(path: "app-state")
......@@ -26,9 +26,23 @@ final class ReleaseRunnerTests: XCTestCase {
let model = SplitReleaseModel(settings: settings, storage: storage)
model.add()
XCTAssertEqual(model.panes.count, 2)
XCTAssertTrue(model.panes.allSatisfy { !$0.showsConsole })
XCTAssertTrue(model.panes.allSatisfy { $0.mavenCommand == .mvnd })
model.replace(model.panes[0], with: beta)
XCTAssertEqual(Set(model.panes.map(\.projectID)).count, 2)
model.add()
XCTAssertEqual(model.panes.count, 2)
model.publishAll()
XCTAssertTrue(model.panes.allSatisfy(\.showsConsole))
XCTAssertEqual(model.panes.filter { $0.state == .running }.count, 1)
XCTAssertEqual(model.panes.filter { $0.state == .queued }.count, 1)
let firstPane = model.panes[0]
for _ in 0..<200 where firstPane.state != .finished {
try await Task.sleep(for: .milliseconds(10))
}
XCTAssertEqual(firstPane.result?.status, .succeeded)
XCTAssertFalse(firstPane.showsConsole)
XCTAssertTrue(model.panes[1].showsConsole)
for _ in 0..<100 where model.isRunning {
try await Task.sleep(for: .milliseconds(50))
}
......@@ -38,9 +52,48 @@ final class ReleaseRunnerTests: XCTestCase {
XCTAssertTrue(model.panes.contains { $0.log.contains("second task completed") })
let restored = SplitReleaseModel(settings: settings, storage: storage)
XCTAssertEqual(restored.panes.count, 2)
XCTAssertTrue(restored.panes.allSatisfy { !$0.showsConsole })
firstPane.showLog()
XCTAssertTrue(firstPane.showsConsole)
firstPane.returnToConfiguration()
XCTAssertFalse(firstPane.showsConsole)
XCTAssertTrue(restored.panes.contains { $0.log.contains("first task completed") })
}
@MainActor
func testFailedPaneKeepsConsoleUntilReturnedAndRetryResetsIt() async throws {
let fixture = try Fixture()
defer { fixture.remove() }
let script = fixture.local.appending(path: "release.sh")
try "printf 'failure detail\\n'\nexit 3\n".write(to: script, atomically: true, encoding: .utf8)
let storage = fixture.base.appending(path: "app-state")
let settings = AppModel(storage: storage)
try settings.save(fixture.project)
let model = SplitReleaseModel(settings: settings, storage: storage)
let pane = try XCTUnwrap(model.panes.first)
model.publish(pane)
pane.returnToConfiguration()
XCTAssertTrue(pane.showsConsole)
for _ in 0..<200 where model.isRunning { try await Task.sleep(for: .milliseconds(10)) }
XCTAssertEqual(pane.result?.status, .failed)
XCTAssertTrue(pane.showsConsole)
XCTAssertTrue(pane.log.contains("failure detail"))
let restored = SplitReleaseModel(settings: settings, storage: storage)
XCTAssertTrue(try XCTUnwrap(restored.panes.first).showsConsole)
pane.returnToConfiguration()
XCTAssertFalse(pane.showsConsole)
pane.showLog()
XCTAssertTrue(pane.showsConsole)
try "printf 'retry succeeded\\n'\n".write(to: script, atomically: true, encoding: .utf8)
model.publish(pane)
XCTAssertTrue(pane.showsConsole)
for _ in 0..<200 where model.isRunning { try await Task.sleep(for: .milliseconds(10)) }
XCTAssertEqual(pane.result?.status, .succeeded)
XCTAssertFalse(pane.showsConsole)
XCTAssertTrue(pane.log.contains("retry succeeded"))
XCTAssertFalse(pane.log.contains("failure detail"))
}
@MainActor
func testSplitReleaseRunsDisjointCityKeeperTargetsConcurrently() async throws {
let first = try Fixture()
......@@ -258,6 +311,22 @@ final class ReleaseRunnerTests: XCTestCase {
fixture.local.appending(path: "bin/mvnd").path)
}
func testMissingMvndFallsBackToMvn() throws {
let fixture = try Fixture()
defer { fixture.remove() }
try fixture.createCityKeeperFixture()
try FileManager.default.removeItem(at: fixture.local.appending(path: "bin/mvnd"))
var project = fixture.project
project.type = .cityKeeper
project.toolPath = fixture.local.appending(path: "bin").path
project.mavenCommand = .mvnd
let available = project.detectedMavenPaths()
let expected = available["mvnd"] ?? available["mvn"]
XCTAssertNotNil(expected)
XCTAssertEqual(try project.mavenOverrides()["mvn"], expected)
XCTAssertEqual(try project.mavenOverrides()["mvnd"], expected)
}
func testMavenPathsAreDetectedAndOverridesReachDeploymentScript() async throws {
let fixture = try Fixture()
defer { fixture.remove() }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment