-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
189 lines (169 loc) · 5.2 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
def PACKAGE = 'com.erutulco.utils'
def ID = 'imladris-calendar'
def VERSION = '2.0.0'
def STATE = 'stable'
def NAME = 'Imladris Calendar'
def DESCRIPTION = 'Java library for manipulating Imladris Reckoning dates.'
def GITHUB_PATH = 'joaquingatica/imladris-calendar'
def GITHUB_MAIN = '//github.com/' + GITHUB_PATH
def GITHUB_HTTPS = 'https:' + GITHUB_MAIN
def URL = GITHUB_HTTPS
def BINTRAY_REPOSITORY = 'erutulco'
def LICENSE_ID = 'GPL-3.0'
def LICENSE_NAME = 'The GNU General Public License v3.0'
def LICENSE_URL = 'https://www.gnu.org/licenses/gpl-3.0.txt'
// Requires an existing local.properties file with the entries specified below
def props = new Properties()
file('local.properties').withInputStream { props.load(it) }
def MAVEN_DEVELOPER_ID = props.getProperty('maven.developer.id') ? props.getProperty('maven.developer.id') : System.getenv('MAVEN_DEVELOPER_ID')
def MAVEN_DEVELOPER_NAME = props.getProperty('maven.developer.name') ? props.getProperty('maven.developer.name') : System.getenv('MAVEN_DEVELOPER_NAME')
def MAVEN_DEVELOPER_EMAIL = props.getProperty('maven.developer.email') ? props.getProperty('maven.developer.email') : System.getenv('MAVEN_DEVELOPER_EMAIL')
def BINTRAY_USER = props.getProperty('bintray.user') ? props.getProperty('bintray.user') : System.getenv('BINTRAY_USER')
def BINTRAY_KEY = props.getProperty('bintray.apiKey') ? props.getProperty('bintray.apiKey') : System.getenv('BINTRAY_KEY')
def BINTRAY_PASS = props.getProperty('bintray.gpgPass') ? props.getProperty('bintray.gpgPass') : System.getenv('BINTRAY_PASS')
def GITHUB_CONNECTION = 'git:' + GITHUB_MAIN + '.git'
def GITHUB_SSH = 'ssh://' + GITHUB_MAIN + '.git'
def GITHUB_GIT = GITHUB_HTTPS + '.git'
def GITHUB_MASTER = GITHUB_HTTPS + '/tree/master'
def STATE_SUFFIX = '-' + STATE
if (STATE == 'stable') {
STATE_SUFFIX = ''
}
// ************
group PACKAGE
version ID
apply plugin: 'java'
sourceCompatibility = 1.7
targetCompatibility = 1.7
apply plugin: 'checkstyle'
checkstyle {
toolVersion = '7.5'
configFile = file('checkstyle.xml')
}
repositories {
jcenter()
}
dependencies {
compile 'commons-io:commons-io:2.5'
compile 'com.maxmind.geoip:geoip-api:1.2.11'
compile 'com.google.maps:google-maps-services:0.1.17'
compile 'com.luckycatlabs:SunriseSunsetCalculator:1.2'
}
jar {
baseName = ID
version = VERSION
classifier = STATE
}
task sourcesJar(type: Jar, dependsOn: classes) {
baseName = ID
version = VERSION
classifier = STATE + '-sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
baseName = ID
version = VERSION
classifier = STATE + '-javadoc'
from javadoc.destinationDir
}
task jarAll(dependsOn: ['jar', 'sourcesJar', 'javadocJar']) {}
// Publishing JAR tasks
task jarPublish(type: Jar) {
baseName = ID
version = VERSION
classifier = ''
from sourceSets.main.output
}
task sourcesJarPublish(type: Jar, dependsOn: classes) {
baseName = ID
version = VERSION
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJarPublish(type: Jar, dependsOn: javadoc) {
baseName = ID
version = VERSION
classifier = 'javadoc'
from javadoc.destinationDir
}
task jarAllPublish(dependsOn: ['jarPublish', 'sourcesJarPublish', 'javadocJarPublish']) {}
artifacts {
archives jarPublish
archives sourcesJarPublish
archives javadocJarPublish
}
// Maven publishing
apply plugin: 'maven-publish'
// POM file setup
def pomConfig = {
licenses {
license {
name LICENSE_NAME
url LICENSE_URL
distribution "repo"
}
}
developers {
developer {
id MAVEN_DEVELOPER_ID
name MAVEN_DEVELOPER_NAME
email MAVEN_DEVELOPER_EMAIL
}
}
scm {
connection 'scm:git:' + GITHUB_CONNECTION
developerConnection 'scm:git:' + GITHUB_SSH
url GITHUB_MASTER
}
}
publishing {
publications {
MavenJava(MavenPublication) {
groupId PACKAGE
artifactId ID
version VERSION + STATE_SUFFIX
from project.components.java
artifact jarPublish
artifact sourcesJarPublish
artifact javadocJarPublish
pom.withXml {
def root = asNode()
root.appendNode('description', DESCRIPTION)
root.appendNode('name', NAME)
root.appendNode('url', URL)
root.children().last() + pomConfig
}
}
}
}
// Bintray publishing
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
apply plugin: 'com.jfrog.bintray'
bintray {
user = BINTRAY_USER
key = BINTRAY_KEY
publications = ['MavenJava']
pkg {
repo = BINTRAY_REPOSITORY
name = ID
licenses = [LICENSE_ID]
vcsUrl = GITHUB_GIT
version {
name = VERSION + STATE_SUFFIX
desc = NAME + ' release ' + VERSION + ' ' + STATE
released = new Date()
vcsTag = VERSION + STATE_SUFFIX
gpg {
sign = true
passphrase = BINTRAY_PASS
}
}
}
}