Skip to content

Commit

Permalink
buildscripts: use "configureEach" to reduce task configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed Oct 24, 2023
1 parent 74409a0 commit 64501ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion WesLibrary/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ publishMavenPublicationToOSSRHRepository.dependsOn('assemble')
signing {
sign publishing.publications.maven
}
tasks.withType(Sign) {
tasks.withType(Sign).configureEach {
onlyIf { rootProject.hasProperty('signing.keyId') }
}
signMavenPublication.dependsOn('module')
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ subprojects {
apply from: rootProject.file('common.gradle')
}

configurations.all {
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds' // to disable caching of SNAPSHOTs
}

Expand Down
4 changes: 2 additions & 2 deletions common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ checkstyle {
toolVersion '9.3'
}

tasks.withType(JavaCompile) { // Java compile-time options:
tasks.withType(JavaCompile).configureEach { // Java compile-time options:
options.compilerArgs << '-Xdiags:verbose'
if (JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_14)) {
// Suppress warnings that source value 7 is obsolete.
Expand All @@ -29,7 +29,7 @@ tasks.withType(JavaCompile) { // Java compile-time options:
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
Boolean isMacOS = DefaultNativePlatform.currentOperatingSystem.isMacOsX()

tasks.withType(JavaExec) { // Java runtime options:
tasks.withType(JavaExec).configureEach { // Java runtime options:
if (isMacOS) {
jvmArgs '-XstartOnFirstThread'
}
Expand Down

0 comments on commit 64501ae

Please sign in to comment.