-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle
224 lines (191 loc) · 6.92 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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'maven-publish' // for bintray
apply plugin: 'signing' // for oss
apply plugin: 'codenarc'
apply plugin: 'com.jfrog.bintray'
/**** Uncomment this to get faster build times ****/
//build.dependsOn.remove("check")
/**************************************************/
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
classpath 'org.codehaus.groovy:groovy-backports-compat23:2.4.7'
}
}
repositories {
jcenter()
mavenCentral()
}
group = 'com.tkruse.gradle'
version = '1.0.9-SNAPSHOT'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
def compatibilityVersion = 1.7
sourceCompatibility = compatibilityVersion
targetCompatibility = compatibilityVersion
// ********* Testing & Checks
codenarcMain.maxPriority2Violations = 3
codenarcTest.maxPriority2Violations = 1
codenarc {
configFile = file('config/codenarc/rules.groovy')
toolVersion = '0.25.2'
}
tasks.withType(CodeNarc) { codeNarcTask ->
codeNarcTask.ignoreFailures = true
}
test {
testLogging {
exceptionFormat = "full" // default is "short"
}
}
dependencies {
compile gradleApi()
if (gradle.gradleVersion.startsWith('1')) {
compile "jline:jline:1.0"
} else {
compile "jline:jline:2.11"
}
if (gradle.gradleVersion.startsWith('1')) {
// no conflict
compile('org.codehaus.groovy:groovy-all:2.4.4') { force = true }
} else if (gradle.gradleVersion.startsWith('2.0')) {
compile('org.codehaus.groovy:groovy-all:2.3.3') { force = true }
} else if (gradle.gradleVersion == ('2.1')
|| gradle.gradleVersion.startsWith('2.2')
|| (gradle.gradleVersion.startsWith('2.3'))
|| (gradle.gradleVersion.startsWith('2.4'))) {
compile('org.codehaus.groovy:groovy-all:2.3.6') { force = true }
} else if (gradle.gradleVersion.startsWith('2.5')) {
compile('org.codehaus.groovy:groovy-all:2.3.10') { force = true }
} else if (gradle.gradleVersion.startsWith('2.6')
|| gradle.gradleVersion.startsWith('2.7')) {
compile('org.codehaus.groovy:groovy-all:2.3.10') { force = true }
} else {
compile('org.codehaus.groovy:groovy-all:2.4.4') { force = true }
}
runtime('commons-cli:commons-cli:1.2')
testCompile("junit:junit-dep:4.11")
}
task sourcesJar( type: Jar ) {
classifier 'sources'
from sourceSets.main.allSource
}
task groovydocJar( type: Jar ) {
classifier 'javadoc'
from groovydoc
}
task javadocJar (type: Jar, dependsOn: javadoc) { // (1)
classifier = 'javadoc'
from javadoc.destinationDir
}
// ********* Note to myself: Release steps
// run gradle clean check
// push to develop
// wait for travis to be happy
// check README.md and CHANGELOG
// remove -SNAPSHOT in build.gradle (2x) and samples/build.gradle from version (in README too)
// ./gradlew clean assemble uploadArchives generatePomFileForMavenJavaPublication bintrayUpload
// git tag
// push to master with --tags
// Then see instructions below
// Finally bump to next version + -SNAPSHOT also in README and push to develop (not master!)
artifacts {
archives sourcesJar
archives groovydocJar
archives javadocJar
}
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Groovysh plugin',
'Implementation-Version': version,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion
}
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
/************ Maven central
* go to
* https://oss.sonatype.org/#stagingRepositories
* check all is good. If so, find the repo, select, close, wait until closed, then release
*
* Also see:
* https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
* http://central.sonatype.org/pages/releasing-the-deployment.html
* http://yennicktrevels.com/blog/2013/10/11/automated-gradle-project-deployment-to-sonatype-oss-repository/
*/
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(
userName: (project.hasProperty( 'sonatypeUsername' ) ? project.getProperty( 'sonatypeUsername' ) : null),
password: (project.hasProperty( 'sonatypePassword' ) ? project.getProperty( 'sonatypePassword' ) : null))
}
pom.project {
name project.name
packaging 'jar'
description project.description
url 'https://github.com/tkruse/gradle-groovysh-plugin'
scm {
url 'https://github.com/tkruse/gradle-groovysh-plugin'
connection 'scm:git:git://tkruse/gradle-groovysh-plugin.git'
developerConnection 'scm:git:ssh:[email protected]:tkruse/gradle-groovysh-plugin.git'
}
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/license/LICENSE-2.0.txt'
distribution 'repo'
}
}
developers {
developer {
id 'tkruse'
name 'Thibault Kruse'
email project.hasProperty( 'email' ) ? project.getProperty( 'email' ) : null
}
}
}
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact groovydocJar
}
}
}
/********* Bintray
* go to https://bintray.com/tkruse/maven/gradle-groovysh-plugin and hit publish
*
* Set bintray version attribute ('Edit' button on *version*, not package)
* 'gradle-plugin', 'com.github.tkruse.groovysh:com.tkruse.gradle:gradle-groovysh-plugin'
* check gradle portal after a few minutes: http://plugins.gradle.org/search?term=groovysh
*
* also see: https://github.com/bintray/gradle-bintray-plugin
*/
bintray {
user = project.hasProperty( 'bintrayUser' ) ? project.getProperty( 'bintrayUser' ) : null
key = project.hasProperty( 'bintrayKey' ) ? project.getProperty( 'bintrayKey' ) : null
publications = ['mavenJava']
pkg {
repo = 'maven'
name = 'gradle-groovysh-plugin'
desc = 'A gradle plugin to start command-line shells with your Application classes.'
licenses = ['Apache-2.0']
labels = ['groovysh', 'groovy', 'shell']
}
// dryRun = true
}