-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
149 lines (128 loc) · 3.84 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.3.60"
kotlin("plugin.serialization") version "1.3.60"
id("org.jetbrains.dokka") version "0.10.0"
id("com.jfrog.bintray") version "1.8.4"
`maven-publish`
`build-scan`
}
buildScan {
termsOfServiceUrl = "https://gradle.com/terms-of-service"
termsOfServiceAgree = "yes"
publishAlways()
}
group = "org.mechdancer"
version = "0.1.0-dev-1"
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx", "kotlinx-serialization-runtime", "0.14.0")
val vertVersion = "3.8.4"
implementation("io.vertx:vertx-web:$vertVersion")
implementation("io.vertx:vertx-web-client:$vertVersion")
implementation("io.vertx:vertx-lang-kotlin-coroutines:$vertVersion")
testImplementation("junit", "junit", "+")
testImplementation(kotlin("test-junit"))
}
tasks.dokka {
outputFormat = "javadoc"
outputDirectory = "$buildDir/javadoc"
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xuse-experimental=kotlin.Experimental")
}
}
val doc = tasks.register<Jar>("javadocJar") {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka"
archiveClassifier.set("javadoc")
from(tasks.dokka)
}
val sources = tasks.register<Jar>("sourcesJar") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "Creates sources jar"
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val fat = tasks.register<Jar>("fatJar") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "Packs binary output with dependencies"
archiveClassifier.set("all")
from(sourceSets.main.get().output)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
tasks.register("allJars") {
group = JavaBasePlugin.BUILD_TASK_NAME
description = "Assembles all jars in one task"
dependsOn(doc, sources, fat, tasks.jar)
}
val rename = tasks.register("renamePomFile") {
dependsOn(tasks.publishToMavenLocal)
doLast {
val path = "${buildDir.absolutePath}/publications/maven/"
val old = File(path + "pom-default.xml")
val f = File("$path${project.name}-$version.pom")
old.renameTo(f)
}
}
tasks.bintrayUpload.configure {
dependsOn(rename)
}
bintray {
user = "berberman"
key = System.getenv("BintrayToken")
setConfigurations("archives")
val v = version.toString()
val url = "https://github.com/MechDancer/dingtalk-bot"
publish = true
pkg.apply {
name = project.name
desc = "a kotlin api of dingtalk bot."
repo = "maven"
userOrg = "mechdancer"
githubRepo = "MechDancer/dingtalk"
vcsUrl = "$url.git"
issueTrackerUrl = "$url/issues"
publicDownloadNumbers = true
setLicenses("WTFPL")
version.apply {
name = v
vcsTag = v
websiteUrl = "$url/releases/tag/$v"
}
}
}
publishing {
repositories {
maven("$buildDir/repo")
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/MechDancer/dingtalk-bot")
credentials {
username = "MechDancerProject"
password = System.getenv("GitHubToken")
}
}
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
}
artifacts {
add("archives", tasks.jar)
add("archives", fat)
add("archives", sources)
add("archives", doc)
add("archives", File("${buildDir.absolutePath}/publications/maven/${project.name}-$version.pom"))
}