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.
Split compiler plugin and its Gradle plugin into separate modules (#61)
- Loading branch information
Showing
15 changed files
with
155 additions
and
43 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 |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
val kotlinVersion: String = libs.versions.kotlin.get() | ||
|
||
val detektPluginVersion: String by project | ||
|
||
group = "io.github.detekt" | ||
version = detektPluginVersion | ||
|
||
val detektPublication = "DetektPublication" | ||
|
||
plugins { | ||
alias(libs.plugins.kotlin) | ||
id("maven-publish") | ||
id("java-gradle-plugin") | ||
`jvm-test-suite` | ||
alias(libs.plugins.pluginPublishing) | ||
alias(libs.plugins.gradleVersionz) | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
mavenLocal() | ||
} | ||
|
||
dependencies { | ||
compileOnly(gradleApi()) | ||
compileOnly(kotlin("gradle-plugin")) | ||
compileOnly(kotlin("gradle-plugin-api")) | ||
|
||
testImplementation(libs.assertj.core) | ||
} | ||
|
||
tasks.withType<KotlinCompile>().configureEach { | ||
kotlinOptions.jvmTarget = "1.8" | ||
kotlinOptions.freeCompilerArgs = listOf( | ||
"-opt-in=kotlin.RequiresOptIn" | ||
) | ||
} | ||
|
||
tasks.withType<Test>().configureEach { | ||
testLogging { | ||
// set options for log level LIFECYCLE | ||
events = setOf( | ||
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED, | ||
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR, | ||
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT, | ||
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED | ||
) | ||
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL | ||
showExceptions = true | ||
showCauses = true | ||
showStackTraces = true | ||
} | ||
} | ||
|
||
testing { | ||
suites { | ||
val test by getting(JvmTestSuite::class) { | ||
useJUnitJupiter(libs.versions.junit.get()) | ||
} | ||
} | ||
} | ||
|
||
tasks { | ||
val writeDetektVersionProperties by registering(WriteProperties::class) { | ||
description = "Write the properties file with the Detekt version to be used by the plugin" | ||
encoding = "UTF-8" | ||
outputFile = file("$buildDir/versions.properties") | ||
property("detektCompilerPluginVersion", project.version) | ||
} | ||
|
||
processResources { | ||
from(writeDetektVersionProperties) | ||
} | ||
} | ||
|
||
val sourcesJar by tasks.registering(Jar::class) { | ||
dependsOn(tasks.classes) | ||
archiveClassifier.set("sources") | ||
from(sourceSets.main.get().allSource) | ||
} | ||
|
||
val javadocJar by tasks.registering(Jar::class) { | ||
from(tasks.javadoc) | ||
archiveClassifier.set("javadoc") | ||
} | ||
|
||
artifacts { | ||
archives(sourcesJar) | ||
archives(javadocJar) | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
register("detektCompilerPlugin") { | ||
id = "io.github.detekt.gradle.compiler-plugin" | ||
implementationClass = "io.github.detekt.gradle.DetektKotlinCompilerPlugin" | ||
} | ||
} | ||
} | ||
|
||
pluginBundle { | ||
website = "https://detekt.github.io/detekt" | ||
vcsUrl = "https://github.com/detekt/detekt-compiler-plugin" | ||
description = "Static code analysis for Kotlin as a compiler plugin." | ||
tags = listOf("kotlin", "detekt", "code-analysis") | ||
|
||
(plugins) { | ||
"detektCompilerPlugin" { | ||
id = "io.github.detekt.gradle.compiler-plugin" | ||
displayName = "Static code analysis for Kotlin" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
detektPluginVersion=0.4.0 | ||
|
||
kotlinCompilerChecksum=f5216644ad81571e5db62ec2322fe07468927bda40f51147ed626a2884b55f9a | ||
|
||
kotlin.code.style=official | ||
systemProp.sonar.host.url=http://localhost:9000 | ||
systemProp.detektVersion=detektVersion | ||
systemProp.file.encoding=UTF-8 |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
rootProject.name = "detekt-compiler-plugin-gradle-plugin" | ||
|
||
pluginManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
} | ||
} | ||
|
||
dependencyResolutionManagement { | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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