Merge "Apply Benchmark plugin to benchmark modules" into androidx-master-dev
diff --git a/appcompat/benchmark/build.gradle b/appcompat/benchmark/build.gradle
index 8ff9b65..962cb98 100644
--- a/appcompat/benchmark/build.gradle
+++ b/appcompat/benchmark/build.gradle
@@ -21,6 +21,7 @@
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
+ id("androidx.benchmark")
}
dependencies {
diff --git a/benchmark/benchmark/build.gradle b/benchmark/benchmark/build.gradle
index 23f8633..b540dcd 100644
--- a/benchmark/benchmark/build.gradle
+++ b/benchmark/benchmark/build.gradle
@@ -19,6 +19,7 @@
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
+ id("androidx.benchmark")
}
dependencies {
diff --git a/benchmark/gradle-plugin/src/main/kotlin/androidx/benchmark/gradle/BenchmarkPlugin.kt b/benchmark/gradle-plugin/src/main/kotlin/androidx/benchmark/gradle/BenchmarkPlugin.kt
index 7365bc8..1a57e4f 100644
--- a/benchmark/gradle-plugin/src/main/kotlin/androidx/benchmark/gradle/BenchmarkPlugin.kt
+++ b/benchmark/gradle-plugin/src/main/kotlin/androidx/benchmark/gradle/BenchmarkPlugin.kt
@@ -88,11 +88,17 @@
}
}
- project.tasks.register("lockClocks", LockClocksTask::class.java).configure {
- it.adbPath.set(extension.adbExecutable.absolutePath)
+ if (project.rootProject.tasks.findByName("lockClocks") == null) {
+ project.rootProject.tasks.register("lockClocks", LockClocksTask::class.java).configure {
+ it.adbPath.set(extension.adbExecutable.absolutePath)
+ }
}
- project.tasks.register("unlockClocks", UnlockClocksTask::class.java).configure {
- it.adbPath.set(extension.adbExecutable.absolutePath)
+
+ if (project.rootProject.tasks.findByName("unlockClocks") == null) {
+ project.rootProject.tasks.register("unlockClocks", UnlockClocksTask::class.java)
+ .configure {
+ it.adbPath.set(extension.adbExecutable.absolutePath)
+ }
}
val extensionVariants = when (extension) {
diff --git a/benchmark/integration-tests/startup-benchmark/build.gradle b/benchmark/integration-tests/startup-benchmark/build.gradle
index 4219241..80085a3 100644
--- a/benchmark/integration-tests/startup-benchmark/build.gradle
+++ b/benchmark/integration-tests/startup-benchmark/build.gradle
@@ -20,6 +20,7 @@
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
+ id("androidx.benchmark")
}
dependencies {
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 59996ce..c51fd30 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -58,11 +58,6 @@
}
}
-sourceSets {
- main.java.srcDirs += "${supportRootFolder}/benchmark/gradle-plugin/src/main/kotlin"
- main.resources.srcDirs += "${supportRootFolder}/benchmark/gradle-plugin/src/main/resources"
-}
-
dependencies {
implementation build_libs.gradle
implementation build_libs.error_prone_gradle
@@ -73,3 +68,18 @@
testImplementation "junit:junit:4.12"
}
+apply plugin: "java-gradle-plugin"
+
+sourceSets {
+ main.java.srcDirs += "${supportRootFolder}/benchmark/gradle-plugin/src/main/kotlin"
+ main.resources.srcDirs += "${supportRootFolder}/benchmark/gradle-plugin/src/main/resources"
+}
+
+gradlePlugin {
+ plugins {
+ benchmark {
+ id = 'androidx.benchmark'
+ implementationClass = 'androidx.benchmark.gradle.BenchmarkPlugin'
+ }
+ }
+}
\ No newline at end of file
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
index b7f46cd..35fedcb 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
@@ -16,8 +16,6 @@
package androidx.build
-import androidx.benchmark.gradle.LockClocksTask
-import androidx.benchmark.gradle.UnlockClocksTask
import androidx.build.SupportConfig.BENCHMARK_INSTRUMENTATION_RUNNER
import androidx.build.SupportConfig.BUILD_TOOLS_VERSION
import androidx.build.SupportConfig.COMPILE_SDK_VERSION
@@ -316,14 +314,6 @@
CheckSameVersionLibraryGroupsTask::class.java)
buildOnServerTask.dependsOn(checkSameVersionLibraryGroupsTask)
- val adbPath = "${getSdkPath(SupportConfig.getSupportRoot(project)).path}/platform-tools/adb"
- tasks.register("lockClocks", LockClocksTask::class.java).configure {
- it.adbPath.set(adbPath)
- }
- tasks.register("unlockClocks", UnlockClocksTask::class.java).configure {
- it.adbPath.set(adbPath)
- }
-
AffectedModuleDetector.configure(gradle, this)
// If useMaxDepVersions is set, iterate through all the project and substitute any androidx
diff --git a/compose/compose-runtime/compose-runtime-benchmark/build.gradle b/compose/compose-runtime/compose-runtime-benchmark/build.gradle
index 07a7246..dcb32f6 100644
--- a/compose/compose-runtime/compose-runtime-benchmark/build.gradle
+++ b/compose/compose-runtime/compose-runtime-benchmark/build.gradle
@@ -24,6 +24,7 @@
id("com.android.library")
id("AndroidXUiPlugin")
id("kotlin-android")
+ id("androidx.benchmark")
}
android {
diff --git a/navigation/benchmark/build.gradle b/navigation/benchmark/build.gradle
index 0a308dd..ad5d976 100644
--- a/navigation/benchmark/build.gradle
+++ b/navigation/benchmark/build.gradle
@@ -22,6 +22,7 @@
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
+ id("androidx.benchmark")
}
dependencies {
diff --git a/recyclerview/recyclerview-benchmark/build.gradle b/recyclerview/recyclerview-benchmark/build.gradle
index 985934e..8b18e14 100644
--- a/recyclerview/recyclerview-benchmark/build.gradle
+++ b/recyclerview/recyclerview-benchmark/build.gradle
@@ -19,6 +19,7 @@
id("AndroidXPlugin")
id("com.android.library")
id("kotlin-android")
+ id("androidx.benchmark")
}
dependencies {
diff --git a/room/benchmark/build.gradle b/room/benchmark/build.gradle
index 966d074..b13c3b9 100644
--- a/room/benchmark/build.gradle
+++ b/room/benchmark/build.gradle
@@ -20,6 +20,7 @@
id("com.android.library")
id("kotlin-android")
id("kotlin-kapt")
+ id("androidx.benchmark")
}
dependencies {
diff --git a/slices/benchmark/build.gradle b/slices/benchmark/build.gradle
index ecb41ad..f7cb0db 100644
--- a/slices/benchmark/build.gradle
+++ b/slices/benchmark/build.gradle
@@ -21,6 +21,7 @@
plugins {
id("AndroidXPlugin")
id("com.android.library")
+ id("androidx.benchmark")
}
dependencies {
diff --git a/ui/integration-tests/benchmark/build.gradle b/ui/integration-tests/benchmark/build.gradle
index 43ecf2c..ab94dc5 100644
--- a/ui/integration-tests/benchmark/build.gradle
+++ b/ui/integration-tests/benchmark/build.gradle
@@ -24,6 +24,7 @@
id("com.android.library")
id("AndroidXUiPlugin")
id("org.jetbrains.kotlin.android")
+ id("androidx.benchmark")
}
dependencies {
diff --git a/ui/ui-layout/build.gradle b/ui/ui-layout/build.gradle
index d467d30..2af0b7e 100644
--- a/ui/ui-layout/build.gradle
+++ b/ui/ui-layout/build.gradle
@@ -27,6 +27,7 @@
id("com.android.library")
id("AndroidXUiPlugin")
id("org.jetbrains.kotlin.android")
+ id("androidx.benchmark")
}
dependencies {