-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
167 lines (144 loc) · 4.19 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
import org.ajoberstar.grgit.Grgit
import org.apache.tools.ant.filters.*
import java.text.SimpleDateFormat
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
// Add dependency for build script,
// so we can access Git from our
// build script.
classpath 'org.ajoberstar:grgit:1.1.0'
classpath 'edu.sc.seis.gradle:launch4j:2.4.4'
classpath 'gradle.plugin.de.fntsoftware.gradle:markdown-to-pdf:1.1.0'
}
}
plugins {
id 'com.gladed.androidgitversion' version '0.4.4'
id "io.freefair.lombok" version "4.1.0"
id 'com.github.johnrengelman.shadow' version '5.0.0'
}
apply plugin: 'java'
apply plugin:'application'
apply plugin: 'pmd'
apply plugin: 'findbugs'
apply plugin: 'jacoco'
apply plugin: 'edu.sc.seis.launch4j'
apply plugin: 'de.fntsoftware.gradle.markdown-to-pdf'
ext {
// Open the Git repository in the current directory.
git = Grgit.open(file('.'))
// Get commit id of HEAD.
revision = git.head().id
// Alternative is using abbreviatedId of head() method.
// revision = git.head().abbreviatedId
}
/*
* Gets the version name from the latest Git tag
*/
def getVersionTag = { ->
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags'
standardOutput = stdout
}
return stdout.toString().trim()
}
mainClassName = 'com.mtecresults.rshappy.Driver'
group 'com.mtecresults'
project.version = getVersionTag()+"-${git.head().abbreviatedId}"
sourceCompatibility=1.8
targetCompatibility=1.8
repositories {
mavenCentral()
google()
jcenter()
maven { url 'https://jitpack.io' }
}
findbugs {
ignoreFailures = true
//toolVersion = "2.0.1"
sourceSets = [sourceSets.main]
reportsDir = file("$project.buildDir/reports/findbugs")
effort = "max"
}
pmd {
ignoreFailures = true
sourceSets = [sourceSets.main]
reportsDir = file("$project.buildDir/reports/pmd")
toolVersion = '5.1.3'
ruleSets = [
'java-android',
'java-basic',
'java-braces',
'java-clone',
'java-codesize',
'java-controversial',
'java-coupling',
'java-design',
'java-empty',
'java-finalizers',
'java-imports',
'java-j2ee',
'java-javabeans',
'java-junit',
'java-logging-jakarta-commons',
'java-logging-java',
'java-migrating',
'java-naming',
'java-optimizations',
'java-strictexception',
'java-strings',
'java-sunsecure',
'java-typeresolution',
'java-unnecessary',
'java-unusedcode'
]
}
test {
systemProperty "java.net.preferIPv4Stack", "true"
}
dependencies {
implementation 'info.picocli:picocli:3.8.2'
implementation 'com.google.guava:guava:19.0'
implementation 'com.github.cmagnuson:mylaps-tcp-server:0.3.1'
testImplementation group: 'junit', name: 'junit', version: '4.12'
testImplementation 'org.jmockit:jmockit:1.39'
}
def buildTime() {
def df = new SimpleDateFormat("yyyy-MM-dd HH:mm")
//df.setTimeZone(TimeZone.getTimeZone("UTC"))
return df.format(new Date())
}
task processSource(type: Copy) {
from sourceSets.main.java
filter(ReplaceTokens, tokens: [BUILDVERSION: getVersion(), BUILDTIME: buildTime()])
into "$buildDir/src"
}
compileJava {
source = processSource.outputs
}
launch4j {
outfile = "rs-happy-${project.version}.exe"
copyConfigurable = project.tasks.shadowJar.outputs.files
jar = "lib/${project.tasks.shadowJar.archiveName}"
headerType = "console"
cmdLine = "--gui"
}
def getMarkdownFileName(File file){
return file.getName().substring(0, file.getName().length()-3);
}
task buildDoc {
fileTree('doc').include('*.md').each { File file ->
def pdfize = tasks.create([name: "$file.name PDF", type: de.fntsoftware.gradle.MarkdownToPdfTask], {
inputFile = file;
outputFile = 'build/doc/' + getMarkdownFileName(file) + ".pdf"
})
dependsOn(pdfize)
}
}