-
Notifications
You must be signed in to change notification settings - Fork 70
Wasm target support #188
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
Merged
Merged
Wasm target support #188
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* | ||
| * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
| * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
| */ | ||
|
|
||
| package kotlinx.io | ||
|
|
||
| import kotlinx.io.internal.commonAsUtf8ToByteArray | ||
|
|
||
| internal actual fun String.asUtf8ToByteArray(): ByteArray = commonAsUtf8ToByteArray() | ||
|
|
||
| public actual open class IOException actual constructor( | ||
| message: String?, | ||
| cause: Throwable? | ||
| ) : Exception(message, cause) { | ||
| public actual constructor(message: String?) : this(message, null) | ||
| } | ||
|
|
||
| public actual open class EOFException actual constructor(message: String?) : IOException(message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| /* | ||
| * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
| * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
| */ | ||
|
|
||
| package kotlinx.io | ||
|
|
||
| @OptIn(ExperimentalStdlibApi::class) | ||
| public actual interface RawSink : AutoCloseableAlias { | ||
| public actual fun write(source: Buffer, byteCount: Long) | ||
|
|
||
| public actual fun flush() | ||
|
|
||
| actual override fun close() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
| * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
| */ | ||
|
|
||
| package kotlinx.io | ||
|
|
||
| internal actual object SegmentPool { | ||
| actual val MAX_SIZE: Int = 0 | ||
|
|
||
| actual val byteCount: Int = 0 | ||
|
|
||
| actual fun take(): Segment = Segment() | ||
|
|
||
| actual fun recycle(segment: Segment) { | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
| * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
| */ | ||
|
|
||
| package kotlinx.io.files | ||
|
|
||
| import kotlinx.io.Sink | ||
| import kotlinx.io.Source | ||
|
|
||
|
|
||
| public actual class Path internal constructor(private val path: String, | ||
| @Suppress("UNUSED_PARAMETER") any: Any?) { | ||
| override fun toString(): String = path | ||
| } | ||
|
|
||
| public actual fun Path(path: String): Path { | ||
| return Path(path, null) | ||
| } | ||
|
|
||
| public actual fun Path.source(): Source { | ||
| TODO("Paths are not supported for Wasm target") | ||
| } | ||
|
|
||
| public actual fun Path.sink(): Sink { | ||
| TODO("Paths are not supported for Wasm target") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* | ||
| * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. | ||
| * Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
| */ | ||
|
|
||
| package kotlinx.io | ||
|
|
||
| actual fun createTempFile(): String { | ||
| TODO("Paths are not supported for Wasm target") | ||
| } | ||
|
|
||
| actual fun deleteFile(path: String) { | ||
| TODO("Paths are not supported for Wasm target") | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| [versions] | ||
| kotlin = "1.9.0" | ||
| kotlin = "1.9.10" | ||
| java = "8" | ||
| dokka = "1.8.20" | ||
| kover = "0.7.3" | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No real pool in WASM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pooling is only supported for JVM target at the moment. I'm thinking of adding support for other targets later.