Skip to content

Commit

Permalink
Refactor publishing tasks into a plugin (#437)
Browse files Browse the repository at this point in the history
* Refactor publishing tasks into a plugin

* Update detekt baseline to ignore gradle/plugins build dir
  • Loading branch information
RenFraser committed Mar 7, 2023
1 parent 54c8465 commit 4bdd672
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 24 deletions.
24 changes: 1 addition & 23 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,6 @@ repositories {
mavenCentral()
}

configure(subprojects.filter { it.name != "grammars" }) {
apply(plugin = "kotlin")
apply(plugin = "maven-publish")

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/fwcd/kotlin-language-server")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GPR_PASSWORD")
}
}
}

publications {
register("gpr", MavenPublication::class) {
from(components["java"])
}
}
}
}

detekt {
allRules = false // activate all available (even unstable) rules.
Expand Down Expand Up @@ -66,6 +43,7 @@ tasks.register<DetektCreateBaselineTask>("createDetektBaseline") {
include("**/*.kts")
exclude("shared/build/**/*.*")
exclude("server/build/**/*.*")
exclude("gradle/plugins/build/**/*.*")
}

tasks.withType<Detekt>().configureEach {
Expand Down
140 changes: 139 additions & 1 deletion detekt_baseline.xml

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions gradle/plugins/kotlin-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
plugins {
`maven-publish`
}

repositories {
mavenCentral()
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/fwcd/kotlin-language-server")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GPR_USERNAME")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GPR_PASSWORD")
}
}
}

publications {
register("gpr", MavenPublication::class) {
from(components["java"])
}
}
}
7 changes: 7 additions & 0 deletions gradle/plugins/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
repositories {
gradlePluginPortal()
}
}

include("kotlin-plugins")
1 change: 1 addition & 0 deletions server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ plugins {
id("application")
id("com.github.jk1.tcdeps")
id("com.jaredsburrows.license")
id("configure-publishing")
}

val projectVersion = "1.3.2"
Expand Down
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ pluginManagement {
id("com.github.jk1.tcdeps") version "1.2" apply false
id("com.jaredsburrows.license") version "0.8.42" apply false
}

includeBuild("gradle/plugins")
}

dependencyResolutionManagement {
Expand Down
1 change: 1 addition & 0 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import groovy.lang.MissingPropertyException
plugins {
id("maven-publish")
kotlin("jvm")
id("configure-publishing")
}

repositories {
Expand Down

0 comments on commit 4bdd672

Please sign in to comment.