Download full copy of the Android SDK (needed to run the all Android Lint tests)

This commit is contained in:
Yan Zhulanow
2016-03-23 20:10:00 +03:00
parent 984f10ddff
commit 65da1edb56
4 changed files with 164 additions and 60 deletions
+159
View File
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="download_android_sdk" default="download_android_sdk" xmlns:unless="ant:unless">
<property name="android.sdk.dir" value="dependencies/androidSDK"/>
<property name="download.dir" value="dependencies/download"/>
<condition property="tools.os" value="windows">
<os family="windows"/>
</condition>
<condition property="tools.isWindows" value="true">
<os family="windows"/>
</condition>
<condition property="tools.os" value="macosx">
<os family="mac"/>
</condition>
<condition property="tools.os" value="linux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<target name="download_android_sdk">
<delete dir="${android.sdk.dir}" failonerror="false" />
<mkdir dir="${download.dir}"/>
<mkdir dir="${android.sdk.dir}"/>
<mkdir dir="${android.sdk.dir}/platforms"/>
<mkdir dir="${android.sdk.dir}/build-tools"/>
<download_android_platform android.versioncode="23_r01" android.sdk.version="23" android.full.version="6.0" />
<download_platform_tools android.platform.tools.version="23" />
<download_tools android.tools.version="24.3.4" />
<download_build_tools android.build.tools.version="23.0.1" android.build.tools.full.version="6.0" />
</target>
<target name="download_sources">
<delete dir="${android.sdk.dir}" failonerror="false" />
<mkdir dir="${download.dir}"/>
<mkdir dir="${android.sdk.dir}"/>
<mkdir dir="${android.sdk.dir}/platforms"/>
<mkdir dir="${android.sdk.dir}/build-tools"/>
<download_sources android.sources.versioncode="21_r01" android.sources.version="21" />
</target>
<macrodef name="download_android_platform">
<attribute name="android.versioncode" />
<attribute name="android.sdk.version" />
<attribute name="android.full.version" />
<sequential>
<get src="http://dl-ssl.google.com/android/repository/android-@{android.versioncode}.zip"
dest="${download.dir}/android-platform-@{android.versioncode}.zip" usetimestamp="true"/>
<unzip src="${download.dir}/android-platform-@{android.versioncode}.zip" dest="${android.sdk.dir}/platforms"/>
<move file="${android.sdk.dir}/platforms/android-@{android.full.version}" tofile="${android.sdk.dir}/platforms/android-@{android.sdk.version}"/>
<delete dir="${android.sdk.dir}/platforms/android-@{android.full.version}"/>
</sequential>
</macrodef>
<macrodef name="download_platform_tools">
<attribute name="android.platform.tools.version" />
<sequential>
<get src="http://dl-ssl.google.com/android/repository/platform-tools_r@{android.platform.tools.version}-${tools.os}.zip"
dest="${download.dir}/android-platform-tools_r@{android.platform.tools.version}.zip" usetimestamp="true"/>
<unzip src="${download.dir}/android-platform-tools_r@{android.platform.tools.version}.zip" dest="${android.sdk.dir}"/>
</sequential>
</macrodef>
<macrodef name="download_tools">
<attribute name="android.tools.version" />
<sequential>
<get src="http://dl.google.com/android/repository/tools_r@{android.tools.version}-${tools.os}.zip"
dest="${download.dir}/android-tools_r@{android.tools.version}.zip" usetimestamp="true"/>
<unzip src="${download.dir}/android-tools_r@{android.tools.version}.zip" dest="${android.sdk.dir}"/>
</sequential>
</macrodef>
<macrodef name="download_build_tools">
<attribute name="android.build.tools.version" />
<attribute name="android.build.tools.full.version" />
<sequential>
<taskdef resource="net/sf/antcontrib/antcontrib.properties" classpath="lib/ant-contrib.jar"/>
<get src="http://dl.google.com/android/repository/build-tools_r@{android.build.tools.version}-${tools.os}.zip"
dest="${download.dir}/android-build-tools_r@{android.build.tools.version}.zip" usetimestamp="true"/>
<unzip src="${download.dir}/android-build-tools_r@{android.build.tools.version}.zip" dest="${android.sdk.dir}/build-tools"/>
<move file="${android.sdk.dir}/build-tools/android-@{android.build.tools.full.version}"
tofile="${android.sdk.dir}/build-tools/@{android.build.tools.version}"/>
<sequential unless:set="tools.isWindows">
<exec executable="chmod">
<arg value="a+x"/>
<arg path="${android.sdk.dir}/build-tools/@{android.build.tools.version}/aapt"/>
<arg path="${android.sdk.dir}/build-tools/@{android.build.tools.version}/aidl"/>
<arg path="${android.sdk.dir}/build-tools/@{android.build.tools.version}/dx"/>
<arg path="${android.sdk.dir}/build-tools/@{android.build.tools.version}/zipalign"/>
</exec>
</sequential>
</sequential>
</macrodef>
<macrodef name="download_support_repository">
<attribute name="android.repo.version" />
<attribute name="android.repo.last" />
<sequential>
<get src="http://dl-ssl.google.com/android/repository/android_m2repository_r@{android.repo.version}.zip"
dest="${download.dir}/android_m2repository_r@{android.repo.version}.zip" usetimestamp="true"/>
<mkdir dir="${android.sdk.dir}/extras/android" />
<unzip src="${download.dir}/android_m2repository_r@{android.repo.version}.zip" dest="${android.sdk.dir}/extras/android"/>
<unzip
src="${android.sdk.dir}/extras/android/m2repository/com/android/support/appcompat-v7/@{android.repo.last}/appcompat-v7-@{android.repo.last}.aar"
dest="${android.sdk.dir}/support/appcompat-v7" />
<unzip
src="${android.sdk.dir}/extras/android/m2repository/com/android/support/support-v4/@{android.repo.last}/support-v4-@{android.repo.last}.aar"
dest="${android.sdk.dir}/support/support-v4" />
</sequential>
</macrodef>
<macrodef name="download_sources">
<attribute name="android.sources.versioncode" />
<attribute name="android.sources.version" />
<sequential>
<get src="http://dl-ssl.google.com/android/repository/sources-@{android.sources.versioncode}.zip"
dest="${download.dir}/android_sources_@{android.sources.versioncode}.zip" usetimestamp="true"/>
<mkdir dir="${android.sdk.dir}/sources/android-@{android.sources.version}" />
<unzip src="${download.dir}/android_sources_@{android.sources.versioncode}.zip"
dest="${android.sdk.dir}/sources"/>
<move file="${android.sdk.dir}/sources/src"
tofile="${android.sdk.dir}/sources/android-@{android.sources.version}"/>
</sequential>
</macrodef>
</project>
@@ -81,7 +81,7 @@ public abstract class KotlinAndroidTestCase extends KotlinAndroidTestCaseBase {
protected void setUp() throws Exception {
// sdk path workaround, set real android sdk path and platform for android plugin to work
System.setProperty(KotlinAndroidTestCaseBase.SDK_PATH_PROPERTY, PathManager.getHomePath() + "/../dependencies/androidSDK");
System.setProperty(KotlinAndroidTestCaseBase.PLATFORM_DIR_PROPERTY, "android-21");
System.setProperty(KotlinAndroidTestCaseBase.PLATFORM_DIR_PROPERTY, "android-23");
VfsRootAccess.allowRootAccess(KotlinTestUtils.getHomeDirectory());
@@ -28,7 +28,7 @@ import java.io.File
abstract class AbstractAndroidJpsTestCase : JpsBuildTestCase() {
private val SDK_NAME = "Android API 21 Platform"
private val SDK_NAME = "Android API 23 Platform"
override fun setUp() {
super.setUp()
@@ -46,10 +46,10 @@ abstract class AbstractAndroidJpsTestCase : JpsBuildTestCase() {
private fun addJdkAndAndroidSdk(): JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> {
val jdkName = "java_sdk"
addJdk(jdkName)
val properties = JpsAndroidSdkProperties("android-21", jdkName)
val properties = JpsAndroidSdkProperties("android-23", jdkName)
val sdkPath = homePath + "/../dependencies/androidSDK"
val library = myModel.global.addSdk(SDK_NAME, sdkPath, "", JpsAndroidSdkType.INSTANCE, JpsSimpleElementImpl(properties))
library.addRoot(File(sdkPath + "/platforms/android-21/android.jar"), JpsOrderRootType.COMPILED)
library.addRoot(File(sdkPath + "/platforms/android-23/android.jar"), JpsOrderRootType.COMPILED)
return library.properties
}
}
+1 -56
View File
@@ -238,7 +238,7 @@
<get-maven-library prefix="com/google/protobuf" lib="protobuf-java" version="2.5.0" bin="false"/>
<!-- Android SDK platform -->
<get_android_sdk version.full="21_r01" version.number="21" version.buildtools="21.1.1"/>
<ant antfile="download_android_sdk.xml" target="download_android_sdk"/>
<!-- CLI Parser -->
<get-maven-library prefix="com/github/spullara/cli-parser" lib="cli-parser" version="1.1.1"/>
@@ -322,61 +322,6 @@
<download-or-build-markdown-parser/>
</target>
<macrodef name="get_android_sdk">
<attribute name="version.full"/>
<attribute name="version.number"/>
<attribute name="version.buildtools"/>
<sequential>
<condition property="android.os.tag" value="windows">
<os family="windows"/>
</condition>
<condition property="android.os.tag" value="macosx">
<os family="mac"/>
</condition>
<condition property="android.os.tag" value="linux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<delete dir="dependencies/androidSDK" failonerror="false"/>
<get
src="https://dl-ssl.google.com/android/repository/android-@{version.full}.zip"
dest="dependencies/android_sdk.zip" usetimestamp="true"/>
<unzip src="dependencies/android_sdk.zip" dest="dependencies/androidSDK/platforms/android-@{version.number}/">
<cutdirsmapper dirs="1"/>
</unzip>
<get
src="https://dl-ssl.google.com/android/repository/build-tools_r@{version.buildtools}-${android.os.tag}.zip"
dest="dependencies/android_buildtools.zip" usetimestamp="true"/>
<unzip src="dependencies/android_buildtools.zip" dest="dependencies/androidSDK/build-tools/@{version.buildtools}/">
<cutdirsmapper dirs="1"/>
</unzip>
<condition property="android.need.chmod">
<not>
<equals arg1="${android.os.tag}" arg2="windows"/>
</not>
</condition>
<exec executable="chmod" if:set="android.need.chmod">
<arg value="a+x"/>
<arg path="dependencies/androidSDK/build-tools/@{version.buildtools}/aapt"/>
<arg path="dependencies/androidSDK/build-tools/@{version.buildtools}/aidl"/>
<arg path="dependencies/androidSDK/build-tools/@{version.buildtools}/dx"/>
<arg path="dependencies/androidSDK/build-tools/@{version.buildtools}/zipalign"/>
</exec>
</sequential>
</macrodef>
<macrodef name="build-protobuf-java-lite">
<sequential>
<exec executable="dependencies/bootstrap-compiler/Kotlin/kotlinc/bin/${kotlinc.executable.path}" failonerror="true">