New 2018 and later build setup (#1001)

This commit is contained in:
Thad House
2018-04-29 13:29:07 -07:00
committed by Peter Johnson
parent cb2c9eb6d5
commit 7f88cf768d
317 changed files with 60521 additions and 54781 deletions

View File

@@ -0,0 +1,98 @@
apply plugin: 'maven-publish'
apply plugin: 'edu.wpi.first.wpilib.versioning.WPILibVersioningPlugin'
if (!hasProperty('releaseType')) {
WPILibVersion {
releaseType = 'dev'
}
}
def pubVersion = ''
if (project.hasProperty("publishVersion")) {
pubVersion = project.publishVersion
} else {
pubVersion = WPILibVersion.version
}
def baseArtifactId = pluginName
def artifactGroupId = 'edu.wpi.first.halsim'
def zipBaseName = "_GROUP_edu_wpi_first_halsim_ID_${pluginName}_CLS"
def outputsFolder = file("$project.buildDir/outputs")
task cppSourcesZip(type: Zip) {
destinationDir = outputsFolder
baseName = zipBaseName
classifier = "sources"
from(licenseFile) {
into '/'
}
from('src/main/native/cpp') {
into '/'
}
}
task cppHeadersZip(type: Zip) {
destinationDir = outputsFolder
baseName = zipBaseName
classifier = "headers"
from(licenseFile) {
into '/'
}
from('src/main/native/include') {
into '/'
}
}
build.dependsOn cppSourcesZip
build.dependsOn cppHeadersZip
addTaskToCopyAllOutputs(cppSourcesZip)
addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def pluginTaskList = createComponentZipTasks($.components, pluginName, zipBaseName, Zip, project, { task, value ->
value.each { binary ->
if (binary.buildable) {
if (binary instanceof SharedLibraryBinarySpec) {
task.dependsOn binary.buildTask
task.from(binary.sharedLibraryFile) {
into getPlatformPath(binary) + '/shared'
}
}
}
}
})
def allTask
if (!project.hasProperty('jenkinsBuild')) {
allTask = createAllCombined(pluginTaskList, pluginName, zipBaseName, Zip, project)
}
publications {
cpp(MavenPublication) {
pluginTaskList.each {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifact cppSourcesZip
artifactId = baseArtifactId
groupId artifactGroupId
version pubVersion
}
}
}
}

View File

@@ -0,0 +1,95 @@
apply plugin: 'cpp'
apply plugin: 'edu.wpi.first.NativeUtils'
if (!project.hasProperty('onlyAthena')) {
ext.skipAthena = true
apply from: "${rootDir}/shared/config.gradle"
model {
components {
"${pluginName}"(NativeLibrarySpec) {
sources {
cpp {
source {
srcDirs = ['src/main/native/cpp']
includes = ["**/*.cpp"]
}
exportedHeaders {
srcDirs = ["src/main/native/include"]
}
}
}
binaries.all {
if (it instanceof StaticLibraryBinarySpec) {
it.buildable = false
return
}
lib project: ':hal', library: 'hal', linkage: 'shared'
if (project.hasProperty('includeNtCore')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
}
if (project.hasProperty('includeWpiutil')) {
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
}
}
"${pluginName}Dev"(NativeExecutableSpec) {
sources {
cpp {
source {
srcDirs = ['src/dev/native/cpp']
includes = ["**/*.cpp"]
}
exportedHeaders {
srcDirs = ["src/dev/native/include"]
}
}
}
binaries.all {
lib project: ':hal', library: 'hal', linkage: 'shared'
lib library: pluginName
if (project.hasProperty('includeNtCore')) {
lib project: ':ntcore', library: 'ntcore', linkage: 'shared'
}
lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared'
}
}
}
}
apply from: "${rootDir}/shared/plugins/publish.gradle"
}
model {
tasks {
def c = $.components
if (!project.hasProperty('onlyAthena')) {
project.tasks.create('runCpp', Exec) {
group = 'WPILib'
description = "Run the ${pluginName}Dev executable"
def found = false
def systemArch = getCurrentArch()
c.each {
if (it in NativeExecutableSpec && it.name == "${pluginName}Dev") {
it.binaries.each {
if (!found) {
def arch = it.targetPlatform.architecture.name
if (arch == systemArch) {
dependsOn it.tasks.install
commandLine it.tasks.install.runScriptFile.get().asFile.toString()
// it.tasks.install.libs.each { lib ->
// if (lib.name.contains(pluginName)) {
// def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib' + File.separatorChar + lib.name
// environment('HALSIM_EXTENSIONS', filePath)
// }
// }
found = true
}
}
}
}
}
}
}
}
}