Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
Prepare the project for archiviation (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico authored Jan 26, 2023
1 parent 7f3594d commit 0145827
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# WIP: __detekt-compiler-plugin__
# Detekt Compiler Plugin

![Pre Merge Checks](https://github.com/detekt/detekt-compiler-plugin/workflows/Pre%20Merge%20Checks/badge.svg)
[![gradle plugin](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/io/github/detekt/gradle/compiler-plugin/io.github.detekt.gradle.compiler-plugin.gradle.plugin/maven-metadata.xml.svg?label=Gradle&style=flat-square)](https://plugins.gradle.org/plugin/io.github.detekt.gradle.compiler-plugin)

⚠️ This repository is going to get archived in the near future. The development of the `detekt-compiler-plugin` has been moved to the [detekt repo](https://github.com/detekt/detekt/tree/main/detekt-compiler-plugin) ⚠️

Experimental support for integrating detekt as a Kotlin compiler plugin

![image](docs/detekt-compiler-plugin.png "image")


### Usage

```kotlin
plugins {
id("io.github.detekt.gradle.compiler-plugin") version "<latest>"
id("io.github.detekt.gradle.compiler-plugin") version "0.4.0"
}

detekt {
Expand Down
61 changes: 58 additions & 3 deletions detekt-compiler-plugin-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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
60 changes: 59 additions & 1 deletion plugin-build/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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

0 comments on commit 0145827

Please sign in to comment.