This repository has been archived by the owner on May 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
60 lines (52 loc) · 1.76 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
plugins {
kotlin("jvm") version "1.7.10"
antlr
application
}
repositories {
mavenCentral()
}
dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.7.10")
testImplementation("org.jetbrains.kotlin:kotlin-test")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
antlr("org.antlr:antlr4:4.10.1")
}
application {
mainClass.set("org.anotherkit.interpreter.AppKt")
}
kotlin.target.compilations.create("antlrBase") {
defaultSourceSet {
kotlin.srcDir("src/antlr-base/kotlin")
}
}
sourceSets.create("antlr") {
java.srcDir("src/antlr/java")
compileClasspath = compileClasspath
.plus(sourceSets.main.get().compileClasspath)
.plus(tasks.getByName("compileAntlrBaseKotlin").outputs.files)
// println(compileClasspath.asPath)
}
sourceSets.getByName("antlrBase") {
compileClasspath = compileClasspath
.plus(sourceSets.main.get().compileClasspath)
}
sourceSets.main {
val additionalClasspath = tasks.getByName("compileAntlrJava").outputs.files
.plus(tasks.getByName("compileAntlrBaseJava").outputs.files)
.plus(tasks.getByName("compileAntlrBaseKotlin").outputs.files)
compileClasspath = compileClasspath.plus(additionalClasspath)
runtimeClasspath = runtimeClasspath.plus(additionalClasspath)
}
tasks.compileKotlin {
dependsOn("compileAntlrJava")
}
tasks.getByName("compileAntlrJava") {
dependsOn("compileAntlrBaseKotlin", "generateAntlrGrammarSource")
}
tasks.getByName("generateAntlrGrammarSource") {
this as AntlrTask
arguments = arguments + listOf("-visitor", "-package", "org.anotherkit.interpreter")
}