This repository has been archived by the owner on Jul 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
91 lines (72 loc) · 2.03 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
plugins {
kotlin("jvm") version "1.5.0"
kotlin("plugin.serialization") version "1.5.0"
antlr
idea
}
group = "v2.format"
version = "1.3"
val kotlinxSerializationVersion: String by project
val cliktVersion: String by project
val commonsTextVersion: String by project
val antlrVersion: String by project
val junitVersion: String by project
val mockkVersion: String by project
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlinx", "kotlinx-serialization-json", kotlinxSerializationVersion)
implementation("com.github.ajalt.clikt", "clikt", cliktVersion)
antlr("org.antlr", "antlr4", antlrVersion)
testImplementation("org.junit.jupiter", "junit-jupiter-api", junitVersion)
testRuntimeOnly("org.junit.jupiter", "junit-jupiter-engine", junitVersion)
testImplementation("io.mockk", "mockk", mockkVersion)
}
val genDir = file("${project.buildDir}/generated-src/antlr/main/v2/format/antlr")
idea {
module {
generatedSourceDirs.add(genDir)
}
}
sourceSets {
main {
java {
srcDirs.add(genDir)
}
}
}
tasks {
compileJava {
options.encoding = "cp1252"
}
compileKotlin {
dependsOn(generateGrammarSource)
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
}
generateGrammarSource {
arguments.addAll(arrayOf("-visitor", "-package", "v2.format.antlr"))
outputDirectory = genDir
}
test {
useJUnitPlatform()
}
jar {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
manifest {
attributes["Main-Class"] = "v2.format.MainKt"
}
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
archiveFileName.set("v2format.jar")
}
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_11
}