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

[WIP] Add failing test for #33 #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,57 @@ class LicenserPluginFunctionalTest extends Specification {

where:
[gradleVersion, _, extraArgs] << testMatrix
}

@Unroll
def "Plugin tasks should work twice with configuration cache enabled (Gradle #gradleVersion)"() {
given:
def projectDir = temporaryFolder.newFolder()
def sourceDir = projectDir.toPath().resolve(Paths.get("src", "main", "java", "com", "example")).toFile()
sourceDir.mkdirs()
new File(projectDir, "LICENSE") << "Copyright header"
new File(projectDir, "settings.gradle") << ""
new File(projectDir, "build.gradle") << """
plugins {
id('java')
id('org.cadixdev.licenser')
}
""".stripIndent().trim()
def sourceFileContent = """\
/*
* Copyright header
*/

package com.example;

class MyClass {}
""".stripIndent()
def sourceFile = new File(sourceDir, "MyClass.java") << sourceFileContent

when:
def runner = runner(projectDir, gradleVersion, extraArgs + "checkLicenses")
runner.debug = true
def result = runner.build()

then:
result.task(":checkLicenses").outcome == TaskOutcome.SUCCESS
sourceFile.text == """\
/*
* Copyright header
*/

package com.example;

class MyClass {}
""".stripIndent()

when:
def secondResult = runner.build()

then:
secondResult.task(":checkLicenses").outcome == TaskOutcome.UP_TO_DATE

where:
[gradleVersion, _, extraArgs] << configurationCacheTestMatrix
}
}