generated from 41north/besu-plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
114 lines (98 loc) · 3.18 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
104
105
106
107
108
109
110
111
112
113
114
/*
* Copyright (c) 2020 41North.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.reporter.ReporterType
if (!JavaVersion.current().isJava11Compatible) {
throw GradleException("Java 11 or later is required to build this project. Detected version ${JavaVersion.current()}")
}
plugins {
`maven-publish`
distribution
id("org.jetbrains.kotlin.jvm") version "1.3.72"
id("com.github.johnrengelman.shadow") version "6.0.0"
id("org.jlleitschuh.gradle.ktlint") version "9.3.0"
id("org.jlleitschuh.gradle.ktlint-idea") version "9.3.0"
id("com.github.ben-manes.versions") version "0.29.0"
id("dev.north.fortyone.intellij.run.generator") version "0.2.0"
}
group = "dev.north.fortyone.besu"
allprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
repositories {
jcenter()
maven(url = "https://packages.confluent.io/maven/")
maven(url = "https://dl.bintray.com/hyperledger-org/besu-repo/")
maven(url = "https://dl.bintray.com/consensys/pegasys-repo/")
maven(url = "https://repo.spring.io/libs-release")
}
tasks {
val javaVersion = "11"
withType<KotlinCompile>().all {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
kotlinOptions.jvmTarget = javaVersion
}
withType<JavaCompile> {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
}
ktlint {
debug.set(false)
verbose.set(true)
outputToConsole.set(true)
ignoreFailures.set(false)
reporters {
reporter(ReporterType.PLAIN)
}
filter {
exclude("**/generated/**")
}
}
}
distributions {
main {
contents {
from("LICENSE") { into("") }
from("README.md") { into("") }
from("plugin/build/libs") { into("plugins") }
}
}
}
tasks {
jar { enabled = false }
val distZip: Zip by container
distZip.apply {
doFirst { delete { fileTree(Pair("build/distributions", "*.zip")) } }
}
val distTar: Tar by container
distTar.apply {
doFirst { delete { fileTree(Pair("build/distributions", "*.tar.gz")) } }
compression = Compression.GZIP
archiveExtension.set("tar.gz")
}
withType<DependencyUpdatesTask> {
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
// Reject all non stable versions
rejectVersionIf { isNonStable(candidate.version) }
}
}