Conversation
…rk-gradle-plugin into addGroovyTests
📝 WalkthroughWalkthroughThis pull request releases version 1.0.2 with test infrastructure refactoring and plugin implementation updates. The version is bumped in build configuration and documentation. The test base class AbstractPluginFunctionalTest is renamed to KotlinPluginFunctionalTest, and a new GroovyPluginFunctionalTest abstract class is introduced for Groovy-based functional tests. A new functional test class CFGroovyPluginFunctionalTest is added extending the Groovy base. The main plugin implementation wraps configuration logic in a doFirst block, moves checker validation into a guarded section, and broadens the test name detection regex pattern for more permissive matching. 🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/functionalTest/kotlin/org/checkerframework/plugin/gradle/Fixtures.kt (1)
28-36:⚠️ Potential issue | 🟡 MinorFix package-directory mismatch in
writeTestClass().Test.javadeclarespackage test;but is placed directly insrc/test/javainstead ofsrc/test/java/test. This breaks the pattern used consistently bywriteEmptyClass()(line 13) andwriteNullnessFailure()(line 45) and may cause tooling issues. Align the path with the package declaration:Suggested fix
- File(this.resolve("src/test/java").apply { mkdirs() }, "Test.java").apply { + File(this.resolve("src/test/java/test").apply { mkdirs() }, "Test.java").apply {src/main/kotlin/org/checkerframework/plugin/gradle/CheckerFrameworkPlugin.kt (1)
106-143:⚠️ Potential issue | 🟠 MajorAvoid mutating
JavaCompileinputs insidedoFirst—this breaks incremental builds and build caching.Lines 106–139 mutate
options.annotationProcessorPathandoptions.compilerArgsduring execution. Gradle snapshots task inputs beforedoFirstruns (immediately before execution). Any mutations indoFirstcreate a mismatch: the pre-execution snapshot won't match the execution history persisted from the previous run, causing the task to appear out-of-date on subsequent builds even when inputs haven't actually changed. This is a known Gradle caching problem.Move these mutations to configuration time (when tasks are configured, not when they execute), or express them as inputs via lazy
Provider-based properties or thecompilerArgumentProvidersAPI so Gradle can properly track them. At minimum, declare the manifest directory as an input:Mitigation: declare manifest as input
dependsOn("writeCheckerManifest") + inputs.dir(cfManifestDir)Better: move the entire
doFirstblock logic to configuration time (a separateTask.doFirstequivalent that runs duringconfigureEach), or use lazy properties.
🤖 Fix all issues with AI agents
In
`@src/functionalTest/kotlin/org/checkerframework/plugin/gradle/CFGroovyPluginFunctionalTest.kt`:
- Around line 11-23: The appended plugin/repositories block uses trimIndent()
which removes trailing blank lines so subsequent buildFile.appendText calls can
run together (e.g., merging "}" with following blocks); update the code that
calls buildFile.appendText(...) for this block (the string passed to
buildFile.appendText) to ensure it ends with an explicit newline (for example
append "\n" or include a final blank line after trimIndent) so subsequent
appendText calls like the one adding compileJava{} remain separated.
| buildFile.appendText( | ||
| """ | ||
| plugins { | ||
| id("java") | ||
| id("org.checkerframework") | ||
| } | ||
| repositories { | ||
| mavenCentral() | ||
| } | ||
|
|
||
| """ | ||
| .trimIndent() | ||
| ) |
There was a problem hiding this comment.
Avoid relying on trailing whitespace for block separation.
trimIndent() strips trailing blank lines, so this block likely ends without a newline. The later appendText() calls can concatenate } and compileJava{} unless the trailing spaces survive formatting. Add an explicit newline to make the separation robust.
🔧 Suggested fix
- buildFile.appendText(
- """
- plugins {
- id("java")
- id("org.checkerframework")
- }
- repositories {
- mavenCentral()
- }
-
- """
- .trimIndent()
- )
+ buildFile.appendText(
+ """
+ plugins {
+ id("java")
+ id("org.checkerframework")
+ }
+ repositories {
+ mavenCentral()
+ }
+ """.trimIndent() + "\n"
+ )🤖 Prompt for AI Agents
In
`@src/functionalTest/kotlin/org/checkerframework/plugin/gradle/CFGroovyPluginFunctionalTest.kt`
around lines 11 - 23, The appended plugin/repositories block uses trimIndent()
which removes trailing blank lines so subsequent buildFile.appendText calls can
run together (e.g., merging "}" with following blocks); update the code that
calls buildFile.appendText(...) for this block (the string passed to
buildFile.appendText) to ensure it ends with an explicit newline (for example
append "\n" or include a final blank line after trimIndent) so subsequent
appendText calls like the one adding compileJava{} remain separated.
No description provided.