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

Fixes to allow Configuration Caching in Gradle 6.6+ #591

Merged
merged 6 commits into from Oct 5, 2020

Conversation

timyates
Copy link

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
Author

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

@eskatos
Copy link
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

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>
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
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 johnrengelman:master Oct 5, 2020
jar.doFirst {
manifest.attributes 'Main-Class': pluginConvention.mainClassName
manifest.attributes 'Main-Class': classNameProvider.get()
Copy link

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.

None yet

5 participants