Skip to content

ShadowJar task input fingerprint uses configured 'excludes' #717

@robmoore-i

Description

@robmoore-i

Please check the User Guide before submitting "how do I do 'x'?" questions!

Shadow Version : 7.1.0

Gradle Version : 7.2

Expected Behaviour : Changes to configured 'excludes' causes task to not be up-to-date

Actual Behaviour : Task reports that it's up-to-date after changes to the configured 'excludes'

Gradle Build Script

Reproducer: https://github.com/robmoore-i/shadow-jar-cacheability-reproducer

import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
    java
    id("com.github.johnrengelman.shadow").version("7.1.0")
}

/**
 * Reproducer Guide:
 *
     * This task's input fingerprint should change when the set of excludes changes.
 *
 * Try:
 * 1. Run `./gradlew shadowJar`. You should see `2 actionable tasks: 2 executed`.
 * 2. Re-run. You should see `2 actionable tasks: 2 up-to-date`.
 * 3. Uncomment the first line in the ShadowJar task configuration block.
 * 4. Re-run. You'll see the log line, and (incorrectly) `2 actionable tasks: 2 up-to-date`.
 * 5. Re-comment the first line in the ShadowJar task configuration block, and uncomment the second line.
 * 6. Re-run. As before, you'll see the log line and (incorrectly) `2 actionable tasks: 2 up-to-date`.
 *
 * Reset with `./gradlew clean`.
 */
tasks.named<ShadowJar>("shadowJar") {
//    logger.quiet("Excluding 1"); exclude("META-INF/maven/com.google.j2objc/")
//    logger.quiet("Excluding 2"); exclude("META-INF/maven/com.google.j2objc/", "META-INF/maven/com.google.errorprone/")
}

group = "com.reproducer"
version = "1.0"

repositories {
    mavenCentral()
}

dependencies {
    implementation("com.google.guava:guava:31.0.1-jre")
}

Content of Shadow JAR (jar tf <jar file> - post link to GIST if too long)

N/A - This issue is about task cacheability, and not the correctness of the task action.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions