From 311579746371580dbfd624e3df680e0edb4da31f Mon Sep 17 00:00:00 2001 From: Dawid Weiss Date: Tue, 30 Mar 2021 10:55:19 +0200 Subject: [PATCH] LUCENE-9871: clean up some old cruft and shuffle files around. Correct inputs/outputs on check broken links so that it's incremental. --- build.gradle | 16 ++--- .../check-broken-links.gradle | 34 ++++----- .../check-broken-links}/checkJavadocLinks.py | 0 .../local-settings.gradle} | 0 gradle/{defaults.gradle => globals.gradle} | 7 -- gradle/{ => java}/jar-manifest.gradle | 0 .../javac.gradle} | 0 .../defaults-maven.gradle | 0 .../distribution.gradle} | 0 .../{maven => publishing}/maven-local.gradle | 0 .../validate-source-patterns.gradle | 6 +- settings.gradle | 72 +++++++++---------- 12 files changed, 64 insertions(+), 71 deletions(-) rename gradle/{validation => documentation}/check-broken-links.gradle (76%) rename {dev-tools/scripts => gradle/documentation/check-broken-links}/checkJavadocLinks.py (100%) rename gradle/{generate-defaults.gradle => generation/local-settings.gradle} (100%) rename gradle/{defaults.gradle => globals.gradle} (93%) rename gradle/{ => java}/jar-manifest.gradle (100%) rename gradle/{defaults-java.gradle => java/javac.gradle} (100%) rename gradle/{maven => publishing}/defaults-maven.gradle (100%) rename gradle/{releasing.gradle => publishing/distribution.gradle} (100%) rename gradle/{maven => publishing}/maven-local.gradle (100%) diff --git a/build.gradle b/build.gradle index c3ffce9c0a6..cfd865324c2 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ plugins { id 'com.diffplug.spotless' version "5.8.2" apply false } -apply from: file('gradle/defaults.gradle') +apply from: file('gradle/globals.gradle') // General metadata. @@ -107,7 +107,7 @@ ext { // if the build file is incorrectly written and evaluates something // eagerly). -apply from: file('gradle/generate-defaults.gradle') +apply from: file('gradle/generation/local-settings.gradle') // Ant-compatibility layer: apply folder layout early so that // evaluation of other scripts doesn't need to be deferred. @@ -115,16 +115,16 @@ apply from: file('gradle/ant-compat/folder-layout.gradle') // Set up defaults and configure aspects for certain modules or functionality // (java, tests) -apply from: file('gradle/defaults-java.gradle') +apply from: file('gradle/java/javac.gradle') apply from: file('gradle/testing/defaults-tests.gradle') apply from: file('gradle/testing/randomization.gradle') apply from: file('gradle/testing/fail-on-no-tests.gradle') apply from: file('gradle/testing/alternative-jdk-support.gradle') -apply from: file('gradle/jar-manifest.gradle') +apply from: file('gradle/java/jar-manifest.gradle') // Publishing and releasing -apply from: file('gradle/maven/defaults-maven.gradle') -apply from: file('gradle/releasing.gradle') +apply from: file('gradle/publishing/defaults-maven.gradle') +apply from: file('gradle/publishing/distribution.gradle') // IDE support, settings and specials. apply from: file('gradle/ide/intellij-idea.gradle') @@ -143,7 +143,6 @@ apply from: file('gradle/validation/rat-sources.gradle') apply from: file('gradle/validation/owasp-dependency-check.gradle') apply from: file('gradle/validation/ecj-lint.gradle') apply from: file('gradle/validation/gradlew-scripts-tweaked.gradle') -apply from: file('gradle/validation/check-broken-links.gradle') apply from: file('gradle/validation/spotless.gradle') @@ -163,7 +162,7 @@ apply from: file('gradle/datasets/external-datasets.gradle') apply from: file('gradle/native/disable-native.gradle') // Additional development aids. -apply from: file('gradle/maven/maven-local.gradle') +apply from: file('gradle/publishing/maven-local.gradle') apply from: file('gradle/testing/per-project-summary.gradle') apply from: file('gradle/testing/slowest-tests-at-end.gradle') apply from: file('gradle/testing/failed-tests-at-end.gradle') @@ -181,6 +180,7 @@ apply from: file('gradle/documentation/documentation.gradle') apply from: file('gradle/documentation/changes-to-html.gradle') apply from: file('gradle/documentation/markdown.gradle') apply from: file('gradle/documentation/render-javadoc.gradle') +apply from: file('gradle/documentation/check-broken-links.gradle') apply from: file('gradle/hacks/gradle-archives.gradle') apply from: file('gradle/hacks/wipe-temp.gradle') diff --git a/gradle/validation/check-broken-links.gradle b/gradle/documentation/check-broken-links.gradle similarity index 76% rename from gradle/validation/check-broken-links.gradle rename to gradle/documentation/check-broken-links.gradle index aef8ce7a83b..79a08182e2a 100644 --- a/gradle/validation/check-broken-links.gradle +++ b/gradle/documentation/check-broken-links.gradle @@ -15,36 +15,38 @@ * limitations under the License. */ -configure(rootProject) { - task checkBrokenLinks { - group 'Verification' - description 'Check broken links in the entire documentation' - - dependsOn ':lucene:documentation:checkBrokenLinks' - } -} +def resources = scriptResources(buildscript) configure(project(':lucene:documentation')) { - task checkBrokenLinks(type: CheckBrokenLinksTask, 'dependsOn': 'documentation') + task checkBrokenLinks(type: CheckBrokenLinksTask) { + group 'Verification' + description 'Check broken links in the entire documentation' + dependsOn 'documentation' + + validationScript = file("${resources}/checkJavadocLinks.py") + docsDir.fileProvider(provider { -> file(project.docroot) }) + output = project.file("${buildDir}/check-broken-links-output.txt") + } + check.dependsOn checkBrokenLinks } class CheckBrokenLinksTask extends DefaultTask { - // wraps input directory location in DirectoryProperty so as to lazily evaluate 'docroot' property // (see gradle/documentation/documentation.gradle) @InputDirectory final DirectoryProperty docsDir = project.objects.directoryProperty() - .fileProvider(project.providers.provider { project.docroot }) @InputFile - File script = project.rootProject.file("dev-tools/scripts/checkJavadocLinks.py") + File validationScript + + @OutputFile + File output @TaskAction def check() { - def outputFile = project.file("${getTemporaryDir()}/check-broken-links-output.txt") def result - outputFile.withOutputStream { output -> + output.withOutputStream { output -> result = project.exec { executable project.externalTool("python3") ignoreExitValue = true @@ -52,14 +54,14 @@ class CheckBrokenLinksTask extends DefaultTask { errorOutput = output args = [ "-B", - script.absolutePath, + validationScript.absolutePath, docsDir.get().getAsFile() ] } } if (result.getExitValue() != 0) { - throw new GradleException("Broken links check failed. Command output at: ${outputFile}") + throw new GradleException("Broken links check failed. Command output at: ${output}") } } } diff --git a/dev-tools/scripts/checkJavadocLinks.py b/gradle/documentation/check-broken-links/checkJavadocLinks.py similarity index 100% rename from dev-tools/scripts/checkJavadocLinks.py rename to gradle/documentation/check-broken-links/checkJavadocLinks.py diff --git a/gradle/generate-defaults.gradle b/gradle/generation/local-settings.gradle similarity index 100% rename from gradle/generate-defaults.gradle rename to gradle/generation/local-settings.gradle diff --git a/gradle/defaults.gradle b/gradle/globals.gradle similarity index 93% rename from gradle/defaults.gradle rename to gradle/globals.gradle index 661a6c15db2..0ca1af1a60e 100644 --- a/gradle/defaults.gradle +++ b/gradle/globals.gradle @@ -23,13 +23,6 @@ allprojects { // Repositories to fetch dependencies from. repositories { mavenCentral() - - if (System.getProperty("skip.lucene") as Boolean) { - maven { - name "ApacheSnapshots" - url 'https://repository.apache.org/content/repositories/snapshots/' - } - } } // Artifacts will have names after full gradle project path diff --git a/gradle/jar-manifest.gradle b/gradle/java/jar-manifest.gradle similarity index 100% rename from gradle/jar-manifest.gradle rename to gradle/java/jar-manifest.gradle diff --git a/gradle/defaults-java.gradle b/gradle/java/javac.gradle similarity index 100% rename from gradle/defaults-java.gradle rename to gradle/java/javac.gradle diff --git a/gradle/maven/defaults-maven.gradle b/gradle/publishing/defaults-maven.gradle similarity index 100% rename from gradle/maven/defaults-maven.gradle rename to gradle/publishing/defaults-maven.gradle diff --git a/gradle/releasing.gradle b/gradle/publishing/distribution.gradle similarity index 100% rename from gradle/releasing.gradle rename to gradle/publishing/distribution.gradle diff --git a/gradle/maven/maven-local.gradle b/gradle/publishing/maven-local.gradle similarity index 100% rename from gradle/maven/maven-local.gradle rename to gradle/publishing/maven-local.gradle diff --git a/gradle/validation/validate-source-patterns.gradle b/gradle/validation/validate-source-patterns.gradle index e9939a1991f..9ac74e1c112 100644 --- a/gradle/validation/validate-source-patterns.gradle +++ b/gradle/validation/validate-source-patterns.gradle @@ -190,8 +190,8 @@ class ValidateSourcePatternsTask extends DefaultTask { def validSPINameJavadocTag = ~$/(?s)\s*\*\s*@lucene\.spi\s+\{@value #NAME\}/$; def isLicense = { matcher, ratDocument -> - licenseMatcher.reset(); - return lineSplitter.split(matcher.group(1)).any{ licenseMatcher.match(ratDocument, it) }; + licenseMatcher.reset() + return lineSplitter.split(matcher.group(1)).any { licenseMatcher.match(ratDocument, it) } } def checkLicenseHeaderPrecedes = { f, description, contentPattern, commentPattern, text, ratDocument -> @@ -213,7 +213,7 @@ class ValidateSourcePatternsTask extends DefaultTask { def checkMockitoAssume = { f, text -> if (text.contains("mockito") && !text.contains("assumeWorkingMockito()")) { - reportViolation(f, 'File uses Mockito but has no assumeWorkingMockito() call'); + reportViolation(f, 'File uses Mockito but has no assumeWorkingMockito() call') } } diff --git a/settings.gradle b/settings.gradle index 6e4d2a4c8df..bec1d7f7173 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,40 +19,38 @@ rootProject.name = "lucene-root" includeBuild("dev-tools/missing-doclet") -if (!(System.getProperty("skip.lucene") as Boolean)) { - include "lucene:analysis:common" - include "lucene:analysis:icu" - include "lucene:analysis:kuromoji" - include "lucene:analysis:morfologik" - include "lucene:analysis:nori" - include "lucene:analysis:opennlp" - include "lucene:analysis:phonetic" - include "lucene:analysis:smartcn" - include "lucene:analysis:stempel" - include "lucene:backward-codecs" - include "lucene:benchmark" - include "lucene:classification" - include "lucene:codecs" - include "lucene:core" - include "lucene:demo" - include "lucene:expressions" - include "lucene:facet" - include "lucene:grouping" - include "lucene:highlighter" - include "lucene:join" - include "lucene:luke" - include "lucene:memory" - include "lucene:misc" - include "lucene:misc:native" - include "lucene:monitor" - include "lucene:queries" - include "lucene:queryparser" - include "lucene:replicator" - include "lucene:sandbox" - include "lucene:spatial-extras" - include "lucene:spatial3d" - include "lucene:suggest" - include "lucene:test-framework" - include "lucene:documentation" - include "lucene:packaging" -} +include "lucene:analysis:common" +include "lucene:analysis:icu" +include "lucene:analysis:kuromoji" +include "lucene:analysis:morfologik" +include "lucene:analysis:nori" +include "lucene:analysis:opennlp" +include "lucene:analysis:phonetic" +include "lucene:analysis:smartcn" +include "lucene:analysis:stempel" +include "lucene:backward-codecs" +include "lucene:benchmark" +include "lucene:classification" +include "lucene:codecs" +include "lucene:core" +include "lucene:demo" +include "lucene:expressions" +include "lucene:facet" +include "lucene:grouping" +include "lucene:highlighter" +include "lucene:join" +include "lucene:luke" +include "lucene:memory" +include "lucene:misc" +include "lucene:misc:native" +include "lucene:monitor" +include "lucene:queries" +include "lucene:queryparser" +include "lucene:replicator" +include "lucene:sandbox" +include "lucene:spatial-extras" +include "lucene:spatial3d" +include "lucene:suggest" +include "lucene:test-framework" +include "lucene:documentation" +include "lucene:packaging"