Skip to content
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
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ The supported Native platforms are:
| macosArm64 | linuxArm64 | androidNativeArm64 |
| iosSimulatorArm64 | watchosSimulatorArm64 | androidNativeX86 |
| iosX64 | watchosX64 | androidNativeX64 |
| | watchosArm32 | watchosDeviceArm64 |
| iosArm64 | watchosArm32 | watchosDeviceArm64 |
| | watchosArm64 | mingwX64 |
| | tvosSimulatorArm64 | linuxArm32Hfp |
| | tvosX64 | |
| | tvosArm64 | |
| | iosArm64 | |

> [!NOTE]
> The `linuxArm32Hfp` platform is deprecated
Expand Down Expand Up @@ -120,7 +119,10 @@ To start using ANTLR Kotlin:
Depending on `cleanGenerateKotlinGrammarSource` ensures the `.tokens` files are always fresh,
and we do not end up with out-of-sync lexers and parsers.

5. Specify that the output directory of the `generateKotlinGrammarSource` task should be included as a source directory in the commonMain source set. In Gradle, you can do that by simply reference the task itself, and Gradle will automatically infer the associated output directory and include such directory in the source set.
5. Specify that the output directory of the `generateKotlinGrammarSource` task should be included
as a source directory in the `commonMain` source set. With Gradle, you can do that by simply
referencing the task itself. Gradle will automatically infer the associated output directory
and include it in the source set.

```kotlin
kotlin {
Expand All @@ -129,7 +131,7 @@ To start using ANTLR Kotlin:
kotlin {
srcDir(generateKotlinGrammarSource)
}
...
/* ... */
}
}
}
Expand Down
16 changes: 7 additions & 9 deletions antlr-kotlin-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import com.strumenta.antlrkotlin.gradle.ext.setupPom
import com.strumenta.antlrkotlin.gradle.ext.targetsNative
import com.vanniktech.maven.publish.SonatypeHost
import org.jetbrains.dokka.Platform
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.dokka.gradle.engine.parameters.KotlinPlatform

plugins {
id("strumenta.multiplatform")
Expand Down Expand Up @@ -35,25 +33,25 @@ kotlin {

mavenPublishing {
coordinates(
groupId = project.group as String,
groupId = project.group.toString(),
artifactId = project.name,
version = project.version as String,
version = project.version.toString(),
)

setupPom(project, projectDescription = "Runtime for ANTLR Kotlin")
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true)
publishToMavenCentral(true)
signAllPublications()
}

tasks.withType<DokkaTask>().configureEach {
dokka {
dokkaSourceSets {
configureEach {
suppress = true
}

val commonMain by getting {
commonMain.configure {
suppress = false
platform = Platform.jvm
analysisPlatform = KotlinPlatform.JVM
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Copyright 2024-present Strumenta and contributors, licensed under BSD 3-Clause.
package com.strumenta.antlrkotlin.runtime

import kotlin.wasm.WasmImport
import kotlin.wasm.unsafe.UnsafeWasmMemoryApi
import kotlin.wasm.unsafe.withScopedMemoryAllocator

Expand All @@ -15,6 +14,7 @@ internal actual fun platformPrintErrLn(message: String): Unit =
internal actual fun platformPrintErr(message: String): Unit =
wasiPrintErr(message, lineFeed = false)

@OptIn(ExperimentalWasmInterop::class)
@WasmImport("wasi_snapshot_preview1", "fd_write")
private external fun fdWrite(descriptor: Int, scatterPtr: Int, scatterSize: Int, errorPtr: Int): Int

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
// Copyright 2024-present Strumenta and contributors, licensed under BSD 3-Clause.
package com.strumenta.antlrkotlin.runtime

import kotlin.wasm.WasmImport
import kotlin.wasm.unsafe.Pointer
import kotlin.wasm.unsafe.UnsafeWasmMemoryApi
import kotlin.wasm.unsafe.withScopedMemoryAllocator

/**
* See [environ_sizes_get](https://wasix.org/docs/api-reference/wasi/environ_sizes_get).
*/
@OptIn(ExperimentalWasmInterop::class)
@WasmImport("wasi_snapshot_preview1", "environ_sizes_get")
private external fun wasiRawEnvironSizesGet(environCountPtr: Int, environBufSizePtr: Int): Int

/**
* See [environ_get](https://wasix.org/docs/api-reference/wasi/environ_get).
*/
@OptIn(ExperimentalWasmInterop::class)
@WasmImport("wasi_snapshot_preview1", "environ_get")
private external fun wasiRawEnvironGet(environPtr: Int, environBufPtr: Int): Int

Expand Down
7 changes: 3 additions & 4 deletions antlr-kotlin-target/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import com.strumenta.antlrkotlin.gradle.ext.setupPom
import com.vanniktech.maven.publish.SonatypeHost

plugins {
id("strumenta.jvm.library")
Expand All @@ -12,13 +11,13 @@ dependencies {

mavenPublishing {
coordinates(
groupId = project.group as String,
groupId = project.group.toString(),
artifactId = project.name,
version = project.version as String,
version = project.version.toString(),
)

setupPom(project, projectDescription = "Kotlin target for ANTLR")
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true)
publishToMavenCentral(true)
signAllPublications()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class StrumentaGradlePluginModulePlugin : Plugin<Project> {
val kotlin = project.kotlinJvmExtension
kotlin.explicitApiWarning()
kotlin.compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_2_1)
languageVersion.set(KotlinVersion.KOTLIN_2_1)
apiVersion.set(KotlinVersion.KOTLIN_2_2)
languageVersion.set(KotlinVersion.KOTLIN_2_2)

jvmTarget.set(JvmTarget.JVM_1_8)
freeCompilerArgs.add("-Xjvm-default=all")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class StrumentaJvmLibraryModulePlugin : Plugin<Project> {
val kotlin = project.kotlinJvmExtension
kotlin.explicitApiWarning()
kotlin.compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_2_1)
languageVersion.set(KotlinVersion.KOTLIN_2_1)
apiVersion.set(KotlinVersion.KOTLIN_2_2)
languageVersion.set(KotlinVersion.KOTLIN_2_2)

jvmTarget.set(JvmTarget.JVM_1_8)
freeCompilerArgs.add("-Xjvm-default=all")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class StrumentaMultiplatformModulePlugin : Plugin<Project> {
val kmp = project.kmpExtension
kmp.explicitApiWarning()
kmp.compilerOptions {
apiVersion.set(KotlinVersion.KOTLIN_2_1)
languageVersion.set(KotlinVersion.KOTLIN_2_1)
apiVersion.set(KotlinVersion.KOTLIN_2_2)
languageVersion.set(KotlinVersion.KOTLIN_2_2)
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
Expand Down
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[versions]
kotlin = "2.1.20"
kotlinx-io = "0.7.0"
kotlin = "2.2.20"
kotlinx-io = "0.8.0"
kotlinx-benchmark = "0.4.14"
kotlinx-resources = "0.10.0"
kotlinx-resources = "0.10.1"
antlr4 = "4.13.1"
dokka = "1.9.20"
dokka = "2.1.0-Beta"
researchgate-release = "3.1.0"
maven-publish = "0.32.0"
gradle-plugin-publish = "1.3.0"
maven-publish = "0.34.0"
gradle-plugin-publish = "2.0.0"
antlr-kotlin = "1.0.5"

[libraries]
Expand Down
Loading
Loading