Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
JavaReleaseMenu
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱鹏程
JavaReleaseMenu
Commits
12947a88
Commit
12947a88
authored
Nov 18, 2026
by
zpc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate release configuration from execution and preserve failed consoles
parent
1d312d6e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
290 additions
and
179 deletions
+290
-179
Info.plist
Info.plist
+2
-2
SplitReleaseModel.swift
Sources/JavaReleaseMenu/SplitReleaseModel.swift
+22
-1
SplitReleasePanel.swift
Sources/JavaReleaseMenu/SplitReleasePanel.swift
+195
-174
ReleaseProject.swift
Sources/ReleaseCore/ReleaseProject.swift
+1
-1
ReleaseRunnerTests.swift
Tests/ReleaseCoreTests/ReleaseRunnerTests.swift
+70
-1
No files found.
Info.plist
View file @
12947a88
...
@@ -19,9 +19,9 @@
...
@@ -19,9 +19,9 @@
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
k
e
y
>
CFBundlePackageType
<
/k
e
y
>
<
string
>
APPL
<
/string
>
<
string
>
APPL
<
/string
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
k
e
y
>
CFBundleShortVersionString
<
/k
e
y
>
<
string
>
1.
3.2
<
/string
>
<
string
>
1.
4.0
<
/string
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
k
e
y
>
CFBundleVersion
<
/k
e
y
>
<
string
>
9
<
/string
>
<
string
>
10
<
/string
>
<
k
e
y
>
LSMinimumSystemVersion
<
/k
e
y
>
<
k
e
y
>
LSMinimumSystemVersion
<
/k
e
y
>
<
string
>
14.0
<
/string
>
<
string
>
14.0
<
/string
>
<
k
e
y
>
LSUIElement
<
/k
e
y
>
<
k
e
y
>
LSUIElement
<
/k
e
y
>
...
...
Sources/JavaReleaseMenu/SplitReleaseModel.swift
View file @
12947a88
...
@@ -37,6 +37,8 @@ final class ReleasePaneState: Identifiable {
...
@@ -37,6 +37,8 @@ final class ReleasePaneState: Identifiable {
var
error
:
String
?
var
error
:
String
?
var
paused
=
false
var
paused
=
false
var
stopping
=
false
var
stopping
=
false
var
consoleDismissed
=
false
var
viewingLog
=
false
@ObservationIgnored
var
control
:
ReleaseControl
?
@ObservationIgnored
var
control
:
ReleaseControl
?
@ObservationIgnored
var
onChange
:
(()
->
Void
)?
@ObservationIgnored
var
onChange
:
(()
->
Void
)?
@ObservationIgnored
var
inventoryTask
:
Task
<
Void
,
Never
>
?
@ObservationIgnored
var
inventoryTask
:
Task
<
Void
,
Never
>
?
...
@@ -51,7 +53,8 @@ final class ReleasePaneState: Identifiable {
...
@@ -51,7 +53,8 @@ final class ReleasePaneState: Identifiable {
??
available
.
first
.
map
{
[
$0
]
}
??
[]
??
available
.
first
.
map
{
[
$0
]
}
??
[]
profileID
=
saved
?
.
profileID
??
project
.
profiles
.
first
?
.
id
profileID
=
saved
?
.
profileID
??
project
.
profiles
.
first
?
.
id
server
=
saved
?
.
server
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
useVPC
=
saved
?
.
useVPC
??
false
verified
=
saved
?
.
verified
??
false
verified
=
saved
?
.
verified
??
false
result
=
saved
?
.
result
result
=
saved
?
.
result
...
@@ -60,6 +63,22 @@ final class ReleasePaneState: Identifiable {
...
@@ -60,6 +63,22 @@ final class ReleasePaneState: Identifiable {
}
}
var
selectedCount
:
Int
{
modules
.
count
}
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
)
{
func
refresh
(
for
project
:
ReleaseProject
)
{
guard
state
!=
.
running
&&
state
!=
.
queued
else
{
return
}
guard
state
!=
.
running
&&
state
!=
.
queued
else
{
return
}
...
@@ -317,6 +336,8 @@ final class SplitReleaseModel {
...
@@ -317,6 +336,8 @@ final class SplitReleaseModel {
}
}
for
job
in
prepared
{
for
job
in
prepared
{
let
pane
=
job
.
pane
let
pane
=
job
.
pane
pane
.
consoleDismissed
=
false
pane
.
viewingLog
=
false
pane
.
state
=
.
queued
pane
.
state
=
.
queued
pane
.
result
=
nil
pane
.
result
=
nil
pane
.
phase
=
nil
pane
.
phase
=
nil
...
...
Sources/JavaReleaseMenu/SplitReleasePanel.swift
View file @
12947a88
...
@@ -11,7 +11,7 @@ struct SplitReleasePanel: View {
...
@@ -11,7 +11,7 @@ struct SplitReleasePanel: View {
private
var
columnWidth
:
CGFloat
{
private
var
columnWidth
:
CGFloat
{
let
available
=
(
NSScreen
.
main
?
.
visibleFrame
.
width
??
1440
)
-
32
let
available
=
(
NSScreen
.
main
?
.
visibleFrame
.
width
??
1440
)
-
32
return
min
(
return
min
(
383
,
model
.
panes
.
count
==
1
?
460
:
400
,
max
(
max
(
310
,
310
,
floor
(
floor
(
...
@@ -27,7 +27,9 @@ struct SplitReleasePanel: View {
...
@@ -27,7 +27,9 @@ struct SplitReleasePanel: View {
}
}
private
var
columnHeight
:
CGFloat
{
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
{
var
body
:
some
View
{
...
@@ -61,9 +63,10 @@ struct SplitReleasePanel: View {
...
@@ -61,9 +63,10 @@ struct SplitReleasePanel: View {
Divider
()
Divider
()
Button
(
"退出 Java 发布"
,
action
:
quit
)
Button
(
"退出 Java 发布"
,
action
:
quit
)
}
label
:
{
}
label
:
{
Image
(
systemName
:
"gearshape"
)
Label
(
"项目设置"
,
systemImage
:
"gearshape"
)
.
font
(
.
system
(
size
:
17
))
.
font
(
.
system
(
size
:
13
))
.
frame
(
width
:
30
,
height
:
29
)
.
padding
(
.
horizontal
,
5
)
.
frame
(
height
:
29
)
}
}
.
menuStyle
(
.
borderlessButton
)
.
menuStyle
(
.
borderlessButton
)
.
menuIndicator
(
.
hidden
)
.
menuIndicator
(
.
hidden
)
...
@@ -98,6 +101,7 @@ struct SplitReleasePanel: View {
...
@@ -98,6 +101,7 @@ struct SplitReleasePanel: View {
.
frame
(
height
:
columnHeight
)
.
frame
(
height
:
columnHeight
)
.
scrollIndicators
(
.
hidden
)
.
scrollIndicators
(
.
hidden
)
Rectangle
()
.
fill
(
ReleaseColors
.
border
)
.
frame
(
height
:
1
)
Rectangle
()
.
fill
(
ReleaseColors
.
border
)
.
frame
(
height
:
1
)
if
model
.
panes
.
count
>
1
{
HStack
{
HStack
{
if
model
.
isRunning
{
if
model
.
isRunning
{
Text
(
Text
(
...
@@ -115,13 +119,15 @@ struct SplitReleasePanel: View {
...
@@ -115,13 +119,15 @@ struct SplitReleasePanel: View {
.
frame
(
height
:
46
)
.
frame
(
height
:
46
)
}
}
.
disabled
(
model
.
isRunning
||
model
.
panes
.
count
<
2
)
.
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
))
.
font
(
.
system
(
size
:
16
))
.
foregroundStyle
(
.
white
.
opacity
(
0.9
))
.
foregroundStyle
(
.
white
.
opacity
(
0.9
))
.
padding
(
.
horizontal
,
18
)
.
padding
(
.
horizontal
,
18
)
.
frame
(
height
:
78
)
.
frame
(
height
:
78
)
}
}
}
if
let
error
=
model
.
error
{
if
let
error
=
model
.
error
{
Text
(
error
)
.
font
(
.
caption
)
.
foregroundStyle
(
.
red
)
Text
(
error
)
.
font
(
.
caption
)
.
foregroundStyle
(
.
red
)
.
textSelection
(
.
enabled
)
.
padding
([
.
horizontal
,
.
bottom
],
14
)
.
textSelection
(
.
enabled
)
.
padding
([
.
horizontal
,
.
bottom
],
14
)
...
@@ -152,6 +158,7 @@ private struct ProjectReleaseColumn: View {
...
@@ -152,6 +158,7 @@ private struct ProjectReleaseColumn: View {
@State
private
var
showsModules
=
false
@State
private
var
showsModules
=
false
@State
private
var
showsConfiguration
=
false
@State
private
var
showsConfiguration
=
false
@State
private
var
showsProjects
=
false
@State
private
var
showsProjects
=
false
@State
private
var
showsServers
=
false
@FocusState
private
var
moduleSearchFocused
:
Bool
@FocusState
private
var
moduleSearchFocused
:
Bool
private
var
project
:
ReleaseProject
?
{
model
.
project
(
for
:
pane
)
}
private
var
project
:
ReleaseProject
?
{
model
.
project
(
for
:
pane
)
}
...
@@ -167,24 +174,49 @@ private struct ProjectReleaseColumn: View {
...
@@ -167,24 +174,49 @@ private struct ProjectReleaseColumn: View {
}
}
var
body
:
some
View
{
var
body
:
some
View
{
VStack
(
alignment
:
.
leading
,
spacing
:
18
)
{
VStack
(
alignment
:
.
leading
,
spacing
:
16
)
{
HStack
(
spacing
:
8
)
{
if
model
.
panes
.
count
>
1
{
HStack
{
Text
(
project
?
.
name
??
"选择项目"
)
.
font
(
.
system
(
size
:
18
,
weight
:
.
semibold
))
.
lineLimit
(
1
)
Spacer
(
minLength
:
4
)
Button
{
Button
{
showsProjects
.
toggle
(
)
model
.
remove
(
pane
)
}
label
:
{
}
label
:
{
Text
(
project
?
.
name
??
"选择项目"
)
Label
(
"减少窗口"
,
systemImage
:
"xmark"
)
.
font
(
.
system
(
size
:
11
))
.
font
(
.
system
(
size
:
20
,
weight
:
.
semibold
))
.
padding
(
6
)
.
foregroundStyle
(
.
white
)
.
lineLimit
(
1
)
.
minimumScaleFactor
(
0.75
)
.
frame
(
maxWidth
:
.
infinity
,
alignment
:
.
leading
)
.
contentShape
(
Rectangle
())
}
}
.
buttonStyle
(
ReleaseButtonStyle
())
.
buttonStyle
(
ReleaseButtonStyle
())
.
disabled
(
!
editable
)
.
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
)
{
.
popover
(
isPresented
:
$
showsProjects
)
{
VStack
(
alignment
:
.
leading
,
spacing
:
8
)
{
VStack
(
alignment
:
.
leading
,
spacing
:
12
)
{
Text
(
"选择项目"
)
.
font
(
.
headline
)
.
padding
(
.
bottom
,
4
)
Text
(
"选择项目"
)
.
font
(
.
headline
)
ForEach
(
ForEach
(
model
.
settings
.
projects
.
filter
{
candidate
in
model
.
settings
.
projects
.
filter
{
candidate
in
!
model
.
panes
.
contains
{
!
model
.
panes
.
contains
{
...
@@ -195,200 +227,185 @@ private struct ProjectReleaseColumn: View {
...
@@ -195,200 +227,185 @@ private struct ProjectReleaseColumn: View {
Button
(
candidate
.
name
)
{
Button
(
candidate
.
name
)
{
showsProjects
=
false
showsProjects
=
false
model
.
replace
(
pane
,
with
:
candidate
)
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
)
.
popover
(
isPresented
:
$
showsConfiguration
)
{
configurationControls
}
.
frame
(
minWidth
:
220
,
alignment
:
.
leading
)
rowDivider
.
environment
(\
.
colorScheme
,
.
dark
)
formRow
(
"服务器"
,
symbol
:
"server.rack"
,
value
:
serverTitle
)
{
showsServers
=
true
}
}
Button
{
.
popover
(
isPresented
:
$
showsServers
)
{
model
.
remove
(
pane
)
ScrollView
{
}
label
:
{
VStack
(
alignment
:
.
leading
,
spacing
:
12
)
{
Label
(
"减少窗口"
,
systemImage
:
"xmark"
)
Text
(
"选择服务器"
)
.
font
(
.
headline
)
.
font
(
.
system
(
size
:
11
))
ForEach
(
pane
.
servers
,
id
:
\
.
name
)
{
target
in
.
padding
(
.
horizontal
,
8
)
Button
(
target
.
displayName
)
{
.
frame
(
height
:
26
)
pane
.
server
=
target
.
name
model
.
save
()
showsServers
=
false
}
.
buttonStyle
(
ReleaseButtonStyle
())
}
}
.
buttonStyle
(
ReleaseButtonStyle
())
if
pane
.
servers
.
isEmpty
{
Text
(
"未读取到服务器,请检查项目设置中的 hosts 文件。"
)
}
.
overlay
{
}
.
padding
(
18
)
RoundedRectangle
(
cornerRadius
:
7
)
.
strokeBorder
(
Color
.
white
.
opacity
(
0.35
))
}
.
frame
(
width
:
310
,
height
:
240
)
.
environment
(\
.
colorScheme
,
.
dark
)
}
}
.
disabled
(
!
editable
)
.
help
(
"减少窗口"
)
}
}
.
frame
(
height
:
28
)
rowDivider
formRow
(
"模块"
,
symbol
:
"square.stack"
,
value
:
moduleTitle
)
{
showsModules
=
true
}
if
project
!=
nil
{
.
popover
(
isPresented
:
$
showsModules
)
{
modulePicker
}
Button
{
if
project
?
.
type
==
.
cityKeeper
{
showsConfiguration
.
toggle
()
rowDivider
}
label
:
{
HStack
(
spacing
:
12
)
{
HStack
(
spacing
:
4
)
{
Image
(
systemName
:
"hammer"
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
frame
(
Text
(
configurationSummary
)
.
lineLimit
(
1
)
.
truncationMode
(
.
middle
)
width
:
20
)
Image
(
systemName
:
"chevron.down"
)
.
font
(
.
system
(
size
:
9
))
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
)
)
.
labelsHidden
()
.
pickerStyle
(
.
segmented
)
.
frame
(
maxWidth
:
.
infinity
,
alignment
:
.
leading
)
.
onChange
(
of
:
pane
.
mavenCommand
)
{
model
.
save
()
}
.
contentShape
(
Rectangle
()
)
}
.
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
)
{
if
project
?
.
type
==
.
cityKeeper
{
Image
(
systemName
:
"magnifyingglass"
)
Toggle
(
"使用 VPC 镜像地址"
,
isOn
:
$
pane
.
useVPC
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
toggleStyle
(
.
checkbox
)
.
disabled
(
!
editable
)
TextField
(
"搜索模块…"
,
text
:
$
pane
.
search
)
.
onChange
(
of
:
pane
.
useVPC
)
{
model
.
save
()
}
.
textFieldStyle
(
.
plain
)
.
onChange
(
of
:
pane
.
search
)
{
showsModules
=
true
}
if
!
pane
.
search
.
isEmpty
{
Button
{
pane
.
search
=
""
}
label
:
{
Image
(
systemName
:
"xmark.circle.fill"
)
}
}
.
buttonStyle
(
.
plain
)
publishButton
(
title
:
"发布
\(
pane
.
selectedCount
)
个模块"
)
if
let
message
=
pane
.
error
{
Text
(
message
)
.
font
(
.
caption
)
.
foregroundStyle
(
.
red
)
.
lineLimit
(
3
)
}
}
Button
{
if
pane
.
state
==
.
skipped
{
showsModules
.
toggle
()
Text
(
"前序项目失败,本项目未执行"
)
.
foregroundStyle
(
.
orange
)
}
label
:
{
Image
(
systemName
:
showsModules
?
"chevron.up"
:
"chevron.down"
)
}
}
.
buttonStyle
(
.
plain
)
if
let
result
=
pane
.
result
{
.
help
(
"选择模块"
)
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
)
Spacer
(
minLength
:
0
)
.
padding
(
.
horizontal
,
11
)
Button
(
"查看日志"
)
{
pane
.
showLog
()
}
.
buttonStyle
(
ReleaseButtonStyle
())
.
frame
(
height
:
34
)
}
.
font
(
ReleaseTypography
.
detail
)
.
background
(
ReleaseColors
.
surface
,
in
:
RoundedRectangle
(
cornerRadius
:
7
))
}
else
{
.
overlay
{
Text
(
"选择模块后即可发布"
)
.
font
(
ReleaseTypography
.
detail
)
.
foregroundStyle
(
RoundedRectangle
(
cornerRadius
:
7
)
.
strokeBorder
(
Color
.
white
.
opacity
(
0.32
))
ReleaseColors
.
muted
)
}
Spacer
(
minLength
:
0
)
}
}
.
disabled
(
!
editable
)
.
popover
(
isPresented
:
$
showsModules
,
arrowEdge
:
.
bottom
)
{
modulePicker
}
}
if
!
pane
.
modules
.
isEmpty
{
private
var
serverTitle
:
String
{
ScrollView
(
.
horizontal
)
{
pane
.
servers
.
first
(
where
:
{
$0
.
name
==
pane
.
server
})?
.
displayName
??
"选择服务器"
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
))
}
}
.
font
(
ReleaseTypography
.
detail
)
private
var
moduleTitle
:
String
{
.
foregroundStyle
(
.
white
)
pane
.
modules
.
isEmpty
.
padding
(
.
horizontal
,
10
)
?
"选择模块"
:
"已选
\(
pane
.
selectedCount
)
个 · "
+
pane
.
modules
.
joined
(
separator
:
", "
)
.
frame
(
height
:
30
)
.
background
(
ReleaseColors
.
action
,
in
:
Capsule
())
}
}
.
buttonStyle
(
.
plain
)
private
var
rowDivider
:
some
View
{
.
disabled
(
!
editable
)
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
)
.
buttonStyle
(
ReleaseButtonStyle
(
base
:
ReleaseColors
.
action
,
prominent
:
true
))
.
frame
(
height
:
32
)
.
disabled
(
model
.
isRunning
||
pane
.
modules
.
isEmpty
)
}
else
{
.
opacity
(
model
.
isRunning
||
pane
.
modules
.
isEmpty
?
0.5
:
1
)
Text
(
"请选择模块"
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
.
frame
(
height
:
32
)
}
}
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
)
{
VStack
(
spacing
:
0
)
{
HStack
{
HStack
{
Text
(
"实时输出 ·
\(
paneTitle
)
"
)
Text
(
"实时输出 ·
\(
paneTitle
)
"
)
.
font
(
.
system
(
size
:
13
,
weight
:
.
medium
))
.
lineLimit
(
.
font
(
.
system
(
size
:
14
,
weight
:
.
medium
))
1
)
.
lineLimit
(
1
)
Spacer
(
minLength
:
4
)
Spacer
()
if
pane
.
state
==
.
running
{
if
pane
.
state
==
.
running
{
Button
(
pane
.
paused
?
"继续"
:
"暂停"
)
{
model
.
togglePause
(
pane
)
}
Button
(
pane
.
paused
?
"继续"
:
"暂停"
)
{
model
.
togglePause
(
pane
)
}
.
disabled
(
.
disabled
(
pane
.
stopping
)
pane
.
stopping
)
Button
(
"停止"
)
{
model
.
stop
(
pane
)
}
Button
(
"停止"
)
{
model
.
stop
(
pane
)
}
.
disabled
(
pane
.
stopping
)
.
disabled
(
pane
.
stopping
)
}
}
}
}
.
padding
(
10
)
.
background
(
ReleaseColors
.
surface
)
.
foregroundStyle
(
.
white
.
opacity
(
0.9
))
.
padding
(
.
horizontal
,
11
)
.
frame
(
height
:
34
)
.
background
(
ReleaseColors
.
surface
)
LogTextView
(
LogTextView
(
text
:
pane
.
log
.
isEmpty
text
:
pane
.
log
.
isEmpty
?
"等待构建资源…"
:
pane
.
log
,
?
(
pane
.
state
==
.
queued
?
"等待构建资源…"
:
"等待发布,命令和输出将在这里显示。"
)
errorLine
:
nil
,
jumpRequest
:
0
,
followsOutput
:
pane
.
state
==
.
running
,
:
pane
.
log
,
fontSize
:
13
errorLine
:
nil
,
jumpRequest
:
0
,
followsOutput
:
pane
.
state
==
.
running
,
fontSize
:
13
)
)
.
frame
(
maxWidth
:
.
infinity
,
maxHeight
:
.
infinity
)
.
frame
(
maxWidth
:
.
infinity
,
maxHeight
:
.
infinity
)
.
layoutPriority
(
1
)
}
}
.
buttonStyle
(
ReleaseButtonStyle
())
.
frame
(
maxHeight
:
.
infinity
)
.
background
(
ReleaseColors
.
terminal
,
in
:
RoundedRectangle
(
cornerRadius
:
8
))
.
background
(
ReleaseColors
.
terminal
,
in
:
RoundedRectangle
(
cornerRadius
:
8
))
.
clipShape
(
RoundedRectangle
(
cornerRadius
:
8
))
.
clipShape
(
RoundedRectangle
(
cornerRadius
:
8
))
.
overlay
{
.
overlay
{
RoundedRectangle
(
cornerRadius
:
8
)
.
strokeBorder
(
ReleaseColors
.
border
)
}
RoundedRectangle
(
cornerRadius
:
8
)
.
strokeBorder
(
ReleaseColors
.
border
)
}
if
let
result
=
pane
.
result
{
if
let
result
=
pane
.
result
{
Button
(
"打开完整日志"
)
{
Text
(
"
\(
result
.
headline
)
· 耗时
\(
result
.
duration
)
秒"
)
NSWorkspace
.
shared
.
open
(
model
.
logURL
(
for
:
result
))
.
font
(
.
caption
)
.
foregroundStyle
(
result
.
status
==
.
succeeded
?
.
green
:
.
red
)
if
let
message
=
result
.
message
{
Text
(
message
)
.
font
(
.
caption
)
.
foregroundStyle
(
.
red
)
.
lineLimit
(
2
)
}
}
.
font
(
ReleaseTypography
.
detail
)
HStack
{
.
buttonStyle
(
ReleaseButtonStyle
())
Button
(
"返回配置"
)
{
pane
.
returnToConfiguration
()
}
}
Spacer
()
if
let
issue
=
pane
.
error
??
pane
.
result
?
.
message
,
!
issue
.
isEmpty
{
Button
(
"完整日志"
)
{
NSWorkspace
.
shared
.
open
(
model
.
logURL
(
for
:
result
))
}
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
}
}
if
result
.
status
!=
.
succeeded
{
publishButton
(
title
:
"重试发布"
)
}
}
else
{
Text
(
pane
.
state
==
.
queued
?
"排队等待发布"
:
"发布中,请等待…"
)
.
font
(
.
caption
)
.
foregroundStyle
(
ReleaseColors
.
muted
)
}
}
}
.
buttonStyle
(
ReleaseButtonStyle
())
}
}
private
var
modulePicker
:
some
View
{
private
var
modulePicker
:
some
View
{
...
@@ -399,6 +416,10 @@ private struct ProjectReleaseColumn: View {
...
@@ -399,6 +416,10 @@ private struct ProjectReleaseColumn: View {
Button
(
"完成"
)
{
showsModules
=
false
}
Button
(
"完成"
)
{
showsModules
=
false
}
}
}
TextField
(
"输入模块名搜索…"
,
text
:
$
pane
.
search
)
.
textFieldStyle
(
.
roundedBorder
)
.
focused
(
$
moduleSearchFocused
)
.
onAppear
{
moduleSearchFocused
=
true
}
ScrollView
{
ScrollView
{
LazyVStack
(
spacing
:
2
)
{
LazyVStack
(
spacing
:
2
)
{
ForEach
(
matches
,
id
:
\
.
self
)
{
module
in
ForEach
(
matches
,
id
:
\
.
self
)
{
module
in
...
@@ -481,7 +502,7 @@ private struct ProjectReleaseColumn: View {
...
@@ -481,7 +502,7 @@ private struct ProjectReleaseColumn: View {
}
}
}
}
menuRow
(
"Maven"
,
value
:
pane
.
mavenCommand
.
title
)
{
menuRow
(
"Maven"
,
value
:
pane
.
mavenCommand
.
title
)
{
ForEach
(
MavenCommand
.
allCases
)
{
command
in
ForEach
(
[
MavenCommand
.
mvnd
,
.
mvn
]
)
{
command
in
Button
(
command
.
title
)
{
Button
(
command
.
title
)
{
pane
.
mavenCommand
=
command
pane
.
mavenCommand
=
command
model
.
save
()
model
.
save
()
...
...
Sources/ReleaseCore/ReleaseProject.swift
View file @
12947a88
...
@@ -286,7 +286,7 @@ public struct ReleaseProject: Codable, Identifiable, Equatable, Sendable {
...
@@ -286,7 +286,7 @@ public struct ReleaseProject: Codable, Identifiable, Equatable, Sendable {
let
name
:
String
let
name
:
String
switch
preferred
{
switch
preferred
{
case
.
automatic
:
name
=
mvnd
!=
nil
?
"mvnd"
:
"mvn"
case
.
automatic
:
name
=
mvnd
!=
nil
?
"mvnd"
:
"mvn"
case
.
mvnd
:
name
=
"mvnd
"
case
.
mvnd
:
name
=
mvnd
!=
nil
?
"mvnd"
:
"mvn
"
case
.
mvn
:
name
=
"mvn"
case
.
mvn
:
name
=
"mvn"
}
}
guard
let
executable
=
name
==
"mvnd"
?
mvnd
:
mvn
else
{
guard
let
executable
=
name
==
"mvnd"
?
mvnd
:
mvn
else
{
...
...
Tests/ReleaseCoreTests/ReleaseRunnerTests.swift
View file @
12947a88
...
@@ -12,7 +12,7 @@ final class ReleaseRunnerTests: XCTestCase {
...
@@ -12,7 +12,7 @@ final class ReleaseRunnerTests: XCTestCase {
try
"sleep 0.5
\n
printf 'first task completed
\\
n'
\n
"
.
write
(
try
"sleep 0.5
\n
printf 'first task completed
\\
n'
\n
"
.
write
(
to
:
first
.
local
.
appending
(
path
:
"release.sh"
),
atomically
:
true
,
encoding
:
.
utf8
to
:
first
.
local
.
appending
(
path
:
"release.sh"
),
atomically
:
true
,
encoding
:
.
utf8
)
)
try
"printf 'second task completed
\\
n'
\n
"
.
write
(
try
"
sleep 0.4
\n
printf 'second task completed
\\
n'
\n
"
.
write
(
to
:
second
.
local
.
appending
(
path
:
"release.sh"
),
atomically
:
true
,
encoding
:
.
utf8
to
:
second
.
local
.
appending
(
path
:
"release.sh"
),
atomically
:
true
,
encoding
:
.
utf8
)
)
let
storage
=
first
.
base
.
appending
(
path
:
"app-state"
)
let
storage
=
first
.
base
.
appending
(
path
:
"app-state"
)
...
@@ -26,9 +26,23 @@ final class ReleaseRunnerTests: XCTestCase {
...
@@ -26,9 +26,23 @@ final class ReleaseRunnerTests: XCTestCase {
let
model
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
let
model
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
model
.
add
()
model
.
add
()
XCTAssertEqual
(
model
.
panes
.
count
,
2
)
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
()
model
.
publishAll
()
XCTAssertTrue
(
model
.
panes
.
allSatisfy
(\
.
showsConsole
))
XCTAssertEqual
(
model
.
panes
.
filter
{
$0
.
state
==
.
running
}
.
count
,
1
)
XCTAssertEqual
(
model
.
panes
.
filter
{
$0
.
state
==
.
running
}
.
count
,
1
)
XCTAssertEqual
(
model
.
panes
.
filter
{
$0
.
state
==
.
queued
}
.
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
{
for
_
in
0
..<
100
where
model
.
isRunning
{
try
await
Task
.
sleep
(
for
:
.
milliseconds
(
50
))
try
await
Task
.
sleep
(
for
:
.
milliseconds
(
50
))
}
}
...
@@ -38,9 +52,48 @@ final class ReleaseRunnerTests: XCTestCase {
...
@@ -38,9 +52,48 @@ final class ReleaseRunnerTests: XCTestCase {
XCTAssertTrue
(
model
.
panes
.
contains
{
$0
.
log
.
contains
(
"second task completed"
)
})
XCTAssertTrue
(
model
.
panes
.
contains
{
$0
.
log
.
contains
(
"second task completed"
)
})
let
restored
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
let
restored
=
SplitReleaseModel
(
settings
:
settings
,
storage
:
storage
)
XCTAssertEqual
(
restored
.
panes
.
count
,
2
)
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"
)
})
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'
\n
exit 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
@MainActor
func
testSplitReleaseRunsDisjointCityKeeperTargetsConcurrently
()
async
throws
{
func
testSplitReleaseRunsDisjointCityKeeperTargetsConcurrently
()
async
throws
{
let
first
=
try
Fixture
()
let
first
=
try
Fixture
()
...
@@ -258,6 +311,22 @@ final class ReleaseRunnerTests: XCTestCase {
...
@@ -258,6 +311,22 @@ final class ReleaseRunnerTests: XCTestCase {
fixture
.
local
.
appending
(
path
:
"bin/mvnd"
)
.
path
)
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
{
func
testMavenPathsAreDetectedAndOverridesReachDeploymentScript
()
async
throws
{
let
fixture
=
try
Fixture
()
let
fixture
=
try
Fixture
()
defer
{
fixture
.
remove
()
}
defer
{
fixture
.
remove
()
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment