Skip to content

Commit

Permalink
Update gradlew 7.3 -> 7.4.1 (#2163)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scottmitch authored Mar 25, 2022
1 parent 6f0c43a commit 1d3607a
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 41 deletions.
4 changes: 2 additions & 2 deletions docs/generation/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
org.gradle.parallel=true

antoraVersion=2.3.4
jsoupVersion=1.13.1
jsoupVersion=1.14.3
nodeVersion=14.16.0
nodePluginVersion=3.0.1
nodePluginVersion=3.2.1
nuValidatorVersion=20.7.2
75 changes: 38 additions & 37 deletions docs/generation/gradle/validateSite.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,35 @@ dependencies {
}
}

for (location in ["local", "remote"]) {
def capitalizedLocation = location.capitalize()
def buildSiteTask = "build${capitalizedLocation}Site"
def validateSiteTask = "validate${capitalizedLocation}Site"
def validateHtmlFilesTask = "validate${capitalizedLocation}HtmlFiles"
def configureValidateHtmlFilesTask = "configureValidate${capitalizedLocation}HtmlFiles"
def validateHtmlLinksTask = "validate${capitalizedLocation}HtmlLinks"

def htmlFiles
def getHtmlFiles(def location) {
if (location == "local") {
htmlFiles = fileTree("$buildDir/$location").matching {
include "**/*.html"
}
return fileTree("$buildDir/$location").matching {
include "**/*.html"
}
} else {
// only check the currently generated docs, ignore legacy docs
htmlFiles = fileTree("$buildDir/$location").matching {
include "**/SNAPSHOT/*.html"
}
}

task(validateSiteTask) {
dependsOn validateHtmlFilesTask, validateHtmlLinksTask
}

task(configureValidateHtmlFilesTask) {
doLast {
tasks[validateHtmlFilesTask].args htmlFiles
// only check the currently generated docs, ignore legacy docs
return fileTree("$buildDir/$location").matching {
include "**/SNAPSHOT/*.html"
}
}
}

task(validateHtmlFilesTask, type: JavaExec) {
dependsOn(configureValidateHtmlFilesTask, buildSiteTask)

def outputFile = file("$buildDir/report/validateHtmlFiles/result.txt")
for (location in ["local", "remote"]) {
def capitalizedLocation = location.capitalize()
def buildSiteTask = tasks.getByPath("build${capitalizedLocation}Site")

def filterSiteHtmlFilesTask = tasks.create(name: "filter${capitalizedLocation}Site") {
dependsOn buildSiteTask
inputs.dir buildSiteTask.outputs.files.files.first()
outputs.files location == "local" ?
inputs.files.asFileTree.matching { include "**/*.html" } :
inputs.files.asFileTree.matching { include "**/SNAPSHOT/*.html" }
}

inputs.files htmlFiles
def validateHtmlFilesTask = tasks.create(name: "validate${capitalizedLocation}HtmlFiles", type: JavaExec) {
def outputFile = file("$buildDir/$location/report/validateHtmlFiles/result.txt")
dependsOn filterSiteHtmlFilesTask
// inputs.files contains jar files because of task type JavaExec, don't add filterSiteHtmlFilesTask.outputs.
outputs.file outputFile

classpath = configurations.nuValidator
Expand All @@ -91,19 +84,23 @@ for (location in ["local", "remote"]) {
// for debugging
// args "--verbose"

// Before execution we need to add the arguments that specify the files to check. Do this in a doFirst block
// so filterSiteHtmlFilesTask.outputs has been resolved, otherwise we may race and not have any value.
doFirst {
args filterSiteHtmlFilesTask.outputs.files.stream().map(f -> f.getAbsolutePath()).toList()
}

// write a basic result file s.t. gradle can consider task up-to-date
// writing a result file in case validation fails is not easily possible with JavaExec,
// but also not strictly necessary
doFirst { delete(outputFile) }
doLast { outputFile.text = "Success." }
}

task(validateHtmlLinksTask) {
dependsOn(buildSiteTask)

def outputDir = file("$buildDir/report/validateHtmlLinks")

inputs.files htmlFiles
def validateHtmlLinksTask = tasks.create(name: "validate${capitalizedLocation}HtmlLinks") {
def outputDir = file("$buildDir/$location/report/validateHtmlLinks")
dependsOn filterSiteHtmlFilesTask
inputs.files filterSiteHtmlFilesTask.outputs.files
outputs.dir outputDir

doLast {
Expand All @@ -113,7 +110,7 @@ for (location in ["local", "remote"]) {

try {
// only validate links of latest version because we can't fix links of older versions
for (htmlFile in htmlFiles) {
for (htmlFile in inputs.files) {
if (htmlFile.toString().endsWith("404.html")) {
continue;
}
Expand Down Expand Up @@ -237,4 +234,8 @@ for (location in ["local", "remote"]) {
}
}
}

tasks.create(name: "validate${capitalizedLocation}Site") {
dependsOn validateHtmlFilesTask, validateHtmlLinksTask
}
}
2 changes: 1 addition & 1 deletion docs/generation/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 1d3607a

Please sign in to comment.