This repository has been archived by the owner on Jun 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
build.gradle.kts
executable file
·153 lines (135 loc) · 4.43 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* 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 me.qoomon.gradle.gitversioning.GitVersioningPluginConfig
import me.qoomon.gradle.gitversioning.GitVersioningPluginConfig.CommitVersionDescription
import me.qoomon.gradle.gitversioning.GitVersioningPluginConfig.VersionDescription
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 Exflo. Detected version ${JavaVersion.current()}")
}
plugins {
`maven-publish`
distribution
id("org.jetbrains.kotlin.jvm") version "1.3.72"
id("org.jlleitschuh.gradle.ktlint") version "9.2.1" apply false
id("org.jlleitschuh.gradle.ktlint-idea") version "9.2.1" apply true
id("com.github.johnrengelman.shadow") version "5.2.0" apply true
id("io.spring.dependency-management") version "1.0.9.RELEASE"
id("com.github.ben-manes.versions") version "0.28.0"
id("me.qoomon.git-versioning") version "3.0.0"
id("dev.north.fortyone.intellij.run.generator") version "0.2.0"
}
version = "0.0.0-SNAPSHOT"
gitVersioning.apply(closureOf<GitVersioningPluginConfig> {
branch(closureOf<VersionDescription> {
pattern = "master"
versionFormat = "\${version}"
})
branch(closureOf<VersionDescription> {
pattern = "feature/(?<feature>.+)"
versionFormat = "\${feature}-SNAPSHOT"
})
tag(closureOf<VersionDescription> {
pattern = "v(?<tagVersion>[0-9].*)"
versionFormat = "\${tagVersion}"
})
commit(closureOf<CommitVersionDescription> {
versionFormat = "\${commit.short}"
})
})
val distZip: Zip by project.tasks
distZip.apply {
dependsOn(":plugin:build")
doFirst { delete { fileTree(Pair("build/distributions", "*.zip")) } }
}
val distTar: Tar by project.tasks
distTar.apply {
dependsOn("plugin:build")
doFirst { delete { fileTree(Pair("build/distributions", "*.tar.gz")) } }
compression = Compression.GZIP
archiveExtension.set("tar.gz")
}
allprojects {
apply(plugin = "io.spring.dependency-management")
apply(from = "$rootDir/gradle/versions.gradle")
apply(plugin = "org.jlleitschuh.gradle.ktlint")
group = "io.exflo"
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 {
withType<KotlinCompile>().all {
sourceCompatibility = "11"
targetCompatibility = "11"
kotlinOptions.jvmTarget = "11"
}
withType<JavaCompile> {
sourceCompatibility = "11"
targetCompatibility = "11"
}
}
ktlint {
debug.set(false)
verbose.set(true)
outputToConsole.set(true)
ignoreFailures.set(false)
reporters {
reporter(ReporterType.PLAIN)
}
filter {
exclude("**/generated/**")
exclude("**/flatbuffers/**")
}
}
}
intellijRunGenerator {
tasksDefinitions.set(File("./intellij-run-configs/"))
tasksDefinitionOutput.set(File(".idea/runConfigurations"))
}
distributions {
main {
contents {
from("LICENSE") { into("") }
from("README.md") { into("") }
from("CHANGELOG.md") { into("") }
from("ingestion/kafka/build/libs") { into("plugins") }
from("ingestion/postgres/build/libs") { into("plugins") }
}
}
}
tasks {
jar {
enabled = false
}
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)
}
}
}