-
Notifications
You must be signed in to change notification settings - Fork 53
/
build.gradle.kts
66 lines (55 loc) · 1.91 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
plugins {
`copper-leaf-base`
`copper-leaf-version`
jacoco
id("com.github.ben-manes.versions") version "0.39.0"
`copper-leaf-sonatype`
}
// Add check to make sure every release version has a Changelog file
//----------------------------------------------------------------------------------------------------------------------
fun ProjectVersion.toFile(): File {
return project.file("$rootDir/docs/src/orchid/resources/changelog/$shortVersion/$releaseVersion.md")
}
val checkForChangelogFile by project.tasks.registering {
doLast {
if (project.hasProperty("release")) {
val version = Config.projectVersion(project)
val changelogFile = version.toFile()
if (!changelogFile.exists()) {
throw java.io.FileNotFoundException("There is no changelog entry for this version, expected '${changelogFile.absolutePath}' to exist.")
}
}
}
}
val createChangelogFile by project.tasks.registering {
doLast {
val version = Config.projectVersion(project)
val changelogFile = version.toFile()
project.mkdir(changelogFile.parentFile)
changelogFile.writeText(
"""
|---
|---
|
|- ${version.commits.joinToString(separator = "\n- ")}
|
|## Breaking Changes
|
|-
|
""".trimMargin()
)
}
}
val check by tasks
check.dependsOn(checkForChangelogFile)
val archiveDocumentation by tasks.registering(Zip::class) {
from("${project(":docs").buildDir}/docs/orchid")
// from(project.version.toFile())
include("**/*")
archiveFileName.set("docs-${project.version}.zip")
destinationDirectory.set(file("$buildDir/orchid/archives"))
}
val publish by tasks.registering {
dependsOn(archiveDocumentation)
}