GradleUp / shadow

Gradle plugin to create fat/uber JARs, apply file transforms, and relocate packages for applications and libraries. Gradle version of Maven's Shade plugin.
https://www.gradleup.com/shadow/
Apache License 2.0
3.73k stars 393 forks source link

ShadowJar task input fingerprint uses configured 'excludes' #717

Open robmoore-i opened 3 years ago

robmoore-i commented 3 years ago

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.

johnrengelman commented 1 year ago

There has been a number of fixes in v8+ for cacheability thanks to @Goooler. Can you reverify if this issue still exists in 8.1.1?