-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
83 lines (69 loc) · 1.81 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
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '6.1.0'
id 'maven-publish'
}
group 'EntityDataContainer'
version '1.0.0'
repositories {
mavenCentral()
}
dependencies {
implementation("org.javassist:javassist:3.29.1-GA")
}
jar {
from {
for (File file : new File("archive").listFiles()) {
zipTree(file)
}
}
manifest {
attributes(
"Premain-Class": "com.bgsoftware.entitydatacontainer.EntityDataContainerMain",
"Can-Redefine-Classes": false,
"Can-Set-Native-Method-Prefix": false
)
}
}
processResources {
outputs.upToDateWhen {false}
String versionNumber = System.getenv("BUILD_NUMBER") == null ? version : version + "-DEVb" + System.getenv("BUILD_NUMBER")
eachFile { details ->
if (details.name.contentEquals('plugin.yml')) {
filter { String line ->
line.replace('${project.version}', versionNumber)
}
}
}
}
shadowJar {
dependsOn(jar)
if(System.getenv("BUILD_NUMBER") == null){
archiveName = rootProject.name + ".jar"
}
else{
archiveName = rootProject.name + "-b" + System.getenv("BUILD_NUMBER") + ".jar"
}
delete fileTree('./target/') {
exclude archiveName
}
destinationDir = file("./target/")
from sourceSets.getByName("main").output
configurations = [project.configurations.getByName("runtimeClasspath")]
}
task copyAPI(type: Copy) {
from './archive/API.jar'
into './target/'
rename('API.jar', rootProject.name + 'API.jar')
}
clean {
delete file('./archive/')
}
build {
dependsOn shadowJar
dependsOn copyAPI
dependsOn clean
}
publish.shouldRunAfter shadowJar
shadowJar.shouldRunAfter build
build.shouldRunAfter subprojects.build