-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild.gradle
More file actions
123 lines (96 loc) 路 2.89 KB
/
Copy pathbuild.gradle
File metadata and controls
123 lines (96 loc) 路 2.89 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
import org.apache.tools.ant.filters.ReplaceTokens
apply plugin: 'java-library'
apply plugin: 'java'
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://repo.essentialsx.net/releases/"
}
maven {
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven {
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url = "https://repo.papermc.io/repository/maven-public/"
}
}
configurations {
internalLibs
implementation.extendsFrom(internalLibs)
}
dependencies {
this.addModularCompile('net.essentialsx:EssentialsX:2.21.1', 'EssentialsX', false)
this.addModularCompile('org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT', 'spigot', false)
compileOnly fileTree(dir: 'libs', include: '*.jar') // Needed for Magma
}
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': '1.0'
}
boolean gitBuild = project.hasProperty('commit_branch') && project.hasProperty('commit_hash')
if(gitBuild) {
String commit_branch = getProperty('commit_branch').replace('/', '_')
String commit_hash = getProperty('commit_hash')
project.plugin_version = project.plugin_version + '-GIT-' + commit_branch + '-' + commit_hash
}
baseName rootProject.name + '-' + project.plugin_version
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from {
configurations.internalLibs.collect {
it.isDirectory() ? it : zipTree(it)
}
}
}
processResources {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from (sourceSets.main.resources.srcDirs) {
filter ReplaceTokens, tokens: [version: project.plugin_version]
}
}
test {
useJUnitPlatform()
testLogging {
exceptionFormat = 'full'
outputs.upToDateWhen { false }
showStandardStreams = true
}
}