代码优化

This commit is contained in:
HapeLee
2026-05-13 21:22:44 +08:00
parent 4beeb2d4f6
commit 876f1370ec
21 changed files with 126200 additions and 331 deletions
+8 -16
View File
@@ -1,5 +1,3 @@
import com.android.build.api.dsl.ManagedVirtualDevice
plugins {
alias(libs.plugins.android.test)
alias(libs.plugins.baselineprofile)
@@ -20,7 +18,7 @@ android {
defaultConfig {
minSdk = 28
targetSdk = 36
targetSdk = 37
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
@@ -31,24 +29,13 @@ android {
productFlavors {
create("app") { dimension = "mode" }
}
// 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 {
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
// managedDevices += "pixel6Api34"
useConnectedDevices = true
}
dependencies {
@@ -59,6 +46,11 @@ dependencies {
}
androidComponents {
beforeVariants { v ->
if (v.buildType == "noR8" || v.buildType == "debug") {
v.enable = false
}
}
onVariants { v ->
val artifactsLoader = v.artifacts.getBuiltArtifactsLoader()
v.instrumentationRunnerArguments.put(