1+ import java.util.regex.Matcher
12
23plugins {
34 id ' net.researchgate.release' version ' 2.6.0'
45}
56
6- // it's a workaround for https://github.com/researchgate/gradle-release/issues/186
7- task build (dependsOn : [' :embedded-database-spring-test-core:build' , ' :embedded-database-spring-test-main:build' ])
7+ ext {
8+ ossrhUsername = project. findProperty(' ossrhUsername' )
9+ ossrhPassword = project. findProperty(' ossrhPassword' )
10+ }
811
912allprojects {
10- group ' io.zonky'
13+ group ' io.zonky.test '
1114}
1215
1316subprojects {
1417 apply plugin : ' java'
1518 apply plugin : ' maven'
16- apply plugin : ' maven-publish '
19+ apply plugin : ' signing '
1720
1821 sourceCompatibility = 1.8
1922
@@ -42,42 +45,96 @@ subprojects {
4245 useJUnit()
4346 }
4447
45- task sourcesJar(type : Jar , dependsOn : classes ) {
48+ task sourcesJar(type : Jar ) {
4649 classifier = ' sources'
4750 from sourceSets. main. allSource
4851 }
4952
50- task javadocJar(type : Jar , dependsOn : javadoc ) {
53+ task javadocJar(type : Jar ) {
5154 classifier = ' javadoc'
52- from javadoc. destinationDir
55+ from javadoc
5356 }
5457
55- publishing {
56- publications {
57- mavenJava(MavenPublication ) {
58- from components. java
59- artifact sourcesJar
60- artifact javadocJar
61- }
62- all {
63- pom. withXml {
64- asNode(). dependencies. ' *' . findAll() {
65- it. scope. text() == ' runtime' && project. configurations. compile. allDependencies. find { dep ->
66- dep. name == it. artifactId. text()
58+ artifacts {
59+ archives javadocJar, sourcesJar
60+ }
61+
62+ signing {
63+ required { gradle. taskGraph. hasTask(" uploadArchives" ) }
64+ sign configurations. archives
65+ }
66+
67+ uploadArchives {
68+ repositories {
69+ mavenDeployer {
70+ beforeDeployment { MavenDeployment deployment -> signing. signPom(deployment) }
71+
72+ repository(url : " https://oss.sonatype.org/service/local/staging/deploy/maven2/" ) {
73+ authentication(userName : ossrhUsername, password : ossrhPassword)
74+ }
75+
76+ snapshotRepository(url : " https://oss.sonatype.org/content/repositories/snapshots/" ) {
77+ authentication(userName : ossrhUsername, password : ossrhPassword)
78+ }
79+
80+ pom. project {
81+ name ' embedded-database-spring-test'
82+ packaging ' jar'
83+ description ' A library for creating isolated embedded databases for Spring-powered integration tests.'
84+ url ' https://github.com/zonkyio/embedded-database-spring-test'
85+
86+ scm {
87+ connection ' scm:git:git://github.com/zonkyio/embedded-database-spring-test.git'
88+ developerConnection ' scm:git:ssh://github.com:zonkyio/embedded-database-spring-test.git'
89+ url ' https://github.com/zonkyio/embedded-database-spring-test/tree/master'
90+ }
91+
92+ licenses {
93+ license {
94+ name ' The Apache License, Version 2.0'
95+ url ' http://www.apache.org/licenses/LICENSE-2.0.txt'
96+ }
97+ }
98+
99+ developers {
100+ developer {
101+ name ' Roman Pichlik'
102+ 103+ }
104+ developer {
105+ name ' Tomas Vanek'
106+ 107+ }
108+ developer {
109+ name ' Developers Zonky'
110+ 67111 }
68- }. each { it . scope * . value = ' compile ' }
112+ }
69113 }
70114 }
71115 }
72116 }
73117
74118 release {
119+ tagTemplate = ' v${version}'
120+ versionPatterns = [
121+ // increments the minor version: "1.0.0-SNAPSHOT" => "1.1.0-SNAPSHOT"
122+ / (\d +)\.\d +([^\d ]*$)/ : { Matcher m , Project p -> m. replaceAll(" ${ (m[0][1] as int) + 1} .0${ m[0][2]} " ) }
123+ ]
75124 git {
76125 requireBranch = ' ^(master|\\ d+\\ .\\ d+\\ .x)$'
77126 }
78127 }
79128}
80129
130+ project(' :embedded-database-spring-test-autoconfigure' ) {
131+ archivesBaseName = ' embedded-database-spring-test'
132+
133+ dependencies {
134+ compile project(' :embedded-database-spring-test-core' )
135+ }
136+ }
137+
81138project(' :embedded-database-spring-test-core' ) {
82139 dependencies {
83140 compile ' org.springframework:spring-context:4.3.10.RELEASE'
@@ -88,16 +145,24 @@ project(':embedded-database-spring-test-core') {
88145 }
89146}
90147
91- project(' :embedded-database-spring-test-main' ) {
92- dependencies {
93- compile project(' :embedded-database-spring-test-core' )
148+ task updateReadmeVersion () {
149+ doLast {
150+ def version = project. version. toString()
151+ ant. replaceregexp(file : ' README.md' , match : ' <version>\\ d+\\ .\\ d+\\ .\\ d+</version>' , replace : " <version>$version </version>" , flags : ' g' , byline : true )
94152 }
153+ }
95154
96- publishing {
97- publications {
98- mavenJava(MavenPublication ) {
99- artifactId ' embedded-database-spring-test'
100- }
101- }
155+ // workaround for https://github.com/researchgate/gradle-release/issues/186
156+ task build (group : ' build' ) {
157+ subprojects. each {
158+ dependsOn " ${ it.path} :build"
159+ }
160+ }
161+
162+ runBuildTasks. dependsOn updateReadmeVersion
163+
164+ afterReleaseBuild {
165+ subprojects. each {
166+ dependsOn " ${ it.path} :uploadArchives"
102167 }
103168}
0 commit comments