Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jjlauer committed Nov 3, 2023
1 parent 22a2088 commit 57c26dc
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 61 deletions.
67 changes: 35 additions & 32 deletions .blaze/blaze.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,16 @@ public void clean() throws Exception {
.setHost("bmh-build-x64-win11-1"),

//
// test-only containers
// CI/Test Local Machine
//

new Target(localNativeTarget.toJneOsAbi(), localNativeTarget.toJneArch(), "local machine")
.setTags("test"),

//
// CI/Test Linux
//

new Target("linux", "x64", "ubuntu16.04, jdk11")
.setTags("test")
.setContainerImage("fizzed/buildx:x64-ubuntu16-jdk11"),
Expand All @@ -197,62 +201,61 @@ public void clean() throws Exception {
.setTags("test")
.setContainerImage("fizzed/buildx:x64-ubuntu22-jdk21"),

/*new Target("linux", "arm64")
.setTags("test")
.setHost("bmh-build-arm64-ubuntu22-1"),*/

new Target("linux", "arm64", "ubuntu16.04, jdk11")
new Target("linux", "arm64", "Ubuntu 16.04, JDK 11")
.setTags("test")
.setHost("bmh-hv-6")
.setContainerImage("fizzed/buildx:arm64-ubuntu16-jdk11"),

new Target("linux", "armhf", "Ubuntu 16.04, JDK 11")
.setTags("test")
.setHost("bmh-hv-6")
.setContainerImage("fizzed/buildx:armhf-ubuntu16-jdk11"),

new Target("windows", "x64", "win10")
new Target("linux", "armel", "Debian 11, JDK 11")
.setTags("test")
.setHost("bmh-build-x64-win10-1"),
.setHost("bmh-hv-6")
.setContainerImage("fizzed/buildx:armel-debian11-jdk11"),

new Target("windows", "arm64", "win11")
new Target("linux", "riscv64", "debian11")
.setTags("test")
.setHost("bmh-build-arm64-win11-1"),
.setHost("bmh-build-riscv64-debian11-1"),

//
// CI/Test Linux (w/ MUSL)
//

new Target("linux_musl", "x64", "alpine3.11, jdk11")
.setTags("test")
.setContainerImage("fizzed/buildx:x64-alpine3.11-jdk11"),

new Target("linux_musl", "arm64", "alpine3.11, jdk11")
.setTags("test")
// faster to run on an arm64 box?
//.setHost("bmh-build-arm64-ubuntu22-1")
.setContainerImage("fizzed/buildx:arm64v8-alpine3.11-jdk11")

/*
*/

/*
new Target("linux", "armhf-test")
.setTags("test")
.setContainerImage("fizzed/buildx:arm32v7-ubuntu18-jdk11"),
.setHost("bmh-hv-6")
.setContainerImage("fizzed/buildx:arm64v8-alpine3.11-jdk11"),

new Target("linux", "armel-test")
.setTags("test")
.setContainerImage("fizzed/buildx:arm32v5-debian11-jdk11"),
//
// CI/Test MacOS
//

new Target("linux", "armel-test")
new Target("macos", "arm64", "MacOS 12")
.setTags("test")
.setContainerImage("fizzed/buildx:arm32v5-debian11-jdk11"),
.setHost("bmh-build-arm64-macos12-1"),

new Target("linux", "riscv64-test")
.setTags("test")
.setContainerImage("fizzed/buildx:riscv64-ubuntu20-jdk19"),
//
// CI/Test Windows
//

new Target("windows", "x64-test", "win10")
new Target("windows", "x64", "Windows 10")
.setTags("test")
.setHost("bmh-build-x64-win10-1"),

new Target("windows", "x64-test", "win7")
new Target("windows", "x64", "Windows 7")
.setTags("test")
.setHost("bmh-build-x64-win7-1"),
*/

new Target("windows", "arm64", "Windows 11")
.setTags("test")
.setHost("bmh-build-arm64-win11-1")
);

@Task(order = 50)
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
*.iml
native/libhelloj/helloj/HelloLib.class
.buildx
.buildx-temp
.buildx-cache
64 changes: 36 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Java Native Extractor by Fizzed
# Java Native Environment by Fizzed

[![Maven Central](https://img.shields.io/maven-central/v/com.fizzed/jne?style=flat-square)](https://mvnrepository.com/artifact/com.fizzed/jne)

Expand All @@ -17,10 +17,40 @@

## Overview

Java library (targeting 6+, plus 8, 11, 17, 21 etc) for finding, extracting, and using os and architecture
dependent files (executables, libraries, and/or other files) that are packaged
as resources within jar files. Extensive support and testing for operating system, libc (e.g. glibc vs. musl), and
hardware architecture detection.
Java library (8, 11, 17, 21 etc) for working with "native" resources on the JVM. Utilities for finding & extracting
OS and hardware architecture dependent files, executables, and libraries (e.g. including libraries as resources in JARs),
as well as utilities for detecting installed JDKs, or calculating the "targets" of native compilation.

This is a battle-tested library w/ extensive test coverage and automated CI across various operating systems, versions,
and architectures.

## Features

- JNE class: helps to find, extract, and load OS, ABI, and hardware architecture dependent files, executables, and
libraries
- NativeTarget class: helps to compile native code by determining various "targets" for Rust, C/C++, or for CI frameworks
- JavaHome, JavaHomes classes: helps to detect JDKs installed on the local system, as well as versions, distribution,
JDK vs. JRE, etc.
- Support for Linux, Windows, MacOS, FreeBSD, OpenBSD operating systems
- Support for x64, x32, arm64, armhf, armel, riscv64 hardware architecture
- Support for GNU & MUSL abis
- Support for multiple operating systems and architectures so that a single jar dependency can support them all.
- Support for finding executables (e.g. cat or cat.exe)
- Support for finding libraries (e.g. sample.dll/libsample.dylib/libsample.so)
- Support for finding generic files (e.g. movie.swf)
- Use a one-time temporary directory for extracted executables (thus same apps running multiple instances get their own executable copy)
- Specify a directory to extract executables to (useful for single instance daemons).
- Specify if executables should be deleted on VM exit. If disabled and an extracted directory is specified, then a "hash" is calculated for an extracted
executable so that if the next run of the app has a dependency change then the latest executable will be used.
- Optional fallback to x86 executables on x64 platforms where an x64-specific executable is not found/included. Useful in the case where an x86 executable
is good for either architecture and you want to save space by not including both versions in your JAR.
- Utility classes for double-locking, safe loading of libraries.

## OS/Architecture Dependent Extraction at Runtime

JNE can helps with finding, extracting, and using os and architecture dependent files (executables, libraries, and/or
other files) that are packaged as resources within jar files. Extensive support and testing for operating system, libc
(e.g. glibc vs. musl), and hardware architecture detection.

Allows them to be easily included as part of a Java application and intelligently extracted for use at runtime. This library makes
it easy to build your own custom "bin" directory based on the runtime operating
Expand Down Expand Up @@ -56,27 +86,6 @@ be included as the first argument to a Process or ProcessBuilder object. There
are other options as well (e.g. fallback to x86 resources on x64 platforms) so
please see features below.

## Features

- Support for multiple operating systems and architectures so that a single
jar dependency can support them all.
- Support for finding executables (e.g. cat or cat.exe)
- Support for finding libraries (e.g. sample.dll/libsample.dylib/libsample.so)
- Support for finding generic files (e.g. movie.swf)
- Use a one-time temporary directory for extracted executables (thus same apps
running multiple instances get their own executable copy)
- Specify a directory to extract executables to (useful for single instance
daemons).
- Specify if executables should be deleted on VM exit. If disabled and an
extracted directory is specified, then a "hash" is calculated for an extracted
executable so that if the next run of the app has a dependency change then
the latest executable will be used.
- Optional fallback to x86 executables on x64 platforms where an x64-specific
executable is not found/included. Useful in the case where an x86 executable
is good for either architecture and you want to save space by not including both
versions in your JAR.
- Utility classes for double-locking, safe loading of libraries.

## Operating Systems

All popular operating systems are supported, along with special care for MUSL-based operating systems
Expand Down Expand Up @@ -196,8 +205,7 @@ information on how this works, please visit https://github.com/fizzed/blaze-buil

You can test this library on a wide variety of operating systems and architectures

./build-dockers.sh
./test-on-dockers.sh
java -jar blaze.jar test

## License

Expand Down

0 comments on commit 57c26dc

Please sign in to comment.