Skip to content

Commit

Permalink
Deprecate build goal in favor of compile-no-fork goal.
Browse files Browse the repository at this point in the history
Signed-off-by: Lazar Mitrović <lazar.mitrovic@oracle.com>
  • Loading branch information
lazar-mitrovic committed Aug 8, 2022
1 parent d6ff3e1 commit 1d7be6b
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 15 deletions.
2 changes: 1 addition & 1 deletion docs/src/docs/asciidoc/announcement.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Adding our new plugin to the existing _Maven_ project requires adding the follow
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/docs/asciidoc/maven-plugin.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Add the following profile to your `pom.xml` file to register the `native-maven-p
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion native-maven-plugin/reproducers/issue-144/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
*
* Subject to the condition set forth below, permission is hereby granted to any
* person obtaining a copy of this software, associated documentation and/or
* data (collectively the "Software"), free of charge and under any and all
* copyright rights in the Software, and any and all patent rights owned or
* freely licensable by each licensor hereunder covering either (i) the
* unmodified Software as contributed to or provided by such licensor, or (ii)
* the Larger Works (as defined below), to deal in both
*
* (a) the Software, and
*
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
* one is included with the Software each a "Larger Work" to which the Software
* is contributed by such licensors),
*
* without restriction, including without limitation the rights to copy, create
* derivative works of, display, perform, and distribute the Software and make,
* use, sell, offer for sale, import, export, have made, and have sold the
* Software and the Larger Work(s), and to sublicense the foregoing rights on
* either these or other terms.
*
* This license is subject to the following condition:
*
* The above copyright notice and either this complete permission notice or at a
* minimum a reference to the UPL must be included in all copies or substantial
* portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package org.graalvm.buildtools.maven;

import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;

/**
* Mojo used to invoke native image building by attaching it to a phase.
* Deprecated in favor of compile-no-fork goal.
*/
@Deprecated
@Mojo(name = "build", defaultPhase = LifecyclePhase.PACKAGE,
requiresDependencyResolution = ResolutionScope.RUNTIME,
requiresDependencyCollection = ResolutionScope.RUNTIME)
public class DeprecatedNativeBuildMojo extends NativeCompileNoForkMojo {

@Override
public void execute() throws MojoExecutionException {
logger.warn("'native:build' goal is deprecated. Use 'native:compile-no-fork' instead.");
super.execute();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
* This goal runs native builds. It functions the same as the native:compile goal, but it
* does not fork the build, so it is suitable for attaching to the build lifecycle.
*/
@Mojo(name = "build", defaultPhase = LifecyclePhase.PACKAGE,
@Mojo(name = "compile-no-fork", defaultPhase = LifecyclePhase.PACKAGE,
requiresDependencyResolution = ResolutionScope.RUNTIME,
requiresDependencyCollection = ResolutionScope.RUNTIME)
public class NativeCompileNoForkMojo extends AbstractNativeMojo {
Expand Down
2 changes: 1 addition & 1 deletion samples/java-application-with-reflection/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion samples/java-application-with-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<id>build-native</id>
<goals>
<goal>generateResourceConfig</goal>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down
4 changes: 2 additions & 2 deletions samples/java-application-with-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down Expand Up @@ -191,7 +191,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
<configuration>
Expand Down
4 changes: 2 additions & 2 deletions samples/java-application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down Expand Up @@ -126,7 +126,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down
2 changes: 1 addition & 1 deletion samples/java-library/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down
4 changes: 2 additions & 2 deletions samples/metadata-repo-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down Expand Up @@ -109,7 +109,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down
4 changes: 2 additions & 2 deletions samples/native-config-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down Expand Up @@ -128,7 +128,7 @@
<execution>
<id>build-native</id>
<goals>
<goal>build</goal>
<goal>compile-no-fork</goal>
</goals>
<phase>package</phase>
</execution>
Expand Down

0 comments on commit 1d7be6b

Please sign in to comment.