Skip to content

devrail-dev/devrail-plugin-kotlin

Repository files navigation

devrail-plugin-kotlin

DevRail plugin: Kotlin language ecosystem (ktlint, detekt, Gradle, JDK 21).

This is the reference plugin extracted from dev-toolchain core during Story 13.7. It demonstrates the v1 plugin model and serves as the template for other languages that will follow the same extraction path in v2.0.0.

What's included

  • JDK 21 (Eclipse Temurin) — copied from the eclipse-temurin:21-jdk builder stage by the dev-toolchain build pipeline (Story 13.4).
  • ktlint 1.5.0 — Kotlin linter and formatter using the official Kotlin coding conventions.
  • detekt 1.23.7 — configurable static analysis for Kotlin (complexity, potential bugs, code smells).
  • Gradle 8.12 — the standard Kotlin build tool.
  • OWASP dependency-check — Gradle plugin for scanning dependencies against the National Vulnerability Database (consumed via gradle dependencyCheckAnalyze).

Consumer-side declaration

Add to your project's .devrail.yml:

plugins:
  - source: github.com/devrail-dev/devrail-plugin-kotlin
    rev: v1.0.0
    languages: [kotlin]

Then:

make plugins-update    # resolves rev → SHA, writes .devrail.lock
make check             # builds the project-local extended image and runs all targets

Note: While dev-toolchain v1.10.x and v1.11.x continue to ship Kotlin in core, declaring kotlin in languages: will hit the in-core path FIRST (per the loader's "core wins" precedence rule). To exercise this plugin, declare it in plugins: only — leave kotlin out of the top-level languages: list. v2.0.0 (Story 13.9) removes the in-core Kotlin path; from then on, this plugin is the only path.

Targets

The plugin maps to the standard DevRail Makefile targets:

Target Command Gate
lint ktlint && detekt-cli ... build.gradle.kts
format_check ktlint --format --dry-run build.gradle.kts
format_fix ktlint --format build.gradle.kts
test gradle test --no-daemon build.gradle.kts
security gradle dependencyCheckAnalyze --no-daemon build.gradle.kts

The lint target chains ktlint AND detekt with && because the v1 plugin contract is one cmd per target. To override either tool individually, use a per-language override in your .devrail.yml:

kotlin:
  linter: "ktlint"          # drop detekt
  test: "gradle test --info" # extra Gradle flags

Override key map (per the .devrail.yml schema): lint→linter, format_check/format_fix→formatter, fix→fixer, test→test, security→security. Overrides take the cmd verbatim.

Versioning

  • schema_version: 1 — the manifest format. v1.10.0 baseline.
  • version — this plugin's own semver. Bumped on releases.
  • devrail_min_version: 1.10.0 — the oldest dev-toolchain version that supports this plugin (when the plugin loader first stabilized).
Plugin version dev-toolchain min Notes
v1.0.0 1.10.0 Initial extraction. ktlint 1.5.0, detekt 1.23.7, Gradle 8.12.

Local development

To test changes to this plugin against a consumer workspace:

# In the consumer's .devrail.yml
plugins:
  - source: file:///path/to/devrail-plugin-kotlin
    rev: v1.0.0
    languages: [kotlin]
make plugins-update
make check

Contributing

This plugin follows DevRail standards. To work on it:

make check               # lint, format, test, security, scan
make install-hooks       # one-time pre-commit setup

All commits use conventional commit format.

License

MIT

See also

About

DevRail plugin: Kotlin language ecosystem (ktlint, detekt, Gradle, JDK 21). Reference example for Story 13.7.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors