-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
129 lines (108 loc) · 3.62 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
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
import com.strumenta.antlrkotlin.gradle.AntlrKotlinTask
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
plugins {
kotlin("multiplatform") version "1.9.22"
id("org.jetbrains.dokka") version "1.9.10"
java
antlr
id("com.strumenta.antlr-kotlin") version "0.1.0-RC14"
`maven-publish`
}
val klarityVersion = "2.1.1"
group = "net.iceyleagons"
version = klarityVersion
repositories {
mavenCentral()
}
kotlin {
jvm {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
withJava()
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
js {
compilations["main"].packageJson {
name = "@iceyleagons/klarity"
private = false
customField("repository", mapOf(
"type" to "git",
"url" to "https://github.com/IceyLeagons/Klarity"
))
customField("author", "IceyLeagons")
customField("license", "MIT")
customField("keywords", arrayOf("i18n", "klarity", "internalization", "library", "kotlin multiplatform", "multiplatform"))
customField("description", "Klarity is a lightweight internalization library for the Kotlin programming language, with support for JavaScript thanks to Kotlin Multiplatform. It makes it super easy to create multi-lingual projects.")
}
nodejs()
generateTypeScriptDefinitions()
binaries.library()
}
sourceSets {
commonMain {
dependencies {
implementation("com.strumenta:antlr-kotlin-runtime:0.1.0-RC14")
}
kotlin {
srcDir(layout.buildDirectory.dir("generatedAntlr"))
}
}
commonTest {
dependencies {
implementation(kotlin("test"))
}
}
jsMain {
}
val jvmMain by getting {
dependencies {
implementation("org.json:json:20230618")
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
implementation(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:1.0.0-pre.674"))
implementation("org.jetbrains.kotlin:kotlin-stdlib-js:1.9.0")
implementation("org.jetbrains.kotlin-wrappers:kotlin-js")
}
}
val jsTest by getting
}
}
dependencies {
antlr("org.antlr:antlr4:4.13.1")
}
val generateKotlinGrammarSource = tasks.register<AntlrKotlinTask>("generateKotlinGrammarSource") {
dependsOn("cleanGenerateKotlinGrammarSource")
// ANTLR .g4 files are under
setSource(layout.projectDirectory.dir("src/antlr"))
// We want the generated source files to have this package name
val pkgName = "net.iceyleagons.klarity.parsers.generated"
packageName = pkgName
// We want visitors alongside listeners.
// The Kotlin target language is implicit, as is the file encoding (UTF-8)
arguments = listOf("-visitor")
// Generated files are outputted inside build/generatedAntlr/{package-name}
val outDir = "generatedAntlr/${pkgName.replace(".", "/")}"
outputDirectory = layout.buildDirectory.dir(outDir).get().asFile
}
tasks.dokkaHtml {
outputDirectory.set(File("docs"))
}
tasks.withType<KotlinCompile<*>> {
dependsOn(generateKotlinGrammarSource)
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "net.iceyleagons"
artifactId = "klarity"
version = klarityVersion
from(components["java"])
}
}
}