Skip to content

Commit 82fc269

Browse files
committed
Migrate to baseline profile plugin
1 parent 4e9c82e commit 82fc269

File tree

9 files changed

+74
-15
lines changed

9 files changed

+74
-15
lines changed

app/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
id(libs.plugins.android.application.get().pluginId)
88
id(libs.plugins.kotlin.android.get().pluginId)
99
id(libs.plugins.compose.compiler.get().pluginId)
10+
id(libs.plugins.baseline.profile.get().pluginId)
1011
}
1112

1213
android {
@@ -89,4 +90,6 @@ dependencies {
8990

9091
// logger
9192
implementation(libs.stream.log)
93+
94+
baselineProfile(project(":benchmark"))
9295
}

benchmark/build.gradle.kts

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import io.getstream.Configurations
1919
plugins {
2020
id("com.android.test")
2121
id("org.jetbrains.kotlin.android")
22+
id(libs.plugins.baseline.profile.get().pluginId)
2223
}
2324

2425
android {
@@ -30,12 +31,6 @@ android {
3031
targetCompatibility = JavaVersion.VERSION_11
3132
}
3233

33-
defaultConfig {
34-
minSdk = 24
35-
targetSdk = Configurations.targetSdk
36-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
37-
}
38-
3934
buildTypes {
4035
// This benchmark buildType is used for benchmarking, and should function like your
4136
// release build (for example, with minification on). It"s signed with a debug key
@@ -47,8 +42,33 @@ android {
4742
}
4843
}
4944

45+
defaultConfig {
46+
minSdk = 24
47+
targetSdk = Configurations.targetSdk
48+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
49+
}
50+
5051
targetProjectPath = ":app"
51-
experimentalProperties["android.experimental.self-instrumenting"] = true
52+
testOptions.managedDevices.devices {
53+
maybeCreate<com.android.build.api.dsl.ManagedVirtualDevice>("pixel6api31").apply {
54+
device = "Pixel 6"
55+
apiLevel = 31
56+
systemImageSource = "aosp"
57+
}
58+
}
59+
}
60+
61+
// This is the plugin configuration. Everything is optional. Defaults are in the
62+
// comments. In this example, you use the GMD added earlier and disable connected devices.
63+
baselineProfile {
64+
65+
// This specifies the managed devices to use that you run the tests on. The default
66+
// is none.
67+
managedDevices += "pixel6api31"
68+
69+
// This enables using connected devices to generate profiles. The default is true.
70+
// When using connected devices, they must be rooted or API 33 and higher.
71+
useConnectedDevices = false
5272
}
5373

5474
dependencies {
@@ -57,9 +77,3 @@ dependencies {
5777
implementation(libs.androidx.benchmark.macro)
5878
implementation(libs.androidx.profileinstaller)
5979
}
60-
61-
androidComponents {
62-
beforeVariants(selector().all()) {
63-
it.enable = it.buildType == "benchmark"
64-
}
65-
}

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ plugins {
44
alias(libs.plugins.android.library) apply false
55
alias(libs.plugins.kotlin.android) apply false
66
alias(libs.plugins.compose.compiler) apply false
7+
alias(libs.plugins.baseline.profile) apply false
78
alias(libs.plugins.nexusPlugin)
89
alias(libs.plugins.spotless)
910
alias(libs.plugins.dokka)

buildSrc/src/main/kotlin/io/getstream/Configurations.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.getstream
22

33
object Configurations {
4-
const val compileSdk = 34
5-
const val targetSdk = 34
4+
const val compileSdk = 35
5+
const val targetSdk = 35
66
const val minSdk = 21
77
const val majorVersion = 1
88
const val minorVersion = 2

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,6 @@ kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
6363
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
6464
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
6565
dokka = { id = "org.jetbrains.dokka", version = "1.9.20" }
66+
baseline-profile = { id = "androidx.baselineprofile", version.ref = "androidxMacroBenchmark" }
6667
nexusPlugin = { id = "io.github.gradle-nexus.publish-plugin", version = "2.0.0" }
6768
kotlinBinaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version = "0.16.3" }

stream-webrtc-android-compose/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ plugins {
77
id(libs.plugins.android.library.get().pluginId)
88
id(libs.plugins.kotlin.android.get().pluginId)
99
id(libs.plugins.compose.compiler.get().pluginId)
10+
id(libs.plugins.baseline.profile.get().pluginId)
1011
}
1112

1213
rootProject.extra.apply {
@@ -48,6 +49,13 @@ android {
4849
enableStrongSkippingMode = true
4950
reportsDestination = layout.buildDirectory.dir("compose_compiler")
5051
}
52+
53+
baselineProfile {
54+
baselineProfileOutputDir = "."
55+
filter {
56+
include("io.getstream.webrtc.android.compose.**")
57+
}
58+
}
5159
}
5260

5361
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
@@ -69,4 +77,6 @@ dependencies {
6977
implementation(libs.androidx.compose.runtime)
7078
implementation(libs.androidx.compose.foundation)
7179
implementation(libs.androidx.compose.material)
80+
81+
baselineProfile(project(":benchmark"))
7282
}

stream-webrtc-android-ktx/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import io.getstream.Configurations
66
plugins {
77
id(libs.plugins.android.library.get().pluginId)
88
id(libs.plugins.kotlin.android.get().pluginId)
9+
id(libs.plugins.baseline.profile.get().pluginId)
910
}
1011

1112
rootProject.extra.apply {
@@ -32,6 +33,13 @@ android {
3233
lint {
3334
abortOnError = false
3435
}
36+
37+
baselineProfile {
38+
baselineProfileOutputDir = "."
39+
filter {
40+
include("io.getstream.webrtc.android.ktx.**")
41+
}
42+
}
3543
}
3644

3745
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
@@ -47,4 +55,6 @@ tasks.withType(JavaCompile::class.java).configureEach {
4755

4856
dependencies {
4957
api(project(":stream-webrtc-android"))
58+
59+
baselineProfile(project(":benchmark"))
5060
}

stream-webrtc-android-ui/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import io.getstream.Configurations
55
@Suppress("DSL_SCOPE_VIOLATION") plugins {
66
id(libs.plugins.android.library.get().pluginId)
77
id(libs.plugins.kotlin.android.get().pluginId)
8+
id(libs.plugins.baseline.profile.get().pluginId)
89
}
910

1011
rootProject.extra.apply {
@@ -31,6 +32,13 @@ android {
3132
lint {
3233
abortOnError = false
3334
}
35+
36+
baselineProfile {
37+
baselineProfileOutputDir = "."
38+
filter {
39+
include("io.getstream.webrtc.android.ui.**")
40+
}
41+
}
3442
}
3543

3644
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
@@ -46,4 +54,6 @@ tasks.withType(JavaCompile::class.java).configureEach {
4654

4755
dependencies {
4856
api(project(":stream-webrtc-android"))
57+
58+
baselineProfile(project(":benchmark"))
4959
}

stream-webrtc-android/build.gradle.kts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import io.getstream.Configurations
66
plugins {
77
id(libs.plugins.android.library.get().pluginId)
88
id(libs.plugins.kotlin.android.get().pluginId)
9+
id(libs.plugins.baseline.profile.get().pluginId)
910
}
1011

1112
rootProject.extra.apply {
@@ -39,6 +40,13 @@ android {
3940
sourceCompatibility = JavaVersion.VERSION_11
4041
targetCompatibility = JavaVersion.VERSION_11
4142
}
43+
44+
baselineProfile {
45+
baselineProfileOutputDir = "."
46+
filter {
47+
include("org.webrtc.**")
48+
}
49+
}
4250
}
4351

4452
tasks.withType(JavaCompile::class.java).configureEach {
@@ -48,4 +56,6 @@ tasks.withType(JavaCompile::class.java).configureEach {
4856

4957
dependencies {
5058
implementation(libs.androidx.annotation)
59+
60+
baselineProfile(project(":benchmark"))
5161
}

0 commit comments

Comments
 (0)