Cleanup remaining scripts to use script-relative resource location.

This commit is contained in:
Dawid Weiss 2020-08-31 15:35:14 +02:00
parent 66eb9f7f3d
commit 3e47bfb7b4
9 changed files with 31 additions and 17 deletions

View File

@ -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 = 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;
@ -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
@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 = []
@ -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 css
ant.concat(destfile: "${outputDir}/stylesheet.css", append: "true", fixlastline: "true", encoding: "UTF-8") {
filelist(dir: taskResources, files: "table_padding.css")

View File

@ -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 {
@ -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'

View File

@ -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

View File

@ -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()

View File

@ -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))
}
})
}

View File

@ -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() {