forked from spockframework/spock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The spock-bom project generates a Maven compatible bill of materials pom.xml which manages all spock artifacts.
- Loading branch information
Showing
3 changed files
with
79 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
include "spock-bom" | ||
include "spock-core" | ||
include "spock-specs" | ||
include "spock-spring" | ||
|
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
plugins { | ||
id 'maven' | ||
} | ||
|
||
def modifyBom = { xml -> | ||
def projectNode = xml.asNode() | ||
|
||
projectNode.remove(projectNode['dependencies'][0]) // remove default dependency section | ||
|
||
projectNode['version'] + { // add packaging next to version | ||
packaging 'pom' | ||
} | ||
|
||
projectNode.appendNode('properties').appendNode('spock.version', project.fullVersion) | ||
|
||
def dependencyManagement = projectNode.appendNode('dependencyManagement').appendNode('dependencies') | ||
|
||
def mvnProjects = project.parent.subprojects.findAll { it.hasProperty('install') } // find all published projects | ||
mvnProjects -= project // don't self reference | ||
|
||
mvnProjects.name.each { | ||
dependencyManagement.appendNode('dependency').with { dep -> | ||
dep.appendNode('groupId', project.group) | ||
dep.appendNode('artifactId', it) | ||
dep.appendNode('version', '${spock.version}') | ||
} | ||
} | ||
} | ||
|
||
displayName = "Spock Framework - Bill of Materials" | ||
|
||
description = '''This bill of materials provides managed spock dependencies.''' | ||
|
||
def bom = { | ||
project { | ||
name project.displayName | ||
description project.description | ||
url "http://spockframework.org" | ||
|
||
licenses { | ||
license { | ||
name "The Apache Software License, Version 2.0" | ||
url "http://www.apache.org/licenses/LICENSE-2.0.txt" | ||
distribution "repo" | ||
} | ||
} | ||
} | ||
} | ||
task writeBom << { | ||
pom(bom).withXml(modifyBom) .writeTo("$buildDir/pom.xml") | ||
} | ||
|
||
def deployers = [] | ||
|
||
project.afterEvaluate { | ||
configure(deployers) { | ||
pom(bom).withXml(modifyBom) | ||
} | ||
} | ||
|
||
install { | ||
deployers << repositories.mavenInstaller | ||
} | ||
|
||
uploadArchives { | ||
deployers << repositories.mavenDeployer { | ||
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") { | ||
authentication(userName: "pniederw", password: System.getenv("SONATYPE_OSS_PASSWORD")) | ||
} | ||
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") { | ||
authentication(userName: "pniederw", password: System.getenv("SONATYPE_OSS_PASSWORD")) | ||
} | ||
} | ||
} | ||
|
||
deployers*.beforeDeployment { signing.signPom(it) } |