-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.gradle
203 lines (170 loc) · 5.18 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
// include the BinTray repository
buildscript {
repositories {
jcenter()
maven { url "http://dl.bintray.com/palantir/releases" }
}
dependencies {
classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
classpath 'com.palantir:gradle-gitsemver:0.7.0'
}
}
plugins {
id 'com.palantir.git-version' version '0.11.0'
}
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'com.bmuschko.nexus'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'gitsemver'
apply plugin: 'maven'
apply plugin: 'com.github.johnrengelman.shadow'
group = 'com.github.geoframecomponents'
archivesBaseName = 'jswmm'
def projectName = "jswmm"
def projectDescription = "java version of jswmm"
// artifactId is taken by default, from folder name
version = '0.1-SNAPSHOT'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
sourceCompatibility = '1.8'
// Warning! IJ has a bug here..https://youtrack.jetbrains.com/issue/IDEA-141750
sourceSets {
main{
}
test {
}
}
// to get project version from command line, just type
// $ gradle -PprojVersion=<version_number> build
// default is na
if (project.hasProperty('projVersion')) {
project.version = project.projVersion
} else {
project.version = gitVersion()
}
// name with versioning of the jar file
jar {
baseName = projectName
manifest {
attributes 'Implementation-Title' : projectName,
'Implementation-Version': version
}
}
repositories {
maven {
// geotools
url 'http://download.osgeo.org/webdav/geotools/'
}
mavenCentral()
jcenter()
flatDir {
dirs 'lib'
}
}
dependencies {
compile name: 'oms-all'
compile name: 'inpparser-all'
compile 'com.github.geoframecomponents:GEOframeUtils:0.4'
compile 'commons-lang:commons-lang:2.3'
compile 'org.apache.commons:commons-math3:3.6.1'
compile group: 'org.apache.commons', name: 'commons-configuration2', version: '2.0'
compile 'junit:junit:4.12'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
shadowJar {
mergeServiceFiles()
archiveName = project.name + "-" + project.version + "-all.jar"
}
// custom tasks for creating source/javadoc jars
task sJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task jJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
// add javadoc/source jar tasks as artifacts
artifacts {
archives sJar, jJar
}
def pomConfig = {
scm {
connection 'scm:git:https://github.com/geoframecomponents/jswmm.git'
developerConnection 'scm:git:https://github.com/geoframecomponents/jswmm.git'
url 'https://github.com/geoframecomponents/jswmm'
}
licenses {
license {
name 'General Public License V.3 (GPL3)'
url 'http://www.gnu.org/licenses/gpl.html'
}
}
developers {
developer {
id 'ftt01'
name 'Daniele Dalla Torre'
email '[email protected]'
}
}
}
nexus {
sign = false
}
publishing {
publications {
MyPublication(MavenPublication) {
from components.java
artifact sJar
artifact jJar
groupId 'com.github.geoframecomponents'
artifactId 'jswmm'
version project.version
pom.withXml {
def root = asNode()
root.appendNode('description', 'Java version of SWMM')
root.appendNode('name', 'jswmm')
root.appendNode('url', 'https://github.com/geoframecomponents/jswmm')
root.children().last() + pomConfig
}
}
}
}
// bintray sync
if (hasProperty('bintrayUsername') ||
System.getenv().containsKey('BINTRAY_USER')) {
// Used by the bintray plugin
bintray {
user = System.getenv().getOrDefault('BINTRAY_USER', bintrayUsername)
key = System.getenv().getOrDefault('BINTRAY_KEY', bintrayApiKey)
publish = true
publications = ['MyPublication']
pkg {
repo = 'geoframecomponents'
name = projectName
licenses = ['GPL-3.0']
vcsUrl = 'https://github.com/geoframecomponents/jswmm.git'
version {
name = project.version
desc = projectDescription
released = new Date()
gpg {
sign = true
passphrase = System.getenv().getOrDefault('PASSPHRASE',
bintrayPassphrase)
}
mavenCentralSync {
user = System.getenv().getOrDefault('SONATYPE_USER',
nexusUsername)
password = System.getenv().getOrDefault('SONATYPE_PASSWORD',
nexusPassword)
}
}
}
configurations = ['archives']
}
}