Add photon.pb.h/PhotonVersion to cpp headers zip & create combined sources zip (#1335)

Combined sources zip is useful for robotpy to build both targeting & lib in the same build
This commit is contained in:
Matt
2024-06-09 17:18:57 -04:00
committed by GitHub
parent 7b19a951ca
commit 5289948b83
4 changed files with 121 additions and 14 deletions

View File

@@ -159,6 +159,7 @@ task generateVendorJson() {
}
build.mustRunAfter generateVendorJson
publish.mustRunAfter generateVendorJson
task writeCurrentVersion {
def versionFileIn = file("${rootDir}/shared/PhotonVersion.java.in")
@@ -216,3 +217,65 @@ model {
}
}
}
// Add photonversion to cpp sources zip
tasks.named('cppSourcesZip') {
dependsOn writeCurrentVersion
from("$projectDir/src/generate/native/cpp") {
into '/'
}
}
// Publish an uberzip with photon-lib and photon-targeting. This makes python binding easier to have it in one place
def zipBaseNameCombined = '_GROUP_org.photonvision_combinedcpp_ID_photonvision-combinedcpp_CLS'
task combinedCppSourcesZip(type: Zip) {
dependsOn(':photon-lib:cppSourcesZip', ':photon-targeting:cppSourcesZip')
mustRunAfter(':photon-lib:cppHeadersZip', ':photon-targeting:cppHeadersZip')
destinationDirectory = file("$buildDir/outputs")
archiveBaseName = zipBaseNameCombined
archiveClassifier = "sources"
// Include the contents of the photon-lib cppSourcesZip. Magic chatgpt nonsense
from(zipTree(project(':photon-lib').tasks.cppSourcesZip.archiveFile.get().asFile)) {
into 'photon-lib'
}
from(zipTree(project(':photon-targeting').tasks.cppSourcesZip.archiveFile.get().asFile)) {
into 'photon-targeting'
}
duplicatesStrategy = DuplicatesStrategy.FAIL
}
task combinedHeadersZip(type: Zip) {
dependsOn(':photon-lib:cppHeadersZip', ':photon-targeting:cppHeadersZip')
mustRunAfter(':photon-lib:cppHeadersZip', ':photon-targeting:cppHeadersZip')
destinationDirectory = file("$buildDir/outputs")
archiveBaseName = zipBaseNameCombined
archiveClassifier = "headers"
// Include the contents of the photon-lib cppHeadersZip. Magic chatgpt nonsense
from(zipTree(project(':photon-lib').tasks.cppHeadersZip.archiveFile.get().asFile)) {
into 'photon-lib'
}
from(zipTree(project(':photon-targeting').tasks.cppHeadersZip.archiveFile.get().asFile)) {
into 'photon-targeting'
}
duplicatesStrategy = DuplicatesStrategy.FAIL
}
// Add the uberzip to our maven publications
publishing {
publications {
combinedcpp(MavenPublication) {
artifact combinedCppSourcesZip
artifact combinedHeadersZip
artifactId = "${nativeName}-combinedcpp"
groupId artifactGroupId
version pubVersion
}
}
}