Skip to content

Commit e5ebe0a

Browse files
ci: fix linting
1 parent 6126060 commit e5ebe0a

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

.github/workflows/lint.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ jobs:
4242
if: "!cancelled() && steps.ktlint.outcome == 'failure'"
4343
with:
4444
sarif_file: build/reports/ktlint.sarif
45+
# FIXME: github/codeql-action#2215
46+
checkout_path: ${{env.HOME}}
4547
category: ktlint
4648
detekt:
4749
runs-on: ubuntu-latest
@@ -55,12 +57,12 @@ jobs:
5557
java-version: 17
5658
- name: Install detekt
5759
run: |-
58-
curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.6/detekt-cli-1.23.6-all.jar
59-
mv detekt-cli-1.23.6-all.jar $RUNNER_TOOL_CACHE/detekt-cli.jar
60+
curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.7/detekt-cli-1.23.7-all.jar
61+
mv detekt-cli-1.23.7-all.jar $RUNNER_TOOL_CACHE/detekt-cli.jar
6062
- name: Run detekt
6163
id: detekt
6264
run: >-
63-
java -jar $RUNNER_TOOL_CACHE/detekt-cli.jar --build-upon-default-config
65+
java -jar $RUNNER_TOOL_CACHE/detekt-cli.jar --build-upon-default-config \
6466
--jvm-target 17 -c .github/detekt.yml -r sarif:build/reports/detekt.sarif
6567
- name: Upload report
6668
uses: github/codeql-action/upload-sarif@v3

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sdk.version.min=23
88
# The Android NDK version that is used to compile the project.
99
ndk.version=26.3.11579264
1010
# The CMake version that is used to compile the project.
11-
cmake.version=3.30.3
11+
cmake.version=3.30.5
1212

1313
# Specifies the JVM arguments used for the daemon process.
1414
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8

ktreesitter-plugin/src/main/java/io/github/treesitter/ktreesitter/plugin/GrammarFilesTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,16 @@ private void generateNative(Path srcDir) throws GradleException {
194194
);
195195
mkdirs(classFile.getParent().toFile());
196196

197+
var imports = languageMethods.values().stream().map(method ->
198+
"import %s.internal.%s".formatted(packageName, method)
199+
);
197200
var methods = languageMethods.entrySet().stream().map(method ->
198201
" actual fun %s(): Any = %s()!!".formatted(method.getKey(), method.getValue())
199202
);
200203
var template = readResource("native.kt.in")
201204
.replace("@PACKAGE@", packageName)
202205
.replace("@CLASS@", className)
206+
.replace("@IMPORTS@", String.join("\n\n", imports.toList()))
203207
.replace("@METHODS@", String.join("\n\n", methods.toList()));
204208
writeFile(classFile.toFile(), template);
205209
}

ktreesitter-plugin/src/main/resources/native.kt.in

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

33
package @PACKAGE@
44

5-
5+
@IMPORTS@
66
import kotlinx.cinterop.ExperimentalForeignApi
77

88
@OptIn(ExperimentalForeignApi::class)

0 commit comments

Comments
 (0)