#1160 OSX aarch64 (M1) libusb support and JDK auto-download for target OS images. (#1161)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2022-03-12 07:43:58 -05:00
committed by GitHub
parent 6b3b45e9af
commit a9f4fbbdd4

View File

@@ -86,6 +86,7 @@ dependencies {
implementation 'org.usb4java:libusb4java:1.3.0' implementation 'org.usb4java:libusb4java:1.3.0'
implementation 'org.usb4java:usb4java:1.3.0' implementation 'org.usb4java:usb4java:1.3.0'
implementation 'org.usb4java:usb4java-javax:1.3.0' implementation 'org.usb4java:usb4java-javax:1.3.0'
implementation 'io.github.dsheirer:libusb4java-darwin-aarch64:1.3.0' //usb4java native lib for OSX M1 cpu
implementation 'pl.edu.icm:JLargeArrays:1.6' implementation 'pl.edu.icm:JLargeArrays:1.6'
} }
@@ -125,69 +126,83 @@ idea {
} }
/** /**
* Java Development Kit (JDK) locations. In order to build OS-specific images, these paths must point to the parent * Java Development Kit (JDK) for each target platform can either be used from a local copy, or downloaded from a
* directory containing the 'bin' directory within a JDK for each of the specified architectures. These JDKs are used * JDK vendor. These locations are relative to the author's development workstation.
* by the runtime and runtimeZip tasks to produce platform-specific builds. If none of these paths exists, then an
* image will be created for the host OS using the installed JDK.
*/ */
def jdk_base = '/home/denny/java_jdks/' def jdk_base = '/home/denny/java_jdks/'
def jdk_linux_aarch64 = file(jdk_base + 'linux-arm64/jdk-17.0.2-full')
def jdk_linux_arm64 = jdk_base + 'linux-arm64/jdk-17.0.2-full' def jdk_linux_x86_64 = file(jdk_base + 'linux-x64/jdk-17.0.2-full')
def jdk_linux_x86_64 = jdk_base + 'linux-x64/jdk-17.0.2-full' def jdk_osx_x86_64 = file(jdk_base + 'osx-x64/jdk-17.0.2-full.jdk')
def jdk_osx_x86_64 = jdk_base + 'osx-x64/jdk-17.0.2-full.jdk' def jdk_osx_aarch64 = file(jdk_base + 'osx-arm64/jdk-17.0.2-full.jdk')
def jdk_windows_x86_64 = jdk_base + 'windows-x64/jdk-17.0.2-full' def jdk_windows_x86_64 = file(jdk_base + 'windows-x64/jdk-17.0.2-full')
def hasTargetJdk = jdk_linux_x86_64.exists() || jdk_linux_aarch64.exists() || jdk_osx_x86_64.exists() ||
def hasTargetJdk = file(jdk_linux_x86_64).exists() || jdk_osx_aarch64.exists() || jdk_windows_x86_64.exists()
file(jdk_linux_arm64).exists() ||
file(jdk_osx_x86_64).exists() ||
file(jdk_windows_x86_64).exists()
/** /**
* Beryx Runtime plugin - adds operating system specific runtime build targets when the OS-specific JDK is * Beryx Runtime plugin - adds operating system specific runtime build targets using either an OS-specific JDK
* found on the local file system. The runtime plugin enables you to optionally download these files, * found on the local file system or it downloads the JDK from the specified URLs.
* however I normally have them installed locally and use those versions. *
* usage: gradle runtimeZip
*/ */
runtime { runtime {
if(file(jdk_linux_arm64).exists()) targetPlatform('linux-aarch64-v' + version) {
{ if(jdk_linux_aarch64.exists())
targetPlatform('linux-arm64-v' + version, jdk_linux_arm64) {
} jdkHome = jdk_linux_aarch64
else }
{ else
println("Skipping OS Image - Linux ARM 64-bit JDK was not found at " + jdk_linux_arm64) {
jdkHome = jdkDownload("https://download.bell-sw.com/java/17.0.2+9/bellsoft-jdk17.0.2+9-linux-aarch64-full.tar.gz")
}
} }
if(file(jdk_linux_x86_64).exists()) targetPlatform('linux-x86_64-v' + version) {
{ if(file(jdk_linux_x86_64).exists())
targetPlatform('linux-x86_64-v' + version, jdk_linux_x86_64) {
} jdkHome = jdk_linux_x86_64
else }
{ else
println("Skipping OS Image - Linux x86 64-bit JDK was not found at " + jdk_linux_x86_64) {
jdkHome = jdkDownload("https://download.bell-sw.com/java/17.0.2+9/bellsoft-jdk17.0.2+9-linux-amd64-full.tar.gz")
}
} }
if(file(jdk_osx_x86_64).exists()) targetPlatform('osx-x86_64-v' + version) {
{ if(file(jdk_osx_x86_64).exists())
targetPlatform('osx-x86_64-v' + version, jdk_osx_x86_64) {
} jdkHome = jdk_osx_x86_64
else }
{ else
println("Skipping OS Image - OSX x86 64-bit JDK was not found at " + jdk_osx_x86_64); {
jdkHome = jdkDownload("https://download.bell-sw.com/java/17.0.2+9/bellsoft-jdk17.0.2+9-macos-amd64-full.tar.gz")
}
} }
if(file(jdk_windows_x86_64).exists()) targetPlatform('osx-aarch64-v' + version) {
{ if(file(jdk_osx_aarch64).exists())
targetPlatform('windows-x86_64-v' + version, jdk_windows_x86_64) {
jdkHome = jdk_osx_aarch64
}
else
{
jdkHome = jdkDownload("https://download.bell-sw.com/java/17.0.2+9/bellsoft-jdk17.0.2+9-macos-aarch64-full.tar.gz")
}
} }
else
{ targetPlatform('windows-x86_64-v' + version) {
println("Skipping OS Image - Windows x86 64-bit JDK was not found at " + jdk_windows_x86_64) if(file(jdk_windows_x86_64).exists())
{
jdkHome = jdk_windows_x86_64
}
else
{
jdkHome = jdkDownload("https://download.bell-sw.com/java/17.0.2+9/bellsoft-jdk17.0.2+9-windows-amd64-full.zip")
}
} }
//jdk.crypto.ec is needed for HTTPS connections (broadcastify calls & map tile server) //jdk.crypto.ec is needed for HTTPS connections (broadcastify calls & map tile server)
modules = ['jdk.crypto.ec'] modules = ['jdk.crypto.ec']
additive = true additive = true
options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages'] options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
imageZip = hasTargetJdk ? file("$buildDir/image/sdr-trunk.zip") : file("$buildDir/image/sdr-trunk-" + version + ".zip") imageZip = hasTargetJdk ? file("$buildDir/image/sdr-trunk.zip") : file("$buildDir/image/sdr-trunk-" + version + ".zip")
} }