Skip to content

Commit

Permalink
[Java] Fix fury benchmark jmh GPLV2 license conflict (#1272)
Browse files Browse the repository at this point in the history
This PR closes #1271  by:
- Remove java/fury-benchmark from fury java module. In this way, when
users/developers compiles and install fury from source, jmh won't be
downloaded by default.
- Make jmh depdendency as optional, and only avlaiable when activating
`jmh` profile.

According to apache license doc:
https://www.apache.org/legal/resolved.html#optional

![image](https://github.com/apache/incubator-fury/assets/12445254/bd5cc989-2911-4d43-81da-9b2dd9c4e0c3)

I believe GPLv2 license conflict has been addressed.
  • Loading branch information
chaokunyang committed Jan 2, 2024
1 parent 20f1849 commit 1134cce
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
java/fury-benchmark export-ignore
integration_tests/perftests export-ignore
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ jobs:
with:
java-version: 8
distribution: 'temurin'
- name: Install fury-benchmark jar
run: |
cd java && mvn -T10 -B --no-transfer-progress clean install -DskipTests && cd -
cd java/fury-benchmark && mvn -T10 -B --no-transfer-progress clean install -DskipTests -Pjmh && cd -
- name: Run CI
run: ./ci/run_ci.sh integration_tests
javascript:
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ cython_debug
testresult
java/target
benchmark/target
fury-benchmark/target
**/target/**/io/ray/**
**/target/**/**
java/**/.code/
java/**/dependency-reduced-pom.xml
**/pom.xml.versionsBackup
**/.code/
**/*.iml
**/*.html
Expand Down
2 changes: 2 additions & 0 deletions ci/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ bump_java_version() {
cd "$ROOT/java"
echo "Set fury java version to $version"
mvn versions:set -DnewVersion="$version"
cd "$ROOT/java/fury-benchmark"
mvn versions:set -DnewVersion="$version"
echo "Set fury integration_tests version to $version"
cd "$ROOT/integration_tests/jdk_compatibility_tests"
mvn versions:set -DnewVersion="$version"
Expand Down
2 changes: 2 additions & 0 deletions ci/format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ format_java() {
cd "$ROOT/java"
mvn -T10 --no-transfer-progress spotless:apply
mvn -T10 --no-transfer-progress checkstyle:check
cd "$ROOT/java/fury-benchmark"
mvn -T10 --no-transfer-progress spotless:apply
cd "$ROOT/integration_tests"
dirs=("graalvm_tests" "jdk_compatibility_tests" "latest_jdk_tests" "perftests")
for d in "${dirs[@]}" ; do
Expand Down
4 changes: 1 addition & 3 deletions ci/run_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ graalvm_test() {
integration_tests() {
cd "$ROOT"/java
mvn -T10 -B --no-transfer-progress clean install -DskipTests
echo "Start perf tests"
cd "$ROOT"/integration_tests/perftests
echo "Start latest jdk tests"
cd "$ROOT"/integration_tests/latest_jdk_tests
echo "latest_jdk_tests: JDK 21"
Expand Down Expand Up @@ -131,7 +129,7 @@ jdk17_plus_tests() {
echo "Executing fury java tests"
cd "$ROOT/java"
set +e
mvn -T10 --batch-mode --no-transfer-progress test install -pl '!fury-format,!fury-testsuite,!fury-benchmark'
mvn -T10 --batch-mode --no-transfer-progress test install -pl '!fury-format,!fury-testsuite'
testcode=$?
if [[ $testcode -ne 0 ]]; then
exit $testcode
Expand Down
10 changes: 8 additions & 2 deletions integration_tests/perftests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ proto code can be generated by maven plugin.
Flatbuffers generated is short, just add generated files to repo directly.

# Run tests
This benchmark use [jmh](https://github.com/openjdk/jmh) as benchmark tool. [jmh](https://github.com/openjdk/jmh) is
licensed under GPL V2 with CLASSPATH exception, the usage can't be included in apache source/binary release unless
as an optional feature. So Fury make it as an optional dependency and you must enable `jmh` profile to activate it.

```bash
cd java && mvn -T10 install -DskipTests -Dcheckstyle.skip -Dlicense.skip -Dmaven.javadoc.skip && cd ../integration_tests/perftests
mvn -T10 compile
# use `-Pjmh` to download jmh dependencies, we mark it as optional
# since jmh is licenced under GPL V2 andn not comply with the license policy of ASF.
mvn -T10 compile -Pjmh
#mvn exec:java -Dexec.mainClass="org.apache.fury.integration_tests.UserTypeSerializeSuite" -Dexec.args="-f 1 -wi 0 -i 1 -t 1 -w 1s -r 1s -rf csv"
mvn exec:java -Dexec.mainClass="org.apache.fury.integration_tests.UserTypeSerializeSuite"
mvn exec:java -Dexec.mainClass="org.apache.fury.integration_tests.UserTypeSerializeSuite" -Pjmh
```
30 changes: 19 additions & 11 deletions integration_tests/perftests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,6 @@
</repositories>

<dependencies>
<dependency>
<groupId>org.apache.fury</groupId>
<artifactId>fury-benchmark</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
Expand All @@ -78,6 +67,25 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>jmh</id>
<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand Down
8 changes: 6 additions & 2 deletions java/fury-benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ Fury Java Benchmark contains benchmarks for:
> Kryo benchmark suite is based on [Kryo benchmark](https://github.com/EsotericSoftware/kryo/tree/master/benchmarks).
# How to run
This benchmark use [jmh](https://github.com/openjdk/jmh) as benchmark tool. [jmh](https://github.com/openjdk/jmh) is
licensed under GPL V2 with CLASSPATH exception, the usage can't be included in apache source/binary release unless
as an optional feature. So Fury make it as an optional dependency and you must enable `jmh` profile to activate it.

```bash
# Install fury
cd ../java && mvn install -DskipTests && cd -

# build benchmark jar
mvn package

# use `-Pjmh` to download jmh dependencies, we mark it as optional
# since jmh is licenced under GPL V2 andn not comply with the license policy of ASF.
mvn package -Pjmh
# run benchmark
nohup java -jar target/benchmarks.jar -f 5 -wi 3 -i 5 -t 1 -w 3s -r 5s -rf csv >bench.log 2>&1 &
java -jar target/benchmarks.jar "io.*\.deserialize$" -f 1 -wi 1 -i 3 -t 1 -w 2s -r 2s -rf csv
Expand Down
31 changes: 19 additions & 12 deletions java/fury-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,6 @@
</properties>

<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.fury</groupId>
<artifactId>fury-core</artifactId>
Expand Down Expand Up @@ -153,6 +141,25 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>jmh</id>
<dependencies>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>${jmh.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>

<build>
<plugins>
<plugin>
Expand Down
1 change: 0 additions & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
<module>fury-core</module>
<module>fury-test-core</module>
<module>fury-testsuite</module>
<module>fury-benchmark</module>
</modules>

<properties>
Expand Down

0 comments on commit 1134cce

Please sign in to comment.