-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
109 lines (95 loc) · 3.47 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
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.kotlin.serialization)
}
repositories {
mavenCentral()
}
plugins.withType<YarnPlugin> {
configure<YarnRootExtension> {
yarnLockAutoReplace = true
}
}
kotlin {
jvm()
js {
browser {
commonWebpackConfig {
}
}
binaries.executable()
}
sourceSets {
commonMain {
dependencies {
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.datetime)
}
}
jvmMain {
dependencies {
implementation(libs.kaml.jvm)
implementation(libs.markdown.jvm)
implementation(libs.jfree.svg)
}
}
jvmTest {
dependencies {
implementation(kotlin("test"))
}
}
jsMain {
dependencies {
implementation(dependencies.platform(libs.kotlin.wrappers))
implementation("org.jetbrains.kotlin-wrappers:kotlin-react")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom")
implementation("org.jetbrains.kotlin-wrappers:kotlin-react-router-dom")
implementation(npm("bootstrap", libs.versions.npm.bootstrap.get()))
implementation(npm("yaml-loader", libs.versions.npm.loader.yaml.get()))
implementation(npm("css-loader", libs.versions.npm.loader.css.get()))
implementation(npm("sass-loader", libs.versions.npm.loader.sass.get()))
implementation(npm("sass", libs.versions.npm.sass.get()))
implementation(npm("mini-css-extract-plugin", libs.versions.npm.minicss.get()))
implementation(npm("share-buttons", libs.versions.npm.sharebuttons.get()))
implementation(npm("highlight.js", libs.versions.npm.highlightjs.get()))
implementation(npm("highlightjs-copy", libs.versions.npm.highlightjsCopyPlugin.get()))
implementation(npm("@giscus/react", libs.versions.npm.giscus.get()))
}
}
}
}
tasks {
val jvmRuntimeClasspath by configurations
val kotlinClasspath = layout.buildDirectory.files("classes/kotlin/jvm/main") + jvmRuntimeClasspath
val jsResourcesPath = layout.buildDirectory.file("processedResources/js/main")
val generateHtmlFiles by registering(JavaExec::class) {
val inputDir = "pages"
group = "run"
mainClass = "app.MdToHtmlConverterKt"
classpath = kotlinClasspath
val outputPath = jsResourcesPath.get().asFile.absolutePath
environment = mapOf(
"INPUT_DIR" to inputDir,
"OUTPUT_DIR" to outputPath
)
inputs.dir(inputDir)
outputs.dir(outputPath)
dependsOn("compileKotlinJvm")
}
val generateVoronoi by registering(JavaExec::class) {
group = "run"
mainClass = "app.VoronoiGeneratorKt"
classpath = kotlinClasspath
val outputPath = jsResourcesPath.get().asFile.absolutePath
environment = mapOf(
"OUTPUT_DIR" to outputPath
)
outputs.dir(outputPath)
dependsOn("compileKotlinJvm")
}
named("jsProcessResources") {
dependsOn(generateHtmlFiles, generateVoronoi)
}
}