-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.gradle.kts
51 lines (43 loc) · 1.45 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
plugins {
java
antlr
kotlin("jvm") version "2.0.21"
`maven-publish`
}
group = "io.github.persiancalendar"
version = "0.0.1"
repositories {
mavenCentral()
}
dependencies {
antlr("org.antlr:antlr4:4.13.2")
implementation("org.antlr:antlr4-runtime:4.13.2")
testImplementation(kotlin("test"))
val junit5Version = "5.11.4"
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit5Version")
testImplementation("org.junit.jupiter:junit-jupiter-params:$junit5Version")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junit5Version")
}
// https://github.com/gradle/gradle/issues/820#issuecomment-808315335
configurations[JavaPlugin.API_CONFIGURATION_NAME].let { apiConfiguration ->
apiConfiguration.setExtendsFrom(apiConfiguration.extendsFrom.filter { it.name != "antlr" })
}
tasks.generateGrammarSource {
maxHeapSize = "64m"
arguments = arguments + listOf("-no-listener", "-visitor", "-package", "io.github.persiancalendar.calculator.parser")
outputDirectory = File("${project.buildDir}/generated-src/antlr/main/io/github/persiancalendar/calculator/parser")
}
tasks.named("compileKotlin").configure { dependsOn(tasks.generateGrammarSource) }
tasks.test {
useJUnitPlatform()
}
configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_1_8
}
publishing {
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
}
}
}