-
Notifications
You must be signed in to change notification settings - Fork 138
Drive by cleanup #149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Drive by cleanup #149
Changes from all commits
fdc246c
e4d8529
055d035
3ee7821
f749476
9644c33
e9982d6
bd0611f
15a9cc4
992fd5f
4fe2c46
abb1ac9
b0f5c1b
4463f8f
36e7a05
08e7560
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| /* | ||
| * Copyright 2026 The Android Open Source Project | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| import org.jetbrains.kotlin.gradle.dsl.JvmTarget | ||
|
|
||
| /* | ||
| * Copyright 2026 The Android Open Source Project | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| plugins { | ||
| alias(libs.plugins.android.test) | ||
| alias(libs.plugins.jetbrains.kotlin.android) | ||
| } | ||
|
|
||
| android { | ||
| namespace = "com.android.ai.catalog.benchmark" | ||
| compileSdk { | ||
| version = release(36) | ||
| } | ||
|
|
||
| defaultConfig { | ||
| minSdk = 24 | ||
| targetSdk = 36 | ||
|
|
||
| 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") | ||
| } | ||
| } | ||
|
|
||
| targetProjectPath = ":app" | ||
| experimentalProperties["android.experimental.self-instrumenting"] = true | ||
|
|
||
| compileOptions { | ||
| sourceCompatibility = JavaVersion.VERSION_17 | ||
| targetCompatibility = JavaVersion.VERSION_17 | ||
| } | ||
| kotlin { | ||
| compilerOptions { jvmTarget.set(JvmTarget.JVM_17) } | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation(libs.androidx.junit) | ||
| implementation(libs.androidx.espresso.core) | ||
| implementation(libs.androidx.uiautomator) | ||
| implementation(libs.androidx.benchmark.macro.junit4) | ||
| } | ||
|
|
||
| androidComponents { | ||
| beforeVariants(selector().all()) { | ||
| it.enable = it.buildType == "benchmark" | ||
| } | ||
| } |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we remove this, if we don't need it.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Even without manual content the |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| <manifest /> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright 2026 The Android Open Source Project | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package com.android.ai.catalog.benchmark | ||
|
|
||
| import androidx.benchmark.macro.StartupMode | ||
| import androidx.benchmark.macro.StartupTimingMetric | ||
| import androidx.benchmark.macro.junit4.MacrobenchmarkRule | ||
| import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
| import org.junit.Rule | ||
| import org.junit.Test | ||
| import org.junit.runner.RunWith | ||
|
|
||
| /** | ||
| * Benchmark class to measure the startup timing of the application. | ||
| * | ||
| * This benchmark uses [MacrobenchmarkRule] to measure the time it takes for the application | ||
| * to start up in [StartupMode.COLD] mode. | ||
| */ | ||
| @RunWith(AndroidJUnit4::class) | ||
| class StartupBenchmark { | ||
| @get:Rule | ||
| val benchmarkRule = MacrobenchmarkRule() | ||
|
|
||
| /** | ||
| * Measures the application startup time. | ||
| * | ||
| * It runs the benchmark for 5 iterations using [StartupTimingMetric]. | ||
| * The application is started in [StartupMode.COLD] mode, ensuring a fresh start for each iteration. | ||
| */ | ||
| @Test | ||
| fun startup() = benchmarkRule.measureRepeated( | ||
| packageName = "com.android.ai.catalog", | ||
| metrics = listOf(StartupTimingMetric()), | ||
| iterations = 5, | ||
| startupMode = StartupMode.COLD, | ||
| ) { | ||
| startApp(packageName) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ plugins { | |
| alias(libs.plugins.ksp) apply false | ||
| alias(libs.plugins.compose.compiler) apply false | ||
| alias(libs.plugins.spotless) apply false | ||
| alias(libs.plugins.android.test) apply false | ||
| } | ||
|
|
||
| subprojects { | ||
|
|
@@ -43,5 +44,10 @@ subprojects { | |
| // Look for the first line that doesn't have a block comment (assumed to be the license) | ||
| licenseHeaderFile(rootProject.file("spotless/copyright.kt"), "(^(?![\\/ ]\\*).*$)") | ||
| } | ||
| format("toml") { | ||
| target("gradle/libs.versions.toml") | ||
| prettier(mapOf("prettier" to "3.2.5", "prettier-plugin-toml" to "2.0.1")) | ||
| .config(mapOf("plugins" to listOf("prettier-plugin-toml"))) | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👌 |
||
| } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am curious why this import re-ordering isn't something that Detekt in the github action picked up. Did you run manually?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a pre-push or even pre-commit hook. For now its manual.