-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle.kts
144 lines (119 loc) · 3.3 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import org.jetbrains.kotlin.gradle.plugin.mpp.Framework
plugins {
kotlin("multiplatform") version "1.4.0"
kotlin("xcode-compat") version "0.2.5"
}
repositories {
jcenter()
maven(url = "https://dl.bintray.com/kotlin/ktor")
mavenCentral()
}
val ktorVersion = "1.4.0"
val logbackVersion = "1.2.3"
kotlin {
jvm()
js {
browser()
compilations.all {
kotlinOptions {
moduleKind = "umd"
sourceMap = true
metaInfo = true
}
}
compilations["main"].kotlinOptions {
this.outputFile = "conway.js"
}
}
macosX64("console") {
binaries {
executable {
entryPoint = "org.jonnyzzz.lifegame.main"
}
}
}
xcode {
setupFramework("ios") {
baseName = "GameOfLifeFramework"
embedBitcode = Framework.BitcodeEmbeddingMode.BITCODE
}
}
val commonMain by sourceSets.getting
val commonTest by sourceSets.getting
val jvmMain by sourceSets.getting
val jvmTest by sourceSets.getting
val jsMain by sourceSets.getting
val jsTest by sourceSets.getting
val iosMain by sourceSets.getting
commonMain.dependencies {
implementation(kotlin("stdlib-common"))
}
commonTest.dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
jvmMain.dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("io.ktor:ktor-server-netty:$ktorVersion")
implementation("io.ktor:ktor-html-builder:$ktorVersion")
implementation("ch.qos.logback:logback-classic:$logbackVersion")
}
jvmTest.dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
jsMain.dependencies {
implementation(kotlin("stdlib-js"))
implementation("org.jetbrains.kotlinx:kotlinx-html-js:0.6.12")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-js:1.2.1")
}
jsTest.dependencies {
implementation(kotlin("test-js"))
}
iosMain.dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.2.1")
}
val webFolder = File(project.buildDir, "jsMain/web")
val jsCompilations = kotlin.targets.getByName("js").compilations
val populateWebFolder by tasks.creating(Sync::class) {
group = "build"
jsCompilations.forEach {
dependsOn(it.compileAllTaskName)
from(it.output)
doFirst {
it.compileDependencyFiles.forEach { f ->
if (f.exists() && !f.isDirectory) {
from(zipTree(f).matching { include("*.js") })
}
}
}
}
from(jsMain.resources)
into(webFolder)
}
val jsJar by tasks.getting {
dependsOn(populateWebFolder)
}
val run by tasks.creating(JavaExec::class) {
group = "run-me"
dependsOn(targets["jvm"].compilations["main"].compileAllTaskName, jsJar)
main = "org.jonnyzzz.lifegame.Game_jvmKt"
doFirst {
classpath(
kotlin.targets["jvm"].compilations["main"].output.allOutputs.files,
configurations["jvmRuntimeClasspath"]
)
}
systemProperty("jsWeb", webFolder)
///disable app icon on macOS
systemProperty("java.awt.headless", "true")
}
}
kotlin.targets.all {
compilations.all {
kotlinOptions.freeCompilerArgs += listOf(
"-XXLanguage:+InlineClasses",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts"
)
}
}