Skip to content
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

Support WebAssembly targets #111

Merged
merged 5 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# kotlin-multiplatform-diff

![Build and test](https://github.com/petertrr/kotlin-multiplatform-diff/workflows/Build%20and%20test/badge.svg)
[![License](https://img.shields.io/github/license/petertrr/kotlin-multiplatform-diff)](https://github.com/petertrr/kotlin-multiplatform-diff/blob/main/LICENSE)
[![codecov](https://codecov.io/gh/petertrr/kotlin-multiplatform-diff/branch/main/graph/badge.svg)](https://codecov.io/gh/petertrr/kotlin-multiplatform-diff)
Expand All @@ -7,20 +8,29 @@
[![Maven Central](https://img.shields.io/maven-central/v/io.github.petertrr/kotlin-multiplatform-diff)](https://mvnrepository.com/artifact/io.github.petertrr)
[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)

This is a port of [java-diff-utils](https://github.com/java-diff-utils/java-diff-utils) to kotlin
with multiplatform support. All credit for the implementation goes to original authors.
This is a port of [java-diff-utils](https://github.com/java-diff-utils/java-diff-utils) to Kotlin with multiplatform support.
All credit for the implementation goes to original authors.

## Features
All features from version 4.10 of the original library are present, except for:
* Unified diff, which heavily uses file read/write and therefore needs a more complicated rewrite for kotlin-multiplatform
* diff-utils-jgit, which uses JVM-only jgit library

All features from version `4.10` of the original library are present, except for:

- unified diff, which heavily uses file read/write and therefore needs a more complicated rewrite
- diff-utils-jgit, which uses JVM-only jgit library

Please refer to the original guides for more information.

## Supported platforms
## Supported Platforms

Currently, artifacts for the following platforms are supported:
* JVM
* JS (both browser and Node.js)
* LinuxX64
* MingwX64
* MacosX64

- JVM
- JS (both browser and Node.js)
- WebAssembly (JS and WASI)
- Native

The supported Native targets are (following the Kotlin/Native [target support guidelines](https://kotlinlang.org/docs/native-target-support.html)):

| Tier 1 | Tier 2 | Tier 3 |
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by tiers here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This table aligns with the tiers specified in the documentation:
https://kotlinlang.org/docs/native-target-support.html

I'd like to enable other Native targets in the future.

Copy link
Owner

@petertrr petertrr May 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I missed the inception of this classification! Could you please add think link to the readme as well, something like:

Suggested change
| Tier 1 | Tier 2 | Tier 3 |
The supported Native targets are (following the Kotlin/Native [target support guidelines](https://kotlinlang.org/docs/native-target-support.html)):
| Tier 1 | Tier 2 | Tier 3 |

Edit: I updated it myself to merge the PR quicker

|:---------|:---------|:---------|
| macosX64 | linuxX64 | mingwX64 |
16 changes: 16 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
kotlin("multiplatform")
Expand Down Expand Up @@ -51,6 +52,21 @@ kotlin {
nodejs()
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
browser()
nodejs()
applyBinaryen()
}

@OptIn(ExperimentalWasmDsl::class)
wasmWasi {
nodejs()

// Available since 2.0
// applyBinaryen()
}

linuxX64()
mingwX64()
macosX64()
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
kotlin = "1.9.23"
kotlin = "1.9.24"
detekt = "1.23.5"
dokka = "1.9.10"
dokka = "1.9.20"
nexus = "1.3.0"

[plugins]
Expand Down
Loading