Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linux and mingw x64 target to the paging extension #4280

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 19 additions & 4 deletions drivers/native-driver/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeOutputKind

plugins {
alias(libs.plugins.kotlin.multiplatform)
Expand Down Expand Up @@ -50,19 +51,33 @@ kotlin {

configure([targets.iosX64, targets.iosArm64, targets.tvosX64, targets.tvosArm64, targets.watchosX64, targets.watchosArm32, targets.watchosArm64, targets.macosX64, targets.macosArm64, targets.iosSimulatorArm64, targets.watchosSimulatorArm64, targets.tvosSimulatorArm64]) {
binaries.configureEach {
linkerOpts += ["-lsqlite3"]
// we only need to link sqlite for the test binaries
if (outputKind == NativeOutputKind.TEST) {
linkerOpts += ["-lsqlite3"]
}
}
}

configure([targets.linuxX64]) {
binaries.configureEach {
linkerOpts += ["-L$rootDir/libs/linux".toString(), "-lsqlite3"]
compilations.configureEach {
if (name == "test") {
cinterops {
sqlite {
// use sqlite3 amalgamation on linux tests to prevent linking issues on new linux distros with dependency libraries which are to recent (for example glibc)
// see: https://github.com/touchlab/SQLiter/pull/38#issuecomment-867171789
defFile = new File("$rootDir/libs/linux/cinterop/sqlite3.def")
}
}
}
}
}

configure([targets.mingwX64]) {
binaries.configureEach {
linkerOpts += ["-Lc:\\msys64\\mingw64\\lib", "-L$rootDir\\libs\\windows".toString(), "-lsqlite3"]
// we only need to link sqlite for the test binaries
if (outputKind == NativeOutputKind.TEST) {
linkerOpts += ["-Lc:\\msys64\\mingw64\\lib", "-L$rootDir\\libs\\windows".toString(), "-lsqlite3"]
}
}
}
}
Expand Down
65 changes: 63 additions & 2 deletions extensions/androidx-paging3/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeOutputKind

plugins {
alias(libs.plugins.kotlin.multiplatform)
alias(libs.plugins.publish)
Expand All @@ -14,6 +17,8 @@ kotlin {
js {
browser()
}
linuxX64()
mingwX64()

sourceSets {
commonMain {
Expand All @@ -30,11 +35,21 @@ kotlin {
implementation libs.stately.concurrency
}
}
nativeMain {
}
nativeTest {
dependsOn(nativeMain)
dependsOn(commonTest)
dependencies {
implementation projects.drivers.nativeDriver
}
}
iosMain {
dependsOn(nativeMain)
}
iosTest {
dependsOn(nativeTest)
dependencies {
implementation projects.drivers.nativeDriver
implementation libs.app.cash.paging.runtime.uikit
}
}
Expand All @@ -44,6 +59,18 @@ kotlin {
iosSimulatorArm64Test {
dependsOn(iosTest)
}
linuxX64Main {
dependsOn(nativeMain)
}
linuxX64Test {
dependsOn(nativeTest)
}
mingwX64Main {
dependsOn(nativeMain)
}
mingwX64Test {
dependsOn(nativeTest)
}
jvmTest {
dependencies {
implementation projects.drivers.sqliteDriver
Expand All @@ -59,9 +86,43 @@ kotlin {

configure([targets.iosX64, targets.iosArm64, targets.iosSimulatorArm64]) {
binaries.configureEach {
linkerOpts += ["-lsqlite3"]
// we only need to link sqlite for the test binaries
if (outputKind == NativeOutputKind.TEST) {
linkerOpts += ["-lsqlite3"]
}
}
}

configure([targets.linuxX64]) {
compilations.configureEach {
if (name == "test") {
cinterops {
sqlite {
// use sqlite3 amalgamation on linux tests to prevent linking issues on new linux distros with dependency libraries which are to recent (for example glibc)
// see: https://github.com/touchlab/SQLiter/pull/38#issuecomment-867171789
defFile = new File("$rootDir/libs/linux/cinterop/sqlite3.def")
}
}
}
}
}

configure([targets.mingwX64]) {
binaries.configureEach {
// we only need to link sqlite for the test binaries
if (outputKind == NativeOutputKind.TEST) {
linkerOpts += ["-Lc:\\msys64\\mingw64\\lib", "-L$rootDir\\libs\\windows".toString(), "-lsqlite3"]
}
}
}
}

//linking fails for the linux test build if not built on a linux host
//ensure the tests and linking for them is only done on linux hosts
tasks.named("linuxX64Test") { enabled = HostManager.hostIsLinux }
tasks.named("linkDebugTestLinuxX64") { enabled = HostManager.hostIsLinux }

tasks.named("mingwX64Test") { enabled = HostManager.hostIsMingw }
tasks.named("linkDebugTestMingwX64") { enabled = HostManager.hostIsMingw }

apply from: "$rootDir/gradle/gradle-mvn-push.gradle"
25 changes: 21 additions & 4 deletions extensions/coroutines-extensions/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.NativeOutputKind

plugins {
alias(libs.plugins.publish)
alias(libs.plugins.dokka)
Expand Down Expand Up @@ -47,18 +49,33 @@ kotlin {

configure([targets.iosX64, targets.iosArm64, targets.tvosX64, targets.tvosArm64, targets.watchosX64, targets.watchosArm32, targets.watchosArm64, targets.macosX64, targets.macosArm64, targets.iosSimulatorArm64, targets.watchosSimulatorArm64, targets.tvosSimulatorArm64]) {
binaries.configureEach {
linkerOpts += ['-lsqlite3']
// we only need to link sqlite for the test binaries
if (outputKind == NativeOutputKind.TEST) {
linkerOpts += ["-lsqlite3"]
}
}
}

configure([targets.linuxX64]) {
binaries.configureEach {
linkerOpts += ["-L$rootDir/libs/linux".toString(), "-lsqlite3"]
compilations.configureEach {
if (name == "test") {
cinterops {
sqlite {
// use sqlite3 amalgamation on linux tests to prevent linking issues on new linux distros with dependency libraries which are to recent (for example glibc)
// see: https://github.com/touchlab/SQLiter/pull/38#issuecomment-867171789
defFile = new File("$rootDir/libs/linux/cinterop/sqlite3.def")
}
}
}
}
}

configure([targets.mingwX64]) {
binaries.configureEach {
linkerOpts += ["-Lc:\\msys64\\mingw64\\lib", "-L$rootDir\\libs\\windows".toString(), "-lsqlite3"]
// we only need to link sqlite for the test binaries
if (outputKind == NativeOutputKind.TEST) {
linkerOpts += ["-Lc:\\msys64\\mingw64\\lib", "-L$rootDir\\libs\\windows".toString(), "-lsqlite3"]
}
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ kotlin.js.compiler=ir
kotlin.mpp.stability.nowarn=true
kotlin.native.ignoreDisabledTargets=true
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=1g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# caches break the linkage of the sqlite amalgamation
kotlin.native.cacheKind.linuxX64=none
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ stately = "1.2.5"
sqliter = "1.2.3"
testhelp = "0.6.5"
sqljs = "1.8.0"
paging-mpp = "3.1.1-0.2.0"
paging-mpp = "3.1.1-0.3.0"
paging3 = "3.1.1"
ktlint = "0.49.1"
agp = "8.0.2"
Expand Down
4 changes: 0 additions & 4 deletions libs/linux/Dockerfile

This file was deleted.

Loading