-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
106 lines (94 loc) · 3.54 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
import com.jfrog.bintray.gradle.BintrayExtension
import groovy.util.Node
import groovy.util.NodeList
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.api.tasks.bundling.Jar
import java.time.OffsetDateTime
import java.time.ZoneOffset
fun version(): String {
val buildNumber = System.getProperty("BUILD_NUM")
val version = "0.1" + if (buildNumber.isNullOrEmpty()) "-SNAPSHOT" else ".$buildNumber"
println("building version $version")
return version
}
val projectVersion = version()
val projectDescription = """KloudFormation Specification Generator"""
val kotlinVersion = "1.3.11"
val jacksonVersion = "2.9.8"
val kotlinpoetVersion = "1.0.1"
val jsoupVersion = "1.11.3"
val junitVersion = "5.0.0"
val artifactId = "kloudformation-specification-generator"
group = "io.kloudformation"
version = projectVersion
description = projectDescription
plugins {
id("org.jetbrains.kotlin.jvm") version "1.3.11"
id("org.jlleitschuh.gradle.ktlint") version "6.3.1"
id("com.jfrog.bintray") version "1.8.4"
`maven-publish`
}
repositories {
jcenter()
mavenCentral()
}
dependencies {
implementation(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = jacksonVersion)
implementation(group = "com.fasterxml.jackson.module", name = "jackson-module-kotlin", version = jacksonVersion)
implementation(group = "com.squareup", name = "kotlinpoet", version = kotlinpoetVersion)
implementation(group = "org.jsoup", name = "jsoup", version = jsoupVersion)
testImplementation(group = "org.jetbrains.kotlin", name = "kotlin-test-junit5", version = kotlinVersion)
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = junitVersion)
testImplementation(group = "com.fasterxml.jackson.dataformat", name = "jackson-dataformat-yaml", version = jacksonVersion)
testRuntime(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = junitVersion)
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
val sourcesJar by tasks.registering(Jar::class) {
classifier = "sources"
from(sourceSets["main"].allSource)
}
bintray {
user = "hexlabs-builder"
key = System.getProperty("BINTRAY_KEY") ?: "UNKNOWN"
setPublications("mavenJava")
publish = true
pkg(
closureOf<BintrayExtension.PackageConfig> {
repo = "kloudformation"
name = artifactId
userOrg = "hexlabsio"
setLicenses("Apache-2.0")
vcsUrl = "https://github.com/hexlabsio/kloudformation-specification-generator.git"
version(closureOf<BintrayExtension.VersionConfig> {
name = projectVersion
desc = projectVersion
})
})
}
publishing {
publications {
register("mavenJava", MavenPublication::class) {
from(components["java"])
artifactId = artifactId
artifact(sourcesJar.get())
pom.withXml {
val dependencies = (asNode()["dependencies"] as NodeList)
configurations.compile.allDependencies.forEach {
dependencies.add(Node(null, "dependency").apply {
appendNode("groupId", it.group)
appendNode("artifactId", it.name)
appendNode("version", it.version)
})
}
}
}
}
}