diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-11-10 00:45:15 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-11-10 00:45:15 +0000 |
commit | 0e34afa5bd92219861b71da020cc9e16d2911ffc (patch) | |
tree | 08bcfb829adce342e52de495169614c1884e1767 | |
parent | cec28500f1ae807d253fdbd61ef0a838cdc930db (diff) | |
parent | d9379d7f0646af8f012b29d77f057ee3fda7a8dc (diff) | |
download | support-snap-temp-L80700030000204720.tar.gz |
Merge "Merge cherrypicks of ['android-review.googlesource.com/2824842'] into androidx-benchmark-release." into androidx-benchmark-releasesnap-temp-L80700030000204720snap-temp-L76100030000200210snap-temp-L46700030000216862
4 files changed, 49 insertions, 48 deletions
diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt index 92660a31816..4babdfbf53c 100644 --- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt +++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/apptarget/BaselineProfileAppTargetPluginTest.kt @@ -17,9 +17,9 @@ package androidx.baselineprofile.gradle.apptarget import androidx.baselineprofile.gradle.utils.BaselineProfileProjectSetupRule -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_0_0 -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_1_0 -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_ALL +import androidx.baselineprofile.gradle.utils.TestAgpVersion +import androidx.baselineprofile.gradle.utils.TestAgpVersion.TEST_AGP_VERSION_8_0_0 +import androidx.baselineprofile.gradle.utils.TestAgpVersion.TEST_AGP_VERSION_8_1_0 import androidx.baselineprofile.gradle.utils.build import androidx.baselineprofile.gradle.utils.buildAndAssertThatOutput import com.google.common.truth.Truth.assertThat @@ -66,15 +66,15 @@ private val buildGradle = """ """.trimIndent() @RunWith(Parameterized::class) -class BaselineProfileAppTargetPluginTest(agpVersion: String?) { +class BaselineProfileAppTargetPluginTest(agpVersion: TestAgpVersion) { @get:Rule - val projectSetup = BaselineProfileProjectSetupRule(forceAgpVersion = agpVersion) + val projectSetup = BaselineProfileProjectSetupRule(forceAgpVersion = agpVersion.versionString) companion object { @Parameterized.Parameters(name = "agpVersion={0}") @JvmStatic - fun parameters() = TEST_AGP_VERSION_ALL + fun parameters() = TestAgpVersion.values() } @Test @@ -134,7 +134,7 @@ class BaselineProfileAppTargetPluginTestWithAgp80 { @get:Rule val projectSetup = BaselineProfileProjectSetupRule( - forceAgpVersion = TEST_AGP_VERSION_8_0_0 + forceAgpVersion = TEST_AGP_VERSION_8_0_0.versionString ) @Test @@ -172,7 +172,7 @@ class BaselineProfileAppTargetPluginTestWithAgp81 { @get:Rule val projectSetup = BaselineProfileProjectSetupRule( - forceAgpVersion = TEST_AGP_VERSION_8_1_0 + forceAgpVersion = TEST_AGP_VERSION_8_1_0.versionString ) @Test diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt index 5c47623a83f..38b3357e2d5 100644 --- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt +++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/consumer/BaselineProfileConsumerPluginTest.kt @@ -21,9 +21,9 @@ import androidx.baselineprofile.gradle.utils.ANDROID_LIBRARY_PLUGIN import androidx.baselineprofile.gradle.utils.ANDROID_TEST_PLUGIN import androidx.baselineprofile.gradle.utils.BaselineProfileProjectSetupRule import androidx.baselineprofile.gradle.utils.Fixtures -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_0_0 -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_1_0 -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_ALL +import androidx.baselineprofile.gradle.utils.TestAgpVersion +import androidx.baselineprofile.gradle.utils.TestAgpVersion.TEST_AGP_VERSION_8_0_0 +import androidx.baselineprofile.gradle.utils.TestAgpVersion.TEST_AGP_VERSION_8_1_0 import androidx.baselineprofile.gradle.utils.VariantProfile import androidx.baselineprofile.gradle.utils.build import androidx.baselineprofile.gradle.utils.buildAndAssertThatOutput @@ -44,16 +44,16 @@ import org.junit.runners.Parameterized private const val EXPECTED_PROFILE_FOLDER = "generated/baselineProfiles" @RunWith(Parameterized::class) -class BaselineProfileConsumerPluginTest(private val agpVersion: String?) { +class BaselineProfileConsumerPluginTest(private val agpVersion: TestAgpVersion) { companion object { @Parameterized.Parameters(name = "agpVersion={0}") @JvmStatic - fun parameters() = TEST_AGP_VERSION_ALL + fun parameters() = TestAgpVersion.values() } @get:Rule - val projectSetup = BaselineProfileProjectSetupRule(forceAgpVersion = agpVersion) + val projectSetup = BaselineProfileProjectSetupRule(forceAgpVersion = agpVersion.versionString) private val gradleRunner by lazy { projectSetup.consumer.gradleRunner } @@ -67,10 +67,12 @@ class BaselineProfileConsumerPluginTest(private val agpVersion: String?) { "src/$variantName/$EXPECTED_PROFILE_FOLDER/startup-prof.txt" ) - private fun mergedArtProfile(variantName: String) = File( - projectSetup.consumer.rootDir, - "build/intermediates/merged_art_profile/$variantName/baseline-prof.txt" - ) + private fun mergedArtProfile(variantName: String): File { + return File( + projectSetup.consumer.rootDir, + "build/intermediates/merged_art_profile/$variantName/baseline-prof.txt" + ) + } private fun readBaselineProfileFileContent(variantName: String): List<String> = baselineProfileFile(variantName).readLines() @@ -1022,7 +1024,10 @@ class BaselineProfileConsumerPluginTest(private val agpVersion: String?) { """.trimIndent() ) - data class VariantAndProfile(val variantName: String, val profile: List<String>) + data class VariantAndProfile( + val variantName: String, + val profile: List<String> + ) val freeRelease = VariantAndProfile( variantName = "freeRelease", @@ -1051,10 +1056,11 @@ class BaselineProfileConsumerPluginTest(private val agpVersion: String?) { paidReleaseProfileLines = paidRelease.profile, ) - gradleRunner - .build("mergeFreeReleaseArtProfile", "mergePaidReleaseArtProfile") {} + val variants = arrayOf(freeRelease, paidRelease) + val tasks = variants.map { camelCase("merge", it.variantName, "ArtProfile") } + gradleRunner.build(*(tasks.toTypedArray())) {} - arrayOf(freeRelease, paidRelease).forEach { + variants.forEach { val notFound = mergedArtProfile(it.variantName) .readLines() .require(*(it.profile).toTypedArray()) @@ -1371,7 +1377,7 @@ class BaselineProfileConsumerPluginTestWithAgp80 { @get:Rule val projectSetup = BaselineProfileProjectSetupRule( - forceAgpVersion = TEST_AGP_VERSION_8_0_0 + forceAgpVersion = TEST_AGP_VERSION_8_0_0.versionString ) @Test @@ -1535,7 +1541,7 @@ class BaselineProfileConsumerPluginTestWithAgp81 { @get:Rule val projectSetup = BaselineProfileProjectSetupRule( - forceAgpVersion = TEST_AGP_VERSION_8_1_0 + forceAgpVersion = TEST_AGP_VERSION_8_1_0.versionString ) @Test @@ -1746,17 +1752,17 @@ class BaselineProfileConsumerPluginTestWithAgp81 { } @RunWith(Parameterized::class) -class BaselineProfileConsumerPluginTestWithKmp(agpVersion: String?) { +class BaselineProfileConsumerPluginTestWithKmp(agpVersion: TestAgpVersion) { companion object { @Parameterized.Parameters(name = "agpVersion={0}") @JvmStatic - fun parameters() = TEST_AGP_VERSION_ALL + fun parameters() = TestAgpVersion.values() } @get:Rule val projectSetup = BaselineProfileProjectSetupRule( - forceAgpVersion = agpVersion, + forceAgpVersion = agpVersion.versionString, addKotlinGradlePluginToClasspath = true ) diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPluginTest.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPluginTest.kt index af8be8ea120..eeb142e0fc9 100644 --- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPluginTest.kt +++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/producer/BaselineProfileProducerPluginTest.kt @@ -17,10 +17,10 @@ package androidx.baselineprofile.gradle.producer import androidx.baselineprofile.gradle.utils.BaselineProfileProjectSetupRule -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_0_0 -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_1_0 -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_8_2_0 -import androidx.baselineprofile.gradle.utils.TEST_AGP_VERSION_ALL +import androidx.baselineprofile.gradle.utils.TestAgpVersion +import androidx.baselineprofile.gradle.utils.TestAgpVersion.TEST_AGP_VERSION_8_0_0 +import androidx.baselineprofile.gradle.utils.TestAgpVersion.TEST_AGP_VERSION_8_1_0 +import androidx.baselineprofile.gradle.utils.TestAgpVersion.TEST_AGP_VERSION_8_2_0 import androidx.baselineprofile.gradle.utils.VariantProfile import androidx.baselineprofile.gradle.utils.build import androidx.baselineprofile.gradle.utils.buildAndAssertThatOutput @@ -38,7 +38,7 @@ class BaselineProfileProducerPluginTestWithAgp80 { @get:Rule val projectSetup = BaselineProfileProjectSetupRule( - forceAgpVersion = TEST_AGP_VERSION_8_0_0 + forceAgpVersion = TEST_AGP_VERSION_8_0_0.versionString ) private val emptyReleaseVariantProfile = VariantProfile( @@ -70,7 +70,7 @@ class BaselineProfileProducerPluginTestWithAgp81 { @get:Rule val projectSetup = BaselineProfileProjectSetupRule( - forceAgpVersion = TEST_AGP_VERSION_8_1_0 + forceAgpVersion = TEST_AGP_VERSION_8_1_0.versionString ) private val emptyReleaseVariantProfile = VariantProfile( @@ -103,7 +103,7 @@ class BaselineProfileProducerPluginTestWithAgp82 { @get:Rule val projectSetup = BaselineProfileProjectSetupRule( - forceAgpVersion = TEST_AGP_VERSION_8_2_0 + forceAgpVersion = TEST_AGP_VERSION_8_2_0.versionString ) private val emptyReleaseVariantProfile = VariantProfile( @@ -184,16 +184,16 @@ class BaselineProfileProducerPluginTestWithAgp82 { } @RunWith(Parameterized::class) -class BaselineProfileProducerPluginTest(agpVersion: String?) { +class BaselineProfileProducerPluginTest(agpVersion: TestAgpVersion) { companion object { @Parameterized.Parameters(name = "agpVersion={0}") @JvmStatic - fun parameters() = TEST_AGP_VERSION_ALL + fun parameters() = TestAgpVersion.values() } @get:Rule - val projectSetup = BaselineProfileProjectSetupRule(forceAgpVersion = agpVersion) + val projectSetup = BaselineProfileProjectSetupRule(forceAgpVersion = agpVersion.versionString) private val emptyReleaseVariantProfile = VariantProfile( flavor = null, diff --git a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt index 220b1d2bc51..ea5d250f127 100644 --- a/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt +++ b/benchmark/baseline-profile-gradle-plugin/src/test/kotlin/androidx/baselineprofile/gradle/utils/Constants.kt @@ -16,14 +16,9 @@ package androidx.baselineprofile.gradle.utils -internal const val TEST_AGP_VERSION_8_0_0 = "8.0.0-beta03" -internal const val TEST_AGP_VERSION_8_1_0 = "8.1.0-beta05" -internal const val TEST_AGP_VERSION_8_2_0 = "8.2.0-alpha04" -internal val TEST_AGP_VERSION_CURRENT = null - -internal val TEST_AGP_VERSION_ALL = arrayOf<String?>( - TEST_AGP_VERSION_8_0_0, - TEST_AGP_VERSION_8_1_0, - TEST_AGP_VERSION_8_2_0, - TEST_AGP_VERSION_CURRENT, -) +enum class TestAgpVersion(val versionString: String?) { + TEST_AGP_VERSION_8_0_0("8.0.0-beta03"), + TEST_AGP_VERSION_8_1_0("8.1.0-beta05"), + TEST_AGP_VERSION_8_2_0("8.2.0-alpha04"), + TEST_AGP_VERSION_CURRENT(null) +} |