|
|
|
if (!hasProperty('mainClass')) {
|
|
|
|
ext.mainClass = ''
|
|
|
|
}
|
|
|
|
|
|
|
|
String classBuildDir = "${buildDir}" + File.separator + 'classes'
|
|
|
|
|
|
|
|
sourceSets {
|
|
|
|
main {
|
|
|
|
java {
|
|
|
|
srcDir 'src/main/java'
|
|
|
|
srcDir 'src/common/java'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile project(':jme3-core')
|
|
|
|
compile project(':jme3-terrain')
|
|
|
|
}
|
|
|
|
|
|
|
|
task generateNativeHeaders(type: Exec, dependsOn: classes) {
|
|
|
|
def files0 = fileTree("src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
|
|
def files1 = fileTree("src/common/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
|
|
def files2 = fileTree("../jme3-core/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
|
|
def files3 = fileTree("../jme3-core/src/plugins/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
|
|
def files4 = fileTree("../jme3-core/src/tools/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
|
|
def files5 = fileTree("../jme3-terrain/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
|
|
|
|
def classpath = sourceSets.main.runtimeClasspath.asPath
|
|
|
|
def nativeIncludes = new File(project(":jme3-bullet-native").projectDir, "src/native/cpp")
|
|
|
|
def filesList = "\"" + files0.join("\"\n\"") + "\"\n\"" + files1.join("\"\n\"") + "\"\n\"" + files2.join("\"\n\"") + "\"\n\"" + files3.join("\"\n\"") + "\"\n\"" + files4.join("\"\n\"") + "\"\n\"" + files5.join("\"\n\"") + "\""
|
|
|
|
new File("$projectDir/java_classes.jtxt").text = filesList.replaceAll(java.util.regex.Pattern.quote("\\"), java.util.regex.Matcher.quoteReplacement("/"))
|
|
|
|
executable org.gradle.internal.jvm.Jvm.current().getExecutable('javac')
|
|
|
|
args "-h", nativeIncludes
|
|
|
|
args "@$projectDir/java_classes.jtxt"
|
|
|
|
args '-d', classBuildDir
|
|
|
|
args "-encoding", "UTF-8"
|
|
|
|
}
|
|
|
|
|
|
|
|
assemble.dependsOn(generateNativeHeaders)
|