Skip to content

Fixes to allow Configuration Caching in Gradle 6.6+#591

Merged
johnrengelman merged 6 commits intoGradleUp:masterfrom
timyates:configuration-cache
Oct 5, 2020
Merged

Fixes to allow Configuration Caching in Gradle 6.6+#591
johnrengelman merged 6 commits intoGradleUp:masterfrom
timyates:configuration-cache

Conversation

@timyates
Copy link
Copy Markdown

We (myself and @britter) believe this PR allows the Shadow Plugin to be used
in a Gradle 6.6+ build with --configuration-cache enabled.

We unfortunately did not get round to fixing the case where minimize() is
used, so it does not work if that is called in the build.

We're basically looking for suggestions on what we can do to improve it,
or whether it is good enough to go in as-is

Cheers

Tim (and Benedikt)

We (myself and @britter) believe this PR allows the Shadow Plugin to be used
in a Gradle 6.6+ build with --configuration-cache enabled.

We unfortunately did not get round to fixing the case where `minimize()` is
used, so it does not work if that is called in the build.

We're basically looking for suggestions on what we can do to improve it,
or whether it is good enough to go in as-is

Cheers

Tim (and Benedikt)
@timyates
Copy link
Copy Markdown
Author

(upcoming configuration cache feature is described here https://docs.gradle.org/release-candidate/userguide/configuration_cache.html)

@eskatos
Copy link
Copy Markdown
Contributor

eskatos commented Aug 12, 2020

@timyates, @britter, any chance you could add a failing test for minimize()? I think this could help moving this forward

@britter
Copy link
Copy Markdown

britter commented Aug 19, 2020

@eskatos I think you only need to call minimize() in the ShadowJar configuration. Haven't checked it, but this test case should fail:

    def "configuration caching supports minimize"() {
        given:
        buildFile << """
            shadowJar {
               minimize()
            }
        """.stripIndent()

        when:
        runner.withArguments('--configuration-cache', 'shadowJar').build()
        output.delete()
        def result = runner.withArguments('--configuration-cache', 'shadowJar').build()

        then:
        contains(output, ['a.properties', 'b.properties'])

        and:
        doesNotContain(output, ['a2.properties'])
        result.output.contains("Reusing configuration cache.")
    }

Signed-off-by: Paul Merlin <paul@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
@eskatos eskatos force-pushed the configuration-cache branch from 1cc82aa to a45502d Compare September 12, 2020 10:58
Signed-off-by: Paul Merlin <paul@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
Signed-off-by: Paul Merlin <paul@gradle.com>
@eskatos
Copy link
Copy Markdown
Contributor

eskatos commented Sep 12, 2020

With the latest changes above, the minimize {} use case now works with the configuration cache enabled.

Here are some links about configuration caching in Gradle:

@johnrengelman this should be ready for review, could you please take a look?

BTW it looks like the circleci build is broken
https://app.circleci.com/pipelines/github/johnrengelman/shadow/42/workflows/1b019a05-d7a1-47e5-aa42-3a45781b228e/jobs/497

@timyates timyates changed the title [WIP] Fixes to allow Configuration Caching in Gradle 6.6+ Fixes to allow Configuration Caching in Gradle 6.6+ Sep 12, 2020
eskatos added a commit to eskatos/jmh-gradle-plugin that referenced this pull request Sep 21, 2020
@johnrengelman johnrengelman added this to the 6.1 milestone Oct 5, 2020
@johnrengelman johnrengelman merged commit 55c55f5 into GradleUp:master Oct 5, 2020
jar.inputs.property('mainClassName', classNameProvider)
jar.doFirst {
manifest.attributes 'Main-Class': pluginConvention.mainClassName
manifest.attributes 'Main-Class': classNameProvider.get()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

5 participants