From 7b17a992d56a6b16e51adf5a773f316fff321a57 Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Tue, 1 Mar 2022 14:55:49 -0600 Subject: [PATCH] Treat pom scope=runtime as compile to make gradle poms usable Gradle's "implementation" configuration for dependencies results in published maven poms that are technically accurate for building bytecode, but useless for building J2CL. To fix this, we interpret any scope=runtime as if it says scope=compile. This patch also tests many publicly released gwt modules to ensure that they build cleanly in the plugin, with the hope of avoiding this issue in the future. There are several commented out dependencies, to avoid trying to build gwt-dom until the next release is ready. Bug #127 is filed for followup. Fixes #126 --- j2cl-maven-plugin/pom.xml | 3 + .../src/it/gwt-modules-project/pom.xml | 155 ++++++++++++++++++ .../j2cl/mojo/AbstractBuildMojo.java | 2 +- 3 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 j2cl-maven-plugin/src/it/gwt-modules-project/pom.xml diff --git a/j2cl-maven-plugin/pom.xml b/j2cl-maven-plugin/pom.xml index 8b89b2ba..3b699aa3 100644 --- a/j2cl-maven-plugin/pom.xml +++ b/j2cl-maven-plugin/pom.xml @@ -147,6 +147,9 @@ -ea + + com.google.jsinterop:jsinterop-annotations:1.0.2 + diff --git a/j2cl-maven-plugin/src/it/gwt-modules-project/pom.xml b/j2cl-maven-plugin/src/it/gwt-modules-project/pom.xml new file mode 100644 index 00000000..14f8cbb6 --- /dev/null +++ b/j2cl-maven-plugin/src/it/gwt-modules-project/pom.xml @@ -0,0 +1,155 @@ + + 4.0.0 + + gwt-modules-project + gwt-modules-project + 1.0 + + + + + + + org.gwtproject.http + gwt-http + 1.0.0-RC3 + + + org.gwtproject.json + gwt-json + 1.0.0-RC1 + + + + + + + + + + + + + + org.gwtproject.event + gwt-event-legacy + 1.0.0-RC1 + + + org.gwtproject.event + gwt-logical-event + 1.0.0-RC1 + + + + + + + + + + + + + + + + + + org.gwtproject.xhr + gwt-xhr + 1.0.0-RC1 + + + org.gwtproject.safehtml + gwt-safehtml + 1.0.0-RC1 + + + org.gwtproject.safehtml + gwt-safecss + 1.0.0-RC1 + + + org.gwtproject.regexp + gwt-regexp + 1.0.0-RC1 + + + org.gwtproject.core + gwt-core + 1.0.0-RC1 + + + org.gwtproject.xml + gwt-xml + 1.0.0-RC1 + + + org.gwtproject.callback + gwt-callback + 1.0.0-RC1 + + + org.gwtproject.timer + gwt-timer + 1.0.0-RC1 + + + org.gwtproject.typedarrays + gwt-typedarrays + 1.0.0-RC2 + + + org.gwtproject.user.window + gwt-window + 1.0.0-RC2 + + + org.gwtproject.place + gwt-places + 1.0.0-RC1 + + + org.gwtproject.user.history + gwt-history + 1.0.0-RC1 + + + + + + @project.groupId@ + @project.artifactId@ + @project.version@ + + + + build + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.1 + + 1.8 + 1.8 + + + + + + + + google-snapshots + https://oss.sonatype.org/content/repositories/google-snapshots/ + + + diff --git a/j2cl-maven-plugin/src/main/java/com/vertispan/j2cl/mojo/AbstractBuildMojo.java b/j2cl-maven-plugin/src/main/java/com/vertispan/j2cl/mojo/AbstractBuildMojo.java index a7b6cde2..00f18aab 100644 --- a/j2cl-maven-plugin/src/main/java/com/vertispan/j2cl/mojo/AbstractBuildMojo.java +++ b/j2cl-maven-plugin/src/main/java/com/vertispan/j2cl/mojo/AbstractBuildMojo.java @@ -307,7 +307,7 @@ private Dependency.Scope translateScope(String scope) { case Artifact.SCOPE_PROVIDED: return Dependency.Scope.COMPILE; case Artifact.SCOPE_RUNTIME: - return Dependency.Scope.RUNTIME; + return Dependency.Scope.BOTH; // These two should already be removed by earlier filtering, throw anyway case Artifact.SCOPE_IMPORT: case Artifact.SCOPE_SYSTEM: