forked from kuberig-io/kuberig
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
118 lines (95 loc) · 3.12 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
import com.jfrog.bintray.gradle.BintrayExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm") apply(false)
id("com.jfrog.bintray") apply(false)
}
val projectVersion = if (project.version.toString() == "unspecified") {
println("Defaulting to version 0.0.0")
"0.0.0"
} else {
project.version.toString()
}
project.version = projectVersion
subprojects {
apply {
plugin("maven-publish")
plugin("java")
plugin("idea")
plugin("org.jetbrains.kotlin.jvm")
plugin("com.jfrog.bintray")
plugin("jacoco")
}
val subProject = this
subProject.group = "io.kuberig"
subProject.version = projectVersion
repositories {
jcenter()
}
dependencies {
val implementation by configurations
val testImplementation by configurations
val testRuntimeOnly by configurations
implementation(kotlin("stdlib-jdk8"))
testImplementation("org.junit.jupiter:junit-jupiter-api:5.5.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.1")
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.named<Test>("test") {
finalizedBy(tasks.getByName("jacocoTestReport")) // report is always generated after tests run
}
tasks.named<JacocoReport>("jacocoTestReport") {
dependsOn(tasks.getByName("test")) // tests are required to run before generating the report
reports {
xml.isEnabled = true
csv.isEnabled = false
}
}
tasks.getByName("check").dependsOn(tasks.getByName("jacocoTestReport"))
tasks.named<Test>("test") {
useJUnitPlatform()
}
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
val sourceSets: SourceSetContainer by subProject
from(sourceSets["main"].allSource)
}
configure<PublishingExtension> {
publications {
register(subProject.name, MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
}
}
}
val bintrayApiKey : String by project
val bintrayUser : String by project
configure<BintrayExtension> {
user = bintrayUser
key = bintrayApiKey
publish = true
pkg(closureOf<BintrayExtension.PackageConfig> {
repo = "rigeldev-oss-maven"
name = "io-kuberig-" + subProject.name
setLicenses("Apache-2.0")
isPublicDownloadNumbers = true
websiteUrl = project.properties["websiteUrl"]!! as String
vcsUrl = project.properties["vcsUrl"]!! as String
})
setPublications(subProject.name)
}
tasks.withType<Jar> {
manifest {
attributes(
"Implementation-Title" to project.name,
"Implementation-Version" to project.version
)
}
}
}