@@ -79,14 +79,23 @@ val buildCInteropDef by tasks.registering {
7979
8080val binariesFolder = project.layout.buildDirectory.dir(" binaries/desktop" )
8181val downloadPowersyncDesktopBinaries by tasks.registering(Download ::class ) {
82+ description = " Download PowerSync core extensions for JVM builds and releases"
83+
8284 val coreVersion = libs.versions.powersync.core.get()
8385 val linux_aarch64 = " https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v$coreVersion /libpowersync_aarch64.so"
8486 val linux_x64 = " https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v$coreVersion /libpowersync_x64.so"
8587 val macos_aarch64 = " https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v$coreVersion /libpowersync_aarch64.dylib"
8688 val macos_x64 = " https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v$coreVersion /libpowersync_x64.dylib"
8789 val windows_x64 = " https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v$coreVersion /powersync_x64.dll"
8890
89- if (binariesAreProvided) {
91+ val includeAllPlatformsForJvmBuild = project.findProperty(" powersync.binaries.allPlatforms" ) == " true"
92+ val os = OperatingSystem .current()
93+
94+ // The jar we're releasing for JVM clients needs to include the core extension. For local tests, it's enough to only
95+ // download the extension for the OS running the build. For releases, we want to include them all.
96+ // We're not compiling native code for JVM builds here (we're doing that for Android only), so we just have to
97+ // fetch prebuilt binaries from the powersync-sqlite-core repository.
98+ if (includeAllPlatformsForJvmBuild) {
9099 src(listOf (linux_aarch64, linux_x64, macos_aarch64, macos_x64, windows_x64))
91100 } else {
92101 val (aarch64, x64) = when {
@@ -96,10 +105,9 @@ val downloadPowersyncDesktopBinaries by tasks.registering(Download::class) {
96105 else -> error(" Unknown operating system: $os " )
97106 }
98107 val arch = System .getProperty(" os.arch" )
99- src(when {
100- crossArch -> listOfNotNull(aarch64, x64)
101- arch == " aarch64" -> listOfNotNull(aarch64)
102- arch == " amd64" || arch == " x86_64" -> listOfNotNull(x64)
108+ src(when (arch) {
109+ " aarch64" -> listOfNotNull(aarch64)
110+ " amd64" , " x86_64" -> listOfNotNull(x64)
103111 else -> error(" Unsupported architecture: $arch " )
104112 })
105113 }
@@ -297,14 +305,6 @@ android {
297305 }
298306}
299307
300- val os = OperatingSystem .current()
301- val binariesAreProvided = project.findProperty(" powersync.binaries.provided" ) == " true"
302- val crossArch = project.findProperty(" powersync.binaries.cross-arch" ) == " true"
303-
304- if (binariesAreProvided && crossArch) {
305- error(" powersync.binaries.provided and powersync.binaries.cross-arch must not be both defined." )
306- }
307-
308308tasks.named<ProcessResources >(kotlin.jvm().compilations[" main" ].processResourcesTaskName) {
309309 from(downloadPowersyncDesktopBinaries)
310310}
0 commit comments