Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle-plugin/api/gradle-plugin.api
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,19 @@ public abstract class kotlinx/rpc/buf/tasks/BufGenerateTask : kotlinx/rpc/buf/ta
public abstract fun getExecutableFiles ()Lorg/gradle/api/provider/ListProperty;
public abstract fun getIncludeImports ()Lorg/gradle/api/provider/Property;
public abstract fun getIncludeWkt ()Lorg/gradle/api/provider/Property;
public abstract fun getOutputDirectory ()Lorg/gradle/api/provider/Property;
public abstract fun getOutputDirectory ()Lorg/gradle/api/file/DirectoryProperty;
public final fun getOutputSourceDirectories ()Lorg/gradle/api/provider/Provider;
public abstract fun getPluginNames ()Lorg/gradle/api/provider/ListProperty;
}

public abstract class kotlinx/rpc/buf/tasks/GenerateBufGenYaml : kotlinx/rpc/protoc/DefaultProtoTask {
public static final field NAME_PREFIX Ljava/lang/String;
public abstract fun getBufGenFile ()Lorg/gradle/api/provider/Property;
public abstract fun getBufGenFile ()Lorg/gradle/api/file/RegularFileProperty;
}

public abstract class kotlinx/rpc/buf/tasks/GenerateBufYaml : kotlinx/rpc/protoc/DefaultProtoTask {
public static final field NAME_PREFIX Ljava/lang/String;
public abstract fun getBufFile ()Lorg/gradle/api/provider/Property;
public abstract fun getBufFile ()Lorg/gradle/api/file/RegularFileProperty;
}

public final class kotlinx/rpc/protoc/ConstsKt {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package kotlinx.rpc.buf.tasks
import kotlinx.rpc.protoc.PROTO_GROUP
import kotlinx.rpc.protoc.ProtocPlugin
import org.gradle.api.Project
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
Expand Down Expand Up @@ -99,7 +100,7 @@ public abstract class BufGenerateTask @Inject internal constructor(
* not the directory for sources. For that see [outputSourceDirectories].
*/
@get:OutputDirectory
public abstract val outputDirectory: Property<File>
public abstract val outputDirectory: DirectoryProperty

/**
* Generated source directories by plugin name.
Expand All @@ -113,7 +114,7 @@ public abstract class BufGenerateTask @Inject internal constructor(
*/
@get:Internal
public val outputSourceDirectories: Provider<List<File>> = pluginNames.map { plugins ->
val out = outputDirectory.get()
val out = outputDirectory.get().asFile
plugins.map { out.resolve(it) }
}

Expand All @@ -122,7 +123,7 @@ public abstract class BufGenerateTask @Inject internal constructor(

val args = project.provider {
buildList {
add("--output"); add(outputDirectory.get().absolutePath)
add("--output"); add(outputDirectory.get().asFile.absolutePath)

if (includeImports.getOrElse(false) || includeWkt.getOrElse(false)) {
add("--include-imports")
Expand Down Expand Up @@ -169,7 +170,7 @@ internal fun Project.registerBufGenerateTask(
includeWkt.convention(generate.includeWkt)
errorFormat.convention(generate.errorFormat)

this.outputDirectory.convention(outputDirectory)
this.outputDirectory.convention(project.layout.dir(project.provider { outputDirectory }))

pluginNames.convention(includedPlugins.map { it.map { plugin -> plugin.name } })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import kotlinx.rpc.protoc.ProtoTask
import kotlinx.rpc.protoc.ProtocPlugin
import kotlinx.rpc.util.ensureRegularFileExists
import org.gradle.api.Project
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.ListProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
Expand Down Expand Up @@ -66,12 +67,12 @@ public abstract class GenerateBufGenYaml @Inject internal constructor(
* The `buf.gen.yaml` file to generate/update.
*/
@get:OutputFile
public abstract val bufGenFile: Property<File>
public abstract val bufGenFile: RegularFileProperty

@TaskAction
@Suppress("detekt.NestedBlockDepth")
internal fun generate() {
val file = bufGenFile.get()
val file = bufGenFile.get().asFile
// Parent dir may be missing when the configuration cache hits and `ensureRegularFileExists`
// in the caller is skipped; creating it defensively lets `bufferedWriter()` succeed.
file.parentFile.mkdirs()
Expand Down Expand Up @@ -185,7 +186,7 @@ internal fun Project.registerGenerateBufGenYamlTask(
.resolve(BUF_GEN_YAML)
.ensureRegularFileExists()

bufGenFile.convention(bufGenYamlFile)
bufGenFile.convention(project.layout.file(project.provider { bufGenYamlFile }))

configure()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import kotlinx.rpc.protoc.DefaultProtoTask
import kotlinx.rpc.protoc.ProtoTask
import kotlinx.rpc.util.ensureRegularFileExists
import org.gradle.api.Project
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.CacheableTask
Expand Down Expand Up @@ -62,11 +63,11 @@ public abstract class GenerateBufYaml @Inject internal constructor(
* The `buf.yaml` file to generate/update.
*/
@get:OutputFile
public abstract val bufFile: Property<File>
public abstract val bufFile: RegularFileProperty

@TaskAction
internal fun generate() {
val file = bufFile.get()
val file = bufFile.get().asFile
// Parent dir may be missing when the configuration cache hits and `ensureRegularFileExists`
// in the caller is skipped; creating it defensively lets `bufferedWriter()` succeed.
file.parentFile.mkdirs()
Expand Down Expand Up @@ -123,7 +124,7 @@ internal fun Project.registerGenerateBufYamlTask(
.resolve(BUF_YAML)
.ensureRegularFileExists()

bufFile.convention(bufYamlFile)
bufFile.convention(project.layout.file(project.provider { bufYamlFile }))

configure()
}
Expand Down
Loading