This repository was archived by the owner on Nov 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
133 lines (107 loc) · 3.04 KB
/
build.gradle
File metadata and controls
133 lines (107 loc) · 3.04 KB
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
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'java-library'
apply plugin: 'java'
version = "1.0.0"
libsDirName = System.getenv("libsDirName") == null ? libsDirName : System.getenv("libsDirName")
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
compileJava.options.encoding = 'UTF-8'
sourceSets {
main {
java {
srcDirs 'src'
}
resources {
srcDirs 'resources'
}
}
test {
java {
srcDirs 'test'
}
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
maven {
url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url 'https://m2.dv8tion.net/releases'
}
maven {
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
maven {
url 'https://jitpack.io'
}
}
configurations {
internalLibs
implementation.extendsFrom(internalLibs)
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.2")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.2")
this.addModularCompile('org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT', 'spigot', false)
this.addModularCompile('com.googlecode.json-simple:json-simple:1.1.1', 'gson', false)
this.addModularCompile("me.clip:placeholderapi:2.10.10", "placeholderapi", false)
this.addModularCompile("net.luckperms:api:5.3", "luckperms", false)
this.addModularCompile('com.github.CuukyOfficial:CFW:master-SNAPSHOT', 'CFW', true)
compileOnly fileTree(dir: 'libs', include: '*.jar') // Local libs
// Enable if you need some internal libs that should be compiled into the jar
// this.addModularInternal('com.github.CuukyOfficial:CFW:master-SNAPSHOT', 'CFW', true)
}
boolean checkLib(String filePath) {
return file('libs/' + filePath + '.jar').exists()
}
void addModularCompile(String repoName, String fileName, boolean changingB) {
if (this.checkLib(fileName))
this.dependencies.implementation name: fileName
else
this.dependencies.implementation (repoName) { changing = changingB }
}
void addModularInternal(String repoName, String fileName, boolean changingB) {
if (this.checkLib(fileName))
this.dependencies.internalLibs name: fileName
else
this.dependencies.internalLibs (repoName) { changing = changingB }
}
jar {
manifest {
attributes(
'Manifest-Version': version,
'Class-Path': '.',
'Main-Class': 'net.kettlemc.plugin.MainLauncher',
)
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.internalLibs.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from (sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [name: project.name]
filter ReplaceTokens, tokens: [version: version]
filter ReplaceTokens, tokens: [author: "KettleMC"]
filter ReplaceTokens, tokens: [main: "net.kettlemc.plugin.Main"]
}
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
outputs.upToDateWhen { false }
showStandardStreams = true
}
}