Skip to content

Commit

Permalink
Build photonlib json first
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Oct 15, 2023
1 parent 760de0f commit a125cf9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
13 changes: 6 additions & 7 deletions photon-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -147,7 +146,7 @@ task writeCurrentVersion {
versionString)
}

build.dependsOn writeCurrentVersion
build.mustRunAfter writeCurrentVersion

tasks.withType(Javadoc) {
options.encoding = 'UTF-8'
Expand Down
3 changes: 1 addition & 2 deletions photon-lib/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit a125cf9

Please sign in to comment.