Code-health suggestion (proactive — staged for your review)
Category: dead-code
Where: compiler/native/ (the whole module) — compiler/settings.gradle.kts:28-29, compiler/build.gradle.kts:42-54
Current:
:kplusplus-compiler-plugin-native Syncs ../plugin/src/main/kotlin into its own (gitignored) src/main/kotlin and compiles it a second time, against the non-shaded org.jetbrains.kotlin:kotlin-compiler instead of kotlin-compiler-embeddable. Its compiler/native/build.gradle.kts:14 comment states the reason:
// Kotlin/Native loads a plugin compiled against the non-shaded compiler.
compileOnly("org.jetbrains.kotlin:kotlin-compiler:2.4.0")
That is no longer true, and the repo already says so — in compiler/gradle/src/main/kotlin/.../KPlusPlusCompilerGradlePlugin.kt:731-733, directly under getPluginArtifact():
// Kotlin 2.4.0 removed getPluginArtifactForNative — the plugin artifact from
// getPluginArtifact() is now used for native compilations too (the separate
// `-native` host artifact is no longer a distinct plugin-loading path).
getPluginArtifact() returns com.monkopedia.kplusplus:kplusplus-compiler-plugin — the embeddable-compiled jar — and it is what every Kotlin/Native compilation gets. Since every module in this repo (:krapper, :featuregen, :cppfixture, :clangwalk, all three samples) is Kotlin/Native and all of them build, the embeddable jar is demonstrated to be the one that works on K/N. The -native variant serves a loading path that does not exist.
Three measurements.
1. Nothing in the repo consumes it. Every reference, across all 535 tracked files:
$ git grep -n -e 'plugin-native' -e 'compiler/native' -e "file(\"native\")" -- .
.github/workflows/release.yml:65: # `compiler/native/src/test` and a literal `for mod in ...` <- a comment
compiler/build.gradle.kts:46:// * `:kplusplus-compiler-plugin-native` — an internal K/N ... <- the exclusion's comment
compiler/build.gradle.kts:52: "kplusplus-compiler-plugin-native" <- apiValidation.ignoredProjects
compiler/settings.gradle.kts:28:include(":kplusplus-compiler-plugin-native") <- its own declaration
compiler/settings.gradle.kts:29:project(":kplusplus-compiler-plugin-native").projectDir = file("native")
docs/design/memscope-context-params.md:97: ... (prose)
docs/design/memscope-context-params.md:399: ... (prose)
matches above; denominator = 535 tracked files
Its own include(...), its own exclusion from the ABI gate, and prose. No dependency, no artifact reference, no task.
2. It has never been published. Not "not published any more" — never:
$ for a in kplusplus-compiler-gradle kplusplus-compiler-plugin kplusplus-compiler-plugin-native; do ... done
com.monkopedia.kplusplus:kplusplus-compiler-gradle -> HTTP 200, 7 versions, latest=0.3.6
com.monkopedia.kplusplus:kplusplus-compiler-plugin -> HTTP 200, 7 versions, latest=0.3.6
com.monkopedia.kplusplus:kplusplus-compiler-plugin-native-> HTTP 404, 0 versions
(The first two are the positive controls, and they match docs/releasing.md's "That's the whole set — three jars".) So there is no persisted-state hazard here: no consumer can resolve it, nothing on disk or on the wire names it.
3. It is built on every PR and on the release gate, and verifies nothing. From ./gradlew -p compiler check --no-daemon on this box:
> Task :kplusplus-compiler-plugin-native:compileKotlin
> Task :kplusplus-compiler-plugin-native:jar
> Task :kplusplus-compiler-plugin-native:test NO-SOURCE
> Task :kplusplus-compiler-plugin-native:check UP-TO-DATE
That is a full second compile of the FIR plugin on every compiler-check.yml run and, since #222, on release.yml's pre-publish gate — with no tests (NO-SOURCE) and no apiCheck (explicitly ignoredProjects).
And the copy has already drifted. compiler/plugin ships two service registrations; compiler/native ships one:
$ for f in $(git ls-files compiler | /usr/bin/grep services); do echo "--- $f"; cat "$f"; done
--- compiler/native/src/main/resources/META-INF/services/...CompilerPluginRegistrar
com.monkopedia.kplusplus.compiler.KPlusPlusComponentRegistrar
--- compiler/plugin/src/main/resources/META-INF/services/...CommandLineProcessor
com.monkopedia.kplusplus.compiler.KPlusPlusCommandLineProcessor
--- compiler/plugin/src/main/resources/META-INF/services/...CompilerPluginRegistrar
com.monkopedia.kplusplus.compiler.KPlusPlusComponentRegistrar
compiler/native compiles KPlusPlusCommandLineProcessor (it is in the synced sources) but never registers it, so if this jar were ever loaded it would silently ignore every -P plugin:com.monkopedia.kplusplus.compiler:… option. Nothing catches that, because nothing loads the jar. That is the shape of the risk: a maintained-looking duplicate whose divergence from the real artifact is invisible and untested. It is also the mechanical half of the duplication #117 declined to unify — a copy that only exists to serve a dead loading path is better deleted than unified.
Proposed: delete the compiler/native module — the directory, the two include/projectDir lines in compiler/settings.gradle.kts:28-29, and the "kplusplus-compiler-plugin-native" entry (plus its explanatory bullet) from apiValidation.ignoredProjects in compiler/build.gradle.kts. Refs #117 — deleting the duplicate is the disposition that issue's discussion never had available while the module still had a stated purpose.
Before merging, re-read the getPluginArtifactForNative claim against the KGP version in the catalog at that moment, so the deletion rests on a checked fact rather than on a comment (which is precisely what went stale here).
Why: removes a module that is compiled twice per PR and once per release, is published nowhere, is referenced by nothing, exists for a Kotlin API removed in 2.4.0, carries a second off-catalog kotlin-compiler:2.4.0 pin (Refs #225), and has already silently drifted from the source it mirrors. Deleting it also removes a Sync task that writes into a src/ directory, which is the reason compiler/native/.gitignore has to exist.
Effort: mechanical
Filed by the nightly code-health pass. To act on it: relabel agent-workable (it'll flow into triage→work). To decline: close it — it won't be suggested again.
Code-health suggestion (proactive — staged for your review)
Category: dead-code
Where:
compiler/native/(the whole module) —compiler/settings.gradle.kts:28-29,compiler/build.gradle.kts:42-54Current:
:kplusplus-compiler-plugin-nativeSyncs../plugin/src/main/kotlininto its own (gitignored)src/main/kotlinand compiles it a second time, against the non-shadedorg.jetbrains.kotlin:kotlin-compilerinstead ofkotlin-compiler-embeddable. Itscompiler/native/build.gradle.kts:14comment states the reason:That is no longer true, and the repo already says so — in
compiler/gradle/src/main/kotlin/.../KPlusPlusCompilerGradlePlugin.kt:731-733, directly undergetPluginArtifact():getPluginArtifact()returnscom.monkopedia.kplusplus:kplusplus-compiler-plugin— the embeddable-compiled jar — and it is what every Kotlin/Native compilation gets. Since every module in this repo (:krapper,:featuregen,:cppfixture,:clangwalk, all three samples) is Kotlin/Native and all of them build, the embeddable jar is demonstrated to be the one that works on K/N. The-nativevariant serves a loading path that does not exist.Three measurements.
1. Nothing in the repo consumes it. Every reference, across all 535 tracked files:
Its own
include(...), its own exclusion from the ABI gate, and prose. No dependency, no artifact reference, no task.2. It has never been published. Not "not published any more" — never:
(The first two are the positive controls, and they match
docs/releasing.md's "That's the whole set — three jars".) So there is no persisted-state hazard here: no consumer can resolve it, nothing on disk or on the wire names it.3. It is built on every PR and on the release gate, and verifies nothing. From
./gradlew -p compiler check --no-daemonon this box:That is a full second compile of the FIR plugin on every
compiler-check.ymlrun and, since #222, onrelease.yml's pre-publish gate — with no tests (NO-SOURCE) and noapiCheck(explicitlyignoredProjects).And the copy has already drifted.
compiler/pluginships two service registrations;compiler/nativeships one:compiler/nativecompilesKPlusPlusCommandLineProcessor(it is in the synced sources) but never registers it, so if this jar were ever loaded it would silently ignore every-P plugin:com.monkopedia.kplusplus.compiler:…option. Nothing catches that, because nothing loads the jar. That is the shape of the risk: a maintained-looking duplicate whose divergence from the real artifact is invisible and untested. It is also the mechanical half of the duplication #117 declined to unify — a copy that only exists to serve a dead loading path is better deleted than unified.Proposed: delete the
compiler/nativemodule — the directory, the twoinclude/projectDirlines incompiler/settings.gradle.kts:28-29, and the"kplusplus-compiler-plugin-native"entry (plus its explanatory bullet) fromapiValidation.ignoredProjectsincompiler/build.gradle.kts. Refs #117 — deleting the duplicate is the disposition that issue's discussion never had available while the module still had a stated purpose.Before merging, re-read the
getPluginArtifactForNativeclaim against the KGP version in the catalog at that moment, so the deletion rests on a checked fact rather than on a comment (which is precisely what went stale here).Why: removes a module that is compiled twice per PR and once per release, is published nowhere, is referenced by nothing, exists for a Kotlin API removed in 2.4.0, carries a second off-catalog
kotlin-compiler:2.4.0pin (Refs #225), and has already silently drifted from the source it mirrors. Deleting it also removes aSynctask that writes into asrc/directory, which is the reasoncompiler/native/.gitignorehas to exist.Effort: mechanical
Filed by the nightly code-health pass. To act on it: relabel
agent-workable(it'll flow into triage→work). To decline: close it — it won't be suggested again.