This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare the project for archiviation (#62)
- Loading branch information
Showing
3 changed files
with
121 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,13 +7,12 @@ val detektPluginVersion: String by project | |
group = "io.github.detekt" | ||
version = detektPluginVersion | ||
|
||
val detektPublication = "DetektPublication" | ||
|
||
plugins { | ||
alias(libs.plugins.kotlin) | ||
id("maven-publish") | ||
id("signing") | ||
id("java-gradle-plugin") | ||
`jvm-test-suite` | ||
id("jvm-test-suite") | ||
alias(libs.plugins.pluginPublishing) | ||
alias(libs.plugins.gradleVersionz) | ||
} | ||
|
@@ -113,3 +112,59 @@ pluginBundle { | |
} | ||
} | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "mavenCentral" | ||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2") | ||
credentials { | ||
username = "SONATYPE_USERNAME".byProperty | ||
password = "SONATYPE_PASSWORD".byProperty | ||
} | ||
} | ||
} | ||
publications.register<MavenPublication>("pluginMaven") { | ||
groupId = project.group.toString() | ||
artifactId = project.name | ||
version = detektPluginVersion | ||
pom { | ||
description.set("Gradle plugin to support the compiler plugin for Detekt, the Static code analyzer for Kotlin") | ||
name.set("detekt") | ||
url.set("https://detekt.dev") | ||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
distribution.set("repo") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("Detekt Developers") | ||
name.set("Detekt Developers") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
url.set("https://github.com/detekt/detekt") | ||
} | ||
} | ||
} | ||
} | ||
|
||
val signingKey = "SIGNING_KEY".byProperty | ||
val signingPwd = "SIGNING_PWD".byProperty | ||
if (signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) { | ||
logger.info("Signing disabled as the GPG key was not found") | ||
} else { | ||
logger.info("GPG Key found - Signing enabled") | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys(signingKey, signingPwd) | ||
sign(publishing.publications) | ||
isRequired = !(signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) | ||
} | ||
|
||
val String.byProperty: String? get() = providers.gradleProperty(this).orNull |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ val detektPublication = "DetektPublication" | |
plugins { | ||
alias(libs.plugins.kotlin) | ||
id("maven-publish") | ||
`jvm-test-suite` | ||
id("signing") | ||
id("jvm-test-suite") | ||
alias(libs.plugins.gradleVersionz) | ||
alias(libs.plugins.shadow) | ||
alias(libs.plugins.download) | ||
|
@@ -171,3 +172,60 @@ artifacts { | |
archives(sourcesJar) | ||
archives(javadocJar) | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
name = "mavenCentral" | ||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2") | ||
credentials { | ||
username = "SONATYPE_USERNAME".byProperty | ||
password = "SONATYPE_PASSWORD".byProperty | ||
} | ||
} | ||
} | ||
publications.register<MavenPublication>(detektPublication) { | ||
groupId = project.group.toString() | ||
artifactId = project.name | ||
from(components["java"]) | ||
version = detektPluginVersion | ||
pom { | ||
description.set("Compiler plugin for Detekt, the Static code analyzer for Kotlin") | ||
name.set("detekt") | ||
url.set("https://detekt.dev") | ||
licenses { | ||
license { | ||
name.set("The Apache Software License, Version 2.0") | ||
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") | ||
distribution.set("repo") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("Detekt Developers") | ||
name.set("Detekt Developers") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
url.set("https://github.com/detekt/detekt") | ||
} | ||
} | ||
} | ||
} | ||
|
||
val signingKey = "SIGNING_KEY".byProperty | ||
val signingPwd = "SIGNING_PWD".byProperty | ||
if (signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) { | ||
logger.info("Signing disabled as the GPG key was not found") | ||
} else { | ||
logger.info("GPG Key found - Signing enabled") | ||
} | ||
|
||
signing { | ||
useInMemoryPgpKeys(signingKey, signingPwd) | ||
sign(publishing.publications) | ||
isRequired = !(signingKey.isNullOrBlank() || signingPwd.isNullOrBlank()) | ||
} | ||
|
||
val String.byProperty: String? get() = providers.gradleProperty(this).orNull |