Move test APKs to DIST_DIR

Bug: 24494874
Change-Id: I4fb745e3808a4c43a13aa8ec398577f2581249d5
diff --git a/build.gradle b/build.gradle
index e366b16..3b23406 100644
--- a/build.gradle
+++ b/build.gradle
@@ -34,6 +34,7 @@
 }
 
 ext.supportRepoOut = new File(buildDir, 'support_repo')
+ext.testApkDistOut = new File(buildDir, 'test_apks')
 
 // Main task called by the build server.
 task(createArchive) << {
diff --git a/v7/recyclerview/build.gradle b/v7/recyclerview/build.gradle
index 25b686d..c9f1a22 100644
--- a/v7/recyclerview/build.gradle
+++ b/v7/recyclerview/build.gradle
@@ -78,6 +78,17 @@
     artifacts.add('archives', sourcesJarTask);
 }
 
+// TODO make this generic for all projects
+afterEvaluate {
+    def originalTask = tasks['packageDebugAndroidTest']
+    tasks['assembleDebugAndroidTest'].doLast {
+        copy {
+            from(originalTask.outputFile)
+            into(rootProject.ext.testApkDistOut)
+        }
+    }
+}
+
 uploadArchives {
     repositories {
         mavenDeployer {