-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle.kts
145 lines (120 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
/*
* Copyright 2018 - 2019 Duncan "duncte123" Sterken
*
* 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.
*/
plugins {
idea
`java-library`
`maven-publish`
}
group = "me.duncte123"
version = "${getVersionPrefix()}3.1.${getBuildNum()}"
val archivesBaseName = "botCommons"
repositories {
mavenCentral()
maven("https://m2.dv8tion.net/releases")
maven("https://m2.duncte123.dev/releases")
maven("https://duncte123.jfrog.io/artifactory/maven")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
val jdaVersion = "5.0.0-beta.21"
dependencies {
api(group = "com.fasterxml.jackson.core", name = "jackson-databind", version = "2.16.1")
api(group = "org.jsoup", name = "jsoup", version = "1.15.3")
api(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.3")
api(group = "me.duncte123", name = "reliqua", version = "2.6.5") {
exclude(group = "com.squareup.okhttp3", module = "okhttp")
}
compileOnly("com.google.code.findbugs:jsr305:3.0.2")
compileOnly(group = "org.json", name = "json", version = "20220924") // Provided by the user
compileOnly(group = "net.dv8tion", name = "JDA", version = jdaVersion) {
exclude(module = "opus-java")
}
testImplementation (group = "net.dv8tion", name = "JDA", version = jdaVersion) {
exclude(module = "opus-java")
}
testImplementation(group = "junit", name = "junit", version = "4.12")
testImplementation("com.squareup.okhttp3:mockwebserver:4.9.3")
}
fun getBuildNum(): String {
return System.getenv("GITHUB_RUN_NUMBER") ?: "dev"
}
fun getVersionPrefix(): String {
return System.getenv("VERSION_PREFIX") ?: ""
}
fun getDeployPath(): String {
return System.getenv("DEPLOY_PATH") ?: "releases"
}
val compileJava: JavaCompile by tasks
val javadoc: Javadoc by tasks
val jar: Jar by tasks
val build: Task by tasks
val publish: Task by tasks
val clean: Task by tasks
val test: Task by tasks
val check: Task by tasks
javadoc.apply {
isFailOnError = false
}
val sourcesJar = task<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets["main"].allJava)
}
val javadocJar = task<Jar>("javadocJar") {
dependsOn(javadoc)
archiveClassifier.set("javadoc")
}
publishing {
repositories {
maven {
name = "duncte123-m2"
url = uri("https://m2.duncte123.dev/${getDeployPath()}")
credentials {
username = System.getenv("USERNAME")
password = System.getenv("PASSWORD")
}
}
}
publications {
create<MavenPublication>("duncte123-m2") {
from(components["java"])
artifactId = archivesBaseName
groupId = project.group as String
version = project.version as String
artifact(javadocJar)
artifact(sourcesJar)
}
}
}
build.apply {
dependsOn(jar)
dependsOn(javadocJar)
dependsOn(sourcesJar)
jar.mustRunAfter(clean)
javadocJar.mustRunAfter(jar)
sourcesJar.mustRunAfter(javadocJar)
}
publish.apply {
dependsOn(build)
onlyIf {
System.getenv("JFROG_USERNAME") != null && System.getenv("JFROG_TOKEN") != null
}
}
tasks.withType<Wrapper> {
gradleVersion = "8.2.1"
distributionType = Wrapper.DistributionType.BIN
}