| plugins { |
| id 'java' |
| id 'de.undercouch.download' version '3.1.1' |
| id 'com.github.johnrengelman.shadow' version '1.2.4' |
| } |
| |
| tasks.withType(AbstractCompile) { |
| classpath += configurations.shadow |
| } |
| |
| group 'protocolsupport' |
| version '4.25.dev' |
| |
| sourceCompatibility = 1.8 |
| |
| import de.undercouch.gradle.tasks.download.Download |
| |
| task updateSpigot(type: Download) { |
| src 'http://yivesmirror.com/files/spigot/spigot-1.11.2-R0.1-SNAPSHOT.jar' |
| dest buildDir |
| onlyIfNewer true |
| overwrite true |
| } |
| |
| task updateGlowstone(type: Download) { |
| src 'https://bamboo.gserv.me/artifact/GSPP-SRV/shared/build-latestSuccessful/Version-Independent-Server-JAR/glowstone.jar' |
| dest buildDir |
| onlyIfNewer true |
| overwrite true |
| } |
| |
| compileJava.dependsOn(clean) |
| compileJava.dependsOn(updateSpigot, updateGlowstone) |
| |
| sourceSets { |
| main { |
| java { |
| srcDirs = ['src'] |
| } |
| resources { |
| srcDirs = ['resources'] |
| } |
| } |
| } |
| |
| repositories { |
| mavenCentral() |
| } |
| |
| dependencies { |
| shadow files('buildprocessor/BuildProcessor.jar', 'build/spigot-1.11.2-R0.1-SNAPSHOT.jar', 'build/glowstone.jar') |
| compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.0' |
| compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3' |
| compile group: 'com.google.code.gson', name: 'gson', version: '2.8.0' |
| } |
| |
| shadowJar { |
| from sourceSets.main.allSource |
| from 'LICENSE' |
| from 'src/plugin.yml' |
| |
| destinationDir = file('build') |
| archiveName = 'ProtocolSupport-all.jar' |
| |
| exclude 'META-INF/**' |
| relocate 'org.apache', 'protocolsupport.libs.org.apache' |
| relocate 'gnu.trove', 'protocolsupport.libs.gnu.trove' |
| relocate 'com.google.gson', 'protocolsupport.libs.com.google.gson' |
| } |
| |
| task replaceManifest(type: Zip) { |
| def shadedFile = file('build/ProtocolSupport-all.jar') |
| destinationDir = file('target') |
| archiveName = 'ProtocolSupport.jar' |
| from (zipTree(shadedFile), { |
| filesMatching('META-INF/MANIFEST.MF') { |
| filter { |
| String line -> line.startsWith("Manifest-Version:") ? line : null |
| } |
| } |
| }) |
| } |
| |
| jar.enabled = false |
| classes.finalizedBy(shadowJar) |
| shadowJar.finalizedBy(replaceManifest) |