Repository navigation
Recognize Gradle tasks as checks in the done gate - #59
McCal-Codes wants to merge 1 commit into
Conversation
The done gate only knew a bare \gradlew test\, so Android and Kotlin projects that run \./gradlew :app:testDebugUnitTest\, \:app:assembleDebug\ or \.\gradlew.bat\ recorded no checks: failures went unseen, and an answer saying the tests pass was sent back. Gradle tasks with a project path, flags and the Windows wrapper now count as tests, builds, lint and typecheck; a task after -x is left out.
vchaindz
left a comment
There was a problem hiding this comment.
Thanks for this, the bare gradlew test pattern was a real hole for Android projects. The approach fits how CHECKS already works. Three cases don't come out right yet, all in the GRADLE prefix:
1. A task after -x is never reached
./gradlew -x lint build -> no check
./gradlew -x test assembleDebug -> no check
The lookahead stops the token skip at -x, so everything after it is lost, not only the excluded task. Skipping the flag together with its value fixes it.
2. Root-project tasks with a leading colon
./gradlew :test, :build and :check match nothing, because (?::?[\w.-]+:)* wants a colon after every segment. :?(?:[\w.-]+:)* covers them.
3. Hyphenated project names read as tasks
./gradlew test-utils:assemble -> test (is a build)
./gradlew lint-rules:assemble -> lint (is a build)
\b matches before the hyphen. This one matters most: a wrong "test" lets an answer that says the tests pass through the gate. Ending the task on (?=\s|$) fixes it.
This prefix passes your 18 cases plus the ones above, with (?=\s|$) after each Gradle task group in place of the shared \b:
const GRADLE = String.raw`(?:\S*\\)?(?:gradlew(?:\.bat)?|gradle)\s+(?:(?:-x|--exclude-task)(?:\s+|=)\S+\s+|(?!-x\s|--exclude-task[\s=])\S+\s+)*?:?(?:[\w.-]+:)*`Please add those cases to the test.
Smaller things:
./gradlew tasks --group buildand./gradlew help --task teststill read as build and test, since a flag's value looks like a task. Fine to leave, but then it wants a// shortcut:comment naming the limit.- The comment above
GRADLEis two lines; we keep them to one. - The 64 Windows failures deserve their own issue, could you open one with the output?
The done gate only knows a bare
gradlew test. Android and Kotlin projects usually run tasks with a project path, so./gradlew :app:testDebugUnitTest,./gradlew :app:assembleDebug,./gradlew :app:lintDebugand anything through.\gradlew.batrecord no check at all. Two things follow:This adds a
GRADLEprefix to the check patterns inhooks/format.ts. It accepts./gradlew,.\gradlew.batorgradle, then any flags and earlier tasks, then a task with an optional project path:test,test…UnitTest,connected…AndroidTest,checkassemble…,bundle…,buildlint…,ktlintCheck,detekt,spotlessCheckcompile…Kotlin-xor--exclude-taskis skipped, so./gradlew :app:assembleDebug -x testis a build, not a test.testClasses,buildEnvironment,cleanand--stopstay unrecognized.assembleDebug testDebugUnitTestreads as a test.docs/guide.mdgets one paragraph, andtests/format.test.tsgets one test with 18 cases.Testing
findCheck reads Gradle tasks with a project path, flags and the Windows wrapper: passes.claude plugin test .on Windows 11 (Claude Code 2.1.332): 298 pass, 64 fail. The same 64 tests fail on an unpatched 0.60.0 checkout, so none are caused by this change. They look like Windows path issues in the tests. For example, the spool tests expect/spool/sess-1.jsonand getundefined, and a web test expects--openand gets the port. That may be useful, since the README asks for Windows reports.findCheckspassed: real Android commands, the-xcases, commands that look like checks but aren't (echo "./gradlew test",grep gradlew build.gradle), and the existing npm, cargo, tsc and make patterns.tsc --noEmitwas not run, because it needs the generated.claude-plugin/types.