-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
165 lines (147 loc) · 4.99 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
import java.time.LocalDate
plugins {
id 'application'
id 'maven'
id 'checkstyle'
id 'findbugs'
id 'idea'
id 'eclipse'
id 'ninja.miserable.blossom' version '1.0.1'
id 'net.minecrell.licenser' version '0.3'
id 'com.github.johnrengelman.shadow' version '1.2.4'
}
version = getGitHash() + '-' + '0.1.0-SNAPSHOT'
repositories {
mavenCentral()
}
dependencies {
compile 'org.pircbotx:pircbotx:' + project.pircbotx
compile 'ninja.leaping.configurate:configurate-hocon:' + project.configurate_hocon
compile 'ninja.leaping.configurate:configurate-gson:' + project.configurate_gson
compile 'ch.qos.logback:logback-classic:' + project.logback_classic
compile 'com.google.code.findbugs:jsr305:' + project.jsr305
compile 'mysql:mysql-connector-java:' + project.mysql
compile 'com.google.inject:guice:' + project.guice
testCompile 'junit:junit:4.11'
}
//////////////////////////////////////////////////////
// APPLICATION PLUGIN //
//////////////////////////////////////////////////////
mainClassName = 'org.radicaldelta.ranger.Ranger'
//////////////////////////////////////////////////////
// BLOSSOM PLUGIN //
//////////////////////////////////////////////////////
blossom {
def loc = 'src/main/java/org/radicaldelta/ranger/Metadata.java'
replaceToken '${name}', project.name.toUpperCase(), loc
replaceToken '${description}', project.description, loc
replaceToken '${url}', project.url, loc
replaceToken '${gitHash}', getGitHash(), loc
replaceToken '${version}', ((String)project.version).replaceFirst('^([0-9a-f-]{8}|(unknown-))', ''), loc
}
//////////////////////////////////////////////////////
// CHECKSTYLE PLUGIN //
//////////////////////////////////////////////////////
checkstyle {
toolVersion = '6.19'
configFile = file('checkstyle.xml')
configProperties = [
'baseDir': project.projectDir,
'suppressions' : file('checkstyle-suppressions.xml'),
'severity' : 'error'
]
showViolations = true
}
//////////////////////////////////////////////////////
// IDEA PLUGIN //
//////////////////////////////////////////////////////
task genIdeaTasks(type: Copy) {
group 'Build Setup'
description 'Generate run tasks for IntelliJ'
from rootProject.file('extra/run-tasks/idea')
into rootProject.file('.idea/runConfigurations')
}
//////////////////////////////////////////////////////
// JAVA PLUGIN //
//////////////////////////////////////////////////////
sourceCompatibility = 1.8
javadoc {
options {
addStringOption (
'Xdoclint:none',
'-quiet'
)
charSet = 'UTF-8'
encoding = 'UTF-8'
links (
'https://docs.oracle.com/javase/8/docs/api/'
)
}
}
jar {
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': version
}
}
//////////////////////////////////////////////////////
// LICENSER PLUGIN //
//////////////////////////////////////////////////////
license {
ext {
name = project.name
vendor = project.vendor
url = project.url
inception = project.inception
present = LocalDate.now().getYear()
}
include '**/*.java'
header = file('HEADER')
}
//////////////////////////////////////////////////////
// MAVEN PLUGIN //
//////////////////////////////////////////////////////
uploadArchives {
repositories {
mavenDeployer {
repository(url: mavenLocal().url)
pom.project {
inceptionYear project.inception
licenses {
license {
name 'MIT'
url 'https://opensource.org/licenses/MIT'
distribution 'repo'
}
}
organization {
name project.vendor
url project.url
}
issueManagement {
system project.git_issues_name
url project.git_issues_url
}
scm {
connection project.scm_connection
developerConnection project.scm_connection
url project.git_source
}
}
}
}
}
//////////////////////////////////////////////////////
// SHADOWJAR PLUGIN //
//////////////////////////////////////////////////////
shadowJar {
manifest {
attributes 'Implementation-Title': project.name,
'Implementation-Version': version
}
}
def private String getGitHash() {
def process = 'git rev-parse --short HEAD'.execute()
process.waitFor()
return process.exitValue() ? 'unknown' : process.text.trim()
}