Refactor baseline profiles generation and regenerate (#3434)

This commit is contained in:
AntsyLich
2026-06-22 00:50:24 +06:00
committed by GitHub
parent 3bb734dde7
commit b3e190c627
20 changed files with 63270 additions and 37972 deletions
+50
View File
@@ -0,0 +1,50 @@
import com.android.build.api.dsl.ManagedVirtualDevice
plugins {
alias(mihonx.plugins.android.test)
alias(libs.plugins.androidx.baselineProfile)
}
android {
namespace = "mihon.baselineprofile"
defaultConfig {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
targetProjectPath = ":app"
// This code creates the gradle managed device used to generate baseline profiles.
// To use GMD please invoke generation through the command line:
// ./gradlew :app:generateBaselineProfile
testOptions.managedDevices.allDevices {
@Suppress("UnstableApiUsage")
create<ManagedVirtualDevice>("pixel6Api34") {
device = "Pixel 6"
apiLevel = 34
systemImageSource = "google"
}
}
}
// This is the configuration block for the Baseline Profile plugin.
// You can specify to run the generators on a managed devices or connected devices.
baselineProfile {
managedDevices += "pixel6Api34"
useConnectedDevices = false
}
dependencies {
implementation(libs.androidx.benchmark.macroJunit4)
implementation(libs.androidx.test.junit)
implementation(libs.androidx.test.espresso.core)
implementation(libs.androidx.test.uiautomator)
}
androidComponents {
onVariants { variant ->
val artifactsLoader = variant.artifacts.getBuiltArtifactsLoader()
val applicationId = variant.testedApks.map { artifactsLoader.load(it)?.applicationId }
variant.instrumentationRunnerArguments.put("targetAppId", applicationId)
}
}