Upgrade to Gradle 8.10, Kotlin 2.0.20, reduce warnings

This commit is contained in:
Edwin Jakobs
2024-08-25 09:39:18 +02:00
parent 5b6f2ec1ff
commit 8a4a85d333
37 changed files with 133 additions and 81 deletions

View File

@@ -90,7 +90,6 @@ fun GltfFile.buildSceneNodes(): GltfSceneData {
val localBuffer = buffers[localBufferView.buffer].contents(this@buildSceneNodes)
require(localBufferView.byteOffset != null)
require(localBufferView.byteLength != null)
localBuffer.position(localBufferView.byteOffset)
localBuffer.limit(localBufferView.byteOffset + localBufferView.byteLength)
@@ -321,7 +320,6 @@ fun GltfFile.buildSceneNodes(): GltfSceneData {
val scenes = scenes.map { scene ->
scene.nodes.map { node ->
val gltfNode = nodes.getOrNull(node) ?: error("node not found: $node")
require(gltfNode != null)
val sceneNode = gltfNode.createSceneNode()
sceneNode
}

View File

@@ -19,12 +19,12 @@ fun Mesh.collapse() {
}
grouped.map {
val vertexCount = it.value.sumBy { primitive ->
val vertexCount = it.value.sumOf { primitive ->
primitive.geometry.vertexCount
}
val indexCount = if (it.key.hasIndexBuffer)
it.value.sumBy { primitive ->
it.value.sumOf { primitive ->
primitive.geometry.indexBuffer?.indexCount ?: 0
}
else 0

View File

@@ -5,7 +5,9 @@ plugins {
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
dependencies {

View File

@@ -5,7 +5,9 @@ plugins {
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
dependencies {

View File

@@ -11,7 +11,9 @@ tasks.generateGrammarSource {
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
dependencies {

View File

@@ -5,7 +5,9 @@ plugins {
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
tasks.test {

View File

@@ -5,6 +5,7 @@ import java.io.File
import java.io.InputStream
import java.io.Reader
import java.net.MalformedURLException
import java.net.URI
import java.net.URL
import javax.script.ScriptEngineManager

View File

@@ -5,7 +5,9 @@ plugins {
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs = listOf("-opt-in=kotlin.RequiresOptIn")
compilerOptions {
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}
tasks.test {

View File

@@ -88,7 +88,7 @@ fun Element.div(vararg classes: String, init: Div.() -> Unit): Div {
}
inline fun <reified T : TextElement> Element.textElement(classes: Array<out String>, init: T.() -> String): T {
val te = T::class.java.newInstance()
@Suppress("DEPRECATION") val te = T::class.java.newInstance()
te.classes.addAll(classes.map { ElementClass(it) })
te.text(te.init())
append(te)

View File

@@ -7,7 +7,7 @@ import kotlin.reflect.full.declaredMemberProperties
fun watchHash(toHash: Any): Int {
var hash = 0
for (property in toHash::class.declaredMemberProperties) {
val v = ((property as KProperty1<Any, Any?>).getter).invoke(toHash)
@Suppress("UNCHECKED_CAST") val v = ((property as KProperty1<Any, Any?>).getter).invoke(toHash)
if (v is KProperty0<*>) {
val pv = v.get()
hash = 31 * hash + (pv?.hashCode() ?: 0)