ソースを参照

gradle:
import current build script to gradle-restructure

git-svn-id: https://jmonkeyengine.googlecode.com/svn/branches/gradle-restructure@10968 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

nor..67 11 年 前
コミット
511d045274

+ 490 - 0
build.gradle

@@ -0,0 +1,490 @@
+import org.gradle.api.artifacts.*
+
+//location of jme3 engine sources
+String jmeSvnRoot = '../jme3-gradle/engine/'
+
+apply plugin: 'base' // To add "clean" task to the root project.
+//apply plugin: 'java-library-distribution'
+
+// This is applied to all sub projects
+subprojects {
+    // Don't add to native builds
+    //    if(!project.name.endsWith('native')){
+    apply from: rootProject.file('common.gradle')
+    //    }
+}
+
+task(run, dependsOn: ':jme3-examples:build', type: JavaExec) {
+    main = 'jme3test.TestChooser'
+    classpath = files(subprojects.collect {project -> 
+            project.sourceSets*.compileClasspath})
+//    classpath = sourceSets.main.runtimeClasspath
+//    args 'mrhaki'
+//    systemProperty 'simple.message', 'Hello '
+}
+
+defaultTasks 'run'
+
+//evaluationDependsOn ":jme3-examples" 
+//task run(dependsOn: subprojects.run)
+//run.dependsOn subprojects.'jme3-examples'.run//':jme3-examples:run'
+
+task clearjme(type: Delete){
+    description 'Deletes the source folders inside the project folders for copying a new version of the engine sources'
+    delete 'jme3-android/src'
+    delete 'jme3-android-native/src'
+    delete 'jme3-blender/src'
+    delete 'jme3-jbullet/src'
+    delete 'jme3-bullet/src'
+    delete 'jme3-bullet-native/src'
+    delete 'jme3-core/src'
+    delete 'jme3-desktop/src'
+    delete 'jme3-effects/src'
+    delete 'jme3-examples/src'
+    //ios
+    //jheora
+    delete 'jme3-jogg/src'
+    delete 'jme3-jogl/src'
+    delete 'jme3-lwjgl/src'
+    delete 'jme3-networking/src'
+    delete 'jme3-niftygui/src'
+    delete 'jme3-plugins/src'
+    delete 'jme3-terrain/src'
+    delete 'jme3-testdata/src'
+}
+
+task copyjme(dependsOn: clearjme) << {
+    description 'Copies the jME3 sources from a svn checkout to the project folders'
+    // ANDROID
+    ant.copy(todir: 'jme3-android/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/android') {
+            include(name: '**/*.java')
+        }
+    }
+    // ANDROID NATIVE (OPENAL)
+    ant.copy(todir: 'jme3-android-native/src/native/android',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/openal-soft-native/android') {
+            include(name: '**/*.cpp')
+            include(name: '**/*.h')
+            include(name: '**/*.mk')
+            exclude(name: '.**')
+        }
+    }
+    // BLENDER
+    ant.copy(todir: 'jme3-blender/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/blender') {
+            include(name: '**/*.java')
+        }
+    }
+    // BULLET
+    ant.copy(todir: 'jme3-bullet/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/bullet') {
+            include(name: '**/*.java')
+        }
+    }
+    ant.copy(todir: 'jme3-bullet/src/common/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/bullet-common') {
+            include(name: '**/*.java')
+        }
+    }
+    ant.copy(todir: 'jme3-jbullet/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/jbullet') {
+            include(name: '**/*.java')
+        }
+    }
+    // BULLET NATIVE
+    ant.copy(todir: 'jme3-bullet-native/src/native/cpp',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/bullet-native') {
+            include(name: '**/*.h')
+            include(name: '**/*.cpp')
+            exclude(name: 'android/**')
+        }
+    }
+    ant.copy(todir: 'jme3-bullet-native/src/native/android',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/bullet-native/android') {
+            include(name: '**/*.mk')
+        }
+    }
+    // CORE
+    ant.copy(todir: 'jme3-core/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/core') {
+            include(name: '**/*.java')
+        }
+    }
+    ant.copy(todir: 'jme3-core/src/main/resources',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/core') {
+            exclude(name: '**/*.java')
+            exclude(name: '**/*.html')
+        }
+    }
+    ant.copy(todir: 'jme3-core/src/main/resources',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/core-data') {
+            exclude(name: '**/*.java')
+            exclude(name: '**/*.html')
+        }
+    }
+    ant.copy(todir: 'jme3-core/src/plugins/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/core-plugins') {
+            include(name: '**/*.java')
+        }
+    }
+    ant.copy(todir: 'jme3-core/src/tools/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/tools') {
+            include(name: '**/*.java')
+        }
+    }
+    // DESKTOP
+    ant.copy(todir: 'jme3-desktop/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/desktop') {
+            include(name: '**/*.java')
+        }
+    }
+    ant.copy(todir: 'jme3-desktop/src/main/resources',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/desktop') {
+            exclude(name: '**/*.java')
+            exclude(name: '**/*.html')
+        }
+    }
+    // EFFECTS
+    ant.copy(todir: 'jme3-effects/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/core-effects') {
+            include(name: '**/*.java')
+        }
+    }
+    ant.copy(todir: 'jme3-effects/src/main/resources',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/core-effects') {
+            exclude(name: '**/*.java')
+            exclude(name: '**/*.html')
+        }
+    }
+    //EXAMPLES
+    ant.copy(todir: 'jme3-examples/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/test') {
+            include(name: '**/*.java')
+        }
+    }
+    //JOGG
+    ant.copy(todir: 'jme3-jogg/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/jogg') {
+            include(name: '**/*.java')
+        }
+    }
+    //JOGL
+    ant.copy(todir: 'jme3-jogl/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/jogl') {
+            include(name: '**/*.java')
+        }
+    }
+    //LWJGL
+    ant.copy(todir: 'jme3-lwjgl/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/lwjgl') {
+            include(name: '**/*.java')
+        }
+    }
+    //NETWORKING
+    ant.copy(todir: 'jme3-networking/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/networking') {
+            include(name: '**/*.java')
+        }
+    }
+    //NIFTYGUI
+    ant.copy(todir: 'jme3-niftygui/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/niftygui') {
+            include(name: '**/*.java')
+        }
+    }
+    //PLUGINS
+    ant.copy(todir: 'jme3-plugins/src/xml/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/xml') {
+            include(name: '**/*.java')
+        }
+    }
+    ant.copy(todir: 'jme3-plugins/src/ogre/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/ogre') {
+            include(name: '**/*.java')
+        }
+    }
+    //TERRAIN
+    ant.copy(todir: 'jme3-terrain/src/main/java',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/terrain') {
+            include(name: '**/*.java')
+        }
+    }
+    ant.copy(todir: 'jme3-terrain/src/main/resources',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'src/terrain') {
+            exclude(name: '**/*.java')
+            exclude(name: '**/*.html')
+        }
+    }
+    //TESTDATA
+    ant.copy(todir: 'jme3-testdata/src/main/resources',
+        includeEmptyDirs: false) {
+        fileset(dir: jmeSvnRoot + 'test-data')
+    }
+}
+
+//task copyjme(type: Copy, dependsOn:clearjme) {
+//    // ANDROID
+//    from(jmeSvnRoot+'src/android') {
+//        include '**/*.java'
+//        into 'jme3-android/src/main/java'
+//    }
+//    // BLENDER
+//    from(jmeSvnRoot+'src/blender') {
+//        include '**/*.java'
+//        into 'jme3-blender/src/main/java'
+//    }
+//    // BULLET
+//    from(jmeSvnRoot+'src/bullet') {
+//        include '**/*.java'
+//        into 'jme3-bullet/src/main/java'
+//    }
+//    from(jmeSvnRoot+'src/bullet-common') {
+//        include '**/*.java'
+//        into 'jme3-bullet/src/common/java'
+//    }
+//    from(jmeSvnRoot+'src/jbullet') {
+//        include '**/*.java'
+//        into 'jme3-jbullet/src/main/java'
+//    }
+//    // BULLET NATIVE
+//    from(jmeSvnRoot+'src/bullet-native') {
+//        include '**/*.h'
+//        include '**/*.cpp'
+//        exclude 'android/**'
+//        into 'jme3-bullet-native/src/native/cpp'
+//    }
+//    from(jmeSvnRoot+'src/bullet-native') {
+//        include '**/*.mk'
+//        into 'jme3-bullet-native/src/native/android-mk'
+//    }    
+//    // CORE
+//    from(jmeSvnRoot+'src/core') {
+//        include '**/*.java'
+//        into 'jme3-core/src/main/java'
+//    }
+//    from(jmeSvnRoot+'src/core') {
+//        exclude '**/*.java'
+//        exclude '**/*.html'
+//        into 'jme3-core/src/main/resources'
+//    }
+//    from(jmeSvnRoot+'src/core-data') {
+//        exclude '**/*.java'
+//        exclude '**/*.html'
+//        into 'jme3-core/src/main/resources'
+//    }
+//    from(jmeSvnRoot+'src/core-plugins') {
+//        include '**/*.java'
+//        into 'jme3-core/src/plugins/java'
+//    }
+//    from(jmeSvnRoot+'src/tools') {
+//        include '**/*.java'
+//        into 'jme3-core/src/tools/java'
+//    }
+//    // DESKTOP
+//    from(jmeSvnRoot+'src/desktop') {
+//        include '**/*.java'
+//        into 'jme3-desktop/src/main/java'
+//    }
+//    from(jmeSvnRoot+'src/desktop') {
+//        exclude '**/*.java'
+//        exclude '**/*.html'
+//        into 'jme3-desktop/src/main/resources'
+//    }
+//    // EFFECTS
+//    from(jmeSvnRoot+'src/core-effects') {
+//        include '**/*.java'
+//        into 'jme3-effects/src/main/java'
+//    }
+//    from(jmeSvnRoot+'src/core-effects') {
+//        exclude '**/*.java'
+//        exclude '**/*.html'
+//        into 'jme3-effects/src/main/resources'
+//    }
+//    //EXAMPLES
+//    from(jmeSvnRoot+'src/test') {
+//        include '**/*.java'
+//        into 'jme3-examples/src/main/java'
+//    }
+//    //JOGG
+//    from(jmeSvnRoot+'src/jogg') {
+//        include '**/*.java'
+//        into 'jme3-jogg/src/main/java'
+//    }
+//    //JOGL
+//    from(jmeSvnRoot+'src/jogl') {
+//        include '**/*.java'
+//        into 'jme3-jogl/src/main/java'
+//    }
+//    //LWJGL
+//    from(jmeSvnRoot+'src/lwjgl') {
+//        include '**/*.java'
+//        into 'jme3-lwjgl/src/main/java'
+//    }
+//    //NETWORKING
+//    from(jmeSvnRoot+'src/networking') {
+//        include '**/*.java'
+//        into 'jme3-networking/src/main/java'
+//    }
+//    //NIFTYGUI
+//    from(jmeSvnRoot+'src/niftygui') {
+//        include '**/*.java'
+//        into 'jme3-niftygui/src/main/java'
+//    }
+//    //PLUGINS
+//    from(jmeSvnRoot+'src/xml') {
+//        include '**/*.java'
+//        into 'jme3-plugins/src/xml/java'
+//    }
+//    from(jmeSvnRoot+'src/ogre') {
+//        include '**/*.java'
+//        into 'jme3-plugins/src/ogre/java'
+//    }
+//    //TERRAIN
+//    from(jmeSvnRoot+'src/terrain') {
+//        include '**/*.java'
+//        into 'jme3-terrain/src/main/java'
+//    }
+//    from(jmeSvnRoot+'src/terrain') {
+//        exclude '**/*.java'
+//        exclude '**/*.html'
+//        into 'jme3-terrain/src/main/resources'
+//    }
+//    //TESTDATA
+//    from(jmeSvnRoot+'test-data') {
+//        into 'jme3-testdata/src/main/resources'
+//    }
+//  
+//    includeEmptyDirs = false
+//    into '.'
+//}
+
+task libDist(dependsOn: subprojects.build) << {
+//    description 'Builds and copies the engine binaries, sources and javadoc to build/libDist'
+    File libFolder = mkdir("$buildDir/libDist/lib")
+    File sourceFolder = mkdir("$buildDir/libDist/sources")
+    File javadocFolder = mkdir("$buildDir/libDist/javadoc")
+    subprojects.each {project ->
+        if(project.ext.mainClass == ''){
+            project.tasks.withType(Jar).each {archiveTask ->
+                if(archiveTask.classifier == "sources"){
+                    copy {
+                        from archiveTask.archivePath
+                        into sourceFolder
+                    }
+                } else if(archiveTask.classifier == "javadoc"){
+                    copy {
+                        from archiveTask.archivePath
+                        into javadocFolder
+                    }
+                } else{
+                    copy {
+                        from archiveTask.archivePath
+                        into libFolder
+                    }
+                }
+            }
+        }
+    }
+}
+
+task copyLibs(type: Copy){
+//    description 'Copies the engine dependencies to build/libDist'
+    from {
+        subprojects*.configurations*.compile*.copyRecursive({ !(it instanceof ProjectDependency); })*.resolve()
+    }
+    
+    into "$buildDir/libDist/lib-ext" //buildDir.path + '/' + libsDirName + '/lib'
+}
+
+task dist{
+    description 'Creates a distribution of all jme3 binaries, sources, javadoc and external libraries under build/libDist'
+}
+dist.dependsOn libDist
+dist.dependsOn copyLibs
+
+task mergedJavadoc(type: Javadoc, description: 'Creates Javadoc from all the projects.') {
+    title = 'All modules'
+    destinationDir = new File(project.buildDir, 'merged-javadoc')
+
+    // Note: The closures below are executed lazily.
+    source subprojects.collect {project -> 
+        project.sourceSets*.allJava
+    } 
+    classpath = files(subprojects.collect {project -> 
+            project.sourceSets*.compileClasspath}) 
+    //    source {
+    //        subprojects*.sourceSets*.main*.allSource
+    //    }
+    //    classpath.from {
+    //        subprojects*.configurations*.compile*.copyRecursive({ !(it instanceof ProjectDependency); })*.resolve()
+    //    }
+}
+
+//task javadoc(type: Javadoc) { 
+//    source subprojects.collect {project -> 
+//        project.sourceSets*.allJava
+//    } 
+//    destinationDir = new File(buildDir, 'javadoc') 
+//    // Might need a classpath 
+//    classpath = files(subprojects.collect {project -> 
+//            project.sourceSets.main.compileClasspath}) 
+//} 
+
+task wrapper(type: Wrapper, description: 'Creates and deploys the Gradle wrapper to the current directory.') {
+    gradleVersion = '1.10'
+}
+
+//class IncrementalReverseTask extends DefaultTask {
+//    @InputDirectory
+//    def File inputDir
+//
+//    @OutputDirectory
+//    def File outputDir
+//
+//    @Input
+//    def inputProperty
+//
+//    @TaskAction
+//    void execute(IncrementalTaskInputs inputs) {
+//        println inputs.incremental ? "CHANGED inputs considered out of date" : "ALL inputs considered out of date"
+//        inputs.outOfDate { change ->
+//            println "out of date: ${change.file.name}"
+//            def targetFile = new File(outputDir, change.file.name)
+//            targetFile.text = change.file.text.reverse()
+//        }
+//
+//        inputs.removed { change ->
+//            println "removed: ${change.file.name}"
+//            def targetFile = new File(outputDir, change.file.name)
+//            targetFile.delete()
+//        }
+//    }
+//}

+ 84 - 0
common.gradle

@@ -0,0 +1,84 @@
+//
+// This file is to be applied to every subproject.
+//
+
+apply plugin: 'java'
+apply plugin: 'maven'
+
+//String jmeVersion = '3.0.10'
+//String jmeVersion = rootProject.version;
+
+String mavenGroupId = 'com.jme3'
+String mavenVersion = jmeVersion + '-SNAPSHOT'
+
+sourceCompatibility = '1.5'
+[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
+
+repositories {
+    mavenCentral();
+    maven{
+        url "http://nifty-gui.sourceforge.net/nifty-maven-repo"
+    }
+    // You may define additional repositories, or even remove "mavenCentral()".
+    // Read more about repositories here:
+    //   http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories
+}
+
+dependencies {
+    // Adding dependencies here will add the dependencies to each subproject.
+    testCompile group: 'junit', name: 'junit', version: '4.10'
+}
+
+String mavenArtifactId = name
+
+group = mavenGroupId
+version = mavenVersion
+
+//jar.doFirst{
+//    manifest {
+//        attributes('Manifest-Version'       : '1.0',
+//                'Created-By'             : vendor,
+//                'Specification-Title'    : appName,
+//                'Specification-Version'  : version,
+//                'Specification-Vendor'   : vendor,
+//                'Implementation-Title'   : appName,
+//                'Implementation-Version' : version,
+//                'Implementation-Vendor'  : vendor,
+//                'Main-Class'             : getProperty('mainClass'),
+//                'Class-Path'             : configurations.compile.collect { 'lib/' + it.getName() }.join(' ') 
+//        )
+//    }
+//}
+
+task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates a jar from the source files.') {
+    classifier = 'sources'
+    from sourceSets*.allSource
+}
+
+task javadocJar(type: Jar, dependsOn: javadoc, description: 'Creates a jar from the javadoc files.') {
+    classifier = 'javadoc'
+    from javadoc.destinationDir
+}
+
+artifacts {
+    archives jar
+    archives sourcesJar
+//    archives javadocJar
+}
+
+configure(install.repositories.mavenInstaller) {
+    pom.project {
+        groupId = mavenGroupId
+        artifactId = mavenArtifactId
+        version = mavenVersion
+    }
+}
+
+task createFolders(description: 'Creates the source folders if they do not exist.') doLast {
+//    sourceSets*.allSource*.srcDirs*.each { File srcDir ->
+//        if (!srcDir.isDirectory()) {
+//            println "Creating source folder: ${srcDir}"
+//            srcDir.mkdirs()
+//        }
+//    }
+}

+ 1 - 0
gradle.properties

@@ -0,0 +1 @@
+jmeVersion = 3.0.10

BIN
gradle/wrapper/gradle-wrapper.jar


+ 6 - 0
gradle/wrapper/gradle-wrapper.properties

@@ -0,0 +1,6 @@
+#Mon Jan 06 23:12:51 CET 2014
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip

+ 164 - 0
gradlew

@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+##  Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+    echo "$*"
+}
+
+die ( ) {
+    echo
+    echo "$*"
+    echo
+    exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+  CYGWIN* )
+    cygwin=true
+    ;;
+  Darwin* )
+    darwin=true
+    ;;
+  MINGW* )
+    msys=true
+    ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+    ls=`ls -ld "$PRG"`
+    link=`expr "$ls" : '.*-> \(.*\)$'`
+    if expr "$link" : '/.*' > /dev/null; then
+        PRG="$link"
+    else
+        PRG=`dirname "$PRG"`"/$link"
+    fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+        # IBM's JDK on AIX uses strange locations for the executables
+        JAVACMD="$JAVA_HOME/jre/sh/java"
+    else
+        JAVACMD="$JAVA_HOME/bin/java"
+    fi
+    if [ ! -x "$JAVACMD" ] ; then
+        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+    fi
+else
+    JAVACMD="java"
+    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+    MAX_FD_LIMIT=`ulimit -H -n`
+    if [ $? -eq 0 ] ; then
+        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+            MAX_FD="$MAX_FD_LIMIT"
+        fi
+        ulimit -n $MAX_FD
+        if [ $? -ne 0 ] ; then
+            warn "Could not set maximum file descriptor limit: $MAX_FD"
+        fi
+    else
+        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+    fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+    # We build the pattern for arguments to be converted via cygpath
+    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+    SEP=""
+    for dir in $ROOTDIRSRAW ; do
+        ROOTDIRS="$ROOTDIRS$SEP$dir"
+        SEP="|"
+    done
+    OURCYGPATTERN="(^($ROOTDIRS))"
+    # Add a user-defined pattern to the cygpath arguments
+    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+    fi
+    # Now convert the arguments - kludge to limit ourselves to /bin/sh
+    i=0
+    for arg in "$@" ; do
+        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option
+
+        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
+            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+        else
+            eval `echo args$i`="\"$arg\""
+        fi
+        i=$((i+1))
+    done
+    case $i in
+        (0) set -- ;;
+        (1) set -- "$args0" ;;
+        (2) set -- "$args0" "$args1" ;;
+        (3) set -- "$args0" "$args1" "$args2" ;;
+        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+    esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+    JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

+ 90 - 0
gradlew.bat

@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem  Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega

+ 32 - 0
jme3-android-native/build.gradle

@@ -0,0 +1,32 @@
+// Note: "common.gradle" in the root project contains additional initialization
+//   for this project. This initialization is applied in the "build.gradle"
+//   of the root project.
+
+// NetBeans will automatically add "run" and "debug" tasks relying on the
+// "mainClass" property. You may however define the property prior executing
+// tasks by passing a "-PmainClass=<QUALIFIED_CLASS_NAME>" argument.
+//
+// Note however, that you may define your own "run" and "debug" task if you
+// prefer. In this case NetBeans will not add these tasks but you may rely on
+// your own implementation.
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+sourceSets {
+    main {
+        java {
+            srcDir 'src/native/android'
+        }
+    }
+}
+
+dependencies {
+    // TODO: Add dependencies here
+    //   but note that JUnit should have already been added in parent.gradle.
+    //   By default, only the Maven Central Repository is specified in
+    //   parent.gradle.
+    //
+    // You can read more about how to add dependency here:
+    //   http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:how_to_declare_your_dependencies
+}

+ 9 - 0
jme3-android/build.gradle

@@ -0,0 +1,9 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+    compile project(':jme3-plugins')
+    compile 'com.google.android:android:4.1.1.4'
+}

+ 8 - 0
jme3-blender/build.gradle

@@ -0,0 +1,8 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+    compile project(':jme3-desktop')
+}

+ 149 - 0
jme3-bullet-native/build.gradle

@@ -0,0 +1,149 @@
+apply plugin: 'cpp'
+
+String bulletUrl = 'http://bullet.googlecode.com/files/bullet-2.82-r2704.zip'
+String bulletFolder = 'bullet-2.82-r2704'
+
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-bullet')
+}
+
+// C++ sources for binary compilation
+sources {
+    bulletjme {
+        cpp {
+            source {
+                srcDir 'src/native/cpp'
+                srcDir "${bulletFolder}/src"
+                exclude 'BulletMultiThreaded/GpuSoftBodySolvers/**'
+                include '**/*.cpp'
+            }
+            exportedHeaders {
+                srcDir 'src/native/cpp'
+                srcDir "${bulletFolder}/src"
+                include '**/*.h'            
+            }
+        }
+    }
+}
+
+// Java source sets for IDE acces and source jar bundling / mavenization
+sourceSets {
+    main {
+        java {
+            srcDir 'src/native/cpp'
+            srcDir 'src/native/android'
+        }
+    }
+}
+
+// Set of target platforms, will be available based on build system
+targetPlatforms {
+//    osx_universal { // TODO: universal binary doesn't work?
+//        architecture 'x86_64'
+//        architecture 'x86'
+//        operatingSystem 'osx'
+//    }
+    osx_x86 {
+        architecture "x86"
+        operatingSystem "osx"
+    }
+    osx_x64 {
+        architecture "x86_64"
+        operatingSystem "osx"
+    }
+    linux_x86 {
+        architecture "x86"
+        operatingSystem "linux"
+    }
+    linux_x86_64 {
+        architecture "x86_64"
+        operatingSystem "linux"
+    }
+    windows_x86 {
+        architecture "x86"
+        operatingSystem "windows"
+    }
+    windows_x86_64 {
+        architecture "x86_64"
+        operatingSystem "windows"
+    }
+}
+
+// Defines created C++ libraries
+libraries {
+    bulletjme {
+    }
+    all {
+        binaries.all {
+            cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include"
+            if (targetPlatform.operatingSystem.name == "osx") {
+                cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/darwin"
+            } else if (targetPlatform.operatingSystem.name == "linux") {
+                cppCompiler.args '-I', "${org.gradle.internal.jvm.Jvm.current().javaHome}/include/linux"
+                cppCompiler.args "-fPIC"
+                cppCompiler.args "-fpermissive"
+                cppCompiler.args "-static-libgcc"
+                linker.args "-static"
+            } else if (targetPlatform.operatingSystem.name == "windows") {
+                cppCompiler.args "-I${org.gradle.internal.jvm.Jvm.current().javaHome}/include/win32"
+//                cppCompiler.define('WIN32')
+//                linker.args 'Shlwapi.lib', 'Advapi32.lib'
+            }
+        }
+    }
+}
+
+// Download bullet if not available
+task downloadBullet(type: MyDownload) {
+    sourceUrl = bulletUrl
+    target = file('bullet.zip')
+}
+
+// Unzip bullet if not available
+task unzipBullet(type: Copy, dependsOn:downloadBullet) {
+    def zipFile = file('bullet.zip')
+    def outputDir = file(".")
+
+    from zipTree(zipFile)
+    into outputDir
+}
+
+compileJava.dependsOn unzipBullet
+
+//task buildAllExecutables {
+//    dependsOn binaries.withType(SharedLibraryBinary).matching {
+//        it.buildable
+//    }
+//}
+
+// Adds all built binaries to java jar task
+binaries.withType(SharedLibraryBinary) { binary ->
+    if (!buildable) {
+        //TODO: obtain elsewhere if not available
+        return
+    }
+    // Get builder of this binary
+    def builderTask = binary.tasks.builder
+    // Add output to jar file
+    jar.into("native/${targetPlatform.operatingSystem.name}/${targetPlatform.architecture.name}") { from builderTask.outputFile }
+    // Add depend on build
+    jar.dependsOn builderTask
+}
+
+// Helper class to wrap ant dowload task
+class MyDownload extends DefaultTask {
+    @Input
+    String sourceUrl
+
+    @OutputFile
+    File target
+
+    @TaskAction
+    void download() {
+       ant.get(src: sourceUrl, dest: target)
+    }
+}

+ 17 - 0
jme3-bullet/build.gradle

@@ -0,0 +1,17 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+sourceSets {
+    main {
+        java {
+            srcDir 'src/main/java'
+            srcDir 'src/common/java'
+        }
+    }
+}
+
+dependencies {
+    compile project(':jme3-core')
+    compile project(':jme3-terrain')
+}

+ 16 - 0
jme3-core/build.gradle

@@ -0,0 +1,16 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+sourceSets {
+    main {
+        java {
+            srcDir 'src/main/java'
+            srcDir 'src/plugins/java'
+            srcDir 'src/tools/java'
+        }
+    }
+}
+
+dependencies {
+}

+ 7 - 0
jme3-desktop/build.gradle

@@ -0,0 +1,7 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+}

+ 7 - 0
jme3-effects/build.gradle

@@ -0,0 +1,7 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+}

+ 47 - 0
jme3-examples/build.gradle

@@ -0,0 +1,47 @@
+//apply plugin:'application'
+
+if (!hasProperty('mainClass')) {
+    ext.mainClass = 'jme3test.TestChooser'
+}
+
+//mainClassName = ext.mainClass
+
+dependencies {
+    compile project(':jme3-blender')
+    compile project(':jme3-core')
+    compile project(':jme3-desktop')
+    compile project(':jme3-effects')
+//    compile project(':jme3-bullet')
+    compile project(':jme3-jbullet')
+    compile project(':jme3-jogg')
+//    compile project(':jme3-jogl')
+    compile project(':jme3-lwjgl')
+    compile project(':jme3-networking')
+    compile project(':jme3-niftygui')
+    compile project(':jme3-plugins')
+    compile project(':jme3-terrain')
+    compile project(':jme3-testdata')
+}
+
+jar.doFirst{
+    manifest {
+        attributes('Manifest-Version'       : '1.0',
+//                'Created-By'             : vendor,
+//                'Specification-Title'    : appName,
+//                'Specification-Version'  : version,
+//                'Specification-Vendor'   : vendor,
+//                'Implementation-Title'   : appName,
+//                'Implementation-Version' : version,
+//                'Implementation-Vendor'  : vendor,
+                'Main-Class'             : getProperty('mainClass'),
+                'Class-Path'             : configurations.compile.collect { 'lib/' + it.getName() }.join(' ') 
+        )
+    }
+}
+
+jar.dependsOn('copyLibs')
+
+task copyLibs(type: Copy){
+    from configurations.compile
+    into buildDir.path + '/' + libsDirName + '/lib'
+}

+ 19 - 0
jme3-jbullet/build.gradle

@@ -0,0 +1,19 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+sourceSets {
+    main {
+        java {
+            srcDir 'src/main/java'
+            srcDir '../jme3-bullet/src/common/java'
+        }
+    }
+}
+
+dependencies {
+    compile ('java3d:vecmath:1.3.1')
+    compile files('../lib/jbullet.jar', '../lib/stack-alloc.jar')
+    compile project(':jme3-core')
+    compile project(':jme3-terrain')
+}

+ 8 - 0
jme3-jogg/build.gradle

@@ -0,0 +1,8 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+    compile files('../lib/j-ogg-oggd.jar', '../lib/j-ogg-vorbisd.jar')
+}

+ 11 - 0
jme3-jogl/build.gradle

@@ -0,0 +1,11 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+    compile project(':jme3-desktop')
+    compile 'org.jogamp.gluegen:gluegen-rt-main:2.1.3'
+    compile 'org.jogamp.jogl:jogl-all-main:2.1.3'
+    compile 'org.jogamp.joal:joal-main:2.1.3'
+}

+ 9 - 0
jme3-lwjgl/build.gradle

@@ -0,0 +1,9 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+    compile project(':jme3-desktop')
+    compile 'org.lwjgl.lwjgl:lwjgl:2.9.0'
+}

+ 7 - 0
jme3-networking/build.gradle

@@ -0,0 +1,7 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+}

+ 16 - 0
jme3-niftygui/build.gradle

@@ -0,0 +1,16 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+repositories {
+    maven{
+        url 'http://nifty-gui.sourceforge.net/nifty-maven-repo'
+    }
+}
+
+dependencies {
+    compile project(':jme3-core')
+    compile 'lessvoid:nifty:1.3.3'
+    compile 'lessvoid:nifty-default-controls:1.3.3'
+//    compile 'lessvoid:nifty-style-black:1.3.3'
+}

+ 16 - 0
jme3-plugins/build.gradle

@@ -0,0 +1,16 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+sourceSets {
+    main {
+        java {
+            srcDir 'src/ogre/java'
+            srcDir 'src/xml/java'
+        }
+    }
+}
+
+dependencies {
+    compile project(':jme3-core')
+}

+ 7 - 0
jme3-terrain/build.gradle

@@ -0,0 +1,7 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+    compile project(':jme3-core')
+}

+ 6 - 0
jme3-testdata/build.gradle

@@ -0,0 +1,6 @@
+if (!hasProperty('mainClass')) {
+    ext.mainClass = ''
+}
+
+dependencies {
+}

BIN
lib/j-ogg-oggd.jar


BIN
lib/j-ogg-vorbisd.jar


BIN
lib/jbullet.jar


BIN
lib/stack-alloc.jar


+ 57 - 0
settings.gradle

@@ -0,0 +1,57 @@
+rootProject.name = 'jmonkeyengine'
+
+/**
+ * You can enable or disable different subprojects of the build here.
+ * 
+ * The SDK will only be built if the appropriate library folders exist,
+ * call the "prepareSdk" target to prepare building the SDK.
+ **/
+
+// Core classes, should work on all java platforms
+include 'jme3-core'
+include 'jme3-effects'
+include 'jme3-networking'
+include 'jme3-plugins'
+include 'jme3-terrain'
+
+// Desktop dependent java classes
+include 'jme3-desktop'
+include 'jme3-blender'
+include 'jme3-jogl'
+include 'jme3-lwjgl'
+
+// Other external dependencies
+include 'jme3-jbullet'
+include 'jme3-niftygui'
+include 'jme3-jogg'
+include 'jme3-android'
+
+//native builds
+include 'jme3-bullet' //java
+include 'jme3-bullet-native' //cpp
+include 'jme3-android-native' //cpp
+
+// Test Data project
+include 'jme3-testdata'
+
+// Example projects
+include 'jme3-examples'
+
+//include 'sdk'
+
+// Find the directories containing a 'build.gradle' file in the root directory
+// of the project. That is, every directory containing a 'build.gradle' will
+// be automatically the subproject of this project.
+/*def subDirs = rootDir.listFiles(new FileFilter() {
+    public boolean accept(File file) {
+        if (!file.isDirectory()) {
+            return false
+        }
+
+        return new File(file, 'build.gradle').isFile()
+    }
+});
+
+subDirs.each { File dir ->
+    include dir.name
+}*/