| OLD | NEW |
| (Empty) |
| 1 // Top-level build file where you can add configuration options common to all su
b-projects/modules. | |
| 2 | |
| 3 buildscript { | |
| 4 repositories { | |
| 5 jcenter() | |
| 6 } | |
| 7 dependencies { | |
| 8 classpath 'com.android.tools.build:gradle:1.2.3' | |
| 9 | |
| 10 // NOTE: Do not place your application dependencies here; they belong | |
| 11 // in the individual module build.gradle files | |
| 12 } | |
| 13 } | |
| 14 | |
| 15 allprojects { | |
| 16 repositories { | |
| 17 jcenter() | |
| 18 } | |
| 19 } | |
| 20 | |
| 21 def getLocalProperties() { | |
| 22 Properties properties = new Properties() | |
| 23 File propFile = project.rootProject.file('local.properties') | |
| 24 if (propFile.canRead()) { | |
| 25 properties.load(propFile.newDataInputStream()) | |
| 26 } | |
| 27 propFile = project.rootProject.file('gradle.properties') | |
| 28 if (propFile.canRead()) { | |
| 29 properties.load(propFile.newDataInputStream()) | |
| 30 } | |
| 31 return properties | |
| 32 } | |
| 33 | |
| 34 def getSDKPath() { | |
| 35 String path = System.getenv("ANDROID_SDK_ROOT") | |
| 36 if (path == null) { | |
| 37 path = getLocalProperties().getProperty('sdk.dir', null) | |
| 38 } | |
| 39 | |
| 40 if (path == null) { | |
| 41 throw new GradleScriptException("Android SDK not found! Please set ANDRO
ID_SDK_ROOT to" + | |
| 42 " your path or define sdk.dir in gradle.
properties") | |
| 43 } | |
| 44 return path | |
| 45 } | |
| 46 | |
| 47 def getPathWithDepotTools() { | |
| 48 System.getenv("PATH") + ":" + getLocalProperties().getProperty('depot_tools.
dir', null) | |
| 49 String path = System.getenv("PATH") | |
| 50 if (!path.contains("depot_tools")) { | |
| 51 path += ":" + getLocalProperties().getProperty('depot_tools.dir', null) | |
| 52 } | |
| 53 | |
| 54 if (!path.contains("depot_tools")) { | |
| 55 throw GradleScriptException("Depot Tools not found! Please update your p
ath to include" + | |
| 56 " depot_tools or define depot_tools.dir in g
radle.properties") | |
| 57 } | |
| 58 return path | |
| 59 } | |
| 60 | |
| 61 def constructBuildCommand(variant, buildTarget) { | |
| 62 String cmdLine = "./platform_tools/android/bin/android_ninja $buildTarget" | |
| 63 String deviceType = null | |
| 64 if (variant.name.startsWith("arm64")) { | |
| 65 deviceType = "arm64" | |
| 66 } else if (variant.name.startsWith("arm")) { | |
| 67 deviceType = "arm_v7_neon" | |
| 68 } else if (variant.name.startsWith("x86_64")) { | |
| 69 deviceType = "x86_64" | |
| 70 } else if (variant.name.startsWith("x86")) { | |
| 71 deviceType = "x86" | |
| 72 } else if (variant.name.startsWith("mips")) { | |
| 73 deviceType = "mips" | |
| 74 } else if (variant.name.startsWith("mips64")) { | |
| 75 deviceType = "mips64" | |
| 76 } | |
| 77 | |
| 78 if (deviceType != null) { | |
| 79 cmdLine += " -d " + deviceType | |
| 80 } | |
| 81 | |
| 82 if (variant.name.endsWith("Release")) { | |
| 83 cmdLine += " --release" | |
| 84 } | |
| 85 return cmdLine | |
| 86 } | |
| OLD | NEW |