From 76dd2a88684ade93e33f474d5b9536f1da1242e9 Mon Sep 17 00:00:00 2001 From: Sriman Achanta <68172138+srimanachanta@users.noreply.github.com> Date: Wed, 22 Nov 2023 02:18:38 -0500 Subject: [PATCH] add generated headers in task config --- photon-lib/build.gradle | 48 +++++++++++++------------------- shared/javacpp/setupBuild.gradle | 3 ++ 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/photon-lib/build.gradle b/photon-lib/build.gradle index 99dd8daab0..099308f470 100644 --- a/photon-lib/build.gradle +++ b/photon-lib/build.gradle @@ -9,37 +9,14 @@ import java.nio.file.Path ext { nativeName = "photonlib" includePhotonTargeting = true + // Include the generated Version file + generatedHeaders = "src/generate/native/include" } apply from: "${rootDir}/shared/javacpp/setupBuild.gradle" apply from: "${rootDir}/versioningHelper.gradle" -model { - components { - all { - it.sources.each { - it.exportedHeaders { - srcDirs "src/main/native/include" - srcDirs "src/generate/native/include" - } - } - } - } - - // Publish the vendordep json - publishing { - publications { - vendorjson(MavenPublication) { - artifact vendorJson - - artifactId = "${nativeName}-json" - groupId = "org.photonvision" - version "1.0" - } - } - } -} - +// Include the version file in the distributed sources cppHeadersZip { from('src/generate/native/include') { into '/' @@ -49,8 +26,6 @@ cppHeadersZip { def photonlibFileInput = file("src/generate/photonlib.json.in") ext.photonlibFileOutput = file("$buildDir/generated/vendordeps/photonlib.json") -def vendorJson = artifacts.add('archives', file("$photonlibFileOutput")) - task generateVendorJson() { description = "Generates the vendor JSON file" group = "PhotonVision" @@ -85,3 +60,20 @@ task writeCurrentVersion { } build.mustRunAfter writeCurrentVersion + +def vendorJson = artifacts.add('archives', file("$photonlibFileOutput")) + +model { + // Publish the vendordep json + publishing { + publications { + vendorjson(MavenPublication) { + artifact vendorJson + + artifactId = "${nativeName}-json" + groupId = "org.photonvision" + version "1.0" + } + } + } +} diff --git a/shared/javacpp/setupBuild.gradle b/shared/javacpp/setupBuild.gradle index 8bc08d7565..66106c6057 100644 --- a/shared/javacpp/setupBuild.gradle +++ b/shared/javacpp/setupBuild.gradle @@ -43,6 +43,9 @@ model { } exportedHeaders { srcDirs 'src/main/native/include' + if (project.hasProperty('generatedHeaders')) { + srcDir generatedHeaders + } include "**/*.h" } }