You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by ch...@apache.org on 2024/01/14 11:04:24 UTC
(incubator-fury) branch main updated: feat(java): Specify JPMS module names (#1343)
This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-fury.git
The following commit(s) were added to refs/heads/main by this push:
new 54faae1e feat(java): Specify JPMS module names (#1343)
54faae1e is described below
commit 54faae1ef301c3c3477f30184f5d8753742dea5f
Author: Markus Frohme <mt...@users.noreply.github.com>
AuthorDate: Sun Jan 14 12:04:20 2024 +0100
feat(java): Specify JPMS module names (#1343)
This PR adds support for JPMS modules by adding the
`Automatic-Module-Name` entry to the `MANIFEST.MF` files of the
constructed `.jar` files.
Closes #1341.
---
ci/run_ci.sh | 3 ++
integration_tests/README.md | 1 +
.../jpms_tests}/pom.xml | 63 ++++++----------------
.../jpms_tests/src/main/java/module-info.java | 29 ++++++++++
.../org/apache/fury/integration_tests/Test.java | 39 ++++++++++++++
java/benchmark/pom.xml | 11 ++++
java/fury-core/pom.xml | 11 ++++
java/fury-format/pom.xml | 16 ++++++
java/fury-test-core/pom.xml | 11 ++++
java/fury-testsuite/pom.xml | 11 ++++
10 files changed, 148 insertions(+), 47 deletions(-)
diff --git a/ci/run_ci.sh b/ci/run_ci.sh
index f3c0e71b..44448e20 100755
--- a/ci/run_ci.sh
+++ b/ci/run_ci.sh
@@ -118,6 +118,9 @@ integration_tests() {
export JAVA_HOME="$ROOT/zulu21.28.85-ca-jdk21.0.0-linux_x64"
export PATH=$JAVA_HOME/bin:$PATH
mvn -T10 -B --no-transfer-progress clean test
+ echo "Start JPMS tests"
+ cd "$ROOT"/integration_tests/jpms_tests
+ mvn -T10 -B --no-transfer-progress clean compile
echo "Start jdk compatibility tests"
cd "$ROOT"/integration_tests/jdk_compatibility_tests
mvn -T10 -B --no-transfer-progress clean test
diff --git a/integration_tests/README.md b/integration_tests/README.md
index f806f7a4..60f1ffd5 100644
--- a/integration_tests/README.md
+++ b/integration_tests/README.md
@@ -2,5 +2,6 @@ Integration tests for fury:
- [jdk_compatibility_tests](jdk_compatibility_tests): test fury compatibility across multiple jdk versions.
- [latest_jdk_tests](latest_jdk_tests): test latest jdk.
- [graalvm_tests](graalvm_tests): test graalvm native image support.
+- [jpms_tests](jpms_tests): test JPMS module names.
> Note that this integration_tests is not designed as a maven multi-module project on purpose, so we can introduce features of higher jdk version without breaking compilation for lower jdk, and add integration tests for other languages.
diff --git a/java/fury-testsuite/pom.xml b/integration_tests/jpms_tests/pom.xml
similarity index 58%
copy from java/fury-testsuite/pom.xml
copy to integration_tests/jpms_tests/pom.xml
index 3de507be..74e1e029 100644
--- a/java/fury-testsuite/pom.xml
+++ b/integration_tests/jpms_tests/pom.xml
@@ -23,74 +23,46 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
- <artifactId>fury-parent</artifactId>
<groupId>org.apache.fury</groupId>
+ <artifactId>fury-parent</artifactId>
<version>0.5.0-SNAPSHOT</version>
+ <relativePath>../../java</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
-
- <artifactId>fury-testsuite</artifactId>
+ <artifactId>jpms_tests</artifactId>
<properties>
- <maven.compiler.source>8</maven.compiler.source>
- <maven.compiler.target>8</maven.compiler.target>
- <maven.deploy.skip>true</maven.deploy.skip>
- <maven.javadoc.skip>true</maven.javadoc.skip>
- <fury.java.rootdir>${basedir}/..</fury.java.rootdir>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ <maven.compiler.release>11</maven.compiler.release>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- <scope>test</scope>
+ <groupId>org.apache.fury</groupId>
+ <artifactId>benchmark</artifactId>
+ <version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.fury</groupId>
<artifactId>fury-core</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.fury</groupId>
<artifactId>fury-format</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.fury</groupId>
<artifactId>fury-test-core</artifactId>
<version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.esotericsoftware</groupId>
- <artifactId>kryo</artifactId>
- <version>4.0.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.esotericsoftware</groupId>
- <artifactId>reflectasm</artifactId>
- <version>1.11.3</version>
- <scope>test</scope>
</dependency>
<dependency>
- <groupId>com.esotericsoftware.minlog</groupId>
- <artifactId>minlog</artifactId>
- <version>1.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>de.ruedigermoeller</groupId>
- <artifactId>fst</artifactId>
- <version>2.57</version>
- <scope>test</scope>
+ <groupId>org.apache.fury</groupId>
+ <artifactId>fury-testsuite</artifactId>
+ <version>${project.version}</version>
</dependency>
</dependencies>
@@ -98,13 +70,10 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.7</version>
- <configuration>
- <skip>true</skip>
- </configuration>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.11.0</version>
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/integration_tests/jpms_tests/src/main/java/module-info.java b/integration_tests/jpms_tests/src/main/java/module-info.java
new file mode 100644
index 00000000..8da7cffd
--- /dev/null
+++ b/integration_tests/jpms_tests/src/main/java/module-info.java
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+module org.apache.fury.integration_tests {
+
+ requires org.apache.fury.benchmark;
+ requires org.apache.fury.core;
+ requires org.apache.fury.format;
+ requires org.apache.fury.test.core;
+
+ // we can't really test any classes from this module because it only contains test-classes
+ requires org.apache.fury.test.suite;
+}
diff --git a/integration_tests/jpms_tests/src/main/java/org/apache/fury/integration_tests/Test.java b/integration_tests/jpms_tests/src/main/java/org/apache/fury/integration_tests/Test.java
new file mode 100644
index 00000000..2d60dd4a
--- /dev/null
+++ b/integration_tests/jpms_tests/src/main/java/org/apache/fury/integration_tests/Test.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 org.apache.fury.integration_tests;
+
+import org.apache.fury.Fury;
+import org.apache.fury.benchmark.Benchmark;
+import org.apache.fury.format.encoder.Encoders;
+import org.apache.fury.test.bean.Foo;
+
+/**
+ * A test class that simply references classes from the various Fury artifacts to check whether
+ * they specify the module names referenced in the module-info descriptor.
+ */
+public class Test {
+
+ public static void main(String[] args) {
+ final Fury fury = Fury.builder().build();
+ fury.serialize(Foo.create());
+
+ Encoders.bean(Benchmark.class, fury);
+ }
+}
diff --git a/java/benchmark/pom.xml b/java/benchmark/pom.xml
index 1e2230df..201cd831 100644
--- a/java/benchmark/pom.xml
+++ b/java/benchmark/pom.xml
@@ -188,6 +188,17 @@
</annotationProcessorPaths>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Automatic-Module-Name>org.apache.fury.benchmark</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
diff --git a/java/fury-core/pom.xml b/java/fury-core/pom.xml
index 64be66d4..46d7a6bd 100644
--- a/java/fury-core/pom.xml
+++ b/java/fury-core/pom.xml
@@ -64,6 +64,17 @@
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Automatic-Module-Name>org.apache.fury.core</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
diff --git a/java/fury-format/pom.xml b/java/fury-format/pom.xml
index a0d96ad6..895dd373 100644
--- a/java/fury-format/pom.xml
+++ b/java/fury-format/pom.xml
@@ -88,6 +88,22 @@
</dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Automatic-Module-Name>org.apache.fury.format</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<profiles>
<profile>
<id>releaseShade</id>
diff --git a/java/fury-test-core/pom.xml b/java/fury-test-core/pom.xml
index 174da25b..5a7c83b7 100644
--- a/java/fury-test-core/pom.xml
+++ b/java/fury-test-core/pom.xml
@@ -103,6 +103,17 @@
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Automatic-Module-Name>org.apache.fury.test.core</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
diff --git a/java/fury-testsuite/pom.xml b/java/fury-testsuite/pom.xml
index 3de507be..112d6e1f 100644
--- a/java/fury-testsuite/pom.xml
+++ b/java/fury-testsuite/pom.xml
@@ -96,6 +96,17 @@
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestEntries>
+ <Automatic-Module-Name>org.apache.fury.test.suite</Automatic-Module-Name>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org