From 7f949627918bf6c348797d40971d034fe5757d63 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 15 Oct 2023 13:45:30 -0400 Subject: [PATCH] Build photonlib json first (#952) --- photon-lib/build.gradle | 13 ++++++------- photon-lib/publish.gradle | 3 +-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/photon-lib/build.gradle b/photon-lib/build.gradle index d7952394df..baae8fcc7d 100644 --- a/photon-lib/build.gradle +++ b/photon-lib/build.gradle @@ -120,23 +120,22 @@ task generateVendorJson() { outputs.file photonlibFileOutput inputs.file photonlibFileInput - doLast { - println "Writing version ${pubVersion} to $photonlibFileOutput" + println "Writing vendor JSON ${pubVersion} to $photonlibFileOutput" if (photonlibFileOutput.exists()) { photonlibFileOutput.delete() } + photonlibFileOutput.parentFile.mkdirs() + def read = photonlibFileInput.text .replace('${photon_version}', pubVersion) .replace('${frc_year}', frcYear) - photonlibFileOutput.write(read) - } + photonlibFileOutput.text = read outputs.upToDateWhen { false } } -build.dependsOn generateVendorJson - +build.mustRunAfter generateVendorJson task writeCurrentVersion { def versionFileIn = file("${rootDir}/shared/PhotonVersion.java.in") @@ -147,7 +146,7 @@ task writeCurrentVersion { versionString) } -build.dependsOn writeCurrentVersion +build.mustRunAfter writeCurrentVersion tasks.withType(Javadoc) { options.encoding = 'UTF-8' diff --git a/photon-lib/publish.gradle b/photon-lib/publish.gradle index 9967b24ee2..ca67c43b0e 100644 --- a/photon-lib/publish.gradle +++ b/photon-lib/publish.gradle @@ -198,8 +198,7 @@ model { } } -// So I don't actually know the _right_ way to tell gradle that the vendordep json publish requires generation first, so we're doing this -getTasksByName("publishVendorjsonPublicationToMavenLocal", false).each { +tasks.withType(PublishToMavenRepository) { it.mustRunAfter generateVendorJson }