Permalink
89d35ca Jan 5, 2017
@codeanticode @jwill
96 lines (80 sloc) 3.53 KB
apply plugin: 'java'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath group: 'commons-io', name: 'commons-io', version: '2.5'
classpath group: 'org.zeroturnaround', name: 'zt-zip', version: '1.9'
}
}
allprojects {
apply plugin: 'java'
ext.android_platform = "$sdkdir/platforms/android-$sdkver"
ext.core_jar_path = "$rootDir/android-core.zip"
repositories {
jcenter()
flatDir dirs: "$rootDir/core/library"
flatDir dirs: "$rootDir/core/build/libs"
flatDir dirs: "$rootDir/libraries/cardboard/lib"
flatDir dirs: android_platform
}
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
dependencies {
compile name: 'android'
compile project(":core")
compile project(":libraries:cardboard")
compile group: 'org.processing', name: 'core', version: '3.2.3'
compile group: 'org.processing', name: 'pde', version: '3.2.3'
compile group: 'org.processing', name: 'java-mode', version: '3.2.3'
}
sourceSets {
main {
java {
srcDirs = ['src/']
}
}
}
import java.nio.file.Files
import org.zeroturnaround.zip.ZipUtil
import org.apache.commons.io.FileUtils
import static java.nio.file.StandardCopyOption.*;
task dist {
try {
def root = "$buildDir/zip/AndroidMode"
// Copy assets to build dir
FileUtils.copyDirectory(file("templates"), file("$root/templates"))
FileUtils.copyDirectory(file("examples"), file("$root/examples"))
FileUtils.copyDirectory(file("icons"), file("$root/icons"))
FileUtils.copyDirectory(file("mode"), file("$root/mode"))
FileUtils.copyDirectory(file("theme"), file("$root/theme"))
Files.copy(file("$buildDir/libs/processing-android.jar").toPath(),
file("$root/mode/AndroidMode.jar").toPath(), REPLACE_EXISTING);
Files.copy(file("$buildDir/libs/processing-android.jar").toPath(),
file("mode/AndroidMode.jar").toPath(), REPLACE_EXISTING);
Files.copy(file("core/build/libs/android-core.zip").toPath(),
file("$root/android-core.zip").toPath(), REPLACE_EXISTING);
Files.copy(file("mode.properties").toPath(),
file("$root/mode.properties").toPath(), REPLACE_EXISTING);
FileUtils.copyDirectory(file("libraries/cardboard/examples"),
file("$root/libraries/cardboard/examples"))
FileUtils.copyDirectory(file("libraries/cardboard/gvrsdk"),
file("$root/libraries/cardboard/gvrsdk"))
FileUtils.copyDirectory(file("libraries/cardboard/lib"),
file("$root/libraries/cardboard/lib"))
FileUtils.copyDirectory(file("libraries/cardboard/library"),
file("$root/libraries/cardboard/library"))
FileUtils.copyDirectory(file("libraries/cardboard/src"),
file("$root/libraries/cardboard/src"))
Files.copy(file("libraries/cardboard/library.properties").toPath(),
file("$root/libraries/cardboard/library.properties").toPath(), REPLACE_EXISTING);
ZipUtil.pack(file("$buildDir/zip"), new File("release/AndroidMode.zip"))
Files.copy(file("mode.properties").toPath(),
file("release/AndroidMode.txt").toPath(), REPLACE_EXISTING);
} catch (Exception ex) {
logger.error ex.getMessage()
}
}
dist.dependsOn build