Skip to content

Commit 4911817

Browse files
committed
Fix dependencies
1 parent 2e689a3 commit 4911817

File tree

2 files changed

+33
-44
lines changed

2 files changed

+33
-44
lines changed

core/build.gradle.kts

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,41 @@ val moveJDBCJNIFiles by tasks.registering(Copy::class) {
127127
into(jniLibsFolder) // Move everything into the base jniLibs folder
128128
}
129129

130-
kotlin {
131-
powersyncTargets()
130+
val generateVersionConstant by tasks.registering {
131+
val target = project.layout.buildDirectory.dir("generated/constants")
132+
val packageName = "com.powersync.build"
132133

133-
targets.configureEach {
134-
compilations.configureEach {
135-
compileTaskProvider.configure {
136-
dependsOn(generateVersionConstant)
137-
}
138-
}
134+
outputs.dir(target)
135+
val currentVersion = version.toString()
139136

140-
if (this is KotlinNativeTarget) {
141-
compilations.named("main") {
142-
compileTaskProvider.configure {
143-
compilerOptions.freeCompilerArgs.add("-Xexport-kdoc")
144-
}
145-
}
146-
}
137+
doLast {
138+
val dir = target.get().asFile
139+
dir.mkdir()
140+
val rootPath = dir.toPath()
141+
142+
val source = """
143+
package $packageName
144+
145+
internal const val LIBRARY_VERSION: String = "$currentVersion"
146+
147+
""".trimIndent()
148+
149+
val packageRoot = packageName.split('.').fold(rootPath, Path::resolve)
150+
packageRoot.createDirectories()
151+
152+
packageRoot.resolve("BuildConstants.kt").writeText(source)
147153
}
154+
}
148155

149-
targets.withType<KotlinNativeTarget> {
156+
kotlin {
157+
powersyncTargets()
150158

159+
targets.withType<KotlinNativeTarget> {
160+
compilations.named("main") {
161+
compileTaskProvider {
162+
compilerOptions.freeCompilerArgs.add("-Xexport-kdoc")
163+
}
164+
}
151165
}
152166

153167
explicitApi()
@@ -173,7 +187,7 @@ kotlin {
173187

174188
commonMain.configure {
175189
kotlin {
176-
srcDir(layout.buildDirectory.dir("generated/constants"))
190+
srcDir(generateVersionConstant)
177191
}
178192

179193
dependencies {
@@ -311,29 +325,3 @@ setupGithubRepository()
311325
dokka {
312326
moduleName.set("PowerSync Core")
313327
}
314-
315-
val generateVersionConstant by tasks.registering {
316-
val target = project.layout.buildDirectory.dir("generated/constants")
317-
val packageName = "com.powersync.build"
318-
319-
outputs.dir(target)
320-
val currentVersion = version.toString()
321-
322-
doLast {
323-
val dir = target.get().asFile
324-
dir.mkdir()
325-
val rootPath = dir.toPath()
326-
327-
val source = """
328-
package $packageName
329-
330-
internal const val LIBRARY_VERSION: String = "$currentVersion"
331-
332-
""".trimIndent()
333-
334-
val packageRoot = packageName.split('.').fold(rootPath, Path::resolve)
335-
packageRoot.createDirectories()
336-
337-
packageRoot.resolve("BuildConstants.kt").writeText(source)
338-
}
339-
}

core/src/nativeMain/kotlin/com/powersync/sync/UserAgent.native.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import com.powersync.build.LIBRARY_VERSION
44
import kotlin.experimental.ExperimentalNativeApi
55

66
@OptIn(ExperimentalNativeApi::class)
7-
internal actual fun userAgent(): String = "PowerSync Kotlin SDK v$LIBRARY_VERSION (running on ${Platform.cpuArchitecture.name} ${Platform.osFamily.name})"
7+
internal actual fun userAgent(): String =
8+
"PowerSync Kotlin SDK v$LIBRARY_VERSION (running on ${Platform.cpuArchitecture.name} ${Platform.osFamily.name})"

0 commit comments

Comments
 (0)