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

Build with Kotlin 2.0.21 #1535

Merged
merged 8 commits into from
Oct 17, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.classpath
.gradle
.kotlin
.project
.settings
eclipsebin
Expand Down
8 changes: 8 additions & 0 deletions android-test/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.android.build.gradle.internal.lint.AndroidLintAnalysisTask
import com.android.build.gradle.internal.lint.AndroidLintTask

plugins {
id("com.android.library")
id("org.jetbrains.kotlin.android")
Expand Down Expand Up @@ -60,6 +63,11 @@ android {
}
}

// https://issuetracker.google.com/issues/325146674
tasks.withType<AndroidLintAnalysisTask> {
onlyIf { false }
}

dependencies {
coreLibraryDesugaring(libs.android.desugar.jdk.libs)
androidTestImplementation(libs.androidx.test.ext.junit)
Expand Down
2 changes: 1 addition & 1 deletion build-support/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ gradlePlugin {
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25")
implementation(libs.kotlin.gradle.plugin)
}
8 changes: 7 additions & 1 deletion build-support/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
// empty.
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
18 changes: 10 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
[versions]
jmh = "1.37"
kotlin = "2.0.21"
ktlint = "0.48.2"

[libraries]
android-gradle-plugin = { module = "com.android.tools.build:gradle", version = "8.7.1" }
android-desugar-jdk-libs = { module = "com.android.tools:desugar_jdk_libs", version = "2.1.2" }
android-gradle-plugin = { module = "com.android.tools.build:gradle", version = "8.7.1" }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sort lines

androidx-test-ext-junit = { module = "androidx.test.ext:junit", version = "1.2.1" }
androidx-test-runner = { module = "androidx.test:runner", version = "1.5.2" }
binaryCompatibilityValidator = { module = "org.jetbrains.kotlinx.binary-compatibility-validator:org.jetbrains.kotlinx.binary-compatibility-validator.gradle.plugin", version = "0.16.3" }
bnd = { module = "biz.aQute.bnd:biz.aQute.bnd.gradle", version = "7.0.0" }
dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.9.20" }
jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" }
jmh-generator = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" }
jmh-gradle-plugin = { module = "me.champeau.jmh:jmh-gradle-plugin", version = "0.7.2" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit" }
kotlin-time = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version = "0.6.1" }
jmh-gradle-plugin = { module = "me.champeau.jmh:jmh-gradle-plugin", version = "0.7.2" }
jmh-core = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" }
jmh-generator = { module = "org.openjdk.jmh:jmh-generator-annprocess", version.ref = "jmh" }
dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version = "1.9.20" }
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.25.0" }
bnd = { module = "biz.aQute.bnd:biz.aQute.bnd.gradle", version = "7.0.0" }
vanniktech-publish-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.30.0" }
test-junit = { module = "junit:junit", version = "4.13.2" }
test-assertj = { module = "org.assertj:assertj-core", version = "3.26.3" }
test-assertk = "com.willowtreeapps.assertk:assertk:0.28.1"
test-jimfs = "com.google.jimfs:jimfs:1.3.0"
test-junit = { module = "junit:junit", version = "4.13.2" }
vanniktech-publish-plugin = { module = "com.vanniktech:gradle-maven-publish-plugin", version = "0.30.0" }
596 changes: 320 additions & 276 deletions kotlin-js-store/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ expect class Instant : Comparable<Instant> {
operator fun plus(duration: Duration): Instant

operator fun minus(duration: Duration): Instant

override operator fun compareTo(other: Instant): Int
}

expect fun fromEpochSeconds(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ actual class Instant(
actual operator fun minus(duration: Duration) =
Instant(epochMilliseconds - duration.inWholeMilliseconds)

override fun compareTo(other: Instant) =
actual override fun compareTo(other: Instant) =
epochMilliseconds.compareTo(other.epochMilliseconds)
}

Expand Down
34 changes: 23 additions & 11 deletions okio-wasifilesystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,41 @@ val injectWasiInit by tasks.creating {
import { WASI } from 'wasi';
import { argv, env } from 'node:process';

export const wasi = new WASI({
const wasi = new WASI({
version: 'preview1',
args: argv,
preopens: {
'/tmp': '$base',
'/a': '$baseA',
'/b': '$baseB'
}
},
env,
});

const module = await import(/* webpackIgnore: true */'node:module');
const require = module.default.createRequire(import.meta.url);
const fs = require('fs');
const path = require('path');
const url = require('url');
const filepath = url.fileURLToPath(import.meta.url);
const dirpath = path.dirname(filepath);
const wasmBuffer = fs.readFileSync(path.resolve(dirpath, './$moduleName.wasm'));
const fs = await import('node:fs');
const url = await import('node:url');
const wasmBuffer = fs.readFileSync(url.fileURLToPath(import.meta.resolve('./okio-parent-okio-wasifilesystem-wasm-wasi-test.wasm')));
const wasmModule = new WebAssembly.Module(wasmBuffer);
const wasmInstance = new WebAssembly.Instance(wasmModule, wasi.getImportObject());

wasi.initialize(wasmInstance);

export default wasmInstance.exports;
const exports = wasmInstance.exports

export default new Proxy(exports, {
_shownError: false,
get(target, prop) {
if (!this._shownError) {
this._shownError = true;
throw new Error("Do not use default import. Use the corresponding named import instead.")
}
}
});
export const {
startUnitTests,
_initialize,
memory
} = exports;
""".trimIndent()
)
}
Expand Down
106 changes: 66 additions & 40 deletions okio/src/commonMain/kotlin/okio/Buffer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ expect class Buffer() : BufferedSource, BufferedSink {
var size: Long
internal set

override val buffer: Buffer

override fun emitCompleteSegments(): Buffer

override fun emit(): Buffer

/** Copy `byteCount` bytes from this, starting at `offset`, to `out`. */
fun copyTo(
out: Buffer,
Expand Down Expand Up @@ -74,18 +68,6 @@ expect class Buffer() : BufferedSource, BufferedSink {
/** Discards `byteCount` bytes from the head of this buffer. */
override fun skip(byteCount: Long)

override fun write(byteString: ByteString): Buffer

override fun write(byteString: ByteString, offset: Int, byteCount: Int): Buffer

override fun writeUtf8(string: String): Buffer

override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): Buffer

override fun writeUtf8CodePoint(codePoint: Int): Buffer

override fun write(source: ByteArray): Buffer

/**
* Returns a tail segment that we can write at least `minimumCapacity`
* bytes to, creating it if necessary.
Expand All @@ -109,28 +91,6 @@ expect class Buffer() : BufferedSource, BufferedSink {
/** Returns the 512-bit SHA-512 HMAC of this buffer. */
fun hmacSha512(key: ByteString): ByteString

override fun write(source: ByteArray, offset: Int, byteCount: Int): Buffer

override fun write(source: Source, byteCount: Long): Buffer

override fun writeByte(b: Int): Buffer

override fun writeShort(s: Int): Buffer

override fun writeShortLe(s: Int): Buffer

override fun writeInt(i: Int): Buffer

override fun writeIntLe(i: Int): Buffer

override fun writeLong(v: Long): Buffer

override fun writeLongLe(v: Long): Buffer

override fun writeDecimalLong(v: Long): Buffer

override fun writeHexadecimalUnsignedLong(v: Long): Buffer

/**
* Returns a deep copy of this buffer. The returned [Buffer] initially shares the underlying
* [ByteArray]s. See [UnsafeCursor] for more details.
Expand All @@ -147,6 +107,72 @@ expect class Buffer() : BufferedSource, BufferedSink {

fun readAndWriteUnsafe(unsafeCursor: UnsafeCursor = DEFAULT__new_UnsafeCursor): UnsafeCursor

override val buffer: Buffer
override fun close()
override fun emit(): Buffer
override fun emitCompleteSegments(): Buffer
override fun exhausted(): Boolean
override fun flush()
override fun indexOf(b: Byte): Long
override fun indexOf(b: Byte, fromIndex: Long): Long
override fun indexOf(b: Byte, fromIndex: Long, toIndex: Long): Long
override fun indexOf(bytes: ByteString): Long
override fun indexOf(bytes: ByteString, fromIndex: Long): Long
override fun indexOfElement(targetBytes: ByteString): Long
override fun indexOfElement(targetBytes: ByteString, fromIndex: Long): Long
override fun peek(): BufferedSource
override fun rangeEquals(offset: Long, bytes: ByteString): Boolean
override fun rangeEquals(offset: Long, bytes: ByteString, bytesOffset: Int, byteCount: Int): Boolean
override fun read(sink: Buffer, byteCount: Long): Long
override fun read(sink: ByteArray): Int
override fun read(sink: ByteArray, offset: Int, byteCount: Int): Int
override fun readAll(sink: Sink): Long
override fun readByte(): Byte
override fun readByteArray(): ByteArray
override fun readByteArray(byteCount: Long): ByteArray
override fun readByteString(): ByteString
override fun readByteString(byteCount: Long): ByteString
override fun readDecimalLong(): Long
override fun readFully(sink: Buffer, byteCount: Long)
override fun readFully(sink: ByteArray)
override fun readHexadecimalUnsignedLong(): Long
override fun readInt(): Int
override fun readIntLe(): Int
override fun readLong(): Long
override fun readLongLe(): Long
override fun readShort(): Short
override fun readShortLe(): Short
override fun readUtf8(): String
override fun readUtf8(byteCount: Long): String
override fun readUtf8CodePoint(): Int
override fun readUtf8Line(): String?
override fun readUtf8LineStrict(): String
override fun readUtf8LineStrict(limit: Long): String
override fun request(byteCount: Long): Boolean
override fun require(byteCount: Long)
override fun select(options: Options): Int
override fun <T : Any> select(options: TypedOptions<T>): T?
override fun timeout(): Timeout
override fun write(byteString: ByteString): Buffer
override fun write(byteString: ByteString, offset: Int, byteCount: Int): Buffer
override fun write(source: Buffer, byteCount: Long)
override fun write(source: ByteArray): Buffer
override fun write(source: ByteArray, offset: Int, byteCount: Int): Buffer
override fun write(source: Source, byteCount: Long): Buffer
override fun writeAll(source: Source): Long
override fun writeByte(b: Int): Buffer
override fun writeDecimalLong(v: Long): Buffer
override fun writeHexadecimalUnsignedLong(v: Long): Buffer
override fun writeInt(i: Int): Buffer
override fun writeIntLe(i: Int): Buffer
override fun writeLong(v: Long): Buffer
override fun writeLongLe(v: Long): Buffer
override fun writeShort(s: Int): Buffer
override fun writeShortLe(s: Int): Buffer
override fun writeUtf8(string: String): Buffer
override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): Buffer
override fun writeUtf8CodePoint(codePoint: Int): Buffer

/**
* A handle to the underlying data in a buffer. This handle is unsafe because it does not enforce
* its own invariants. Instead, it assumes a careful user who has studied Okio's implementation
Expand Down
5 changes: 5 additions & 0 deletions okio/src/commonMain/kotlin/okio/HashingSink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ expect class HashingSink : Sink {
*/
val hash: ByteString

override fun close()
override fun flush()
override fun timeout(): Timeout
override fun write(source: Buffer, byteCount: Long)

companion object {
/**
* Returns a sink that uses the obsolete MD5 hash algorithm to produce 128-bit hashes.
Expand Down
4 changes: 4 additions & 0 deletions okio/src/commonMain/kotlin/okio/HashingSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ expect class HashingSource : Source {
*/
val hash: ByteString

override fun close()
override fun read(sink: Buffer, byteCount: Long): Long
override fun timeout(): Timeout

companion object {
/**
* Returns a source that uses the obsolete MD5 hash algorithm to produce 128-bit hashes.
Expand Down
26 changes: 26 additions & 0 deletions okio/src/commonMain/kotlin/okio/RealBufferedSink.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,30 @@ internal expect class RealBufferedSink(
) : BufferedSink {
val sink: Sink
var closed: Boolean

override val buffer: Buffer
override fun close()
override fun emit(): BufferedSink
override fun emitCompleteSegments(): BufferedSink
override fun flush()
override fun timeout(): Timeout
override fun write(byteString: ByteString): BufferedSink
override fun write(byteString: ByteString, offset: Int, byteCount: Int): BufferedSink
override fun write(source: Buffer, byteCount: Long)
override fun write(source: ByteArray): BufferedSink
override fun write(source: ByteArray, offset: Int, byteCount: Int): BufferedSink
override fun write(source: Source, byteCount: Long): BufferedSink
override fun writeAll(source: Source): Long
override fun writeByte(b: Int): BufferedSink
override fun writeDecimalLong(v: Long): BufferedSink
override fun writeHexadecimalUnsignedLong(v: Long): BufferedSink
override fun writeInt(i: Int): BufferedSink
override fun writeIntLe(i: Int): BufferedSink
override fun writeLong(v: Long): BufferedSink
override fun writeLongLe(v: Long): BufferedSink
override fun writeShort(s: Int): BufferedSink
override fun writeShortLe(s: Int): BufferedSink
override fun writeUtf8(string: String): BufferedSink
override fun writeUtf8(string: String, beginIndex: Int, endIndex: Int): BufferedSink
override fun writeUtf8CodePoint(codePoint: Int): BufferedSink
}
45 changes: 45 additions & 0 deletions okio/src/commonMain/kotlin/okio/RealBufferedSource.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,49 @@ internal expect class RealBufferedSource(
) : BufferedSource {
val source: Source
var closed: Boolean

override val buffer: Buffer
override fun close()
override fun exhausted(): Boolean
override fun indexOf(b: Byte): Long
override fun indexOf(b: Byte, fromIndex: Long): Long
override fun indexOf(b: Byte, fromIndex: Long, toIndex: Long): Long
override fun indexOf(bytes: ByteString): Long
override fun indexOf(bytes: ByteString, fromIndex: Long): Long
override fun indexOfElement(targetBytes: ByteString): Long
override fun indexOfElement(targetBytes: ByteString, fromIndex: Long): Long
override fun peek(): BufferedSource
override fun rangeEquals(offset: Long, bytes: ByteString): Boolean
override fun rangeEquals(offset: Long, bytes: ByteString, bytesOffset: Int, byteCount: Int): Boolean
override fun read(sink: Buffer, byteCount: Long): Long
override fun read(sink: ByteArray): Int
override fun read(sink: ByteArray, offset: Int, byteCount: Int): Int
override fun readAll(sink: Sink): Long
override fun readByte(): Byte
override fun readByteArray(): ByteArray
override fun readByteArray(byteCount: Long): ByteArray
override fun readByteString(): ByteString
override fun readByteString(byteCount: Long): ByteString
override fun readDecimalLong(): Long
override fun readFully(sink: Buffer, byteCount: Long)
override fun readFully(sink: ByteArray)
override fun readHexadecimalUnsignedLong(): Long
override fun readInt(): Int
override fun readIntLe(): Int
override fun readLong(): Long
override fun readLongLe(): Long
override fun readShort(): Short
override fun readShortLe(): Short
override fun readUtf8(): String
override fun readUtf8(byteCount: Long): String
override fun readUtf8CodePoint(): Int
override fun readUtf8Line(): String?
override fun readUtf8LineStrict(): String
override fun readUtf8LineStrict(limit: Long): String
override fun request(byteCount: Long): Boolean
override fun require(byteCount: Long)
override fun select(options: Options): Int
override fun <T : Any> select(options: TypedOptions<T>): T?
override fun skip(byteCount: Long)
override fun timeout(): Timeout
}
Loading