Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // AT THE TOP OF THE FILE
- import proguard.gradle.ProGuardTask
- apply plugin: "java"
- sourceCompatibility = 1.6
- sourceSets.main.java.srcDirs = [ "src/" ]
- project.ext.mainClassName = "com.valenguard.client.desktop.DesktopLauncher"
- project.ext.assetsDir = new File("../android/assets")
- task run(dependsOn: classes, type: JavaExec) {
- main = project.mainClassName
- classpath = sourceSets.main.runtimeClasspath
- standardInput = System.in
- workingDir = project.assetsDir
- ignoreExitValue = true
- }
- task debug(dependsOn: classes, type: JavaExec) {
- main = project.mainClassName
- classpath = sourceSets.main.runtimeClasspath
- standardInput = System.in
- workingDir = project.assetsDir
- ignoreExitValue = true
- debug = true
- }
- task dist(type: Jar) {
- from files(sourceSets.main.output.classesDir)
- from {configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }}
- from files(project.assetsDir)
- manifest {
- attributes 'Main-Class': project.mainClassName
- }
- }
- task dist(type: Copy, dependsOn: [clean, jar, proguard]) {
- group 'distribution'
- description 'Deploy artifacts to distribution directories.'
- tasks.findByName('jar').mustRunAfter 'clean'
- tasks.findByName('proguard').mustRunAfter 'jar'
- }
- task distRaw(type: Copy, dependsOn: [clean, jar]) {
- group 'distribution'
- description 'Deploy artifacts to distribution directories WITHOUT Proguard.'
- tasks.findByName('jar').mustRunAfter 'clean'
- }
- task proguard(type: ProGuardTask, dependsOn: [jar]) {
- description 'Obfuscates the previously built jar file.'
- ext {
- outDir = file("${jar.destinationDir}/proguard")
- def pathWithoutExtension = "${outDir}/" + jar.archiveName.minus('.jar')
- obfuscatedJarPath = "${pathWithoutExtension}.jar"
- mappingPath = "${outDir}/mapping.map"
- proguardConfig = 'proguard.cfg'
- }
- outDir.mkdirs()
- injars jar.archivePath
- outjars obfuscatedJarPath
- printmapping mappingPath
- configuration proguardConfig
- }
- dist.dependsOn classes
- eclipse {
- project {
- name = appName + "-desktop"
- linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
- }
- }
- task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
- doLast {
- def classpath = new XmlParser().parse(file(".classpath"))
- new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ])
- def writer = new FileWriter(file(".classpath"))
- def printer = new XmlNodePrinter(new PrintWriter(writer))
- printer.setPreserveWhitespace(true)
- printer.print(classpath)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement