mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 18:47:03 +05:30
refactor: slim down per-module dependencies
dependency-analysis plugin coming in clutch as usual
This commit is contained in:
parent
541acf4ef1
commit
eed64b95df
7 changed files with 2 additions and 99 deletions
|
@ -6,9 +6,6 @@
|
|||
*/
|
||||
@file:Suppress("UnstableApiUsage")
|
||||
|
||||
import com.android.build.api.dsl.ApplicationExtension
|
||||
import dev.msfjarvis.claw.gradle.addTestDependencies
|
||||
|
||||
plugins {
|
||||
id("dev.msfjarvis.claw.android-application")
|
||||
id("dev.msfjarvis.claw.rename-artifacts")
|
||||
|
@ -18,19 +15,16 @@ plugins {
|
|||
id("dev.msfjarvis.claw.versioning-plugin")
|
||||
id("kotlin-parcelize")
|
||||
alias(libs.plugins.aboutlibraries)
|
||||
alias(libs.plugins.android.junit5)
|
||||
alias(libs.plugins.anvil)
|
||||
alias(libs.plugins.modulegraphassert)
|
||||
alias(libs.plugins.whetstone)
|
||||
alias(libs.plugins.licensee)
|
||||
alias(libs.plugins.tracelog)
|
||||
alias(libs.plugins.kotlin.composeCompiler)
|
||||
alias(libs.plugins.kotlin.serialization)
|
||||
alias(libs.plugins.dependencyAnalysis)
|
||||
}
|
||||
|
||||
// Directly using the generated `android` accessor lights up bright red
|
||||
extensions.configure<ApplicationExtension> {
|
||||
android {
|
||||
namespace = "dev.msfjarvis.claw.android"
|
||||
defaultConfig.applicationId = "dev.msfjarvis.claw.android"
|
||||
defaultConfig.testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
@ -93,7 +87,6 @@ dependencies {
|
|||
implementation(libs.androidx.compose.runtime)
|
||||
implementation(libs.androidx.compose.ui)
|
||||
implementation(libs.androidx.compose.ui.text)
|
||||
implementation(libs.androidx.compose.ui.util)
|
||||
implementation(libs.androidx.core.splashscreen)
|
||||
implementation(libs.androidx.lifecycle.compose)
|
||||
implementation(libs.androidx.material3.navigation3)
|
||||
|
@ -105,7 +98,6 @@ dependencies {
|
|||
implementation(libs.dagger)
|
||||
implementation(libs.eithernet)
|
||||
implementation(libs.haze)
|
||||
implementation(libs.haze.materials)
|
||||
implementation(libs.javax.inject)
|
||||
implementation(libs.kotlinx.collections.immutable)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
|
@ -127,8 +119,4 @@ dependencies {
|
|||
implementation(projects.web)
|
||||
|
||||
kapt(libs.dagger.compiler)
|
||||
|
||||
addTestDependencies(project)
|
||||
androidTestImplementation(libs.androidx.test.uiautomator)
|
||||
androidTestImplementation(libs.leakcanary.android.test)
|
||||
}
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* Copyright © Harsh Shandilya.
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
package dev.msfjarvis.claw.android
|
||||
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.BySelector
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import androidx.test.uiautomator.UiObject2
|
||||
import androidx.test.uiautomator.Until
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import de.mannodermaus.junit5.ActivityScenarioExtension
|
||||
import leakcanary.repeatingAndroidInProcessScenario
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.junit.jupiter.api.extension.RegisterExtension
|
||||
import shark.HeapDiff
|
||||
|
||||
class HeapGrowthCheck {
|
||||
@JvmField
|
||||
@RegisterExtension
|
||||
@Suppress("Unused")
|
||||
val scenarioExtension = ActivityScenarioExtension.launch<MainActivity>()
|
||||
private val detector = HeapDiff.repeatingAndroidInProcessScenario()
|
||||
private lateinit var device: UiDevice
|
||||
|
||||
@BeforeEach
|
||||
fun setUp() {
|
||||
val instrumentation = InstrumentationRegistry.getInstrumentation()
|
||||
device = UiDevice.getInstance(instrumentation)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun verify_heap_growth() {
|
||||
val heapGrowth = detector.findRepeatedlyGrowingObjects { device.exploreScreens() }
|
||||
assertThat(heapGrowth.growingObjects).isEmpty()
|
||||
}
|
||||
|
||||
private companion object {
|
||||
fun UiDevice.exploreScreens() {
|
||||
listOf("HOTTEST", "NEWEST", "SAVED").forEach { tag ->
|
||||
waitForObject(By.res(tag)).click()
|
||||
waitForIdle()
|
||||
}
|
||||
}
|
||||
|
||||
private fun UiDevice.waitForObject(selector: BySelector, timeout: Long = 10_000L): UiObject2 {
|
||||
if (wait(Until.hasObject(selector), timeout)) {
|
||||
return findObject(selector)
|
||||
}
|
||||
|
||||
error("Object with selector [$selector] not found")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue