Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various minor issues in quarkus update #37428

Merged
merged 5 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
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
4 changes: 4 additions & 0 deletions independent-projects/tools/devtools-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@
<groupId>io.smallrye.common</groupId>
<artifactId>smallrye-common-version</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.common</groupId>
<artifactId>smallrye-common-os</artifactId>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>maven-model-helper</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.quarkus.devtools.messagewriter.MessageWriter;
import io.quarkus.devtools.project.BuildTool;
import io.quarkus.qute.Qute;
import io.smallrye.common.os.OS;

public class QuarkusUpdateCommand {

Expand Down Expand Up @@ -57,6 +58,16 @@ public static void handle(MessageWriter log, BuildTool buildTool, Path baseDir,
}
}

private static void runMavenUpdate(MessageWriter log, Path baseDir, String rewritePluginVersion, String recipesGAV,
Path recipe,
boolean dryRun) {
final String mvnBinary = findMvnBinary(baseDir);
executeCommand(baseDir, getMavenUpdateCommand(mvnBinary, rewritePluginVersion, recipesGAV, recipe, dryRun), log);

// format the sources
executeCommand(baseDir, getMavenProcessSourcesCommand(mvnBinary), log);
}

private static void runGradleUpdate(MessageWriter log, Path baseDir, String rewritePluginVersion, String recipesGAV,
Path recipe, boolean dryRun) {
Path tempInit = null;
Expand Down Expand Up @@ -119,19 +130,10 @@ private static void propagateSystemPropertyIfSet(String name, List<String> comma
}
}

private static void runMavenUpdate(MessageWriter log, Path baseDir, String rewritePluginVersion, String recipesGAV,
Path recipe,
boolean dryRun) {
final String mvnBinary = findMvnBinary(baseDir);
executeCommand(baseDir, getMavenUpdateCommand(mvnBinary, rewritePluginVersion, recipesGAV, recipe, dryRun), log);

// format the sources
executeCommand(baseDir, getMavenProcessSourcesCommand(mvnBinary), log);
}

private static List<String> getMavenProcessSourcesCommand(String mvnBinary) {
List<String> command = new ArrayList<>();
command.add(mvnBinary);
command.add("clean");
command.add("process-sources");
final String mavenSettings = getMavenSettingsArg();
if (mavenSettings != null) {
Expand Down Expand Up @@ -305,18 +307,8 @@ private static boolean isExecutable(Path file) {
return false;
}

private static String OS = System.getProperty("os.name").toLowerCase();

public static boolean isWindows() {
return OS.contains("win");
}

static boolean hasGradle(Path dir) {
return Files.exists(dir.resolve("build.gradle"));
}

private static boolean hasMaven(Path dir) {
return Files.exists(dir.resolve("pom.xml"));
return OS.WINDOWS.isCurrent();
}

private enum LogLevel {
Expand Down Expand Up @@ -351,13 +343,13 @@ private String clean(String line) {
return line;
}

String pattern = "[" + name() + "]";
String pattern = "[" + name() + "] ";

if (line.length() < pattern.length()) {
if (!line.startsWith(pattern)) {
return line;
}

return line.substring(pattern.length()).trim();
return line.substring(pattern.length());
}

private boolean matches(String line) {
Expand Down
Loading