KRPC-598: Use RegularFileProperty/DirectoryProperty for buf task outputs#714
Merged
Conversation
🔒 AI PR Safety: SAFEAll comments on this bot-authored PR are from authorized repository collaborators. |
Contributor
Author
Internal code reviewItems flagged during automated code review but not fixed in this PR. Gradle correctness reviewer
Cross-cutting risk reviewer
No errors were flagged by either reviewer. The full diff was reviewed against ABI compatibility, configuration cache safety, lazy-evaluation semantics, and downstream consumer impact. |
Contributor
Author
CI ReportPassed
FailedNone |
Mr3zee
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Subsystem
gradle-plugin(Buf code-generation tasks)Problem
YouTrack: KRPC-598
Solution
Migrates the three Buf task output properties in
gradle-pluginfrom the genericProperty<File>to the idiomatic typed forms:GenerateBufYamlbufFile(@OutputFile)Property<File>RegularFilePropertyGenerateBufGenYamlbufGenFile(@OutputFile)Property<File>RegularFilePropertyBufGenerateTaskoutputDirectory(@OutputDirectory)Property<File>DirectoryPropertyCaller-side wiring (
registerGenerateBufYamlTask,registerGenerateBufGenYamlTask,registerBufGenerateTask) now usesproject.layout.file(project.provider { ... })andproject.layout.dir(project.provider { ... })to feed the localFileintoconvention(...). This is the canonical convention-with-File idiom —FileSystemLocationPropertyhas noconventionFileValue(File). Read sites inside@TaskActionswitch from.get()(which returnedFile) to.get().asFile(which returnsFilefrom the newRegularFile/Directoryvalue).The
gradle-plugin/api/gradle-plugin.apiABI dump is regenerated as a separate commit so the mechanical change is visible in isolation.Three public abstract task-property getters change return type:
BufGenerateTask.getOutputDirectory(): Property<File>→DirectoryPropertyGenerateBufGenYaml.getBufGenFile(): Property<File>→RegularFilePropertyGenerateBufYaml.getBufFile(): Property<File>→RegularFilePropertyThe new return types are subtypes of
Propertyso source code that reads the property (e.g.task.outputDirectory.get()) keeps working at the value level. Source-incompatible cases:Property<File>(e.g.val p: Property<File> = task.outputDirectory) needs to switch toDirectoryProperty/RegularFileProperty.getOutputDirectory()against the old descriptor will getNoSuchMethodErrorand must be recompiled.The Kotlin DSL
outputDirectory = file("...")andoutputDirectory.set(file("..."))patterns continue to compile because Gradle 8.2+ shipsFileSystemLocationProperty.set(File)and.assign(File?). No.fileValue(File)migration is required for users who already used those forms.This is a pre-1.0 dev-preview line; per the analysis on the YouTrack ticket no deprecation shim is added (single-getter surface, nothing to soft-deprecate side-by-side). The breaking change should be called out in the next release CHANGELOG section by the release maintainer — this project does not maintain an in-tree
Unreleasedsection.Verification
:gradle-plugin:compileKotlin✓:gradle-plugin:updateLegacyAbiregenerated cleanly;checkLegacyAbi✓detekt✓ (no new violations):gradle-plugin:test— 205/205 TestKit integration tests pass (exercisebufGenerateCommonMainend-to-end across JVM/KMP/Android scenarios):protobuf:protobuf-wkt:bufGenerateCommonMainand:tests:protobuf-conformance:bufGenerateCommonMain✓ — confirms the two internal call sites that useoutputDirectory = file(Kotlin-DSL assign-operator, type-erased) still compile and execute correctly againstDirectoryPropertyNote
Fully autonomous AI-generated PR — no human reviewed the code before submission.
Problem analysis and root cause details: KRPC-598