Shade using gradle build script instead of external shell script
This commit is contained in:
46
build.gradle
46
build.gradle
@@ -33,8 +33,18 @@ minecraft {
|
||||
mappings = "snapshot_nodoc_20141130"
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://repo.johni0702.de/content/groups/public/" }
|
||||
}
|
||||
|
||||
configurations {
|
||||
shade
|
||||
compile.extendsFrom shade
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'lib', includes: ['*.jar'])
|
||||
shade 'de.johni0702:replaystudio:0.0.1-SNAPSHOT'
|
||||
shade fileTree(dir: 'libs', includes: ['*.jar'])
|
||||
// you may put jars on which you depend on in ./libs
|
||||
// or you may define them like so..
|
||||
//compile "some.group:artifact:version:classifier"
|
||||
@@ -51,7 +61,23 @@ dependencies {
|
||||
}
|
||||
|
||||
jar {
|
||||
//from { configurations.external.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
dependsOn configurations.shade
|
||||
def noticeDir = file("$buildDir/NOTICE")
|
||||
doFirst {
|
||||
noticeDir.deleteDir()
|
||||
noticeDir.mkdirs()
|
||||
configurations.shade.collect { it.isDirectory() ? fileTree(it) : zipTree(it) }.each {
|
||||
it.matching { include '**/NOTICE*' }.each {
|
||||
new File(noticeDir, 'NOTICE.txt') << it.getText('UTF-8') + '\n'
|
||||
}
|
||||
}
|
||||
}
|
||||
from noticeDir
|
||||
|
||||
from (configurations.shade.collect { it.isDirectory() ? it : zipTree(it) }) {
|
||||
exclude '**/NOTICE*'
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes 'FMLCorePlugin': 'eu.crushedpixel.replaymod.coremod.LoadingPlugin',
|
||||
'FMLCorePluginContainsFMLMod': 'false'
|
||||
@@ -78,18 +104,4 @@ processResources
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def shade() {
|
||||
exec {
|
||||
executable "./shade.sh"
|
||||
args "./build/libs/replaymod-0.6.jar", "./libs", "replaymod-0.6.jar"
|
||||
}
|
||||
}
|
||||
|
||||
task doShade {
|
||||
doLast {
|
||||
shade()
|
||||
}
|
||||
}
|
||||
|
||||
defaultTasks 'build', 'doShade'
|
||||
defaultTasks 'build'
|
||||
Binary file not shown.
17
shade.sh
17
shade.sh
@@ -1,17 +0,0 @@
|
||||
#!/bin/sh
|
||||
JARPATH="$1"
|
||||
LIBSPATH="$2"
|
||||
FILENAME="$3"
|
||||
|
||||
TEMPDIR="./tempdir"
|
||||
mkdir $TEMPDIR
|
||||
|
||||
unzip -o $LIBSPATH"/*.jar" -d $TEMPDIR
|
||||
unzip -o $JARPATH -d $TEMPDIR
|
||||
|
||||
JARDIR=$(dirname "$JARPATH")
|
||||
|
||||
#Thanks to johni0702 for the following line of code <3
|
||||
cd $TEMPDIR && ls | zip -r -@ "../$JARDIR/$FILENAME" && cd ..
|
||||
|
||||
rm -r $TEMPDIR
|
||||
Reference in New Issue
Block a user