From e296871f2169d2b82cfb2f08208e0482861af45e Mon Sep 17 00:00:00 2001 From: Johan Vos Date: Tue, 14 Mar 2023 21:40:41 +0100 Subject: [PATCH 01/13] add static lib build (#461) * add static lib build * Process reviewer comments --- .../java/com/gluonhq/NativeStaticLibMojo.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/main/java/com/gluonhq/NativeStaticLibMojo.java diff --git a/src/main/java/com/gluonhq/NativeStaticLibMojo.java b/src/main/java/com/gluonhq/NativeStaticLibMojo.java new file mode 100644 index 0000000..089b881 --- /dev/null +++ b/src/main/java/com/gluonhq/NativeStaticLibMojo.java @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2023, Gluon + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package com.gluonhq; + +import com.gluonhq.substrate.SubstrateDispatcher; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Execute; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +@Mojo(name = "staticlib", defaultPhase = LifecyclePhase.COMPILE, + requiresDependencyResolution = ResolutionScope.COMPILE) +@Execute(phase = LifecyclePhase.PROCESS_CLASSES) +public class NativeStaticLibMojo extends NativeBaseMojo { + + @Override + public void execute() throws MojoExecutionException { + boolean result; + try { + SubstrateDispatcher dispatcher = createSubstrateDispatcher(); + result = dispatcher.nativeStaticLibrary(); + } catch (Exception e) { + e.printStackTrace(); + throw new MojoExecutionException("Error", e); + } + + if (!result) { + throw new MojoExecutionException("Native static library failed"); + } + } +} From ad35cf61b8ec5d526da12a8ad2a510409a2c191e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pereda?= Date: Wed, 15 Mar 2023 11:41:37 +0100 Subject: [PATCH 02/13] Check Maven runtime version (#463) * Check Maven runtime version * reword message exception * set limit to 3.8.8 --- src/main/java/com/gluonhq/NativeBaseMojo.java | 16 +++++++++++++++- .../com/gluonhq/utils/MavenArtifactResolver.java | 3 ++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gluonhq/NativeBaseMojo.java b/src/main/java/com/gluonhq/NativeBaseMojo.java index dc43904..6506e92 100644 --- a/src/main/java/com/gluonhq/NativeBaseMojo.java +++ b/src/main/java/com/gluonhq/NativeBaseMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Gluon + * Copyright (c) 2019, 2023, Gluon * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,6 +36,7 @@ import com.gluonhq.substrate.SubstrateDispatcher; import com.gluonhq.substrate.model.Triplet; import com.gluonhq.substrate.target.WebTargetConfiguration; +import com.gluonhq.substrate.util.Version; import com.gluonhq.utils.MavenArtifactResolver; import org.apache.commons.exec.ProcessDestroyer; import org.apache.commons.exec.ShutdownHookProcessDestroyer; @@ -49,6 +50,7 @@ import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; +import org.apache.maven.rtinfo.RuntimeInformation; import org.eclipse.aether.artifact.DefaultArtifact; import org.eclipse.aether.graph.DependencyFilter; @@ -72,6 +74,9 @@ public abstract class NativeBaseMojo extends AbstractMojo { private static final List ALLOWED_DEPENDENCY_TYPES = Collections.singletonList("jar"); + // TODO: Remove this restriction when MavenArtifactResolver works with Maven 3.9.0+ + private static final Version MAX_SUPPORTED_MAVEN_VERSION = new Version(3, 8, 8); + Path outputDir; @Parameter(defaultValue = "${project}", readonly = true) @@ -83,6 +88,9 @@ public abstract class NativeBaseMojo extends AbstractMojo { @Component BuildPluginManager pluginManager; + @Component + private RuntimeInformation runtimeInformation; + @Parameter(readonly = true, required = true, defaultValue = "${basedir}") File basedir; @@ -149,6 +157,12 @@ public abstract class NativeBaseMojo extends AbstractMojo { private ProcessDestroyer processDestroyer; public SubstrateDispatcher createSubstrateDispatcher() throws IOException, MojoExecutionException { + String mavenVersion = runtimeInformation.getMavenVersion(); + Version version = new Version(mavenVersion); + if (version.compareTo(MAX_SUPPORTED_MAVEN_VERSION) > 0) { + throw new MojoExecutionException("Maven version " + mavenVersion + " is not currently supported by the GluonFX Maven Plugin.\n" + + "Please downgrade your Maven version to " + MAX_SUPPORTED_MAVEN_VERSION + " and then try again.\n"); + } if (getGraalvmHome().isEmpty()) { throw new MojoExecutionException("GraalVM installation directory not found." + " Either set GRAALVM_HOME as an environment variable or" + diff --git a/src/main/java/com/gluonhq/utils/MavenArtifactResolver.java b/src/main/java/com/gluonhq/utils/MavenArtifactResolver.java index 46bc9b7..edefdde 100644 --- a/src/main/java/com/gluonhq/utils/MavenArtifactResolver.java +++ b/src/main/java/com/gluonhq/utils/MavenArtifactResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Gluon + * Copyright (c) 2019, 2023, Gluon * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -149,6 +149,7 @@ public static void initRepositories(List repositories) { instance = new MavenArtifactResolver(repositories); } + // TODO: Find an alternative, as this only works up until Maven 3.8.7. private RepositorySystem createRepositorySystem() { DefaultServiceLocator serviceLocator = MavenRepositorySystemUtils.newServiceLocator(); serviceLocator.addService(RepositoryConnectorFactory.class, BasicRepositoryConnectorFactory.class); From 67ce2c6292f8e49b87fcdfc670a091184b2c3609 Mon Sep 17 00:00:00 2001 From: Abhinay Agarwal Date: Thu, 16 Mar 2023 00:57:56 +0530 Subject: [PATCH 03/13] Use GITHUB_TOKEN instead of PAT in workflow (#465) --- .github/workflows/release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8955beb..5c05fd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,6 @@ jobs: - name: Create GitHub release uses: softprops/action-gh-release@v1 with: - token: ${{ secrets.PAT }} generate_release_notes: true - name: Commit next development version @@ -66,7 +65,7 @@ jobs: git push https://gluon-bot:$PAT@github.com/$GITHUB_REPOSITORY HEAD:master shell: bash env: - PAT: ${{ secrets.PAT }} + PAT: ${{ secrets.GITHUB_TOKEN }} - name: Update projects if: steps.deploy.outputs.exit_code == 0 @@ -75,6 +74,6 @@ jobs: bash $GITHUB_WORKSPACE/.github/scripts/release.sh shell: bash env: - GITHUB_PASSWORD: ${{ secrets.PAT }} + GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From 26460ed40770e9ec18a894f0386929f0400cefaa Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Mon, 20 Mar 2023 20:24:49 +0530 Subject: [PATCH 04/13] Update Substrate version to 0.0.57 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4f41b0d..13cd5b7 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 11 3.1.0 1.6 - 0.0.57-SNAPSHOT + 0.0.57 From 2c276aa6936398aa919868565465fbad69f76b76 Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Mon, 20 Mar 2023 20:24:52 +0530 Subject: [PATCH 05/13] Release 1.0.17 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 13cd5b7..c543db6 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ com.gluonhq gluonfx-maven-plugin maven-plugin - 1.0.17-SNAPSHOT + 1.0.17 GluonFX plugin for Maven GluonFX plugin allows to run JavaFX application on the JVM or to create their native images. 2019 From 63843613ddd9f9fad22ae4d4af205e73c967229e Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Mon, 20 Mar 2023 14:59:12 +0000 Subject: [PATCH 06/13] Prepare development of 1.0.18 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index c543db6..741b9c8 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ com.gluonhq gluonfx-maven-plugin maven-plugin - 1.0.17 + 1.0.18-SNAPSHOT GluonFX plugin for Maven GluonFX plugin allows to run JavaFX application on the JVM or to create their native images. 2019 @@ -46,7 +46,7 @@ 11 3.1.0 1.6 - 0.0.57 + 0.0.58-SNAPSHOT From 3e107559944c6245d89623c8b6765d64f03e149b Mon Sep 17 00:00:00 2001 From: Abhinay Agarwal Date: Mon, 20 Mar 2023 23:51:50 +0530 Subject: [PATCH 07/13] Revert to use PAT in workflow (#466) --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5c05fd9..675fa22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,7 +65,7 @@ jobs: git push https://gluon-bot:$PAT@github.com/$GITHUB_REPOSITORY HEAD:master shell: bash env: - PAT: ${{ secrets.GITHUB_TOKEN }} + PAT: ${{ secrets.PAT }} - name: Update projects if: steps.deploy.outputs.exit_code == 0 @@ -74,6 +74,6 @@ jobs: bash $GITHUB_WORKSPACE/.github/scripts/release.sh shell: bash env: - GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }} + GITHUB_PASSWORD: ${{ secrets.PAT }} AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From 57bf8f2bbe3bf96505133d1e44da4b7a40835355 Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Tue, 21 Mar 2023 13:36:20 +0000 Subject: [PATCH 08/13] Update Substrate version to 0.0.58 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 741b9c8..215bb7c 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 11 3.1.0 1.6 - 0.0.58-SNAPSHOT + 0.0.58 From 548338de4cc2228eab6b6282f1cef9c72001110d Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Tue, 21 Mar 2023 13:36:27 +0000 Subject: [PATCH 09/13] Release 1.0.18 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 215bb7c..aa0923d 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ com.gluonhq gluonfx-maven-plugin maven-plugin - 1.0.18-SNAPSHOT + 1.0.18 GluonFX plugin for Maven GluonFX plugin allows to run JavaFX application on the JVM or to create their native images. 2019 From ebc12e6100379aab6caa09954ce6441396cbbf11 Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Tue, 21 Mar 2023 14:24:55 +0000 Subject: [PATCH 10/13] Prepare development of 1.0.19 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index aa0923d..938d741 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ com.gluonhq gluonfx-maven-plugin maven-plugin - 1.0.18 + 1.0.19-SNAPSHOT GluonFX plugin for Maven GluonFX plugin allows to run JavaFX application on the JVM or to create their native images. 2019 @@ -46,7 +46,7 @@ 11 3.1.0 1.6 - 0.0.58 + 0.0.59-SNAPSHOT From d682bd1c61b4f13aeeb356da6e2146c54dfdf5f5 Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Mon, 26 Jun 2023 09:20:19 +0000 Subject: [PATCH 11/13] Update Substrate version to 0.0.59 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 938d741..873e5e9 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 11 3.1.0 1.6 - 0.0.59-SNAPSHOT + 0.0.59 From d89d5bd24b5c1855a7a9daf26d07ba20b4817312 Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Mon, 26 Jun 2023 09:20:26 +0000 Subject: [PATCH 12/13] Release 1.0.19 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 873e5e9..99be147 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ com.gluonhq gluonfx-maven-plugin maven-plugin - 1.0.19-SNAPSHOT + 1.0.19 GluonFX plugin for Maven GluonFX plugin allows to run JavaFX application on the JVM or to create their native images. 2019 From c74739fa63c9fd011ce11fbcf3173ef50f480afe Mon Sep 17 00:00:00 2001 From: Gluon Bot Date: Mon, 26 Jun 2023 10:04:56 +0000 Subject: [PATCH 13/13] Prepare development of 1.0.20 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 99be147..2fbec3f 100644 --- a/pom.xml +++ b/pom.xml @@ -34,7 +34,7 @@ com.gluonhq gluonfx-maven-plugin maven-plugin - 1.0.19 + 1.0.20-SNAPSHOT GluonFX plugin for Maven GluonFX plugin allows to run JavaFX application on the JVM or to create their native images. 2019 @@ -46,7 +46,7 @@ 11 3.1.0 1.6 - 0.0.59 + 0.0.60-SNAPSHOT