Skip to content

Commit 958b509

Browse files
author
Murat Yener
committed
Unifying benchmarks in a single module
1 parent c6f539c commit 958b509

29 files changed

+84
-230
lines changed

MacrobenchmarkSample/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@ dependencies {
103103
implementation(libs.viewmodel)
104104
androidTestImplementation(libs.benchmark.junit)
105105

106-
baselineProfile(project(":baselineProfile"))
106+
baselineProfile(project(":macrobenchmark"))
107107
}

MacrobenchmarkSample/baseBenchmarks/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

MacrobenchmarkSample/baseBenchmarks/build.gradle.kts

Lines changed: 0 additions & 57 deletions
This file was deleted.

MacrobenchmarkSample/baseBenchmarks/consumer-rules.pro

Whitespace-only changes.

MacrobenchmarkSample/baseBenchmarks/src/main/AndroidManifest.xml

Lines changed: 0 additions & 20 deletions
This file was deleted.

MacrobenchmarkSample/baselineProfile/build.gradle.kts

Lines changed: 0 additions & 75 deletions
This file was deleted.

MacrobenchmarkSample/baselineProfile/src/main/AndroidManifest.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

MacrobenchmarkSample/macrobenchmark/build.gradle.kts

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
1+
/*
2+
* Copyright 2023 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import com.android.build.api.dsl.ManagedVirtualDevice
218

319
plugins {
20+
//id("com.android.library")
21+
id("kotlin-android")
422
alias(libs.plugins.test)
523
alias(libs.plugins.kotlin)
24+
alias(libs.plugins.baselineprofile)
625
}
726

827
// [START macrobenchmark_setup_android]
@@ -12,19 +31,22 @@ android {
1231
namespace = "com.example.macrobenchmark"
1332

1433
defaultConfig {
15-
minSdk = 23 // Minimum supported version for macrobenchmark
34+
// Minimum supported version for Baseline Profiles.
35+
// On lower APIs, apps are fully AOT compile, therefore Baseline Profiles aren't needed.
36+
minSdk = 24
1637
targetSdk = 34
1738
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1839
}
1940

2041
targetProjectPath = ":app"
2142

2243
compileOptions {
23-
sourceCompatibility = JavaVersion.VERSION_11
24-
targetCompatibility = JavaVersion.VERSION_11
44+
sourceCompatibility = JavaVersion.VERSION_17
45+
targetCompatibility = JavaVersion.VERSION_17
2546
}
47+
2648
kotlinOptions {
27-
jvmTarget = JavaVersion.VERSION_11.toString()
49+
jvmTarget = JavaVersion.VERSION_17.toString()
2850
}
2951

3052
testOptions.managedDevices.devices {
@@ -54,8 +76,18 @@ android {
5476
}
5577
// [END macrobenchmark_setup_android]
5678

79+
baselineProfile {
80+
81+
// This specifies the managed devices to use that you run the tests on. The default
82+
// is none.
83+
managedDevices += "pixel6Api31"
84+
85+
// This enables using connected devices to generate profiles. The default is true.
86+
// When using connected devices, they must be rooted or API 33 and higher.
87+
useConnectedDevices = false
88+
}
89+
5790
dependencies {
58-
implementation(project(":baseBenchmarks"))
5991
implementation(libs.benchmark.junit)
6092
implementation(libs.androidx.junit)
6193
implementation(libs.espresso)

MacrobenchmarkSample/macrobenchmark/src/main/AndroidManifest.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
<?xml version="1.0" encoding="utf-8"?><!--
2-
~ Copyright 2022 The Android Open Source Project
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
~ Copyright 2023 The Android Open Source Project
34
~
45
~ Licensed under the Apache License, Version 2.0 (the "License");
56
~ you may not use this file except in compliance with the License.
@@ -15,8 +16,9 @@
1516
-->
1617

1718
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
18-
1919
<!-- Requesting legacy storage is needed to be able to write to additionalTestOutputDir on API 29 -->
2020
<application android:requestLegacyExternalStorage="true" />
21-
22-
</manifest>
21+
<queries>
22+
<package android:name="com.example.macrobenchmark.target" />
23+
</queries>
24+
</manifest>

0 commit comments

Comments
 (0)