mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-21 01:01:43 +00:00
Gradle needs to produce a platform path of "Linux/i386" when targeting a Linux 32-bit Intel platform. Otherwise, it doesn't match Java's os.name/os.arch when loading the ntcore library in NetworkTablesJNI.java. Windows uses "x86" but Linux uses "i386". (http://lopica.sourceforge.net/os.html)
75 lines
2.2 KiB
Groovy
75 lines
2.2 KiB
Groovy
import org.gradle.internal.os.OperatingSystem
|
|
|
|
buildscript {
|
|
repositories {
|
|
maven {
|
|
url "https://plugins.gradle.org/m2/"
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.8'
|
|
classpath 'gradle.plugin.edu.wpi.first.wpilib.versioning:wpilib-version-plugin:1.6'
|
|
}
|
|
}
|
|
|
|
ext.buildArm = !project.hasProperty('skipArm')
|
|
ext.includeJava = !project.hasProperty('skipJava')
|
|
|
|
if (hasProperty('makeDesktop')) {
|
|
println 'Making desktop classifier jar. NOTE: This desktop version should only be used for local testing.' +
|
|
'It will only support the current platform, and will override fetching the latest development version from' +
|
|
' the maven repo until you manually delete it!'
|
|
}
|
|
|
|
ext.getPlatformPath = { binary ->
|
|
if (binary.targetPlatform.architecture.arm) {
|
|
return 'Linux/arm'
|
|
} else if (binary.targetPlatform.operatingSystem.linux) {
|
|
if (binary.targetPlatform.architecture.amd64) {
|
|
return 'Linux/amd64'
|
|
} else {
|
|
return 'Linux/i386'
|
|
}
|
|
} else if (binary.targetPlatform.operatingSystem.windows) {
|
|
if (binary.targetPlatform.architecture.amd64) {
|
|
return 'Windows/amd64'
|
|
} else {
|
|
return 'Windows/' + binary.targetPlatform.architecture.name
|
|
}
|
|
} else if (binary.targetPlatform.operatingSystem.macOsX) {
|
|
if (binary.targetPlatform.architecture.amd64) {
|
|
return 'Mac OS X/x86_64'
|
|
} else {
|
|
return 'Mac OS X/' + binary.targetPlatform.architecture.name
|
|
}
|
|
} else {
|
|
return binary.targetPlatform.operatingSystem.name + '/' + binary.targetPlatform.architecture.name
|
|
}
|
|
}
|
|
|
|
ext.setupDefines = { project, binaries ->
|
|
binaries.all {
|
|
if (project.hasProperty('debug')) {
|
|
project.setupDebugDefines(cppCompiler, linker)
|
|
} else {
|
|
project.setupReleaseDefines(cppCompiler, linker)
|
|
}
|
|
}
|
|
}
|
|
|
|
apply from: "ntcore.gradle"
|
|
apply from: "wpiutil.gradle"
|
|
|
|
// Empty task for build so that ntcoreSourceZip and wpiutilSourceZip will be
|
|
// built when running ./gradlew build
|
|
task build
|
|
|
|
build.dependsOn ntcoreSourceZip
|
|
build.dependsOn wpiutilSourceZip
|
|
|
|
apply from: 'publish.gradle'
|
|
|
|
task wrapper(type: Wrapper) {
|
|
gradleVersion = '3.3'
|
|
}
|