This repository has been archived by the owner on Dec 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
84 lines (77 loc) · 2.72 KB
/
build.gradle
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
plugins {
id 'java'
id 'maven-publish'
id("com.github.monosoul.yadegrap") version "1.0.0"
}
group 'me.bluetree242.jdaeventer'
var isCI = project.properties["BUILD_NUMBER"] != null // jenkins
|| System.getenv("BUILD_NUMBER") != null
|| project.properties["GIT_COMMIT"] != null // jitpack
|| System.getenv("GIT_COMMIT") != null
var branch = System.getenv("GIT_BRANCH") ?: project.project.properties["GIT_BRANCH"]
if (branch == null) branch = "unknown"
var major = 1
var minor = 0
var revision = 0
var verClassifier = 'alpha'
var versionNoCommit = "${major}.${minor}.${revision}_${verClassifier}"
var commit = System.getenv("GIT_COMMIT") ?: project.project.properties["GIT_COMMIT"]
if (isCI && commit != null)
commit = commit.substring(0, 7)
else commit = 'LOCAL'
System.out.println("Commit: " + commit)
System.out.println("Branch: " + branch)
version = "${versionNoCommit}${branch != 'origin/master' ? "-${commit}-SNAPSHOT" : ''}"
repositories {
mavenCentral()
}
dependencies {
implementation("net.dv8tion:JDA:5.0.0-beta.9")
//lombok
compileOnly 'org.projectlombok:lombok:1.18.24'
annotationProcessor 'org.projectlombok:lombok:1.18.24'
testCompileOnly 'org.projectlombok:lombok:1.18.24'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.24'
}
task packageJavadoc(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
classifier = 'javadoc'
}
task packageSources(type: Jar, dependsOn: 'classes') {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives packageJavadoc
archives packageSources
}
javadoc {
dependsOn delombok
options.links 'https://ci.dv8tion.net/job/JDA/javadoc/', 'https://docs.oracle.com/javase/8/docs/api/'
source = delombok
if (JavaVersion.current() in JavaVersion.VERSION_11..JavaVersion.VERSION_12)
options.addBooleanOption('-no-module-directories', true)
}
publishing {
publications {
"$project.name"(MavenPublication) {
groupId rootProject.group
artifactId project.name
version project.version.replace("-${commit}", "")
from components.java
artifact(packageSources)
artifact(packageJavadoc)
repositories {
maven {
credentials {
username = System.getenv('REPO_USERNAME')
password = System.getenv('REPO_PASSWORD')
}
url = "https://repo.bluetree242.ml/maven-${branch != null && branch == 'origin/master' ? "releases" : "snapshots"}/"
}
}
}
}
}
java.sourceCompatibility = JavaVersion.VERSION_1_8
java.targetCompatibility = JavaVersion.VERSION_1_8