-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.gradle.kts
55 lines (45 loc) · 1.42 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
import com.javiersc.gradle.properties.extensions.getStringProperty
plugins { //
alias(hubdle.plugins.javiersc.hubdle)
}
val isGradlePlugin = getStringProperty("semver.tagPrefix").orNull == "p"
hubdle {
config {
analysis()
binaryCompatibilityValidator()
coverage()
documentation {
api()
changelog()
readme { //
badges()
}
site()
}
nexus()
}
}
tasks.named("patchChangelog").configure { //
onlyIf { isGradlePlugin }
}
tasks.named("addChangelogItem").configure { //
onlyIf { isGradlePlugin }
}
tasks.register("buildItself") {
val publishToMavenLocalTasks: List<Task> =
allprojects.mapNotNull { it.tasks.findByName("publishToMavenLocal") }
for (task: Task in publishToMavenLocalTasks) {
dependsOn(task)
}
doFirst {
val libsTomlFile: File = rootDir.resolve("gradle/libs.versions.toml")
val libsContent: String =
libsTomlFile.readLines().joinToString("\n") { line ->
if (line.startsWith("""hubdle = """")) """hubdle = "$version"""" else line
}
libsTomlFile.writeText(libsContent)
val settingsFile: File = rootDir.resolve("settings.gradle.kts")
val settingsContent: String = settingsFile.readText()
settingsFile.writeText(settingsContent.replace("// mavenLocal()", "mavenLocal()"))
}
}