Browse Source

add NetBeans platform base download to SDK build, the SDK should now build out of the box with gradle

Normen Hansen 11 năm trước cách đây
mục cha
commit
ad0c18cbfe
1 tập tin đã thay đổi với 23 bổ sung2 xóa
  1. 23 2
      sdk/build.gradle

+ 23 - 2
sdk/build.gradle

@@ -36,6 +36,27 @@ artifacts {
     //    jar null
 }
 
+task checkPlatformConfig {
+    description = "Downloads the NetBeans platform base and registers it in the SDK project if needed"
+    def platformFile = file("nbproject/private/platform-private.properties")
+    if(!platformFile.exists()){
+        def netbeansFolder = file("../netbeans")
+        if(!netbeansFolder.exists()){
+            println "Downloading NetBeans Platform base, this only has to be done once.."
+            def f = file("netbeans.zip")
+            new URL("http://download.netbeans.org/netbeans/8.0/final/zip/netbeans-8.0-201403101706-javase.zip").withInputStream{ i -> f.withOutputStream{ it << i }}
+            copy{
+                from zipTree(f)
+                into "../"
+            }
+            f.delete()
+        }
+        platformFile.createNewFile()
+        platformFile.write("nbplatform.default.netbeans.dest.dir=${netbeansFolder.absolutePath}\r\n"+\
+                           "nbplatform.default.harness.dir=${netbeansFolder.absolutePath}/harness\r\n")
+    }
+}
+
 task copyBaseLibs(dependsOn:configurations.corelibs) <<{
     description "Copies the library files needed to run the SDK to "+
                 "jme3-core-baselibs and jme3-core-libraries"
@@ -311,11 +332,11 @@ ant.properties['plugins.version'] = jmeVersion
 ant.properties['app.version']= jmeMainVersion + jmeVersionSuffix
 
 task buildSdk() <<{
-//    ant.ant(dir: ".", antfile: "build.xml", target: "build")
+    ant.ant(dir: ".", antfile: "build.xml", target: "build")
 }
 
 task cleanSdk() <<{
-//    ant.ant(dir: ".", antfile: "build.xml", target: "clean")
+    ant.ant(dir: ".", antfile: "build.xml", target: "clean")
 }
 
 jar.dependsOn([copyBaseLibs, copyProjectLibs, createProjectXml, createBaseXml, buildSdk])