diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index d3bb2d19c4..087ae301a3 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -12,9 +12,10 @@ + - \ No newline at end of file + diff --git a/assemble_baseline_profile.sh b/assemble_baseline_profile.sh new file mode 100755 index 0000000000..8b347fec47 --- /dev/null +++ b/assemble_baseline_profile.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +./gradlew :coil-benchmark:pixel6Api31BenchmarkAndroidTest -P android.testInstrumentationRunnerArguments.class=coil.benchmark.BaselineProfileGenerator#generate -Dproject=view +mv coil-benchmark/build/outputs/managed_device_android_test_additional_output/pixel6Api31/BaselineProfileGenerator_generate-baseline-prof.txt coil-base/src/main/baseline-prof.txt +./gradlew :coil-benchmark:pixel6Api31BenchmarkAndroidTest -P android.testInstrumentationRunnerArguments.class=coil.benchmark.BaselineProfileGenerator#generate -Dproject=compose +mv coil-benchmark/build/outputs/managed_device_android_test_additional_output/pixel6Api31/BaselineProfileGenerator_generate-baseline-prof.txt coil-compose-base/src/main/baseline-prof.txt diff --git a/baseline-profile.sh b/baseline-profile.sh deleted file mode 100755 index 155ac575ef..0000000000 --- a/baseline-profile.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -./gradlew :coil-compose-benchmark:pixel2Api31BenchmarkAndroidTest -P android.testInstrumentationRunnerArguments.class=coil.compose.benchmark.BaselineProfileGenerator#generate -cp coil-compose-benchmark/build/outputs/managed_device_android_test_additional_output/pixel2Api31/BaselineProfileGenerator_generate-baseline-prof.txt coil-sample-compose/src/main/baseline-prof.txt -./gradlew :coil-compose-benchmark:connectedBenchmarkAndroidTest -P android.testInstrumentationRunnerArguments.class=coil.compose.benchmark.BaselineProfileBenchmark diff --git a/buildSrc/src/main/kotlin/Projects.kt b/buildSrc/src/main/kotlin/Projects.kt index a9825f4391..f09ac0a662 100644 --- a/buildSrc/src/main/kotlin/Projects.kt +++ b/buildSrc/src/main/kotlin/Projects.kt @@ -4,6 +4,7 @@ import com.android.build.api.dsl.CommonExtension import com.android.build.api.dsl.Lint import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension +import com.android.build.gradle.TestExtension import com.android.build.gradle.internal.dsl.BaseAppModuleExtension import org.gradle.api.JavaVersion import org.gradle.api.Project @@ -21,7 +22,7 @@ fun Project.setupLibraryModule( buildConfig: Boolean = false, publish: Boolean = false, document: Boolean = publish, - block: LibraryExtension.() -> Unit = {} + block: LibraryExtension.() -> Unit = {}, ) = setupBaseModule(name) { libraryVariants.all { generateBuildConfigProvider?.configure { enabled = buildConfig } @@ -54,6 +55,7 @@ fun Project.setupAppModule( block: BaseAppModuleExtension.() -> Unit = {} ) = setupBaseModule(name) { defaultConfig { + applicationId = name versionCode = project.versionCode versionName = project.versionName resourceConfigurations += "en" @@ -62,9 +64,20 @@ fun Project.setupAppModule( block() } +fun Project.setupTestModule( + name: String?, + block: TestExtension.() -> Unit = {}, +) = setupBaseModule(name) { + defaultConfig { + resourceConfigurations += "en" + vectorDrawables.useSupportLibrary = true + } + block() +} + private inline fun Project.setupBaseModule( name: String?, - crossinline block: T.() -> Unit = {} + crossinline block: T.() -> Unit = {}, ) = extensions.configure("android") { namespace = name compileSdkVersion(project.compileSdk) @@ -91,7 +104,7 @@ private inline fun Project.setupBaseModule( "-Xno-param-assertions", "-Xno-receiver-assertions", ) - if (project.name != "coil-test") { + if (project.name != "coil-benchmark" && project.name != "coil-test") { arguments += "-opt-in=coil.annotation.ExperimentalCoilApi" } // https://youtrack.jetbrains.com/issue/KT-41985 diff --git a/coil-benchmark/build.gradle.kts b/coil-benchmark/build.gradle.kts new file mode 100644 index 0000000000..f43179efe3 --- /dev/null +++ b/coil-benchmark/build.gradle.kts @@ -0,0 +1,48 @@ +import coil.setupTestModule +import com.android.build.api.dsl.ManagedVirtualDevice + +plugins { + id("com.android.test") + id("kotlin-android") +} + +setupTestModule(name = "coil.benchmark") { + val targetProject = System.getProperty("project", "view") + defaultConfig { + minSdk = 23 + buildConfigField("String", "PROJECT", "\"$targetProject\"") + } + buildTypes { + create("benchmark") { + isDebuggable = true + signingConfig = getByName("debug").signingConfig + matchingFallbacks += listOf("release") + } + } + testOptions { + managedDevices { + devices { + create("pixel6Api31") { + device = "Pixel 6" + apiLevel = 31 + systemImageSource = "aosp" + } + } + } + } + targetProjectPath = ":coil-sample-$targetProject" + experimentalProperties["android.experimental.self-instrumenting"] = true +} + +dependencies { + implementation(libs.androidx.benchmark.macro) + implementation(libs.androidx.test.espresso) + implementation(libs.androidx.test.junit) + implementation(libs.androidx.test.uiautomator) +} + +androidComponents { + beforeVariants(selector().all()) { + it.enable = it.buildType == "benchmark" + } +} diff --git a/coil-compose-benchmark/src/main/AndroidManifest.xml b/coil-benchmark/src/main/AndroidManifest.xml similarity index 61% rename from coil-compose-benchmark/src/main/AndroidManifest.xml rename to coil-benchmark/src/main/AndroidManifest.xml index e349690439..7106e222c8 100644 --- a/coil-compose-benchmark/src/main/AndroidManifest.xml +++ b/coil-benchmark/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ - - + + diff --git a/coil-compose-benchmark/src/main/java/coil/compose/benchmark/BaselineProfileBenchmark.kt b/coil-benchmark/src/main/java/coil/benchmark/BaselineProfileBenchmark.kt similarity index 69% rename from coil-compose-benchmark/src/main/java/coil/compose/benchmark/BaselineProfileBenchmark.kt rename to coil-benchmark/src/main/java/coil/benchmark/BaselineProfileBenchmark.kt index ae8d4e0e85..620f9bfe9d 100644 --- a/coil-compose-benchmark/src/main/java/coil/compose/benchmark/BaselineProfileBenchmark.kt +++ b/coil-benchmark/src/main/java/coil/benchmark/BaselineProfileBenchmark.kt @@ -1,4 +1,4 @@ -package coil.compose.benchmark +package coil.benchmark import androidx.benchmark.macro.BaselineProfileMode import androidx.benchmark.macro.CompilationMode @@ -6,12 +6,14 @@ import androidx.benchmark.macro.StartupMode import androidx.benchmark.macro.StartupTimingMetric import androidx.benchmark.macro.junit4.MacrobenchmarkRule import androidx.test.ext.junit.runners.AndroidJUnit4 +import coil.benchmark.BuildConfig.PROJECT import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class BaselineProfileBenchmark { + @get:Rule val benchmarkRule = MacrobenchmarkRule() @@ -22,17 +24,12 @@ class BaselineProfileBenchmark { @Test fun startupPartialCompilation() { - startup(CompilationMode.Partial( - baselineProfileMode = BaselineProfileMode.Disable, - warmupIterations = 3 - )) + startup(CompilationMode.Partial(BaselineProfileMode.Disable, warmupIterations = 3)) } @Test fun startupBaselineProfile() { - startup(CompilationMode.Partial( - baselineProfileMode = BaselineProfileMode.Require - )) + startup(CompilationMode.Partial(BaselineProfileMode.Require)) } @Test @@ -42,16 +39,13 @@ class BaselineProfileBenchmark { private fun startup(compilationMode: CompilationMode) { benchmarkRule.measureRepeated( - packageName = "sample.compose", + packageName = "sample.$PROJECT", metrics = listOf(StartupTimingMetric()), iterations = 10, startupMode = StartupMode.COLD, compilationMode = compilationMode, - setupBlock = { - pressHome() - } - ) { - startActivityAndWait() - } + setupBlock = { pressHome() }, + measureBlock = { startActivityAndWait() }, + ) } } diff --git a/coil-benchmark/src/main/java/coil/benchmark/BaselineProfileGenerator.kt b/coil-benchmark/src/main/java/coil/benchmark/BaselineProfileGenerator.kt new file mode 100644 index 0000000000..b0989c7d2f --- /dev/null +++ b/coil-benchmark/src/main/java/coil/benchmark/BaselineProfileGenerator.kt @@ -0,0 +1,45 @@ +package coil.benchmark + +import androidx.benchmark.macro.junit4.BaselineProfileRule +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation +import androidx.test.uiautomator.By +import androidx.test.uiautomator.Direction +import androidx.test.uiautomator.UiDevice +import coil.benchmark.BuildConfig.PROJECT +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +@Suppress("KotlinConstantConditions") // BuildConfig constant can change. +class BaselineProfileGenerator { + + @get:Rule + val baselineProfileRule = BaselineProfileRule() + + @Test + fun generate() = baselineProfileRule.collectBaselineProfile( + packageName = "sample.$PROJECT", + filterPredicate = newFilterPredicate(), + ) { + pressHome() + startActivityAndWait() + UiDevice.getInstance(getInstrumentation()) + .findObject( + if (PROJECT == "compose") { + By.res("list") + } else { + By.res(packageName, "list") + }, + ) + .fling(Direction.DOWN, 3000) + device.waitForIdle() + } + + private fun newFilterPredicate(): (String) -> Boolean { + // Only include Compose-specific rules in the coil-compose module. + val packageName = if (PROJECT == "compose") "coil/compose/" else "coil/" + return { line -> packageName in line && "sample/" !in line } + } +} diff --git a/coil-compose-benchmark/.gitignore b/coil-compose-benchmark/.gitignore deleted file mode 100644 index 42afabfd2a..0000000000 --- a/coil-compose-benchmark/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/coil-compose-benchmark/build.gradle.kts b/coil-compose-benchmark/build.gradle.kts deleted file mode 100644 index 44f1489210..0000000000 --- a/coil-compose-benchmark/build.gradle.kts +++ /dev/null @@ -1,68 +0,0 @@ -import coil.compileSdk -import coil.targetSdk -import com.android.build.api.dsl.ManagedVirtualDevice - -plugins { - id("com.android.test") - id("org.jetbrains.kotlin.android") -} - -android { - namespace = "coil.compose.benchmark" - compileSdk = project.compileSdk - - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = "1.8" - } - - defaultConfig { - minSdk = 23 - targetSdk = project.targetSdk - - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - // This benchmark buildType is used for benchmarking, and should function like your - // release build (for example, with minification on). It"s signed with a debug key - // for easy local/CI testing. - create("benchmark") { - isDebuggable = true - signingConfig = getByName("debug").signingConfig - matchingFallbacks += listOf("release") - } - } - - testOptions { - managedDevices { - devices { - create("pixel2Api31", ManagedVirtualDevice::class) { - device = "Pixel 2" - apiLevel = 31 - systemImageSource = "aosp" - } - } - } - } - - targetProjectPath = ":coil-sample-compose" - experimentalProperties["android.experimental.self-instrumenting"] = true -} - -dependencies { - implementation(libs.androidx.test.junit) - implementation(libs.androidx.test.espresso) - implementation(libs.androidx.test.uiautomator) - implementation(libs.androidx.benchmark.macro) -} - -androidComponents { - beforeVariants(selector().all()) { - it.enabled = it.buildType == "benchmark" - } -} diff --git a/coil-compose-benchmark/src/main/java/coil/compose/benchmark/BaselineProfileGenerator.kt b/coil-compose-benchmark/src/main/java/coil/compose/benchmark/BaselineProfileGenerator.kt deleted file mode 100644 index ed1c2c10c5..0000000000 --- a/coil-compose-benchmark/src/main/java/coil/compose/benchmark/BaselineProfileGenerator.kt +++ /dev/null @@ -1,30 +0,0 @@ -package coil.compose.benchmark - -import androidx.benchmark.macro.junit4.BaselineProfileRule -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation -import androidx.test.uiautomator.By -import androidx.test.uiautomator.Direction -import androidx.test.uiautomator.UiDevice -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith - -@RunWith(AndroidJUnit4::class) -class BaselineProfileGenerator { - @get:Rule - val baselineProfileRule = BaselineProfileRule() - - @Test - fun generate() = baselineProfileRule.collectBaselineProfile( - packageName = "sample.compose", packageFilters = listOf("coil") - ) { - pressHome() - startActivityAndWait() - val instrumentedDevice = UiDevice.getInstance(getInstrumentation()) - instrumentedDevice - .findObject(By.res("scrollableContent")) - .fling(Direction.DOWN, 3000) - device.waitForIdle() - } -} diff --git a/coil-sample-compose/shrinker-rules-android.pro b/coil-sample-common/shrinker-rules-android.pro similarity index 100% rename from coil-sample-compose/shrinker-rules-android.pro rename to coil-sample-common/shrinker-rules-android.pro diff --git a/coil-sample-compose/shrinker-rules.pro b/coil-sample-common/shrinker-rules.pro similarity index 100% rename from coil-sample-compose/shrinker-rules.pro rename to coil-sample-common/shrinker-rules.pro diff --git a/coil-sample-compose/baseline-profile-rules.pro b/coil-sample-compose/baseline-profile-rules.pro deleted file mode 100644 index e9caf6359a..0000000000 --- a/coil-sample-compose/baseline-profile-rules.pro +++ /dev/null @@ -1 +0,0 @@ --dontobfuscate diff --git a/coil-sample-compose/build.gradle.kts b/coil-sample-compose/build.gradle.kts index 3abfd649e4..c8d2350ab5 100644 --- a/coil-sample-compose/build.gradle.kts +++ b/coil-sample-compose/build.gradle.kts @@ -6,22 +6,22 @@ plugins { } setupAppModule(name = "sample.compose") { - defaultConfig { - applicationId = "sample.compose" - } buildTypes { release { isMinifyEnabled = true isShrinkResources = true - proguardFiles("shrinker-rules.pro", "shrinker-rules-android.pro") + proguardFiles( + "../coil-sample-common/shrinker-rules.pro", + "../coil-sample-common/shrinker-rules-android.pro", + ) signingConfig = signingConfigs["debug"] } - create("benchmark") { - signingConfig = signingConfigs.getByName("debug") - matchingFallbacks += listOf("release") isDebuggable = false - proguardFiles("baseline-profile-rules.pro") + isMinifyEnabled = false + isShrinkResources = false + matchingFallbacks += listOf("release") + signingConfig = signingConfigs.getByName("debug") } } buildFeatures { diff --git a/coil-sample-compose/src/main/java/sample/compose/MainActivity.kt b/coil-sample-compose/src/main/java/sample/compose/MainActivity.kt index 4430acae61..698d5c468d 100644 --- a/coil-sample-compose/src/main/java/sample/compose/MainActivity.kt +++ b/coil-sample-compose/src/main/java/sample/compose/MainActivity.kt @@ -172,9 +172,9 @@ private fun ListScreen( val numColumns = remember(context) { numberOfColumns(context) } LazyVerticalStaggeredGrid( - modifier = Modifier.testTag("scrollableContent"), columns = StaggeredGridCells.Fixed(numColumns), state = gridState, + modifier = Modifier.testTag("list"), ) { items(images) { image -> // Scale the image to fit the width of a column. diff --git a/coil-sample-view/build.gradle.kts b/coil-sample-view/build.gradle.kts index ca3cd515ae..3800b46faf 100644 --- a/coil-sample-view/build.gradle.kts +++ b/coil-sample-view/build.gradle.kts @@ -5,17 +5,24 @@ plugins { id("kotlin-android") } -setupAppModule(name = "coil.sample") { - defaultConfig { - applicationId = "coil.sample" - } +setupAppModule(name = "sample.view") { buildTypes { release { isMinifyEnabled = true isShrinkResources = true - proguardFiles("shrinker-rules.pro", "shrinker-rules-android.pro") + proguardFiles( + "../coil-sample-common/shrinker-rules.pro", + "../coil-sample-common/shrinker-rules-android.pro", + ) signingConfig = signingConfigs["debug"] } + create("benchmark") { + isDebuggable = false + isMinifyEnabled = false + isShrinkResources = false + matchingFallbacks += listOf("release") + signingConfig = signingConfigs.getByName("debug") + } } buildFeatures { viewBinding = true diff --git a/coil-sample-view/shrinker-rules-android.pro b/coil-sample-view/shrinker-rules-android.pro deleted file mode 100644 index 0a286c76fa..0000000000 --- a/coil-sample-view/shrinker-rules-android.pro +++ /dev/null @@ -1,49 +0,0 @@ -# This is a configuration file for ProGuard. -# https://proguard.sourceforge.net/index.html#manual/usage.html - --dontpreverify --dontusemixedcaseclassnames --dontskipnonpubliclibraryclasses --verbose - -# Preserve some attributes that may be required for reflection. --keepattributes *Annotation*,Signature,InnerClasses,EnclosingMethod - -# For native methods, see https://proguard.sourceforge.net/manual/examples.html#native --keepclasseswithmembernames class * { native ; } - -# Keep setters in views so that animations can still work. --keepclassmembers public class * extends android.view.View { - void set*(***); - *** get*(); -} - -# For enumeration classes, see https://proguard.sourceforge.net/manual/examples.html#enumerations --keepclassmembers enum * { - public static **[] values(); - public static ** valueOf(java.lang.String); -} --keepclassmembers class * implements android.os.Parcelable { public static final ** CREATOR; } - -# Preserve annotated Javascript interface methods. --keepclassmembers class * { @android.webkit.JavascriptInterface ; } - -# The support libraries contains references to newer platform versions. -# Don't warn about those in case this app is linking against an older -# platform version. We know about them, and they are safe. --dontnote androidx.** --dontwarn androidx.** - -# Understand the @Keep support annotation. --keep class androidx.annotation.Keep --keep @androidx.annotation.Keep class * { *; } --keepclasseswithmembers class * { @androidx.annotation.Keep ; } --keepclasseswithmembers class * { @androidx.annotation.Keep ; } --keepclasseswithmembers class * { @androidx.annotation.Keep (...); } - -# These classes are duplicated between android.jar and org.apache.http.legacy.jar. --dontnote org.apache.http.** --dontnote android.net.http.** - -# These classes are duplicated between android.jar and core-lambda-stubs.jar. --dontnote java.lang.invoke.** diff --git a/coil-sample-view/shrinker-rules.pro b/coil-sample-view/shrinker-rules.pro deleted file mode 100644 index 587be2c0c7..0000000000 --- a/coil-sample-view/shrinker-rules.pro +++ /dev/null @@ -1,23 +0,0 @@ -# This is a configuration file for ProGuard. -# https://proguard.sourceforge.net/index.html#manual/usage.html - --allowaccessmodification --flattenpackagehierarchy --mergeinterfacesaggressively --dontnote * - -# Remove intrinsic assertions. --assumenosideeffects class kotlin.jvm.internal.Intrinsics { - public static void checkExpressionValueIsNotNull(...); - public static void checkNotNullExpressionValue(...); - public static void checkParameterIsNotNull(...); - public static void checkNotNullParameter(...); - public static void checkFieldIsNotNull(...); - public static void checkReturnedValueIsNotNull(...); -} - -# https://github.com/square/okhttp/issues/6258 --dontwarn okhttp3.internal.platform.** --dontwarn org.conscrypt.** --dontwarn org.bouncycastle.** --dontwarn org.openjsse.** diff --git a/coil-sample-view/src/main/AndroidManifest.xml b/coil-sample-view/src/main/AndroidManifest.xml index 80d74d776b..bfa3869233 100644 --- a/coil-sample-view/src/main/AndroidManifest.xml +++ b/coil-sample-view/src/main/AndroidManifest.xml @@ -15,8 +15,12 @@ android:theme="@style/AppTheme" tools:ignore="GoogleAppIndexingWarning"> + + diff --git a/coil-sample-view/src/main/java/coil/sample/ImageListAdapter.kt b/coil-sample-view/src/main/java/sample/view/ImageListAdapter.kt similarity index 96% rename from coil-sample-view/src/main/java/coil/sample/ImageListAdapter.kt rename to coil-sample-view/src/main/java/sample/view/ImageListAdapter.kt index 8630260a8f..fe51692ec4 100644 --- a/coil-sample-view/src/main/java/coil/sample/ImageListAdapter.kt +++ b/coil-sample-view/src/main/java/sample/view/ImageListAdapter.kt @@ -1,4 +1,4 @@ -package coil.sample +package sample.view import android.graphics.Color import android.graphics.drawable.ColorDrawable @@ -11,10 +11,10 @@ import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import coil.load import coil.memory.MemoryCache -import coil.sample.ImageListAdapter.ViewHolder import sample.common.Image import sample.common.Screen import sample.common.calculateScaledSize +import sample.view.ImageListAdapter.ViewHolder class ImageListAdapter( private val numColumns: Int, diff --git a/coil-sample-view/src/main/java/coil/sample/MainActivity.kt b/coil-sample-view/src/main/java/sample/view/MainActivity.kt similarity index 98% rename from coil-sample-view/src/main/java/coil/sample/MainActivity.kt rename to coil-sample-view/src/main/java/sample/view/MainActivity.kt index 14666d71d3..9d57d98a35 100644 --- a/coil-sample-view/src/main/java/coil/sample/MainActivity.kt +++ b/coil-sample-view/src/main/java/sample/view/MainActivity.kt @@ -1,4 +1,4 @@ -package coil.sample +package sample.view import android.os.Build.VERSION.SDK_INT import android.os.Bundle @@ -16,7 +16,6 @@ import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.StaggeredGridLayoutManager import androidx.recyclerview.widget.StaggeredGridLayoutManager.VERTICAL import coil.load -import coil.sample.databinding.ActivityMainBinding import kotlinx.coroutines.launch import sample.common.AssetType import sample.common.Image @@ -24,6 +23,7 @@ import sample.common.MainViewModel import sample.common.Screen import sample.common.next import sample.common.numberOfColumns +import sample.view.databinding.ActivityMainBinding class MainActivity : AppCompatActivity() { diff --git a/coil-sample-view/src/main/java/coil/sample/Utils.kt b/coil-sample-view/src/main/java/sample/view/Utils.kt similarity index 97% rename from coil-sample-view/src/main/java/coil/sample/Utils.kt rename to coil-sample-view/src/main/java/sample/view/Utils.kt index 11dd8738e1..009c293dcf 100644 --- a/coil-sample-view/src/main/java/coil/sample/Utils.kt +++ b/coil-sample-view/src/main/java/sample/view/Utils.kt @@ -1,6 +1,6 @@ @file:Suppress("NOTHING_TO_INLINE") -package coil.sample +package sample.view import android.view.LayoutInflater import android.view.View diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bb8bc04327..20f3a9b02f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,7 +1,6 @@ [versions] androidx-activity = "1.4.0" androidx-lifecycle = "2.4.1" -androidx-profile-installer = "1.3.0-alpha02" androidx-test = "1.5.0" compose = "1.3.1" composeCompiler = "1.3.2" @@ -34,7 +33,7 @@ androidx-exifinterface = "androidx.exifinterface:exifinterface:1.3.5" androidx-lifecycle-runtime = { module = "androidx.lifecycle:lifecycle-runtime", version.ref = "androidx-lifecycle" } androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidx-lifecycle" } androidx-lifecycle-viewmodel-compose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" } -androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "androidx-profile-installer" } +androidx-profileinstaller = "androidx.profileinstaller:profileinstaller:1.3.0-alpha02" androidx-recyclerview = "androidx.recyclerview:recyclerview:1.2.1" androidx-test-core = { module = "androidx.test:core-ktx", version.ref = "androidx-test" } androidx-test-espresso = "androidx.test.espresso:espresso-core:3.5.0" diff --git a/publish_remote.sh b/publish_remote.sh index c116c6ac72..f0c39be5e6 100755 --- a/publish_remote.sh +++ b/publish_remote.sh @@ -1,4 +1,11 @@ #!/bin/bash -# Build and upload the artifacts to 'mavenCentral'. -./gradlew publish +# Build the baseline profile. +./assemble_baseline_profile.sh + +if [[ `git status --porcelain` ]]; then + echo "The baseline profile has changed. Commit the changes before publishing." +else + # Build and upload the artifacts to 'mavenCentral'. + ./gradlew publish +fi diff --git a/settings.gradle.kts b/settings.gradle.kts index b9d535e935..a74abf886f 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -17,9 +17,9 @@ include( // Private modules include( + "coil-benchmark", "coil-sample-common", "coil-sample-compose", "coil-sample-view", "coil-test", - "coil-compose-benchmark", ) diff --git a/test_baseline_profile.sh b/test_baseline_profile.sh new file mode 100755 index 0000000000..22cd1f370a --- /dev/null +++ b/test_baseline_profile.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +./gradlew :coil-benchmark:connectedBenchmarkAndroidTest -P android.testInstrumentationRunnerArguments.class=coil.benchmark.BaselineProfileBenchmark