You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/30 18:16:08 UTC
[lucene] branch main updated: LUCENE-9871: move dummy outputs
aspect into a separate file.
This is an automated email from the ASF dual-hosted git repository.
dweiss pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 32e891c LUCENE-9871: move dummy outputs aspect into a separate file.
32e891c is described below
commit 32e891c60fd5cb1c045716fb3cdfff743d4e0d5c
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Tue Mar 30 20:15:55 2021 +0200
LUCENE-9871: move dummy outputs aspect into a separate file.
---
build.gradle | 1 +
gradle/globals.gradle | 12 ------
.../dummy-outputs.gradle} | 43 ++++++++++------------
gradle/validation/ecj-lint.gradle | 3 --
gradle/validation/gradlew-scripts-tweaked.gradle | 3 --
gradle/validation/validate-source-patterns.gradle | 6 ---
6 files changed, 20 insertions(+), 48 deletions(-)
diff --git a/build.gradle b/build.gradle
index e50b1b7..648c419 100644
--- a/build.gradle
+++ b/build.gradle
@@ -177,3 +177,4 @@ apply from: file('gradle/hacks/gradle-archives.gradle')
apply from: file('gradle/hacks/wipe-temp.gradle')
apply from: file('gradle/hacks/hashmapAssertions.gradle')
apply from: file('gradle/hacks/turbocharge-jvm-opts.gradle')
+apply from: file('gradle/hacks/dummy-outputs.gradle')
diff --git a/gradle/globals.gradle b/gradle/globals.gradle
index fbcbb2d..66b1660 100644
--- a/gradle/globals.gradle
+++ b/gradle/globals.gradle
@@ -61,18 +61,6 @@ allprojects {
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()
- }
- }
- }
-
// Utility function similar to project.exec but not emitting
// any output unless an error code is returned from the executed command.
quietExec = { closure ->
diff --git a/gradle/validation/gradlew-scripts-tweaked.gradle b/gradle/hacks/dummy-outputs.gradle
similarity index 51%
copy from gradle/validation/gradlew-scripts-tweaked.gradle
copy to gradle/hacks/dummy-outputs.gradle
index fa3ba6d..1d9a154 100644
--- a/gradle/validation/gradlew-scripts-tweaked.gradle
+++ b/gradle/hacks/dummy-outputs.gradle
@@ -1,5 +1,3 @@
-import java.nio.charset.StandardCharsets
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -17,30 +15,27 @@ import java.nio.charset.StandardCharsets
* limitations under the License.
*/
-// This ensures 'gradlew*' scripts contain the manual fix so that they
-// don't fork a daemon subprocess on the initial run.
-
-configure(rootProject) {
- task gradlewScriptsTweaked() { task ->
- def scripts = [
- file("gradlew"),
- file("gradlew.bat")
- ]
-
- inputs.files(scripts)
-
- // This task has no proper outputs.
- setupDummyOutputs(task)
+// LUCENE-9505: utility function that sets up dummy outputs for a task so that
+// clean[TaskName] works and allows selective re-runs.
- doFirst {
- scripts.each { file ->
- def content = new String(file.readBytes(), StandardCharsets.US_ASCII)
- if (content.indexOf("Don't fork a daemon mode on initial run that generates local defaults") < 0) {
- throw new GradleException("Launch script ${file} does not have a manual daemon tweak (see LUCENE-9232).")
- }
- }
+def 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()
}
}
+}
- check.dependsOn gradlewScriptsTweaked
+allprojects {
+ tasks.matching {
+ it.name.startsWith("ecjLint") ||
+ it.name in [
+ "gradlewScriptsTweaked",
+ "validateSourcePatterns"
+ ] }.all { Task task ->
+ task.logger.info("Setting up ${task.path} as no-output.")
+ setupDummyOutputs(task)
+ }
}
diff --git a/gradle/validation/ecj-lint.gradle b/gradle/validation/ecj-lint.gradle
index 7b64157..8c72f9d 100644
--- a/gradle/validation/ecj-lint.gradle
+++ b/gradle/validation/ecj-lint.gradle
@@ -47,9 +47,6 @@ allprojects {
// The inputs are all source files from the sourceSet.
inputs.files sourceSet.allSource.asFileTree
- // This task has no proper outputs.
- setupDummyOutputs(task)
-
// We create a task for all source sets but ignore those
// that don't have any Java source directories.
enabled = !srcDirs.isEmpty()
diff --git a/gradle/validation/gradlew-scripts-tweaked.gradle b/gradle/validation/gradlew-scripts-tweaked.gradle
index fa3ba6d..a37d4e5 100644
--- a/gradle/validation/gradlew-scripts-tweaked.gradle
+++ b/gradle/validation/gradlew-scripts-tweaked.gradle
@@ -29,9 +29,6 @@ configure(rootProject) {
inputs.files(scripts)
- // This task has no proper outputs.
- setupDummyOutputs(task)
-
doFirst {
scripts.each { file ->
def content = new String(file.readBytes(), StandardCharsets.US_ASCII)
diff --git a/gradle/validation/validate-source-patterns.gradle b/gradle/validation/validate-source-patterns.gradle
index 9ac74e1..389ca74 100644
--- a/gradle/validation/validate-source-patterns.gradle
+++ b/gradle/validation/validate-source-patterns.gradle
@@ -66,9 +66,6 @@ subprojects {
group = 'Verification'
description = 'Validate Source Patterns'
- // This task has no proper outputs.
- setupDummyOutputs(task)
-
sourceFiles = fileTree(projectDir) {
extensions.each{
include "**/*.${it}"
@@ -99,9 +96,6 @@ configure(rootProject) {
group = 'Verification'
description = 'Validate Source Patterns'
- // This task has no proper outputs.
- setupDummyOutputs(task)
-
sourceFiles = fileTree(projectDir) {
extensions.each{
include "**/*.${it}"