You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by th...@apache.org on 2020/09/14 16:38:43 UTC
[lucene-solr] 25/39: Cleanup remaining scripts to use
script-relative resource location.
This is an automated email from the ASF dual-hosted git repository.
thelabdude pushed a commit to branch reference_impl_gradle_updates
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit ff33a6393dca2a212546a2323daad1e59e0e1738
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Mon Aug 31 15:35:14 2020 +0200
Cleanup remaining scripts to use script-relative resource location.
---
gradle/documentation/render-javadoc.gradle | 21 +++++++++++++--------
gradle/testing/defaults-tests.gradle | 3 ++-
gradle/testing/randomization.gradle | 8 +++++---
.../policies/replicator-tests.policy | 0
.../{ => randomization}/policies/solr-tests.policy | 0
.../{ => randomization}/policies/tests.policy | 0
gradle/validation/ecj-lint.gradle | 4 +++-
gradle/validation/forbidden-apis.gradle | 8 +++++---
gradle/validation/owasp-dependency-check.gradle | 4 +++-
9 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/gradle/documentation/render-javadoc.gradle b/gradle/documentation/render-javadoc.gradle
index 46bb867..57892c2 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) {
configurations {
@@ -47,17 +49,19 @@ allprojects {
description "Generates Javadoc API documentation for the main source code. This directly invokes javadoc tool."
group "documentation"
+ taskResources = resources
dependsOn sourceSets.main.compileClasspath
- classpath = sourceSets.main.compileClasspath;
+ classpath = sourceSets.main.compileClasspath
srcDirSet = 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 = resources
dependsOn sourceSets.main.compileClasspath
classpath = sourceSets.main.compileClasspath;
srcDirSet = sourceSets.main.java;
@@ -73,9 +77,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"
@@ -409,7 +413,10 @@ class RenderJavadocTask extends DefaultTask {
@Optional
@Input
def 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 = []
@@ -569,8 +576,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 css
ant.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.gradle
index 57b0c14..a277d32 100644
--- a/gradle/testing/defaults-tests.gradle
+++ b/gradle/testing/defaults-tests.gradle
@@ -20,6 +20,7 @@ import org.apache.tools.ant.types.Commandline
import org.gradle.api.tasks.testing.logging.*
import org.apache.lucene.gradle.ErrorReportingTestListener
+def resources = scriptResources(buildscript)
def verboseModeHookInstalled = false
allprojects {
@@ -108,7 +109,7 @@ allprojects {
ignoreFailures = resolvedTestOption("tests.haltonfailure").toBoolean() == false
- 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.gradle
index 570ff6a..298bfe1 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', commonSolrDir
systemProperty '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', commonDir
diff --git a/gradle/testing/policies/replicator-tests.policy b/gradle/testing/randomization/policies/replicator-tests.policy
similarity index 100%
rename from gradle/testing/policies/replicator-tests.policy
rename to gradle/testing/randomization/policies/replicator-tests.policy
diff --git a/gradle/testing/policies/solr-tests.policy b/gradle/testing/randomization/policies/solr-tests.policy
similarity index 100%
rename from gradle/testing/policies/solr-tests.policy
rename to gradle/testing/randomization/policies/solr-tests.policy
diff --git a/gradle/testing/policies/tests.policy b/gradle/testing/randomization/policies/tests.policy
similarity index 100%
rename from gradle/testing/policies/tests.policy
rename to gradle/testing/randomization/policies/tests.policy
diff --git a/gradle/validation/ecj-lint.gradle b/gradle/validation/ecj-lint.gradle
index 56bbd8d..3dcb2c0 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.gradle
index 8fe5199..f935386 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", {
@@ -38,7 +40,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)
@@ -73,7 +75,7 @@ allprojects { prj ->
]
signaturesFiles = files(
- rootProject.file("gradle/validation/forbidden-apis/defaults.tests.txt")
+ file("${resources}/defaults.tests.txt")
)
suppressAnnotations += [
@@ -127,7 +129,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 file
diff --git a/gradle/validation/owasp-dependency-check.gradle b/gradle/validation/owasp-dependency-check.gradle
index 4d300b8..d58fd8b 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 Integer
formats = ['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() {