This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new a817be3dd8 Defer more task configurations
a817be3dd8 is described below
commit a817be3dd8e00483a97d2725557d6eb23c1e96e0
Author: Goooler <[email protected]>
AuthorDate: Sun Feb 19 02:57:30 2023 +0800
Defer more task configurations
---
bootstrap/build.gradle | 3 +-
.../src/main/groovy/org.apache.groovy-base.gradle | 4 +-
.../main/groovy/org.apache.groovy-tested.gradle | 2 +-
gradle/eclipse.gradle | 4 +-
gradle/licenses.gradle | 48 +++++++++++-----------
subprojects/groovy-binary/build.gradle | 2 +-
6 files changed, 32 insertions(+), 31 deletions(-)
diff --git a/bootstrap/build.gradle b/bootstrap/build.gradle
index 2469e25c91..d6ef1fc5fa 100644
--- a/bootstrap/build.gradle
+++ b/bootstrap/build.gradle
@@ -28,7 +28,8 @@ tasks.withType(Wrapper).configureEach {
gradleVersion = props.gradle_version
}
-task bootstrap(dependsOn: 'wrapper') {
+tasks.register('bootstrap') {
+ dependsOn 'wrapper'
doLast {
ant.move file: "${projectDir}/gradlew", todir: "${projectDir}/../"
ant.move file: "${projectDir}/gradlew.bat", todir: "${projectDir}/../"
diff --git a/build-logic/src/main/groovy/org.apache.groovy-base.gradle
b/build-logic/src/main/groovy/org.apache.groovy-base.gradle
index e73f90c3ca..d5b8c0e3c0 100644
--- a/build-logic/src/main/groovy/org.apache.groovy-base.gradle
+++ b/build-logic/src/main/groovy/org.apache.groovy-base.gradle
@@ -144,7 +144,7 @@ tasks.named('jar') {
groovyLibrary.configureManifest(manifest, excludedFromManifest)
}
-tasks.withType(AbstractArchiveTask) {
+tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
@@ -261,7 +261,7 @@ tasks.withType(Checkstyle).configureEach {
def chk = it
finalizedBy {
// we use a closure here as a workaround, to preserve task
configuration laziness
- tasks.create("${name}Report", CheckstyleHtmlReport) {
+ tasks.register("${name}Report", CheckstyleHtmlReport) {
dependsOn chk
source.from(chk.source)
configFile =
rootProject.file("config/checkstyle/checkstyle-report.groovy")
diff --git a/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
b/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
index a3c9003546..c5ad2bc44b 100644
--- a/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
+++ b/build-logic/src/main/groovy/org.apache.groovy-tested.gradle
@@ -96,7 +96,7 @@ tasks.withType(Test).configureEach {
tasks.addRule('Pattern: testSingle<Name> will test **/<Name>.class') { String
taskName ->
if (taskName.startsWith('testSingle')) {
- tasks.create(taskName).dependsOn(test)
+ tasks.register(taskName) { dependsOn(test) }
test.includes = ['**/' + taskName.substring(10) + '.class']
test.outputs.upToDateWhen { false }
}
diff --git a/gradle/eclipse.gradle b/gradle/eclipse.gradle
index 3174bec028..8407596e08 100644
--- a/gradle/eclipse.gradle
+++ b/gradle/eclipse.gradle
@@ -90,12 +90,12 @@ if (gradle.startParameter.taskNames.any { it =~
/(?i)eclipse/ }) {
// tasks for cleaning the .settings files created above
- task cleanEclipseGdt(type: Delete) {
+ tasks.register('cleanEclipseGdt', Delete) {
delete
"${project.projectDir}/.settings/org.eclipse.jdt.groovy.core.prefs"
}
cleanEclipse.dependsOn(cleanEclipseGdt)
- task cleanEclipseJdtUI(type: Delete) {
+ tasks.register('cleanEclipseJdtUI', Delete) {
delete "${project.projectDir}/.settings/org.eclipse.jdt.ui.prefs"
}
cleanEclipse.dependsOn(cleanEclipseJdtUI)
diff --git a/gradle/licenses.gradle b/gradle/licenses.gradle
index da471f4f17..d05bc8e97a 100644
--- a/gradle/licenses.gradle
+++ b/gradle/licenses.gradle
@@ -17,7 +17,7 @@
* under the License.
*/
-task updateLicenses {
+tasks.register('updateLicenses') {
description = 'Updates the various LICENSE files'
ext.licensesDir = "${projectDir}/licenses"
ext.licenseBaseFile = "${licensesDir}/LICENSE-BASE"
@@ -32,7 +32,7 @@ task updateLicenses {
ext.licenseSdkFile = "${licensesDir}/LICENSE-SDK"
inputs.files(licenseBaseFile, fileTree(licensesDir).include('*.txt'))
outputs.files(licenseBinZipFile, licenseDocFile, licenseJarJarFile,
licenseSrcFile,
- licenseDocGeneratorFile, licenseGroovyDocFile, licenseJsr223File,
licenseSdkFile)
+ licenseDocGeneratorFile, licenseGroovyDocFile, licenseJsr223File,
licenseSdkFile)
doLast {
def srcFiles = fileTree(licensesDir).include('*-SRC*.txt').sort {
it.name }
@@ -47,13 +47,13 @@ task updateLicenses {
def jsr223Files =
fileTree(licensesDir).include('jsr223-BINZIP-SRC.txt')
def licenseHdr =
'\n\n------------------------------------------------------------------------\n\n'
[
- (licenseBinZipFile): binzipFiles,
- (licenseDocFile): docFiles,
- (licenseJarJarFile): jarjarFiles,
- (licenseSrcFile): srcFiles,
- (licenseDocGeneratorFile): docgeneratorFiles,
- (licenseGroovyDocFile): groovydocFiles,
- (licenseJsr223File): jsr223Files,
+ (licenseBinZipFile) : binzipFiles,
+ (licenseDocFile) : docFiles,
+ (licenseJarJarFile) : jarjarFiles,
+ (licenseSrcFile) : srcFiles,
+ (licenseDocGeneratorFile): docgeneratorFiles,
+ (licenseGroovyDocFile) : groovydocFiles,
+ (licenseJsr223File) : jsr223Files,
].each { outFile, inFiles ->
file(outFile).withWriter('utf-8') { writer ->
writer << ([file(licenseBaseFile)] + inFiles).collect {
@@ -63,15 +63,15 @@ task updateLicenses {
}
file(licenseSdkFile).withWriter { writer ->
writer << [
- file(licenseBinZipFile).text,
- "This convenience zip embeds Groovy's src and doc
zips.\nSee also src/LICENSE " +
- "and doc/LICENSE files for additional license
information."
+ file(licenseBinZipFile).text,
+ "This convenience zip embeds Groovy's src and doc zips.\nSee
also src/LICENSE " +
+ "and doc/LICENSE files for additional license information."
].join(licenseHdr) + '\n'
}
}
}
-task updateNotices {
+tasks.register('updateNotices') {
description = 'Updates the various NOTICE files'
ext.noticesDir = "${projectDir}/notices"
ext.noticeBaseFile = "${noticesDir}/NOTICE-BASE"
@@ -85,7 +85,7 @@ task updateNotices {
ext.noticeSdkFile = "${noticesDir}/NOTICE-SDK"
inputs.files(noticeBaseFile, fileTree(noticesDir).include('*.txt'))
outputs.files(noticeBinZipFile, noticeGrooidFile, noticeGrooidJarJarFile,
- noticeJarJarFile, noticeSrcFile, noticeGroovyConsoleFile,
noticeSdkFile)
+ noticeJarJarFile, noticeSrcFile, noticeGroovyConsoleFile,
noticeSdkFile)
doLast {
def srcFiles = fileTree(noticesDir).include('*-SRC*.txt').sort {
it.name }
@@ -102,12 +102,12 @@ task updateNotices {
}.sort { it.name }
def groovyconsoleFiles =
fileTree(noticesDir).include('silkicons-BINZIP-SRC.txt')
[
- (noticeBinZipFile): binzipFiles,
- (noticeGrooidFile): grooidFiles,
- (noticeGrooidJarJarFile): grooidJarjarFiles,
- (noticeJarJarFile): jarjarFiles,
- (noticeSrcFile): srcFiles,
- (noticeGroovyConsoleFile): groovyconsoleFiles,
+ (noticeBinZipFile) : binzipFiles,
+ (noticeGrooidFile) : grooidFiles,
+ (noticeGrooidJarJarFile) : grooidJarjarFiles,
+ (noticeJarJarFile) : jarjarFiles,
+ (noticeSrcFile) : srcFiles,
+ (noticeGroovyConsoleFile): groovyconsoleFiles,
].each { outFile, inFiles ->
file(outFile).withWriter('utf-8') { writer ->
writer << ([file(noticeBaseFile)] + inFiles).collect {
@@ -117,10 +117,10 @@ task updateNotices {
}
file(noticeSdkFile).withWriter { writer ->
writer << [
- file(noticeBinZipFile).text,
- "This convenience zip embeds Groovy's src and doc
zips.\nSee also src/NOTICE " +
- "and doc/NOTICE files for additional notice
information."
+ file(noticeBinZipFile).text,
+ "This convenience zip embeds Groovy's src and doc zips.\nSee
also src/NOTICE " +
+ "and doc/NOTICE files for additional notice information."
].join('\n\n')
}
}
-}
\ No newline at end of file
+}
diff --git a/subprojects/groovy-binary/build.gradle
b/subprojects/groovy-binary/build.gradle
index dda2d9f47c..5686cb153e 100644
--- a/subprojects/groovy-binary/build.gradle
+++ b/subprojects/groovy-binary/build.gradle
@@ -193,7 +193,7 @@ distribution {
}
}
-tasks.withType(AbstractArchiveTask) {
+tasks.withType(AbstractArchiveTask).configureEach {
preserveFileTimestamps = false
reproducibleFileOrder = true
}