Apache Lucene open-source search software
Cleanup remaining scripts to use script-relative resource location.
Dawid Weiss3e47bfb7b433
diff --git a/gradle/documentation/render-javadoc.gradle b/gradle/documentation/render-javadoc.gradleindex 4d0ce2e4dcb..baae06665a5 100644--- a/gradle/documentation/render-javadoc.gradle+++ b/gradle/documentation/render-javadoc.gradle@@ -20,6 +20,8 @@ import javax.annotation.Nullable// generate javadocs by calling javadoc tool// see https://docs.oracle.com/en/java/javase/11/tools/javadoc.html+def resources = scriptResources(buildscript)+allprojects {plugins.withType(JavaPlugin) {ext {@@ -39,17 +41,19 @@ allprojects {description "Generates Javadoc API documentation for the main source code. This directly invokes javadoc tool."group "documentation"+ taskResources = resourcesdependsOn sourceSets.main.compileClasspath- classpath = sourceSets.main.compileClasspath;+ classpath = sourceSets.main.compileClasspathsrcDirSet = sourceSets.main.java;- outputDir = project.javadoc.destinationDir;+ outputDir = project.javadoc.destinationDir}task renderSiteJavadoc(type: RenderJavadocTask) {description "Generates Javadoc API documentation for the site (relative links)."group "documentation"+ taskResources = resourcesdependsOn sourceSets.main.compileClasspathclasspath = sourceSets.main.compileClasspath;srcDirSet = sourceSets.main.java;@@ -65,9 +69,9 @@ allprojects {// Set up titles and link up some offline docs for all documentation// (they may be unused but this doesn't do any harm).-def taskResources = "${rootProject.projectDir}/gradle/documentation/render-javadoc"-def javaJavadocPackages = rootProject.file("${taskResources}/java11/")-def junitJavadocPackages = rootProject.file("${taskResources}/junit/")++def javaJavadocPackages = rootProject.file("${resources}/java11/")+def junitJavadocPackages = rootProject.file("${resources}/junit/")allprojects {project.tasks.withType(RenderJavadocTask) {title = "${project.path.startsWith(':lucene') ? 'Lucene' : 'Solr'} ${project.version} ${project.name} API"@@ -158,7 +162,10 @@ class RenderJavadocTask extends DefaultTask {@Optional@Inputdef executable-++ @Input+ def taskResources+/** Utility method to recursively collect all tasks with same name like this one that we depend on */private Set findRenderTasksInDependencies() {Set found = []@@ -311,8 +318,6 @@ class RenderJavadocTask extends DefaultTask {throw new GradleException("Javadoc generation failed for ${project.path},\n Options file at: ${optionsFile}\n Command output at: ${outputFile}", cause)}- def taskResources = "${project.rootDir}/gradle/documentation/render-javadoc"-// append some special table css, prettify cssant.concat(destfile: "${outputDir}/stylesheet.css", append: "true", fixlastline: "true", encoding: "UTF-8") {filelist(dir: taskResources, files: "table_padding.css")diff --git a/gradle/testing/defaults-tests.gradle b/gradle/testing/defaults-tests.gradleindex 83d4735f0c1..2ceb436d76b 100644--- a/gradle/testing/defaults-tests.gradle+++ b/gradle/testing/defaults-tests.gradle@@ -20,6 +20,7 @@ import org.apache.tools.ant.types.Commandlineimport org.gradle.api.tasks.testing.logging.*import org.apache.lucene.gradle.ErrorReportingTestListener+def resources = scriptResources(buildscript)def verboseModeHookInstalled = falseallprojects {@@ -105,7 +106,7 @@ allprojects {jvmArgs Commandline.translateCommandline(resolvedTestOption("tests.jvmargs"))- systemProperty 'java.util.logging.config.file', rootProject.file("gradle/testing/defaults-tests/logging.properties")+ systemProperty 'java.util.logging.config.file', file("${resources}/logging.properties")systemProperty 'java.awt.headless', 'true'systemProperty 'jdk.map.althashing.threshold', '0'diff --git a/gradle/testing/randomization.gradle b/gradle/testing/randomization.gradleindex 570ff6aaa9f..298bfe13e0c 100644--- a/gradle/testing/randomization.gradle+++ b/gradle/testing/randomization.gradle@@ -33,6 +33,8 @@ buildscript {}}+def resources = scriptResources(buildscript)+// Pick the "root" seed from which everything else is derived.configure(rootProject) {ext {@@ -182,14 +184,14 @@ allprojects {if (Boolean.parseBoolean(testOptionsResolved["tests.useSecurityManager"])) {if (project.path == ":lucene:replicator") {systemProperty 'java.security.manager', "org.apache.lucene.util.TestSecurityManager"- systemProperty 'java.security.policy', rootProject.file("gradle/testing/policies/replicator-tests.policy")+ systemProperty 'java.security.policy', file("${resources}/policies/replicator-tests.policy")} else if (project.path.startsWith(":lucene")) {systemProperty 'java.security.manager', "org.apache.lucene.util.TestSecurityManager"- systemProperty 'java.security.policy', rootProject.file("gradle/testing/policies/tests.policy")+ systemProperty 'java.security.policy', file("${resources}/policies/tests.policy")} else {systemProperty 'common-solr.dir', commonSolrDirsystemProperty 'java.security.manager', "org.apache.lucene.util.TestSecurityManager"- systemProperty 'java.security.policy', rootProject.file("gradle/testing/policies/solr-tests.policy")+ systemProperty 'java.security.policy', file("${resources}/policies/solr-tests.policy")}systemProperty 'common.dir', commonDirdiff --git a/gradle/testing/policies/replicator-tests.policy b/gradle/testing/randomization/policies/replicator-tests.policysimilarity index 100%rename from gradle/testing/policies/replicator-tests.policyrename to gradle/testing/randomization/policies/replicator-tests.policydiff --git a/gradle/testing/policies/solr-tests.policy b/gradle/testing/randomization/policies/solr-tests.policysimilarity index 100%rename from gradle/testing/policies/solr-tests.policyrename to gradle/testing/randomization/policies/solr-tests.policydiff --git a/gradle/testing/policies/tests.policy b/gradle/testing/randomization/policies/tests.policysimilarity index 100%rename from gradle/testing/policies/tests.policyrename to gradle/testing/randomization/policies/tests.policydiff --git a/gradle/validation/ecj-lint.gradle b/gradle/validation/ecj-lint.gradleindex 56bbd8db1d1..3dcb2c00669 100644--- a/gradle/validation/ecj-lint.gradle+++ b/gradle/validation/ecj-lint.gradle@@ -27,6 +27,8 @@ configure(rootProject) {}}+def resources = scriptResources(buildscript)+allprojects {plugins.withType(JavaPlugin) {// Create a [sourceSetName]EcjLint task for each source set@@ -69,7 +71,7 @@ allprojects {args += [ "-proc:none" ]args += [ "-nowarn" ]args += [ "-enableJavadoc" ]- args += [ "-properties", rootProject.file("gradle/validation/ecj-lint/ecj.javadocs.prefs").absolutePath ]+ args += [ "-properties", file("${resources}/ecj.javadocs.prefs").absolutePath ]doFirst {tmpDst.mkdirs()diff --git a/gradle/validation/forbidden-apis.gradle b/gradle/validation/forbidden-apis.gradleindex 5237570dfc9..4767d0fe3de 100644--- a/gradle/validation/forbidden-apis.gradle+++ b/gradle/validation/forbidden-apis.gradle@@ -18,6 +18,8 @@// This configures application of forbidden API rules// via https://github.com/policeman-tools/forbidden-apis+def resources = scriptResources(buildscript)+// Only apply forbidden-apis to java projects.allprojects { prj ->plugins.withId("java", {@@ -39,7 +41,7 @@ allprojects { prj ->deps += ["defaults.all.txt", "defaults.${suffix}.txt"]deps.each { sig ->- def signaturesFile = rootProject.file("gradle/validation/forbidden-apis/${sig}")+ def signaturesFile = file("${resources}/${sig}")if (signaturesFile.exists()) {logger.info("Signature file applied: ${sig}")signaturesFiles += files(signaturesFile)@@ -79,7 +81,7 @@ allprojects { prj ->]signaturesFiles = files(- rootProject.file("gradle/validation/forbidden-apis/defaults.tests.txt")+ file("${resources}/defaults.tests.txt"))suppressAnnotations += [@@ -133,7 +135,7 @@ allprojects { prj ->// This is the simplest workaround possible: just point at all the rule files and indicate// them as inputs. This way if a rule is modified, checks will be reapplied.configure([forbiddenApisMain, forbiddenApisTest]) { task ->- task.inputs.dir(rootProject.file("gradle/validation/forbidden-apis"))+ task.inputs.dir(file(resources))}})}\ No newline at end of filediff --git a/gradle/validation/owasp-dependency-check.gradle b/gradle/validation/owasp-dependency-check.gradleindex 4d300b85c94..d58fd8bfd10 100644--- a/gradle/validation/owasp-dependency-check.gradle+++ b/gradle/validation/owasp-dependency-check.gradle@@ -20,13 +20,15 @@// If -Pvalidation.owasp=true is set the validation will also run as part of the check task.+def resources = scriptResources(buildscript)+configure(rootProject) {dependencyCheck {failBuildOnCVSS = propertyOrDefault("validation.owasp.threshold", 7) as Integerformats = ['HTML', 'JSON']skipProjects = [':solr:solr-ref-guide']skipConfigurations = ['unifiedClasspath']- suppressionFile = rootProject.file('gradle/validation/owasp-dependency-check/exclusions.xml')+ suppressionFile = file("${resources}/exclusions.xml")}task owasp() {