Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. // AT THE TOP OF THE FILE
  2. import proguard.gradle.ProGuardTask
  3.  
  4. apply plugin: "java"
  5.  
  6. sourceCompatibility = 1.6
  7. sourceSets.main.java.srcDirs = [ "src/" ]
  8.  
  9. project.ext.mainClassName = "com.valenguard.client.desktop.DesktopLauncher"
  10. project.ext.assetsDir = new File("../android/assets")
  11.  
  12. task run(dependsOn: classes, type: JavaExec) {
  13. main = project.mainClassName
  14. classpath = sourceSets.main.runtimeClasspath
  15. standardInput = System.in
  16. workingDir = project.assetsDir
  17. ignoreExitValue = true
  18. }
  19.  
  20. task debug(dependsOn: classes, type: JavaExec) {
  21. main = project.mainClassName
  22. classpath = sourceSets.main.runtimeClasspath
  23. standardInput = System.in
  24. workingDir = project.assetsDir
  25. ignoreExitValue = true
  26. debug = true
  27. }
  28.  
  29. task dist(type: Jar) {
  30. from files(sourceSets.main.output.classesDir)
  31. from {configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }}
  32. from files(project.assetsDir)
  33.  
  34. manifest {
  35. attributes 'Main-Class': project.mainClassName
  36. }
  37. }
  38.  
  39. task dist(type: Copy, dependsOn: [clean, jar, proguard]) {
  40. group 'distribution'
  41. description 'Deploy artifacts to distribution directories.'
  42.  
  43. tasks.findByName('jar').mustRunAfter 'clean'
  44. tasks.findByName('proguard').mustRunAfter 'jar'
  45. }
  46.  
  47. task distRaw(type: Copy, dependsOn: [clean, jar]) {
  48. group 'distribution'
  49. description 'Deploy artifacts to distribution directories WITHOUT Proguard.'
  50.  
  51. tasks.findByName('jar').mustRunAfter 'clean'
  52. }
  53.  
  54. task proguard(type: ProGuardTask, dependsOn: [jar]) {
  55. description 'Obfuscates the previously built jar file.'
  56. ext {
  57. outDir = file("${jar.destinationDir}/proguard")
  58. def pathWithoutExtension = "${outDir}/" + jar.archiveName.minus('.jar')
  59. obfuscatedJarPath = "${pathWithoutExtension}.jar"
  60. mappingPath = "${outDir}/mapping.map"
  61. proguardConfig = 'proguard.cfg'
  62. }
  63. outDir.mkdirs()
  64.  
  65. injars jar.archivePath
  66. outjars obfuscatedJarPath
  67. printmapping mappingPath
  68. configuration proguardConfig
  69. }
  70.  
  71. dist.dependsOn classes
  72.  
  73. eclipse {
  74. project {
  75. name = appName + "-desktop"
  76. linkedResource name: 'assets', type: '2', location: 'PARENT-1-PROJECT_LOC/android/assets'
  77. }
  78. }
  79.  
  80. task afterEclipseImport(description: "Post processing after project generation", group: "IDE") {
  81. doLast {
  82. def classpath = new XmlParser().parse(file(".classpath"))
  83. new Node(classpath, "classpathentry", [ kind: 'src', path: 'assets' ])
  84. def writer = new FileWriter(file(".classpath"))
  85. def printer = new XmlNodePrinter(new PrintWriter(writer))
  86. printer.setPreserveWhitespace(true)
  87. printer.print(classpath)
  88. }
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement