Skip to content

Commit d031bf5

Browse files
feat!: upgrade to Kotlin 2
1 parent a1a9e0e commit d031bf5

File tree

29 files changed

+153
-192
lines changed

29 files changed

+153
-192
lines changed

.github/scripts/build-jni.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
& cmake -S ktreesitter -B ktreesitter/.cmake/build `
44
-DCMAKE_VERBOSE_MAKEFILE=ON `
5-
-DCMAKE_INSTALL_PREFIX=ktreesitter/src/jvmMain/resources `
5+
-DCMAKE_INSTALL_PREFIX=ktreesitter/src/jvmMain/resources `
66
-DCMAKE_INSTALL_BINDIR="$env:CMAKE_INSTALL_LIBDIR"
77
& cmake --build ktreesitter/.cmake/build --config Debug
88
& cmake --install ktreesitter/.cmake/build --config Debug

.github/scripts/build-jni.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
cmake -S ktreesitter -B ktreesitter/.cmake/build \
44
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
55
-DCMAKE_VERBOSE_MAKEFILE=ON \
6-
-DCMAKE_OSX_ARCHITECTURES=arm64 \
6+
-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \
77
-DCMAKE_INSTALL_PREFIX=ktreesitter/src/jvmMain/resources \
88
-DCMAKE_INSTALL_LIBDIR="$CMAKE_INSTALL_LIBDIR"
99
cmake --build ktreesitter/.cmake/build
@@ -12,7 +12,7 @@ cmake --install ktreesitter/.cmake/build
1212
for dir in languages/*/; do
1313
cmake -S "${dir}build/generated" -B "${dir}.cmake/build" \
1414
-DCMAKE_BUILD_TYPE=RelWithDebugInfo \
15-
-DCMAKE_OSX_ARCHITECTURES=arm64 \
15+
-DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' \
1616
-DCMAKE_INSTALL_PREFIX="${dir}build/generated/src/jvmMain/resources" \
1717
-DCMAKE_INSTALL_LIBDIR="$CMAKE_INSTALL_LIBDIR"
1818
cmake --build "${dir}.cmake/build"

.github/workflows/ci.yml

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,12 @@ jobs:
4242
cache-dependency-path: |
4343
gradle/libs.versions.toml
4444
gradle/wrapper/gradle-wrapper.properties
45-
- name: Cache Kotlin/Native prebuilt
46-
uses: actions/cache@v4
45+
- name: Set up Kotlin/Native
46+
uses: ObserverOfTime/setup-konan-action@v1
4747
with:
48-
path: ${{runner.tool_cache}}/konan/kotlin-native-prebuilt-*
49-
key: konan-${{runner.os}}-prebuilt-1.9
48+
kotlin_version: 2.1.21
5049
- name: Generate files
5150
run: ./gradlew --no-daemon generateGrammarFiles
52-
env:
53-
KONAN_DATA_DIR: ${{runner.tool_cache}}/konan
5451
- name: Upload artifact
5552
uses: actions/upload-artifact@v4
5653
with:
@@ -113,14 +110,20 @@ jobs:
113110
cache-dependency-path: |
114111
gradle/libs.versions.toml
115112
gradle/wrapper/gradle-wrapper.properties
113+
- name: Set up Kotlin/Native
114+
uses: ObserverOfTime/setup-konan-action@v1
115+
with:
116+
kotlin_version: 2.1.21
116117
- name: Set up cross compilation
117-
run: sudo apt-get install -qy {binutils,gcc}-aarch64-linux-gnu
118118
if: matrix.platform == 'Linux'
119-
- name: Restore Kotlin/Native prebuilt
120-
uses: actions/cache/restore@v4
121-
with:
122-
path: ${{runner.tool_cache}}/konan/kotlin-native-prebuilt-*
123-
key: konan-${{runner.os}}-prebuilt-1.9
119+
run: |-
120+
sudo apt-get update
121+
sudo apt-get install -qy {binutils,gcc}-aarch64-linux-gnu
122+
- name: Set up Ninja
123+
if: matrix.platform == 'Android'
124+
run: |-
125+
sudo apt-get update
126+
sudo apt-get install -qy ninja-build
124127
- name: Download generated files
125128
uses: actions/download-artifact@v4
126129
with:
@@ -131,30 +134,8 @@ jobs:
131134
run: .github/scripts/build-jni.${{matrix.os == 'windows-latest' && 'ps1' || 'sh'}}
132135
env:
133136
CMAKE_INSTALL_LIBDIR: lib/${{matrix.lib_platform}}/${{matrix.lib_arch}}
134-
- name: Cache Kotlin/Native dependencies
135-
id: cache-dependencies
136-
uses: actions/cache@v4
137-
if: matrix.platform != 'JVM' && matrix.platform != 'Android'
138-
with:
139-
path: ${{runner.tool_cache}}/konan/dependencies
140-
key: konan-${{runner.os}}-dependencies
141-
- name: Download Kotlin/Native dependencies
142-
if: matrix.platform == 'macOS/iOS' && steps.cache-dependencies.outputs.cache-hit != 'true'
143-
run: |-
144-
mkdir -p "$RUNNER_TOOL_CACHE/konan/dependencies"
145-
curl -LSs https://download-cdn.jetbrains.com/kotlin/native/$DEP.tar.gz | \
146-
tar -xzf - -C "$RUNNER_TOOL_CACHE/konan/dependencies"
147-
env:
148-
DEP: apple-llvm-20200714-macos-aarch64-essentials
149-
- name: Set up Ninja
150-
if: matrix.platform == 'Android'
151-
run: |-
152-
sudo apt-get update
153-
sudo apt-get install -y ninja-build
154137
- name: Run tests
155138
run: ./gradlew --no-daemon ${{matrix.targets}}
156-
env:
157-
KONAN_DATA_DIR: ${{runner.tool_cache}}/konan
158139
- name: Report test results
159140
uses: mikepenz/action-junit-report@v5
160141
if: matrix.platform == 'JVM' && !cancelled()

.github/workflows/docs.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,22 @@ jobs:
4444
cache-dependency-path: |
4545
gradle/libs.versions.toml
4646
gradle/wrapper/gradle-wrapper.properties
47-
- name: Restore Kotlin/Native prebuilt
48-
uses: actions/cache/restore@v4
47+
- name: Set up Kotlin/Native
48+
uses: ObserverOfTime/setup-konan-action@v1
4949
with:
50-
path: ${{runner.tool_cache}}/konan/kotlin-native-prebuilt-*
51-
key: konan-${{runner.os}}-prebuilt-1.9
52-
- name: Restore Kotlin/Native dependencies
53-
uses: actions/cache/restore@v4
54-
with:
55-
path: ${{runner.tool_cache}}/konan/dependencies
56-
key: konan-${{runner.os}}-dependencies
50+
kotlin_version: 2.1.21
51+
- name: Set up cross compilation
52+
if: matrix.platform == 'Linux'
53+
run: |-
54+
sudo apt-get update
55+
sudo apt-get install -qy {binutils,gcc}-aarch64-linux-gnu
5756
- name: Set up Ninja
57+
if: matrix.platform == 'Android'
5858
run: |-
5959
sudo apt-get update
60-
sudo apt-get install -y ninja-build
60+
sudo apt-get install -qy ninja-build
6161
- name: Build documentation
62-
run: ./gradlew --no-daemon generateFiles :ktreesitter:dokkaHtml
63-
env:
64-
KONAN_DATA_DIR: ${{runner.tool_cache}}/konan
62+
run: ./gradlew --no-daemon generateFiles :ktreesitter:dokkaGeneratePublicationHtml
6563
- name: Upload pages artifact
6664
uses: actions/upload-pages-artifact@v3
6765
with:

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
java-version: 17
3535
- name: Install ktlint
3636
run: |-
37-
curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.3.1/ktlint
37+
curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.6.0/ktlint
3838
chmod a+x ktlint && mv ktlint $RUNNER_TOOL_CACHE/ktlint
3939
- name: Run ktlint
4040
id: ktlint
@@ -59,8 +59,8 @@ jobs:
5959
java-version: 17
6060
- name: Install detekt
6161
run: |-
62-
curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.7/detekt-cli-1.23.7-all.jar
63-
mv detekt-cli-1.23.7-all.jar $RUNNER_TOOL_CACHE/detekt-cli.jar
62+
curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.8/detekt-cli-1.23.8-all.jar
63+
mv detekt-cli-1.23.8-all.jar $RUNNER_TOOL_CACHE/detekt-cli.jar
6464
- name: Run detekt
6565
id: detekt
6666
run: >-

.github/workflows/publish.yml

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -132,38 +132,32 @@ jobs:
132132
cache-dependency-path: |
133133
gradle/libs.versions.toml
134134
gradle/wrapper/gradle-wrapper.properties
135-
- name: Set up cross compilation
136-
run: sudo apt-get install -qy {binutils,gcc}-aarch64-linux-gnu
137-
if: matrix.platform == 'Linux' || matrix.platform == 'common'
138-
- name: Restore Kotlin/Native prebuilt
139-
uses: actions/cache/restore@v4
135+
- name: Set up Kotlin/Native
136+
uses: ObserverOfTime/setup-konan-action@v1
140137
with:
141-
path: ${{runner.tool_cache}}/konan/kotlin-native-prebuilt-*
142-
key: konan-${{runner.os}}-prebuilt-1.9
143-
- name: Restore Kotlin/Native dependencies
144-
uses: actions/cache/restore@v4
145-
if: matrix.platform != 'JVM' && matrix.platform != 'Android'
146-
with:
147-
path: ${{runner.tool_cache}}/konan/dependencies
148-
key: konan-${{runner.os}}-dependencies
138+
kotlin_version: 2.1.21
139+
- name: Set up cross compilation
140+
if: matrix.platform == 'Linux'
141+
run: |-
142+
sudo apt-get update
143+
sudo apt-get install -qy {binutils,gcc}-aarch64-linux-gnu
144+
- name: Set up Ninja
145+
if: matrix.platform == 'Android'
146+
run: |-
147+
sudo apt-get update
148+
sudo apt-get install -qy ninja-build
149149
- name: Download library artifacts
150150
uses: actions/download-artifact@v4
151151
if: matrix.platform == 'JVM'
152152
with:
153153
path: ktreesitter/src/jvmMain/resources/lib
154154
pattern: ktreesitter-lib-*
155155
merge-multiple: true
156-
- name: Set up Ninja
157-
if: matrix.platform == 'Android'
158-
run: |-
159-
sudo apt-get update
160-
sudo apt-get install -y ninja-build
161156
- name: Build packages
162157
run: ./gradlew --no-daemon ${{matrix.targets}}
163158
env:
164159
SIGNING_KEY: ${{secrets.SIGNING_KEY}}
165160
SIGNING_PASSWORD: ${{secrets.SIGNING_PASSWORD}}
166-
KONAN_DATA_DIR: ${{runner.tool_cache}}/konan
167161
- name: Upload artifacts
168162
uses: actions/upload-artifact@v4
169163
with:
@@ -235,14 +229,12 @@ jobs:
235229
cache-dependency-path: |
236230
gradle/libs.versions.toml
237231
gradle/wrapper/gradle-wrapper.properties
238-
- name: Restore Kotlin/Native prebuilt
239-
uses: actions/cache/restore@v4
232+
- name: Set up Kotlin/Native
233+
uses: ObserverOfTime/setup-konan-action@v1
240234
with:
241-
path: ${{runner.tool_cache}}/konan/kotlin-native-prebuilt-*
242-
key: konan-${{runner.os}}-prebuilt-1.9
235+
kotlin_version: 2.1.21
243236
- name: Publish Gradle plugin
244237
run: ./gradlew --no-daemon :ktreesitter-plugin:publishPlugins
245238
env:
246-
KONAN_DATA_DIR: ${{runner.tool_cache}}/konan
247239
GRADLE_PUBLISH_KEY: ${{secrets.GRADLE_PUBLISH_KEY}}
248240
GRADLE_PUBLISH_SECRET: ${{secrets.GRADLE_PUBLISH_SECRET}}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
### Gradle ###
22
.gradle/
33
build/
4+
.kotlin/
45
kotlin-js-store/
56
dependency-graph-reports/
67
local.properties

.idea/ktlint-plugin.xml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ subprojects {
1717
}
1818

1919
tasks.wrapper {
20-
gradleVersion = "8.7"
20+
gradleVersion = "8.11"
2121
distributionType = Wrapper.DistributionType.BIN
2222
}

gradle.properties

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
project.version=0.24.1
33

44
# The Android SDK version that is used to compile the project.
5-
sdk.version.compile=34
5+
sdk.version.compile=35
66
# The minimum supported Android SDK version.
77
sdk.version.min=23
88
# The Android NDK version that is used to compile the project.
9-
ndk.version=26.3.11579264
9+
ndk.version=27.2.12479018
1010
# The CMake version that is used to compile the project.
11-
cmake.version=3.31.3
11+
cmake.version=3.31.6
1212

1313
# Specifies the JVM arguments used for the daemon process.
1414
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
@@ -23,6 +23,8 @@ kotlin.code.style=official
2323
kotlin.mpp.androidSourceSetLayoutVersion=2
2424
# Enable C interop sharing
2525
kotlin.mpp.enableCInteropCommonization=true
26+
# Enable cross-compilation of klib artifacts
27+
kotlin.native.enableKlibsCrossCompilation=true
2628
# Disable default stdlib dependency
2729
kotlin.stdlib.default.dependency=false
2830
# Ignore disabled Kotlin/Native targets
@@ -32,3 +34,7 @@ kotlin.native.ignoreDisabledTargets=true
3234
android.useAndroidX=true
3335
# Disables automatically downloading the Android SDK.
3436
android.builder.sdkDownload=false
37+
38+
# Enables the experimental Dokka V2 mode.
39+
org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled
40+
org.jetbrains.dokka.experimental.gradle.pluginMode.noWarn=true

0 commit comments

Comments
 (0)