Skip to content

Commit

Permalink
Use shadow jar
Browse files Browse the repository at this point in the history
  • Loading branch information
fornwall committed Apr 29, 2018
1 parent 530adb4 commit fde5756
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 42 deletions.
50 changes: 10 additions & 40 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,46 +1,16 @@
defaultTasks 'executable'

repositories {
jcenter()
plugins {
id 'com.github.johnrengelman.shadow' version '2.0.4'
id 'java'
}

apply plugin: 'java'
defaultTasks 'shadowJar'

dependencies {
compile 'commons-cli:commons-cli:1.4'
compile 'com.madgag.spongycastle:bcpkix-jdk15on:1.56.0.0'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
repositories { jcenter() }

// Create a single Jar with all dependencies
task fatJar(type: Jar) {
manifest {
attributes (
'Main-Class': MAIN_CLASS
)
}
baseName = project.name + '-all'
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}

task executable(dependsOn: ':fatJar') {
doLast {
exec {
commandLine 'sh', '-c', 'cat stub.sh ' + fatJar.archivePath + ' > ' + BINARY_NAME
}
exec {
commandLine 'chmod', '+x', BINARY_NAME
}
println 'Runnable file ' + BINARY_NAME +' created!'
}
clean {
delete BINARY_NAME
}
dependencies {
compile 'commons-cli:commons-cli:1.4'
compile 'com.madgag.spongycastle:bcpkix-jdk15on:1.56.0.0'
testCompile group: 'junit', name: 'junit', version: '4.12'
}

test {
afterTest { desc, result ->
println "Test ${desc.name} [${desc.className}] result: ${result.resultType}"
}
}
jar { manifest { attributes ( 'Main-Class': 'net.fornwall.apksigner.Main' ) } }
2 changes: 0 additions & 2 deletions gradle.properties

This file was deleted.

0 comments on commit fde5756

Please sign in to comment.