Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1688 | chris | 1 | sourceSets.main.java.srcDirs = [ "src/" ] |
| 2 | |||
| 3 | sourceCompatibility = '1.7' |
||
| 4 | [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' |
||
| 5 | |||
| 6 | ext { |
||
| 7 | mainClassName = "com.gebauz.watergame.IOSLauncher" |
||
| 8 | } |
||
| 9 | |||
| 10 | // Extracts native libs (*.a) from the native-ios.jar and places them |
||
| 11 | // under build/libs/ios/. |
||
| 12 | task copyNatives << { |
||
| 13 | file("build/libs/ios/").mkdirs(); |
||
| 14 | configurations.natives.files.each { jar -> |
||
| 15 | def outputDir = null |
||
| 16 | if (jar.name.endsWith("natives-ios.jar")) outputDir = file("build/libs/ios") |
||
| 17 | if (outputDir != null) { |
||
| 18 | copy { |
||
| 19 | from zipTree(jar) |
||
| 20 | into outputDir |
||
| 21 | include "*.a" |
||
| 22 | } |
||
| 23 | } |
||
| 24 | } |
||
| 25 | } |
||
| 26 | |||
| 27 | // Updates a robovm.xml file. |
||
| 28 | task updateRoboVMXML << { |
||
| 29 | def xml = file('robovm.xml') |
||
| 30 | |||
| 31 | if (!xml.exists()) { |
||
| 32 | return |
||
| 33 | } |
||
| 34 | |||
| 35 | // Find all native (*.a) libraries beneath libs |
||
| 36 | def libtree = fileTree(dir: 'build/libs', include: '**/*.a') |
||
| 37 | |||
| 38 | def config = new groovy.util.XmlParser().parse(xml) |
||
| 39 | config.libs.each {libs -> |
||
| 40 | libs.children().clear() |
||
| 41 | libtree.each { File file -> |
||
| 42 | libs.appendNode('lib', 'build/libs/ios/' + file.getName()) |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | def writer = new FileWriter(xml) |
||
| 47 | def printer = new XmlNodePrinter(new PrintWriter(writer)) |
||
| 48 | printer.setPreserveWhitespace true |
||
| 49 | printer.print(config) |
||
| 50 | } |
||
| 51 | |||
| 52 | updateRoboVMXML.dependsOn copyNatives |
||
| 53 | build.dependsOn updateRoboVMXML |
||
| 54 | tasks.eclipse.dependsOn updateRoboVMXML |
||
| 55 | |||
| 56 | launchIPhoneSimulator.dependsOn build |
||
| 57 | launchIPadSimulator.dependsOn build |
||
| 58 | launchIOSDevice.dependsOn build |
||
| 59 | createIPA.dependsOn build |
||
| 60 | |||
| 61 | |||
| 62 | eclipse.project { |
||
| 63 | name = appName + "-ios" |
||
| 64 | natures 'org.robovm.eclipse.RoboVMNature' |
||
| 65 | } |