Skip to content

Commit 9a3158e

Browse files
committed
Add a shortcut for Gradle's providers
1 parent 54bcd5a commit 9a3158e

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

gradle-api/src/main/kotlin/io/spine/protodata/gradle/CodegenSettings.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
package io.spine.protodata.gradle
2828

2929
import com.google.common.collect.Multimap
30+
import org.gradle.api.provider.Provider
3031
import org.gradle.api.tasks.SourceSet
3132

3233
/**
@@ -79,6 +80,15 @@ public interface CodegenSettings {
7980
*/
8081
public val paths: Multimap<String, SourcePaths>
8182

83+
/**
84+
* Configures a particular launch of ProtoData for the given source set.
85+
*
86+
* @param sourceSet the source set for which ProtoData is launched.
87+
* @param configure the block configuring the launch.
88+
*/
89+
public fun launchFor(sourceSet: Provider<SourceSet>, configure: Launch.() -> Unit): Unit =
90+
launchFor(sourceSet.get().name, configure)
91+
8292
/**
8393
* Configures a particular launch of ProtoData for the given source set.
8494
*

gradle-plugin/src/functionalTest/resources/custom-paths/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ protoData {
6363
}
6464
}
6565

66-
launchFor(sourceSets.test.get()) {
66+
launchFor(sourceSets.test) {
6767
sourceFileSet {
6868
source = "$buildDir/generated-proto/test/kotlin"
6969
target = "$buildDir/footest"

0 commit comments

Comments
 (0)