24
24
import io .quarkus .devtools .messagewriter .MessageWriter ;
25
25
import io .quarkus .devtools .project .BuildTool ;
26
26
import io .quarkus .qute .Qute ;
27
+ import io .smallrye .common .os .OS ;
27
28
28
29
public class QuarkusUpdateCommand {
29
30
@@ -57,6 +58,16 @@ public static void handle(MessageWriter log, BuildTool buildTool, Path baseDir,
57
58
}
58
59
}
59
60
61
+ private static void runMavenUpdate (MessageWriter log , Path baseDir , String rewritePluginVersion , String recipesGAV ,
62
+ Path recipe ,
63
+ boolean dryRun ) {
64
+ final String mvnBinary = findMvnBinary (baseDir );
65
+ executeCommand (baseDir , getMavenUpdateCommand (mvnBinary , rewritePluginVersion , recipesGAV , recipe , dryRun ), log );
66
+
67
+ // format the sources
68
+ executeCommand (baseDir , getMavenProcessSourcesCommand (mvnBinary ), log );
69
+ }
70
+
60
71
private static void runGradleUpdate (MessageWriter log , Path baseDir , String rewritePluginVersion , String recipesGAV ,
61
72
Path recipe , boolean dryRun ) {
62
73
Path tempInit = null ;
@@ -119,19 +130,11 @@ private static void propagateSystemPropertyIfSet(String name, List<String> comma
119
130
}
120
131
}
121
132
122
- private static void runMavenUpdate (MessageWriter log , Path baseDir , String rewritePluginVersion , String recipesGAV ,
123
- Path recipe ,
124
- boolean dryRun ) {
125
- final String mvnBinary = findMvnBinary (baseDir );
126
- executeCommand (baseDir , getMavenUpdateCommand (mvnBinary , rewritePluginVersion , recipesGAV , recipe , dryRun ), log );
127
-
128
- // format the sources
129
- executeCommand (baseDir , getMavenProcessSourcesCommand (mvnBinary ), log );
130
- }
131
-
132
133
private static List <String > getMavenProcessSourcesCommand (String mvnBinary ) {
133
134
List <String > command = new ArrayList <>();
134
135
command .add (mvnBinary );
136
+ command .add ("-B" );
137
+ command .add ("clean" );
135
138
command .add ("process-sources" );
136
139
final String mavenSettings = getMavenSettingsArg ();
137
140
if (mavenSettings != null ) {
@@ -146,6 +149,7 @@ private static List<String> getMavenUpdateCommand(String mvnBinary, String rewri
146
149
boolean dryRun ) {
147
150
final List <String > command = new ArrayList <>();
148
151
command .add (mvnBinary );
152
+ command .add ("-B" );
149
153
command .add ("-e" );
150
154
command .add (
151
155
String .format ("%s:%s:%s:%s" , MAVEN_REWRITE_PLUGIN_GROUP , MAVEN_REWRITE_PLUGIN_ARTIFACT , rewritePluginVersion ,
@@ -305,18 +309,8 @@ private static boolean isExecutable(Path file) {
305
309
return false ;
306
310
}
307
311
308
- private static String OS = System .getProperty ("os.name" ).toLowerCase ();
309
-
310
312
public static boolean isWindows () {
311
- return OS .contains ("win" );
312
- }
313
-
314
- static boolean hasGradle (Path dir ) {
315
- return Files .exists (dir .resolve ("build.gradle" ));
316
- }
317
-
318
- private static boolean hasMaven (Path dir ) {
319
- return Files .exists (dir .resolve ("pom.xml" ));
313
+ return OS .WINDOWS .isCurrent ();
320
314
}
321
315
322
316
private enum LogLevel {
@@ -351,13 +345,13 @@ private String clean(String line) {
351
345
return line ;
352
346
}
353
347
354
- String pattern = "[" + name () + "]" ;
348
+ String pattern = "[" + name () + "] " ;
355
349
356
- if (line .length () < pattern . length ( )) {
350
+ if (! line .startsWith ( pattern )) {
357
351
return line ;
358
352
}
359
353
360
- return line .substring (pattern .length ()). trim () ;
354
+ return line .substring (pattern .length ());
361
355
}
362
356
363
357
private boolean matches (String line ) {
0 commit comments