Skip to content

Commit

Permalink
Update to kotlin 1.8.10 (#61)
Browse files Browse the repository at this point in the history
* first attempt to update to 1.8.10

* use jvalues on jvm which seems to work unlike the method casting

* more stuff into jvalues

* set kotlin compiler target in buildPlugin

* upgrade gradle and agp, workaround for jni libs bug
  • Loading branch information
yigit authored Apr 26, 2023
1 parent 345841a commit 88a2dc6
Show file tree
Hide file tree
Showing 20 changed files with 433 additions and 354 deletions.
2 changes: 1 addition & 1 deletion .github/actions/commonSetup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ runs:
- name: Setup Java environment based on setup-java
uses: actions/setup-java@v1
with:
java-version: '11'
java-version: '17'
java-package: jdk
architecture: x64
- name: Cache konan
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/run-device-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
if: ${{ !github.event.repository.fork && github.event.workflow_run.conclusion == 'success' }}
name: Run integration tests on FTL
steps:
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '11'
java-version: '17'
distribution: 'zulu'
- name: "set output directory"
run: |
Expand Down
1 change: 0 additions & 1 deletion buildPlugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ configure<GradlePluginDevelopmentExtension> {
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ abstract class CollectNativeLibrariesTask : DefaultTask() {
"ForJvm"
}
return project.tasks.register(
"collectSharedLibsFor${namePrefix.titleCase()}}$suffix",
"collectSharedLibsFor${namePrefix.titleCase()}$suffix",
CollectNativeLibrariesTask::class.java
) {
configure(it, namePrefix, outFolder, forAndroid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class KSqliteBuildPlugin : Plugin<Project> {
"ksqliteBuild"
)
target.disableCinteropUpToDateChecks()
target.tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
it.kotlinOptions.jvmTarget = "1.8"
}
}

private fun Project.disableCinteropUpToDateChecks() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal object AndroidSetup {
getByName("androidTest").java
.srcDir(project.file("src/androidTest/kotlin"))
}
androidLibrary.ndkVersion = "21.3.6528147"
androidLibrary.ndkVersion = "23.1.7779620"
val debugSigningConfig = androidLibrary.signingConfigs.getByName("debug")
// Use a local debug keystore to have reproducible test apks
debugSigningConfig.storeFile = project.getDebugKeystore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*/
package com.birbit.ksqlite.build.internal

import org.jetbrains.kotlin.konan.target.Family
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.KonanTarget
import java.util.Locale
import java.util.Properties

internal object KonanPropLoader {
Expand Down Expand Up @@ -53,6 +56,11 @@ internal object KonanPropLoader {
}

fun sysroot(target: KonanTarget): String {
if (target.family == Family.ANDROID) {
// android sysroot with sources lives in another property, not sure why but this seems to work
val keyName = (HostManager.host.name.lowercase(Locale.US) + "-" + target.name)
return loadPropertyWithKeySubstitution("targetToolchain.$keyName") + "/sysroot"
}
return loadPropertyWithKeySubstitution("targetSysRoot.${target.name}")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ internal object KonanUtil {
val appleSdkRoot = getAppleSdkRoot(target)
if (appleSdkRoot != null) {
File(appleSdkRoot)
} else if (target.family == Family.ANDROID) {
// TODO we should be able to use the standard sysroot from props, figure out
// why the actual sysroot is only available in dependencies
project.ndkSysrootDir()
} else {
konanDeps.resolve(
konanProps.sysroot(target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ internal object SqliteCompilation {
it.dir(konanTarget.presetName).file("sqlite-generated.def")
}
val createDefFileTask = project.tasks.register(
"createDefFileForSqlite${konanTarget.presetName.titleCase()}}",
"createDefFileForSqlite${konanTarget.presetName.titleCase()}",
CreateDefFileWithLibraryPathTask::class.java
) { task ->
task.dependsOn(archiveSQLite)
Expand Down
Loading

0 comments on commit 88a2dc6

Please sign in to comment.