-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
133 lines (120 loc) · 3.44 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
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
plugins {
id 'java'
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'maven-publish'
id 'java-library'
}
ext {
bigVersion = '1.0.0'
releaseType = 'dev'
// Development (dev); Release (release); Snapshots / Pre-Release (snapshots)
}
group = 'flyproject'
version = version()
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
maven {
name = 'fastmcmirror'
url = 'https://repo.fastmcmirror.org/content/repositories/releases/'
}
}
dependencies {
implementation 'com.google.code.gson:gson:2.10.1'
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
implementation 'com.xbaimiao:mirai-http-sdk:1.0.4-beta-9ff255a'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
}
def targetJavaVersion = 17
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
options.release = 8
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
shadowJar {
archiveClassifier = ""
relocate("com.google.gson", "dev.rgbmc.ultraqbot.libs.gson")
relocate("kotlin", "dev.rgbmc.ultraqbot.libs.kotlin")
relocate("kotlinx", "dev.rgbmc.ultraqbot.libs.kotlinx")
relocate("com.xbaimiao.mirai", "dev.rgbmc.ultraqbot.libs.mirai")
relocate("org.java_websocket", "dev.rgbmc.ultraqbot.libs.websocket")
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = "sources"
from sourceSets.main.allSource
}
publishing {
publications {
maven(MavenPublication) {
groupId "dev.rgbmc"
artifactId "UltraQBot"
version = this.version
artifact shadowJar
artifact sourcesJar
}
}
repositories {
maven {
url = "https://repo.fastmcmirror.org/content/repositories/releases/"
credentials {
username System.getenv("USERNAME")
password System.getenv("PASSWORD")
}
}
}
}
def String id() {
Process process = Runtime.getRuntime().exec("git rev-parse --short HEAD")
BufferedReader reader = new BufferedReader(new InputStreamReader(process.inputStream))
String cid = reader.readLine()
if (cid==null) {
println("Make sure you are using a repository fetched via Git before trying to build")
System.exit(0)
}
println("Commit ID: " + cid)
return cid;
}
def String version() {
StringBuilder builder = new StringBuilder()
builder.append(bigVersion)
if (!releaseType.equalsIgnoreCase("release")) {
builder.append("-")
builder.append(releaseType)
builder.append("-")
builder.append(id())
}
println("Current Version: " + builder.toString())
return builder.toString()
}