Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support wasmJs target #4965

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

Closed
wants to merge 13 commits into from
Closed

Conversation

IlyaGulya
Copy link
Contributor

@IlyaGulya IlyaGulya commented Jan 16, 2024

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.

@dellisd dellisd self-assigned this Jan 17, 2024
@dellisd
Copy link
Collaborator

dellisd commented Jan 31, 2024

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.

@IlyaGulya
Copy link
Contributor Author

Sure, I will revert this change

@IlyaGulya IlyaGulya force-pushed the feature/wasmJs branch 6 times, most recently from 2c9fe7e to 5c2d9a3 Compare February 5, 2024 07:24
@IlyaGulya
Copy link
Contributor Author

@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
Copy link
Contributor Author

IlyaGulya commented Feb 18, 2024

@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 IlyaGulya force-pushed the feature/wasmJs branch 2 times, most recently from 0f55176 to 8d53f00 Compare February 19, 2024 06:06
@IlyaGulya
Copy link
Contributor Author

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

@artemyto
Copy link

artemyto commented Mar 6, 2024

Turbine 1.1.0 with wasmJs support is out

@IlyaGulya
Copy link
Contributor Author

Replaced Turbine snapshot with 1.1.0

@IlyaGulya
Copy link
Contributor Author

Currently trying to fix tests 🙂

@IlyaGulya IlyaGulya force-pushed the feature/wasmJs branch 6 times, most recently from 49e197c to 672ff65 Compare March 20, 2024 12:49
@IlyaGulya IlyaGulya changed the title [WIP] Support wasmJs target Support wasmJs target Mar 25, 2024
@IlyaGulya IlyaGulya changed the title Support wasmJs target [WIP] Support wasmJs target Mar 25, 2024
@IlyaGulya IlyaGulya force-pushed the feature/wasmJs branch 2 times, most recently from 8838b26 to f3fbc73 Compare March 25, 2024 16:01
@dpnkrg
Copy link

dpnkrg commented Oct 1, 2024

Still any update on the same

@ahna92
Copy link

ahna92 commented Oct 12, 2024

Hi
Until this MR is merged ,
I've created a no operation wasm target version 2.1.0-wasm-no-op.4

Need to make some changes while adding the lib

update settings.gradle.kts

pluginManagement {
    repositories {
        mavenLocal()
        google()
        gradlePluginPortal()
        mavenCentral()
+        maven { url = uri("https://s01.oss.sonatype.org/content/groups/staging") } // <---- add this
    }
}

dependencyResolutionManagement {
    repositories {
        mavenLocal()
        google()
        mavenCentral()
+        maven { url = uri("https://s01.oss.sonatype.org/content/groups/staging") } // <---- add this
    }
}

then update only plugin and library group, app.cash.sqldelight -> io.telereso.kmp.sqldelight

-id("app.cash.sqldelight") version "2.0.2"
+id("io.telereso.kmp.sqldelight") version "2.1.0-wasm-no-op.4"
-implementation("app.cash.sqldelight:sqlite-driver:2.0.2")
+implementation("io.telereso.kmp.sqldelight:sqlite-driver:2.1.0-wasm-no-op.4")

No need to update src classes imports


My use case that I had 9 project with db I needed to expose to web ,
I've tested 1 so far it worked
I had to change the logic to not store/fetch from db in browser target, but rather use network directly

I'll try to publish this MR too to see if it works or not , but need some time

@GGsrvg
Copy link

GGsrvg commented Oct 22, 2024

@dellisd any update?

@IlyaGulya
Copy link
Contributor Author

Upgraded to latest master, fixed all errors.

@dellisd
Copy link
Collaborator

dellisd commented Oct 26, 2024

I appreciate the huge amount of enthusiasm around this PR, and I want to say that I'm also very excited about the prospect of using SQLDelight in Wasm projects.

I also really appreciate the contributions being made here, but this PR is very difficult to review as-is because of its size and because of all of the changes that aren't directly related to enabling Wasm that are being pulled into here.

My recommendation would be to break this PR up into a few smaller PRs that are more focused and will be easier/quicker to review:

  1. A PR that enables the wasmJs() target in the runtime and extensions
  2. A PR that adds Wasm support for the web worker driver
  3. Additional PRs to make other gradle config/code cleanliness changes after the fact

Thank you!

@ahna92
Copy link

ahna92 commented Oct 26, 2024

@dellisd Agree, there are lots of changes to just accept ,

but until it's broken down, can we get snapshot from this PR,
we already have some none production use cases that are only blocked by sqldelight right now
we can help test the changes too 😄

@IlyaGulya
Copy link
Contributor Author

I appreciate the huge amount of enthusiasm around this PR, and I want to say that I'm also very excited about the prospect of using SQLDelight in Wasm projects.

I also really appreciate the contributions being made here, but this PR is very difficult to review as-is because of its size and because of all of the changes that aren't directly related to enabling Wasm that are being pulled into here.

My recommendation would be to break this PR up into a few smaller PRs that are more focused and will be easier/quicker to review:

  1. A PR that enables the wasmJs() target in the runtime and extensions
  2. A PR that adds Wasm support for the web worker driver
  3. Additional PRs to make other gradle config/code cleanliness changes after the fact

Thank you!

Sure, I will make those changes it in the next couple of weeks

@IlyaGulya
Copy link
Contributor Author

@ahna92 you can always publish this branch to your mavenLocal and take a look 🙂
Making a snapshot is not that easy so I'll just focus on preparing this PR to be merged.

@IlyaGulya IlyaGulya marked this pull request as draft October 29, 2024 18:07
@IlyaGulya
Copy link
Contributor Author

@dellisd first PR is here #5531 🙂

@dellisd
Copy link
Collaborator

dellisd commented Oct 30, 2024

I'll be closing this PR in favour of the new ones!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.