Move to using prebuilts/fullsdk instead of prebuilts/sdk
If fullsdk is not available it will falback to using prebuilds/sdk
Test: compiles both from terminal using gradlew and from android studio
Change-Id: Ia9c5ac177478445941cc6c48a21fc0fd03801129
diff --git a/.gitignore b/.gitignore
index 6c671f7..a59f7e1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
.project
.settings/
project.properties
+local.properties
**/bin
**/gen
*.iml
diff --git a/build.gradle b/build.gradle
index 0403270..8d37c56 100644
--- a/build.gradle
+++ b/build.gradle
@@ -6,6 +6,7 @@
import com.android.build.gradle.internal.coverage.JacocoPlugin
import com.android.build.gradle.internal.coverage.JacocoReportTask
import com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask
+import org.gradle.internal.os.OperatingSystem
import com.google.common.base.Charsets
import com.google.common.hash.HashCode
@@ -40,11 +41,9 @@
doclava project(':doclava')
}
-gradle.ext.currentSdk = 'current'
ext.supportVersion = '26.0.0-SNAPSHOT'
ext.extraVersion = 41
ext.supportRepoOut = ''
-ext.buildToolsVersion = '24.0.1'
ext.buildNumber = Integer.toString(ext.extraVersion)
ext.testRunnerVersion = '0.6-alpha'
@@ -54,6 +53,24 @@
// required for the doclava dependency.
ext.usePrebuilts = "true"
+final String platform = OperatingSystem.current().isMacOsX() ? 'darwin' : 'linux'
+System.setProperty('android.dir', "${rootDir}/../../")
+final String fullSdkPath = "${rootDir}/../../prebuilts/fullsdk-${platform}"
+if (file(fullSdkPath).exists()) {
+ gradle.ext.currentSdk = 26
+ ext.buildToolsVersion = '26.0.0'
+ project.ext.androidJar = files("${fullSdkPath}/platforms/android-${gradle.ext.currentSdk}/android.jar")
+ System.setProperty('android.home', "${rootDir}/../../prebuilts/fullsdk-${platform}")
+ File props = file("local.properties")
+ props.write "sdk.dir=${fullSdkPath}"
+} else {
+ gradle.ext.currentSdk = 'current'
+ ext.buildToolsVersion = '24.0.1'
+ project.ext.androidJar = files("${project.rootDir}/../../prebuilts/sdk/current/android.jar")
+ File props = file("local.properties")
+ props.write "android.dir=../../"
+}
+
/*
* With the build server you are given two env variables.
* The OUT_DIR is a temporary directory you can use to put things during the build.
@@ -178,16 +195,6 @@
return hashCode.toString()
}
-/**
- * Returns the Android prebuilt JAR for the specified API level.
- *
- * @param apiLevel the API level or "current"
- * @return a file collection containing the Android prebuilt JAR
- */
-FileCollection getAndroidPrebuilt(apiLevel) {
- files("${project.rootDir}/../../prebuilts/sdk/$apiLevel/android.jar")
-}
-
void registerForDocsTask(Task task, Project subProject, releaseVariant) {
task.dependsOn releaseVariant.javaCompile
task.source {
@@ -206,7 +213,7 @@
destinationDir = new File(project.docsDir, "online")
// Base classpath is Android SDK, sub-projects add their own.
- classpath = getAndroidPrebuilt(gradle.ext.currentSdk)
+ classpath = project.ext.androidJar
def hdfOption = new DoclavaMultilineJavadocOptionFileOption('hdf')
hdfOption.add(
@@ -225,8 +232,6 @@
addStringOption "templatedir",
"${project.rootDir}/../../build/tools/droiddoc/templates-sdk"
addStringOption "federate Android", "http://developer.android.com"
- addStringOption "federationapi Android",
- "${project.rootDir}/../../prebuilts/sdk/api/24.txt"
addStringOption "stubpackages", "android.support.*"
addStringOption "samplesdir", "${project.rootDir}/samples"
addOption hdfOption
@@ -241,7 +246,7 @@
destinationDir = project.docsDir
// Base classpath is Android SDK, sub-projects add their own.
- classpath = getAndroidPrebuilt(gradle.ext.currentSdk)
+ classpath = project.ext.androidJar
apiFile = new File(project.docsDir, 'release/current.txt')
removedApiFile = new File(project.docsDir, 'release/removed.txt')
@@ -251,8 +256,6 @@
addStringOption "templatedir",
"${project.rootDir}/../../build/tools/droiddoc/templates-sdk"
addStringOption "federate Android", "http://developer.android.com"
- addStringOption "federationapi Android",
- "${project.rootDir}/../../prebuilts/sdk/api/24.txt"
addStringOption "stubpackages", "android.support.*"
}
exclude '**/BuildConfig.java'
diff --git a/local.properties b/local.properties
deleted file mode 100644
index 7b7f7a0..0000000
--- a/local.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-## This file is automatically generated by Android Studio.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must *NOT* be checked into Version Control Systems,
-# as it contains information specific to your local configuration.
-#
-# Location of the SDK. This is only used by Gradle.
-# For customization when using a Version Control System, please read the
-# header note.
-#Mon Apr 11 17:16:19 PDT 2016
-#do not define sdk.dir here, it will confuse android studio
-android.dir=../../