mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
This check is unnecessary and is run during task creation, so prevents the .debug file from being included the first time gradle is run.
113 lines
3.1 KiB
Groovy
113 lines
3.1 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("wpiutilZip", Zip) {
|
|
description = 'Creates platform-specific zip of the desktop wpiutil libraries.'
|
|
group = 'WPILib'
|
|
destinationDir = project.buildDir
|
|
baseName = 'wpiutil'
|
|
classifier = "${project.buildPlatform}"
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
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)
|
|
}
|
|
from(new File(binary.sharedLibraryFile.absolutePath + ".debug")) {
|
|
into getPlatformPath(binary)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
project.debugStripSetup()
|
|
|
|
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'
|
|
|
|
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"
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
from('wpiutil/src') {
|
|
into 'src'
|
|
}
|
|
|
|
from('wpiutil/include') {
|
|
into 'include'
|
|
}
|
|
}
|