Skip to content

Commit

Permalink
Build script
Browse files Browse the repository at this point in the history
Change


Revert "Remove check"

This reverts commit 78c7306.

logging


test


Test


debug

test

test

arm

Update script


Remove specific flags

Push


new test

test

print

jdk
  • Loading branch information
Stonedestroyer committed Jun 4, 2021
1 parent 69fe2e1 commit 8e06e2b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
32 changes: 26 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,56 @@ 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}"]
]
} else {
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) {
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion udp-queue-natives/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ def buildTaskConfig = [
]

createBuildTask(tasks, buildTaskConfig, 32)
createBuildTask(tasks, buildTaskConfig, 64)
createBuildTask(tasks, buildTaskConfig, 64)

0 comments on commit 8e06e2b

Please sign in to comment.