This repository has been archived by the owner on Jun 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #18: Fix evaluation ordering issue for POM modification.
- Loading branch information
Showing
7 changed files
with
263 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,18 @@ apply plugin: org.gradle.api.plugins.nexus.NexusPlugin | |
} | ||
} | ||
|
||
protected void assertCorrectPomXml(File pomFile) { | ||
println pomFile.text | ||
def pomXml = new XmlSlurper().parse(pomFile) | ||
assert pomXml.name.text() == 'myapp' | ||
assert pomXml.description.text() == 'My application' | ||
assert pomXml.inceptionYear.text() == '2012' | ||
def developer = pomXml.developers.developer[0] | ||
assert developer.id.text() == 'bmuschko' | ||
assert developer.name.text() == 'Benjamin Muschko' | ||
assert developer.email.text() == '[email protected]' | ||
} | ||
|
||
protected GradleProject runTasks(File projectDir, String... tasks) { | ||
ProjectConnection connection = GradleConnector.newConnector().forProjectDirectory(projectDir).connect() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,54 @@ nexus { | |
assertExistingFiles(installationDir, expectedFilenames) | ||
} | ||
|
||
def "Installs all configured JARs, customized metadata and signature artifacts with default configuration"() { | ||
setup: | ||
def projectCoordinates = [group: 'org.gradle.mygroup', name: 'integTest', version: '1.0'] | ||
File installationDir = new File(M2_HOME_DIR, createInstallationDir(projectCoordinates)) | ||
deleteMavenLocalInstallationDir(installationDir) | ||
|
||
when: | ||
buildFile << """ | ||
version = '$projectCoordinates.version' | ||
group = '$projectCoordinates.group' | ||
nexus { | ||
attachTests = true | ||
} | ||
modifyPom { | ||
project { | ||
name 'myapp' | ||
description 'My application' | ||
inceptionYear '2012' | ||
developers { | ||
developer { | ||
id 'bmuschko' | ||
name 'Benjamin Muschko' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
runTasks(integTestDir, MavenPlugin.INSTALL_TASK_NAME) | ||
|
||
then: | ||
def expectedFilenames = ["${projectCoordinates.name}-${projectCoordinates.version}.jar", | ||
"${projectCoordinates.name}-${projectCoordinates.version}.jar.asc", | ||
"${projectCoordinates.name}-${projectCoordinates.version}.pom", | ||
"${projectCoordinates.name}-${projectCoordinates.version}.pom.asc", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-javadoc.jar", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-javadoc.jar.asc", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-sources.jar", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-sources.jar.asc", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-tests.jar", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-tests.jar.asc"] | ||
assertExistingFiles(installationDir, expectedFilenames) | ||
assertCorrectPomXml(new File(installationDir, "${projectCoordinates.name}-${projectCoordinates.version}.pom")) | ||
} | ||
|
||
def "Installs all configured JARs, metadata and signature artifacts for release version with custom configuration"() { | ||
setup: | ||
def projectCoordinates = [group: 'org.gradle.mygroup', name: 'integTest', version: '1.0'] | ||
|
@@ -98,6 +146,63 @@ nexus { | |
assertExistingFiles(installationDir, expectedFilenames) | ||
} | ||
|
||
def "Installs all configured JARs, customized metadata and signature artifacts with custom configuration"() { | ||
setup: | ||
def projectCoordinates = [group: 'org.gradle.mygroup', name: 'integTest', version: '1.0'] | ||
File installationDir = new File(M2_HOME_DIR, createInstallationDir(projectCoordinates)) | ||
deleteMavenLocalInstallationDir(installationDir) | ||
|
||
when: | ||
buildFile << """ | ||
version = '$projectCoordinates.version' | ||
group = '$projectCoordinates.group' | ||
configurations { | ||
myConfig.extendsFrom signatures | ||
} | ||
artifacts { | ||
myConfig jar | ||
} | ||
nexus { | ||
attachTests = true | ||
configuration = configurations.myConfig | ||
} | ||
modifyPom { | ||
project { | ||
name 'myapp' | ||
description 'My application' | ||
inceptionYear '2012' | ||
developers { | ||
developer { | ||
id 'bmuschko' | ||
name 'Benjamin Muschko' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
runTasks(integTestDir, MavenPlugin.INSTALL_TASK_NAME) | ||
|
||
then: | ||
def expectedFilenames = ["${projectCoordinates.name}-${projectCoordinates.version}.jar", | ||
"${projectCoordinates.name}-${projectCoordinates.version}.jar.asc", | ||
"${projectCoordinates.name}-${projectCoordinates.version}.pom", | ||
"${projectCoordinates.name}-${projectCoordinates.version}.pom.asc", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-javadoc.jar", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-javadoc.jar.asc", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-sources.jar", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-sources.jar.asc", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-tests.jar", | ||
"${projectCoordinates.name}-${projectCoordinates.version}-tests.jar.asc"] | ||
assertExistingFiles(installationDir, expectedFilenames) | ||
assertCorrectPomXml(new File(installationDir, "${projectCoordinates.name}-${projectCoordinates.version}.pom")) | ||
} | ||
|
||
def "Installs all configured JARs, metadata and signature artifacts for snapshot version with default configuration"() { | ||
setup: | ||
def projectCoordinates = [group: 'org.gradle.mygroup', name: 'integTest', version: '1.0-SNAPSHOT'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,45 @@ nexus { | |
assertExistingFiles(repoDir, expectedFilenames) | ||
} | ||
|
||
def "Uploads all configured JARs, customized metadata and signature artifacts with default configuration"() { | ||
when: | ||
buildFile << """ | ||
version = '1.0' | ||
group = 'org.gradle.mygroup' | ||
nexus { | ||
attachTests = true | ||
repositoryUrl = 'file://$integTestDir.canonicalPath/repo' | ||
} | ||
modifyPom { | ||
project { | ||
name 'myapp' | ||
description 'My application' | ||
inceptionYear '2012' | ||
developers { | ||
developer { | ||
id 'bmuschko' | ||
name 'Benjamin Muschko' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
GradleProject project = runTasks(integTestDir, 'uploadArchives') | ||
|
||
then: | ||
File repoDir = new File(integTestDir, 'repo/org/gradle/mygroup/integTest/1.0') | ||
def expectedFilenames = ["${project.name}-1.0.jar", "${project.name}-1.0.jar.asc", "${project.name}-1.0.pom", | ||
"${project.name}-1.0.pom.asc", "${project.name}-1.0-javadoc.jar", "${project.name}-1.0-javadoc.jar.asc", | ||
"${project.name}-1.0-sources.jar", "${project.name}-1.0-sources.jar.asc", "${project.name}-1.0-tests.jar", | ||
"${project.name}-1.0-tests.jar.asc"] | ||
assertExistingFiles(repoDir, expectedFilenames) | ||
assertCorrectPomXml(new File(repoDir, "${project.name}-1.0.pom")) | ||
} | ||
|
||
def "Uploads all configured JARs, metadata and signature artifacts for release version with custom configuration"() { | ||
when: | ||
buildFile << """ | ||
|
@@ -76,6 +115,54 @@ nexus { | |
assertExistingFiles(repoDir, expectedFilenames) | ||
} | ||
|
||
def "Uploads all configured JARs, customized metadata and signature artifacts with custom configuration"() { | ||
when: | ||
buildFile << """ | ||
version = '1.0' | ||
group = 'org.gradle.mygroup' | ||
configurations { | ||
myConfig.extendsFrom signatures | ||
} | ||
artifacts { | ||
myConfig jar | ||
} | ||
nexus { | ||
attachTests = true | ||
repositoryUrl = 'file://$integTestDir.canonicalPath/repo' | ||
configuration = configurations.myConfig | ||
} | ||
modifyPom { | ||
project { | ||
name 'myapp' | ||
description 'My application' | ||
inceptionYear '2012' | ||
developers { | ||
developer { | ||
id 'bmuschko' | ||
name 'Benjamin Muschko' | ||
email '[email protected]' | ||
} | ||
} | ||
} | ||
} | ||
""" | ||
GradleProject project = runTasks(integTestDir, 'uploadMyConfig') | ||
|
||
then: | ||
File repoDir = new File(integTestDir, 'repo/org/gradle/mygroup/integTest/1.0') | ||
def expectedFilenames = ["${project.name}-1.0.jar", "${project.name}-1.0.jar.asc", "${project.name}-1.0.pom", | ||
"${project.name}-1.0.pom.asc", "${project.name}-1.0-javadoc.jar", "${project.name}-1.0-javadoc.jar.asc", | ||
"${project.name}-1.0-sources.jar", "${project.name}-1.0-sources.jar.asc", "${project.name}-1.0-tests.jar", | ||
"${project.name}-1.0-tests.jar.asc"] | ||
assertExistingFiles(repoDir, expectedFilenames) | ||
assertCorrectPomXml(new File(repoDir, "${project.name}-1.0.pom")) | ||
} | ||
|
||
def "Uploads all configured JARs and metadata without signature artifacts for release version with default configuration"() { | ||
when: | ||
buildFile << """ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters