benchamrk

This commit is contained in:
T8RIN 2024-01-05 16:30:19 +03:00
parent f501fcdcfe
commit 141e86185a
9 changed files with 132 additions and 31 deletions

View File

@ -98,6 +98,13 @@ android {
"proguard-rules.pro"
)
}
create("benchmark") {
initWith(buildTypes.getByName("release"))
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks += listOf("release")
isMinifyEnabled = false
isShrinkResources = false
}
}
compileOptions {
sourceCompatibility = rootProject.extra.get("javaCompile") as JavaVersion

View File

@ -9,9 +9,7 @@
<uses-permission
android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
@ -20,7 +18,6 @@
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.PROJECT_MEDIA" />
@ -42,10 +39,13 @@
android:theme="@style/Theme.ImageResizer.Launcher"
tools:targetApi="tiramisu">
<profileable
android:shell="true"
tools:targetApi="29" />
<meta-data
android:name="firebase_crashlytics_collection_enabled"
android:value="false" />
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="false" />
@ -54,52 +54,56 @@
android:name=".presentation.MainActivity"
android:exported="true"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="@string/app_launcher_name">
<action android:name="android.intent.action.VIEW" />
<action android:name="com.android.camera.action.REVIEW" />
<action android:name="android.provider.action.REVIEW" />
<action android:name="android.provider.action.REVIEW_SECURE" />
<data android:scheme="content" />
<data android:scheme="file" />
<data android:mimeType="image/*" />
<data android:mimeType="application/pdf" />
<data android:mimeType="*/pdf" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.INSERT_OR_EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.INSERT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
<activity android:name=".presentation.crash_screen.CrashActivity" />
<provider
@ -188,7 +192,6 @@
<service
android:name=".presentation.services.ScreenshotService"
android:foregroundServiceType="mediaProjection" />
</application>
</manifest>

1
benchmark/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

View File

@ -0,0 +1,62 @@
@file:Suppress("UnstableApiUsage")
plugins {
id("com.android.test")
id("org.jetbrains.kotlin.android")
id("androidx.baselineprofile")
}
android {
namespace = "ru.tech.imageresizershrinker.benchmark"
compileSdk = libs.versions.androidCompileSdk.get().toIntOrNull()
defaultConfig {
minSdk = 28
targetSdk = libs.versions.androidCompileSdk.get().toIntOrNull()
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = rootProject.extra.get("javaCompile") as JavaVersion
targetCompatibility = rootProject.extra.get("javaCompile") as JavaVersion
}
kotlinOptions {
jvmTarget = libs.versions.jvmTarget.get()
}
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")
}
}
flavorDimensions += listOf("app")
productFlavors {
create("foss") { dimension = "app" }
create("market") { dimension = "app" }
create("jxl") { dimension = "app" }
}
targetProjectPath = ":app"
experimentalProperties["android.experimental.self-instrumenting"] = true
}
dependencies {
implementation(libs.androidx.test.ext.junit)
implementation(libs.espresso)
implementation(libs.uiautomator)
implementation(libs.benchmark.macro.junit4)
}
androidComponents {
beforeVariants(selector().all()) {
it.enable = it.buildType == "benchmark"
}
}

View File

@ -0,0 +1 @@
<manifest />

View File

@ -0,0 +1,20 @@
package ru.tech.imageresizershrinker.benchmark
import androidx.benchmark.macro.junit4.BaselineProfileRule
import org.junit.Rule
import org.junit.Test
class BaselineProfileGenerator {
@get:Rule
val baselineProfileRule = BaselineProfileRule()
@Test
fun startup() = baselineProfileRule.collect(
packageName = "ru.tech.imageresizershrinker",
includeInStartupProfile = true,
profileBlock = {
startActivityAndWait()
device.pressBack()
}
)
}

View File

@ -10,13 +10,14 @@ buildscript {
}
dependencies {
classpath(libs.kotlinSerializationGradlePlugin)
classpath(libs.kspGradlePlugin)
classpath(libs.androidBuildTools)
classpath(libs.kotlinGradlePlugin)
classpath(libs.hiltGradlePlugin)
classpath(libs.gmsGradlePlugin)
classpath(libs.kotlinx.serialization.gradle)
classpath(libs.ksp.gradle)
classpath(libs.agp.gradle)
classpath(libs.kotlin.gradle)
classpath(libs.hilt.gradle)
classpath(libs.gms.gradle)
classpath(libs.firebase.crashlytics.gradle)
classpath(libs.baselineprofile.gradle)
}
}

View File

@ -2,15 +2,15 @@
androidMinSdk = "21"
androidTargetSdk = "34"
androidCompileSdk = "34"
versionName = "2.5.2"
versionCode = "106"
composeColorDetector = "1.0.0"
composeColorfulSliders = "1.2.0"
composeExtendedColors = "1.0.0-alpha07"
m3color = "2023.10.1"
paletteKtx = "1.0.0"
uiText = "1.6.0-beta03"
versionName = "2.5.2"
versionCode = "106"
androidx-datastorePreferencesAndroid = "1.1.0-alpha07"
androidx-material = "1.6.0-beta03"
appUpdateKtx = "2.1.0"
@ -46,7 +46,7 @@ firebaseBom = "32.2.2"
firebaseMessaging = "23.4.0"
firebaseGms = "18.2.0"
composeBom = "2023.10.01"
decompose = "2.2.0"
decompose = "2.2.2"
activityCompose = "1.8.2"
kotlinxCollectionsImmutable = "0.3.7"
scrollbar = "1.8.0"
@ -71,14 +71,16 @@ espresso = "3.5.1"
mockito = "4.8.0"
testArchCore = "2.1.0"
testCoroutines = "1.5.1"
kotlinxSerializationJson = "1.6.1"
kotlinxSerializationJson = "1.6.2"
ksp = "1.9.21-1.0.15"
tinkoffSdk = "3.0.0"
androidx-test-ext-junit = "1.1.5"
material = "1.11.0"
documentfile = "1.0.1"
vkauth = "1.2.0"
datastorePreferencesAndroid = "1.0.0"
uiautomator = "2.2.0"
androidxMacroBenchmark = "1.2.2"
[libraries]
androidx-exifinterface = { module = "androidx.exifinterface:exifinterface", version.ref = "exifinterface" }
@ -110,18 +112,10 @@ coilCompose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
coilGif = { module = "io.coil-kt:coil-gif", version.ref = "coil" }
coilSvg = { module = "io.coil-kt:coil-svg", version.ref = "coil" }
coil = { module = "io.coil-kt:coil", version.ref = "coil" }
androidBuildTools = { module = "com.android.tools.build:gradle", version.ref = "agp" }
firebase-analytics-ktx = { module = "com.google.firebase:firebase-analytics-ktx", version.ref = "firebaseAnalyticsKtx" }
firebase-crashlytics-gradle = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsGradle" }
hilt-compiler = { module = "androidx.hilt:hilt-compiler", version.ref = "hiltCompiler" }
jxl-coder-coil = { module = "com.github.awxkee:jxl-coder-coil", version.ref = "jxlCoder" }
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
hiltGradlePlugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
gmsGradlePlugin = { module = "com.google.gms:google-services", version.ref = "gms" }
kotlinSerializationGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "kotlinxCollectionsImmutable" }
kspGradlePlugin = { module = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
coroutinesAndroid = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" }
coroutinesCore = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" }
@ -181,4 +175,15 @@ androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-documentfile = { group = "androidx.documentfile", name = "documentfile", version.ref = "documentfile" }
vkauth = { module = "com.petersamokhin.vksdk.android:auth", version.ref = "vkauth" }
androidx-datastore-preferences-android = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferencesAndroid" }
androidx-datastore-preferences-android = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferencesAndroid" }
uiautomator = { group = "androidx.test.uiautomator", name = "uiautomator", version.ref = "uiautomator" }
benchmark-macro-junit4 = { group = "androidx.benchmark", name = "benchmark-macro-junit4", version.ref = "androidxMacroBenchmark" }
firebase-crashlytics-gradle = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsGradle" }
baselineprofile-gradle = { group = "androidx.benchmark", name = "benchmark-baseline-profile-gradle-plugin", version.ref = "androidxMacroBenchmark" }
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
hilt-gradle = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
gms-gradle = { module = "com.google.gms:google-services", version.ref = "gms" }
kotlinx-serialization-gradle = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
ksp-gradle = { module = "com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
agp-gradle = { module = "com.android.tools.build:gradle", version.ref = "agp" }

View File

@ -1,5 +1,4 @@
@file:Suppress("UnstableApiUsage")
pluginManagement {
repositories {
gradlePluginPortal()
@ -57,4 +56,6 @@ include(":feature:load-net-image")
include(":core:resources")
include(":core:data")
include(":core:domain")
include(":core:ui")
include(":core:ui")
include(":benchmark")