Skip to content

Failure to clean stale compile output in corner case #33933

@mkm-dt

Description

@mkm-dt

Current Behavior

When switching from a branch in which a certain subproject is part of an included build (configured via settings.gradle) to a branch where the project is directly in the root build (without any change in directory structure), gradle does not use its previously written state to determine which class files are stale and should be deleted.

Expected Behavior

Gradle cleans stale compile output regardless of how the state file was created, or it completely deletes all output if it detects some kind of state mismatch.

Context (optional)

This is quite a corner case and it took a while to track down. We use the same executors for the development branch and older release builds, so the "poisoned" executors broke multiple branches in our CI. Doing clean builds would defeat the purpose of having warmed-up executors, which is why we're not doing that.

Gradle Slack discussion: https://gradle-community.slack.com/archives/CAHSN3LDN/p1750068793575899

Self-contained Reproducer Project

See https://github.com/mkm-dt/gradle-stale-repro for code and instructions

Gradle version

8.14.2

Build scan URL (optional)

No response

Your Environment (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bugin:execution-engineincremental, up-to-date, overlapping outputsin:java-pluginsjava-library, java, java-base, java-platform, java-test-fixtures

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions