Skip to content

Commit 4bdd672

Browse files
authored
Refactor publishing tasks into a plugin (#437)
* Refactor publishing tasks into a plugin * Update detekt baseline to ignore gradle/plugins build dir
1 parent 54c8465 commit 4bdd672

File tree

8 files changed

+184
-24
lines changed

8 files changed

+184
-24
lines changed

build.gradle.kts

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,6 @@ repositories {
1111
mavenCentral()
1212
}
1313

14-
configure(subprojects.filter { it.name != "grammars" }) {
15-
apply(plugin = "kotlin")
16-
apply(plugin = "maven-publish")
17-
18-
publishing {
19-
repositories {
20-
maven {
21-
name = "GitHubPackages"
22-
url = uri("https://maven.pkg.github.com/fwcd/kotlin-language-server")
23-
credentials {
24-
username = project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USERNAME")
25-
password = project.findProperty("gpr.key") as String? ?: System.getenv("GPR_PASSWORD")
26-
}
27-
}
28-
}
29-
30-
publications {
31-
register("gpr", MavenPublication::class) {
32-
from(components["java"])
33-
}
34-
}
35-
}
36-
}
3714

3815
detekt {
3916
allRules = false // activate all available (even unstable) rules.
@@ -66,6 +43,7 @@ tasks.register<DetektCreateBaselineTask>("createDetektBaseline") {
6643
include("**/*.kts")
6744
exclude("shared/build/**/*.*")
6845
exclude("server/build/**/*.*")
46+
exclude("gradle/plugins/build/**/*.*")
6947
}
7048

7149
tasks.withType<Detekt>().configureEach {

detekt_baseline.xml

Lines changed: 139 additions & 1 deletion
Large diffs are not rendered by default.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
plugins {
2+
`maven-publish`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
publishing {
10+
repositories {
11+
maven {
12+
name = "GitHubPackages"
13+
url = uri("https://maven.pkg.github.com/fwcd/kotlin-language-server")
14+
credentials {
15+
username = project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USERNAME")
16+
password = project.findProperty("gpr.key") as String? ?: System.getenv("GPR_PASSWORD")
17+
}
18+
}
19+
}
20+
21+
publications {
22+
register("gpr", MavenPublication::class) {
23+
from(components["java"])
24+
}
25+
}
26+
}

gradle/plugins/settings.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dependencyResolutionManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
}
5+
}
6+
7+
include("kotlin-plugins")

server/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
id("application")
77
id("com.github.jk1.tcdeps")
88
id("com.jaredsburrows.license")
9+
id("configure-publishing")
910
}
1011

1112
val projectVersion = "1.3.2"

settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pluginManagement {
2424
id("com.github.jk1.tcdeps") version "1.2" apply false
2525
id("com.jaredsburrows.license") version "0.8.42" apply false
2626
}
27+
28+
includeBuild("gradle/plugins")
2729
}
2830

2931
dependencyResolutionManagement {

shared/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import groovy.lang.MissingPropertyException
33
plugins {
44
id("maven-publish")
55
kotlin("jvm")
6+
id("configure-publishing")
67
}
78

89
repositories {

0 commit comments

Comments
 (0)