Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing up-to-date check for Jar tasks #101

Open
Fiouz opened this issue Oct 7, 2022 · 0 comments
Open

Missing up-to-date check for Jar tasks #101

Fiouz opened this issue Oct 7, 2022 · 0 comments

Comments

@Fiouz
Copy link

Fiouz commented Oct 7, 2022

Summary

Missing up-to-date checks for Jar tasks: when data collected by nebula.info changes (e.g. Git commit), it should invalidate any previous jar tasks, instead of reusing the old task output.
https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:up_to_date_checks

Expected behavior

  • jar task is executed on second build
  • The resulting .jar file content reflects the data collected by nebula.info during the second build.

Actual behavior

  • jar task is skipped on second build, and marked as UP-TO-DATE
  • The resulting .jar file content reflect the data collected by nebula.info during the previous build.
$ ./gradlew --console=plain jar
Picked up JAVA_TOOL_OPTIONS: "-XX:+UsePerfData" "-Duser.language=en" "-Duser.country=US" "-Duser.timezone=UTC" "-Dfile.encoding=UTF-8"
> Task :compileJava NO-SOURCE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :createPropertiesFileForJar
> Task :writeManifestProperties
> Task :jar

BUILD SUCCESSFUL in 2s
3 actionable tasks: 3 executed

$ git commit -m "some commit" --allow-empty
[detached HEAD 26bcee2e15962c90f5614e3f757c7b2332d6851f] some commit

$ ./gradlew --console=plain jar
Picked up JAVA_TOOL_OPTIONS: "-XX:+UsePerfData" "-Duser.language=en" "-Duser.country=US" "-Duser.timezone=UTC" "-Dfile.encoding=UTF-8"
> Task :compileJava NO-SOURCE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :createPropertiesFileForJar UP-TO-DATE
> Task :writeManifestProperties
> Task :jar UP-TO-DATE

BUILD SUCCESSFUL in 2s
3 actionable tasks: 1 executed, 2 up-to-date

Steps to reproduce

  1. Initialize Git repository
git init .
  1. Create Gradle build structure, with build.gradle.kts:
plugins {
    id("java-library")
    id("nebula.info") version "11.4.1"
}

infoBroker {
    // only include reproducible entries (entries such as build time do not comply to https://reproducible-builds.org/)
    includedManifestProperties = listOf(
        "Full-Change",
    )
}
  1. Create initial commit to initialize HEAD
git add build.gradle.kts settings.gradle.kts gradlew gradlew.bat <...>
git commit -m 'initial commit'
  1. Trigger initial build on initial commit
./gradlew --console=plain jar
  1. Add a new commit, to change HEAD
git commit -m 'some commit message' --allow-empty
  1. Trigger new build, on new commit/HEAD
./gradlew --console=plain jar

Context

------------------------------------------------------------
Gradle 7.5.1
------------------------------------------------------------

Build time:   2022-08-05 21:17:56 UTC
Revision:     d1daa0cbf1a0103000b71484e1dbfe096e095918

Kotlin:       1.6.21
Groovy:       3.0.10
Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM:          11.0.14.1 (Eclipse Adoptium 11.0.14.1+1)
OS:           Windows 10 10.0 amd64

Workaround

plugins.withType<InfoBrokerPlugin> manifestPlugin@{
    plugins.withType<InfoJarManifestPlugin> {
        tasks.withType<Jar>().configureEach {
            inputs.property(
                "nebula.info-jar-workaround",
                provider {
                    this@manifestPlugin.buildManifest()
                }
            )
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant