From 8e06e2b3b555ccc2d1218595c77e28efc72b40c3 Mon Sep 17 00:00:00 2001 From: Stonedestroyer <1307729+Stonedestroyer@users.noreply.github.com> Date: Fri, 4 Jun 2021 03:18:35 +0200 Subject: [PATCH] Build script Change Revert "Remove check" This reverts commit 78c73067c61f270a9aa42a191b5a859f6b081b3b. logging test Test debug test test arm Update script Remove specific flags Push new test test print jdk --- build.gradle | 32 ++++++++++++++++++++++++++------ udp-queue-natives/build.gradle | 2 +- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 874bc4f..3e73184 100644 --- a/build.gradle +++ b/build.gradle @@ -21,20 +21,39 @@ import org.apache.tools.ant.taskdefs.condition.Os def getBuildParameters(base, bits) { def bitSuffix = (bits == 32) ? 'x86' : 'x86-64' + String bitProperty = System.getProperty("os.arch") + String mFlag = "-m" + String setupArg = "-DBITZ:STRING=" + // ARM inject + if(bitProperty == "arm") { + bitSuffix = "arm" + bits = "arm" + } else if (bitProperty == "aarch64") { + bitSuffix = "aarch64" + bits = "" + mFlag = "" + } + + if(!bits) { + setupArg = "" + } + + println "Your java home is " + System.getProperty("JAVA_HOME") + println "Secondary detection" + System.getProperty("java.home") if (Os.isFamily(Os.FAMILY_WINDOWS)) { return [ 'identifier': "win-${bitSuffix}", 'library': "${base}.dll", - 'setupArguments': ["-DBITZ:STRING=${bits}", '-A', (bits == 64 ? 'x64' : 'Win32')], + 'setupArguments': ["${setupArg}${bits}", '-A', (bits == 64 ? 'x64' : 'Win32')], 'buildArguments': ['--config', 'Release'], 'env': [:] ] } else if (Os.isFamily(Os.FAMILY_MAC)) { return [ - 'identifier': 'darwin', + 'identifier': "darwin-${bitProperty}", 'library': "lib${base}.dylib", - 'setupArguments': ["-DBITZ:STRING=${bits}"], + 'setupArguments': ["${setupArg}${bits}"], 'buildArguments': [], 'env': ['CXXFLAGS': "-m${bits}", 'CFLAGS': "-m${bits}", 'LDFLAGS': "-m${bits}"] ] @@ -42,16 +61,16 @@ def getBuildParameters(base, bits) { return [ 'identifier': "linux-${bitSuffix}", 'library': "lib${base}.so", - 'setupArguments': ["-DBITZ:STRING=${bits}"], + 'setupArguments': ["${setupArg}${bits}"], 'buildArguments': [], - 'env': ['CXXFLAGS': "-m${bits}", 'CFLAGS': "-m${bits}", 'LDFLAGS': "-m${bits}"] + 'env': ['CXXFLAGS': "${mFlag}${bits}", 'CFLAGS': "${mFlag}${bits}", 'LDFLAGS': "${mFlag}${bits}"] ] } } def getHomeDirectory() { def directory = file(System.getProperty('java.home')) - return directory.name == 'jre' ? directory.parentFile.absolutePath : directory.absolutePath + return directory.name == 'jre' || directory.name == 'jdk' ? directory.parentFile.absolutePath : directory.absolutePath } def createBuildTask(tasksHolder, config, bits) { @@ -61,6 +80,7 @@ def createBuildTask(tasksHolder, config, bits) { def deployDirectory = "${config.deployBase}/src/main/resources/natives/${parameters.identifier}" def taskBase = "${config.name}-${bits}" + println(System.getProperty("os.arch")) if (Os.isFamily(Os.FAMILY_MAC) && bits != 64) { return } diff --git a/udp-queue-natives/build.gradle b/udp-queue-natives/build.gradle index 65ffffa..221ac59 100644 --- a/udp-queue-natives/build.gradle +++ b/udp-queue-natives/build.gradle @@ -11,4 +11,4 @@ def buildTaskConfig = [ ] createBuildTask(tasks, buildTaskConfig, 32) -createBuildTask(tasks, buildTaskConfig, 64) +createBuildTask(tasks, buildTaskConfig, 64) \ No newline at end of file