Skip to content

Commit 0781a71

Browse files
authored
Merge pull request #118 from rock3r/version-catalogs
Convert build to use Kotlin DSL and version catalogs
2 parents 4bf082b + 9818852 commit 0781a71

File tree

10 files changed

+163
-161
lines changed

10 files changed

+163
-161
lines changed

build.gradle

Lines changed: 0 additions & 60 deletions
This file was deleted.

build.gradle.kts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
plugins {
2+
id("java")
3+
alias(libs.plugins.kotlin.jvm)
4+
alias(libs.plugins.ktfmt)
5+
}
6+
7+
apply(from = "$rootDir/version.gradle")
8+
9+
group = "kdocformatter"
10+
11+
version = "1.0"
12+
13+
repositories {
14+
google()
15+
mavenCentral()
16+
gradlePluginPortal()
17+
}
18+
19+
tasks.register("lint") { dependsOn(":library:lint", ":cli:lint", ":ide-plugin:lint") }
20+
21+
tasks.register("install") { dependsOn(":cli:installDist", "test") }
22+
23+
tasks.register("zip") { dependsOn(":cli:distZip", "test") }
24+
25+
tasks.register("runIde") { dependsOn(":ide-plugin:runIde") }
26+
27+
tasks.register("plugin") { dependsOn(":ide-plugin:buildPlugin") }
28+
29+
tasks.register("all") { dependsOn("clean", "install", "plugin", "zip") }
30+
31+
tasks.named<Delete>("clean") {
32+
doFirst {
33+
delete("$rootDir/m2")
34+
delete("$rootDir/gradle-plugin/build")
35+
}
36+
}

cli/build.gradle

Lines changed: 0 additions & 48 deletions
This file was deleted.

cli/build.gradle.kts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
plugins {
2+
id("java")
3+
alias(libs.plugins.kotlin.jvm)
4+
id("application")
5+
alias(libs.plugins.android.lint)
6+
alias(libs.plugins.ktfmt)
7+
}
8+
9+
group = "kdoc-formatter"
10+
11+
version = rootProject.extra["buildVersion"].toString()
12+
13+
application {
14+
mainClass = "kdocformatter.cli.Main"
15+
applicationName = "kdoc-formatter"
16+
}
17+
18+
repositories {
19+
google()
20+
mavenCentral()
21+
gradlePluginPortal()
22+
}
23+
24+
dependencies {
25+
implementation(libs.kotlin.stdlib)
26+
testImplementation(libs.junit.jupiter.api)
27+
testImplementation(libs.junit.jupiter.params)
28+
testRuntimeOnly(libs.junit.jupiter.engine)
29+
implementation(project(":library"))
30+
}
31+
32+
configure<com.android.build.api.dsl.Lint> {
33+
disable.add("JavaPluginLanguageLevel")
34+
textReport = true
35+
}
36+
37+
tasks.test { useJUnitPlatform() }
38+
39+
java { toolchain { languageVersion = JavaLanguageVersion.of(17) } }
40+
41+
kotlin { jvmToolchain(17) }

gradle/libs.versions.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[versions]
2+
kotlin = "2.2.21"
3+
android-gradle-plugin = "8.13.2"
4+
ktfmt = "0.25.0"
5+
intellij-platform = "2.10.5"
6+
changelog = "2.5.0"
7+
foojay-resolver = "0.9.0"
8+
junit4 = "4.13.2"
9+
junit5 = "5.11.4"
10+
truth = "1.4.5"
11+
12+
[libraries]
13+
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" }
14+
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib" }
15+
junit4 = { module = "junit:junit", version.ref = "junit4" }
16+
truth = { module = "com.google.truth:truth", version.ref = "truth" }
17+
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit5" }
18+
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit5" }
19+
junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit5" }
20+
21+
[plugins]
22+
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
23+
android-lint = { id = "com.android.lint", version.ref = "android-gradle-plugin" }
24+
ktfmt = { id = "com.ncorti.ktfmt.gradle", version.ref = "ktfmt" }
25+
intellij-platform = { id = "org.jetbrains.intellij.platform", version.ref = "intellij-platform" }
26+
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
27+
foojay-resolver = { id = "org.gradle.toolchains.foojay-resolver-convention", version.ref = "foojay-resolver" }

ide-plugin/build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ private fun properties(key: String) = project.findProperty(key).toString()
88

99
plugins {
1010
id("java")
11-
id("org.jetbrains.kotlin.jvm")
12-
id("org.jetbrains.intellij.platform") version "2.10.5"
13-
id("org.jetbrains.changelog") version "2.5.0"
14-
id("com.android.lint")
15-
id("com.ncorti.ktfmt.gradle")
11+
alias(libs.plugins.kotlin.jvm)
12+
alias(libs.plugins.intellij.platform)
13+
alias(libs.plugins.changelog)
14+
alias(libs.plugins.android.lint)
15+
alias(libs.plugins.ktfmt)
1616
}
1717

1818
val pluginVersion: String =

library/build.gradle

Lines changed: 0 additions & 36 deletions
This file was deleted.

library/build.gradle.kts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
plugins {
2+
id("java")
3+
alias(libs.plugins.kotlin.jvm)
4+
alias(libs.plugins.android.lint)
5+
alias(libs.plugins.ktfmt)
6+
}
7+
8+
group = "kdoc-formatter"
9+
10+
version = rootProject.extra["buildVersion"].toString()
11+
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
17+
18+
configure<com.android.build.api.dsl.Lint> {
19+
disable.add("JavaPluginLanguageLevel")
20+
textReport = true
21+
}
22+
23+
dependencies {
24+
implementation(libs.kotlin.stdlib)
25+
testImplementation(libs.junit4)
26+
testImplementation(libs.truth)
27+
}
28+
29+
java { toolchain { languageVersion = JavaLanguageVersion.of(17) } }
30+
31+
kotlin { jvmToolchain(17) }

settings.gradle

Lines changed: 0 additions & 12 deletions
This file was deleted.

settings.gradle.kts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
pluginManagement {
2+
repositories {
3+
google()
4+
mavenCentral()
5+
gradlePluginPortal()
6+
}
7+
}
8+
9+
plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0" }
10+
11+
rootProject.name = "kdoc-formatter"
12+
13+
include("cli")
14+
15+
include("library")
16+
17+
include(
18+
"ide-plugin")
19+
20+
// Including this in the same project causes Gradle sync
21+
// to repeated sources, which makes the IDE experience poor.
22+
// Instead, this is now a separate project.
23+
// include("gradle-plugin")

0 commit comments

Comments
 (0)