forked from detekt/detekt
/
build.gradle.kts
69 lines (58 loc) · 1.77 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
plugins {
alias(libs.plugins.shadow)
id("module")
application
}
application {
mainClass.set("io.gitlab.arturbosch.detekt.cli.Main")
}
val pluginsJar: Configuration by configurations.creating {
isTransitive = false
}
dependencies {
implementation(libs.jcommander)
implementation(projects.detektTooling)
implementation(projects.detektParser)
implementation(libs.kotlin.compilerEmbeddable) {
version {
strictly(libs.versions.kotlin.get())
}
}
runtimeOnly(projects.detektCore)
runtimeOnly(projects.detektRules)
testImplementation(projects.detektTestUtils)
testImplementation(libs.assertj)
pluginsJar(projects.detektFormatting)
pluginsJar(projects.detektRulesLibraries)
pluginsJar(projects.detektRulesRuleauthors)
}
val javaComponent = components["java"] as AdhocComponentWithVariants
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
skip()
}
publishing {
publications.named<MavenPublication>(DETEKT_PUBLICATION) {
artifact(tasks.shadowJar)
}
}
tasks {
shadowJar {
mergeServiceFiles()
}
val runWithHelpFlag by registering(JavaExec::class) {
outputs.upToDateWhen { true }
classpath = files(shadowJar)
args = listOf("--help")
}
val runWithArgsFile by registering(JavaExec::class) {
// The task generating these jar files run first.
inputs.files(pluginsJar)
doNotTrackState("The entire root directory is read as the input source.")
classpath = files(shadowJar)
workingDir = rootDir
args = listOf("@./config/detekt/argsfile", "-p", pluginsJar.files.joinToString(",") { it.path })
}
check {
dependsOn(runWithHelpFlag, runWithArgsFile)
}
}