mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
This will allow dependencies such as wpilibc to update to use wpiutil without breaking "normal" ntcore static library use in the meantime. This commit also restructures the gradle files by creating a new (placeholder) wpiutil project, and moving the ntcore project into a separate gradle file. Added toolchains/native.gradle (refactored from ntcore). Also fixes ntcore skipJava on Windows by providing an alternate .def file for this case.
113 lines
3.0 KiB
Groovy
113 lines
3.0 KiB
Groovy
def wpiutilSetupModel = { project ->
|
|
project.model {
|
|
components {
|
|
wpiutil(NativeLibrarySpec) {
|
|
if (project.isArm) {
|
|
targetPlatform 'arm'
|
|
} else {
|
|
targetPlatform 'x86'
|
|
targetPlatform 'x64'
|
|
}
|
|
setupDefines(project, binaries)
|
|
|
|
sources {
|
|
cpp {
|
|
source {
|
|
srcDirs = ["${rootDir}/wpiutil/src"]
|
|
includes = ['**/*.cpp']
|
|
}
|
|
exportedHeaders {
|
|
srcDirs = ["${rootDir}/wpiutil/include"]
|
|
includes = ['**/*.h']
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
def wpiutilZipTask = { project ->
|
|
project.ext.wpiutilZip = project.tasks.create("${project.isArm ? 'arm' : 'native'}WpiutilZip", Zip) {
|
|
description = 'Creates platform-specific zip of the desktop wpiutil libraries.'
|
|
group = 'WPILib'
|
|
destinationDir = project.buildDir
|
|
baseName = 'wpiutil'
|
|
classifier = "${project.buildPlatform}"
|
|
|
|
from(file('wpiutil/include')) {
|
|
into 'include'
|
|
}
|
|
|
|
project.model {
|
|
binaries {
|
|
withType(StaticLibraryBinarySpec) { binary ->
|
|
from(binary.staticLibraryFile) {
|
|
into getPlatformPath(binary)
|
|
}
|
|
}
|
|
withType(SharedLibraryBinarySpec) { binary ->
|
|
from(binary.sharedLibraryFile) {
|
|
into getPlatformPath(binary)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
project.build.dependsOn project.wpiutilZip
|
|
|
|
def releaseTasks = [project.wpiutilZip]
|
|
|
|
project.releaseSetup(releaseTasks)
|
|
|
|
project.tasks.whenTaskAdded { task ->
|
|
def name = task.name.toLowerCase()
|
|
if (name.contains("wpiutilsharedlibrary") || name.contains("wpiutilstaticlibrary") || name.contains("wpiutiltest")) {
|
|
project.wpiutilZip.dependsOn task
|
|
}
|
|
}
|
|
}
|
|
|
|
if (buildArm) {
|
|
project(':arm:wpiutil') {
|
|
apply plugin: 'cpp'
|
|
|
|
apply from: "${rootDir}/toolchains/arm.gradle"
|
|
|
|
wpiutilSetupModel(project)
|
|
wpiutilZipTask(project)
|
|
}
|
|
}
|
|
|
|
project(':native:wpiutil') {
|
|
apply plugin: 'cpp'
|
|
task check
|
|
|
|
apply from: "${rootDir}/toolchains/native.gradle"
|
|
|
|
if (!project.hasProperty("withoutTests")) {
|
|
apply from: "${rootDir}/wpiutil/unittest/unittest.gradle"
|
|
}
|
|
|
|
wpiutilSetupModel(project)
|
|
wpiutilZipTask(project)
|
|
}
|
|
|
|
task wpiutilSourceZip(type: Zip) {
|
|
description = 'Creates a sources-zip of the wpiutil source files'
|
|
group = 'WPILib'
|
|
destinationDir = project.buildDir
|
|
baseName = 'wpiutil'
|
|
classifier = "sources"
|
|
|
|
from('wpiutil/src') {
|
|
into 'src'
|
|
}
|
|
|
|
from('wpiutil/include') {
|
|
into 'include'
|
|
}
|
|
}
|