-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
173 lines (143 loc) · 4.84 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
buildscript {
ext {
kotlinVersion = '1.3.61'
spekVersion = '1.1.5'
slf4jVersion = '1.7.25'
log4jVersion = '1.2.17'
poiVersion = '3.12'
konfVersion = '0.20.0'
mockkversion = '1.9'
junitVersion = '1.0.2'
userHomePath = System.properties["user.home"]
destinationPath = userHomePath + "/.${rootProject.name}"
}
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlinVersion"
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0'
}
}
plugins {
id "org.jetbrains.kotlin.jvm" version '1.3.60'
id "application"
id "com.github.johnrengelman.shadow" version "5.0.0"
id "org.jmailen.kotlinter" version "2.3.2"
id "org.jlleitschuh.gradle.ktlint-idea" version "9.2.1"
}
group 'com.github.sbaldin'
version '0.4.3'
mainClassName = "com.github.sbaldin.invoicer.ApplicationKt"
defaultTasks 'run'
repositories {
mavenCentral()
}
kotlinter {
ignoreFailures = false
indentSize = 4
reporters = ['checkstyle', 'plain']
experimentalRules = true
disabledRules = ['import-ordering', 'final-newline']
fileBatchSize = 30
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
testCompile "org.jetbrains.kotlin:kotlin-test"
testCompile "org.jetbrains.kotlin:kotlin-test-junit"
compile 'com.uchuhimo:konf-core:0.20.0'
compile 'com.uchuhimo:konf-yaml:0.20.0'
compile "org.apache.poi:poi:${poiVersion}"
compile "org.apache.poi:poi-ooxml:${poiVersion}"
compile "org.apache.poi:poi-ooxml-schemas:${poiVersion}"
compile "org.apache.poi:poi-scratchpad:${poiVersion}"
compile group: 'org.apache.poi', name: 'ooxml-schemas', version: '1.4'
// https://mvnrepository.com/artifact/org.freemarker/freemarker
compile group: 'org.freemarker', name: 'freemarker', version: '2.3.20'
compile "org.slf4j:slf4j-api:${slf4jVersion}"
compile "org.slf4j:slf4j-log4j12:${slf4jVersion}"
compile group: 'log4j', name: 'log4j', version: '1.2.17'
testCompile "io.mockk:mockk:${mockkversion}"
testCompile 'org.jsoup:jsoup:1.10.3'
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
testCompile("org.jetbrains.spek:spek-api:$spekVersion") {
exclude group: 'org.jetbrains.kotlin'
}
testCompile("org.jetbrains.spek:spek-data-driven-extension:$spekVersion") {
exclude group: 'org.jetbrains.kotlin'
}
testRuntime("org.jetbrains.spek:spek-junit-platform-engine:$spekVersion") {
exclude group: 'org.junit.platform'
exclude group: 'org.jetbrains.kotlin'
}
testRuntime "org.junit.platform:junit-platform-runner:$junitVersion"
testRuntime "org.junit.platform:junit-platform-console:$junitVersion"
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.0.2'
testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.2'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
test{
useJUnitPlatform {
includeEngines 'spek'
}
}
//build.dependsOn shadowJar
jar {
zip64 true
manifest {
attributes "Implementation-Title": "Invoice Generator"
attributes "Implementation-Version": getArchiveVersion()
attributes "Main-Class": mainClassName
}
// This line of code recursively collects and copies all of a project's files
// and adds them to the JAR itself. One can extend this task, to skip certain
// files or particular types at will
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
}
application {
applicationDefaultJvmArgs = ['-Xmx500m']
}
tasks.withType(JavaExec) {
systemProperties System.properties
}
task copyBinaries(type: Copy) {
from 'binaries'
into destinationPath + "/binaries"
}
task copyScripts(type: Copy) {
from 'scripts'
into destinationPath + "/scripts"
}
task chmodBinaries {
dependsOn(copyBinaries, copyScripts)
doLast {
exec {
fileTree(destinationPath + "/binaries").visit { FileVisitDetails details ->
commandLine destinationPath + "/scripts/chmod.sh"
println(details.file.path)
args(details.file.path)
}
}
}
}
task copyJar(type: Copy, dependsOn: build) {
from 'build/libs'
include "${rootProject.name}-${project.version}-all.jar"
into destinationPath
}
task copyAppYaml(type: Copy, dependsOn: build) {
from 'build/resources/main'
include "*.yaml"
into destinationPath
}
task installToUserHomeDir {
dependsOn(copyJar, copyAppYaml, copyBinaries, copyScripts, chmodBinaries)
}