Skip to content

Commit 3b88f28

Browse files
committed
build: Enable Kotlin K2 compiler, use Gradle 8.4, JDK 17; Add 75x75 grid
1 parent 6b5b6c4 commit 3b88f28

File tree

5 files changed

+23
-33
lines changed

5 files changed

+23
-33
lines changed

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

+15-18
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,26 @@ kotlin {
3636
binaries.executable()
3737
browser {
3838
useCommonJs()
39-
commonWebpackConfig(
40-
Action {
41-
outputFileName = "$moduleName.js"
42-
}
43-
)
39+
commonWebpackConfig {
40+
outputFileName = "$moduleName.js"
41+
}
4442
}
4543
}
4644
} else {
4745
wasmJs {
4846
moduleName = "app"
4947
binaries.executable()
5048
browser {
51-
commonWebpackConfig(
52-
Action {
53-
outputFileName = "$moduleName.js"
54-
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).copy(
55-
port = 8081,
56-
static = (devServer?.static ?: mutableListOf()).apply {
57-
// Serve sources to debug inside browser
58-
add(project.rootDir.path)
59-
}
60-
)
61-
}
62-
)
49+
commonWebpackConfig {
50+
outputFileName = "$moduleName.js"
51+
devServer = (devServer ?: KotlinWebpackConfig.DevServer()).copy(
52+
port = 8081,
53+
static = (devServer?.static ?: mutableListOf()).apply {
54+
// Serve sources to debug inside browser
55+
add(project.rootDir.path)
56+
}
57+
)
58+
}
6359
}
6460

6561
applyBinaryen {
@@ -97,7 +93,8 @@ kotlin {
9793

9894
sourceSets {
9995
all {
100-
languageSettings.apply {
96+
languageSettings {
97+
languageVersion = "2.0"
10198
progressiveMode = true
10299
optIn("kotlin.RequiresOptIn")
103100
}

gradle.properties

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
# suppress inspection "UnusedProperty" for whole file
22
#
3-
# org.gradle.caching=true # https://docs.gradle.org/current/userguide/build_cache.html#sec:build_cache_enable
4-
# org.gradle.parallel=true # https://docs.gradle.org/current/userguide/performance.html#parallel_execution
3+
org.gradle.caching=true # https://docs.gradle.org/current/userguide/build_cache.html
4+
org.gradle.unsafe.configuration-cache=true # https://docs.gradle.org/current/userguide/configuration_cache.html
5+
org.gradle.parallel=true # https://docs.gradle.org/current/userguide/performance.html#parallel_execution
56
# WORKAROUND java.lang.OutOfMemoryError: Metaspace (similar: https://github.com/Kotlin/dokka/issues/1405)
67
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
7-
# org.gradle.jvmargs=-XX:+UseParallelGC # tune as needed; https://developer.android.com/studio/build/optimize-your-build#configure-the-jvm-garbage-collector
8-
#
98
kotlin.code.style=official
10-
kotlin.js.generate.executable.default=false
11-
# WORKAROUND until Kotlin 1.7.20 ? https://youtrack.jetbrains.com/issue/KT-53063/KJS-IR-IC-undefined-cross-module-reference-for-implemented-interface-functions ("ReferenceError: delay is not defined")
12-
kotlin.incremental.js.ir=true
13-
kotlin.mpp.stability.nowarn=true
14-
# kotlin.daemon.jvmargs= # tune as needed
159
org.jetbrains.compose.experimental.jscanvas.enabled=true
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/commonMain/kotlin/Views.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ fun MainScene() {
6262
}
6363
}
6464

65-
private val grids = listOf(25, 50, 100, 200, 400).map { GridModel(it) }
65+
private val grids = listOf(25, 50, 75, 100, 200, 400).map { GridModel(it) }
6666

6767
@Composable
6868
private fun GridChoiceScene(selectedGrid: MutableState<GridModel?>) {
@@ -224,8 +224,7 @@ private fun ConditionalBoxWithConstraints(content: @Composable () -> Unit) {
224224

225225
@Composable
226226
private fun Cell(cell: CellModel, cellLevelRecompositionTrigger: State<Int>) {
227-
@Suppress("UnusedReceiverParameter")
228-
fun Modifier.drawSupervised() = Modifier.drawWithContent {
227+
fun Modifier.drawSupervised() = drawWithContent {
229228
drawSeries?.addCellOperation()
230229
if (Configuration.cellTextDrawingEnabled.value) {
231230
drawContent()
@@ -255,7 +254,7 @@ private fun Cell(cell: CellModel, cellLevelRecompositionTrigger: State<Int>) {
255254
}
256255

257256
/** Consumes a value in a fashion the compiler (hopefully) would not identify as a no-op (and optimize away). */
258-
fun <T> sinkHole(value: T) {
257+
private fun <T> sinkHole(value: T) {
259258
require(value.toString().isNotEmpty())
260259
}
261260

0 commit comments

Comments
 (0)