mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Gradle publishing does not capture all of the source files that are used during a build. This should get most of them, and get it equivalent to what bazel pushes out.
78 lines
1.7 KiB
Groovy
78 lines
1.7 KiB
Groovy
apply plugin: 'maven-publish'
|
|
|
|
def baseArtifactId = 'wpilibc-cpp'
|
|
def artifactGroupId = 'edu.wpi.first.wpilibc'
|
|
def zipBaseName = '_GROUP_edu_wpi_first_wpilibc_ID_wpilibc-cpp_CLS'
|
|
|
|
def outputsFolder = file("$project.buildDir/outputs")
|
|
|
|
task cppSourcesZip(type: Zip) {
|
|
destinationDirectory = outputsFolder
|
|
archiveBaseName = zipBaseName
|
|
archiveClassifier = "sources"
|
|
|
|
from(licenseFile) {
|
|
into '/'
|
|
}
|
|
|
|
from('src/main/native/cpp') {
|
|
into '/'
|
|
}
|
|
from("$buildDir/generated/cpp") {
|
|
into '/'
|
|
}
|
|
from("src/generated/main/native/cpp") {
|
|
into '/'
|
|
}
|
|
}
|
|
|
|
cppSourcesZip.dependsOn generateCppVersion
|
|
|
|
task cppHeadersZip(type: Zip) {
|
|
destinationDirectory = outputsFolder
|
|
archiveBaseName = zipBaseName
|
|
archiveClassifier = "headers"
|
|
|
|
from(licenseFile) {
|
|
into '/'
|
|
}
|
|
|
|
ext.includeDirs = [
|
|
project.file('src/main/native/include'),
|
|
project.file('src/generated/main/native/include')
|
|
]
|
|
|
|
ext.includeDirs.each {
|
|
from(it) {
|
|
into '/'
|
|
}
|
|
}
|
|
}
|
|
|
|
build.dependsOn cppHeadersZip
|
|
build.dependsOn cppSourcesZip
|
|
|
|
addTaskToCopyAllOutputs(cppHeadersZip)
|
|
addTaskToCopyAllOutputs(cppSourcesZip)
|
|
|
|
model {
|
|
publishing {
|
|
def wpilibCTaskList = createComponentZipTasks($.components, ['wpilibc'], zipBaseName, Zip, project, includeStandardZipFormat)
|
|
|
|
publications {
|
|
cpp(MavenPublication) {
|
|
wpilibCTaskList.each {
|
|
artifact it
|
|
}
|
|
|
|
artifact cppHeadersZip
|
|
artifact cppSourcesZip
|
|
|
|
artifactId = baseArtifactId
|
|
groupId artifactGroupId
|
|
version wpilibVersioning.version.get()
|
|
}
|
|
}
|
|
}
|
|
}
|