apply plugin: 'android' dependencies { compile fileTree(include: '*.jar', dir: 'libs') compile project(':GLWallpaperService') } android { compileSdkVersion 21 buildToolsVersion "21.1.2" compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 targetCompatibility JavaVersion.VERSION_1_7 } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] // jniLibs.srcDirs = ['jni'] jniLibs.srcDirs = ['libs'] jni.srcDirs = [] // disable automatic ndk-build call } // Move the tests to tests/java, tests/res, etc... instrumentTest.setRoot('tests') // Move the build types to build-types/ // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ... // This moves them out of them default location under src//... which would // conflict with src/ being used by the main source set. // Adding new build types or product flavors should be accompanied // by a similar customization. debug.setRoot('build-types/debug') release.setRoot('build-types/release') } project.ext.versionCodes = ['armeabi': 1, 'armeabi-v7a': 2, 'arm64-v8a': 3, 'mips': 5, 'mips64': 6, 'x86': 8, 'x86_64': 9] //versionCode digit for each supported ABI, with 64bit>32bit and x86>armeabi-* // put ndk-build in build's path, or replace below with its full path task ndkBuild(type: Exec) { Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) def ndkDir = properties.getProperty('ndk.dir') commandLine "$ndkDir/ndk-build", '-C', file('jni').absolutePath } // generate files early in the process task perlBuild(type: Exec) { commandLine 'perl', '-x../..', '../../generate_files.pl', 'sproingies', 'superquadrics', 'stonerview', 'unknownpleasures', 'bouncingcow', 'hypertorus', 'glhanoi' } task perlClean(type: Exec) { commandLine 'rm', '-f', '../../gen/glue.c', './res/values/items.xml', './res/values/strings.xml', './res/values/settings.xml' } task perlCleaner(type: Exec) { commandLine 'rm', '-rf', './res/xml', './src/org/jwz/xscreensaver/gen' } task objlibClean(type: Exec) { commandLine 'rm', '-rf', './obj/local', './libs/armeabi', './libs/armeabi-v7a', './libs/mips', './libs/x86' } // if perlBuild already generated file, do not run perlBuild again if (! file("../../gen/glue.c").exists()) { preBuild.dependsOn perlBuild } clean.dependsOn perlClean clean.dependsOn perlCleaner clean.dependsOn objlibClean // tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } defaultConfig { minSdkVersion 15 targetSdkVersion 21 } productFlavors { } buildTypes { debug { jniDebuggable true } } }