2018-07-29 10:20:41 -07:00
|
|
|
import java.security.MessageDigest
|
2018-04-29 13:29:07 -07:00
|
|
|
apply plugin: 'maven-publish'
|
|
|
|
|
|
|
|
|
|
def outputsFolder = file("$buildDir/outputs")
|
|
|
|
|
|
|
|
|
|
def baseArtifactId = nativeName
|
2025-11-07 20:00:38 -05:00
|
|
|
def artifactGroupId = "org.wpilib.${nativeName}"
|
2026-04-27 14:46:11 -04:00
|
|
|
def zipBaseName = makeZipBaseName(artifactGroupId, "${baseArtifactId}-cpp")
|
2023-06-08 21:11:51 -07:00
|
|
|
ext.zipBaseName = zipBaseName
|
2026-04-27 14:46:11 -04:00
|
|
|
def jniCvStaticBaseName = makeZipBaseName(artifactGroupId, "${nativeName}-jnicvstatic")
|
2018-04-29 13:29:07 -07:00
|
|
|
|
2020-03-15 07:18:33 +02:00
|
|
|
def licenseFile = file("$rootDir/license.md")
|
2018-04-29 13:29:07 -07:00
|
|
|
|
|
|
|
|
task cppSourcesZip(type: Zip) {
|
2019-11-12 17:14:04 -08:00
|
|
|
destinationDirectory = outputsFolder
|
|
|
|
|
archiveBaseName = zipBaseName
|
2023-05-12 21:27:31 -07:00
|
|
|
archiveClassifier = "sources"
|
2018-04-29 13:29:07 -07:00
|
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
|
|
|
|
|
|
from(licenseFile) {
|
|
|
|
|
into '/'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
from('src/main/native/cpp') {
|
|
|
|
|
into '/'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
model {
|
|
|
|
|
components {
|
|
|
|
|
it.all {
|
|
|
|
|
if (it in getJniSpecClass()) {
|
|
|
|
|
it.jniHeaderLocations.each {
|
|
|
|
|
dependsOn it.key
|
|
|
|
|
from(it.value) {
|
|
|
|
|
into '/jni'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
task cppHeadersZip(type: Zip) {
|
2019-11-12 17:14:04 -08:00
|
|
|
destinationDirectory = outputsFolder
|
|
|
|
|
archiveBaseName = zipBaseName
|
2023-05-12 21:27:31 -07:00
|
|
|
archiveClassifier = "headers"
|
2018-04-29 13:29:07 -07:00
|
|
|
|
|
|
|
|
from(licenseFile) {
|
|
|
|
|
into '/'
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-12 22:17:39 -08:00
|
|
|
ext.includeDirs = [
|
|
|
|
|
project.file('src/main/native/include')
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
ext.includeDirs.each {
|
|
|
|
|
from(it) {
|
|
|
|
|
into '/'
|
|
|
|
|
}
|
2018-04-29 13:29:07 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
artifacts {
|
2025-09-22 10:58:14 -07:00
|
|
|
tasks.named("assemble") {
|
|
|
|
|
dependsOn(cppHeadersZip)
|
|
|
|
|
dependsOn(cppSourcesZip)
|
|
|
|
|
}
|
2018-04-29 13:29:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
addTaskToCopyAllOutputs(cppSourcesZip)
|
|
|
|
|
addTaskToCopyAllOutputs(cppHeadersZip)
|
|
|
|
|
|
|
|
|
|
model {
|
|
|
|
|
publishing {
|
2020-12-30 16:17:20 -08:00
|
|
|
def taskList = createComponentZipTasks($.components, [
|
|
|
|
|
nativeName,
|
|
|
|
|
"${nativeName}JNIShared"
|
|
|
|
|
], zipBaseName, Zip, project, includeStandardZipFormat)
|
2018-04-29 13:29:07 -07:00
|
|
|
|
|
|
|
|
publications {
|
|
|
|
|
cpp(MavenPublication) {
|
|
|
|
|
taskList.each {
|
|
|
|
|
artifact it
|
|
|
|
|
}
|
|
|
|
|
artifact cppHeadersZip
|
|
|
|
|
artifact cppSourcesZip
|
|
|
|
|
|
|
|
|
|
artifactId = "${baseArtifactId}-cpp"
|
2025-08-08 08:08:34 -07:00
|
|
|
groupId = artifactGroupId
|
|
|
|
|
version = wpilibVersioning.version.get()
|
2018-04-29 13:29:07 -07:00
|
|
|
}
|
|
|
|
|
}
|
2020-06-30 20:39:52 -07:00
|
|
|
|
|
|
|
|
if (project.hasProperty('cvStaticBuild') && project.getProperty('cvStaticBuild') == true) {
|
2020-06-30 22:50:02 -07:00
|
|
|
def jniCvTaskList = createComponentZipTasks($.components, ["${nativeName}JNICvStatic"], jniCvStaticBaseName, Zip, project, { task, value ->
|
2020-06-30 20:39:52 -07:00
|
|
|
value.each { binary ->
|
|
|
|
|
if (binary.buildable) {
|
|
|
|
|
if (binary instanceof SharedLibraryBinarySpec) {
|
|
|
|
|
task.dependsOn binary.tasks.link
|
|
|
|
|
task.inputs.file(binary.sharedLibraryFile)
|
|
|
|
|
task.from(binary.sharedLibraryFile) {
|
|
|
|
|
into nativeUtils.getPlatformPath(binary) + '/shared'
|
|
|
|
|
}
|
2020-07-05 22:11:42 -07:00
|
|
|
def sharedPath = binary.sharedLibraryFile.absolutePath
|
|
|
|
|
sharedPath = sharedPath.substring(0, sharedPath.length() - 4)
|
|
|
|
|
|
|
|
|
|
task.from(new File(sharedPath + '.pdb')) {
|
|
|
|
|
into nativeUtils.getPlatformPath(binary) + '/shared'
|
|
|
|
|
}
|
2020-06-30 20:39:52 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
publications {
|
|
|
|
|
jniCvStatic(MavenPublication) {
|
|
|
|
|
jniCvTaskList.each {
|
|
|
|
|
artifact it
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
artifactId = "${baseArtifactId}-jnicvstatic"
|
2025-08-08 08:08:34 -07:00
|
|
|
groupId = artifactGroupId
|
|
|
|
|
version = wpilibVersioning.version.get()
|
2020-06-30 20:39:52 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-04-29 13:29:07 -07:00
|
|
|
}
|
|
|
|
|
}
|