Skip to content

Commit

Permalink
update to kotlin 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
breandan committed Aug 9, 2024
1 parent fcb1618 commit 66e8cc0
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 38 deletions.
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import io.github.gradlenexus.publishplugin.NexusPublishExtension

plugins {
idea
kotlin("multiplatform") version "1.8.20-Beta" apply false
id("com.github.ben-manes.versions") version "0.45.0"
id("org.jetbrains.dokka") version "1.7.20"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
kotlin("multiplatform") version "2.0.0" apply false
id("com.github.ben-manes.versions") version "0.51.0"
id("org.jetbrains.dokka") version "1.9.20"
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}

val sonatypeApiUser = providers.gradleProperty("sonatypeApiUser")
val sonatypeApiKey = providers.gradleProperty("sonatypeApiKey")
if (sonatypeApiUser.isPresent && sonatypeApiKey.isPresent) {
configure<NexusPublishExtension> {
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
Expand Down
39 changes: 24 additions & 15 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,26 @@ plugins {
id("org.jetbrains.dokka")
}

// Stub secrets to let the project sync and build without the publication values set up
ext["signing.keyId"] = null
ext["signing.password"] = null
ext["signing.secretKeyRingFile"] = null
ext["ossrhUsername"] = null
ext["ossrhPassword"] = null

val keyId = providers.gradleProperty("signing.gnupg.keyId")
val password = providers.gradleProperty("signing.gnupg.password")
val secretKey = providers.gradleProperty("signing.gnupg.key")
val sonatypeApiUser = providers.gradleProperty("sonatypeApiUser")
val sonatypeApiKey = providers.gradleProperty("sonatypeApiKey")
if (keyId.isPresent && password.isPresent && secretKey.isPresent) {
ext["signing.keyId"] = keyId
ext["signing.password"] = password
ext["signing.key"] = secretKey
ext["ossrhUsername"] = sonatypeApiUser
ext["ossrhPassword"] = sonatypeApiKey
}

val generatedSourcesPath = file("src/commonMain/gen")

shipshape {
Expand Down Expand Up @@ -64,22 +84,11 @@ kotlin {
}
}

// Stub secrets to let the project sync and build without the publication values set up
ext["signing.keyId"] = null
ext["signing.password"] = null
ext["signing.secretKeyRingFile"] = null

val keyId = providers.gradleProperty("signing.gnupg.keyId")
val password = providers.gradleProperty("signing.gnupg.password")
val secretKey = providers.gradleProperty("signing.gnupg.key")

if (keyId.isPresent && password.isPresent && secretKey.isPresent) {
ext["signing.keyId"] = keyId
ext["signing.password"] = password
ext["signing.key"] = secretKey
}

fun getExtraString(name: String) = ext[name]?.toString()
// fun getExtraString(name: String) = ext(name).toString()

signing {
useGpgCmd()
Expand Down Expand Up @@ -149,7 +158,7 @@ kotlin {
implementation(kotlin("bom"))
implementation(kotlin("stdlib"))

implementation("org.graalvm.js:js:22.3.0")
implementation("org.graalvm.js:js:23.0.5")
implementation("guru.nidi:graphviz-kotlin:0.18.1")

implementation(kotlin("reflect"))
Expand All @@ -162,11 +171,11 @@ kotlin {

// Property-based testing

val ejmlVersion = "0.41.1"
val ejmlVersion = "0.43.1"
implementation("org.ejml:ejml-kotlin:$ejmlVersion")
implementation("org.ejml:ejml-all:$ejmlVersion")

val kotestVersion = "5.5.4"
val kotestVersion = "5.9.1"
implementation("io.kotest:kotest-runner-junit5:$kotestVersion")
implementation("io.kotest:kotest-assertions-core:$kotestVersion")
implementation("io.kotest:kotest-property:$kotestVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ data class Bindings<X: SFun<X>> constructor(val fMap: MapFxF<X>) {
(it is MFun<X, *, *> && it !is Mat<X, *, *> && it !is MConst<X, *, *>) ||
(it is Vec<X, *> && it.bindings.allFreeVariables.isNotEmpty()) ||
(it is VFun<X, *> && it !is Vec<X, *> && it !is VConst<X, *>) ||
(it is SFun<X> && it !is Constant)
(it is SFun<X> && it !is Constant<*>)

val complete = allFreeVariables.isEmpty()
val readyToBind = allBoundVariables.isNotEmpty()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@ class VDerivative<X: SFun<X>, E: D1>(override val input: VFun<X, E>, override va
is Vec -> Vec(contents.map { it.d(vrb) })
is MVProd<X, *, *> ->
(left.d(vrb) as MFun<X, E, E>) * right as VFun<X, E> +
(left as MFun<X, E, E> * right.d(vrb))
(left as MFun<X, E, E> * right.d(vrb) as VFun<X, E>)
is VMProd<X, *, *> ->
(left.d(vrb) as VFun<X, E> * right as MFun<X, E, E>) +
(left as VFun<X, E> * right.d(vrb))
(left as VFun<X, E> * right.d(vrb) as MFun<X, E, E>)
is Gradient -> invoke().df() // map { it.d(sVar) }
is VMap -> input.df().map { it * ssMap(mapInput to it).d(vrb) } // Chain rule
is VComposition -> evaluate.df()
Expand Down
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-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion kaliningraph
7 changes: 4 additions & 3 deletions samples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ graal {

dependencies {
implementation(kotlin("stdlib"))
compileOnly("org.jetbrains:annotations:23.1.0")
compileOnly("org.jetbrains:annotations:24.1.0")
implementation(project(":kotlingrad"))

implementation("org.graalvm.js:js:22.3.0")
implementation("org.graalvm.js:js:23.0.5")
implementation("guru.nidi:graphviz-kotlin:0.18.1")
// Graphical libraries
implementation("org.jzy3d:jzy3d-api:1.0.3")

implementation("org.jetbrains.lets-plot:lets-plot-kotlin-jvm:4.2.0")
implementation("org.jetbrains.lets-plot:lets-plot-kotlin-jvm:4.7.3")
implementation("org.jetbrains.lets-plot:platf-awt-jvm:4.3.3")

implementation("org.nield:kotlin-statistics:1.2.1")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package ai.hypergraph.kotlingrad.samples
import ai.hypergraph.kaliningraph.visualization.show

import jetbrains.datalore.base.geometry.DoubleVector
import jetbrains.datalore.base.values.Colors
import jetbrains.datalore.plot.PlotSvgExport
import org.jetbrains.letsPlot.awt.plot.PlotSvgExport
import org.jetbrains.letsPlot.geom.*
import org.jetbrains.letsPlot.*
import org.jetbrains.letsPlot.commons.values.Colors
import org.jetbrains.letsPlot.intern.toSpec
import org.jetbrains.letsPlot.label.ggtitle
import org.jetbrains.letsPlot.themes.theme
import kotlin.math.*

fun main() {
Expand Down
16 changes: 8 additions & 8 deletions shipshape/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
plugins {
`java-gradle-plugin`
kotlin("jvm") version "1.8.20-Beta"
id("com.gradle.plugin-publish") version "0.12.0"
kotlin("jvm") version "2.0.0"
id("com.gradle.plugin-publish") version "1.2.1"
}

pluginBundle {
gradlePlugin {
website = "https://github.com/breandan/kotlingrad"
vcsUrl = "https://github.com/breandan/kotlingrad"
description = "A shape-safe code generator for Kotlin."
tags = listOf("uri", "types", "codegen", "kotlin")
// tags = listOf("uri", "types", "codegen", "kotlin")

mavenCoordinates {
groupId = "ai.hypergraph"
artifactId = "shipshape"
}
// mavenCoordinates {
// groupId = "ai.hypergraph"
// artifactId = "shipshape"
// }
}

repositories {
Expand Down

0 comments on commit 66e8cc0

Please sign in to comment.