Skip to content

Commit

Permalink
ci: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
ObserverOfTime committed Oct 21, 2024
1 parent 6126060 commit e5ebe0a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
if: "!cancelled() && steps.ktlint.outcome == 'failure'"
with:
sarif_file: build/reports/ktlint.sarif
# FIXME: github/codeql-action#2215
checkout_path: ${{env.HOME}}
category: ktlint
detekt:
runs-on: ubuntu-latest
Expand All @@ -55,12 +57,12 @@ jobs:
java-version: 17
- name: Install detekt
run: |-
curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.6/detekt-cli-1.23.6-all.jar
mv detekt-cli-1.23.6-all.jar $RUNNER_TOOL_CACHE/detekt-cli.jar
curl -sSLO https://github.com/detekt/detekt/releases/download/v1.23.7/detekt-cli-1.23.7-all.jar
mv detekt-cli-1.23.7-all.jar $RUNNER_TOOL_CACHE/detekt-cli.jar
- name: Run detekt
id: detekt
run: >-
java -jar $RUNNER_TOOL_CACHE/detekt-cli.jar --build-upon-default-config
java -jar $RUNNER_TOOL_CACHE/detekt-cli.jar --build-upon-default-config \
--jvm-target 17 -c .github/detekt.yml -r sarif:build/reports/detekt.sarif
- name: Upload report
uses: github/codeql-action/upload-sarif@v3
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sdk.version.min=23
# The Android NDK version that is used to compile the project.
ndk.version=26.3.11579264
# The CMake version that is used to compile the project.
cmake.version=3.30.3
cmake.version=3.30.5

# Specifies the JVM arguments used for the daemon process.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,16 @@ private void generateNative(Path srcDir) throws GradleException {
);
mkdirs(classFile.getParent().toFile());

var imports = languageMethods.values().stream().map(method ->
"import %s.internal.%s".formatted(packageName, method)
);
var methods = languageMethods.entrySet().stream().map(method ->
" actual fun %s(): Any = %s()!!".formatted(method.getKey(), method.getValue())
);
var template = readResource("native.kt.in")
.replace("@PACKAGE@", packageName)
.replace("@CLASS@", className)
.replace("@IMPORTS@", String.join("\n\n", imports.toList()))
.replace("@METHODS@", String.join("\n\n", methods.toList()));
writeFile(classFile.toFile(), template);
}
Expand Down
2 changes: 1 addition & 1 deletion ktreesitter-plugin/src/main/resources/native.kt.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

package @PACKAGE@

import @[email protected].*
@IMPORTS@
import kotlinx.cinterop.ExperimentalForeignApi

@OptIn(ExperimentalForeignApi::class)
Expand Down

0 comments on commit e5ebe0a

Please sign in to comment.