Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ allprojects {
exclude(group = "ai.grazie.model")
exclude(group = "ai.grazie.utils")
exclude(group = "ai.grazie.nlp")

// We have a transitive dependency on this due to Kermit, but need the fixed version to support Java 8
resolutionStrategy.force("co.touchlab:stately-collections:${libs.versions.stately.get()}")
}

//
Expand Down
37 changes: 34 additions & 3 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import app.cash.sqldelight.core.capitalize
import com.powersync.plugins.sonatype.setupGithubRepository
import de.undercouch.gradle.tasks.download.Download
import org.gradle.internal.os.OperatingSystem
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest
import java.util.*

plugins {
Expand Down Expand Up @@ -76,8 +79,20 @@ val buildCInteropDef by tasks.registering {
kotlin {
androidTarget {
publishLibraryVariants("release", "debug")

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}
jvm {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
// https://jakewharton.com/kotlins-jdk-release-compatibility-flag/
freeCompilerArgs.add("-Xjdk-release=8")
}
}
jvm()

iosX64()
iosArm64()
Expand Down Expand Up @@ -147,8 +162,8 @@ kotlin {
}

android {
kotlin {
jvmToolchain(17)
compileOptions {
targetCompatibility = JavaVersion.VERSION_17
}

buildFeatures {
Expand Down Expand Up @@ -339,6 +354,22 @@ tasks.named<ProcessResources>(kotlin.jvm().compilations["main"].processResources
from(getBinaries, downloadPowersyncDesktopBinaries)
}

// We want to build with recent JDKs, but need to make sure we support Java 8. https://jakewharton.com/build-on-latest-java-test-through-lowest-java/
val testWithJava8 by tasks.registering(KotlinJvmTest::class) {
javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
}

description = "Run tests with Java 8"
group = LifecycleBasePlugin.VERIFICATION_GROUP

// Copy inputs from the normal test task
val testTask = tasks.getByName("jvmTest") as KotlinJvmTest
classpath = testTask.classpath
testClassesDirs = testTask.testClassesDirs
}
tasks.named("check").configure { dependsOn(testWithJava8) }

afterEvaluate {
val buildTasks =
tasks.matching {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,38 +42,38 @@ public actual class DatabaseDriverFactory(
PsSqlDriver(
scope = scope,
driver =
AndroidSqliteDriver(
context = context,
schema = schema,
name = dbFilename,
factory =
RequerySQLiteOpenHelperFactory(
listOf(
RequerySQLiteOpenHelperFactory.ConfigurationOptions { config ->
config.customExtensions.add(
SQLiteCustomExtension(
"libpowersync",
"sqlite3_powersync_init",
),
)
config.customExtensions.add(
SQLiteCustomExtension(
"libpowersync-sqlite",
"powersync_init",
),
)
config
AndroidSqliteDriver(
context = context,
schema = schema,
name = dbFilename,
factory =
RequerySQLiteOpenHelperFactory(
listOf(
RequerySQLiteOpenHelperFactory.ConfigurationOptions { config ->
config.customExtensions.add(
SQLiteCustomExtension(
"libpowersync",
"sqlite3_powersync_init",
),
)
config.customExtensions.add(
SQLiteCustomExtension(
"libpowersync-sqlite",
"powersync_init",
),
)
config
},
),
),
callback =
object : AndroidSqliteDriver.Callback(schema) {
override fun onConfigure(db: SupportSQLiteDatabase) {
db.enableWriteAheadLogging()
super.onConfigure(db)
}
},
),
),
callback =
object : AndroidSqliteDriver.Callback(schema) {
override fun onConfigure(db: SupportSQLiteDatabase) {
db.enableWriteAheadLogging()
super.onConfigure(db)
}
},
),
)
setupSqliteBinding()
return this.driver as PsSqlDriver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ internal data class SyncStatusDataContainer(
get() = downloadError ?: uploadError
}

@ConsistentCopyVisibility
public data class SyncStatus internal constructor(
private var data: SyncStatusDataContainer = SyncStatusDataContainer(),
) : SyncStatusData {
Expand Down
40 changes: 20 additions & 20 deletions core/src/iosMain/kotlin/com/powersync/DatabaseDriverFactory.ios.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,27 @@ public actual class DatabaseDriverFactory {
PsSqlDriver(
scope = scope,
driver =
NativeSqliteDriver(
configuration =
DatabaseConfiguration(
name = dbFilename,
version = schema.version.toInt(),
create = { connection -> wrapConnection(connection) { schema.create(it) } },
loggingConfig = Logging(logger = sqlLogger),
lifecycleConfig =
DatabaseConfiguration.Lifecycle(
onCreateConnection = { connection ->
setupSqliteBinding(connection)
wrapConnection(connection) { driver ->
schema.create(driver)
}
},
onCloseConnection = { connection ->
deregisterSqliteBinding(connection)
},
),
NativeSqliteDriver(
configuration =
DatabaseConfiguration(
name = dbFilename,
version = schema.version.toInt(),
create = { connection -> wrapConnection(connection) { schema.create(it) } },
loggingConfig = Logging(logger = sqlLogger),
lifecycleConfig =
DatabaseConfiguration.Lifecycle(
onCreateConnection = { connection ->
setupSqliteBinding(connection)
wrapConnection(connection) { driver ->
schema.create(driver)
}
},
onCloseConnection = { connection ->
deregisterSqliteBinding(connection)
},
),
),
),
),
)
return this.driver as PsSqlDriver
}
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ java = "17"
idea = "222.4459.24" # Flamingo | 2022.2.1 (see https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html)

# Dependencies
kermit = "2.0.4"
kermit = "2.0.5"
kotlin = "2.0.20"
coroutines = "1.8.1"
kotlinx-datetime = "0.5.0"
Expand All @@ -20,7 +20,7 @@ sqlite-android = "3.45.0"
sqlite-jdbc = "3.45.2.0"

sqlDelight = "2.0.2"
stately = "2.0.7"
stately = "2.1.0"
supabase = "3.0.1"
junit = "4.13.2"

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
20 changes: 17 additions & 3 deletions persistence/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.powersync.plugins.sonatype.setupGithubRepository
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.kotlinMultiplatform)
Expand All @@ -11,9 +13,21 @@ plugins {
kotlin {
androidTarget {
publishLibraryVariants("release", "debug")

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_17)
}
}

jvm()
jvm {
@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
// https://jakewharton.com/kotlins-jdk-release-compatibility-flag/
freeCompilerArgs.add("-Xjdk-release=8")
}
}

iosX64()
iosArm64()
Expand Down Expand Up @@ -45,8 +59,8 @@ kotlin {
}

android {
kotlin {
jvmToolchain(17)
compileOptions {
targetCompatibility = JavaVersion.VERSION_17
}

buildFeatures {
Expand Down
Loading