Revert "Move Compose Macrobenchmarks to a self-instrumenting test module."

This reverts commit 6b8bf61f56fc3f53d43e8a88192fff81c477fabb.

Reason for revert: Compose macrobenchmarks failing in CI

Bug: 200274033
Change-Id: I7e441111c3823aac9e5b1dd5d897602f3e16e65d
diff --git a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
index ed9c041..db5e430 100644
--- a/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
+++ b/buildSrc/private/src/main/kotlin/androidx/build/testConfiguration/TestSuiteConfiguration.kt
@@ -292,10 +292,8 @@
 private fun Project.getOrCreateMacrobenchmarkConfigTask(variantName: String):
     TaskProvider<GenerateTestConfigurationTask> {
         val parentProject = this.parent!!
-        val taskCollection = parentProject.tasks.withType(GenerateTestConfigurationTask::class.java)
-        val taskNames = taskCollection.getNames()
         return if (
-            "${AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK}$variantName" !in taskNames
+            parentProject.tasks.withType(GenerateTestConfigurationTask::class.java).isEmpty()
         ) {
             parentProject.tasks.register(
                 "${AndroidXImplPlugin.GENERATE_TEST_CONFIGURATION_TASK}$variantName",
diff --git a/compose/integration-tests/macrobenchmark/build.gradle b/compose/integration-tests/macrobenchmark/build.gradle
index 6dfe087..4269659 100644
--- a/compose/integration-tests/macrobenchmark/build.gradle
+++ b/compose/integration-tests/macrobenchmark/build.gradle
@@ -1,5 +1,5 @@
 /*
- * Copyright 2021 The Android Open Source Project
+ * Copyright (C) 2020 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.
@@ -16,39 +16,26 @@
 
 plugins {
     id("AndroidXPlugin")
-    id("com.android.test")
+    id("com.android.library")
     id("kotlin-android")
 }
 
-android {
-    targetProjectPath = ":compose:integration-tests:macrobenchmark-target"
-    experimentalProperties["android.experimental.self-instrumenting"] = true
-
-    buildTypes {
-        release {
-            debuggable = true
-        }
-    }
-
-    defaultConfig {
-        minSdkVersion 28
-        testInstrumentationRunnerArgument "androidx.benchmark.output.enable", "true"
-    }
-}
-
-androidComponents {
-    beforeVariants(selector().all()) {
-        enabled = buildType == 'release'
-    }
+android.defaultConfig {
+    minSdkVersion 28
+    testInstrumentationRunnerArgument "androidx.benchmark.output.enable", "true"
 }
 
 dependencies {
-    implementation(project(":benchmark:benchmark-junit4"))
-    implementation(project(":benchmark:benchmark-macro-junit4"))
-    implementation(project(":internal-testutils-macrobenchmark"))
-    implementation(libs.testRules)
-    implementation(libs.testExtJunit)
-    implementation(libs.testCore)
-    implementation(libs.testRunner)
-    implementation(libs.testUiautomator)
+    androidTestImplementation(project(":benchmark:benchmark-junit4"))
+    androidTestImplementation(project(":benchmark:benchmark-macro-junit4"))
+    androidTestImplementation(project(":internal-testutils-macrobenchmark"))
+    androidTestImplementation(libs.testRules)
+    androidTestImplementation(libs.testExtJunit)
+    androidTestImplementation(libs.testCore)
+    androidTestImplementation(libs.testRunner)
+    androidTestImplementation(libs.testUiautomator)
 }
+
+// Define a task dependency so the app is installed before we run macro benchmarks.
+tasks.getByPath(":compose:integration-tests:macrobenchmark:connectedCheck")
+    .dependsOn(tasks.getByPath(":compose:integration-tests:macrobenchmark-target:installRelease"))
diff --git a/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml b/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
new file mode 100644
index 0000000..0718de4
--- /dev/null
+++ b/compose/integration-tests/macrobenchmark/src/androidTest/AndroidManifest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2020 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.
+  -->
+<manifest package="androidx.compose.integration.macrobenchmark.test"/>
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/BenchmarkingUtils.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/BenchmarkingUtils.kt
similarity index 100%
rename from compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/BenchmarkingUtils.kt
rename to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/BenchmarkingUtils.kt
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/IoSettingsStartupBenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/IoSettingsStartupBenchmark.kt
similarity index 100%
rename from compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/IoSettingsStartupBenchmark.kt
rename to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/IoSettingsStartupBenchmark.kt
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/NestedListsScrollBenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/NestedListsScrollBenchmark.kt
similarity index 100%
rename from compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/NestedListsScrollBenchmark.kt
rename to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/NestedListsScrollBenchmark.kt
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
similarity index 100%
rename from compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
rename to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/SmallListStartupBenchmark.kt
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/TrivialListScrollBenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialListScrollBenchmark.kt
similarity index 100%
rename from compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/TrivialListScrollBenchmark.kt
rename to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialListScrollBenchmark.kt
diff --git a/compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt b/compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
similarity index 100%
rename from compose/integration-tests/macrobenchmark/src/main/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
rename to compose/integration-tests/macrobenchmark/src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialStartupBenchmark.kt
diff --git a/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml b/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
index 0718de4..34af7ba 100644
--- a/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
+++ b/compose/integration-tests/macrobenchmark/src/main/AndroidManifest.xml
@@ -14,4 +14,4 @@
   ~ See the License for the specific language governing permissions and
   ~ limitations under the License.
   -->
-<manifest package="androidx.compose.integration.macrobenchmark.test"/>
+<manifest package="androidx.compose.integration.macrobenchmark" />