summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfredrossperry <fredrossperry@gmail.com>2016-07-01 10:10:28 -0700
committerfredrossperry <fredrossperry@gmail.com>2016-07-06 11:14:39 -0700
commit99f3402f454d2d526178a3ee96ab75cc33f8b18b (patch)
tree13aae71232e3792fce8d1ffe5dc6f6ccbe248c8f
parent294178d792835a2777ad451628181f6d756c3e0d (diff)
downloadmupdf-99f3402f454d2d526178a3ee96ab75cc33f8b18b.tar.xz
Android viewer - replace missing build.gradle file
also, change SUPPORT_GPROOF to FZ_ENABLE_GPRF
-rw-r--r--platform/android/viewer/build.gradle89
1 files changed, 89 insertions, 0 deletions
diff --git a/platform/android/viewer/build.gradle b/platform/android/viewer/build.gradle
new file mode 100644
index 00000000..1bd5313b
--- /dev/null
+++ b/platform/android/viewer/build.gradle
@@ -0,0 +1,89 @@
+import org.apache.tools.ant.taskdefs.condition.Os
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:1.2.3'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ }
+}
+
+apply plugin: 'com.android.application'
+
+dependencies {
+ compile fileTree(dir: 'libs', include: '*.so')
+}
+
+android {
+
+ compileSdkVersion 17
+ buildToolsVersion '21.1.2'
+
+ /* this stops gradle from making it's own Android.mk file */
+ sourceSets.main.jni.srcDirs = []
+
+ sourceSets {
+ main {
+ manifest {
+ srcFile 'AndroidManifest.xml'
+ }
+ java {
+ srcDir 'src'
+ exclude 'com/artifex/mupdf/fitz/AndroidDrawDevice.java'
+ }
+ res {
+ srcDir 'res'
+ }
+ assets {
+ srcDir 'assets'
+ }
+ resources {
+ srcDir 'src'
+ }
+ jniLibs {
+ srcDir 'libs'
+ }
+ }
+ }
+
+ /* This is important, it will run lint checks but won't abort build */
+ lintOptions {
+ abortOnError false
+ }
+
+}
+
+/* This defines the path to Android's ndk-build. */
+def ndkBuildPath = plugins.getPlugin('com.android.application').sdkHandler.getNdkFolder().absolutePath + File.separator + 'ndk-build'
+if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ ndkBuildPath +='.cmd'
+}
+
+/* This task builds the native part */
+task buildNative(type: Exec,description: 'Compile JNI source via NDK') {
+ println('executing buildNative')
+ commandLine ndkBuildPath, '-C', file('.').absolutePath, ' FZ_ENABLE_GPRF=1'
+ //'NDK_PROJECT_PATH=build','APP_BUILD_SCRIPT=src/main/jni/Android.mk'//force using appropriate Makefile
+}
+
+/* This task cleans the native part */
+task cleanNative(type: Exec, description: 'Clean JNI object files') {
+ println('executing cleanNative')
+ commandLine ndkBuildPath, '-C', file('.').absolutePath, 'clean'
+}
+
+/* cleaning should also include cleaning native */
+clean.dependsOn 'cleanNative'
+
+/* building should include native */
+tasks.withType(JavaCompile){
+ compileTask -> compileTask.dependsOn buildNative
+}
+