diff --git a/docs/generation/gradle.properties b/docs/generation/gradle.properties index 81f40996a4..3ce9fb1cdf 100644 --- a/docs/generation/gradle.properties +++ b/docs/generation/gradle.properties @@ -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 diff --git a/docs/generation/gradle/validateSite.gradle b/docs/generation/gradle/validateSite.gradle index 25915018b8..e46d472bf5 100644 --- a/docs/generation/gradle/validateSite.gradle +++ b/docs/generation/gradle/validateSite.gradle @@ -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 @@ -91,6 +84,12 @@ 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 @@ -98,12 +97,10 @@ for (location in ["local", "remote"]) { 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 { @@ -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; } @@ -237,4 +234,8 @@ for (location in ["local", "remote"]) { } } } + + tasks.create(name: "validate${capitalizedLocation}Site") { + dependsOn validateHtmlFilesTask, validateHtmlLinksTask + } } diff --git a/docs/generation/gradle/wrapper/gradle-wrapper.properties b/docs/generation/gradle/wrapper/gradle-wrapper.properties index e750102e09..00e33edef6 100644 --- a/docs/generation/gradle/wrapper/gradle-wrapper.properties +++ b/docs/generation/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e750102e09..00e33edef6 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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