Skip to content

Commit

Permalink
Merge pull request quarkus-qe#1025 from michalvavrik/feature/fix-non-…
Browse files Browse the repository at this point in the history
…custom-runner-name

Fix non-custom build runner name
  • Loading branch information
mjurc authored Feb 9, 2024
2 parents 7d698fa + c521958 commit c0cda8f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ public void createSnapshotOfBuildPropertiesIfNotExists() {
}
}

public boolean hasAppSpecificConfigProperties() {
return propertiesSnapshot != null && !propertiesSnapshot.isEmpty();
}

public Map<String, String> createSnapshotOfBuildProperties() {
propertiesSnapshot = new HashMap<>(context.getOwner().getProperties());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class QuarkusMavenPluginBuildHelper {
this.appFolder = resourceBuilder.getApplicationFolder();
this.appClassNames = Arrays.stream(resourceBuilder.getAppClasses()).map(Class::getName).collect(toUnmodifiableSet());
this.buildWithAllClasses = resourceBuilder.isBuildWithAllClasses();
this.customBuildRequired = resourceBuilder.requiresCustomBuild();
// runtime properties provided at build time are currently available during the build time and so are custom props
// therefore we can't allow re-using of native executable with application specific properties (e.g. "withProperty")
this.customBuildRequired = resourceBuilder.requiresCustomBuild() || resourceBuilder.hasAppSpecificConfigProperties();
this.targetFolderForLocalArtifacts = targetFolderForLocalArtifacts;

this.forcedDependencies = List.copyOf(resourceBuilder.getForcedDependencies());
Expand Down Expand Up @@ -163,11 +165,12 @@ private Optional<Path> moveToPermanentLocation(Path tempNativeExecutablePath) {
// find permanent re-usable location of our native executable
final Path permanentNativeExecutablePath;
if (customBuildRequired) {
Path customExecutableTargetDir = targetFolderForLocalArtifacts.resolve(CUSTOM_RUNNER_DIR);
customExecutableTargetDir.toFile().mkdir();
permanentNativeExecutablePath = customExecutableTargetDir.resolve(getUniqueAppName(appFolder) + nativeRunnerName());
String uniqueAppName = getUniqueAppName(appFolder);
Path customExecutableTargetDir = targetFolderForLocalArtifacts.resolve(CUSTOM_RUNNER_DIR).resolve(uniqueAppName);
customExecutableTargetDir.toFile().mkdirs();
permanentNativeExecutablePath = customExecutableTargetDir.resolve(uniqueAppName + nativeRunnerName());
} else {
permanentNativeExecutablePath = targetFolderForLocalArtifacts.resolve(nativeRunnerName());
permanentNativeExecutablePath = targetFolderForLocalArtifacts.resolve("quarkus" + nativeRunnerName());
}

// delete existing executable if exists
Expand Down Expand Up @@ -452,8 +455,10 @@ private static String mvnCmd() {

static Optional<String> findNativeBuildExecutable(Path targetFolder, boolean customBuildRequired, Path appFolder) {
if (customBuildRequired) {
final String customExecutableName = getUniqueAppName(appFolder) + nativeRunnerName();
return findTargetFile(targetFolder.resolve(CUSTOM_RUNNER_DIR), customExecutableName::equalsIgnoreCase);
final String uniqueAppName = getUniqueAppName(appFolder);
final String customExecutableName = uniqueAppName + nativeRunnerName();
return findTargetFile(targetFolder.resolve(CUSTOM_RUNNER_DIR).resolve(uniqueAppName),
customExecutableName::equalsIgnoreCase);
}
return findTargetFile(targetFolder, nativeRunnerName());
}
Expand Down

0 comments on commit c0cda8f

Please sign in to comment.