-
Notifications
You must be signed in to change notification settings - Fork 21
/
build.gradle
146 lines (116 loc) · 3 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
plugins {
id "java"
id "application"
id "com.avast.gradle.docker-compose" version "0.15.0"
id "com.diffplug.spotless" version "6.12.1"
}
mainClassName = "cli.Main"
// def getenv = { String env_val, default_val ->
// ext.val = System.getenv(env_val)
// if (ext.val == null) {
// return default_val
// } else return ext.val
// }
java {
sourceCompatibility = 17
targetCompatibility = 17
}
tasks.named("wrapper") {
jarFile = "${project.projectDir}/src/build/gradle/gradle-wrapper.jar"
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked"
}
repositories {
mavenCentral()
}
spotless {
format 'misc', {
// define the files to apply `misc` to
target '*.gradle'
trimTrailingWhitespace()
indentWithSpaces(2)
endWithNewline()
}
java {
// don't need to set target, it is inferred from java
googleJavaFormat('1.15.0')
// fix formatting of type annotations
formatAnnotations()
}
}
dependencies {
def javalin = "5.6.1"
annotationProcessor(
"io.javalin.community.openapi:openapi-annotation-processor:$javalin"
)
testImplementation(
"junit:junit:4.13.2",
"io.javalin:javalin-testtools:$javalin",
)
implementation(
// Logging
"org.slf4j:slf4j-api:2.0.3",
"org.slf4j:slf4j-simple:2.0.3",
// Database driver and connection pool
"org.postgresql:postgresql:42.2.12",
"com.zaxxer:HikariCP:3.4.1",
// HTML Parsing
"org.jsoup:jsoup:1.15.3",
// Command line arg parsing and progress bar
"info.picocli:picocli:4.7.0",
"me.tongfei:progressbar:0.9.5",
// Async utilities
"io.reactivex.rxjava3:rxjava:3.1.5",
// JSON
"com.fasterxml.jackson.core:jackson-annotations:2.7.4",
// Web server framework and documentation
"io.javalin:javalin:$javalin",
// for /openapi route with JSON scheme
"io.javalin.community.openapi:javalin-openapi-plugin:$javalin",
)
}
sourceSets {
migrations {
resources {
srcDirs "src"
includes = ["migrations/*.sql"]
}
}
main {
resources {
source migrations.resources
}
}
test {
resources {
source migrations.resources
}
}
}
test {
useJUnit()
maxHeapSize = "1G"
}
// @TODO use application plugin to make a distribution instead of using
// a fat jar. Fat jars take an annoying amount of time to compile, wheras
// the distribution plugin likely won't, because it has less work to do.
// - Albert Liu, Jan 31, 2022 Mon 01:34 EST
jar {
manifest { attributes ("Main-Class": "cli.Main") }
duplicatesStrategy = "include"
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith("jar") }.collect { zipTree(it) }
}
}
composeBuild.dependsOn jar
composeUp.dependsOn composeBuild
/*
I cannot for the fucking life of me figure out a reliable way to remove the dependency between
building and testing. Whatever I guess, I just need the jar I think.
*/
dockerCompose {
buildBeforeUp = false
projectName = "schedge"
}