Files
PhotonVision/shared/javacpp/publish.gradle
Matt 655909cc84 Create combine job and offline vendordep ZIP (#1343)
* Create combine job

* Update build.yml

* Bump max workers in photonlib

* Oops

* actually kill entirely

* Maybe fix test

* Don't run tests

* Update OpenCVTest.java

* Update build.yml

* Use upload-artifact@v4

* Update build.yml

* Update build.yml
2024-06-10 20:37:01 -05:00

108 lines
2.8 KiB
Groovy

apply plugin: 'maven-publish'
def outputsFolder = file("$buildDir/outputs")
def baseArtifactId = nativeName
def artifactGroupId = 'org.photonvision'
def zipBaseName = "_GROUP_org_photonvision_${baseArtifactId}_ID_${baseArtifactId}-cpp_CLS"
// Quick hack to make this name visible to photon-lib for combined
ext.zipBaseName = zipBaseName
ext.artifactGroupId = artifactGroupId
def licenseFile = file("$rootDir/LICENCE")
task cppSourcesZip(type: Zip) {
destinationDirectory = outputsFolder
archiveBaseName = zipBaseName
archiveClassifier = "sources"
from(licenseFile) {
into '/'
}
from("$projectDir/src/main/native/cpp") {
into '/'
}
// assume we will always have proto sources
from("$buildDir/generated/source/proto/main/cpp") {
into '/'
// Only include generated C++ source files, not headers
include "**/*.cc", "**/*.cpp"
}
dependsOn generateProto
}
task cppHeadersZip(type: Zip) {
destinationDirectory = outputsFolder
archiveBaseName = zipBaseName
archiveClassifier = "headers"
from(licenseFile) {
into '/'
}
ext.includeDirs = [
project.file('src/main/native/include')
]
ext.includeDirs.each {
from(it) {
into '/'
}
}
// assume we will always have proto sources
from("$buildDir/generated/source/proto/main/cpp") {
into '/'
// Only include generated C++ headers
include "**/*.h"
}
dependsOn generateProto
}
artifacts {
archives cppHeadersZip
archives cppSourcesZip
}
addTaskToCopyAllOutputs(cppSourcesZip)
addTaskToCopyAllOutputs(cppHeadersZip)
model {
publishing {
def taskList = createComponentZipTasks($.components, [nativeName], zipBaseName, Zip, project, includeStandardZipFormat)
publications {
cpp(MavenPublication) {
taskList.each {
artifact it
}
artifact cppHeadersZip
artifact cppSourcesZip
artifactId = "${baseArtifactId}-cpp"
groupId artifactGroupId
version pubVersion
}
}
repositories {
maven {
// If we're trying to copy local outputs, just throw everything into build/maven
// The problem here is we can't specify which repo to publish to easily, so we have to choose one or the other
if (project.hasProperty('copyOfflineArtifacts')) {
url(localMavenURL)
} else {
url(photonMavenURL)
credentials {
username 'ghactions'
password System.getenv("ARTIFACTORY_API_KEY")
}
}
}
}
}
}