aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2018-06-01 20:22:25 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-01 20:22:37 +0000
commita0834048380c51f9e45063e3ae40a142a6f7f2d1 (patch)
tree1e57c75af9d7b3f1e314029c230bce4ebdcbb5de /platform_tools
parent804d0f28ba6de89b7e671c0e9192e16b7494944d (diff)
Revert "Added support for visual debugging on Android Studio"
This reverts commit 222c9cfd1b3f50d21d4a1f93b0b52dd4973fe1b5. Reason for revert: Breaks documented workflow. Original change's description: > Added support for visual debugging on Android Studio > > Change-Id: Icaf848c31167db10d6fbb13d74c7287b03628fb6 > Bug: skia: > Reviewed-on: https://skia-review.googlesource.com/130144 > Reviewed-by: Derek Sollenberger <djsollen@google.com> TBR=djsollen@google.com,mtklein@google.com,bsalomon@google.com,halcanary@google.com,bungeman@google.com,ziadb@google.com Change-Id: I6e7ac2d16d9a0f267d75cd202fd4975be36da4f5 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/131601 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'platform_tools')
-rw-r--r--platform_tools/android/CMakeLists.txt48
-rw-r--r--platform_tools/android/apps/build.gradle89
-rw-r--r--platform_tools/android/apps/skqp/build.gradle51
-rw-r--r--platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java2
-rw-r--r--platform_tools/android/apps/viewer/build.gradle56
-rw-r--r--platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java2
6 files changed, 99 insertions, 149 deletions
diff --git a/platform_tools/android/CMakeLists.txt b/platform_tools/android/CMakeLists.txt
deleted file mode 100644
index c7a8a962b4..0000000000
--- a/platform_tools/android/CMakeLists.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR)
-cmake_policy(VERSION 2.8.8)
-
-## Supported ABIs: 'x86', 'x86_64', armeabi-v7a', 'arm64-v8a'
-message("Build Type: ${CMAKE_BUILD_TYPE}")
-
-##### ARGS.GN
-## Set dev in Android-CMake to true
-set (android_cmake "true")
-set (arg_android_cmake "is_android_cmake = ${android_cmake}")
-
-## Set the NDK path
-set (arg_ndk "ndk = \"${ANDROID_NDK}\"")
-
-## Set target ABI
-if(ANDROID_ABI STREQUAL "arm64-v8a")
- set (arg_abi "target_cpu = \"arm64\"")
-elseif(ANDROID_ABI STREQUAL "x86")
- set (arg_abi "target_cpu = \"x86\"")
-elseif(ANDROID_ABI STREQUAL "x86_64")
- set (arg_abi "target_cpu = \"x64\"")
-elseif(ANDROID_ABI STREQUAL "armeabi-v7a")
- set (arg_abi "target_cpu = \"arm\"")
-endif()
-message ("Target ABI: ${ANDROID_ABI}")
-message ("Target Builds: ${TARGETS}")
-
-set (android_out "${CMAKE_CURRENT_SOURCE_DIR}/../../out/android_cmake_${ANDROID_ABI}")
-
-execute_process(COMMAND mkdir -p ${android_out}/)
-execute_process(COMMAND touch ${android_out}/args.gn)
-file(WRITE "${android_out}/args.gn" "${arg_ndk}\n${arg_abi}\n${arg_android_cmake}\n")
-
-message("CMake Target Output Directory: ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
-##### GN to CMAKE
-set (bin_gn "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/gn")
-set (gen "gen")
-message("GN Output Directory: ${android_out}")
-
-set (ide "--ide=json")
-set (script_arg "--json-ide-script=")
-set (script_path "${CMAKE_CURRENT_SOURCE_DIR}/../../gn/gn_to_cmake.py")
-
-execute_process (COMMAND ${bin_gn} ${gen} ${android_out} ${ide} ${script_arg}${script_path}
-WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
-
-##### NINJA
-include(${android_out}/CMakeLists.txt) \ No newline at end of file
diff --git a/platform_tools/android/apps/build.gradle b/platform_tools/android/apps/build.gradle
index 7aa9b56af8..9f285e5b06 100644
--- a/platform_tools/android/apps/build.gradle
+++ b/platform_tools/android/apps/build.gradle
@@ -18,3 +18,92 @@ allprojects {
jcenter()
}
}
+
+def setupSkiaLibraryBuild(project, appVariants, appName) {
+ appVariants.all{ variant ->
+ def buildNativeLib = project.task("${variant.name}_BuildSkiaLib", type:Exec) {
+ workingDir '../../../..' // top-level skia directory
+ commandLine constructBuildCommand(project, variant, appName).split()
+ }
+ buildNativeLib.onlyIf { !project.hasProperty("suppressNativeBuild") }
+
+ def copyNativeLib = project.task("${variant.name}_CopySkiaLib", type:Copy) {
+ def fromDir = getVariantOutDir(project, variant).skiaOut
+ def intoDir = getVariantOutDir(project, variant).androidOut
+ from fromDir
+ into intoDir
+ include "${appName}.so"
+ }
+
+ TaskCollection<Task> compileTask = project.tasks.matching {
+ // println(it.name)
+ it.name.toLowerCase().contains("compile" + variant.name.toLowerCase()) &&
+ it.name.toLowerCase().endsWith("ndk")
+ }
+ compileTask.findAll()*.dependsOn copyNativeLib
+ copyNativeLib.dependsOn buildNativeLib
+ }
+}
+
+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 getVariantOutDir(project, variant) {
+ String variantPrefix = null
+ String androidLibDir = null
+ if (variant.name.startsWith("arm64")) {
+ variantPrefix = "arm64"
+ androidLibDir = "arm64-v8a"
+ } else if (variant.name.startsWith("arm")) {
+ variantPrefix = "arm"
+ androidLibDir = "armeabi-v7a"
+ } else if (variant.name.startsWith("x64")) {
+ variantPrefix = "x64"
+ androidLibDir = "x86_64"
+ } else if (variant.name.startsWith("x86")) {
+ variantPrefix = "x86"
+ androidLibDir = "x86"
+ }
+
+ String skiaOutDir = null
+ String propName = "${variantPrefix}.out.dir"
+ if (project.hasProperty(propName)) {
+ skiaOutDir = project.getProperties().getAt(propName)
+ } else {
+ skiaOutDir = getLocalProperties().getProperty(propName, "missing_variant_out")
+ }
+
+ return [skiaOut: skiaOutDir,
+ androidOut: "src/main/libs/${androidLibDir}"]
+}
+
+def constructBuildCommand(project, variant, appName) {
+ String depotToolsDir = null
+ for (String entry : System.getenv("PATH").split(":")) {
+ if (entry.contains("depot_tools")) {
+ depotToolsDir = entry;
+ break;
+ }
+ }
+ if (depotToolsDir == null) {
+ depotToolsDir = getLocalProperties().getProperty('depot_tools.dir', null)
+ }
+
+ if (depotToolsDir == null) {
+ throw GradleScriptException("Depot Tools not found! Please update your path to include" +
+ " depot_tools or define depot_tools.dir in local.properties")
+ }
+
+ String out_dir = getVariantOutDir(project, variant).skiaOut
+ return "${depotToolsDir}/ninja -C $out_dir $appName"
+}
diff --git a/platform_tools/android/apps/skqp/build.gradle b/platform_tools/android/apps/skqp/build.gradle
index 7d747c1791..e368a66ef6 100644
--- a/platform_tools/android/apps/skqp/build.gradle
+++ b/platform_tools/android/apps/skqp/build.gradle
@@ -4,12 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
apply plugin: 'com.android.application'
-//Make sure this is directory corresponds to skia/platform_tools/android
-final String ANDROID_CMAKE_HEADER_PATH = "../../CMakeLists.txt"
-
dependencies {
compile 'com.android.support:design:26.+'
compile 'com.android.support.test:runner:0.5'
@@ -25,48 +21,9 @@ android {
versionCode 1
versionName "1.0"
signingConfig signingConfigs.debug
-
- externalNativeBuild {
- cmake {
- //Native libraries to build
- targets "libskqp_app"
-
- arguments "-DANDROID_STL=c++_static",
- "-DTARGETS=${android.defaultConfig.externalNativeBuild.cmake.targets}"
- }
- }
-
- buildTypes {
- debug {
- applicationIdSuffix ".debug"
- debuggable true
- }
- }
-
- productFlavors {
- arm {
- ndk {
- abiFilters "armeabi-v7a"
- }
- }
-
- x86 {
- ndk {
- abiFilters "x86"
- }
- }
-
- x64 {
- ndk {
- abiFilters "x86_64"
- }
- }
- }
- }
-
- externalNativeBuild {
- cmake {
- path ANDROID_CMAKE_HEADER_PATH
- }
}
+ sourceSets.main.jni.srcDirs = []
+ sourceSets.main.jniLibs.srcDir "src/main/libs"
+ productFlavors { universal{}; arm {}; arm64 {}; x86 {}; x64 {}; arm64vulkan{}; }
+ setupSkiaLibraryBuild(project, applicationVariants, "libskqp_app")
}
diff --git a/platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java b/platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java
index 4457fc61f8..58e09ec982 100644
--- a/platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java
+++ b/platform_tools/android/apps/skqp/src/main/java/org/skia/skqp/SkQP.java
@@ -28,7 +28,7 @@ public class SkQP {
protected static final String LOG_PREFIX = "org.skia.skqp";
static {
- System.loadLibrary("libskqp_app");
+ System.loadLibrary("skqp_app");
}
protected void runTests(Context context, String outputDirPath) {
diff --git a/platform_tools/android/apps/viewer/build.gradle b/platform_tools/android/apps/viewer/build.gradle
index ad34f8a61d..630544d0bb 100644
--- a/platform_tools/android/apps/viewer/build.gradle
+++ b/platform_tools/android/apps/viewer/build.gradle
@@ -4,12 +4,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
apply plugin: 'com.android.application'
-//Make sure this is directory corresponds to skia/platform_tools/android
-final String ANDROID_CMAKE_HEADER_PATH = "../../CMakeLists.txt"
-
dependencies {
compile 'com.android.support:support-v13:23.3.0'
compile 'com.android.support:appcompat-v7:23.3.0'
@@ -25,54 +21,10 @@ android {
versionCode 1
versionName "1.0"
signingConfig signingConfigs.debug
-
- externalNativeBuild {
- cmake {
- //Native libraries to build
- targets "libviewer"
-
- arguments "-DANDROID_STL=c++_static",
- "-DTARGETS=${android.defaultConfig.externalNativeBuild.cmake.targets}"
- }
- }
-
- buildTypes {
- debug {
- applicationIdSuffix ".debug"
- debuggable true
- }
- }
-
- productFlavors {
- arm64 {
- ndk {
- abiFilters "arm64-v8a"
- }
- }
-
- arm {
- ndk {
- abiFilters "armeabi-v7a"
- }
- }
-
- x86 {
- ndk {
- abiFilters "x86"
- }
- }
-
- x64 {
- ndk {
- abiFilters "x86_64"
- }
- }
- }
}
+ sourceSets.main.jni.srcDirs = [] //disable automatic ndk-build call
+ sourceSets.main.jniLibs.srcDir "src/main/libs"
+ productFlavors { universal{}; arm {}; arm64 {}; x86 {}; x64 {}; arm64vulkan{}; }
- externalNativeBuild {
- cmake {
- path ANDROID_CMAKE_HEADER_PATH
- }
- }
+ setupSkiaLibraryBuild(project, applicationVariants, "libviewer")
}
diff --git a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
index 0c007ef363..7253eb7503 100644
--- a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
+++ b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/ViewerApplication.java
@@ -16,7 +16,7 @@ public class ViewerApplication extends Application {
private String mStateJsonStr, mTitle;
static {
- System.loadLibrary("libviewer");
+ System.loadLibrary("viewer");
}
private native long createNativeApp(AssetManager assetManager);