diff options
30 files changed, 254 insertions, 220 deletions
diff --git a/.gitignore b/.gitignore index 44d423f269..7ea825655a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,12 @@ *.pyc *.swp +*.iml .DS_Store .android_config .gclient* .gm-actuals +.gradle +.idea .cproject .project .settings/ @@ -12,6 +15,10 @@ bower_components common gyp/build out +platform_tools/android/apps/build +platform_tools/android/apps/*.properties +platform_tools/android/apps/*/build +platform_tools/android/apps/*/src/main/libs platform_tools/chromeos/third_party/externals platform_tools/chromeos/toolchain skps diff --git a/platform_tools/android/app/build.xml b/platform_tools/android/app/build.xml deleted file mode 100644 index fbba716abb..0000000000 --- a/platform_tools/android/app/build.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="SkiaAndroid" default="help"> - - <!-- The local.properties file is created and updated by the 'android' tool. - It contains the path to the SDK. It should *NOT* be checked into - Version Control Systems. --> - <property file="local.properties" /> - - <!-- The project.properties file is created and updated by the 'android' - tool, as well as ADT. - - This contains project specific properties such as project target, and library - dependencies. Lower level build properties are stored in ant.properties - (or in .classpath for Eclipse projects). - - This file is an integral part of the build system for your - application and should be checked into Version Control Systems. --> - <loadproperties srcFile="project.properties" /> - - <!-- quick check on sdk.dir --> - <fail - message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" - unless="sdk.dir" - /> - - <!-- - Import per project custom build rules if present at the root of the project. - This is the place to put custom intermediary targets such as: - -pre-build - -pre-compile - -post-compile (This is typically used for code obfuscation. - Compiled code location: ${out.classes.absolute.dir} - If this is not done in place, override ${out.dex.input.absolute.dir}) - -post-package - -post-build - -pre-clean - --> - <import file="custom_rules.xml" optional="true" /> - - <!-- Import the actual build file. - - To customize existing targets, there are two options: - - Customize only one target: - - copy/paste the target into this file, *before* the - <import> task. - - customize it to your needs. - - Customize the whole content of build.xml - - copy/paste the content of the rules files (minus the top node) - into this file, replacing the <import> task. - - customize to your needs. - - *********************** - ****** IMPORTANT ****** - *********************** - In all cases you must update the value of version-tag below to read 'custom' instead of an integer, - in order to avoid having your file be overridden by tools such as "android update project" - --> - <!-- version-tag: 1 --> - <import file="${sdk.dir}/tools/ant/build.xml" /> - -</project> diff --git a/platform_tools/android/app/project.properties b/platform_tools/android/app/project.properties deleted file mode 100644 index 4ab125693c..0000000000 --- a/platform_tools/android/app/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-19 diff --git a/platform_tools/android/apps/build.gradle b/platform_tools/android/apps/build.gradle new file mode 100644 index 0000000000..b20334b887 --- /dev/null +++ b/platform_tools/android/apps/build.gradle @@ -0,0 +1,86 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:1.2.3' + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle files + } +} + +allprojects { + repositories { + jcenter() + } +} + +def getLocalProperties() { + Properties properties = new Properties() + File propFile = project.rootProject.file('local.properties') + if (propFile.canRead()) { + properties.load(propFile.newDataInputStream()) + } + propFile = project.rootProject.file('gradle.properties') + if (propFile.canRead()) { + properties.load(propFile.newDataInputStream()) + } + return properties +} + +def getSDKPath() { + String path = System.getenv("ANDROID_SDK_ROOT") + if (path == null) { + path = getLocalProperties().getProperty('sdk.dir', null) + } + + if (path == null) { + throw new GradleScriptException("Android SDK not found! Please set ANDROID_SDK_ROOT to" + + " your path or define sdk.dir in gradle.properties") + } + return path +} + +def getPathWithDepotTools() { + System.getenv("PATH") + ":" + getLocalProperties().getProperty('depot_tools.dir', null) + String path = System.getenv("PATH") + if (!path.contains("depot_tools")) { + path += ":" + getLocalProperties().getProperty('depot_tools.dir', null) + } + + if (!path.contains("depot_tools")) { + throw GradleScriptException("Depot Tools not found! Please update your path to include" + + " depot_tools or define depot_tools.dir in gradle.properties") + } + return path +} + +def constructBuildCommand(variant, buildTarget) { + String cmdLine = "./platform_tools/android/bin/android_ninja $buildTarget" + String deviceType = null + if (variant.name.startsWith("arm64")) { + deviceType = "arm64" + } else if (variant.name.startsWith("arm")) { + deviceType = "arm_v7_neon" + } else if (variant.name.startsWith("x86_64")) { + deviceType = "x86_64" + } else if (variant.name.startsWith("x86")) { + deviceType = "x86" + } else if (variant.name.startsWith("mips")) { + deviceType = "mips" + } else if (variant.name.startsWith("mips64")) { + deviceType = "mips64" + } + + if (deviceType != null) { + cmdLine += " -d " + deviceType + } + + if (variant.name.endsWith("Release")) { + cmdLine += " --release" + } + return cmdLine +}
\ No newline at end of file diff --git a/platform_tools/android/apps/sample_app/build.gradle b/platform_tools/android/apps/sample_app/build.gradle new file mode 100644 index 0000000000..e2986e09a4 --- /dev/null +++ b/platform_tools/android/apps/sample_app/build.gradle @@ -0,0 +1,46 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 19 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "com.skia.sample_app" + minSdkVersion 9 + targetSdkVersion 19 + versionCode 1 + versionName "1.0" + } + + sourceSets.main.jni.srcDirs = [] //disable automatic ndk-build call + sourceSets.main.jniLibs.srcDir "src/main/libs" + + productFlavors { + arm {} + arm64 {} + x86 {} + x86_64 {} + mips {} + mips64 {} + } + + // make sure that app is built and shared libraries are copied to correct directories + applicationVariants.all{ variant -> + + def buildNativeLib = task("${variant.name}_NativeLib", type:Exec) { + workingDir '../../../..' // top-level skia directory + commandLine constructBuildCommand(variant, "CopySampleAppDeps").split() + environment PATH: getPathWithDepotTools() + environment ANDROID_SDK_ROOT: getSDKPath() + } + + buildNativeLib.onlyIf { !project.hasProperty("suppressNativeBuild") } + + TaskCollection<Task> assembleTask + assembleTask = project.tasks.matching { + it.name.contains("assemble") && + it.name.toLowerCase().endsWith(variant.name.toLowerCase()) + } + assembleTask.getAt(0).dependsOn buildNativeLib + } +}
\ No newline at end of file diff --git a/platform_tools/android/app/AndroidManifest.xml b/platform_tools/android/apps/sample_app/src/main/AndroidManifest.xml index edb0424ba8..edb0424ba8 100644 --- a/platform_tools/android/app/AndroidManifest.xml +++ b/platform_tools/android/apps/sample_app/src/main/AndroidManifest.xml diff --git a/platform_tools/android/app/src/com/skia/SkiaSampleActivity.java b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleActivity.java index d9cd9f887d..d9cd9f887d 100644 --- a/platform_tools/android/app/src/com/skia/SkiaSampleActivity.java +++ b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleActivity.java diff --git a/platform_tools/android/app/src/com/skia/SkiaSampleRenderer.java b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleRenderer.java index 55257094cd..55257094cd 100644 --- a/platform_tools/android/app/src/com/skia/SkiaSampleRenderer.java +++ b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleRenderer.java diff --git a/platform_tools/android/app/src/com/skia/SkiaSampleView.java b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleView.java index c33f8ae8ac..c33f8ae8ac 100644 --- a/platform_tools/android/app/src/com/skia/SkiaSampleView.java +++ b/platform_tools/android/apps/sample_app/src/main/java/com/skia/SkiaSampleView.java diff --git a/platform_tools/android/app/jni/AndroidKeyToSkKey.h b/platform_tools/android/apps/sample_app/src/main/jni/AndroidKeyToSkKey.h index 6bcb148b46..6bcb148b46 100644 --- a/platform_tools/android/app/jni/AndroidKeyToSkKey.h +++ b/platform_tools/android/apps/sample_app/src/main/jni/AndroidKeyToSkKey.h diff --git a/platform_tools/android/app/jni/com_skia_SkiaSampleRenderer.cpp b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp index d66221a01c..d66221a01c 100644 --- a/platform_tools/android/app/jni/com_skia_SkiaSampleRenderer.cpp +++ b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp diff --git a/platform_tools/android/app/jni/com_skia_SkiaSampleRenderer.h b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.h index 8883a3a9f0..8883a3a9f0 100644 --- a/platform_tools/android/app/jni/com_skia_SkiaSampleRenderer.h +++ b/platform_tools/android/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.h diff --git a/platform_tools/android/app/res/drawable-hdpi/ic_btn_find_next.png b/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_next.png Binary files differindex b696a6bb22..b696a6bb22 100644 --- a/platform_tools/android/app/res/drawable-hdpi/ic_btn_find_next.png +++ b/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_next.png diff --git a/platform_tools/android/app/res/drawable-hdpi/ic_btn_find_prev.png b/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_prev.png Binary files differindex 5550c5a6ff..5550c5a6ff 100644 --- a/platform_tools/android/app/res/drawable-hdpi/ic_btn_find_prev.png +++ b/platform_tools/android/apps/sample_app/src/main/res/drawable-hdpi/ic_btn_find_prev.png diff --git a/platform_tools/android/app/res/layout/layout.xml b/platform_tools/android/apps/sample_app/src/main/res/layout/layout.xml index cdb90e9961..cdb90e9961 100644 --- a/platform_tools/android/app/res/layout/layout.xml +++ b/platform_tools/android/apps/sample_app/src/main/res/layout/layout.xml diff --git a/platform_tools/android/app/res/menu/action_bar.xml b/platform_tools/android/apps/sample_app/src/main/res/menu/action_bar.xml index 72e135e43b..72e135e43b 100644 --- a/platform_tools/android/app/res/menu/action_bar.xml +++ b/platform_tools/android/apps/sample_app/src/main/res/menu/action_bar.xml diff --git a/platform_tools/android/app/res/values/strings.xml b/platform_tools/android/apps/sample_app/src/main/res/values/strings.xml index b0b4e7b74b..b0b4e7b74b 100644 --- a/platform_tools/android/app/res/values/strings.xml +++ b/platform_tools/android/apps/sample_app/src/main/res/values/strings.xml diff --git a/platform_tools/android/apps/settings.gradle b/platform_tools/android/apps/settings.gradle new file mode 100644 index 0000000000..89cc95447b --- /dev/null +++ b/platform_tools/android/apps/settings.gradle @@ -0,0 +1,2 @@ +include ':sample_app' +include ':visualbench' diff --git a/platform_tools/android/apps/visualbench/build.gradle b/platform_tools/android/apps/visualbench/build.gradle new file mode 100644 index 0000000000..476d7ed66a --- /dev/null +++ b/platform_tools/android/apps/visualbench/build.gradle @@ -0,0 +1,46 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 19 + buildToolsVersion "22.0.1" + + defaultConfig { + applicationId "com.skia.visualbench" + minSdkVersion 9 + targetSdkVersion 19 + versionCode 1 + versionName "1.0" + } + + sourceSets.main.jni.srcDirs = [] //disable automatic ndk-build call + sourceSets.main.jniLibs.srcDir "src/main/libs" + + productFlavors { + arm {} + arm64 {} + x86 {} + x86_64 {} + mips {} + mips64 {} + } + + // make sure that app is built and shared libraries are copied to correct directories + applicationVariants.all{ variant -> + + def buildNativeLib = task("${variant.name}_NativeLib", type:Exec) { + workingDir '../../../..' // top-level skia directory + commandLine constructBuildCommand(variant, "CopyVisualBenchDeps").split() + environment PATH: getPathWithDepotTools() + environment ANDROID_SDK_ROOT: getSDKPath() + } + + buildNativeLib.onlyIf { !project.hasProperty("suppressNativeBuild") } + + TaskCollection<Task> assembleTask + assembleTask = project.tasks.matching { + it.name.contains("assemble") && + it.name.toLowerCase().endsWith(variant.name.toLowerCase()) + } + assembleTask.getAt(0).dependsOn buildNativeLib + } +}
\ No newline at end of file diff --git a/platform_tools/android/visualbench/AndroidManifest.xml b/platform_tools/android/apps/visualbench/src/main/AndroidManifest.xml index c15dee6e16..c15dee6e16 100644 --- a/platform_tools/android/visualbench/AndroidManifest.xml +++ b/platform_tools/android/apps/visualbench/src/main/AndroidManifest.xml diff --git a/platform_tools/android/visualbench/src/com/skia/VisualBenchActivity.java b/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java index 90f70bfe0a..90f70bfe0a 100644 --- a/platform_tools/android/visualbench/src/com/skia/VisualBenchActivity.java +++ b/platform_tools/android/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java diff --git a/platform_tools/android/visualbench/jni/SkOSWindow_AndroidNative.cpp b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp index e2bc99610f..e2bc99610f 100644 --- a/platform_tools/android/visualbench/jni/SkOSWindow_AndroidNative.cpp +++ b/platform_tools/android/apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp diff --git a/platform_tools/android/visualbench/jni/main.cpp b/platform_tools/android/apps/visualbench/src/main/jni/main.cpp index 2ea6b76b39..2ea6b76b39 100644 --- a/platform_tools/android/visualbench/jni/main.cpp +++ b/platform_tools/android/apps/visualbench/src/main/jni/main.cpp diff --git a/platform_tools/android/bin/android_install_app b/platform_tools/android/bin/android_install_app index a8c1a12b2b..ed5ed61318 100755 --- a/platform_tools/android/bin/android_install_app +++ b/platform_tools/android/bin/android_install_app @@ -9,7 +9,7 @@ function print_usage { echo " -h Prints this help message" echo " --release Install the release build of Skia" echo " -s [device_s/n] Serial number of the device to be used" - echo " AppName Can be either SampleApp or VisualBench" + echo " AppName Can be either sample_app or VisualBench" } SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -18,8 +18,6 @@ source $SCRIPT_DIR/android_setup.sh source $SCRIPT_DIR/utils/setup_adb.sh forceRemoval="false" -installLauncher="false" -installOptions="-r" app="" for arg in ${APP_ARGS[@]}; do @@ -45,8 +43,8 @@ for arg in ${APP_ARGS[@]}; do done if [[ ${app} == "" ]]; then - echo "defaulting to installing SampleApp." - app="SampleApp" + echo "defaulting to installing sample_app." + app="sample_app" fi @@ -56,6 +54,8 @@ then $ADB ${DEVICE_SERIAL} uninstall com.skia > /dev/null fi -echo "Installing ${app} from ${SKIA_OUT}/${BUILDTYPE}" -$ADB ${DEVICE_SERIAL} install ${installOptions} ${SKIA_OUT}/${BUILDTYPE}/android/${app}/bin/${app}.apk +BUILD_TYPE_LC=$(echo $BUILDTYPE | tr "[:upper:]" "[:lower:]") + +echo "Installing ${app} from ${app}/build/outputs/apk/${app}-${ANDROID_ARCH}-${BUILD_TYPE_LC}.apk" +$ADB ${DEVICE_SERIAL} install -r ${SCRIPT_DIR}/../apps/${app}/build/outputs/apk/${app}-${ANDROID_ARCH}-${BUILD_TYPE_LC}.apk diff --git a/platform_tools/android/bin/android_setup.sh b/platform_tools/android/bin/android_setup.sh index 94ae87f9a1..5396294c7f 100755 --- a/platform_tools/android/bin/android_setup.sh +++ b/platform_tools/android/bin/android_setup.sh @@ -70,6 +70,11 @@ if [ -z "$ANDROID_SDK_ROOT" ]; then fi fi +if [ -z "$ANDROID_HOME" ]; then + echo "ANDROID_HOME not set so we are setting it to a default value of ANDROID_SDK_ROOT" + exportVar ANDROID_HOME $ANDROID_SDK_ROOT +fi + # check to see that gclient sync ran successfully THIRD_PARTY_EXTERNAL_DIR=${SCRIPT_DIR}/../third_party/externals if [ ! -d "$THIRD_PARTY_EXTERNAL_DIR" ]; then diff --git a/platform_tools/android/gyp/dependencies.gypi b/platform_tools/android/gyp/dependencies.gypi index 8be6836f37..036abf2cc5 100644 --- a/platform_tools/android/gyp/dependencies.gypi +++ b/platform_tools/android/gyp/dependencies.gypi @@ -287,7 +287,7 @@ }], ], 'sources': [ - '../app/jni/com_skia_SkiaSampleRenderer.cpp', + '../apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp', ], }, }, @@ -320,8 +320,8 @@ '../../../tools/VisualBench/', ], 'sources': [ - '../visualbench/jni/SkOSWindow_AndroidNative.cpp', - '../visualbench/jni/main.cpp', + '../apps/visualbench/src/main/jni/SkOSWindow_AndroidNative.cpp', + '../apps/visualbench/src/main/jni/main.cpp', ], }, }, diff --git a/platform_tools/android/gyp/skia_android.gypi b/platform_tools/android/gyp/skia_android.gypi index e8bf1c3150..6ffb49cd93 100644 --- a/platform_tools/android/gyp/skia_android.gypi +++ b/platform_tools/android/gyp/skia_android.gypi @@ -12,24 +12,31 @@ 'conditions': [ [ 'skia_arch_type == "arm" and arm_version != 7', { 'android_arch%': "armeabi", + 'android_variant%': "arm", }], [ 'skia_arch_type == "arm" and arm_version == 7', { 'android_arch%': "armeabi-v7a", + 'android_variant%': "arm", }], [ 'skia_arch_type == "arm64"', { 'android_arch%': "arm64-v8a", + 'android_variant%': "arm64", }], [ 'skia_arch_type == "x86"', { 'android_arch%': "x86", + 'android_variant%': "x86", }], [ 'skia_arch_type == "x86_64"', { 'android_arch%': "x86_64", + 'android_variant%': "x86_64", }], [ 'skia_arch_type == "mips" and skia_arch_width == 32', { 'android_arch%': "mips", + 'android_variant%': "mips", }], [ 'skia_arch_type == "mips" and skia_arch_width == 64', { 'android_arch%': "mips64", + 'android_variant%': "mips64", }], ], }, @@ -48,7 +55,7 @@ # libraries to copy, this will cause an error in Make, but the app will # still build. { - 'destination': '<(PRODUCT_DIR)/android/SampleApp/libs/<(android_arch)', + 'destination': '<(android_base)/apps/sample_app/src/main/libs/<(android_arch)', 'conditions': [ [ 'skia_shared_lib', { 'files': [ @@ -69,40 +76,25 @@ 'dependencies': [ 'CopySampleAppDeps', ], - 'variables': { - 'ANDROID_SDK_ROOT': '<!(echo $ANDROID_SDK_ROOT)', - # the ninja generator treats PRODUCT_DIR as a relative path to the - # gyp directory but android ant build wants a path relative to the - # build.xml file so we do that adjustment here. - 'ANDROID_OUT': '../../<(PRODUCT_DIR)/android/SampleApp' - }, 'actions': [ { 'action_name': 'SampleApp_apk', 'inputs': [ - '<(android_base)/app/AndroidManifest.xml', - '<(android_base)/app/build.xml', - '<(android_base)/app/project.properties', - '<(android_base)/app/jni/com_skia_SkiaSampleRenderer.h', - '<(android_base)/app/jni/com_skia_SkiaSampleRenderer.cpp', - '<(android_base)/app/src/com/skia/SkiaSampleActivity.java', - '<(android_base)/app/src/com/skia/SkiaSampleRenderer.java', - '<(android_base)/app/src/com/skia/SkiaSampleView.java', + '<(android_base)/apps/sample_app/src/main/AndroidManifest.xml', + '<(android_base)/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.h', + '<(android_base)/apps/sample_app/src/main/jni/com_skia_SkiaSampleRenderer.cpp', + '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleActivity.java', + '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleRenderer.java', + '<(android_base)/apps/sample_app/src/main/java/com/skia/SkiaSampleView.java', ], 'outputs': [ - '<(PRODUCT_DIR)/../android/SampleApp/bin/SampleApp.apk', + '<(android_base)/apps/sample_app/build', ], 'action': [ - 'ant', - '-quiet', - '-f', - '<(android_base)/app/build.xml', - '-Dout.dir=<(ANDROID_OUT)/bin', - '-Dgen.absolute.dir=<(ANDROID_OUT)/gen', - '-Dnative.libs.absolute.dir=<(ANDROID_OUT)/libs', - '-Dout.final.file=<(ANDROID_OUT)/bin/SampleApp.apk', - '-Dsdk.dir=<(ANDROID_SDK_ROOT)', - 'debug', + '<(android_base)/apps/gradlew', + ':sample_app:assemble<(android_variant)Debug', + '-p<(android_base)/apps/sample_app', + '-PsuppressNativeBuild', ], }, ], @@ -122,7 +114,7 @@ # libraries to copy, this will cause an error in Make, but the app will # still build. { - 'destination': '<(PRODUCT_DIR)/android/VisualBench/libs/<(android_arch)', + 'destination': '<(android_base)/apps/visualbench/src/main/libs/<(android_arch)', 'conditions': [ [ 'skia_shared_lib', { 'files': [ @@ -143,36 +135,21 @@ 'dependencies': [ 'CopyVisualBenchDeps', ], - 'variables': { - 'ANDROID_SDK_ROOT': '<!(echo $ANDROID_SDK_ROOT)', - # the ninja generator treats PRODUCT_DIR as a relative path to the - # gyp directory but android ant build wants a path relative to the - # build.xml file so we do that adjustment here. - 'ANDROID_OUT': '../../<(PRODUCT_DIR)/android/VisualBench/' - }, 'actions': [ { 'action_name': 'SkiaVisualBench_apk', 'inputs': [ - '<(android_base)/visualbench/AndroidManifest.xml', - '<(android_base)/visualbench/build.xml', - '<(android_base)/visualbench/project.properties', - '<(android_base)/visualbench/src/com/skia/VisualBenchActivity.java', + '<(android_base)/apps/visualbench/src/main/AndroidManifest.xml', + '<(android_base)/apps/visualbench/src/main/java/com/skia/VisualBenchActivity.java', ], 'outputs': [ - '<(PRODUCT_DIR)/../android/VisualBench/bin/VisualBench.apk', + '<(android_base)/apps/visualbench/build', ], 'action': [ - 'ant', - '-quiet', - '-f', - '<(android_base)/visualbench/build.xml', - '-Dout.dir=<(ANDROID_OUT)/bin', - '-Dgen.absolute.dir=<(ANDROID_OUT)/gen', - '-Dnative.libs.absolute.dir=<(ANDROID_OUT)/libs', - '-Dout.final.file=<(ANDROID_OUT)/bin/VisualBench.apk', - '-Dsdk.dir=<(ANDROID_SDK_ROOT)', - 'debug', + '<(android_base)/apps/gradlew', + ':visualbench:assemble<(android_variant)Debug', + '-p<(android_base)/apps/visualbench', + '-PsuppressNativeBuild', ], }, ], diff --git a/platform_tools/android/visualbench/build.xml b/platform_tools/android/visualbench/build.xml deleted file mode 100644 index 61df264754..0000000000 --- a/platform_tools/android/visualbench/build.xml +++ /dev/null @@ -1,61 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project name="VisualBench" default="help"> - - <!-- The local.properties file is created and updated by the 'android' tool. - It contains the path to the SDK. It should *NOT* be checked into - Version Control Systems. --> - <property file="local.properties" /> - - <!-- The project.properties file is created and updated by the 'android' - tool, as well as ADT. - - This contains project specific properties such as project target, and library - dependencies. Lower level build properties are stored in ant.properties - (or in .classpath for Eclipse projects). - - This file is an integral part of the build system for your - application and should be checked into Version Control Systems. --> - <loadproperties srcFile="project.properties" /> - - <!-- quick check on sdk.dir --> - <fail - message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var" - unless="sdk.dir" - /> - - <!-- - Import per project custom build rules if present at the root of the project. - This is the place to put custom intermediary targets such as: - -pre-build - -pre-compile - -post-compile (This is typically used for code obfuscation. - Compiled code location: ${out.classes.absolute.dir} - If this is not done in place, override ${out.dex.input.absolute.dir}) - -post-package - -post-build - -pre-clean - --> - <import file="custom_rules.xml" optional="true" /> - - <!-- Import the actual build file. - - To customize existing targets, there are two options: - - Customize only one target: - - copy/paste the target into this file, *before* the - <import> task. - - customize it to your needs. - - Customize the whole content of build.xml - - copy/paste the content of the rules files (minus the top node) - into this file, replacing the <import> task. - - customize to your needs. - - *********************** - ****** IMPORTANT ****** - *********************** - In all cases you must update the value of version-tag below to read 'custom' instead of an integer, - in order to avoid having your file be overridden by tools such as "android update project" - --> - <!-- version-tag: 1 --> - <import file="${sdk.dir}/tools/ant/build.xml" /> - -</project> diff --git a/platform_tools/android/visualbench/project.properties b/platform_tools/android/visualbench/project.properties deleted file mode 100644 index 4ab125693c..0000000000 --- a/platform_tools/android/visualbench/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# This file is automatically generated by Android Tools. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file must be checked in Version Control Systems. -# -# To customize properties used by the Ant build system edit -# "ant.properties", and override values to adapt the script to your -# project structure. -# -# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): -#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt - -# Project target. -target=android-19 diff --git a/site/user/quick/android.md b/site/user/quick/android.md index 44e3161c40..57d45d5259 100644 --- a/site/user/quick/android.md +++ b/site/user/quick/android.md @@ -10,20 +10,12 @@ _Currently we only support building Skia for Android on a Linux or Mac host! In The following libraries/utilities are required in addition to those needed for a standard skia checkout: - * Apache Ant * The Android SDK: http://developer.android.com/sdk/ -~~~~ -$ sudo apt-get install ant git -~~~~ - Check out the source code ------------------------- -Follow the instructions [here](../download) for downloading the Skia source. Modify .gclient to add the following line to -the bottom, and then run gclient sync again: - - target_os = ["android"] +Follow the instructions [here](../download) for downloading the Skia source. Inside your Skia checkout, `platform_tools/android` contains the Android setup scripts, Android specific dependencies, and the Android Sample App. @@ -63,6 +55,7 @@ the -d option plus any of the options or arguments you would normally pass to ninja (see descriptions of some of the other flags here). export ANDROID_SDK_ROOT=/path/to/android/sdk + export ANDROID_HOME=/path/to/android/sdk export PATH=$PATH:/path/to/depot_tools cd skia @@ -135,7 +128,7 @@ Build and run SampleApp The SampleApp on Android provides a simple UI for viewing sample slides and gm images. - BUILDTYPE=Debug ./platform_tools/android/bin/android_ninja -d $TARGET_DEVICE + BUILDTYPE=Debug ./platform_tools/android/bin/android_ninja -d $TARGET_DEVICE SampleApp_APK Then, install the app onto the device: @@ -155,6 +148,28 @@ params... --resourcePath /data/local/tmp/skia_resoures --pictureDir /data/local/tmp/skia_skp + +Android Studio Support +----------------------- + +You can also build and run SampleApp (and some other experimental apps) using Android +Studio. To create the project either select "import project" from the quickstart +screen or use File -> Open. In both cases you'll need to select ./platform_tools/android/apps +as the root directory of your project. + +Finally to be able to build within Android studio it needs to know the path to +ninja so you will need to add a properties file and populate it with the path +to depot_tools. The syntax and location of that file is... + + # + # file location: ./platform_tools/android/apps/gradle.properties + # + depot_tools.dir=<path_to_depot_tools> + +That should be all the setup you need. You should now be able to build and deploy +SampleApp on ARM, Intel, and MIPS devices. + + Build tools ----------- |