Skip to content

Commit

Permalink
Unify dependencies in versions toml, upgrade kotlin to 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Monkopedia committed Jul 9, 2023
1 parent 1c3da11 commit a606067
Show file tree
Hide file tree
Showing 28 changed files with 186 additions and 102 deletions.
21 changes: 12 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.dokka.plugability.ConfigurableBlock

/*
* Copyright 2020 Jason Monk
*
Expand All @@ -17,26 +21,25 @@ import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration

buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.20")
classpath("org.jetbrains.dokka:dokka-base:1.7.20")
classpath(libs.bundles.dokka)
}
extra["kotlin_plugin_id"] = "com.monkopedia.ksrpc.plugin"
}
plugins {
kotlin("plugin.serialization") version "1.8.0" apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.kapt) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.dokka)

id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
id("com.github.hierynomus.license") version "0.16.1"

id("com.github.gmazzo.buildconfig") version "3.1.0" apply false
id("ksrpc-generate-module")
id("com.monkopedia.ksrpc.plugin") apply false
id("org.jetbrains.dokka") version "1.7.20"
}

group = "com.monkopedia.ksrpc"
Expand Down
17 changes: 7 additions & 10 deletions compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,25 @@
*/

buildscript {
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.7.20")
classpath(libs.bundles.dokka)
}
extra["kotlin_plugin_id"] = "com.monkopedia.ksrpc.plugin"
}
plugins {
kotlin("plugin.serialization") version "1.8.0" apply false
id("com.github.hierynomus.license") version "0.16.1"
id("org.jlleitschuh.gradle.ktlint") version "11.0.0"
alias(libs.plugins.kotlin) apply false
alias(libs.plugins.kotlin.serialization) apply false
alias(libs.plugins.hierynomus.license)
alias(libs.plugins.jlleitschuh.ktlint)

id("com.github.gmazzo.buildconfig") version "3.1.0" apply false
alias(libs.plugins.gmazzo.buildconfig) apply false
}

group = "com.monkopedia.ksrpc"

allprojects {
repositories {
google()
mavenLocal()
mavenCentral()
}
Expand Down
1 change: 1 addition & 0 deletions compiler/gradle/libs.versions.toml
2 changes: 1 addition & 1 deletion compiler/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.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions compiler/local-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("gradle-plugin-api"))
implementation(gradleKotlinDsl())
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0")
api("org.jetbrains.dokka:dokka-gradle-plugin:1.7.20")
api(libs.kotlin.gradle)
api(libs.bundles.dokka)
}

java {
Expand Down
15 changes: 1 addition & 14 deletions compiler/local-plugin/src/main/kotlin/GenerateKsrpcProject.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,33 +100,21 @@ fun Project.ksrpcModule(
if (name != "ksrpc-core") {
api(project(":ksrpc-core"))
}
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("org.jetbrains.kotlinx:atomicfu:0.18.5")
}
sourceSets["commonTest"].dependencies {
implementation(kotlin("test"))
}
if (supportJvm) {
sourceSets["jvmMain"].dependencies {
implementation("com.aventrix.jnanoid:jnanoid:2.0.0")

implementation(kotlin("stdlib"))
implementation(kotlin("reflect"))
implementation("org.slf4j:slf4j-api:2.0.6")
}
sourceSets["jvmTest"].dependencies {
implementation(kotlin("test-junit"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
}
}
if (supportJs) {
sourceSets["jsMain"].dependencies {
implementation(npm("nanoid", "3.1.22"))
}
sourceSets["jsTest"].dependencies {
implementation(kotlin("test-js"))
Expand All @@ -135,7 +123,6 @@ fun Project.ksrpcModule(
if (supportNative) {
sourceSets["nativeMain"].dependencies {
implementation(kotlin("stdlib"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
}
}
}
Expand All @@ -157,7 +144,7 @@ fun Project.ksrpcModule(

val dokkaJavadoc = tasks.create("dokkaJavadocCustom", DokkaTask::class) {
it.project.dependencies {
it.plugins("org.jetbrains.dokka:kotlin-as-java-plugin:1.7.20")
it.plugins("org.jetbrains.dokka:kotlin-as-java-plugin")
}
// outputFormat = "javadoc"
it.outputDirectory.set(File(project.buildDir, "javadoc"))
Expand Down
6 changes: 3 additions & 3 deletions compiler/native/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ java {
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-compiler")

kapt("com.google.auto.service:auto-service:1.0-rc7")
compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc7")
kapt(libs.autoservice)
compileOnly(libs.autoservice.annotations)
}

tasks.named("compileKotlin") { dependsOn("syncSource") }
Expand Down Expand Up @@ -95,7 +95,7 @@ publishing {

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable")
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all")
}

signing {
Expand Down
10 changes: 5 additions & 5 deletions compiler/plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ java {
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable")

kapt("com.google.auto.service:auto-service:1.0-rc7")
compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc7")
kapt(libs.autoservice)
compileOnly(libs.autoservice.annotations)

testImplementation("com.monkopedia:ksrpc:0.6.0")
testImplementation(libs.ksrpctest)
testImplementation(kotlin("test-junit"))
testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")
testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.4.9")
testImplementation(libs.kotlin.compiletesting)
}

buildConfig {
Expand Down Expand Up @@ -91,7 +91,7 @@ publishing {

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable")
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=all")
}

signing {
Expand Down
7 changes: 7 additions & 0 deletions compiler/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}

include(":ksrpc-gradle-plugin")
project(":ksrpc-gradle-plugin").projectDir = file("gradle")
Expand Down
62 changes: 62 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[versions]
gradleplugin = "8.0.0"
kotlin = "1.9.0"
kotlin-serialization = "1.5.1"
kotlin-coroutines = "1.7.2"
kotlin-atomicfu = "0.21.0"
kotlin-compiletesting = "1.4.9"
dokka = "1.8.20"
ktor = "2.3.2"
googleautoservice = "1.0.1"
ksrpctest = "0.7.1"
nanoid = "3.1.22"
jnanoid = "2.0.0"
slf4j = "2.0.6"
clikt = "3.5.1"

[libraries]
dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka" }
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
autoservice = { module = "com.google.auto.service:auto-service", version.ref = "googleautoservice" }
autoservice-annotations = { module = "com.google.auto.service:auto-service-annotations", version.ref = "googleautoservice" }
ksrpctest = { module = "com.monkopedia.ksrpc:ksrpc-core", version.ref = "ksrpctest"}
kotlin-compiletesting = { module = "com.github.tschuchortdev:kotlin-compile-testing", version.ref = "kotlin-compiletesting"}
ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" }
kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlin-serialization"}
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization"}
kotlinx-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines"}
kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "kotlin-atomicfu"}
jnanoid = { module = "com.aventrix.jnanoid:jnanoid", version.ref = "jnanoid" }
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j"}
ktor-client = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
ktor-server = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
ktor-server-websockets = { module = "io.ktor:ktor-server-websockets", version.ref = "ktor" }
ktor-server-cors = { module = "io.ktor:ktor-server-cors", version.ref = "ktor" }
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" }
ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" }
ktor-kotlinx-serialization = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
ktor-jackson-serialization = { module = "io.ktor:ktor-serialization-jackson", version.ref = "ktor" }
ktor-websockets = { module = "io.ktor:ktor-websockets", version.ref = "ktor" }
ktor-websockets-serialization = { module = "io.ktor:ktor-websocket-serialization", version.ref = "ktor" }
clikt = { module = "com.github.ajalt.clikt:clikt", version.ref = "clikt"}

[bundles]
dokka = ["dokka-base", "dokka-gradle"]

[plugins]
android-application = { id = "com.android.application", version.ref = "gradleplugin" }
android-library = { id = "com.android.library", version.ref = "gradleplugin" }
kotlin = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
hierynomus-license = { id = "com.github.hierynomus.license", version = "0.16.1" }
jlleitschuh-ktlint = { id = "org.jlleitschuh.gradle.ktlint", version = "11.0.0" }
gmazzo-buildconfig = { id = "com.github.gmazzo.buildconfig", version = "3.1.0" }
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.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
9 changes: 8 additions & 1 deletion ksrpc-core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ ksrpcModule()

kotlin {
sourceSets["commonMain"].dependencies {
api("io.ktor:ktor-io:2.2.1")
api(libs.ktor.io)
api(libs.kotlinx.serialization)
api(libs.kotlinx.serialization.json)
api(libs.kotlinx.coroutines)
api(libs.kotlinx.atomicfu)
}
sourceSets["jvmMain"].dependencies {
implementation(libs.jnanoid)
implementation(libs.slf4j.api)
}
sourceSets["jsMain"].dependencies {
implementation(npm("nanoid", libs.versions.nanoid.get()))
}
sourceSets["nativeMain"].dependencies {
}
Expand Down
2 changes: 2 additions & 0 deletions ksrpc-core/src/nativeMain/kotlin/EpochMillis.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
*/
package com.monkopedia.ksrpc

import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.alloc
import kotlinx.cinterop.memScoped
import kotlinx.cinterop.ptr
import platform.posix.gettimeofday
import platform.posix.timeval

@OptIn(ExperimentalForeignApi::class)
internal actual fun epochMillis(): Long = memScoped {
val timeVal = alloc<timeval>()
gettimeofday(timeVal.ptr, null)
Expand Down
2 changes: 1 addition & 1 deletion ksrpc-jsonrpc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ kotlin {
sourceSets["commonMain"].dependencies {
api(project(":ksrpc-packets"))
api(project(":ksrpc-sockets"))
api("io.ktor:ktor-io:2.2.1")
api(libs.ktor.io)
}
sourceSets["jvmMain"].dependencies {
}
Expand Down
16 changes: 8 additions & 8 deletions ksrpc-ktor/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ ksrpcModule()

kotlin {
sourceSets["commonMain"].dependencies {
implementation("io.ktor:ktor-client-core:2.2.1")
implementation("io.ktor:ktor-http:2.2.1")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.2.1")
implementation(libs.ktor.client)
implementation(libs.ktor.http)
implementation(libs.ktor.kotlinx.serialization)
}
sourceSets["jvmMain"].dependencies {
compileOnly("io.ktor:ktor-client-core:2.2.1")
compileOnly(libs.ktor.client)

implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1")
implementation(libs.kotlinx.serialization)
implementation(libs.kotlinx.serialization.json)
}
sourceSets["jsMain"].dependencies {
compileOnly("io.ktor:ktor-client-core:2.2.1")
compileOnly(libs.ktor.client)
}
sourceSets["nativeMain"].dependencies {
implementation("io.ktor:ktor-client-curl:2.2.1")
implementation(libs.ktor.client.curl)
}
}
2 changes: 1 addition & 1 deletion ksrpc-ktor/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ ksrpcModule(

kotlin {
sourceSets["commonMain"].dependencies {
api("io.ktor:ktor-server-core:2.2.1")
api(libs.ktor.server)
}
}
2 changes: 1 addition & 1 deletion ksrpc-ktor/websocket/client/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ ksrpcModule()
kotlin {
sourceSets["commonMain"].dependencies {
api(project(":ksrpc-ktor-websocket-shared"))
implementation("io.ktor:ktor-client-websockets:2.2.1")
implementation(libs.ktor.client.websockets)
}
}
2 changes: 1 addition & 1 deletion ksrpc-ktor/websocket/server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ ksrpcModule(
kotlin {
sourceSets["commonMain"].dependencies {
api(project(":ksrpc-ktor-websocket-shared"))
api("io.ktor:ktor-server-websockets:2.2.1")
api(libs.ktor.server.websockets)
}
}
6 changes: 3 additions & 3 deletions ksrpc-ktor/websocket/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ksrpcModule()
kotlin {
sourceSets["commonMain"].dependencies {
api(project(":ksrpc-packets"))
api("io.ktor:ktor-websockets:2.2.1")
api("io.ktor:ktor-websocket-serialization:2.2.1")
api("io.ktor:ktor-serialization-kotlinx-json:2.2.1")
api(libs.ktor.websockets)
api(libs.ktor.websockets.serialization)
api(libs.ktor.kotlinx.serialization)
}
}
Loading

0 comments on commit a606067

Please sign in to comment.