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

Made JarResult.originalArtifact point to the actual original jar instead of where it should end up after renaming #13259

Merged
merged 3 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ public class JarResultBuildStep {
public static final String APP = "app";
public static final String QUARKUS = "quarkus";
public static final String DEFAULT_FAST_JAR_DIRECTORY_NAME = "quarkus-app";
public static final String RENAMED_JAR_EXTENSION = ".jar.original";
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mariofusco @evacchi i am not sure it is relevant for you but given that @mariofusco introduced this constant i wanted to check whether removing it is ok.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it looks like it's even better. With this change it will always be jar.


@BuildStep
OutputTargetBuildItem outputTarget(BuildSystemTargetBuildItem bst, PackageConfig packageConfig) {
Expand Down Expand Up @@ -256,13 +255,7 @@ private JarBuildItem buildUberJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
final Path standardJar = outputTargetBuildItem.getOutputDirectory()
.resolve(outputTargetBuildItem.getBaseName() + ".jar");

final Path originalJar;
if (Files.exists(standardJar)) {
originalJar = outputTargetBuildItem.getOutputDirectory()
.resolve(outputTargetBuildItem.getBaseName() + RENAMED_JAR_EXTENSION);
} else {
originalJar = null;
}
final Path originalJar = Files.exists(standardJar) ? standardJar : null;

return new JarBuildItem(runnerJar, originalJar, null, PackageConfig.UBER_JAR,
suffixToClassifier(packageConfig.runnerSuffix));
Expand Down
3 changes: 3 additions & 0 deletions devtools/cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
<goal>generate-code</goal>
<goal>generate-code-tests</goal>
</goals>
<configuration>
<skipOriginalJarRename>true</skipOriginalJarRename>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
15 changes: 11 additions & 4 deletions devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public class BuildMojo extends QuarkusBootstrapMojo {
@Parameter(defaultValue = "false", property = "quarkus.build.skip")
private boolean skip = false;

@Deprecated
@Parameter(property = "skipOriginalJarRename")
boolean skipOriginalJarRename;

@Override
protected boolean beforeExecute() throws MojoExecutionException {
if (skip) {
Expand Down Expand Up @@ -83,12 +87,15 @@ protected void doExecute() throws MojoExecutionException {
Artifact original = mavenProject().getArtifact();
if (result.getJar() != null) {

if (result.getJar().isUberJar() && result.getJar().getOriginalArtifact() != null) {
final Path standardJar = curatedApplication.getAppModel().getAppArtifact().getPaths().getSinglePath();
if (!skipOriginalJarRename && result.getJar().isUberJar()
&& result.getJar().getOriginalArtifact() != null) {
final Path standardJar = result.getJar().getOriginalArtifact();
if (Files.exists(standardJar)) {
final Path renamedOriginal = standardJar.getParent().toAbsolutePath()
.resolve(standardJar.getFileName() + ".original");
try {
IoUtils.recursiveDelete(result.getJar().getOriginalArtifact());
Files.move(standardJar, result.getJar().getOriginalArtifact());
IoUtils.recursiveDelete(renamedOriginal);
Files.move(standardJar, renamedOriginal);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down