diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7f57cb0c..9cead67d 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -26,7 +26,7 @@ jobs: java-version: 8 architecture: x64 - name: Build with Maven - run: mvn -B -ntp clean package --file pom.xml + run: mvn -B --show-version -ntp clean package --file pom.xml - name: Upload the build uses: actions/upload-artifact@v3 with: @@ -44,7 +44,7 @@ jobs: java-version: 11 architecture: x64 - name: Build with Maven - run: mvn -B -ntp clean package --file pom.xml + run: mvn -B --show-version -ntp --file pom.xml clean package MacOS-x86_64-Build-JDK17: runs-on: macos-latest @@ -57,7 +57,20 @@ jobs: java-version: 17 architecture: x64 - name: Build with Maven - run: mvn -B -ntp clean package --file pom.xml + run: mvn -B --show-version -ntp --file pom.xml clean package + + MacOS-x86_64-Build-JDK21: + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: 21 + architecture: x64 + - name: Build with Maven + run: mvn -B --show-version -ntp --file pom.xml clean package Linux-x86_64-Build-JDK8: runs-on: ubuntu-latest @@ -85,6 +98,13 @@ jobs: - name: build centos6 run: docker-compose -f docker/docker-compose17.yml run build + Linux-x86_64-Build-JDK21: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: build centos6 + run: docker-compose -f docker/docker-compose21.yml run build + Linux-Aarch64-Build-JDK8: runs-on: ubuntu-latest steps: @@ -98,7 +118,7 @@ jobs: restore-keys: | ${{ runner.os }}-pr-${{ env.cache-name }}- ${{ runner.os }}-pr- - - uses: uraimo/run-on-arch-action@v2.3.0 + - uses: uraimo/run-on-arch-action@v2.4.0 name: Run commands id: runcmd with: @@ -125,7 +145,7 @@ jobs: run: | export JAVA_HOME="/jdk" chmod +x ./mvnw - ./mvnw -B -ntp clean package + ./mvnw -B --show-version -ntp clean package - name: Upload the build uses: actions/upload-artifact@v3 @@ -145,7 +165,7 @@ jobs: key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- - - uses: uraimo/run-on-arch-action@v2.3.0 + - uses: uraimo/run-on-arch-action@v2.4.0 name: Run commands id: runcmd with: @@ -172,7 +192,7 @@ jobs: run: | export JAVA_HOME="/jdk" chmod +x ./mvnw - ./mvnw -B -ntp clean package + ./mvnw -B --show-version -ntp clean package Linux-Aarch64-Build-JDK17: runs-on: ubuntu-latest @@ -186,7 +206,7 @@ jobs: key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- - - uses: uraimo/run-on-arch-action@v2.3.0 + - uses: uraimo/run-on-arch-action@v2.4.0 name: Run commands id: runcmd with: @@ -214,7 +234,49 @@ jobs: export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork" export JAVA_HOME="/jdk" chmod +x ./mvnw - ./mvnw -B -ntp clean package + ./mvnw -B --show-version -ntp clean package + + Linux-Aarch64-Build-JDK21: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + env: + cache-name: cache-m2-repository-${{ runner.os }}-jdk21-aarch64 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- + - uses: uraimo/run-on-arch-action@v2.4.0 + name: Run commands + id: runcmd + with: + arch: aarch64 + distro: ubuntu20.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + # Mount the .m2/repository + dockerRunArgs: | + --platform linux/arm64 + --volume "/home/runner/.m2/repository/:/root/.m2/repository" + + # Install dependencies + install: | + apt-get update + apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential + + curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | bash && . ~/.jabba/jabba.sh + jabba install 21.0.1-custom=tgz+https://corretto.aws/downloads/resources/21.0.1.12.1/amazon-corretto-21.0.1.12.1-linux-aarch64.tar.gz -o /jdk + + run: | + export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork" + export JAVA_HOME="/jdk" + chmod +x ./mvnw + ./mvnw -B --show-version -ntp clean package Linux-ArmV7-Build-JDK8: runs-on: ubuntu-latest @@ -228,7 +290,7 @@ jobs: key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- - - uses: uraimo/run-on-arch-action@v2.3.0 + - uses: uraimo/run-on-arch-action@v2.4.0 name: Run commands id: runcmd with: @@ -255,7 +317,7 @@ jobs: run: | export JAVA_HOME="/jdk" chmod +x ./mvnw - ./mvnw -B -ntp clean package + ./mvnw -B --show-version -ntp clean package - name: Upload the build uses: actions/upload-artifact@v3 @@ -275,7 +337,7 @@ jobs: key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- - - uses: uraimo/run-on-arch-action@v2.3.0 + - uses: uraimo/run-on-arch-action@v2.4.0 name: Run commands id: runcmd with: @@ -302,7 +364,7 @@ jobs: run: | export JAVA_HOME="/jdk" chmod +x ./mvnw - ./mvnw -B -ntp clean package + ./mvnw -B --show-version -ntp clean package Linux-s390x-Build-JDK8: runs-on: ubuntu-latest @@ -316,7 +378,7 @@ jobs: key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- - - uses: uraimo/run-on-arch-action@v2.3.0 + - uses: uraimo/run-on-arch-action@v2.4.0 name: Run commands id: runcmd with: @@ -339,7 +401,7 @@ jobs: run: | chmod +x ./mvnw - ./mvnw -B -ntp clean package + ./mvnw -B --show-version -ntp clean package - name: Upload the build uses: actions/upload-artifact@v3 @@ -359,7 +421,7 @@ jobs: key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- - - uses: uraimo/run-on-arch-action@v2.3.0 + - uses: uraimo/run-on-arch-action@v2.4.0 name: Run commands id: runcmd with: @@ -380,9 +442,207 @@ jobs: apt-get update apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-11-jdk + run: | + chmod +x ./mvnw + ./mvnw -B --show-version -ntp clean package + + Linux-ppc64le-Build-JDK8: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + env: + cache-name: cache-m2-repository-${{ runner.os }}-jdk8-ppc64le + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- + - uses: uraimo/run-on-arch-action@v2.3.0 + name: Run commands + id: runcmd + with: + arch: ppc64le + distro: ubuntu18.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + # Mount the .m2/repository + dockerRunArgs: | + --platform linux/ppc64le + --volume "/home/runner/.m2/repository/:/root/.m2/repository" + # Install dependencies + install: | + apt-get update + apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-8-jdk + run: | chmod +x ./mvnw ./mvnw -B -ntp clean package + - name: Upload the build + uses: actions/upload-artifact@v3 + with: + name: Linux-ppc64le-Build-JDK8 + path: /home/runner/work/Brotli4j/ + + Linux-ppc64le-Build-JDK11: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + env: + cache-name: cache-m2-repository-${{ runner.os }}-jdk11-ppc64le + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- + - uses: uraimo/run-on-arch-action@v2.3.0 + name: Run commands + id: runcmd + with: + arch: ppc64le + distro: ubuntu18.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + # Mount the .m2/repository + dockerRunArgs: | + --platform linux/ppc64le + --volume "/home/runner/.m2/repository/:/root/.m2/repository" + # Install dependencies + install: | + apt-get update + apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-11-jdk + run: | + chmod +x ./mvnw + ./mvnw -B -ntp clean package + + Linux-riscv64-Build-JDK11: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + env: + cache-name: cache-m2-repository-${{ runner.os }}-jdk11-riscv64 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- + + - uses: uraimo/run-on-arch-action@v2.4.0 + name: Run commands + id: runcmd + with: + arch: riscv64 + distro: ubuntu20.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + # Mount the .m2/repository + dockerRunArgs: | + --platform linux/riscv64 + --volume "/home/runner/.m2/repository/:/root/.m2/repository" + # Install dependencies + install: | + apt-get update + apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-11-jdk + + run: | + export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork" + chmod +x ./mvnw + ./mvnw -B --show-version -ntp clean package + + - name: Upload the build + uses: actions/upload-artifact@v3 + with: + name: Linux-riscv64-Build-JDK11 + path: /home/runner/work/Brotli4j/ + + Linux-riscv64-Build-JDK17: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + env: + cache-name: cache-m2-repository-${{ runner.os }}-jdk17-riscv64 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- + - uses: uraimo/run-on-arch-action@v2.4.0 + name: Run commands + id: runcmd + with: + arch: riscv64 + distro: ubuntu20.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + # Mount the .m2/repository + dockerRunArgs: | + --platform linux/riscv64 + --volume "/home/runner/.m2/repository/:/root/.m2/repository" + # Install dependencies + install: | + apt-get update + apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-17-jdk + + run: | + export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork" + chmod +x ./mvnw + ./mvnw -B --show-version -ntp clean package + + Linux-riscv64-Build-JDK21: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + env: + cache-name: cache-m2-repository-${{ runner.os }}-jdk21-riscv64 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr- + - uses: uraimo/run-on-arch-action@v2.4.0 + name: Run commands + id: runcmd + with: + arch: riscv64 + distro: ubuntu22.04 + + # Not required, but speeds up builds by storing container images in + # a GitHub package registry. + githubToken: ${{ github.token }} + + # Mount the .m2/repository + dockerRunArgs: | + --platform linux/riscv64 + --volume "/home/runner/.m2/repository/:/root/.m2/repository" + + # Install dependencies + install: | + apt-get update + apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential + + curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | bash && . ~/.jabba/jabba.sh + jabba install 21-custom=tgz+https://api.adoptium.net/v3/binary/latest/21/ea/linux/riscv64/jdk/hotspot/normal/eclipse?project=jdk -o /jdk + + run: | + export JAVA_HOME="/jdk" + chmod +x ./mvnw + ./mvnw -B --show-version -ntp clean package Windows-x86_64-Build-JDK8: runs-on: windows-latest @@ -397,7 +657,7 @@ jobs: - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1.12.0 - name: Build with Maven - run: mvn -B -ntp clean package --file pom.xml + run: mvn -B --show-version -ntp clean package --file pom.xml - name: Upload the build uses: actions/upload-artifact@v3 with: @@ -418,7 +678,7 @@ jobs: - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1.12.0 - name: Build with Maven - run: mvn -B -ntp clean package --file pom.xml + run: mvn -B --show-version -ntp --file pom.xml clean package Windows-x86_64-Build-JDK17: runs-on: windows-latest @@ -433,4 +693,19 @@ jobs: - name: Enable Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1.12.0 - name: Build with Maven - run: mvn -B -ntp clean package --file pom.xml + run: mvn -B --show-version -ntp --file pom.xml clean package + + Windows-x86_64-Build-JDK21: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: 21 + architecture: x64 + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@v1.12.0 + - name: Build with Maven + run: mvn -B --show-version -ntp --file pom.xml clean package diff --git a/README.md b/README.md index 18442e28..7001d9d3 100644 --- a/README.md +++ b/README.md @@ -6,15 +6,17 @@ Brotli4j provides Brotli compression and decompression for Java. ## Supported Platforms: -| Module | Architecture | Tested On | -|:------------------------------|:------------:|------------------------:| -| Windows (Windows Server 2022) | x64 | JDK 1.8, JDK 11, JDK 17 | -| Linux (CentOS 6) | x64 | JDK 1.8, JDK 11, JDK 17 | -| Linux (Ubuntu 18.04) | Aarch64 | JDK 1.8, JDK 11, JDK 17 | -| Linux (Ubuntu 18.04) | ARMv7 | JDK 1.8, JDK 11 | -| Linux (Ubuntu 18.04) | s390x | JDK 1.8, JDK 11 | -| macOS (Catalina) | x64 | JDK 1.8, JDK 11, JDK 17 | -| macOS (Catalina) | Aarch64 | JDK 1.8, JDK 11, JDK 17 | +| Module | Architecture | Tested On | +|:------------------------------|:------------:|--------------------------------:| +| Windows (Windows Server 2022) | x64 | JDK 1.8, JDK 11, JDK 17 | +| Linux (CentOS 6) | x64 | JDK 1.8, JDK 11, JDK 17 | +| Linux (Ubuntu 18.04) | Aarch64 | JDK 1.8, JDK 11, JDK 17 | +| Linux (Ubuntu 18.04) | ARMv7 | JDK 1.8, JDK 11 | +| Linux (Ubuntu 18.04) | s390x | JDK 1.8, JDK 11 | +| Linux (Ubuntu 18.04) | ppc64le | JDK 1.8, JDK 11 | +| Linux (Ubuntu 20.04) | RISC-V64 | JDK 1.8, JDK 11, JDK 17, JDK 21 | +| macOS (Catalina) | x64 | JDK 1.8, JDK 11, JDK 17 | +| macOS (Catalina) | Aarch64 | JDK 1.8, JDK 11, JDK 17 | #### *Install [Microsoft Visual C++ Redistributable](https://learn.microsoft.com/en-US/cpp/windows/latest-supported-vc-redist?view=msvc-170) before running this library on Windows @@ -43,6 +45,7 @@ Of course, you can add native(s) as dependency manually also. ```kotlin import org.gradle.nativeplatform.platform.internal.Architectures import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform +import org.gradle.nativeplatform.operatingsystem.OperatingSystem val brotliVersion = "1.13.0" val operatingSystem: OperatingSystem = DefaultNativePlatform.getCurrentOperatingSystem() @@ -54,20 +57,32 @@ repositories { dependencies { implementation("com.aayushatharva.brotli4j:brotli4j:$brotliVersion") runtimeOnly( - "com.aayushatharva.brotli4j:native-${ - if (operatingSystem.isWindows) "windows-x86_64" - else if (operatingSystem.isMacOsX) - if (DefaultNativePlatform.getCurrentArchitecture().isArm()) "osx-aarch64" - else "osx-x86_64" - else if (operatingSystem.isLinux) - if (Architectures.ARM_V7.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) "linux-armv7" - else if (Architectures.AARCH64.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) "linux-aarch64" - else if (Architectures.X86_64.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) "linux-x86_64" - else - throw IllegalStateException("Unsupported architecture: ${DefaultNativePlatform.getCurrentArchitecture().name}") - else - throw IllegalStateException("Unsupported operating system: $operatingSystem") - }:$brotliVersion" + "com.aayushatharva.brotli4j:native-" + + if (operatingSystem.isWindows) { + "windows-x86_64" + } else if (operatingSystem.isMacOsX) { + if (DefaultNativePlatform.getCurrentArchitecture().isArm()) { + "osx-aarch64" + } else { + "osx-x86_64" + } + } else if (operatingSystem.isLinux) { + if (Architectures.ARM_V7.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) { + "linux-armv7" + } else if (Architectures.AARCH64.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) { + "linux-aarch64" + } else if (Architectures.X86_64.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) { + "linux-x86_64" + } else if (Architectures.S390X.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) { + "linux-s390x" + } else if (Architectures.RISCV_64.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) { + "linux-riscv64" + } else { + throw IllegalStateException("Unsupported architecture: ${DefaultNativePlatform.getCurrentArchitecture().name}") + } + } else { + throw IllegalStateException("Unsupported operating system: $operatingSystem") + } + ":$brotliVersion" ) } ``` @@ -96,9 +111,11 @@ dependencies { if (Architectures.ARM_V7.isAlias(DefaultNativePlatform.getCurrentArchitecture().getName())) "linux-armv7" else if (Architectures.AARCH64.isAlias(DefaultNativePlatform.getCurrentArchitecture().getName())) "linux-aarch64" else if (Architectures.X86_64.isAlias(DefaultNativePlatform.getCurrentArchitecture().getName())) "linux-x86_64" + else if (Architectures.S390X.isAlias(DefaultNativePlatform.getCurrentArchitecture().getName())) "linux-s390x" + else if (Architectures.RISCV_64.isAlias(DefaultNativePlatform.getCurrentArchitecture().getName())) "linux-riscv64" else throw new IllegalStateException("Unsupported architecture: ${DefaultNativePlatform.getCurrentArchitecture().getName()}"); - else + else throw new IllegalStateException("Unsupported operating system: $operatingSystem"); }:$brotliVersion""") } @@ -189,6 +206,11 @@ public class Example { } ``` +### Additional Notes + +* RISC-V64: This platform is only supported by JDK 11+ (i.e. JDK 11, JDK 17, JDK 21, atm.). However, Since Brotli4j was always compiled +with JDK 8, we're cross-compiling RISC-V64 native module bytecode with JDK 8. This should not break existing application using +Broti4j. However, you should use JDK 11+ for using Brotli4j on RISC-V64 platform. __________________________________________________________________ ## Sponsors diff --git a/all/pom.xml b/all/pom.xml index f2f5e8c0..272b8fb3 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -64,6 +64,16 @@ native-linux-s390x ${project.version} + + com.aayushatharva.brotli4j + native-linux-ppc64le + ${project.version} + + + com.aayushatharva.brotli4j + native-linux-riscv64 + ${project.version} + com.aayushatharva.brotli4j native-osx-aarch64 diff --git a/brotli4j/pom.xml b/brotli4j/pom.xml index 0f6c7ecc..07cc4787 100644 --- a/brotli4j/pom.xml +++ b/brotli4j/pom.xml @@ -76,6 +76,23 @@ + + linux-ppc64le + + + Linux + ppc64le + + + + + com.aayushatharva.brotli4j + native-linux-ppc64le + ${project.parent.version} + + + + linux-aarch64 @@ -110,6 +127,23 @@ + + linux-riscv64 + + + Linux + riscv64 + + + + + com.aayushatharva.brotli4j + native-linux-riscv64 + ${project.parent.version} + + + + windows-x86_64 diff --git a/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java b/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java index 5d21f807..33ae1a26 100644 --- a/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java +++ b/brotli4j/src/main/java/com/aayushatharva/brotli4j/Brotli4jLoader.java @@ -128,6 +128,10 @@ private static String getPlatform() { return "linux-armv7"; } else if ("s390x".equalsIgnoreCase(archName)) { return "linux-s390x"; + } else if ("ppc64le".equalsIgnoreCase(archName)) { + return "linux-ppc64le"; + } else if ("riscv64".equalsIgnoreCase(archName)) { + return "linux-riscv64"; } } else if (osName.startsWith("Windows")) { if ("amd64".equalsIgnoreCase(archName)) { diff --git a/docker/Dockerfile21.centos6 b/docker/Dockerfile21.centos6 new file mode 100644 index 00000000..ef58d1fa --- /dev/null +++ b/docker/Dockerfile21.centos6 @@ -0,0 +1,45 @@ +FROM gatlingcorp/centos:6-gcc5 + +RUN rm -vf /usr/lib64/libstdc++.so.6.0.21-gdb.py + +RUN yum -y install \ + git + +RUN export java_version=amazon-corretto@21.0.1 && \ + export JAVA_VERSION=$java_version && \ + curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | JABBA_COMMAND="install 21.0.1-custom=tgz+https://corretto.aws/downloads/resources/21.0.1.12.1/amazon-corretto-21.0.1.12.1-linux-x64.tar.gz -o /jdk" bash && \ + echo 'export JAVA_HOME="/jdk"' >> ~/.bashrc && \ + echo 'PATH=/jdk/bin:$PATH' >> ~/.bashrc + +ENV JAVA_HOME "/jdk" +ENV PATH "/jdk/bin:$PATH" + +RUN mkdir -p /workspace + +RUN mkdir -p /opt && \ + cd /opt && \ + wget --no-verbose https://maven-central.storage-download.googleapis.com/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6-bin.tar.gz && \ + tar xzf apache-maven-3.8.6-bin.tar.gz && \ + ln -s apache-maven-3.8.6 maven && \ + ln -s /opt/maven/bin/mvn /usr/bin/mvn + +RUN cd /opt && \ + wget --no-verbose https://github.com/Kitware/CMake/releases/download/v3.20.1/cmake-3.20.1-linux-x86_64.sh && \ + chmod a+x cmake-3.20.1-linux-x86_64.sh && \ + yes | ./cmake-3.20.1-linux-x86_64.sh + +ENV MAVEN_HOME "/opt/maven" +ENV PATH "/opt/maven/bin:$PATH" +ENV PATH "/opt/cmake-3.20.1-linux-x86_64/bin:$PATH" + +RUN mkdir /workspace/Brotli4j +RUN cd /workspace/Brotli4j + +RUN echo "/jdk/lib/amd64" >> /etc/ld.so.conf +RUN echo "/jdk/jre/lib/amd64/" >> /etc/ld.so.conf + +RUN ldconfig + +RUN echo "export MAVEN_HOME=/opt/maven" >> ~/.bashrc +RUN echo "export PATH=/opt/maven/bin:\$PATH " >> ~/.bashrc +RUN echo "export PATH=/opt/cmake-3.20.1-linux-x86_64/bin:\$PATH " >> ~/.bashrc diff --git a/docker/docker-compose11.yml b/docker/docker-compose11.yml index 5de3cf1e..bd59fc3b 100644 --- a/docker/docker-compose11.yml +++ b/docker/docker-compose11.yml @@ -18,7 +18,7 @@ services: build: <<: *common - command: /bin/bash -cl "mvn -B -ntp clean package --file pom.xml" + command: /bin/bash -cl "mvn -B --show-version -ntp --file pom.xml clean package" shell: <<: *common diff --git a/docker/docker-compose17.yml b/docker/docker-compose17.yml index fc3e8be9..80aec39f 100644 --- a/docker/docker-compose17.yml +++ b/docker/docker-compose17.yml @@ -18,7 +18,7 @@ services: build: <<: *common - command: /bin/bash -cl "mvn -B -ntp clean package --file pom.xml" + command: /bin/bash -cl "mvn -B --show-version -ntp --file pom.xml clean package" shell: <<: *common diff --git a/docker/docker-compose21.yml b/docker/docker-compose21.yml new file mode 100644 index 00000000..5b9844a6 --- /dev/null +++ b/docker/docker-compose21.yml @@ -0,0 +1,25 @@ +version: "3" + +services: + + runtime-setup: + image: brotli4j:default + build: + context: . + dockerfile: Dockerfile21.centos6 + + common: &common + image: brotli4j:default + depends_on: [ runtime-setup ] + volumes: + - ~/.m2:/root/.m2 + - ..:/code + working_dir: /code + + build: + <<: *common + command: /bin/bash -cl "mvn -B --show-version -ntp --file pom.xml clean package" + + shell: + <<: *common + entrypoint: /bin/bash diff --git a/natives/linux-ppc64le/build.sh b/natives/linux-ppc64le/build.sh new file mode 100644 index 00000000..468102f7 --- /dev/null +++ b/natives/linux-ppc64le/build.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +CURPATH=$(pwd) +TARGET_CLASSES_PATH="target/classes/lib/linux-ppc64le" +TARGET_PATH="target" + +exitWithError() { + cd ${CURPATH} + echo "*** An error occurred. Please check log messages. ***" + exit $1 +} + +mkdir -p "$TARGET_CLASSES_PATH" + +cd "$TARGET_PATH" +cmake ../../../ || exitWithError $? +make || exitWithError $? +rm -f "$CURPATH/${TARGET_CLASSES_PATH}/libbrotli.so" +cp "./libbrotli.so" "$CURPATH/${TARGET_CLASSES_PATH}" || exitWithError $? + +cd "${CURPATH}" diff --git a/natives/linux-ppc64le/pom.xml b/natives/linux-ppc64le/pom.xml new file mode 100644 index 00000000..7ea1d7af --- /dev/null +++ b/natives/linux-ppc64le/pom.xml @@ -0,0 +1,119 @@ + + + + + natives + com.aayushatharva.brotli4j + 1.12.0 + + 4.0.0 + + native-linux-ppc64le + jar + + + com.aayushatharva.brotli4j.linux.ppc64le + + + + + + org.moditect + moditect-maven-plugin + 1.0.0.RC2 + + + add-module-infos + package + + add-module-info + + + 9 + + + module ${javaModuleName} { + requires com.aayushatharva.brotli4j.service; + exports ${javaModuleName} to com.aayushatharva.brotli4j; + provides com.aayushatharva.brotli4j.service.BrotliNativeProvider with + ${javaModuleName}.NativeLoader; + } + + + + --multi-release + 9 + + + + + + + + + + + linux-ppc64le + + + Linux + ppc64le + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + + build-native + process-classes + + exec + + + /bin/bash + + build.sh + + ${project.basedir} + + + + + + + + + + release + + + + resources + + + + + + diff --git a/natives/linux-ppc64le/src/main/java/com/aayushatharva/brotli4j/linux/ppc64le/NativeLoader.java b/natives/linux-ppc64le/src/main/java/com/aayushatharva/brotli4j/linux/ppc64le/NativeLoader.java new file mode 100644 index 00000000..5eac4a9c --- /dev/null +++ b/natives/linux-ppc64le/src/main/java/com/aayushatharva/brotli4j/linux/ppc64le/NativeLoader.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020-2023, Aayush Atharva + * + * Brotli4j 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 com.aayushatharva.brotli4j.linux.ppc64le; + +import com.aayushatharva.brotli4j.service.BrotliNativeProvider; + +/** + * Service class to access the native lib in a JPMS context + */ +public class NativeLoader implements BrotliNativeProvider { + + @Override + public String platformName() { + return "linux-ppc64le"; + } +} diff --git a/natives/linux-riscv64/build.sh b/natives/linux-riscv64/build.sh new file mode 100644 index 00000000..84deba17 --- /dev/null +++ b/natives/linux-riscv64/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +CURPATH=$(pwd) +TARGET_CLASSES_PATH="target/classes/lib/linux-riscv64" +TARGET_PATH="target" + +exitWithError() { + cd ${CURPATH} + echo "*** An error occurred. Please check log messages. ***" + exit $1 +} + +mkdir -p "$TARGET_CLASSES_PATH" + +cd "$TARGET_PATH" +cmake ../../../ || exitWithError $? +make || exitWithError $? +rm -f "$CURPATH/${TARGET_CLASSES_PATH}/libbrotli.so" +cp "./libbrotli.so" "$CURPATH/${TARGET_CLASSES_PATH}" || exitWithError $? + +cd "${CURPATH}" diff --git a/natives/linux-riscv64/pom.xml b/natives/linux-riscv64/pom.xml new file mode 100644 index 00000000..e94a9771 --- /dev/null +++ b/natives/linux-riscv64/pom.xml @@ -0,0 +1,120 @@ + + + + + natives + com.aayushatharva.brotli4j + 1.12.0 + + 4.0.0 + + native-linux-riscv64 + jar + + + com.aayushatharva.brotli4j.linux.riscv64 + + + + + + org.moditect + moditect-maven-plugin + 1.0.0.RC2 + + + add-module-infos + package + + add-module-info + + + 9 + + + module ${javaModuleName} { + requires com.aayushatharva.brotli4j.service; + exports ${javaModuleName} to com.aayushatharva.brotli4j; + provides com.aayushatharva.brotli4j.service.BrotliNativeProvider with + ${javaModuleName}.NativeLoader; + } + + + + --multi-release + 9 + + + + + + + + + + + linux-riscv64 + + + Linux + riscv64 + + + + + + org.codehaus.mojo + exec-maven-plugin + 3.1.0 + + + build-native + process-classes + + exec + + + /bin/bash + + build.sh + + ${project.basedir} + + + + + + + + + + release + + + + resources + + + + + + + diff --git a/natives/linux-riscv64/src/main/java/com/aayushatharva/brotli4j/linux/riscv64/NativeLoader.java b/natives/linux-riscv64/src/main/java/com/aayushatharva/brotli4j/linux/riscv64/NativeLoader.java new file mode 100644 index 00000000..5ca26f97 --- /dev/null +++ b/natives/linux-riscv64/src/main/java/com/aayushatharva/brotli4j/linux/riscv64/NativeLoader.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2020-2023, Aayush Atharva + * + * Brotli4j 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 com.aayushatharva.brotli4j.linux.riscv64; + +import com.aayushatharva.brotli4j.service.BrotliNativeProvider; + +/** + * Service class to access the native lib in a JPMS context + */ +public class NativeLoader implements BrotliNativeProvider { + + @Override + public String platformName() { + return "linux-riscv64"; + } +} diff --git a/natives/linux-x86_64/pom.xml b/natives/linux-x86_64/pom.xml index 83c0fa55..966376fa 100644 --- a/natives/linux-x86_64/pom.xml +++ b/natives/linux-x86_64/pom.xml @@ -31,6 +31,7 @@ com.aayushatharva.brotli4j.linux.s390x + com.aayushatharva.brotli4j.linux.ppc64le diff --git a/natives/pom.xml b/natives/pom.xml index 00d0878c..2b3dabf5 100644 --- a/natives/pom.xml +++ b/natives/pom.xml @@ -32,6 +32,8 @@ linux-aarch64 linux-armv7 linux-s390x + linux-ppc64le + linux-riscv64 windows-x86_64 osx-x86_64 osx-aarch64 @@ -73,6 +75,19 @@ + + linux-ppc64le + + + Linux + ppc64le + + + + linux-ppc64le + + + linux-aarch64 @@ -99,6 +114,19 @@ + + linux-riscv64 + + + Linux + riscv64 + + + + linux-riscv64 + + + windows-x86_64 @@ -145,6 +173,8 @@ linux-aarch64 linux-armv7 linux-s390x + linux-ppc64le + linux-riscv64 windows-x86_64 osx-x86_64 osx-aarch64 diff --git a/pom.xml b/pom.xml index 95016827..92014c1c 100644 --- a/pom.xml +++ b/pom.xml @@ -67,6 +67,18 @@ 1.8 + + + jdk9+ + + [9,) + + + 8 + + + + ossrh @@ -107,6 +119,12 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.6.0 + + org.apache.maven.plugins maven-jar-plugin