mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
83 lines
1.9 KiB
Groovy
83 lines
1.9 KiB
Groovy
apply plugin: 'maven-publish'
|
|
|
|
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 nativeUtils.getPlatformPath(binary) + '/shared'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
publications {
|
|
cpp(MavenPublication) {
|
|
pluginTaskList.each {
|
|
artifact it
|
|
}
|
|
|
|
artifact cppHeadersZip
|
|
artifact cppSourcesZip
|
|
|
|
|
|
artifactId = baseArtifactId
|
|
groupId artifactGroupId
|
|
version pubVersion
|
|
}
|
|
}
|
|
}
|
|
}
|