Skip to content

Commit

Permalink
fix(jardiff): make jardiff incremental
Browse files Browse the repository at this point in the history
When building a -SNAPSHOT version and changing the source version for
the jardiff, the old jardiff files were also packed in the war file,
making it necessary to do a clean.

Changing the source version of a jardiff does not require a clean
build anymore.

Closes #49
  • Loading branch information
tschulte committed Aug 31, 2017
1 parent f4a8325 commit 7d1dd6f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class JarDiffTask extends DefaultTask {

@TaskAction
void createJardiffs() {
project.delete(into.listFiles())
def toMap = {
[file: it, baseName: it.name - ~/__V.*$/, version: it.name.replaceAll(/.*?__V(.*?)\.jar.*/, '$1')]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,4 +506,55 @@ class GradleJnlpWarPluginIntegrationSpec extends AbstractJnlpIntegrationSpec {
gv << gradleVersions
}

@Unroll
def '[gradle #gv] incremental jardiff build works'() {
given:
gradleVersion = gv

when:
runTasksSuccessfully('build', 'publish')

version = '1.1'
runTasksSuccessfully('build', 'publish')

version = '1.2'
warBuildFile.text = '''\
jnlpWar {
versions {
"1.0" "$rootProject.group:$rootProject.name:1.0:webstart@zip"
}
launchers {
"1.2" {
jardiff {
from "1.0"
}
}
}
}
'''
runTasksSuccessfully("build")
warBuildFile.text = '''\
jnlpWar {
versions {
"1.1" "$rootProject.group:$rootProject.name:1.1:webstart@zip"
}
launchers {
"1.2" {
jardiff {
from "1.1"
}
}
}
}
'''
runTasksSuccessfully("build")

then:
!fileExists("war/build/tmp/warContent/lib/${moduleName}__V1.0-myalias__V1.2-myalias.diff.jar.pack.gz")
fileExists("war/build/tmp/warContent/lib/${moduleName}__V1.1-myalias__V1.2-myalias.diff.jar.pack.gz")

where:
gv << gradleVersions
}

}

0 comments on commit 7d1dd6f

Please sign in to comment.