diff --git a/j2cl-maven-plugin/src/it/hello-world-super-source/pom.xml b/j2cl-maven-plugin/src/it/hello-world-super-source/pom.xml
new file mode 100644
index 00000000..fde6e28b
--- /dev/null
+++ b/j2cl-maven-plugin/src/it/hello-world-super-source/pom.xml
@@ -0,0 +1,62 @@
+
+ 4.0.0
+
+ hello-world-single
+ hello-world-super-source
+ 1.0
+ war
+
+
+
+ com.google.jsinterop
+ jsinterop-annotations
+ 2.0.0
+
+
+
+
+
+ src/main/resources
+
+
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+ build
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+ 3.3.2
+
+
+ @project.groupId@
+ @project.artifactId@
+ @project.version@
+
+
+
+ build
+
+
+ ADVANCED
+
+
+
+
+
+
+
+
diff --git a/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/java/example/helloworld/Test.java b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/java/example/helloworld/Test.java
new file mode 100644
index 00000000..973ebaa7
--- /dev/null
+++ b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/java/example/helloworld/Test.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright © 2024 j2cl-maven-plugin authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package example.helloworld;
+
+public class Test {
+}
diff --git a/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/java/java/lang/NoSuchMethodException.java b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/java/java/lang/NoSuchMethodException.java
new file mode 100644
index 00000000..ab6b0c47
--- /dev/null
+++ b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/java/java/lang/NoSuchMethodException.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+public class NoSuchMethodException {
+}
diff --git a/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/resources/META-INF/module.j2cl.xml b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/resources/META-INF/module.j2cl.xml
new file mode 100644
index 00000000..46b19818
--- /dev/null
+++ b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/resources/META-INF/module.j2cl.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/webapp/WEB-INF/web.xml b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 00000000..12af44ab
--- /dev/null
+++ b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/webapp/index.html b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/webapp/index.html
new file mode 100644
index 00000000..230e3cf5
--- /dev/null
+++ b/j2cl-maven-plugin/src/it/hello-world-super-source/src/main/webapp/index.html
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/j2cl-tasks/src/main/java/com/vertispan/j2cl/build/provided/BytecodeTask.java b/j2cl-tasks/src/main/java/com/vertispan/j2cl/build/provided/BytecodeTask.java
index c5a95fc9..34c28a55 100644
--- a/j2cl-tasks/src/main/java/com/vertispan/j2cl/build/provided/BytecodeTask.java
+++ b/j2cl-tasks/src/main/java/com/vertispan/j2cl/build/provided/BytecodeTask.java
@@ -18,6 +18,7 @@
import com.google.auto.service.AutoService;
import com.google.j2cl.common.SourceUtils;
import com.vertispan.j2cl.build.task.*;
+import com.vertispan.j2cl.tools.J2CLModuleParser;
import com.vertispan.j2cl.tools.Javac;
import javax.annotation.Nullable;
@@ -35,6 +36,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -146,10 +148,19 @@ public Task resolve(Project project, Config config) {
File classOutputDir = context.outputPath().toFile();
Javac javac = new Javac(context, generatedClassesDir, sourcePaths, classpathDirs, classOutputDir, bootstrapClasspath, aptProcessors);
+ // Find the super-source path, if it exists
+ Optional superSource = J2CLModuleParser.getSuperSourcePath(sourcePaths);
+ Stream extends CachedPath> inputSourcesStream = inputSources.getFilesAndHashes()
+ .stream();
+
+ // Exclude super-source files from compilation
+ if(project.hasSourcesMapped() && superSource.isPresent()) {
+ inputSourcesStream = inputSourcesStream.filter(p -> !p.getSourcePath().startsWith(superSource.get()));
+ }
+
// TODO convention for mapping to original file paths, provide FileInfo out of Inputs instead of Paths,
// automatically relativized?
- List sources = inputSources.getFilesAndHashes()
- .stream()
+ List sources = inputSourcesStream
.map(p -> SourceUtils.FileInfo.create(p.getAbsolutePath().toString(), p.getSourcePath().toString()))
.collect(Collectors.toUnmodifiableList());
diff --git a/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/GwtIncompatiblePreprocessor.java b/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/GwtIncompatiblePreprocessor.java
index 98539297..669c13f7 100644
--- a/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/GwtIncompatiblePreprocessor.java
+++ b/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/GwtIncompatiblePreprocessor.java
@@ -44,7 +44,7 @@ public void preprocess(List unprocessedFiles) {
Problems problems = new Problems();
try (OutputUtils.Output output = OutputUtils.initOutput(outputDirectory.toPath(), problems)) {
- GwtIncompatibleStripper.preprocessFiles(unprocessedFiles, output, problems, "GwtIncompatible");
+ GwtIncompatibleStripper.preprocessFiles(unprocessedFiles, output, problems);
if (problems.hasErrors()) {
throw new IllegalStateException(problems.getErrors().toString());
diff --git a/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/J2CLModuleParser.java b/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/J2CLModuleParser.java
new file mode 100644
index 00000000..c7c89435
--- /dev/null
+++ b/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/J2CLModuleParser.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright © 2024 j2cl-maven-plugin authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.vertispan.j2cl.tools;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collection;
+import java.util.Optional;
+
+public class J2CLModuleParser {
+
+ private static final DocumentBuilder db;
+
+ static {
+ try {
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ dbf.setNamespaceAware(false);
+ dbf.setValidating(false);
+ dbf.setFeature("http://xml.org/sax/features/namespaces", false);
+ dbf.setFeature("http://xml.org/sax/features/validation", false);
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ db = dbf.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static Optional getSuperSourcePath(Collection files) {
+ for(File file : files) {
+ Optional superSourcePath = getSuperSourcePath(file.toPath());
+ if(superSourcePath.isPresent()) {
+ return superSourcePath;
+ }
+ }
+ return Optional.empty();
+ }
+
+
+ private static Optional getSuperSourcePath(Path p) {
+ Path modulePath = p.resolve("META-INF").resolve("module.j2cl.xml");
+ Document doc;
+ try {
+ doc = db.parse(modulePath.toFile());
+ } catch (SAXException | IOException e) {
+ return Optional.empty();
+ }
+ doc.getDocumentElement().normalize();
+ NodeList modules = doc.getElementsByTagName("module");
+ for (int i = 0; i < modules.getLength(); i++) {
+ Node module = modules.item(i);
+ for (int j = 0; j < module.getChildNodes().getLength(); j++) {
+ Node node = module.getChildNodes().item(j);
+ if(node.getNodeName().equals("super-source")) {
+ String path = node.getAttributes().getNamedItem("path").getNodeValue();
+ return Optional.of(Paths.get(path));
+ }
+ }
+ }
+ return Optional.empty();
+ }
+}
diff --git a/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/J2cl.java b/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/J2cl.java
index 8761d6aa..f8e310cb 100644
--- a/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/J2cl.java
+++ b/j2cl-tasks/src/main/java/com/vertispan/j2cl/tools/J2cl.java
@@ -16,6 +16,7 @@
package com.vertispan.j2cl.tools;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
import com.google.j2cl.common.OutputUtils;
import com.google.j2cl.common.SourceUtils;
import com.google.j2cl.common.Problems;
@@ -61,9 +62,10 @@ public boolean transpile(List sourcesToCompile, List sourcePaths, Li
if (generatedClassesPath == null) {
javacOptions.add("-proc:none");
}
- if (SourceVersion.latestSupported().compareTo(SourceVersion.RELEASE_8) > 0) {
+ if (SourceVersion.latestSupported().compareTo(SourceVersion.RELEASE_11) > 0) {
//java 9+
- javacOptions.add("--release=8");
+ javacOptions.add("--release=11");
}
if (!processors.isEmpty()) {
javacOptions.add("-processor");
diff --git a/pom.xml b/pom.xml
index 72ef4e30..6870bb50 100644
--- a/pom.xml
+++ b/pom.xml
@@ -105,7 +105,7 @@
2.1.3
3.0.2
3.8.1
- 0.2.1
+ 0.6.0
1.7.5
@@ -463,4 +463,4 @@
-
\ No newline at end of file
+