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