Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: platform_tools/android/apps/build.gradle

Issue 1921553009: Add CMake path to gradle (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: No Duplication Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | platform_tools/android/apps/vulkanviewer/build.gradle » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Top-level build file where you can add configuration options common to all su b-projects/modules. 1 // Top-level build file where you can add configuration options common to all su b-projects/modules.
2 2
3 3
4 buildscript { 4 buildscript {
5 repositories { 5 repositories {
6 jcenter() 6 jcenter()
7 } 7 }
8 dependencies { 8 dependencies {
9 classpath 'com.android.tools.build:gradle:2.1.0' 9 classpath 'com.android.tools.build:gradle:2.1.0'
10 10
11 // NOTE: Do not place your application dependencies here; they belong 11 // NOTE: Do not place your application dependencies here; they belong
12 // in the individual module build.gradle files 12 // in the individual module build.gradle files
13 } 13 }
14 } 14 }
15 15
16 allprojects { 16 allprojects {
17 repositories { 17 repositories {
18 jcenter() 18 jcenter()
19 } 19 }
20 } 20 }
21 21
22 def setupSkiaLibraryBuild(project, appVariants, buildCmd) { 22 def setupSkiaLibraryBuild(project, appVariants, buildCmd, requireCMake = false) {
23 appVariants.all{ variant -> 23 appVariants.all{ variant ->
24 def buildNativeLib = project.task("${variant.name}_SkiaNativeLib", type: Exec) { 24 def buildNativeLib = project.task("${variant.name}_SkiaNativeLib", type: Exec) {
25 workingDir '../../../..' // top-level skia directory 25 workingDir '../../../..' // top-level skia directory
26 commandLine constructBuildCommand(variant, buildCmd).split() 26 commandLine constructBuildCommand(variant, buildCmd).split()
27 environment PATH: getPathWithDepotTools() 27 environment PATH: getPathWithDeps(requireCMake)
28 environment ANDROID_SDK_ROOT: getSDKPath() 28 environment ANDROID_SDK_ROOT: getSDKPath()
29 } 29 }
30 buildNativeLib.onlyIf { !project.hasProperty("suppressNativeBuild") } 30 buildNativeLib.onlyIf { !project.hasProperty("suppressNativeBuild") }
31 TaskCollection<Task> compileTask = project.tasks.matching { 31 TaskCollection<Task> compileTask = project.tasks.matching {
32 // println(it.name) 32 // println(it.name)
33 it.name.toLowerCase().contains("compile" + variant.name.toLowerCase( )) && 33 it.name.toLowerCase().contains("compile" + variant.name.toLowerCase( )) &&
34 it.name.toLowerCase().endsWith("ndk") 34 it.name.toLowerCase().endsWith("ndk")
35 } 35 }
36 compileTask.getAt(0).dependsOn buildNativeLib 36 compileTask.getAt(0).dependsOn buildNativeLib
37 } 37 }
(...skipping 18 matching lines...) Expand all
56 path = getLocalProperties().getProperty('sdk.dir', null) 56 path = getLocalProperties().getProperty('sdk.dir', null)
57 } 57 }
58 58
59 if (path == null) { 59 if (path == null) {
60 throw new GradleScriptException("Android SDK not found! Please set ANDRO ID_SDK_ROOT to" + 60 throw new GradleScriptException("Android SDK not found! Please set ANDRO ID_SDK_ROOT to" +
61 " your path or define sdk.dir in gradle. properties") 61 " your path or define sdk.dir in gradle. properties")
62 } 62 }
63 return path 63 return path
64 } 64 }
65 65
66 def getPathWithDepotTools() { 66 def getPathWithDeps(requireCMake = false) {
67 System.getenv("PATH") + ":" + getLocalProperties().getProperty('depot_tools. dir', null)
68 String path = System.getenv("PATH") 67 String path = System.getenv("PATH")
69 if (!path.contains("depot_tools")) { 68 if (!path.contains("depot_tools")) {
70 path += ":" + getLocalProperties().getProperty('depot_tools.dir', null) 69 path += ":" + getLocalProperties().getProperty('depot_tools.dir', null)
71 } 70 }
72 71
73 if (!path.contains("depot_tools")) { 72 if (!path.contains("depot_tools")) {
74 throw GradleScriptException("Depot Tools not found! Please update your p ath to include" + 73 throw GradleScriptException("Depot Tools not found! Please update your p ath to include" +
75 " depot_tools or define depot_tools.dir in g radle.properties") 74 " depot_tools or define depot_tools.dir in g radle.properties")
76 } 75 }
76
77 if (requireCMake) {
78 String cmakePath = getSDKPath() + "/cmake/bin"
79 if (!file(cmakePath).exists()) {
80 throw new GradleScriptException("cmake not found! Please install the android SDK version" +
81 " of cmake.", null);
82 }
83 if (!path.contains(cmakePath)) {
84 path = cmakePath + ":" + path
85 }
86 }
87
77 return path 88 return path
78 } 89 }
79 90
80 def constructBuildCommand(variant, buildTarget) { 91 def constructBuildCommand(variant, buildTarget) {
81 String cmdLine = "./platform_tools/android/bin/android_ninja $buildTarget" 92 String cmdLine = "./platform_tools/android/bin/android_ninja $buildTarget"
82 String deviceType = null 93 String deviceType = null
83 if (variant.name.startsWith("arm64")) { 94 if (variant.name.startsWith("arm64")) {
84 deviceType = "arm64" 95 deviceType = "arm64"
85 } else if (variant.name.startsWith("arm")) { 96 } else if (variant.name.startsWith("arm")) {
86 deviceType = "arm_v7_neon" 97 deviceType = "arm_v7_neon"
87 } else if (variant.name.startsWith("x86_64")) { 98 } else if (variant.name.startsWith("x86_64")) {
88 deviceType = "x86_64" 99 deviceType = "x86_64"
89 } else if (variant.name.startsWith("x86")) { 100 } else if (variant.name.startsWith("x86")) {
90 deviceType = "x86" 101 deviceType = "x86"
91 } else if (variant.name.startsWith("mips")) { 102 } else if (variant.name.startsWith("mips")) {
92 deviceType = "mips" 103 deviceType = "mips"
93 } else if (variant.name.startsWith("mips64")) { 104 } else if (variant.name.startsWith("mips64")) {
94 deviceType = "mips64" 105 deviceType = "mips64"
95 } 106 }
96 107
97 if (deviceType != null) { 108 if (deviceType != null) {
98 cmdLine += " -d " + deviceType 109 cmdLine += " -d " + deviceType
99 } 110 }
100 111
101 if (variant.name.endsWith("Release")) { 112 if (variant.name.endsWith("Release")) {
102 cmdLine += " --release" 113 cmdLine += " --release"
103 } 114 }
104 return cmdLine 115 return cmdLine
105 } 116 }
OLDNEW
« no previous file with comments | « no previous file | platform_tools/android/apps/vulkanviewer/build.gradle » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698