50
50
type LaunchContext struct {
51
51
startTime time.Time
52
52
53
- port string
54
- alias string
55
- label string
53
+ port string
54
+ alias string
55
+ label string
56
+ warmup bool
56
57
57
58
qualifier string
58
59
productDir string
@@ -89,10 +90,27 @@ func main() {
89
90
log .Info (ServiceName + ": " + Version )
90
91
startTime := time .Now ()
91
92
92
- if len (os .Args ) < 3 {
93
- log .Fatalf ("Usage: %s <port> <kind> [<link label>]\n " , os .Args [0 ])
93
+ var port string
94
+ var warmup bool
95
+
96
+ if len (os .Args ) < 2 {
97
+ log .Fatalf ("Usage: %s (warmup|<port>)\n " , os .Args [0 ])
98
+ }
99
+
100
+ if os .Args [1 ] == "warmup" {
101
+ if len (os .Args ) < 3 {
102
+ log .Fatalf ("Usage: %s %s <alias>\n " , os .Args [0 ], os .Args [1 ])
103
+ }
104
+
105
+ warmup = true
106
+ } else {
107
+ if len (os .Args ) < 3 {
108
+ log .Fatalf ("Usage: %s <port> <kind> [<link label>]\n " , os .Args [0 ])
109
+ }
110
+
111
+ port = os .Args [1 ]
94
112
}
95
- port := os . Args [ 1 ]
113
+
96
114
alias := os .Args [2 ]
97
115
label := "Open JetBrains IDE"
98
116
if len (os .Args ) > 3 {
@@ -129,9 +147,10 @@ func main() {
129
147
launchCtx := & LaunchContext {
130
148
startTime : startTime ,
131
149
132
- port : port ,
133
- alias : alias ,
134
- label : label ,
150
+ warmup : warmup ,
151
+ port : port ,
152
+ alias : alias ,
153
+ label : label ,
135
154
136
155
qualifier : qualifier ,
137
156
productDir : productDir ,
@@ -140,6 +159,11 @@ func main() {
140
159
backendVersion : backendVersion ,
141
160
wsInfo : wsInfo ,
142
161
}
162
+
163
+ if launchCtx .warmup {
164
+ launch (launchCtx )
165
+ return
166
+ }
143
167
// we should start serving immediately and postpone launch
144
168
// in order to enable a JB Gateway to connect as soon as possible
145
169
go launch (launchCtx )
@@ -423,7 +447,11 @@ func launch(launchCtx *LaunchContext) {
423
447
424
448
func run (launchCtx * LaunchContext ) {
425
449
var args []string
426
- args = append (args , "run" )
450
+ if launchCtx .warmup {
451
+ args = append (args , "warmup" )
452
+ } else {
453
+ args = append (args , "run" )
454
+ }
427
455
args = append (args , launchCtx .projectContextDir )
428
456
429
457
cmd := remoteDevServerCmd (args , launchCtx )
0 commit comments