-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
204 lines (171 loc) · 6.1 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
plugins {
// project plugins
id 'java-gradle-plugin'
id 'groovy'
// test coverage
id 'jacoco'
// ide plugin
id 'idea'
// intershop test plugin
id 'com.intershop.gradle.test' version '2.2.0'
// publish plugin
id 'maven-publish'
// artifact signing - necessary on Maven Central
id 'signing'
// intershop version plugin
id 'com.intershop.gradle.scmversion' version '2.7.4'
// plugin for publishing to Gradle Portal
id 'com.gradle.plugin-publish' version '0.20.0'
}
scm {
version {
initialVersion = '1.0.0'
}
}
group = 'com.intershop.gradle.sonarqube'
description = 'Gradle plugin to analyze Intershop Components with SonarQube'
version = scm.version.version
sourceCompatibility = 1.8
targetCompatibility = 1.8
test {
if(project.hasProperty('sonarHostUrl')) {
systemProperty 'sonarHostUrl', project.sonarHostUrl
}
// Gradle versions for test
systemProperty 'intershop.gradle.versions', '2.11'
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
task groovydocJar(type: Jar) {
dependsOn groovydoc
classifier = 'javadoc'
from groovydoc.destinationDir
}
// additional sources artifact
task sourceJar(type: Jar) {
from sourceSets.main.allSource
}
artifacts {
archives jar
archives sourceJar
archives groovydocJar
}
publishing {
publications {
intershopMvn(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
artifact groovydocJar {
classifier "javadoc"
}
pom.withXml {
def root = asNode();
root.appendNode('name', project.name)
root.appendNode('description', project.description)
root.appendNode('url', "https:/gitlab.intershop.de/IntershopGradlePlugins/${project.name}")
def organisation = root.appendNode( 'organization' )
organisation.appendNode("name", "Intershop Communications AG")
organisation.appendNode("url", "http://intershop.com")
def scm = root.appendNode( 'scm' )
scm.appendNode( 'url', "https://github.com/IntershopCommunicationsAG/${project.name}")
scm.appendNode( 'connection', "git@github.com:IntershopCommunicationsAG/${project.name}.git")
scm.appendNode( 'developerConnection', "git@github.com:IntershopCommunicationsAG/${project.name}.git")
def license = root.appendNode( 'licenses' ).appendNode( 'license' )
license.appendNode( 'name', 'Apache License, Version 2.0' )
license.appendNode( 'url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
license.appendNode( 'distribution', 'repo' )
def developer = root.appendNode('developers').appendNode( 'developer' )
developer.appendNode( 'id', 'm-raab' )
developer.appendNode( 'name', 'M. Raab' )
developer.appendNode( 'email', 'mraab@intershop.de' )
def pomFile = file("${project.buildDir}/generated-pom.xml")
writeTo(pomFile)
def pomAscFile = signing.sign(pomFile).signatureFiles[0]
artifact(pomAscFile) {
classifier = null
extension = 'pom.asc'
}
}
// create the signed artifacts
project.tasks.signArchives.signatureFiles.each {
artifact(it) {
def matcher = it.file =~ /-(sources|javadoc)\.(jar)\.asc$/
def ref_matcher = it.file =~ /\.html\.asc$/
def doc_matcher = it.file =~ /\.xml\.asc$/
if (matcher.find()) {
classifier = matcher.group(1)
extension = "jar.asc"
} else {
if(ref_matcher.find()) {
classifier = 'reference'
extension = 'html.asc'
}
else if(doc_matcher.find()) {
classifier = 'docbook'
extension = 'xml.asc'
} else {
classifier = null
extension = 'jar.asc'
}
}
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots"
url = uri(version.toString().endsWith("SNAPSHOT") ? snapshotsRepoUrl : releasesRepoUrl)
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}
signing {
sign configurations.archives
}
pluginBundle {
website = "https://github.com/IntershopCommunicationsAG/${project.name}"
vcsUrl = "https://github.com/IntershopCommunicationsAG/${project.name}"
description = project.description
tags = ['intershop', 'sonarqube', 'build', 'code', 'analysis']
plugins {
gradleTestPlugin {
id = 'com.intershop.gradle.sonarQube'
displayName = project.description
}
}
}
dependencies {
compile('com.google.guava:guava:17.0')
testCompile('org.spockframework:spock-core:1.0-groovy-2.4'){
exclude group: 'org.codehaus.groovy'
}
testCompile 'commons-io:commons-io:2.2'
}
repositories {
mavenCentral()
maven {
url = uri("https://plugins.gradle.org/m2/")
}
}
model {
tasks.generatePomFileForIntershopMvnPublication {
destination = file("$buildDir/generated-pom.xml")
}
tasks.publishIntershopMvnPublicationToMavenLocal {
dependsOn project.tasks.signArchives
}
tasks.publishIntershopMvnPublicationToMavenRepository {
dependsOn project.tasks.signArchives
}
}