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() // } // } //}