sqldelight icon indicating copy to clipboard operation
sqldelight copied to clipboard

Support wasmJs target

Open IlyaGulya opened this issue 1 year ago • 21 comments

What's impossible for now:

  1. Commonization of WebWorkerDriver can't be done without support for Kotlin arrays interop with wasmJs: https://youtrack.jetbrains.com/issue/KT-57125/Add-interop-with-JavaScript-arrays-to-Kotlin-Wasm

Changes:

  1. Enable wasmJs target in MultiplatformConventions and :driver-test.
  2. Migrate to use kotlin multiplatform default hierarchy template.
  3. Add jsCommon source set containing common code for js and wasmJs targets.
  4. Added jsNativeCommon source set to :runtime module containing common code for native, js, and wasmJs targets.
  5. Enable watchosDeviceArm64 and linuxArm64 because of failing tests.
  6. Support WebWorkerDriver for wasmJs target. Fix all tests to be passing.

IlyaGulya avatar Jan 16 '24 09:01 IlyaGulya

Is the conversion to .gradle.kts required to enable the wasmJs target? If not, it would be best to leave that conversion for a different PR since this one has a lot of files that are just moved and it's more difficult to review the actual changes here.

dellisd avatar Jan 31 '24 01:01 dellisd

Sure, I will revert this change

IlyaGulya avatar Jan 31 '24 07:01 IlyaGulya

@dellisd Hi! I've rebased on the latest master. Here are changes since your comment:

  1. Reverted the migration to .gradle.kts.
  2. Made web-worker-driver tests for js and wasmJs common.
  3. Made createWebWorkerDriver helper function which allows creating the default WebWorkerDriver in the jsCommon sourceSet.
  4. Upgraded Kotlin to 2.0.0-Beta3 and KSP to 2.0.0-Beta3-1.0.17

IlyaGulya avatar Feb 05 '24 07:02 IlyaGulya

@dellisd Hi! I've rebased on latest master. Here're changes since my previous comment:

  1. Upgraded Kotlin to 2.0.0-Beta4 and KSP to 2.0.0-Beta4-1.0.17
  2. Upgraded kotlinx.coroutines to 1.8.0 with wasmJs support
  3. Temporarily added Sonatype repository containing Turbine 1.1.0-SNAPSHOT

IlyaGulya avatar Feb 18 '24 13:02 IlyaGulya

I'm not sure why, but instrumentation tests are failing on CI. They're passing locally on my M1 Max. https://github.com/IlyaGulya/sqldelight/actions/runs/7957378205/job/21719986393

IlyaGulya avatar Feb 19 '24 15:02 IlyaGulya

Turbine 1.1.0 with wasmJs support is out

artemyto avatar Mar 06 '24 17:03 artemyto

Replaced Turbine snapshot with 1.1.0

IlyaGulya avatar Mar 12 '24 09:03 IlyaGulya

Currently trying to fix tests 🙂

IlyaGulya avatar Mar 13 '24 15:03 IlyaGulya

@dellisd Hi! All tests are passing. I was able to rollback the kotlin 2.0 upgrade, so I think it can be merged after the code review 🙂 Please take a look when you will have time.

IlyaGulya avatar Mar 25 '24 18:03 IlyaGulya

Do you need Kotlin 2.0 for this change too? I bumped it in this PR #5217, but I will break my PR into smaller ones.

hfhbd avatar May 30 '24 09:05 hfhbd

Do you need Kotlin 2.0 for this change too? I bumped it in this PR #5217, but I will break my PR into smaller ones.

Not really. But I will be happy to rebase on 2.0 once it's merged 🙂

IlyaGulya avatar May 30 '24 13:05 IlyaGulya

Any updates on this?

tamimattafi avatar Jul 11 '24 13:07 tamimattafi

Any update on the same.

dpnkrg avatar Jul 26 '24 12:07 dpnkrg

Any update on this please?

sunildhiman90 avatar Jul 27 '24 14:07 sunildhiman90

I am also interested in wasm support, it would be very nice to have it ready.

petrstetka avatar Jul 30 '24 08:07 petrstetka

can we get an alpha (early access) version with this change to try it out ? 🙏

ahna92 avatar Aug 10 '24 03:08 ahna92

I was developing a multiplatform library and needed to implement a database. After adding SQLDelight, I realized that the plugin causes errors in the wasmjs module, essentially forcing me to remove this module because there's no way to ignore the error and use SQLDelight on other platforms while handling storage differently in wasm. Currently, libraries like Koin, Ktor, ViewModel, and Lifecycle support wasm, and the lack of SQLDelight support is noticeable.

ghasemdev avatar Aug 10 '24 20:08 ghasemdev