Skip to content

Merge scip-kotlin into scip-java#879

Draft
jupblb wants to merge 7 commits into
mainfrom
michal/scip-kotlin-2
Draft

Merge scip-kotlin into scip-java#879
jupblb wants to merge 7 commits into
mainfrom
michal/scip-kotlin-2

Conversation

@jupblb
Copy link
Copy Markdown
Member

@jupblb jupblb commented May 14, 2026

No description provided.

jupblb added 7 commits May 13, 2026 12:10
Merges the scip-kotlin repository (semanticdb-kotlinc compiler plugin) into
scip-java so they live in a single repository. The kotlinc plugin is now
built locally and embedded as a resource into the scip-java CLI distribution
instead of being fetched from Maven at runtime.

Source merge:
- semanticdb-kotlinc/src/** — kotlinc plugin source (Kotlin 2.2.0)
- semanticdb-kotlinc/minimized/src/** — fixtures + golden snapshots

Build wiring (build.sbt + project/):
- New semanticdbKotlinc project (KotlinPlugin + sbt-assembly fat-jar with
  com.intellij.** shading, mirroring the previous Gradle shadowJar setup).
- New semanticdbKotlincMinimized project that compiles the Kotlin/Java
  fixtures with the locally-built plugin and exposes a kotlincSnapshots
  task that drives cli/runMain to (re)generate the golden snapshots.
- V.kotlinVersion bumped 2.1.20 -> 2.2.0 to match the merged plugin.
- V.semanticdbKotlin removed (no longer needed).
- V.semanticdbKotlincProtobuf added (3.17.3) so the kotlinc module keeps
  its own protobuf codegen version without perturbing scip-java.
- V.kotest, V.kctfork added for the kotlinc test suite.
- cli now ships semanticdb-kotlinc.jar alongside the other embedded jars.
- cli's Compile / run / fork is now true so ScipJava.main's System.exit
  cannot kill the surrounding sbt JVM during snapshot regeneration.
- project/SemanticdbKotlincKeys.scala adds the kotlincSnapshots taskKey
  (separately named to avoid collision with the existing snapshots test
  project).
- project/plugins.sbt picks up sbt-kotlin-plugin 3.1.6 and
  sbt-jupiter-interface 0.15.1.

Runtime wiring — replace runtime Maven resolution with embedded jar:
- Embedded.semanticdbKotlincJar(...) added.
- ScipBuildTool.compileKotlinFiles now takes tmp: Path and uses the
  embedded jar instead of resolving com.sourcegraph:semanticdb-kotlinc
  via Coursier. Two debug println calls removed.
- GradleBuildTool init script writes
  project.ext["semanticdbKotlincJar"] so the embedded jar is visible
  to the gradle plugin.
- SemanticdbGradlePlugin reads semanticdbKotlincJar from extra
  properties instead of creating a detached configuration that resolves
  the artifact from Maven.

Housekeeping:
- .github/workflows/ci.yml gets a kotlin_plugin job that runs
  semanticdbKotlinc/test, semanticdbKotlincMinimized/kotlincSnapshots,
  and a snapshot drift check (mirrors scip-kotlin's old CI signal).
- .gitignore: ignore semanticdb-kotlinc/META-INF/ (kctfork tests dump
  semanticdb output there) plus the standard project/target,
  project/project sbt directories.
- tests/buildTools GradleBuildToolSuite kotlin plugin version bumped
  2.1.20 -> 2.2.0 to match V.kotlinVersion.

Deliberately NOT copied:
- scip-kotlin's build.sbt, project/, snapshots-runner/, .github/,
  .gitignore, LICENSE, README.md, renovate.json — scip-java already has
  equivalents and snapshots-runner is replaced by direct cli/runMain
  invocation.
Removes the small project/SemanticdbKotlincKeys.scala helper. The task
key only had a single use site (build.sbt) and taskKey works fine
declared directly in a .sbt file, so the extra meta-build file added
no value.
Fixes scalafmtSbtCheck failure in the 'check' CI job.
The semanticdb-javac plugin's package reference annotation on
'package snapshots;' lines is platform-sensitive: macOS regen emits
the line, Linux regen (the CI environment) does not. The snapshots
carried over from scip-kotlin were generated on macOS, so the CI's
'Check snapshot drift' step in the kotlin_plugin job failed because
its Linux regen produced 5 single-line deletions in:

  ClassConsumer.java, CompanionConsumer.java, KotlinClass.java,
  KotlinLambdas.java, ObjectKtConsumer.java

Each just removes a stray '//... reference semanticdb maven . . snapshots/'
caret line. Reproduced and regenerated inside an eclipse-temurin:11-jdk
container against this branch.
Kotlin 2.2.0's K2JVMCompiler emits LOGGING messages on startup (e.g.
about the missing scripting plugin and Kotlin home directory). The
MessageCollector previously pushed *every* report() severity onto the
errors list, so hasErrors() returned true and the compiler returned
COMPILATION_ERROR even when nothing was actually wrong. The
LibrarySnapshotSuite consequently failed indexing
'org.jetbrains.exposed:exposed-core:1.0.0-beta-4' on CI without any
real diagnostic surfaced.

Only push to errors when severity.isError so hasErrors stays honest.
The semanticdb-kotlinc plugin now runs on Kotlin 2.2.0 (was 2.1.20),
which produces different output for the exposed-core:1.0.0-beta-4
library snapshots indexed by tests.LibrarySnapshotSuite. The dominant
changes are:

  - many more enclosing_range_start/end annotations on classes,
    constructors, properties, getters, anonymous enum-constant objects,
    and lambda inits;
  - local symbol renumbering and a few new locals in lambdas/inits.

No malformed symbols or '???' placeholders.

Regenerated via 'snapshots/Test/runMain tests.SaveSnapshots library'
inside an eclipse-temurin:11-jdk container so the output matches the
Linux CI environment.
This binary kotlinc per-module metadata file was incidentally committed
in #842 ('Remove LSIF graph format support'), unrelated to that PR's
intent. It is not referenced by any build/test config and is
regenerated on every Kotlin compile by LibrarySnapshotSuite.

The matching .gitignore entry 'tests/snapshots/META-INF/' is already
in place (added in #841) but had no effect because the file was
already tracked.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant