Mark MultiDexTestRunner as deprecated am: 93728d8ae0 am: 668b6077de
am: 5ccdd930f0

Change-Id: I1352525730454a258b6cd5a51c2577c7db665944
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
new file mode 100644
index 0000000..2811ea9
--- /dev/null
+++ b/PREUPLOAD.cfg
@@ -0,0 +1,6 @@
+[Hook Scripts]
+checkstyle_hook = ${REPO_ROOT}/prebuilts/checkstyle/checkstyle.py --sha ${PREUPLOAD_COMMIT}
+
+[Builtin Hooks]
+commit_msg_changeid_field = true
+commit_msg_test_field = true
diff --git a/build.gradle b/build.gradle
index f8306d5..3a5ed75 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,3 +1,21 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.gradle.internal.os.OperatingSystem
+
 buildscript {
     repositories {
         maven { url '../../prebuilts/gradle-plugin' }
@@ -5,14 +23,29 @@
         maven { url '../../prebuilts/tools/common/m2/internal' }
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:0.10.0'
+        classpath 'com.android.tools.build:gradle:2.3.0'
     }
 }
 
-ext.supportVersion = '1.0.1'
-ext.extraVersion = 10
-ext.supportRepoOut = ''
-ext.buildToolsVersion = '19.0.3'
+apply from: 'version.gradle'
+
+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.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 = '26.0.0'
+    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.
@@ -31,120 +64,43 @@
 
 ext.supportRepoOut = new File(buildDir, 'support_repo')
 
-// Main task called by the build server.
-task(createArchive) << {
-}
-
 // upload anchor for subprojects to upload their artifacts
 // to the local repo.
-task(mainUpload) << {
-}
-
-// repository creation task
-task createRepository(type: Zip, dependsOn: mainUpload) {
-    from project.ext.supportRepoOut
-    destinationDir project.ext.distDir
-    into 'm2repository'
-    baseName = String.format("android_m2repository_r%02d", project.ext.extraVersion)
-}
-createArchive.dependsOn createRepository
-
-// prepare repository with older versions
-task unzipRepo(type: Copy) {
-    from "$rootDir/../../prebuilts/maven_repo/android"
-    into project.ext.supportRepoOut
-}
-
-unzipRepo.doFirst {
-    project.ext.supportRepoOut.deleteDir()
-    project.ext.supportRepoOut.mkdirs()
-}
-
-// anchor for prepare repo. This is post unzip + sourceProp.
-task(prepareRepo) << {
-}
-
-import com.google.common.io.Files
-import com.google.common.base.Charsets
-
-task(createXml) << {
-    def repoArchive = createRepository.archivePath
-    def repoArchiveName = createRepository.archiveName
-    def size = repoArchive.length()
-    def sha1 = getSha1(repoArchive)
-
-    def xml =
-"<sdk:sdk-addon xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:sdk=\"http://schemas.android.com/sdk/android/addon/6\">\n\
-  <sdk:extra>\n\
-    <sdk:revision>\n\
-      <sdk:major>${project.ext.extraVersion}</sdk:major>\n\
-    </sdk:revision>\n\
-    <sdk:vendor-display>Android</sdk:vendor-display>\n\
-    <sdk:vendor-id>android</sdk:vendor-id>\n\
-    <sdk:name-display>Local Maven repository for Support Libraries</sdk:name-display>\n\
-    <sdk:path>m2repository</sdk:path>\n\
-    <sdk:archives>\n\
-      <sdk:archive os=\"any\" arch=\"any\">\n\
-       <sdk:size>${size}</sdk:size>\n\
-       <sdk:checksum type=\"sha1\">${sha1}</sdk:checksum>\n\
-       <sdk:url>${repoArchiveName}</sdk:url>\n\
-      </sdk:archive>\n\
-    </sdk:archives>\n\
-  </sdk:extra>\n\
-</sdk:sdk-addon>"
-
-    Files.write(xml, new File(project.ext.distDir, 'repo-extras.xml'), Charsets.UTF_8)
-}
-createArchive.dependsOn createXml
-
-task(createSourceProp) << {
-    def sourceProp =
-"Extra.VendorDisplay=Android\n\
-Extra.Path=m2repository\n\
-Archive.Arch=ANY\n\
-Extra.NameDisplay=Android Support Repository\n\
-Archive.Os=ANY\n\
-Pkg.Revision=${project.ext.extraVersion}.0.0\n\
-Extra.VendorId=android"
-
-    Files.write(sourceProp, new File(project.ext.supportRepoOut, 'source.properties'), Charsets.UTF_8)
-}
-createSourceProp.dependsOn unzipRepo
-prepareRepo.dependsOn createSourceProp
-
-
-import com.google.common.hash.HashCode
-import com.google.common.hash.HashFunction
-import com.google.common.hash.Hashing
-
-def getSha1(File inputFile) {
-    HashFunction hashFunction = Hashing.sha1()
-    HashCode hashCode = hashFunction.hashString(inputFile.getAbsolutePath())
-    return hashCode.toString()
+task(dist) {
+    group = BasePlugin.BUILD_GROUP
+    description 'Builds distribution artifacts.'
 }
 
 subprojects {
     // Change buildDir first so that all plugins pick up the new value.
-    project.buildDir = project.file("$project.parent.buildDir/../$project.name/build")
+    project.buildDir = project.file("${project.parent.buildDir}/../${project.name}/build")
 
     apply plugin: 'maven'
 
-    version = rootProject.ext.supportVersion
+    version = rootProject.multidexVersion
     group = 'com.android.support'
 
     task release(type: Upload) {
         configuration = configurations.archives
         repositories {
             mavenDeployer {
-                repository(url: uri("$rootProject.ext.supportRepoOut"))
+                repository(url: uri("$rootProject.supportRepoOut"))
             }
         }
     }
 
-    // before the upload, make sure the repo is ready.
-    release.dependsOn rootProject.tasks.prepareRepo
-    // make the mainupload depend on this one.
-    mainUpload.dependsOn release
+    task createArtifactZip(type: Zip, dependsOn: release)  {
+        from release.artifacts
+        into archivesBaseName
+        destinationDir project.parent.distDir
+        baseName = archivesBaseName
+
+        doLast {
+            logger.warn "Compressed maven artifacts to ${archivePath}"
+        }
+    }
+
+    dist.dependsOn createArtifactZip
 
     project.plugins.whenPluginAdded { plugin ->
         if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
@@ -152,8 +108,3 @@
         }
     }
 }
-
-FileCollection getAndroidPrebuilt(String apiLevel) {
-    files("$rootDir/../../prebuilts/sdk/$apiLevel/android.jar")
-}
-
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 3c7abdf..13372ae 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 127125b..84939b4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Tue Mar 18 16:49:12 PDT 2014
+#Tue Aug 16 10:43:36 PDT 2016
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=../../../../tools/external/gradle/gradle-1.11-bin.zip
+distributionUrl=../../../../tools/external/gradle/gradle-3.3-bin.zip
diff --git a/instrumentation/.classpath b/instrumentation/.classpath
deleted file mode 100644
index 7bc01d9..0000000
--- a/instrumentation/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="gen"/>
-	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
-	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
-	<classpathentry kind="output" path="bin/classes"/>
-</classpath>
diff --git a/instrumentation/.project b/instrumentation/.project
deleted file mode 100644
index bfc77da..0000000
--- a/instrumentation/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>android-support-multidex-instrumentation</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
diff --git a/instrumentation/AndroidManifest.xml b/instrumentation/AndroidManifest.xml
index 6107fd3..7b9f92c 100644
--- a/instrumentation/AndroidManifest.xml
+++ b/instrumentation/AndroidManifest.xml
@@ -15,6 +15,4 @@
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="android.support.multidex.instrumentation">
-    <uses-sdk android:minSdkVersion="4"/>
-    <application />
 </manifest>
diff --git a/instrumentation/README.txt b/instrumentation/README
similarity index 100%
rename from instrumentation/README.txt
rename to instrumentation/README
diff --git a/instrumentation/README.android b/instrumentation/README.android
deleted file mode 100644
index 322676b..0000000
--- a/instrumentation/README.android
+++ /dev/null
@@ -1,6 +0,0 @@
-Library Project including compatibility IntrumentationTestRunner
-for multiple dex applications.
-
-This can be used by an Android test project to set up the classloader
-of applications with multiple dexes.
-
diff --git a/instrumentation/build.gradle b/instrumentation/build.gradle
index 15ea3e8..adea6d7 100644
--- a/instrumentation/build.gradle
+++ b/instrumentation/build.gradle
@@ -1,9 +1,32 @@
-apply plugin: 'android-library'
-archivesBaseName = 'multidex-instrumentation'
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+apply plugin: 'com.android.library'
+
+dependencies {
+    compile project(':support-multidex')
+}
 
 android {
     compileSdkVersion 4
 
+    defaultConfig {
+        minSdkVersion 4
+    }
+
     sourceSets {
         main {
             java.srcDirs         = ['src']
@@ -19,10 +42,6 @@
     }
 }
 
-dependencies {
-    compile project(':library')
-}
-
 uploadArchives {
     repositories {
         mavenDeployer {
@@ -55,4 +74,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/instrumentation/project.properties b/instrumentation/project.properties
deleted file mode 100644
index 22e1c48..0000000
--- a/instrumentation/project.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-14
-android.library=true
diff --git a/instrumentation/res/.readme b/instrumentation/res/.readme
deleted file mode 100644
index cc903f6..0000000
--- a/instrumentation/res/.readme
+++ /dev/null
@@ -1 +0,0 @@
-This hidden file is there to ensure there is an res folder.
\ No newline at end of file
diff --git a/instrumentation/src/.readme b/instrumentation/src/.readme
deleted file mode 100644
index 4bcebad..0000000
--- a/instrumentation/src/.readme
+++ /dev/null
@@ -1,2 +0,0 @@
-This hidden file is there to ensure there is an src folder.
-Once we support binary library this will go away.
\ No newline at end of file
diff --git a/library/.classpath b/library/.classpath
deleted file mode 100644
index 7bc01d9..0000000
--- a/library/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="gen"/>
-	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
-	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
-	<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
-	<classpathentry kind="output" path="bin/classes"/>
-</classpath>
diff --git a/library/.project b/library/.project
deleted file mode 100644
index 566e709..0000000
--- a/library/.project
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>android-support-multidex</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
diff --git a/library/AndroidManifest.xml b/library/AndroidManifest.xml
index f29fe15..8da151d 100644
--- a/library/AndroidManifest.xml
+++ b/library/AndroidManifest.xml
@@ -15,5 +15,5 @@
 -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="android.support.multidex">
-    <uses-sdk android:minSdkVersion="4"/>
+    <meta-data android:name="android.support.VERSION" android:value="${multidex-version}" />
 </manifest>
diff --git a/library/README.txt b/library/README
similarity index 100%
rename from library/README.txt
rename to library/README
diff --git a/library/README.android b/library/README.android
deleted file mode 100644
index 2fde7e2..0000000
--- a/library/README.android
+++ /dev/null
@@ -1,6 +0,0 @@
-Library Project including compatibility multi dex loader.
-
-This can be used by an Android project to install classloader
-with multiple dex of applications running on API 4+.
-
-
diff --git a/library/build.gradle b/library/build.gradle
index f04615d..e882989 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,9 +1,31 @@
-apply plugin: 'android-library'
-archivesBaseName = 'multidex'
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+apply plugin: 'com.android.library'
 
 android {
     compileSdkVersion 4
 
+    defaultConfig {
+        minSdkVersion 4
+
+        // Update the version meta-data in Manifest.
+        addManifestPlaceholders(["multidex-version": project.rootProject.ext.multidexVersion])
+    }
+
     sourceSets {
         main {
             java.srcDirs         = ['src']
@@ -51,4 +73,4 @@
             }
         }
     }
-}
\ No newline at end of file
+}
diff --git a/library/project.properties b/library/project.properties
deleted file mode 100644
index 22e1c48..0000000
--- a/library/project.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-14
-android.library=true
diff --git a/library/res/.readme b/library/res/.readme
deleted file mode 100644
index cc903f6..0000000
--- a/library/res/.readme
+++ /dev/null
@@ -1 +0,0 @@
-This hidden file is there to ensure there is an res folder.
\ No newline at end of file
diff --git a/library/src/.readme b/library/src/.readme
deleted file mode 100644
index 4bcebad..0000000
--- a/library/src/.readme
+++ /dev/null
@@ -1,2 +0,0 @@
-This hidden file is there to ensure there is an src folder.
-Once we support binary library this will go away.
\ No newline at end of file
diff --git a/library/test/.classpath b/library/test/.classpath
deleted file mode 100644
index e3d0af0..0000000
--- a/library/test/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
-	<classpathentry combineaccessrules="false" kind="src" path="/android-support-multidex"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
-	<classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/library/test/.project b/library/test/.project
deleted file mode 100644
index 29f077e..0000000
--- a/library/test/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>android-support-multidex-tests</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
diff --git a/settings.gradle b/settings.gradle
index c1c64f3..516f997 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,21 @@
-include ':library'
-include ':instrumentation'
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+include ':support-multidex'
+project(':support-multidex').projectDir = new File(rootDir, 'library')
+
+include ':support-multidex-instrumentation'
+project(':support-multidex-instrumentation').projectDir = new File(rootDir, 'instrumentation')
diff --git a/version.gradle b/version.gradle
new file mode 100644
index 0000000..d216a30
--- /dev/null
+++ b/version.gradle
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ext.multidexVersion = '1.0.2'