-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
102 lines (83 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
/*
* Adapted from The MIT License (MIT)
*
* Copyright (c) 2016-2022 DaPorkchop_
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
* is furnished to do so, subject to the following conditions:
*
* Any persons and/or organizations using this software must include the above copyright notice and this permission notice,
* provide sufficient credit to the original authors of the project (IE: DaPorkchop_), as well as provide a link to the original project.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
buildscript {
repositories {
maven {
name = "Gradle"
url = "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.johnrengelman:shadow:7.1.0"
}
}
ext {
//this can't be set in gradle.properties since it's dynamic
programVersion = "$programVersionMajor." + ('git rev-list --count HEAD'.execute().text.trim())
}
apply plugin: "java"
apply plugin: "com.github.johnrengelman.shadow"
group "net.daporkchop"
version "$programVersion-$minecraftVersion"
compileJava {
sourceCompatibility = targetCompatibility = "$javaVersion"
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
}
repositories {
maven {
name = "DaPorkchop_"
url = "https://maven.daporkchop.net/"
}
mavenCentral()
}
configurations {
shade
implementation.extendsFrom shade
}
dependencies {
shade "net.daporkchop.lib:gui:$porklibVersion"
shade "net.daporkchop.lib:binary:$porklibVersion"
shade "net.daporkchop.lib:logging:$porklibVersion"
shade "net.daporkchop.lib:minecraft-text:$porklibVersion"
shade "com.github.steveice10:mcprotocollib:$mcprotocollibVersion"
shade "org.java-websocket:Java-WebSocket:$javawebsocketVersion"
testImplementation "junit:junit:$junitVersion"
compileOnly "org.projectlombok:lombok:$lombokVersion"
testCompileOnly "org.projectlombok:lombok:$lombokVersion"
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
testAnnotationProcessor "org.projectlombok:lombok:$lombokVersion"
}
//disable regular unshaded jar
jar.enabled = false
shadowJar {
String branchName = System.getenv("BRANCH_NAME")
branchName = branchName != null && !branchName.isEmpty() && !"master".equals(branchName) ? '-' + branchName.replaceAll("[^a-zA-Z0-9.-]", "_") : "";
archiveName "${project.name}-${project.version}${branchName}.jar"
configurations = [project.configurations.shade]
exclude 'module-info.class'
manifest {
attributes "Implementation-Title": "DaPorkchop_",
"Implementation-Version": project.version,
"Main-Class": "net.daporkchop.toobeetooteebot.Bot"
}
}
build.dependsOn(shadowJar)