fix: remove benchmark project

This has barely ever worked and I'm kinda done with it
This commit is contained in:
Harsh Shandilya 2025-06-07 09:26:14 +05:30
parent 93b593bd41
commit 123e2c9eb2
11 changed files with 2 additions and 246 deletions

View file

@ -23,7 +23,6 @@ plugins {
alias(libs.plugins.anvil) alias(libs.plugins.anvil)
alias(libs.plugins.modulegraphassert) alias(libs.plugins.modulegraphassert)
alias(libs.plugins.whetstone) alias(libs.plugins.whetstone)
alias(libs.plugins.baselineprofile)
alias(libs.plugins.licensee) alias(libs.plugins.licensee)
alias(libs.plugins.tracelog) alias(libs.plugins.tracelog)
alias(libs.plugins.kotlin.composeCompiler) alias(libs.plugins.kotlin.composeCompiler)
@ -47,13 +46,6 @@ extensions.configure<ApplicationExtension> {
aboutLibraries.collect.gitHubApiToken = providers.environmentVariable("GITHUB_TOKEN").orNull aboutLibraries.collect.gitHubApiToken = providers.environmentVariable("GITHUB_TOKEN").orNull
baselineProfile {
mergeIntoMain = true
saveInSrc = true
// dependencyProject is deprecated, needs new APIs in the baseline profile plugin.
@Suppress("deprecation") from(projects.benchmark.dependencyProject)
}
composeCompiler { composeCompiler {
featureFlags.addAll( featureFlags.addAll(
ComposeFeatureFlag.OptimizeNonSkippingGroups, ComposeFeatureFlag.OptimizeNonSkippingGroups,
@ -145,7 +137,6 @@ dependencies {
kapt(libs.dagger.compiler) kapt(libs.dagger.compiler)
addTestDependencies(project) addTestDependencies(project)
androidTestImplementation(libs.androidx.test.espresso.core)
androidTestImplementation(libs.androidx.test.uiautomator) androidTestImplementation(libs.androidx.test.uiautomator)
androidTestImplementation(libs.leakcanary.android.test) androidTestImplementation(libs.leakcanary.android.test)
} }

View file

@ -1 +0,0 @@
/build

View file

@ -1,49 +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.
*/
@file:Suppress("UnstableApiUsage")
plugins {
id(libs.plugins.android.test.get().pluginId)
id("dev.msfjarvis.claw.kotlin-android")
alias(libs.plugins.baselineprofile)
alias(libs.plugins.dependencyAnalysis)
}
android {
namespace = "dev.msfjarvis.claw.benchmark"
compileSdk = 34
defaultConfig {
minSdk = 28
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
create("benchmark") {
isDebuggable = true
signingConfig = signingConfigs["debug"]
matchingFallbacks += "release"
}
}
targetProjectPath = ":android"
}
baselineProfile {
useConnectedDevices = true
enableEmulatorDisplay = false
}
dependencies {
implementation(libs.androidx.benchmark.macro.junit4)
implementation(libs.androidx.profileinstaller)
implementation(libs.androidx.test.core)
implementation(libs.androidx.test.espresso.core)
implementation(libs.androidx.test.ext.junit)
implementation(libs.androidx.test.rules)
implementation(libs.androidx.test.runner)
implementation(libs.androidx.test.uiautomator)
}

View file

@ -1,11 +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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<queries>
<package android:name="dev.msfjarvis.claw.android" />
</queries>
</manifest>

View file

@ -1,67 +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.benchmark
import androidx.benchmark.macro.BaselineProfileMode
import androidx.benchmark.macro.CompilationMode
import androidx.benchmark.macro.FrameTimingMetric
import androidx.benchmark.macro.StartupMode
import androidx.benchmark.macro.StartupTimingMetric
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import org.junit.Before
import org.junit.Rule
import org.junit.Test
class BaselineProfileBenchmark {
@get:Rule val benchmarkRule = MacrobenchmarkRule()
private lateinit var device: UiDevice
@Before
fun setUp() {
val instrumentation = InstrumentationRegistry.getInstrumentation()
device = UiDevice.getInstance(instrumentation)
}
@Test
fun noCompilation() {
exploreUI(CompilationMode.None())
}
@Test
fun fullyCompiled() {
exploreUI(CompilationMode.Full())
}
@Test
fun baselineProfile() {
exploreUI(CompilationMode.Partial(baselineProfileMode = BaselineProfileMode.Require))
}
private fun exploreUI(compilationMode: CompilationMode) {
benchmarkRule.measureRepeated(
packageName = PACKAGE_NAME,
metrics = listOf(FrameTimingMetric(), StartupTimingMetric()),
compilationMode = compilationMode,
startupMode = StartupMode.COLD,
iterations = 10,
) {
device.executeShellCommand("pm clear $PACKAGE_NAME")
startActivityAndWait()
device.waitForIdle()
device.savePosts()
device.exploreScreens()
device.returnToHottestScreen()
}
}
}

View file

@ -1,45 +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.benchmark
import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.UiDevice
import org.junit.Before
import org.junit.Rule
import org.junit.Test
class BaselineProfileGenerator {
@get:Rule val baselineProfileRule = BaselineProfileRule()
private lateinit var device: UiDevice
@Before
fun setUp() {
val instrumentation = InstrumentationRegistry.getInstrumentation()
device = UiDevice.getInstance(instrumentation)
}
@Test
fun generateBaselineProfile() =
baselineProfileRule.collect(
packageName = PACKAGE_NAME,
maxIterations = 8,
includeInStartupProfile = true,
) {
device.executeShellCommand("pm clear $PACKAGE_NAME")
startActivityAndWait()
device.waitForIdle()
device.savePosts()
device.exploreScreens()
device.returnToHottestScreen()
}
}

View file

@ -1,43 +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.benchmark
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
const val PACKAGE_NAME = "dev.msfjarvis.claw.android"
private const val AWAIT_TIMEOUT = 10_000L
private const val SAVE_BUTTON_ID = "save_button"
private const val NAV_ID_HOTTEST = "HOTTEST"
private const val NAV_ID_NEWEST = "NEWEST"
private const val NAV_ID_SAVED = "SAVED"
fun UiDevice.savePosts() {
waitForObject(By.res(SAVE_BUTTON_ID)).click()
}
fun UiDevice.exploreScreens() {
listOf(NAV_ID_HOTTEST, NAV_ID_NEWEST, NAV_ID_SAVED).forEach { tag ->
waitForObject(By.res(tag)).click()
waitForIdle()
}
}
fun UiDevice.returnToHottestScreen() {
waitForObject(By.res(NAV_ID_HOTTEST)).click()
}
private fun UiDevice.waitForObject(selector: BySelector, timeout: Long = AWAIT_TIMEOUT): UiObject2 {
if (wait(Until.hasObject(selector), timeout)) {
return findObject(selector)
}
error("Object with selector [$selector] not found")
}

View file

@ -23,7 +23,7 @@ class KotlinCommonPlugin : Plugin<Project> {
override fun apply(project: Project) { override fun apply(project: Project) {
if (project.isolated.rootProject == project.isolated) { if (project.isolated.rootProject == project.isolated) {
LintConfig.configureRootProject(project) LintConfig.configureRootProject(project)
} else if (project.name != "benchmark") { } else {
LintConfig.configureSubProject(project) LintConfig.configureSubProject(project)
} }
project.tasks.run { project.tasks.run {

View file

@ -46,7 +46,6 @@ class SentryPlugin : Plugin<Project> {
autoUploadNativeSymbols.set(false) autoUploadNativeSymbols.set(false)
includeNativeSources.set(false) includeNativeSources.set(false)
ignoredVariants.set(emptySet()) ignoredVariants.set(emptySet())
ignoredBuildTypes.set(setOf("benchmark"))
ignoredFlavors.set(emptySet()) ignoredFlavors.set(emptySet())
tracingInstrumentation { tracingInstrumentation {
enabled.set(true) enabled.set(true)

View file

@ -3,7 +3,6 @@ aboutLibraries = "12.2.1"
agp = "8.12.0-alpha03" agp = "8.12.0-alpha03"
android-junit5 = "1.12.2.0" android-junit5 = "1.12.2.0"
androidx-test = "1.7.0-alpha03" androidx-test = "1.7.0-alpha03"
benchmark = "1.4.0-beta02"
coil3 = "3.2.0" coil3 = "3.2.0"
coroutines = "1.10.2" coroutines = "1.10.2"
dagger = "2.56.2" dagger = "2.56.2"
@ -32,7 +31,6 @@ workmanager = "2.10.1"
aboutLibraries-m3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutLibraries" } aboutLibraries-m3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutLibraries" }
android-security-lints = "com.android.security.lint:lint:1.0.3" android-security-lints = "com.android.security.lint:lint:1.0.3"
androidx-activity-compose = "androidx.activity:activity-compose:1.11.0-rc01" androidx-activity-compose = "androidx.activity:activity-compose:1.11.0-rc01"
androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmark" }
androidx-browser = "androidx.browser:browser:1.9.0-alpha04" androidx-browser = "androidx.browser:browser:1.9.0-alpha04"
androidx-compose-animation = { module = "androidx.compose.animation:animation" } androidx-compose-animation = { module = "androidx.compose.animation:animation" }
androidx-compose-bom = "androidx.compose:compose-bom-alpha:2025.06.00" androidx-compose-bom = "androidx.compose:compose-bom-alpha:2025.06.00"
@ -60,11 +58,6 @@ androidx-navigation3-runtime = { module = "androidx.navigation3:navigation3-runt
androidx-navigation3-ui = { module = "androidx.navigation3:navigation3-ui", version.ref = "navigation3" } androidx-navigation3-ui = { module = "androidx.navigation3:navigation3-ui", version.ref = "navigation3" }
androidx-paging-compose = "androidx.paging:paging-compose:3.3.6" androidx-paging-compose = "androidx.paging:paging-compose:3.3.6"
androidx-profileinstaller = "androidx.profileinstaller:profileinstaller:1.4.1" androidx-profileinstaller = "androidx.profileinstaller:profileinstaller:1.4.1"
androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test" }
androidx-test-espresso-core = "androidx.test.espresso:espresso-core:3.7.0-alpha03"
androidx-test-ext-junit = "androidx.test.ext:junit:1.3.0-alpha03"
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test" }
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" }
androidx-test-uiautomator = "androidx.test.uiautomator:uiautomator:2.4.0-alpha04" androidx-test-uiautomator = "androidx.test.uiautomator:uiautomator:2.4.0-alpha04"
androidx-work-runtime = { module = "androidx.work:work-runtime", version.ref = "workmanager" } androidx-work-runtime = { module = "androidx.work:work-runtime", version.ref = "workmanager" }
build-agp = { module = "com.android.tools.build:gradle", version.ref = "agp" } build-agp = { module = "com.android.tools.build:gradle", version.ref = "agp" }
@ -129,7 +122,6 @@ android-junit5 = { id = "de.mannodermaus.android-junit5", version.ref = "android
android-lint = { id = "com.android.lint", version.ref = "agp" } android-lint = { id = "com.android.lint", version.ref = "agp" }
android-test = { id = "com.android.test", version.ref = "agp" } android-test = { id = "com.android.test", version.ref = "agp" }
anvil = "com.squareup.anvil:2.5.1" anvil = "com.squareup.anvil:2.5.1"
baselineprofile = { id = "androidx.baselineprofile", version.ref = "benchmark" }
dependencyAnalysis = "com.autonomousapps.dependency-analysis:2.18.0" dependencyAnalysis = "com.autonomousapps.dependency-analysis:2.18.0"
invert = "com.squareup.invert:0.0.3-dev" invert = "com.squareup.invert:0.0.3-dev"
kotlin-composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlin-composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }

View file

@ -127,14 +127,4 @@ rootProject.name = "Claw"
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
include( include("android", "api", "common", "core", "database:core", "database:impl", "model", "web")
"android",
"api",
"benchmark",
"common",
"core",
"database:core",
"database:impl",
"model",
"web",
)