Skip to content

Commit 71bcf11

Browse files
committed
Use named(Spec) method where applicable
1 parent 926e03c commit 71bcf11

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

documentation/documentation.gradle.kts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,10 @@ tasks {
383383
val moduleSourcePathOption = addPathOption("-module-source-path")
384384
moduleSourcePathOption.value = modularProjects.map { it.file("src/module") }
385385
moduleSourcePathOption.value.forEach { inputs.dir(it) }
386-
addOption(ModuleSpecificJavadocFileOption("-patch-module", modularProjects.associate {
387-
it.javaModuleName to files(it.sourceSets.matching { it.name.startsWith("main") }.map { it.allJava.srcDirs }).asPath
386+
addOption(ModuleSpecificJavadocFileOption("-patch-module", modularProjects.associate { project ->
387+
project.javaModuleName to files(
388+
project.sourceSets.named { it.startsWith("main") }.map { it.allJava.srcDirs }
389+
).asPath
388390
}))
389391
addStringOption("-add-modules", "info.picocli")
390392
addOption(ModuleSpecificJavadocFileOption("-add-reads", mapOf(
@@ -394,7 +396,9 @@ tasks {
394396
)))
395397
}
396398

397-
source(modularProjects.map { files(it.sourceSets.matching { it.name.startsWith("main") }.map { it.allJava }) })
399+
source(modularProjects.map { project ->
400+
files(project.sourceSets.named { it.startsWith("main") }.map { it.allJava })
401+
})
398402
classpath = files(modularProjects.map { it.sourceSets.main.get().compileClasspath })
399403

400404
maxMemory = "1024m"

gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ val allMainClasses by tasks.registering {
155155

156156
val prepareModuleSourceDir by tasks.registering(Sync::class) {
157157
from(moduleSourceDir)
158-
from(sourceSets.matching { it.name.startsWith("main") }.map { it.allJava })
158+
from(sourceSets.named { it.startsWith("main") }.map { it.allJava })
159159
into(combinedModuleSourceDir.map { it.dir(javaModuleName) })
160160
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
161161
}

gradle/plugins/common/src/main/kotlin/junitbuild.osgi-conventions.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ val projectDescription = objects.property<String>().convention(provider { projec
1212
// This task enhances `jar` and `shadowJar` tasks with the bnd
1313
// `BundleTaskExtension` extension which allows for generating OSGi
1414
// metadata into the jar
15-
tasks.withType<Jar>().matching { task: Jar ->
16-
task.name == "jar" || task.name == "shadowJar"
15+
tasks.withType<Jar>().named {
16+
it == "jar" || it == "shadowJar"
1717
}.all { // configure tasks eagerly as workaround for https://github.com/bndtools/bnd/issues/5695
1818
extra["importAPIGuardian"] = importAPIGuardian
1919

junit-vintage-engine/junit-vintage-engine.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ tasks {
7474
!it.name.startsWith("junit-4")
7575
}
7676
}
77-
withType<Test>().matching { it.name != testWithoutJUnit4.name }.configureEach {
77+
withType<Test>().named { it != testWithoutJUnit4.name }.configureEach {
7878
(options as JUnitPlatformOptions).apply {
7979
excludeTags("missing-junit4")
8080
}

0 commit comments

Comments
 (0)