-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
101 lines (80 loc) · 2.57 KB
/
build.gradle.kts
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
@file:Suppress("SpellCheckingInspection")
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val linting = false
plugins {
kotlin("jvm") version "1.3.61"
// Gradle Shadow plugin for building a fat jar
id("com.github.johnrengelman.shadow") version "5.2.0"
id("org.jmailen.kotlinter") version "2.3.1"
antlr
application
}
group = "ic.wacc"
version = "1.0"
application.mainClassName = "ic.org.MainKt"
repositories {
jcenter()
}
kotlinter {
indentSize = 2
continuationIndentSize = 2
}
dependencies {
val arrowVer = "0.10.4"
val antlrVer = "4.7"
val fuelVer = "2.2.1"
val junitVer = "5.6.0"
// Kotlin standard library
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3")
// Kotlin functional programming library, Arrow
implementation("io.arrow-kt:arrow-optics:$arrowVer")
implementation("io.arrow-kt:arrow-syntax:$arrowVer")
// Http client Fuel and serialisation lib Gson in order to call the ref compiler
testImplementation("com.google.code.gson:gson:2.8.5")
testImplementation("com.github.kittinunf.fuel:fuel:$fuelVer")
testImplementation("com.github.kittinunf.fuel:fuel-gson:$fuelVer")
antlr("org.antlr:antlr4:$antlrVer")
implementation(fileTree(mapOf("dir" to "lib", "include" to listOf("*.jar"))))
// JUnit5
testImplementation("org.junit.jupiter:junit-jupiter:$junitVer")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVer")
}
// Antlr compile grammar task output directory, and add it to the java sourceSets
val antlrOut = "build/generated/source/antlr/".also {
sourceSets["main"].java.srcDir(it)
}
// Add a test-utils sourceset that will not get added to the final jar
sourceSets["test"].withConvention(KotlinSourceSet::class) {
kotlin.srcDir("src/test-utils/kotlin")
}
tasks {
generateGrammarSource {
val generatedPackage = "antlr"
arguments =
arguments + listOf("-package", generatedPackage, "-visitor", "-no-listener", "-Werror")
this.outputDirectory = file(antlrOut + generatedPackage)
}
test {
useJUnitPlatform()
}
clean {
doFirst {
delete(file("./.test_cache/"))
delete(fileTree(".") {
include("**/*.j")
include("**/*.s")
})
}
}
withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes")
jvmTarget = "1.8"
}
dependsOn(generateGrammarSource)
}
}