Skip to content

Commit

Permalink
Address PR comment. Possibly pathological behavior when running gradl…
Browse files Browse the repository at this point in the history
…e uEP when no changes have actually been made...
  • Loading branch information
PurelyApplied authored and robbadler committed Oct 15, 2018
1 parent 0d8f7d4 commit 11807ba
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions gradle/publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ subprojects {

doLast {
if (tasks.getByName("generatePomFileForMavenPublication").enabled) {
def expectedPomFile = sourceSets.test.resources.find() { it.name == "expected-pom.xml" }
def expectedPomFile = sourceSets.test.resources.getSourceDirectories().first().toURI().resolve("expected-pom.xml")
if (null == expectedPomFile) {
throw new RuntimeException("expected-pom.xml not found.")
}
def expectedPom = new XmlParser().parse(expectedPomFile)
def expectedPom = new XmlParser().parse(expectedPomFile.toString())
def expectedDependencies = new TreeSet()
expectedPom.dependencies.dependency.each() {
expectedDependencies.add(it as String)
Expand Down Expand Up @@ -184,12 +184,13 @@ subprojects {
task updateExpectedPom(dependsOn: generatePomFileForMavenPublication, type: Copy) {
description 'After having verified changes with checkPom, this task will perform the copy.'

def expectedPomFile = sourceSets.test.resources.find() { it.name == "expected-pom.xml" }
def expectedPomDir = sourceSets.test.resources.getSourceDirectories().first().toURI()
def actualPomFile = generatePomFileForMavenPublication.outputs.files.first()
if (tasks.getByName("generatePomFileForMavenPublication").enabled && expectedPomFile && actualPomFile) {
if (tasks.getByName("generatePomFileForMavenPublication").enabled) {
from actualPomFile
into expectedPomFile.parent
rename '.*xml', "expected-pom.xml"
into expectedPomDir
rename '.*.xml', "expected-pom.xml"

}
}
} // subprojects
Expand Down

0 comments on commit 11807ba

Please sign in to comment.