-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
145 lines (125 loc) · 4.01 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
/*
* This build file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java project to get you started.
* For more details take a look at the Java Quickstart chapter in the Gradle
* user guide available at https://docs.gradle.org/4.3/userguide/tutorial_java_projects.html
*/
plugins {
id "com.github.ben-manes.versions" version "0.20.0"
id 'com.github.kt3k.coveralls' version '2.8.2'
id 'jacoco'
id 'net.ltgt.apt' version '0.19'
}
// Apply the java plugin to add support for Java
apply plugin: 'java'
// Apply the application plugin to add support for building an application
apply plugin: 'application'
// In this section you declare where to find the dependencies of your project
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
}
dependencies {
// This dependency is found on compile classpath of this component and consumers.
compile 'com.google.api-client:google-api-client:1.25.0'
compile 'com.google.code.gson:gson:2.8.5'
compile 'com.google.dagger:dagger:2.17'
compile 'com.google.guava:guava:26.0-jre'
compile 'com.sparkjava:spark-core:2.8.0'
compile 'org.apache.logging.log4j:log4j-api:2.11.1'
compile 'org.apache.logging.log4j:log4j-core:2.11.1'
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.1'
compile 'org.postgresql:postgresql:42.2.5'
compileOnly 'org.projectlombok:lombok:1.18.2'
annotationProcessor 'com.google.dagger:dagger-compiler:2.17'
annotationProcessor 'org.projectlombok:lombok:1.18.2'
testCompile 'com.h2database:h2:1.4.197'
// Use JUnit test framework
testCompile 'junit:junit:4.12'
testCompile 'org.easymock:easymock:3.6'
}
test {
testLogging {
// show stacktrace and logs
exceptionFormat = 'full'
showStandardStreams = true
}
}
jacocoTestReport {
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, exclude: [
'me/ericjiang/frontiersmen/config/DaggerFrontiersmen*',
'**/*_MembersInjector.class',
'**/Dagger*Component.class',
'**/Dagger*Component$Builder.class',
'**/*Module_*Factory.class'
])
})
}
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
task printTestReportLocation {
doLast {
println "Unit test report: build/reports/tests/test/index.html"
println "Coverage report: build/reports/jacoco/test/html/index.html"
}
}
// Support for https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
task copyCoverageReport(type: Copy) {
from file("$buildDir/reports/jacoco/test/jacocoTestReport.xml")
into file(".")
rename "jacocoTestReport.xml", "cov.xml"
}
test.finalizedBy jacocoTestReport
jacocoTestReport.finalizedBy printTestReportLocation
jacocoTestReport.finalizedBy copyCoverageReport
sourceSets.main.java.srcDirs = ['build/generated/source/apt/main','src/main/java']
// Define the main class for the application
mainClassName = 'me.ericjiang.frontiersmen.Server'
def database = 'frontiersmen'
task createdb {
doLast {
exec {
commandLine 'createdb'
args database
}
exec {
workingDir 'src/main/sql'
commandLine 'psql'
args database, '-af', 'create.sql'
}
}
}
task dropdb {
doLast {
exec {
commandLine 'dropdb'
args database
}
}
}
task resetdb {
doLast {
exec {
commandLine 'dropdb'
args database
}
exec {
commandLine 'createdb'
args database
}
exec {
workingDir 'src/main/sql'
commandLine 'psql'
args database, '-af', 'create.sql'
}
}
}
// Heroku task
task stage(dependsOn: ['clean', 'installDist'])