-
Notifications
You must be signed in to change notification settings - Fork 119
/
build.gradle.kts
100 lines (86 loc) · 3.39 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
// import org.jmailen.gradle.kotlinter.tasks.LintTask
import java.nio.file.Paths
// Fix Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.hash.Hashing.crc32c()Lcom/google/common/hash/HashFunction;
// https://stackoverflow.com/a/45286710
configurations.all {
resolutionStrategy {
force("com.google.guava:guava:25.1-jre")
force(Dependencies.KOTLIN_REFLECT)
exclude(group = "com.google.guava", module = "guava-jdk5")
}
}
plugins {
kotlin(Plugins.Kotlin.PLUGIN_JVM) version Versions.KOTLIN
// id(Plugins.KTLINT_GRADLE_PLUGIN) version Versions.KTLINT_GRADLE
id(Plugins.BEN_MANES_PLUGIN) version Versions.BEN_MANES
id(Plugins.NEXUS_STAGING) version Versions.NEXUS_STAGING
}
nexusStaging {
username = System.getenv("MVN_CENTRAL_USER") ?: properties["MVN_CENTRAL_USER"].toString()
password = System.getenv("MVN_CENTRAL_PASSWORD") ?: properties["MVN_CENTRAL_PASSWORD"].toString()
packageGroup = "com.github.flank"
}
// tasks {
// "lintKotlinMain"(LintTask::class) {
// exclude(
// "**/*Generated.kt" // we can expand this list
// )
// }
// }
subprojects {
// apply(plugin = Plugins.KTLINT_GRADLE_PLUGIN)
afterEvaluate {
if (tasks.findByName("test") != null) {
tasks.test {
systemProperty("runningTests", true)
}
}
}
}
repositories {
mavenCentral()
}
tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure {
gradleReleaseChannel = "release-candidate"
fun isStable(version: String) = listOf("RELEASE", "FINAL", "GA")
.any { version.toUpperCase().contains(it) } || "^[0-9,.v-]+(-r)?$".toRegex().matches(version)
fun isNonStable(version: String) = isStable(version).not()
resolutionStrategy {
componentSelection {
all {
if (candidate.group == "com.google.apis" &&
candidate.module == "google-api-services-toolresults" &&
!candidate.version.startsWith("v1beta3-")
) {
reject("com.google.apis:google-api-services-toolresults should use beta only")
}
if (isNonStable(candidate.version) && isStable(currentVersion)) {
reject("Release candidate")
}
}
}
}
}
val resolveArtifacts by tasks.registering {
dependsOn(":flank-scripts:prepareJar")
group = "verification"
doLast {
val flankScriptsRunnerName = if (DefaultNativePlatform.getCurrentOperatingSystem().isWindows)
"flankScripts.bat" else "flankScripts"
val flankScriptsPath = Paths.get("flank-scripts", "bash", flankScriptsRunnerName).toString()
val rootFlankScriptsPath = rootDir.resolve(flankScriptsPath).absolutePath
try {
exec {
val cmd = listOf(rootFlankScriptsPath, "testArtifacts", "-p", rootDir.absolutePath, "resolve")
println(cmd.joinToString(" "))
commandLine(cmd)
workingDir = rootDir
}
} catch (e: Exception) {
// avoid breaking all gradle builds if github has rate limited us by not throwing the exception
e.printStackTrace()
}
}
}