forked from ben-manes/gradle-versions-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
202 lines (171 loc) · 5.3 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
plugins {
id 'com.jfrog.bintray' version '1.8.5'
id 'java-gradle-plugin'
id 'maven-publish'
id 'groovy'
id 'codenarc'
}
repositories {
jcenter()
}
group = 'com.github.ben-manes'
version = '0.37.0'
sourceCompatibility = '1.8'
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
termsOfServiceAgree = 'yes'
}
tasks.wrapper {
distributionType 'all'
}
codenarcMain {
configFile = file('config/codenarc/rules.groovy')
}
codenarcTest {
configFile = file('config/codenarc/testrules.groovy')
}
tasks.withType(CodeNarc) { codeNarcTask ->
codeNarcTask.ignoreFailures = true
}
// Write the plugin's classpath to a file to share with the tests
task createClasspathManifest {
def outputDir = file("$buildDir/$name")
inputs.files sourceSets.main.runtimeClasspath
outputs.dir outputDir
doLast {
outputDir.mkdirs()
file("$outputDir/plugin-classpath.txt").text = sourceSets.main.runtimeClasspath.join("\n")
}
}
// Add the classpath file to the test runtime classpath
dependencies {
implementation gradleApi()
implementation 'com.thoughtworks.xstream:xstream:1.4.15'
testRuntimeOnly files(createClasspathManifest)
testImplementation gradleTestKit()
testImplementation('org.spockframework:spock-core:1.3-groovy-2.5') {
exclude(module: 'groovy-all')
}
}
jar {
manifest {
attributes(
'Implementation-Title': 'Gradle Versions plugin',
'Implementation-Version': archiveVersion,
'Built-By': System.getProperty('user.name'),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion
)
}
}
tasks.withType(Test) {
maxParallelForks Runtime.getRuntime().availableProcessors()
testLogging {
events "passed", "failed", "skipped"
showStandardStreams true
exceptionFormat "full"
}
}
task docsJar(type: Jar, dependsOn: groovydoc) {
group = 'Publications'
description = 'Create jar of documentation.'
archiveClassifier = 'docs'
from groovydoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
group = 'Publications'
description = 'Create jar of sources.'
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
task testsJar(type: Jar) {
group = 'Publications'
description = 'Create jar of tests.'
archiveClassifier = 'tests'
from sourceSets.test.output
}
task reportsZip(type: Zip, dependsOn: check) {
group = 'Publications'
description = 'Create a zip of all reports.'
archiveClassifier = 'reports'
from reporting.baseDir
}
// Local published to ~/.m2 - mavenLocal()
publishing {
repositories {
mavenLocal()
}
publications {
pluginMaven(MavenPublication) {
artifact docsJar
artifact sourcesJar
artifact testsJar
artifact reportsZip
pom {
resolveStrategy = Closure.DELEGATE_FIRST
name = 'Gradle Versions plugin'
description = 'Gradle plugin that provides tasks for discovering dependency updates.'
url = 'https://github.com/ben-manes/gradle-versions-plugin'
inceptionYear = '2012'
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'ben-manes'
name = 'Ben Manes'
email = '[email protected]'
}
developer {
id = 'zenedith'
name = 'Zenedith'
email = '[email protected]'
}
developer {
id = 'jochenberger'
name = 'Jochen Berger'
}
}
issueManagement {
system = 'github'
url = 'https://github.com/ben-manes/gradle-versions-plugin/issues'
}
scm {
url = 'https://github.com/ben-manes/gradle-versions-plugin'
connection = 'scm:https://[email protected]/ben-manes/gradle-versions-plugin.git'
developerConnection = 'scm:git://github.com/ben-manes/gradle-versions-plugin.git'
}
}
}
}
}
publish.dependsOn jar, docsJar, sourcesJar, testsJar, reportsZip
publish.dependsOn 'generatePomFileForPluginMavenPublication'
// Publishes to JFrog Bintray's JCenter repository
bintray {
user = project.properties['BINTRAY_USERNAME'] ?: System.env.'BINTRAY_USERNAME'
key = project.properties['BINTRAY_API_KEY'] ?: System.env.'BINTRAY_API_KEY'
configurations = ['archives']
publish = true
pkg {
repo = 'maven'
name = 'com.github.ben-manes:gradle-versions-plugin'
desc = 'Gradle plugin that provides tasks for discovering dependency updates.'
websiteUrl = 'https://github.com/ben-manes/gradle-versions-plugin'
issueTrackerUrl = 'https://github.com/ben-manes/gradle-versions-plugin/issues'
vcsUrl = 'https://github.com/ben-manes/gradle-versions-plugin'
labels = ['gradle', 'plugin', 'versions']
githubRepo = 'ben-manes/gradle-versions-plugin'
githubReleaseNotesFile = 'README.md'
version {
desc = 'Gradle plugin that provides tasks for discovering dependency updates.'
attributes = ['gradle-plugin': 'com.github.ben-manes.versions:com.github.ben-manes:gradle-versions-plugin']
}
}
}
bintrayUpload.dependsOn jar, docsJar, sourcesJar, testsJar, reportsZip
bintrayUpload.dependsOn 'generatePomFileForPluginMavenPublication'