Skip to content

Compile CodeQL sources with the Gradle build cache disabled - #15

Merged
IRus merged 1 commit into
mainfrom
ci/codeql-compile-without-build-cache
Jul 19, 2026
Merged

Compile CodeQL sources with the Gradle build cache disabled#15
IRus merged 1 commit into
mainfrom
ci/codeql-compile-without-build-cache

Conversation

@IRus

@IRus IRus commented Jul 19, 2026

Copy link
Copy Markdown
Member

Problem

Analyze Java and Kotlin fails on every PR with:

CodeQL could not process any code written in Java/Kotlin.

The job uses build-mode: manual, so the CodeQL tracer only captures code compiled by a real compiler process during the "Compile JVM Kotlin sources" step. gradle/actions/setup-gradle restores the Gradle build cache from previous CI runs, so on PRs every compileKotlinJvm task resolves as FROM-CACHE (run 29678913155: all 10 compile tasks came from cache). No compiler ever runs → the extractor sees nothing → database finalize exits with code 32. It only passed on main when the cache happened to miss.

Fix

Add --no-build-cache to the compile invocation. Compilation always executes under the tracer; dependency, wrapper, and configuration caches are untouched, so the overhead is just the actual Kotlin compilation this job exists to observe.

🤖 Generated with Claude Code

The CodeQL job builds in manual mode, so the extractor only sees code
that an actual compiler process emits. setup-gradle restores the local
build cache from earlier CI runs, which turns every compileKotlinJvm
task into FROM-CACHE, no compiler runs, and database finalization fails
with "CodeQL could not process any code written in Java/Kotlin" (see
run 29678913155). Pass --no-build-cache so the tasks always execute
under the CodeQL tracer; dependency and wrapper caches stay in place.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@IRus
IRus merged commit 8bdba99 into main Jul 19, 2026
7 of 9 checks passed
@IRus
IRus deleted the ci/codeql-compile-without-build-cache branch July 19, 2026 08:41
IRus added a commit that referenced this pull request Jul 19, 2026
--no-build-cache (added in #15) stops Gradle from resolving compile
tasks FROM-CACHE, but restored incremental state can still mark them
UP-TO-DATE, in which case kotlinc never launches and CodeQL's
manual-build extractor sees no compilation. Add --rerun-tasks so the
scanned compile tasks always execute for real; dependency caching
from setup-gradle stays in effect.

Verified locally: the exact workflow command reports
"27 actionable tasks: 27 executed" with zero UP-TO-DATE/FROM-CACHE
outcomes.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant