-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle.kts
90 lines (74 loc) · 2.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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import java.util.*
plugins {
id("com.github.ben-manes.versions") version "0.51.0"
id("se.patrikerdes.use-latest-versions") version "0.2.18"
id("com.diffplug.spotless") version "6.25.0"
}
repositories {
mavenCentral()
google()
}
// TODO: move to `raung.java-common` base configuration
allprojects {
apply(plugin = "java")
apply(plugin = "checkstyle")
apply(plugin = "com.github.ben-manes.versions")
apply(plugin = "se.patrikerdes.use-latest-versions")
apply(plugin = "com.diffplug.spotless")
spotless {
java {
importOrderFile("${rootDir}/config/code-formatter/eclipse.importorder")
eclipse().configFile("${rootDir}/config/code-formatter/eclipse.xml")
removeUnusedImports()
encoding("UTF-8")
trimTrailingWhitespace()
endWithNewline()
}
format("misc") {
target("**/*.gradle.kts", "**/*.md", "**/.gitignore")
targetExclude(".gradle/**", ".idea/**", "*/build/**")
indentWithTabs()
trimTrailingWhitespace()
endWithNewline()
}
}
}
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase(Locale.getDefault()).contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
var libProjects = listOf(":raung-common", ":raung-asm", ":raung-disasm")
tasks.register("publishLocal") {
group = "raung"
description = "Publish library packages into Maven local repo"
libProjects.forEach {
dependsOn(tasks.getByPath("$it:publishToMavenLocal"))
}
}
tasks.register("publish") {
group = "raung"
description = "Publish library packages into Maven Central repo"
libProjects.forEach {
dependsOn(tasks.getByPath("$it:publish"))
}
}
tasks.register("dist", Copy::class) {
group = "raung"
description = "Build raung-cli distribution package"
from(tasks.getByPath(":raung-cli:distZip"))
into(layout.buildDirectory.dir("dist"))
}
tasks.register("cleanBuild", Delete::class) {
group = "raung"
description = "Remove all build directories"
delete(layout.buildDirectory)
}
tasks.getByName("clean").dependsOn("cleanBuild")