Skip to content

Commit

Permalink
Kotlin 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
romainbsl committed Aug 13, 2023
1 parent 3b8fb3e commit 8b826a9
Show file tree
Hide file tree
Showing 12 changed files with 569 additions and 526 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ jobs:
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Cached Gradle
uses: actions/cache@v2
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 #v2
- name: Set up JDK 17
uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc #v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
# Host only for MacOS / Windows
- name: Check (macos / windows)
if: matrix.os != 'ubuntu-latest'
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,12 @@ jobs:
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Cached Gradle
uses: actions/cache@v2
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 #v2
- name: Set up JDK 17
uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc #v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
# Host only for MacOS / Windows
- name: Check (macos / windows)
if: matrix.os != 'ubuntu-latest'
Expand Down
13 changes: 5 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ jobs:
key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-konan-
- name: Cached Gradle
uses: actions/cache@v2
with:
path: ~/.gradle
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629 #v2
- name: Set up JDK 17
uses: actions/setup-java@de1bb2b0c5634f0fc4438d7aa9944e68f9bf86cc #v3
with:
java-version: 11
java-version: 17
distribution: 'temurin'
- name: Check
run: ./gradlew check
shell: bash
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id("org.kodein.root")
kodein.root
}

allprojects {
group = "org.kodein.log"
version = "0.18.0"
version = "0.19.0"
}
150 changes: 108 additions & 42 deletions canard/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,67 +1,133 @@
plugins {
id("org.kodein.library.mpp")
kodein.library.mpp
}

kodein {
kotlin {
val datetimeMain by sourceSets.creating {
dependsOn(common.main)
dependencies {
api(libs.kotlinx.datetime)
}
kotlin.kodein {
jsEnv()

// all() TODO kotlinx-datetime does not support WASM

val commonMain by common.main
// val datetimeMain by sourceSets.creating {
// dependsOn(common.main)
// dependencies {
// api(libs.kotlinx.datetime)
// }
// }
val datetimeMain by kotlin.sourceSets.creating {
dependsOn(commonMain)
dependencies {
api(libs.kotlinx.datetime)
}
}

add(kodeinTargets.jvm.jvm) {
main.dependsOn(datetimeMain)
target.setCompileClasspath()
main.dependencies {
// add(kodeinTargets.jvm.jvm) {
// main.dependsOn(datetimeMain)
// target.setCompileClasspath()
// main.dependencies {
// implementation(libs.slf4j.api)
// compileOnly(rootProject.files("libs/android-log.jar"))
// }
// }
// }
jvm {
target.setCompileClasspath()
sources.main {
dependsOn(datetimeMain)
dependencies {
implementation(libs.slf4j.api)
compileOnly(rootProject.files("libs/android-log.jar"))
}
}
}

add(kodeinTargets.js.js) {
main.dependsOn(datetimeMain)
configure(listOf(mainCompilation, testCompilation)) {
kotlinOptions {
sourceMap = true
sourceMapEmbedSources = "always"
}
// add(kodeinTargets.js.js) {
// main.dependsOn(datetimeMain)
// configure(listOf(mainCompilation, testCompilation)) {
// kotlinOptions {
// sourceMap = true
// sourceMapEmbedSources = "always"
// }
// }
// }
js {
sources.main { dependsOn(datetimeMain) }
compilations.configureEach {
kotlinOptions {
sourceMap = true
sourceMapEmbedSources = "always"
}
}
}

val defaultNativeMain by sourceSets.creating {
dependsOn(common.main)
}

add(kodeinTargets.native.allDesktop) {
main {
dependsOn(defaultNativeMain)
dependsOn(datetimeMain)
}
}
val allNativeMain by kotlin.sourceSets.creating {
dependsOn(commonMain)
}
// val defaultNativeMain by sourceSets.creating {
// dependsOn(common.main)
// }
val defaultNativeMain by kotlin.sourceSets.creating {
dependsOn(allNativeMain)
}

val embeddedNativeMain by sourceSets.creating {
dependsOn(common.main)
// add(kodeinTargets.native.allDesktop) {
// main {
// dependsOn(defaultNativeMain)
// dependsOn(datetimeMain)
// }
// }
allDesktop {
sources.main {
dependsOn(defaultNativeMain)
dependsOn(datetimeMain)
}
}

add(kodeinTargets.native.allEmbeddedLinux) {
main {
dependsOn(defaultNativeMain)
dependsOn(embeddedNativeMain)
}
}
// val embeddedNativeMain by sourceSets.creating {
// dependsOn(common.main)
// }
val embeddedNativeMain by kotlin.sourceSets.creating {
dependsOn(allNativeMain)
}

add(kodeinTargets.native.allDarwin) {
main.dependsOn(datetimeMain)
mainCompilation.cinterops.create("darwin_log")
// add(kodeinTargets.native.allEmbeddedLinux) {
// main {
// dependsOn(defaultNativeMain)
// dependsOn(embeddedNativeMain)
// }
// }
linuxArm64 {
sources.main {
dependsOn(defaultNativeMain)
dependsOn(embeddedNativeMain)
}
}

sourceSets.all {
// add(kodeinTargets.native.allDarwin) {
// main.dependsOn(datetimeMain)
// mainCompilation.cinterops.create("darwin_log")
// }
val allAppleMobileMain by kotlin.sourceSets.creating {
dependsOn(allNativeMain)
}
// TODO watchosDeviceArm64 is not supported by KotlinX DateTime
addAll(targets.allAppleMobile - targets.watchosDeviceArm64) {
sources.main {
dependsOn(allAppleMobileMain)
dependsOn(datetimeMain)
languageSettings {
optIn("kotlin.RequiresOptIn")
optIn("kotlinx.cinterop.ExperimentalForeignApi")
}
}
compilations.main {
cinterops.create("darwin_log")
}
}
}

kotlin.sourceSets.all {
languageSettings {
optIn("kotlin.RequiresOptIn")
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
@file:OptIn(ExperimentalNativeApi::class, ExperimentalForeignApi::class)

package org.kodein.log.frontend

import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.cstr
import platform.posix.*
import platform.posix.fdopen
import platform.posix.fprintf
import kotlin.experimental.ExperimentalNativeApi
import kotlin.native.concurrent.SharedImmutable


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@file:OptIn(UnsafeNumber::class)
@file:OptIn(ExperimentalForeignApi::class)

package org.kodein.log

Expand Down
15 changes: 6 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ org.gradle.jvmargs = -Xmx4g -XX:MaxMetaspaceSize=2g
org.gradle.parallel = true

# Kotlin
kotlin.native.ignoreDisabledTargets = true
kotlin.incremental.multiplatform = true
kotlin.parallel.tasks.in.project = true
kotlin.mpp.hierarchicalStructureSupport=false
kotlin.mpp.stability.nowarn=true
# To enable compatibility with non-hierarchical projects
# https://kotlinlang.org/docs/multiplatform-hierarchy.html#for-library-authors
kotlin.mpp.enableCompatibilityMetadataVariant=true
kotlin.mpp.enableCInteropCommonization=true

# Android
android.useAndroidX = true
android.enableJetifier=true
android.useAndroidX=true

# KIGP
org.kodein.jvm-version=17
Loading

0 comments on commit 8b826a9

Please sign in to comment.