Skip to content

Detect Gradle build scripts and Kotlin scripts - #37

Merged
sabbaticas merged 1 commit into
mainfrom
feat/gradle-kotlin-script-detection
Oct 9, 2026
Merged

sabbaticas merged 1 commit into
mainfrom
feat/gradle-kotlin-script-detection

Conversation

@sabbaticas

Copy link
Copy Markdown
Contributor

Closes #36.

Summary

  • .gradle now reports as Groovy and .kts as Kotlin. Both were missing from EXT_FILETYPES, so every Gradle script and Kotlin script reported Unknown.
  • build.gradle.kts carries the same gradle, build and dependencies tags as build.gradle. A project on the Gradle Kotlin DSL previously looked like it declared no dependencies.
  • settings.gradle and settings.gradle.kts are tagged gradle and build. They declare project structure, not dependencies.
  • Version bumped to 0.0.21, with a CHANGELOG.md entry under [Unreleased] and a changes/ note.

Before and after

build.gradle         ['gradle', 'build', 'dependencies']   'Unknown'
settings.gradle      []                                    'Unknown'
build.gradle.kts     []                                    'Unknown'
settings.gradle.kts  []                                    'Unknown'
script.main.kts      []                                    'Unknown'
build.gradle         ['gradle', 'build', 'dependencies']   'Groovy'
settings.gradle      ['gradle', 'build']                   'Groovy'
build.gradle.kts     ['gradle', 'build', 'dependencies']   'Kotlin'
settings.gradle.kts  ['gradle', 'build']                   'Kotlin'
script.main.kts      []                                    'Kotlin'

Why the mapping is safe

Gradle selects the DSL by file extension alone: .gradle is compiled as Groovy and .gradle.kts as Kotlin. There is no content-dependent case, so detection stays path-based.

Things to note

  • Gradle build scripts now count towards a repository's Groovy or Kotlin total, so a pure Java or Android project will show a small amount of one or the other.
  • No new tag, language or filetype name is introduced, and the three newly tagged files were previously untagged, so this is purely additive for kospex. A re-sync is needed to pick the tags up.

Testing

  • pytest: 709 passed. The new extension and tag tests were written first and failed before the change.
  • Fixtures added in src/tests/ for all four Gradle filenames; panopticas assess shows each with the expected language and tags.

🤖 Generated with Claude Code

.gradle now reports as Groovy and .kts as Kotlin. Both were missing from
EXT_FILETYPES, so every Gradle script and Kotlin script reported Unknown.
Gradle selects the DSL by extension alone, so the mapping is exact and
detection stays path-based.

build.gradle.kts carries the same gradle, build and dependencies tags as
build.gradle. A project on the Gradle Kotlin DSL previously looked like it
declared no dependencies. settings.gradle and settings.gradle.kts are
tagged gradle and build only, since they declare project structure.

Bumps the version to 0.0.21.

Closes #36

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sabbaticas
sabbaticas merged commit 79b5df6 into main Oct 9, 2026
4 checks passed
@sabbaticas
sabbaticas deleted the feat/gradle-kotlin-script-detection branch October 9, 2026 01:20
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.

Detect Gradle build scripts and Kotlin scripts (.gradle, .kts)

1 participant