-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.gradle
248 lines (196 loc) · 7.39 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'net.nisgits.gradle:gradle-executable-jar-plugin:1.7.0' // executable jar plugin
}
}
def scalaLibraryDependency = 'org.scala-lang:scala-library:2.11.12'
def scalaXmlDependency = 'org.scala-lang.modules:scala-xml_2.11:1.2.0'
def scalaParsingDependency = 'org.scala-lang.modules:scala-parser-combinators_2.11:1.1.2'
def junitDependency = 'junit:junit:4.12'
def scalaTestDependency = 'org.scalatest:scalatest_2.11:2.2.6'
def hamcrestAllDependency = 'org.hamcrest:hamcrest-all:1.3'
def asmDependency = 'org.ow2.asm:asm:7.1'
def graphCoreDependency = 'com.assembla.scala-incubator:graph-core_2.11:1.9.4'
def scallopDependency = 'org.rogach:scallop_2.11:0.9.6'
def isRepositoryOwner = hasProperty('ossrhUsername')
def degraphDescription = 'Degraph is a library for producing jvm package dependency graphs for visual inspection ' +
'as well as writing tests for checking properties of the dependencies. '
try { // fails when there is no network available
apply from: 'http://tellurianring.com/projects/gradle-plugins/gradle-release/1.1/apply.groovy'
createReleaseTag.dependsOn(':degraph:pushToBintray')
createReleaseTag.dependsOn(':core:pushToBintray')
createReleaseTag.dependsOn(':check:pushToBintray')
} catch (RuntimeException re) {
System.out.println('releasing not possible (probably no network)')
}
allprojects {
apply plugin: 'scala'
apply plugin: 'idea'
apply plugin: 'maven'
if (isRepositoryOwner)
apply plugin: 'signing'
group = 'de.schauderhaft.degraph'
// Following are workarounds to idea goal failing on:
// Cannot infer Scala class path because..
// - no repository is declared in root project
repositories { jcenter() }
// - no Scala library Jar was found
// apply from: "$rootDir/gradle/dependencies.gradle"
dependencies {
compile scalaLibraryDependency
}
}
subprojects {
targetCompatibility = 1.8
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
testCompile junitDependency
testCompile scalaTestDependency
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from scaladoc
}
javadocJar.dependsOn scaladoc
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives javadocJar, sourcesJar
}
if (isRepositoryOwner) {
prepareForMavenCentral(project, description)
}
}
project('core') {
description = degraphDescription + 'The core module makes up the main logic of Degraph independent of any UI.'
archivesBaseName = 'degraph-core'
createBintrayTasks(project, 'jar')
dependencies {
compile scalaLibraryDependency
compile scalaXmlDependency
compile scalaParsingDependency
compile asmDependency
compile graphCoreDependency
}
}
project('check') {
description = degraphDescription + 'The check module allows to write unit tests using scalatest, or junit'
archivesBaseName = 'degraph-check'
createBintrayTasks(project, 'jar')
dependencies {
compile project(':core')
compile scalaTestDependency
compile hamcrestAllDependency
}
}
project('degraph') {
apply plugin: 'application'
description = degraphDescription + 'The degraph module is a command line application for creating dependency graphs.'
mainClassName = 'de.schauderhaft.degraph.app.Degraph'
applicationDistribution.from(['license.txt', 'readme.markdown', 'releaseNotes.md']) {
into '/'
}
applicationDistribution.from('src/demo/resource') {
into '/example/'
}
createBintrayTasks(project, 'zip')
distZip.dependsOn scaladoc
dependencies {
compile project(':core')
compile scallopDependency
}
}
project('jdk8tests') {
sourceCompatibility = 1.8
dependencies {
compile project(':core')
testCompile junitDependency
testCompile scalaTestDependency
}
}
private def createBintrayTasks(project, String artefactType) {
if (hasProperty('bintrayApiKey')) {
project.with {
task pushToBintray(type: Exec) {
commandLine 'curl',
'-T',
'--proxy', sbsMavenUser + ':' + sbsMavenPassword + '@https://www-le.dienste.telekom.de:8080',
'build/' + artefactDir(artefactType) + project.name + '-' + version + '.' + artefactType,
'-uschauder:' + bintrayApiKey,
'https://api.bintray.com/content/schauder/schauderhaft-de/Degraph/' + version + '/degraph-' + project.name + '-' + version + '.' + artefactType
}
pushToBintray.dependsOn(dependsOn(artefactType))
}
}
}
private String dependsOn(String artefactType) {
if (artefactType == 'zip') {
return 'distZip'
} else if (artefactType == 'jar') {
return 'install'
} else {
throw new IllegalArgumentException("don't know how to handle " + artifactType)
}
}
private String artefactDir(String artefactType) {
if (artefactType == 'zip') {
return 'distributions/'
} else if (artefactType == 'jar') {
return 'libs/degraph-'
} else {
throw new IllegalArgumentException("don't know how to handle " + artifactType)
}
}
private def prepareForMavenCentral(project, degraphDescription) {
project.with {
signing {
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'Degraph'
packaging 'jar'
// optionally artifactId can be defined here
description degraphDescription
url 'http://schauder.github.io/degraph/'
scm {
connection 'scm:git:https://github.com/schauder/degraph.git'
developerConnection 'scm:git:https://github.com/schauder/degraph.git'
url 'https://github.com/schauder/degraph.git'
}
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id 'schauder'
name 'Jens Schauder'
email '[email protected]'
}
}
}
}
}
}
}
}