Skip to content

Commit

Permalink
Upgrade Kotlin to 1.9.20
Browse files Browse the repository at this point in the history
Upgrade Gradle to 8.4

Remove obsolete dependency on native cbrt implementation

Fix deprecated buildDir calls
  • Loading branch information
littleant authored and kdrag0n committed Nov 20, 2023
1 parent 58556ab commit c826e0d
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 54 deletions.
3 changes: 1 addition & 2 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 21 additions & 22 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import java.io.FileInputStream
import java.util.Base64

plugins {
kotlin("multiplatform") version "1.6.10"
kotlin("multiplatform") version "1.9.20"
// Tests
jacoco
// Docs
id("org.jetbrains.dokka") version "1.6.0"
id("org.jetbrains.dokka") version "1.9.10"
// Publishing
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("maven-publish")
id("signing")
}

group = "dev.kdrag0n"
Expand All @@ -25,26 +25,30 @@ kotlin {
explicitApi()

jvm {
compilations.all {
kotlinOptions.jvmTarget = "1.8"
}
testRuns["test"].executionTask.configure {
useJUnitPlatform()
jvmToolchain(8)
withJava()
testRuns.named("test") {
executionTask.configure {
useJUnitPlatform()
}
}
}
js {
nodejs()
}

val hostOs = System.getProperty("os.name")
val isArm64 = System.getProperty("os.arch") == "aarch64"
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" -> macosX64("native")
hostOs == "Linux" -> linuxX64("native")
hostOs == "Mac OS X" && isArm64 -> macosArm64("native")
hostOs == "Mac OS X" && !isArm64 -> macosX64("native")
hostOs == "Linux" && isArm64 -> linuxArm64("native")
hostOs == "Linux" && !isArm64 -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}


sourceSets {
val commonMain by getting
val commonTest by getting {
Expand All @@ -67,22 +71,17 @@ jacoco {

val jacocoTestReport by tasks.creating(JacocoReport::class) {
val coverageSourceDirs = arrayOf(
"src/commonMain/kotlin",
"src/jvmMain/kotlin"
"src/commonMain/kotlin", "src/jvmMain/kotlin"
)

val classFiles = File("$buildDir/classes/kotlin/jvm/main")
.walkBottomUp()
.toSet()
val classFiles = layout.buildDirectory.dir("classes/kotlin/jvm/main")

classDirectories.setFrom(classFiles)
sourceDirectories.setFrom(files(coverageSourceDirs))

executionData.setFrom(files("$buildDir/jacoco/jvmTest.exec"))
executionData.setFrom(layout.buildDirectory.files("jacoco/jvmTest.exec"))

reports {
html.isEnabled = true
}
reports {}

dependsOn("jvmTest")
}
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
kotlin.code.style=official
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
kotlin.js.generate.executable.default=false
kotlin.mpp.stability.nowarn=true
kotlin.mpp.applyDefaultHierarchyTemplate=false

# Workaround for Dokka issue: https://github.com/Kotlin/dokka/issues/1405
org.gradle.jvmargs=-XX:MaxMetaspaceSize=512m
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion src/commonMain/kotlin/dev/kdrag0n/colorkt/cam/Zcam.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package dev.kdrag0n.colorkt.cam
import dev.kdrag0n.colorkt.Color
import dev.kdrag0n.colorkt.tristimulus.CieXyzAbs
import dev.kdrag0n.colorkt.ucs.lch.Lch
import dev.kdrag0n.colorkt.util.math.cbrt
import dev.kdrag0n.colorkt.util.math.square
import dev.kdrag0n.colorkt.util.math.toDegrees
import dev.kdrag0n.colorkt.util.math.toRadians
Expand Down
2 changes: 0 additions & 2 deletions src/commonMain/kotlin/dev/kdrag0n/colorkt/gamut/OklabGamut.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package dev.kdrag0n.colorkt.gamut

import dev.kdrag0n.colorkt.rgb.LinearSrgb
import dev.kdrag0n.colorkt.ucs.lab.Oklab
import dev.kdrag0n.colorkt.ucs.lab.Oklab.Companion.toOklab
import dev.kdrag0n.colorkt.util.math.cbrt
import dev.kdrag0n.colorkt.util.math.cube
import dev.kdrag0n.colorkt.util.math.square
import kotlin.jvm.JvmOverloads
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package dev.kdrag0n.colorkt.ucs.lab
import dev.kdrag0n.colorkt.tristimulus.CieXyz
import dev.kdrag0n.colorkt.data.Illuminants
import dev.kdrag0n.colorkt.conversion.ConversionGraph
import dev.kdrag0n.colorkt.util.math.cbrt
import dev.kdrag0n.colorkt.util.math.cube
import kotlin.jvm.JvmName
import kotlin.jvm.JvmOverloads
import kotlin.jvm.JvmStatic
import kotlin.jvm.JvmSynthetic
import kotlin.math.cbrt

/**
* A color in the CIE L*a*b* uniform color space, which represents colors in [dev.kdrag0n.colorkt.ucs.lab.Lab] form.
Expand Down
2 changes: 1 addition & 1 deletion src/commonMain/kotlin/dev/kdrag0n/colorkt/ucs/lab/Oklab.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package dev.kdrag0n.colorkt.ucs.lab
import dev.kdrag0n.colorkt.rgb.LinearSrgb
import dev.kdrag0n.colorkt.tristimulus.CieXyz
import dev.kdrag0n.colorkt.conversion.ConversionGraph
import dev.kdrag0n.colorkt.util.math.cbrt
import dev.kdrag0n.colorkt.util.math.cube
import kotlin.jvm.JvmName
import kotlin.jvm.JvmStatic
import kotlin.jvm.JvmSynthetic
import kotlin.math.cbrt

/**
* A color in the Oklab uniform color space, which represents colors in [dev.kdrag0n.colorkt.ucs.lab.Lab] form.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package dev.kdrag0n.colorkt.ucs.lab

import dev.kdrag0n.colorkt.rgb.LinearSrgb
import dev.kdrag0n.colorkt.conversion.ConversionGraph
import dev.kdrag0n.colorkt.util.math.cbrt
import dev.kdrag0n.colorkt.util.math.cube
import kotlin.jvm.JvmName
import kotlin.jvm.JvmStatic
import kotlin.jvm.JvmSynthetic
import kotlin.math.cbrt

/**
* A color in the SRLAB2 uniform color space, which represents colors in [dev.kdrag0n.colorkt.ucs.lab.Lab] form.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import kotlin.math.PI
internal inline fun cube(x: Double) = x * x * x
@JvmSynthetic
internal inline fun square(x: Double) = x * x

// Use native cbrt where possible, otherwise simulate it with pow
@JvmSynthetic
internal expect fun cbrt(x: Double): Double

@JvmSynthetic
internal fun Double.toRadians() = this * PI / 180.0
@JvmSynthetic
Expand Down
9 changes: 0 additions & 9 deletions src/jsMain/kotlin/dev/kdrag0n/colorkt/util/math/MathExtJs.kt

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit c826e0d

Please sign in to comment.