forked from DevSrSouza/KotlinBukkitAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
206 lines (177 loc) · 6.19 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
import org.gradle.api.tasks.bundling.Jar
plugins {
id("java")
id("maven-publish")
kotlin("jvm")
id("com.github.johnrengelman.shadow")
id("net.minecrell.plugin-yml.bukkit") version "0.3.0"
id("com.jfrog.bintray") version "1.8.4"
id("me.bristermitten.pdm")
}
val groupPrefix = "br.com.devsrsouza.kotlinbukkitapi"
val pVersion = KotlinBukkitAPI.version
group = groupPrefix
version = pVersion
val jcenter = loadProperties("jcenter.properties")
subprojects {
plugins.apply("org.jetbrains.kotlin.jvm")
plugins.apply("maven-publish")
plugins.apply("com.github.johnrengelman.shadow")
plugins.apply("com.jfrog.bintray")
plugins.apply("me.bristermitten.pdm")
group = groupPrefix
version = pVersion
repositories {
jcenter()
mavenLocal()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("http://nexus.devsrsouza.com.br/repository/maven-public/") {
this.isAllowInsecureProtocol = true
}
maven("https://repo.codemc.org/repository/maven-public")
}
dependencies {
compileOnly(kotlin("stdlib-jdk8"))
compileOnly(Dep.spigot)
}
kotlin {
sourceSets.all {
languageSettings.useExperimentalAnnotation("kotlin.contracts.ExperimentalContracts")
}
}
tasks {
test {
useJUnitPlatform()
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.time.ExperimentalTime,kotlin.ExperimentalStdlibApi,kotlinx.coroutines.ExperimentalCoroutinesApi"
}
shadowJar {
baseName = "KotlinBukkitAPI-${project.name}"
classifier = null
version = null
relocate("org.bstats", "br.com.devsrsouza.kotlinbukkitapi.bstats")
}
}
val sources by tasks.registering(Jar::class) {
baseName = "KotlinBukkitAPI-${project.name}"
classifier = "sources"
version = null
from(sourceSets.main.get().allSource)
}
afterEvaluate {
val maven = publishing.publications.findByName("maven") as MavenPublication
maven.apply {
pom {
withXml {
val pdmConfig = configurations.pdm.get()
asElement().applyConfigurationDependenciesToMavenPom(pdmConfig)
}
}
}
}
publishing {
publications {
create<MavenPublication>("maven") {
from(components["kotlin"])
artifact(sources.get())
groupId = project.group.toString()
artifactId = project.path.removePrefix(":")
.replace(":", "-").toLowerCase()
version = project.version.toString()
pom {
name.set("KotlinBukkitAPI-${project.name}")
description.set(KotlinBukkitAPI.github)
url.set(KotlinBukkitAPI.github)
licenses {
license {
name.set("MIT License")
url.set("https://github.com/DevSrSouza/KotlinBukkitAPI/blob/master/LICENSE")
distribution.set("repo")
}
}
developers {
developer {
id.set("DevSrSouza")
name.set("Gabriel Souza")
email.set("[email protected]")
}
}
scm {
url.set("https://github.com/DevSrSouza/KotlinBukkitAPI/tree/master/" +
project.path.removePrefix(":").replace(":", "/"))
}
}
}
}
}
tasks{
withType<GenerateModuleMetadata> {
// disable because the gradle will focus on it for the resolution
// and we add dynamicly into pom the PDM dependencies as compile and
// not at the Gradle Module Metadata, currently I don't know how I will support it
// I guess, I could use withVariantsFromConfiguration for the pdm configurations
// but apperently is not supported for Kotlin components :S
// HELP WANTED!
enabled = false
}
}
if(jcenter != null) {
bintray {
user = jcenter["bintray_user"] as String
key = jcenter["bintray_key"] as String
setPublications("maven")
with(pkg) {
repo = "KotlinBukkitAPI"
name = project.name
websiteUrl = KotlinBukkitAPI.github
vcsUrl = "${KotlinBukkitAPI.github}.git"
issueTrackerUrl = "${KotlinBukkitAPI.github}/issues"
setLicenses("MIT")
with(version) {
name = project.version.toString()
with(gpg) {
sign = (jcenter["gpg_sign"] as String).toBoolean()
passphrase = jcenter["gpg_passphrase"] as String
}
}
}
}
}
}
repositories {
jcenter()
maven("https://repo.codemc.org/repository/maven-public")
}
dependencies {
subprojects.forEach {
api(project(it.path))
}
}
tasks {
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
shadowJar {
dependsOn(pdm)
baseName = project.name
version += "-b${System.getenv("BUILD_NUMBER")}"
classifier = null
relocate("org.bstats", "br.com.devsrsouza.kotlinbukkitapi.bstats")
}
}
bukkit {
name = project.name
version = project.version.toString()
main = "br.com.devsrsouza.kotlinbukkitapi.KotlinBukkitAPI"
description = KotlinBukkitAPI.description
website = KotlinBukkitAPI.github
authors = listOf("DevSrSouza")
// softDepend = KotlinBukkitAPI.plugins.map { it.name }
load = BukkitPluginDescription.PluginLoadOrder.STARTUP
}