This repository has been archived by the owner on Apr 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
211 lines (176 loc) · 6 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
import com.github.spotbugs.SpotBugsTask
plugins {
id 'com.github.spotbugs' version '1.6.2'
id 'com.jfrog.bintray' version '1.8.4'
id 'org.ajoberstar.grgit' version '2.3.0'
id 'org.sonarqube' version '2.6.2'
}
apply plugin: 'org.ajoberstar.grgit'
allprojects {
repositories {
jcenter() // JDA, maybe others
mavenCentral() // everything else
mavenLocal() // local maven repo, mostly for testing stuff
maven { url 'https://jitpack.io' } // for getting builds from github
}
apply plugin: 'idea'
ext {
gradleVers = '4.8.1'
}
group = 'space.npstr.SqlSauce'
version = "${getMyVersion()}"
}
subprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'com.github.spotbugs'
apply plugin: 'jacoco'
apply plugin: 'com.jfrog.bintray'
sourceCompatibility = 8
targetCompatibility = 8
compileJava.dependsOn clean
compileJava.options.encoding = 'UTF-8'
compileJava.options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
jar.mustRunAfter clean
jar.dependsOn spotbugsMain
publishToMavenLocal.dependsOn jar
task install {
dependsOn publishToMavenLocal
}
build {
dependsOn install
dependsOn test
}
task pub {
dependsOn install
dependsOn bintrayUpload
bintrayUpload.mustRunAfter(install)
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier 'sources'
}
test {
useJUnitPlatform()
}
// To generate an HTML report instead of XML
tasks.withType(SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}
configurations {
// Make the compileOnly dependencies available when compiling/running tests
testCompile.extendsFrom compileOnly
}
ext {
jpaVersion = '2.2'
postgresDriverVersion = '42.2.4'
hibernateVersion = '5.3.2.Final'
hikariVersion = '3.2.0'
hibTypesVersion = '2.2.2'
guavaVersion = '25.1-jre'
dsProxyVersion = '1.4.9'
flywayVersion = '5.1.4'
jaxbApiVersion = '2.3.0'
slf4jApiVersion = '1.7.25'
annotationsVersion = '0.0.1'
spotbugsVersion = '3.1.5'
prometheusVersion = '0.4.0'
//discord entities module
jdaVersion = '4.1.1_136'
//notifications module
jsonOrgVersion = '20180130'
//testing
jUnitVersion = '5.2.0'
logbackVersion = '1.2.3'
}
dependencies { //for each module
compile group: 'javax.persistence', name: 'javax.persistence-api', version: jpaVersion
//optional various/QA deps
compileOnly group: 'org.slf4j', name: 'slf4j-api', version: slf4jApiVersion //logging framework
compileOnly group: 'com.github.spotbugs', name: 'spotbugs-annotations', version: spotbugsVersion //annotations
compileOnly group: 'space.npstr', name: 'annotations', version: annotationsVersion //advanced annotations
//testing
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: jUnitVersion
testRuntime group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: jUnitVersion
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: logbackVersion
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar
groupId project.group
artifactId project.name
version project.version
pom {
name = 'SqlSauce'
description = 'SQL tech stack on top of PostgreSQL, HikariCP, Hibernate'
url = 'https://github.com/napstr/SqlSauce'
licenses {
license {
name = 'MIT License'
url = 'https://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
developers {
developer {
name = 'Napster'
email = '[email protected]'
}
}
scm {
url = 'https://github.com/napstr/SqlSauce'
}
}
}
}
}
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY')
publications = ['mavenJava']
filesSpec {
from('build/libs')
into '.'
}
dryRun = false
publish = true
override = true
pkg {
repo = 'SqlSauce'
name = project.name
userOrg = user
licenses = ['MIT']
vcsUrl = 'https://github.com/napstr/SqlSauce'
version {
name = project.version
}
}
}
}
wrapper {
gradleVersion = gradleVers
//noinspection UnnecessaryQualifiedReference
distributionType = Wrapper.DistributionType.ALL
}
//returns either a git tag if there is one on this commit in the form of MAJOR.MINOR.PATCH,
//or the last such tag with "-SNAPSHOT" appended.
@SuppressWarnings("GrMethodMayBeStatic")
String getMyVersion() {
def matcher = /^([0-9]+\.[0-9]+\.[0-9]+)(.*)$/
def match = ("${grgit.describe()}" =~ matcher)[0]
//noinspection GroovyAssignabilityCheck
def result = match[1]
//noinspection GroovyAssignabilityCheck
def dirty = match[2]
if (dirty.length() > 0) {
result += '-SNAPSHOT'
}
println("Version: " + result)
return result
}