Skip to content

Commit

Permalink
Update to detekt 1.17.1, Gradle 7.0.2 and IntelliJ 2021.1 (#129)
Browse files Browse the repository at this point in the history
* Update to Gradle 7.0.2

* Use new Gradle API for tasks configuration

* Remove deprecated API usage

* Add plugin compatibility verification

* Update to detekt 1.17.1

* Change way to get publish token

* Version 1.17.1
  • Loading branch information
osipxd committed May 25, 2021
1 parent 587a20e commit 4dccb56
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 24 deletions.
38 changes: 22 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.jetbrains.intellij.IntelliJPluginExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val detektIntellijPluginVersion: String by extra
Expand All @@ -9,14 +8,13 @@ project.version = detektIntellijPluginVersion

repositories {
mavenCentral()
maven { setUrl("http://dl.bintray.com/jetbrains/intellij-plugin-service") }
jcenter()
maven(url = "https://dl.bintray.com/jetbrains/intellij-plugin-service")
}

plugins {
id("org.jetbrains.intellij").version("0.7.2")
id("com.github.ben-manes.versions") version "0.33.0"
kotlin("jvm").version("1.4.21")
id("org.jetbrains.intellij").version("0.7.3")
id("com.github.ben-manes.versions") version "0.38.0"
kotlin("jvm").version("1.4.32")
id("com.github.breadmoirai.github-release") version "2.2.12"
}

Expand All @@ -27,8 +25,8 @@ dependencies {
runtimeOnly("io.gitlab.arturbosch.detekt:detekt-rules:$detektVersion")
runtimeOnly("io.gitlab.arturbosch.detekt:detekt-formatting:$detektVersion")
testImplementation("io.gitlab.arturbosch.detekt:detekt-test-utils:$detektVersion")
testImplementation("org.assertj:assertj-core:3.17.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.0")
testImplementation("org.assertj:assertj-core:3.19.0")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.2")
}

java {
Expand All @@ -38,12 +36,14 @@ java {
withSourcesJar()
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn")
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn")
}
}

tasks.withType<Test> {
tasks.withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
showStandardStreams = true
Expand All @@ -54,18 +54,24 @@ tasks.withType<Test> {
}

tasks.publishPlugin {
setToken(System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken"))
// This property can be configured via environment variable ORG_GRADLE_PROJECT_intellijPublishToken
// See: https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties
setToken(findProperty("intellijPublishToken"))
}

configure<IntelliJPluginExtension> {
intellij {
pluginName = "Detekt IntelliJ Plugin"
version = "2020.3"
version = "2021.1"
updateSinceUntilBuild = false
setPlugins("IntelliLang", "Kotlin")
}

tasks.runPluginVerifier {
ideVersions(listOf("2020.2.4", "2020.3.4", "2021.1.2"))
}

githubRelease {
token(project.findProperty("github.token") as? String ?: "")
token((project.findProperty("github.token") as? String).orEmpty())
owner.set("detekt")
repo.set("detekt-intellij-plugin")
targetCommitish.set("main")
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
### Changelog

#### 1.17.1

- Update to detekt 1.17.1
- Update to Gradle 7.0.2
- Update to IntelliJ 2021.1

#### 1.16.0
- Upgrade to detekt 1.16.0

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
detektIntellijPluginVersion=1.16.0
detektVersion=1.16.0
detektIntellijPluginVersion=1.17.1
detektVersion=1.17.1

systemProp.detektVersion=detektVersion
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.gitlab.arturbosch.detekt.idea

import com.intellij.lang.annotation.AnnotationHolder
import com.intellij.lang.annotation.ExternalAnnotator
import com.intellij.lang.annotation.HighlightSeverity
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiFile
import io.gitlab.arturbosch.detekt.api.Finding
Expand Down Expand Up @@ -38,11 +39,10 @@ class DetektAnnotator : ExternalAnnotator<PsiFile, List<Finding>>() {
for (finding in annotationResult) {
val textRange = finding.charPosition.toTextRange()
val message = finding.id + ": " + finding.messageOrDescription()
if (configuration.treatAsError) {
holder.createErrorAnnotation(textRange, message)
} else {
holder.createWarningAnnotation(textRange, message)
}
val severity = if (configuration.treatAsError) HighlightSeverity.ERROR else HighlightSeverity.WARNING
holder.newAnnotation(severity, message)
.range(textRange)
.create()
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

<change-notes><![CDATA[
<ul>
<li>1.17.1 - Based on detekt 1.17.1.</li>
<li>1.16.0 - Based on detekt 1.16.0.</li>
<li>1.15.0 - Based on detekt 1.15.0.</li>
<li>1.6.1 - Based on detekt 1.14.2.</li>
Expand Down

0 comments on commit 4dccb56

Please sign in to comment.