mirror of https://github.com/apache/lucene.git
LUCENE-9505: add dummy outputs. (#1829)
This commit is contained in:
parent
2544df8f6d
commit
d31a42763b
|
@ -63,5 +63,17 @@ allprojects {
|
||||||
scriptResources = { buildscript ->
|
scriptResources = { buildscript ->
|
||||||
return file(buildscript.sourceFile.absolutePath.replaceAll('.gradle$', ""))
|
return file(buildscript.sourceFile.absolutePath.replaceAll('.gradle$', ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LUCENE-9505: utility function that sets up dummy outputs for a task so that
|
||||||
|
// clean[TaskName] works and allows selective re-runs.
|
||||||
|
setupDummyOutputs = { Task task ->
|
||||||
|
File dummyOutput = file("${task.project.buildDir}/tasks/${task.name}/dummy-output.txt")
|
||||||
|
task.outputs.file(dummyOutput)
|
||||||
|
task.doLast {
|
||||||
|
if (!dummyOutput.exists()) {
|
||||||
|
dummyOutput.createNewFile()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ allprojects {
|
||||||
def lintTasks = sourceSets.collect { sourceSet ->
|
def lintTasks = sourceSets.collect { sourceSet ->
|
||||||
def srcDirs = sourceSet.java.srcDirs.findAll { dir -> dir.exists() }
|
def srcDirs = sourceSet.java.srcDirs.findAll { dir -> dir.exists() }
|
||||||
|
|
||||||
tasks.create(sourceSet.getTaskName("ecjLint", null), JavaExec, {
|
tasks.create(sourceSet.getTaskName("ecjLint", null), JavaExec, {task ->
|
||||||
// This dependency is on a configuration; technically it causes
|
// This dependency is on a configuration; technically it causes
|
||||||
// all dependencies to be resolved before this task executes
|
// all dependencies to be resolved before this task executes
|
||||||
// (this includes scheduling tasks that compile the
|
// (this includes scheduling tasks that compile the
|
||||||
|
@ -46,8 +46,9 @@ allprojects {
|
||||||
|
|
||||||
// The inputs are all source files from the sourceSet.
|
// The inputs are all source files from the sourceSet.
|
||||||
inputs.files sourceSet.allSource.asFileTree
|
inputs.files sourceSet.allSource.asFileTree
|
||||||
// The outputs are always up to date (we don't generate anything).
|
|
||||||
outputs.upToDateWhen { true }
|
// This task has no proper outputs.
|
||||||
|
setupDummyOutputs(task)
|
||||||
|
|
||||||
// We create a task for all source sets but ignore those
|
// We create a task for all source sets but ignore those
|
||||||
// that don't have any Java source directories.
|
// that don't have any Java source directories.
|
||||||
|
|
|
@ -21,14 +21,16 @@ import java.nio.charset.StandardCharsets
|
||||||
// don't fork a daemon subprocess on the initial run.
|
// don't fork a daemon subprocess on the initial run.
|
||||||
|
|
||||||
configure(rootProject) {
|
configure(rootProject) {
|
||||||
task gradlewScriptsTweaked() {
|
task gradlewScriptsTweaked() { task ->
|
||||||
def scripts = [
|
def scripts = [
|
||||||
file("gradlew"),
|
file("gradlew"),
|
||||||
file("gradlew.bat")
|
file("gradlew.bat")
|
||||||
]
|
]
|
||||||
|
|
||||||
inputs.files(scripts)
|
inputs.files(scripts)
|
||||||
outputs.upToDateWhen { true }
|
|
||||||
|
// This task has no proper outputs.
|
||||||
|
setupDummyOutputs(task)
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
scripts.each { file ->
|
scripts.each { file ->
|
||||||
|
|
|
@ -36,10 +36,13 @@ import org.apache.tools.ant.BuildException
|
||||||
|
|
||||||
configure(subprojects.findAll { it.path.startsWith(':solr') }) {
|
configure(subprojects.findAll { it.path.startsWith(':solr') }) {
|
||||||
plugins.withType(JavaPlugin) {
|
plugins.withType(JavaPlugin) {
|
||||||
task validateLogCalls(type: ValidateLogCallsTask) {
|
task validateLogCalls(type: ValidateLogCallsTask) { task ->
|
||||||
description "Checks that log calls are either validated or conform to efficient patterns."
|
description "Checks that log calls are either validated or conform to efficient patterns."
|
||||||
group "verification"
|
group "verification"
|
||||||
|
|
||||||
|
// This task has no proper outputs.
|
||||||
|
setupDummyOutputs(task)
|
||||||
|
|
||||||
sourceFiles = files(sourceSets*.java)
|
sourceFiles = files(sourceSets*.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,11 +233,6 @@ class ValidateLogCallsTask extends DefaultTask {
|
||||||
@InputFiles
|
@InputFiles
|
||||||
FileCollection sourceFiles
|
FileCollection sourceFiles
|
||||||
|
|
||||||
ValidateLogCallsTask() {
|
|
||||||
// No explicit outputs (outputs always up to date).
|
|
||||||
outputs.upToDateWhen { true }
|
|
||||||
}
|
|
||||||
|
|
||||||
@TaskAction
|
@TaskAction
|
||||||
def checkLogLines() {
|
def checkLogLines() {
|
||||||
sourceFiles.each { checkFile(it) }
|
sourceFiles.each { checkFile(it) }
|
||||||
|
|
|
@ -30,10 +30,13 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
configure(rootProject) {
|
configure(rootProject) {
|
||||||
task("validateSourcePatterns", type: ValidateSourcePatternsTask) {
|
task("validateSourcePatterns", type: ValidateSourcePatternsTask) { task ->
|
||||||
group = 'Verification'
|
group = 'Verification'
|
||||||
description = 'Validate Source Patterns'
|
description = 'Validate Source Patterns'
|
||||||
|
|
||||||
|
// This task has no proper outputs.
|
||||||
|
setupDummyOutputs(task)
|
||||||
|
|
||||||
sourceFiles = project.fileTree(project.rootDir) {
|
sourceFiles = project.fileTree(project.rootDir) {
|
||||||
[
|
[
|
||||||
'java', 'jflex', 'py', 'pl', 'g4', 'jj', 'html', 'js',
|
'java', 'jflex', 'py', 'pl', 'g4', 'jj', 'html', 'js',
|
||||||
|
@ -68,11 +71,6 @@ configure(rootProject) {
|
||||||
|
|
||||||
class ValidateSourcePatternsTask extends DefaultTask {
|
class ValidateSourcePatternsTask extends DefaultTask {
|
||||||
|
|
||||||
ValidateSourcePatternsTask() {
|
|
||||||
// this task has no outputs, so it's always uptodate (if inputs don't change).
|
|
||||||
outputs.upToDateWhen { true }
|
|
||||||
}
|
|
||||||
|
|
||||||
@InputFiles
|
@InputFiles
|
||||||
ConfigurableFileTree sourceFiles
|
ConfigurableFileTree sourceFiles
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue