-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
103 lines (93 loc) · 3.23 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
98
99
100
101
102
103
plugins {
alias(libs.plugins.com.github.sghill.distribution.sha)
id("com.zegreatrob.testmints.plugins.versioning")
alias(libs.plugins.nl.littlerobots.version.catalog.update)
alias(libs.plugins.com.zegreatrob.tools.tagger)
alias(libs.plugins.com.zegreatrob.tools.digger)
base
}
group = "com.zegreatrob.testmints"
tagger {
releaseBranch = "master"
githubReleaseEnabled.set(true)
}
tasks {
val librariesBuild = gradle.includedBuild("libraries")
val publishableBuilds = listOf(
librariesBuild,
gradle.includedBuild("plugins"),
)
val pluginsTestBuild = gradle.includedBuild("plugins-test")
val includedBuilds = publishableBuilds + listOf(
gradle.includedBuild("convention-plugins"),
pluginsTestBuild
)
val publish by creating {
mustRunAfter(check)
dependsOn(provider { publishableBuilds.map { it.task(":publish") } })
}
"versionCatalogUpdate" {
dependsOn(provider { includedBuilds.map { it.task(":versionCatalogUpdate") } })
}
create("kotlinUpgradeYarnLock") {
dependsOn(provider {
librariesBuild.task(":kotlinUpgradeYarnLock")
pluginsTestBuild.task(":kotlinUpgradeYarnLock")
})
}
create<Copy>("collectResults") {
dependsOn(provider { (getTasksByName("collectResults", true) - this).toList() })
dependsOn(provider { includedBuilds.map { it.task(":collectResults") } })
from(includedBuilds.map { it.projectDir.resolve("build/test-output") })
into(rootProject.layout.buildDirectory.dir("test-output/${project.path}".replace(":", "/")))
}
create("formatKotlin") {
dependsOn(provider { (getTasksByName("formatKotlin", true) - this).toList() })
dependsOn(provider { includedBuilds.map { it.task(":formatKotlin") } })
}
create("lintKotlin") {
dependsOn(provider { (getTasksByName("lintKotlin", true) - this).toList() })
dependsOn(provider { includedBuilds.map { it.task(":lintKotlin") } })
}
check {
dependsOn(provider { (getTasksByName("check", true) - this).toList() })
dependsOn(provider { includedBuilds.map { it.task(":check") } })
}
clean {
dependsOn(provider { includedBuilds.map { it.task(":clean") } })
}
release {
mustRunAfter(check)
finalizedBy(publish, currentContributionData)
}
currentContributionData {
mustRunAfter(tag)
}
if (isMacRelease()) {
tag {
enabled = false
}
githubRelease {
enabled = false
}
release {
enabled = false
}
}
}
fun Project.isSnapshot() = version.toString().contains("SNAPSHOT")
fun Project.isMacRelease() = findProperty("release-target") == "mac"
fun TaskCollection<AbstractPublishToMaven>.disableTaskForPublication(
targetPub: MavenPublication
) {
matching { it.publication == targetPub }
.configureEach { this.onlyIf { false } }
}
val macTargets = listOf(
"macosX64",
"iosX64",
"iosArm32",
"iosArm64"
)
fun PublicationContainer.nonMacPublications() = matching { !macTargets.contains(it.name) }
fun PublicationContainer.jvmPublication(): NamedDomainObjectSet<Publication> = matching { it.name == "jvm" }