Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.intellij.tasks.PrepareSandboxTask
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.DEPRECATED_API_USAGES
import org.jetbrains.intellij.tasks.RunPluginVerifierTask.FailureLevel.INVALID_PLUGIN

Expand All @@ -14,6 +16,7 @@ plugins {
alias(libs.plugins.intellij)
alias(libs.plugins.versions)
alias(libs.plugins.github.release)
alias(libs.plugins.shadow)
}

dependencies {
Expand Down Expand Up @@ -54,6 +57,20 @@ tasks.publishPlugin {
channels.set(listOf(project.version.toString().split('-').getOrElse(1) { "default" }.split('.').first()))
}

tasks {
withType<ShadowJar> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
withType<ShadowJar> {
tasks.withType<ShadowJar>.configure {

archiveBaseName = "detekt-intellij-plugin-shaded"
mergeServiceFiles()
relocate("org.jetbrains.kotlin", "detekt.shadow.org.jetbrains.kotlin")
}
}

tasks.withType<PrepareSandboxTask> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this line triggers the shadowJar task eagerly.

tasks.withType<PrepareSandboxTask>.configure {

pluginJar = project.tasks.withType<ShadowJar>().getByName("shadowJar").archiveFile
// disable to collect libraries located in runtime classpath (replace with empty file collection)
runtimeClasspathFiles = project.objects.fileCollection()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/JetBrains/gradle-intellij-plugin/blob/a10fd139467dd34c8e292296b563edfed14fea9d/src/main/kotlin/org/jetbrains/intellij/IntelliJPlugin.kt#L611
runtimeClasspathFiles uses to include depended libraries and plugins.
From this changes applied, we use shadow jar, which included libraries, so we can replace runtimeClasspathFiles empty.

}

intellij {
pluginName.set("Detekt IntelliJ Plugin")
version.set("2022.1.4")
Expand Down
1 change: 1 addition & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ kotlin-jvm = "org.jetbrains.kotlin.jvm:1.9.10"
versions = "com.github.ben-manes.versions:0.48.0"
intellij = "org.jetbrains.intellij:1.15.0"
github-release = "com.github.breadmoirai.github-release:2.4.1"
shadow = "com.github.johnrengelman.shadow:8.1.1"