Skip to content

Commit d00b772

Browse files
committed
Update to gradle 5
1 parent d6117da commit d00b772

File tree

5 files changed

+38
-46
lines changed

5 files changed

+38
-46
lines changed

build.gradle

+36-44
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,16 @@
1-
buildscript {
2-
dependencies {
3-
classpath 'org.jdom:jdom2:2.0.6'
4-
classpath 'org.ow2.asm:asm:5.1'
5-
classpath 'org.ow2.asm:asm-commons:5.1'
6-
classpath 'commons-io:commons-io:2.5'
7-
classpath 'org.apache.ant:ant:1.9.7'
8-
classpath 'org.codehaus.plexus:plexus-utils:3.0.24'
9-
classpath 'org.vafer:jdependency:1.1'
10-
classpath files('gradle/plugins/shadowPlugin.jar')
11-
}
12-
repositories {
13-
mavenCentral()
14-
}
15-
}
16-
171
plugins {
2+
id 'com.github.johnrengelman.shadow' version '5.0.0'
183
id 'java'
194
}
205

216
apply from: 'helper.gradle'
22-
apply plugin: com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
237

24-
tasks.withType(AbstractCompile) {
25-
classpath += configurations.shadow
26-
}
278

28-
tasks.withType(JavaCompile) {
29-
options.encoding = 'UTF-8'
30-
}
9+
defaultTasks 'build'
10+
3111

3212
group 'protocolsupport'
3313
version '1.4.dev'
34-
3514
sourceCompatibility = JavaVersion.VERSION_1_8
3615

3716
File librariesRuntimeDirectory = new File("libraries_runtime")
@@ -76,18 +55,18 @@ repositories {
7655
dependencies {
7756
shadow fileTree(dir: librariesRuntimeDirectory, include: '*.jar')
7857
compile fileTree(dir: librariesShadeDirectory, include: '*.jar')
79-
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0'
80-
compile group: 'com.nimbusds', name: 'nimbus-jose-jwt', version: '5.2'
81-
compile group: 'it.unimi.dsi', name: 'fastutil', version: '8.1.1'
58+
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.8.1'
59+
compile group: 'it.unimi.dsi', name: 'fastutil', version: '8.2.2'
8260
}
8361

84-
task copyFinalJarToTarget(type: Copy) {
85-
// JitPack searches for the output jar at the standard Gradle output directory (jar.archivePath)
86-
// By copying it from there to our target destination JitPack can archive it in a Maven repository
87-
from jar.archivePath.getPath()
88-
into 'target'
89-
//remove version suffix
90-
rename (jar.archiveName, jar.baseName + '.jar')
62+
compileJava {
63+
doFirst {
64+
classpath -= configurations.shadow
65+
classpath += configurations.shadow
66+
}
67+
68+
options.encoding = 'UTF-8'
69+
options.incremental = false
9170
}
9271

9372
shadowJar {
@@ -98,27 +77,40 @@ shadowJar {
9877
from sourceSets.main.java.srcDirs
9978
from 'LICENSE'
10079

101-
102-
//remove the -all suffix
10380
archiveName = jar.archiveName
104-
minimizeJar = true
10581

10682
exclude 'META-INF/**'
10783
relocate 'org.apache', 'protocolsupport.libs.org.apache'
108-
relocate 'com.nimbusds', 'protocolsupport.libs.com.nimbusds'
109-
relocate 'org.objectweb', 'protocolsupport.libs.org.objectweb'
110-
relocate 'net.minidev', 'protocolsupport.libs.net.minidev'
111-
relocate 'net.jcip', 'protocolsupport.libs.net.jcip'
112-
relocate 'raknetserver', 'protocolsupport.libs.raknetserver'
113-
relocate 'udpserversocketchannel', 'protocolsupport.libs.udpserversocketchannel'
11484
relocate 'it.unimi.dsi.fastutil', 'protocolsupport.libs.it.unimi.dsi.fastutil'
85+
86+
minimize()
11587
}
11688

11789

90+
task postprocessFatJar(type: Zip) {
91+
File originalJar = new File(shadowJar.destinationDir, shadowJar.archiveName)
92+
93+
archiveName = shadowJar.archiveName
94+
95+
from(zipTree(originalJar)) {
96+
exclude 'META-INF/**'
97+
}
98+
}
99+
100+
task copyFinalJarToTarget(type: DefaultTask) {doLast{
101+
java.nio.file.Files.copy(
102+
postprocessFatJar.archivePath.getAbsoluteFile().toPath(),
103+
new File(targetJarDirectory, jar.baseName + '.jar').getAbsoluteFile().toPath(),
104+
java.nio.file.StandardCopyOption.REPLACE_EXISTING
105+
)
106+
}}
107+
108+
118109
compileJava.dependsOn(clean)
119110
compileJava.dependsOn(setupFolders)
120111
compileJava.dependsOn(updateRuntimeLibraries)
121112
compileJava.dependsOn(updateShadeLibraries)
122113
jar.enabled = false
123114
jar.finalizedBy(shadowJar)
124-
shadowJar.finalizedBy(copyFinalJarToTarget)
115+
shadowJar.finalizedBy(postprocessFatJar)
116+
postprocessFatJar.finalizedBy(copyFinalJarToTarget)

gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.daemon=false

gradle/plugins/shadowPlugin.jar

-264 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip

settings.gradle

-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
rootProject.name = 'ProtocolSupportBungee'
2-

0 commit comments

Comments
 (0)