forked from ElisaTronetti/collektive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
97 lines (87 loc) · 3.19 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektPlugin
import org.danilopianini.gradle.mavencentral.DocStyle
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.publishOnCentral)
alias(libs.plugins.detekt)
alias(libs.plugins.gitSemVer)
}
val Provider<PluginDependency>.id: String get() = get().pluginId
allprojects {
group = "it.unibo.${rootProject.name}"
repositories {
mavenCentral()
}
with(rootProject.libs.plugins) {
apply(plugin = publishOnCentral.id)
apply(plugin = detekt.id)
apply(plugin = gitSemVer.id)
}
signing {
if (System.getenv("CI") == "true") {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
}
}
publishOnCentral {
projectUrl.set("https://github.com/Collektive/${rootProject.name}")
projectLongName.set("collektive")
projectDescription.set("DSL for Aggregate Computing in Kotlin")
licenseName.set("MIT License")
licenseUrl.set("https://opensource.org/license/mit/")
docStyle.set(DocStyle.HTML)
publishing {
publications {
withType<MavenPublication>().configureEach {
if ("OSSRH" !in name) { artifact(tasks.javadocJar) }
scmConnection.set("git:[email protected]:Collektive/${rootProject.name}")
projectUrl.set("https://github.com/Collektive/${rootProject.name}")
pom {
developers {
developer {
name.set("Elisa Tronetti")
email.set("[email protected]")
url.set("https://github.com/ElisaTronetti")
}
}
}
}
}
}
}
plugins.withType<DetektPlugin> {
val check by tasks.getting
val detektAll by tasks.creating { group = "verification" }
tasks.withType<Detekt>()
.matching { task ->
task.name.let { it.endsWith("Main") || it.endsWith("Test") } && !task.name.contains("Baseline")
}
.all {
check.dependsOn(this)
detektAll.dependsOn(this)
}
}
// Enforce the use of the Kotlin version in all subprojects
configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion(rootProject.libs.versions.kotlin.get())
}
if (requested.group == "org.jetbrains.kotlinx" && requested.name == "kotlinx-coroutines-core") {
useVersion(rootProject.libs.versions.coroutines.get())
}
}
}
}
tasks {
// Prevent publishing the root project (since is empty)
withType<AbstractPublishToMaven>().configureEach {
enabled = false
}
withType<GenerateModuleMetadata>().configureEach {
enabled = false
}
}