Skip to content

Commit

Permalink
Merge pull request #75 from olafurpg/olafurpg/kotlin-1.9
Browse files Browse the repository at this point in the history
Upgrade to Kotlin 1.9.x
  • Loading branch information
olafurpg committed Feb 2, 2024
2 parents 075340e + 44af36f commit 3ff9e97
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@ This codebase implements a Kotlin compiler plugin that can be used together with
[scip-java](https://sourcegraph.github.io/scip-java) to emit
[SCIP](https://github.com/sourcegraph/scip) indexes for Kotlin projects.


## Getting started

This project must be used together with scip-java. Visit
[scip-java](https://sourcegraph.github.io/scip-java/) for instructions on how to
index Kotlin projects with scip-java. Note that scip-java indexes Kotlin sources
even if you have no Java code.

## Kotlin version compatibility

Any given release of scip-kotlin only supports one major version of Kotlin.
Use the table below to find the version of scip-kotlin that matches the Kotlin
version you are using in your project.

| Kotlin version | scip-kotlin version |
|----------------|---------------------|
| 1.8.x | 0.3.2 |
| 1.9.x | 0.4.0 |

## SemanticDB support

This project is implemented as a
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import groovy.lang.Closure
import org.gradle.jvm.toolchain.internal.CurrentJvmToolchainSpec

plugins {
kotlin("jvm") version "1.8.21"
kotlin("jvm") version "1.9.22"
id("com.github.johnrengelman.shadow") version "7.1.0"
id("com.palantir.git-version") version "0.12.3"
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
Expand Down
8 changes: 7 additions & 1 deletion semanticdb-kotlinc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ dependencies {
testImplementation(kotlin("compiler-embeddable"))
testImplementation(kotlin("test"))
testImplementation("io.kotest", "kotest-assertions-core", "4.6.3")
testImplementation("com.github.tschuchortdev", "kotlin-compile-testing", "1.5.0")

// Unable to use com.github.tschuchortdev:kotlin-compile-testing until 1.9.x support is fixed
// https://github.com/tschuchortdev/kotlin-compile-testing/issues/390
// Until then, we use the fork from https://github.com/ZacSweers/kotlin-compile-testing instead.
// testImplementation("com.github.tschuchortdev", "kotlin-compile-testing", "1.5.0")
testImplementation("dev.zacsweers.kctfork", "core", "0.4.0")

testImplementation("org.junit.jupiter", "junit-jupiter-params", "5.8.1")
testImplementation("org.jetbrains.kotlin", "kotlin-stdlib-jdk8", "1.5.0") {
version {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import org.jetbrains.kotlin.com.intellij.navigation.NavigationItem
import org.jetbrains.kotlin.com.intellij.psi.PsiElement
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.ir.backend.js.lower.serialization.ir.JsManglerDesc.fqnString
import org.jetbrains.kotlin.psi.KtConstructor
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.KtPropertyAccessor
import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.descriptorUtil.getAllSuperClassifiers

@ExperimentalContracts
Expand Down Expand Up @@ -86,7 +86,7 @@ class SemanticdbTextDocumentBuilder(
// first is the class itself
.drop(1)
.filter {
it.fqnString(false) !in isIgnoredSuperClass
it.fqNameSafe.toString() !in isIgnoredSuperClass
}
.flatMap { cache[it] }
.map { it.toString() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import com.sourcegraph.semanticdb_kotlinc.Semanticdb.SymbolOccurrence.Role
import com.sourcegraph.semanticdb_kotlinc.test.ExpectedSymbols.SemanticdbData
import com.sourcegraph.semanticdb_kotlinc.test.ExpectedSymbols.SymbolCacheData
import com.tschuchort.compiletesting.SourceFile
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import kotlin.contracts.ExperimentalContracts
import org.junit.jupiter.api.TestFactory

@ExperimentalCompilerApi
@ExperimentalContracts
class SemanticdbSymbolsTest {
@TestFactory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ data class ExpectedSymbols(
fun SourceFile.Companion.testKt(@Language("kotlin") contents: String): SourceFile =
kotlin("Test.kt", contents)

@ExperimentalCompilerApi
@ExperimentalContracts
fun List<ExpectedSymbols>.mapCheckExpectedSymbols(): List<DynamicTest> =
this.flatMap { (testName, source, symbolsData, semanticdbData) ->
Expand Down

0 comments on commit 3ff9e97

Please sign in to comment.