-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
31,587 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15,738 changes: 15,738 additions & 0 deletions
15,738
app/src/release/generated/baselineProfiles/baseline-prof.txt
Large diffs are not rendered by default.
Oops, something went wrong.
15,738 changes: 15,738 additions & 0 deletions
15,738
app/src/release/generated/baselineProfiles/startup-prof.txt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
plugins { | ||
alias(libs.plugins.android.test) | ||
alias(libs.plugins.kotlin.android) | ||
alias(libs.plugins.baselineprofile) | ||
} | ||
|
||
android { | ||
namespace = "at.florianschuster.hydro.baselineprofile" | ||
compileSdk = 34 | ||
|
||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
|
||
defaultConfig { | ||
minSdk = 31 | ||
targetSdk = 34 | ||
|
||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
targetProjectPath = ":app" | ||
} | ||
|
||
// This is the configuration block for the Baseline Profile plugin. | ||
// You can specify to run the generators on a managed devices or connected devices. | ||
baselineProfile { | ||
useConnectedDevices = true | ||
} | ||
|
||
dependencies { | ||
implementation(libs.junit) | ||
implementation(libs.espresso.core) | ||
implementation(libs.uiautomator) | ||
implementation(libs.benchmark.macro.junit4) | ||
} | ||
|
||
androidComponents { | ||
onVariants { variant -> | ||
val artifactsLoader = variant.artifacts.getBuiltArtifactsLoader() | ||
@Suppress("UnstableApiUsage") | ||
variant.instrumentationRunnerArguments.put( | ||
"targetAppId", | ||
variant.testedApks.map { artifactsLoader.load(it)?.applicationId } | ||
) | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...rofile/src/main/java/at/florianschuster/hydro/baselineprofile/BaselineProfileGenerator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package at.florianschuster.hydro.baselineprofile | ||
|
||
import androidx.benchmark.macro.junit4.BaselineProfileRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.filters.LargeTest | ||
import androidx.test.platform.app.InstrumentationRegistry | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
@LargeTest | ||
class BaselineProfileGenerator { | ||
|
||
@get:Rule | ||
val rule = BaselineProfileRule() | ||
|
||
@Test | ||
fun generate() { | ||
rule.collect( | ||
packageName = InstrumentationRegistry.getArguments().getString("targetAppId") | ||
?: throw Exception("targetAppId not passed as instrumentation runner arg"), | ||
includeInStartupProfile = true | ||
) { | ||
pressHome() | ||
startActivityAndWait() | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters