Last active
October 25, 2018 07:23
-
-
Save Joedobo27/6c516ceb8dd5303c47e69fd71d36e74f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
apply plugin: 'distribution' | |
group = 'com.joedobo27' | |
version = '1.0.3' | |
sourceCompatibility = 1.8 | |
def WUServerPath = "C:\\Users\\Jason\\Documents\\WU\\WU-Server\\" | |
repositories { | |
mavenCentral() | |
mavenLocal() | |
} | |
dependencies { | |
compileOnly files("${WUServerPath}common.jar") | |
compileOnly files("${WUServerPath}server.jar") | |
compileOnly files("${WUServerPath}modlauncher.jar") | |
compileOnly files("${WUServerPath}javassist.jar") | |
// https://mvnrepository.com/artifact/junit/junit | |
testCompile group: 'junit', name: 'junit', version: '4.12' | |
// https://mvnrepository.com/artifact/org.javassist/javassist | |
//compileOnly group: 'org.javassist', name: 'javassist', version: '3.20.0-GA' | |
// https://mvnrepository.com/artifact/com.intellij/annotations | |
compile group: 'com.intellij', name: 'annotations', version: '12.0' | |
} | |
jar.setArchiveName(project.name + ".jar") | |
distZip.doFirst { | |
delete (file("${distZip.destinationDir}/${project.name}-${version}.zip")) | |
} | |
distZip.dependsOn(jar) | |
distZip.mustRunAfter(jar) | |
// The distZip automatically adds a sub-folder with the same name as the zip. In order to directly unpack the | |
// archive into WU server folder it needs to have a folder named "mods" as its first sub-folder. After much effort I ended up with | |
// this weird "hack" approach to get the right directory structure. | |
distZip.setArchiveName("mods.zip") | |
distZip.doLast { | |
file("${distZip.destinationDir}/mods.zip").renameTo("${distZip.destinationDir}/${project.name}-${version}.zip") | |
} | |
distributions { | |
main { | |
contents { | |
from('src/main/resources/') { | |
include("*.properties") | |
} | |
from ('build/libs/') { | |
include("${project.name}.jar") | |
into(project.name+"/") | |
} | |
from ('build/libs/'){ | |
exclude("${project.name}.jar") | |
include("*.jar") | |
into("${project.name}/libs/") | |
} | |
} | |
} | |
} | |
task dist(type: Copy) { | |
from configurations.runtime { | |
exclude("annotations*") | |
} | |
into "$buildDir/libs" | |
} | |
build.dependsOn(dist) | |
dist.mustRunAfter(jar) | |
distZip.dependsOn(dist) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment