1 { 2 'targets': [ 3 { 4 'target_name': 'CopySampleAppDeps', 5 'type': 'none', 6 'dependencies': [ 7 'skia_lib.gyp:skia_lib', 8 'SampleApp.gyp:SampleApp', 9 ], 10 'variables': { 11 'conditions': [ 12 [ 'skia_arch_type == "x86"', { 13 'android_arch%': "x86", 14 }, { 15 'conditions': [ 16 [ 'arm_version == 7', { 17 'android_arch%': "armeabi-v7a", 18 }, { 19 'android_arch%': "armeabi", 20 }], 21 ], 22 }], 23 ], 24 }, 25 'copies': [ 26 # Copy all shared libraries into the Android app's libs folder. Note 27 # that this copy requires us to build SkiaAndroidApp after those 28 # libraries, so that they exist by the time it occurs. If there are no 29 # libraries to copy, this will cause an error in Make, but the app will 30 # still build. 31 { 32 'destination': '<(PRODUCT_DIR)/android/libs/<(android_arch)', 33 'conditions': [ 34 [ 'skia_shared_lib', { 35 'files': [ 36 '<(SHARED_LIB_DIR)/libSampleApp.so', 37 '<(SHARED_LIB_DIR)/libskia_android.so', 38 ]}, { 39 'files': [ 40 '<(SHARED_LIB_DIR)/libSampleApp.so', 41 ]} 42 ], 43 ], 44 }, 45 ], 46 }, 47 { 48 'target_name': 'SampleApp_APK', 49 'type': 'none', 50 'dependencies': [ 51 'CopySampleAppDeps', 52 ], 53 'variables': { 54 'ANDROID_SDK_ROOT': '<!(echo $ANDROID_SDK_ROOT)', 55 # the ninja generator treats PRODUCT_DIR as a relative path to the 56 # gyp directory but android ant build wants a path relative to the 57 # build.xml file so we do that adjustment here. 58 'ANDROID_OUT': '../../<(PRODUCT_DIR)/android' 59 }, 60 'actions': [ 61 { 62 'action_name': 'SkiaAndroid_apk', 63 'inputs': [ 64 '<(android_base)/app/AndroidManifest.xml', 65 '<(android_base)/app/build.xml', 66 '<(android_base)/app/project.properties', 67 '<(android_base)/app/jni/com_skia_SkiaSampleRenderer.h', 68 '<(android_base)/app/jni/com_skia_SkiaSampleRenderer.cpp', 69 '<(android_base)/app/src/com/skia/SkiaSampleActivity.java', 70 '<(android_base)/app/src/com/skia/SkiaSampleRenderer.java', 71 '<(android_base)/app/src/com/skia/SkiaSampleView.java', 72 ], 73 'outputs': [ 74 '<(PRODUCT_DIR)/../android/bin/SkiaAndroid.apk', 75 ], 76 'action': [ 77 'ant', 78 '-quiet', 79 '-f', 80 '<(android_base)/app/build.xml', 81 '-Dout.dir=<(ANDROID_OUT)/bin', 82 '-Dgen.absolute.dir=<(ANDROID_OUT)/gen', 83 '-Dnative.libs.absolute.dir=<(ANDROID_OUT)/libs', 84 '-Dout.final.file=<(ANDROID_OUT)/bin/SkiaAndroid.apk', 85 '-Dsdk.dir=<(ANDROID_SDK_ROOT)', 86 'debug', 87 ], 88 }, 89 ], 90 }, 91 ], 92 } 93