Skip to content

Commit

Permalink
Fix baseline profile generation (#768)
Browse files Browse the repository at this point in the history
~Still currently no longer produces anything when I run `./gradlew
:backstack:generateBaselineProfile`, seems like something regressed with
libraries or KMP support or both~

Got this working well enough for our needs now. This doesn't generate a
startup profile for the star app currently due to a bug that was found
while diagnosing issues with this. The rest of the changes are good to
go though and we can use this while we wait for a fix in a new release.
Ref: https://issuetracker.google.com/293889189

This removes baseline profiles from the circuit-retained artifact, as
I'm currently unable to get it to pick up any on the startup hot path. I
think that's ok though 👍
  • Loading branch information
ZacSweers authored Aug 1, 2023
1 parent d6445b1 commit ce1e306
Show file tree
Hide file tree
Showing 25 changed files with 7,188 additions and 6,522 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
**/snapshots/**/*.png filter=lfs diff=lfs merge=lfs -text
**/baseline-prof.txt linguist-generated=true
**/generated/baselineProfiles/** linguist-generated=true
1 change: 1 addition & 0 deletions .github/workflows/update-baseline-profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
pull_request:
paths:
- '.github/workflows/update-baseline-profiles.yml'
- 'gradle/libs.versions.toml'

concurrency:
group: 'ci-${{ github.event.merge_group.head_ref || github.head_ref }}-${{ github.workflow }}'
Expand Down
5 changes: 3 additions & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ Releasing
=========

1. Update the `CHANGELOG.md` for the impending release.
2. Run `./release.sh (--patch|--minor|--major)`.
3. Publish the release on the repo's releases tab.
2. Regenerate baseline profiles by running `./regenerate-baseline-profiles.sh`.
3. Run `./release.sh (--patch|--minor|--major)`.
4. Publish the release on the repo's releases tab.
9 changes: 6 additions & 3 deletions backstack/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ android { namespace = "com.slack.circuit.backstack" }

androidComponents { beforeVariants { variant -> variant.enableAndroidTest = false } }

baselineProfile { filter { include("com.slack.circuit.backstack.**") } }

dependencies { baselineProfile(projects.samples.star.benchmark) }
baselineProfile {
mergeIntoMain = true
saveInSrc = true
from(projects.samples.star.benchmark.dependencyProject)
filter { include("com.slack.circuit.backstack.**") }
}

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions circuit-foundation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ android { namespace = "com.slack.circuit.foundation" }

androidComponents { beforeVariants { variant -> variant.enableAndroidTest = false } }

baselineProfile { filter { include("com.slack.circuit.foundation.**") } }

dependencies { baselineProfile(projects.samples.star.benchmark) }
baselineProfile {
mergeIntoMain = true
saveInSrc = true
from(projects.samples.star.benchmark.dependencyProject)
filter { include("com.slack.circuit.foundation.**") }
}

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions circuit-overlay/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ android { namespace = "com.slack.circuit.overlay" }

androidComponents { beforeVariants { variant -> variant.enableAndroidTest = false } }

baselineProfile { filter { include("com.slack.circuit.overlay.**") } }

dependencies { baselineProfile(projects.samples.star.benchmark) }
baselineProfile {
mergeIntoMain = true
saveInSrc = true
from(projects.samples.star.benchmark.dependencyProject)
filter { include("com.slack.circuit.overlay.**") }
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions circuit-retained/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ persist across process death.
The only meaningful implementation in this artifact is for Android, where a backing `ViewModel` is used
to hold values. If you're not running this on Android, you shouldn't need this artifact.

**Note**: For the Android artifacts, there are no baseline profiles shipped with circuit-retained.
This is normal, as it's not usually something on your startup hot path.

## Installation

Simply provide the `LocalRetainedStateRegistry` composition local using `continuityRetainedStateRegistry()`.
Expand Down
5 changes: 0 additions & 5 deletions circuit-retained/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
alias(libs.plugins.compose)
alias(libs.plugins.mavenPublish)
`java-test-fixtures`
id(libs.plugins.baselineprofile.get().pluginId)
}

kotlin {
Expand Down Expand Up @@ -74,7 +73,3 @@ android {
testOptions { unitTests.isIncludeAndroidResources = true }
testBuildType = "release"
}

baselineProfile { filter { include("com.slack.circuit.retained.**") } }

dependencies { baselineProfile(projects.samples.star.benchmark) }

This file was deleted.

9 changes: 6 additions & 3 deletions circuit-runtime-presenter/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ android { namespace = "com.slack.circuit.runtime.presenter" }

androidComponents { beforeVariants { variant -> variant.enableAndroidTest = false } }

baselineProfile { filter { include("com.slack.circuit.runtime.presenter.**") } }

dependencies { baselineProfile(projects.samples.star.benchmark) }
baselineProfile {
mergeIntoMain = true
saveInSrc = true
from(projects.samples.star.benchmark.dependencyProject)
filter { include("com.slack.circuit.runtime.presenter.**") }
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 6 additions & 3 deletions circuit-runtime-ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ android { namespace = "com.slack.circuit.runtime.ui" }

androidComponents { beforeVariants { variant -> variant.enableAndroidTest = false } }

baselineProfile { filter { include("com.slack.circuit.runtime.ui.**") } }

dependencies { baselineProfile(projects.samples.star.benchmark) }
baselineProfile {
mergeIntoMain = true
saveInSrc = true
from(projects.samples.star.benchmark.dependencyProject)
filter { include("com.slack.circuit.runtime.ui.**") }
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions circuit-runtime/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ android { namespace = "com.slack.circuit.runtime" }
androidComponents { beforeVariants { variant -> variant.enableAndroidTest = false } }

baselineProfile {
mergeIntoMain = true
saveInSrc = true
from(projects.samples.star.benchmark.dependencyProject)

filter {
// Don't include subpackages, only one star
include("com.slack.circuit.runtime.*")
}
}

dependencies { baselineProfile(projects.samples.star.benchmark) }

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 13 additions & 16 deletions samples/star/apk/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,24 @@ android {
versionName = "1"
}
buildTypes {
val releaseBuildType =
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
file("proguard-rules.pro")
)
}

create("benchmark") {
initWith(releaseBuildType)
signingConfig = signingConfigs.getByName("debug")
matchingFallbacks += listOf("release")
isDebuggable = false
getByName("release") {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
file("proguard-rules.pro")
)
}
}
}

baselineProfile {
saveInSrc = true
dexLayoutOptimization = true
from(projects.samples.star.benchmark.dependencyProject)
}

dependencies {
api(projects.samples.star)
implementation(libs.androidx.profileinstaller)
baselineProfile(projects.samples.star.benchmark)
}
Loading

0 comments on commit ce1e306

Please sign in to comment.