Slackbot
01/11/2023, 1:11 PMMarkus Maier
01/11/2023, 1:45 PMDefaultNativePlatform.currentArchitecture
etc. to find out which native binaries we needVampire
01/11/2023, 2:46 PMI don't know about idiomaticI would guess no, for the class being an internal one 😄
Vampire
01/11/2023, 2:48 PMAnt
is a first-class citizen, I usually use org.apache.tools.ant.taskdefs.condition.Os
for similar things.
So for example if (Os.isArch(...))
and similarSomeCat
01/11/2023, 2:49 PMx86_64
even for ARM.
Maybe I just run uname -a
and get that information from there.Vampire
01/11/2023, 2:50 PMx86_64
SomeCat
01/11/2023, 2:51 PMMarkus Maier
01/11/2023, 2:56 PMSomeCat
01/11/2023, 2:59 PMMarkus Maier
01/11/2023, 3:07 PMMatthew Von-Maszewski
01/11/2023, 4:45 PM} else if (OS.contains("macosx")) {
OS = "macosx"
// determine architecture on the system for osx, we need to use uname since
// the system property may mislead us on osx
def architecture = new ByteArrayOutputStream()
exec {
commandLine "uname", "-v"
standardOutput = architecture
}
MacArch = architecture.toString()
println "Mac architecture: " + MacArch;
We have to use the above with our rented macincloud boxes because the M1 machines typically give us x86 emulated java instead of M1 java.Matthew Von-Maszewski
01/11/2023, 4:47 PMChris Lee
01/12/2023, 1:28 AMprivate val currentArchHolder = lazy {
when (val currentArch = System.getProperty("os.arch", "unknown").lowercase()) {
"amd64", "x86_64" -> Amd64
"arm64", "aarch64" -> Arm64
else -> error("Unknown arch: $currentArch")
}
}
Also not exhaustive for all possible JDK architectures. MacOS M1 returns aarch64 for os.arch.Vampire
01/12/2023, 7:36 AMos.arch
is also what the Os
class uses / returnsEric Haag
01/12/2023, 2:06 PM