Skip to content

Commit

Permalink
[skip ci] Update README.md and add back self-hosted aarch64 runner
Browse files Browse the repository at this point in the history
  • Loading branch information
Kale-Ko committed Jun 1, 2024
1 parent 2350458 commit d5eaf0e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 77 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ jobs:
runs_on: windows-2022
java_distro: 'temurin'
java_name: x86
- name: aarch64
runs_on: self-hosted
java_distro: 'liberica'
java_name: aarch64
java_version: [ 8, 11, 17, 21 ]

exclude:
Expand Down
138 changes: 61 additions & 77 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ 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, JDK 21 |
| Windows 11 | Aarch64 | JDK 11 |
| Linux (CentOS 6) | x64 | JDK 1.8, JDK 11, JDK 17, JDK 21 |
| Linux (Ubuntu 18.04) | Aarch64 | JDK 1.8, JDK 11, JDK 17, JDK 21 |
| Linux (Ubuntu 18.04) | ARMv7 | JDK 1.8, JDK 11, JDK 17 |
| 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, JDK 21 |
| macOS (Catalina) | Aarch64 | JDK 1.8, JDK 11, JDK 17, JDK 21 |
| Module | Architecture | Tested On |
|:-----------------------|:---------------:|-----------------------------------------:|
| Windows (Server 2022) | x86_64 (x64) | JDK 8, JDK 11, JDK 17, JDK 21 (temurin) |
| Windows (Server 2022) | x86 (i386) | JDK 8, JDK 11, JDK 17 (temurin) |
| Windows (11) | Aarch64 (arm64) | JDK 11, JDK 17, JDK 21 (liberica) |
| Windows | ARMv7 (arm) | Untested |
| Linux (Ubuntu 24.04) | x86_64 (x64) | JDK 8, JDK 11, JDK 17, JDK 21 (temurin) |
| Linux (Ubuntu 22.04) | x86 (i386) | JDK 8, JDK 11, JDK 17, JDK 21 (liberica) |
| Linux (Ubuntu 24.04) | Aarch64 (arm64) | JDK 8, JDK 11, JDK 17, JDK 21 (temurin) |
| Linux (Ubuntu 24.04) | ARMv7 (arm) | JDK 8, JDK 11 (temurin) |
| Linux (Ubuntu 24.04) | ppc64le | JDK 8, JDK 11, JDK 17, JDK 21 (temurin) |
| Linux (Ubuntu 24.04) | s390x | JDK 11, JDK 17, JDK 21 (temurin) |
| Linux (Ubuntu 24.04) | riscv64 | JDK 17, JDK 21 (temurin) |
| macOS (14 Sonoma) | x86_64 (x64) | JDK 8, JDK 11, JDK 17, JDK 21 (temurin) |
| macOS (14 Sonoma) | Aarch64 (arm64) | JDK 11, JDK 17, JDK 21 (temurin) |

#### *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

Expand All @@ -32,7 +35,7 @@ For maven, the natives will
<dependency>
<groupId>com.aayushatharva.brotli4j</groupId>
<artifactId>brotli4j</artifactId>
<version>1.16.0</version>
<version>1.17.0</version>
</dependency>
```

Expand All @@ -46,49 +49,40 @@ 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.16.0"
val operatingSystem: OperatingSystem = DefaultNativePlatform.getCurrentOperatingSystem()
val brotliVersion = "1.17.0"
val operatingSystem = DefaultNativePlatform.getCurrentOperatingSystem()
val currentArchitecture = DefaultNativePlatform.getCurrentArchitecture().name

repositories {
mavenCentral()
}

dependencies {
implementation("com.aayushatharva.brotli4j:brotli4j:$brotliVersion")
implementation("com.aayushatharva.brotli4j:brotli4j:${brotliVersion}")
runtimeOnly(
"com.aayushatharva.brotli4j:native-" +
if (operatingSystem.isWindows) {
if (DefaultNativePlatform.getCurrentArchitecture().isArm()) {
"windows-aarch64"
} else {
"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 if (Architectures.PPC64LE.isAlias(DefaultNativePlatform.getCurrentArchitecture().name)) {
"linux-ppc64le"
} else {
throw IllegalStateException("Unsupported architecture: ${DefaultNativePlatform.getCurrentArchitecture().name}")
}
if (operatingSystem.isWindows()) {
if (Architectures.X86_64.isAlias(currentArchitecture)) "windows-x86_64"
else if (Architectures.X86.isAlias(currentArchitecture)) "windows-x86"
else if (Architectures.AARCH64.isAlias(currentArchitecture)) "windows-aarch64"
else if (Architectures.ARM_V7.isAlias(currentArchitecture)) "windows-armv7"
else throw new IllegalStateException ("Unsupported architecture: $currentArchitecture")
} else if (operatingSystem.isMacOsX()) {
if (Architectures.X86_64.isAlias(currentArchitecture)) "osx-x86_64"
else if (Architectures.AARCH64.isAlias(currentArchitecture)) "osx-aarch64"
else throw new IllegalStateException ("Unsupported architecture: $currentArchitecture")
} else if (operatingSystem.isLinux()) {
if (Architectures.X86_64.isAlias(currentArchitecture)) "linux-x86_64"
else if (Architectures.X86.isAlias(currentArchitecture)) "linux-x86"
else if (Architectures.AARCH64.isAlias(currentArchitecture)) "linux-aarch64"
else if (Architectures.ARM_V7.isAlias(currentArchitecture)) "linux-armv7"
else if ("ppc64le".equals(currentArchitecture, true)) "linux-ppc64le"
else if ("s390x".equals(currentArchitecture, true)) "linux-s390x"
else if ("riscv64".equals(currentArchitecture, true)) "linux-riscv64"
else throw new IllegalStateException ("Unsupported architecture: $currentArchitecture")
} else {
throw IllegalStateException("Unsupported operating system: $operatingSystem")
throw new IllegalStateException("Unsupported operating system: $operatingSystem")
} + ":$brotliVersion"
)
}
Expand All @@ -100,9 +94,9 @@ dependencies {
import org.gradle.nativeplatform.platform.internal.Architectures
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
def brotliVersion = "1.16.0"
def brotliVersion = "1.17.0"
def operatingSystem = DefaultNativePlatform.getCurrentOperatingSystem()
def currentArchitecture = DefaultNativePlatform.getCurrentArchitecture()
def currentArchitecture = DefaultNativePlatform.getCurrentArchitecture().name
repositories {
mavenCentral()
Expand All @@ -112,24 +106,25 @@ dependencies {
implementation "com.aayushatharva.brotli4j:brotli4j:$brotliVersion"
runtimeOnly("""com.aayushatharva.brotli4j:native-${
if (operatingSystem.isWindows())
if (currentArchitecture.isX86_64()) "windows-x86_64"
else if (currentArchitecture.isArm()) "windows-aarch64"
else
throw new IllegalStateException("Unsupported architecture: ${currentArchitecture.getName()}");
if (Architectures.X86_64.isAlias(currentArchitecture)) "windows-x86_64"
else if (Architectures.X86.isAlias(currentArchitecture)) "windows-x86"
else if (Architectures.AARCH64.isAlias(currentArchitecture)) "windows-aarch64"
else if (Architectures.ARM_V7.isAlias(currentArchitecture)) "windows-armv7"
else throw new IllegalStateException("Unsupported architecture: $currentArchitecture")
else if (operatingSystem.isMacOsX())
if (currentArchitecture.isArm()) "osx-aarch64"
else "osx-x86_64"
if (Architectures.X86_64.isAlias(currentArchitecture)) "osx-x86_64"
else if (Architectures.AARCH64.isAlias(currentArchitecture)) "osx-aarch64"
else throw new IllegalStateException("Unsupported architecture: $currentArchitecture")
else if (operatingSystem.isLinux())
if (currentArchitecture.isAARCH64()) "linux-aarch64"
else if (currentArchitecture.isX86_64()) "linux-x86_64"
else if (currentArchitecture.isARM_V7()) "linux-armv7"
else if (currentArchitecture.isPPC64LE()) "linux-ppc64le"
else if (currentArchitecture.isS390X()) "linux-s390x"
else if (currentArchitecture.isRISCV64()) "linux-riscv64"
else
throw new IllegalStateException("Unsupported architecture: ${currentArchitecture.getName()}");
else
throw new IllegalStateException("Unsupported operating system: $operatingSystem");
if (Architectures.X86_64.isAlias(currentArchitecture)) "linux-x86_64"
else if (Architectures.X86.isAlias(currentArchitecture)) "linux-x86"
else if (Architectures.AARCH64.isAlias(currentArchitecture)) "linux-aarch64"
else if (Architectures.ARM_V7.isAlias(currentArchitecture)) "linux-armv7"
else if ("ppc64le".equalsIgnoreCase(currentArchitecture)) "linux-ppc64le"
else if ("s390x".equalsIgnoreCase(currentArchitecture)) "linux-s390x"
else if ("riscv64".equalsIgnoreCase(currentArchitecture)) "linux-riscv64"
else throw new IllegalStateException("Unsupported architecture: $currentArchitecture")
else throw new IllegalStateException("Unsupported operating system: $operatingSystem")
}:$brotliVersion""")
}
```
Expand All @@ -140,7 +135,7 @@ dependencies {

Call `Brotli4jLoader.ensureAvailability()` in your application once before using Brotli4j. This will load
Brotli4j native library automatically using automatic dependency resolution.
However, its possible to load native library manually from custom path by specifying System Property `"brotli4j.library.path"`.
However, it's possible to load native library manually from custom path by specifying System Property `"brotli4j.library.path"`.

### Direct API

Expand Down Expand Up @@ -219,17 +214,6 @@ public class Example {
}
```

### Additional Notes

* Windows-AArch64: Brotli4j is compiled with JDK 11 with JDK 8 as target because JDK 8 Windows Aarch64 builds are not available at the moment.
However, it should not cause any problem on running it on JDK 8 or plus.
__________________________________________________________________

* 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.
__________________________________________________________________

## Projects that use Brotli4j

- [Netty](https://github.com/netty/netty)
Expand All @@ -252,4 +236,4 @@ performance bottlenecks, pin down memory leaks and understand threading issues.

<a href="https://www.ej-technologies.com/products/jprofiler/overview.html" target="_blank" title="File Management">
<img src="https://www.ej-technologies.com/images/product_banners/jprofiler_large.png" alt="File Management">
</a>
</a>

0 comments on commit d5eaf0e

Please sign in to comment.