blob: 924bf179848ed0845ad6237fa9a490012430d7e0 [file] [log] [blame]
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 = 'hal'
def artifactGroupId = 'edu.wpi.first.hal'
def outputsFolder = file("$project.buildDir/outputs")
task cppSourcesZip(type: Zip) {
destinationDir = outputsFolder
baseName = 'hal'
classifier = "sources"
from(licenseFile) {
into '/'
}
from('src/main/native/athena') {
into '/athena'
}
from('src/main/native/sim') {
into '/sim'
}
from('src/main/native/shared') {
into '/shared'
}
}
task cppHeadersZip(type: Zip) {
destinationDir = outputsFolder
baseName = 'hal'
classifier = "headers"
from(licenseFile) {
into '/'
}
from('src/main/native/include') {
into '/'
}
}
build.dependsOn cppHeadersZip
build.dependsOn cppSourcesZip
model {
publishing {
def halAthenaTaskList = []
if (!project.hasProperty('skipAthena')) {
halAthenaTaskList = createComponentZipTasks($.components, 'halAthena', 'zipcpp', Zip, project, includeStandardZipFormat)
}
def halSimTaskList = []
if (!project.hasProperty('onlyAthena')) {
halSimTaskList = createComponentZipTasks($.components, 'halSim', 'zipcpp', Zip, project, includeStandardZipFormat)
}
def allTask
if (!project.hasProperty('jenkinsBuild')) {
def combinedList = []
halAthenaTaskList.each {
combinedList.add(it)
}
halSimTaskList.each {
combinedList.add(it)
}
allTask = createAllCombined(combinedList, 'hal', 'zipcpp', Zip, project)
}
def halSimStaticDepsTaskList = []
if (project.hasProperty('buildHalStaticDeps')) {
halSimStaticDepsTaskList = createComponentZipTasks($.components, 'halSimStaticDeps', 'zipcpp', Zip, project, includeStandardZipFormat)
if (!project.hasProperty('jenkinsBuild')) {
def staticAllTask = createAllCombined(halSimStaticDepsTaskList, 'halSimStaticDeps', 'zipcpp', Zip, project)
halSimStaticDepsTaskList.add(staticAllTask)
}
}
publications {
cpp(MavenPublication) {
halAthenaTaskList.each {
artifact it
}
halSimTaskList.each {
artifact it
}
if (!project.hasProperty('jenkinsBuild')) {
artifact allTask
}
artifact cppHeadersZip
artifact cppSourcesZip
artifactId = baseArtifactId
groupId artifactGroupId
version pubVersion
}
if (project.hasProperty('buildHalStaticDeps')) {
cppStaticDeps(MavenPublication) {
halSimStaticDepsTaskList.each {
artifact it
}
artifactId = baseArtifactId + 'StaticDeps'
groupId artifactGroupId
version pubVersion
}
}
}
}
}