Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update LeakCanary to 2.10 #581

Open
wants to merge 63 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
b6140c5
Update LeakCanary to 2.10
pyricau May 11, 2023
b0e4155
Add KDoc on `ActivityLifecycleEvent` explaining ordering semantics.
psteiger May 16, 2023
5b9b66e
Make use of `jvmToolchain` for compiling the project.
psteiger May 14, 2023
391d6dd
Apply explicit visibility on missing classes
psteiger May 18, 2023
25adeff
Create version catalogs
psteiger May 18, 2023
42c58af
Create precompiled scripts convention plugins to be used as included …
psteiger May 18, 2023
27d8eba
Make use of convention plugins and version catalogs
psteiger May 18, 2023
2e02191
deprecate old worker
FranAguilera Jun 13, 2023
8587e79
Drafting monitoring option for RIBs
FranAguilera Jun 14, 2023
1041460
Merge pull request #597 from FranAguilera/deprecate_worker_worker_binder
FranAguilera Jun 14, 2023
1930713
Update worker binder dispatcher
FranAguilera Jun 13, 2023
880bbb6
Include deprecated WorkerBinder dispatcher
FranAguilera Jun 14, 2023
789d7bf
Update README.md
FranAguilera Jun 15, 2023
66eac33
Expose stream for RIB component duration info
FranAguilera Jun 15, 2023
7e40711
Merge pull request #596 from FranAguilera/add_migration_api
FranAguilera Jun 16, 2023
2237947
Merge pull request #600 from uber/FranAguilera-patch-1
FranAguilera Jun 16, 2023
5ff4748
Drafting more ideas
FranAguilera Jun 16, 2023
26fe506
Merge branch 'main' into add_rib_monitoring
FranAguilera Jun 20, 2023
3ab3955
Drafting more ideas
FranAguilera Jun 16, 2023
18ced24
Merge branch 'add_rib_monitoring' of https://github.com/FranAguilera/…
FranAguilera Jun 20, 2023
80c5846
spotless apply
FranAguilera Jun 20, 2023
38ae582
Rename callRibActionAndEmitEvents to triggerRibActionAndEmitEvents
FranAguilera Jun 21, 2023
546ac78
Adding back getInstance for RibEvents and mark it as deprecated
FranAguilera Jun 21, 2023
062b002
Removing again getInstance of RibEvents
FranAguilera Jun 21, 2023
747b831
Change actionBlock declaration order
FranAguilera Jun 21, 2023
5a42204
Update JUnit tests
FranAguilera Jun 21, 2023
7009b81
Apply PR feedback
FranAguilera Jun 21, 2023
2edee91
First proposal after PR feedback
FranAguilera Jun 22, 2023
7f251b1
Rename startCapturingRibActionInfo
FranAguilera Jun 22, 2023
8201984
PR feedback: Rename RibComponent and add switch method for RibEvents
FranAguilera Jun 22, 2023
2a5db8e
Remove unnecessary comments for test method
FranAguilera Jun 22, 2023
3e7983a
Rename RibEventEmitter to RibActionEmitter
FranAguilera Jun 22, 2023
1df34c7
Deprecate WorkerUnbinder
FranAguilera Jun 22, 2023
ee3aff2
Open areRibActionEmissionsAllowed get visibility
FranAguilera Jun 22, 2023
f6ca551
Merge pull request #601 from FranAguilera/continue_worker_deprecation
FranAguilera Jun 23, 2023
59014ba
Remove disableRibActionEmissions and use internal setter
FranAguilera Jun 22, 2023
c1cf74c
Merge pull request #599 from FranAguilera/add_rib_monitoring
tyvsmith Jun 23, 2023
5027731
Prepare for release 0.15.0
tyvsmith Jun 23, 2023
c7b7555
Prepare next development version
tyvsmith Jun 23, 2023
d945def
Remove unused ids
jbarr21 Jul 11, 2023
36d2c13
Migrate from deprecated @JvmDefault to compiler option `-Xjvm-default…
psteiger May 10, 2023
5835f8e
Prepare for release 0.15.1
jbarr21 Jul 18, 2023
2de8f90
Prepare next development version
jbarr21 Jul 18, 2023
0d87f61
Add `WorkerBinder.bind` overloads that take in an `Iterable`.
psteiger Jul 25, 2023
9f6a215
Set view tree owners (#606)
jbarr21 Aug 7, 2023
0ea5c5c
Prepare for release 0.15.2
jbarr21 Aug 7, 2023
484a476
Prepare next development version
jbarr21 Aug 7, 2023
d719af0
Add RibCoroutineWorker.bind receiving multiple workers
FranAguilera Aug 10, 2023
94fffa8
Change dispatcher from empty to default for the Worker<>RibCoroutine …
FranAguilera Aug 10, 2023
6ff90ff
Update android/libraries/rib-base/src/main/kotlin/com/uber/rib/core/R…
FranAguilera Aug 10, 2023
e6f98bd
Merge pull request #607 from FranAguilera/rib_coroutine_bind
FranAguilera Aug 10, 2023
1f8839b
Merge pull request #608 from FranAguilera/change_as_worker_dispatcher…
FranAguilera Aug 10, 2023
c0bf8a8
Update coroutines 1.7.3
tyvsmith Aug 22, 2023
09a08e6
Fixing test and removing ignore
tyvsmith Aug 22, 2023
24e3ae7
Fix spotless
tyvsmith Aug 22, 2023
25b8aaf
Setting worker dispatcher in test rule
tyvsmith Aug 22, 2023
a6e2109
addressing feedback
tyvsmith Aug 22, 2023
fa39761
Spotless
tyvsmith Aug 22, 2023
31f4984
Add `RibCoroutineWorker` factory method with `CoroutineScope` as rece…
psteiger Aug 22, 2023
f88e1fe
Merge pull request #609 from uber/tys/coroutines-1.7
tyvsmith Aug 23, 2023
85cf3b3
Bump kotlinx.coroutines.test to 1.7.3
psteiger Aug 23, 2023
04a7f08
Update LeakCanary to 2.10
pyricau May 11, 2023
9f7316a
Merge branch 'main' of https://github.com/pyricau/RIBs into pr/581
FranAguilera Aug 23, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,24 @@
* [Android] Open lifecycleFlow, thus enabling it for mocking
* [Android] [WorkerBinder] Guard against potential Worker.coroutineContext being null while using Mockito

### Version 0.14.2i
### Version 0.14.2
* [Android] Fix potential for deadlocks in `Worker` binding. by @psteiger in https://github.com/uber/RIBs/pull/582
* [Android] Add Rib Worker demo app by @FranAguilera in https://github.com/uber/RIBs/pull/575

### Version 0.15.0
* Only complete the worker's scope after calling `Worker.onStop` by @psteiger in https://github.com/uber/RIBs/pull/585
* Improve KDoc on `ActivityLifecycleEvent` by explaining ordering semantics. by @psteiger in https://github.com/uber/RIBs/pull/586
* Make use of `jvmToolchain` for building the project. by @psteiger in https://github.com/uber/RIBs/pull/583
* Revamp Gradle scripts by @psteiger in https://github.com/uber/RIBs/pull/588
* Deprecate old worker by @FranAguilera in https://github.com/uber/RIBs/pull/597
* Allow overriding default CoroutineDispatcher for WorkerBinder calls by @FranAguilera in https://github.com/uber/RIBs/pull/596
* Update README.md by @FranAguilera in https://github.com/uber/RIBs/pull/600
* Deprecate WorkerUnbinder by @FranAguilera in https://github.com/uber/RIBs/pull/601
* Expose ribActionEvents stream by @FranAguilera in https://github.com/uber/RIBs/pull/599

### Version 0.15.1
* [Android] Remove use of @JvmDefault in favor of using -Xjvm-default=all by @psteiger in https://github.com/uber/RIBs/pull/576

### Version 0.15.2
* [Android] Set view tree owners for RibActivity

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ To get started with RIBs, please refer to the [RIBs documentation](https://githu

To get more hands on with RIBs, we have written a [series of tutorials](https://github.com/uber/RIBs/wiki) that run you through the main aspects of the architecture with hands-on examples.

To read about the backstory on why we created RIBs, see [this blog post](https://eng.uber.com/new-rider-app/) we wrote when releasing RIBs in production the first time and see [this short video](https://www.youtube.com/watch?v=Q5cTT0M0YXg) where we discussed how the RIBs architecture works.
To read about the backstory on why we created RIBs, see [this blog post](https://www.uber.com/blog/new-rider-app-architecture/) we wrote when releasing RIBs in production the first time and see [this short video](https://www.youtube.com/watch?v=Q5cTT0M0YXg) where we discussed how the RIBs architecture works.

#### What is the difference between RIBs and MV*/VIPER?

Expand All @@ -49,9 +49,9 @@ To integrate the recommended minimum setup for RIBs add the following to your `b

```gradle
dependencies {
annotationProcessor 'com.uber.rib:rib-compiler-test:0.14.2'
implementation 'com.uber.rib:rib-android:0.14.2'
testImplementation 'com.uber.rib:rib-test:0.14.2'
annotationProcessor 'com.uber.rib:rib-compiler-test:0.15.2'
implementation 'com.uber.rib:rib-android:0.15.2'
testImplementation 'com.uber.rib:rib-test:0.15.2'
}
```
There are a number of extension packages available as well including Kotlin extensions, Jetpack Compose support, Coroutines support
Expand Down
192 changes: 10 additions & 182 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,186 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import net.ltgt.gradle.errorprone.CheckSeverity
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile



buildscript {
apply from: rootProject.file('gradle/dependencies.gradle')
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath deps.build.gradlePlugins.android
classpath deps.build.gradlePlugins.errorprone
classpath deps.build.gradlePlugins.kotlin
classpath deps.build.gradlePlugins.spotless
classpath deps.build.gradlePlugins.gradleMavenPublish
}
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.kotlinKapt) apply false
alias(libs.plugins.mavenPublish) apply false
alias(libs.plugins.errorprone) apply false
alias(libs.plugins.nullaway) apply false
alias(libs.plugins.intellij) apply false
alias(libs.plugins.spotless) apply false
}

Set<String> useErrorProneProjects = [
"memory-leaks",
"tutorial1",
"tutorial2"
]

def moduleFriends = [
'rib-android': 'rib-base',
'rib-debug-utils': 'rib-base',
'rib-router-navigator': 'rib-base',
'rib-test': 'rib-base',
'rib-workflow-test': 'rib-workflow',
'rib-coroutines-test': 'rib-coroutines'
]

subprojects {
buildscript {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

repositories {
google()
mavenCentral()
}

apply plugin: 'com.diffplug.spotless'
spotless {
format 'misc', {
target '**/*.md', '**/.gitignore'

trimTrailingWhitespace()
endWithNewline()
}
kotlin {
target "**/*.kt"
ktlint(deps.versions.ktlint).editorConfigOverride(['indent_size': '2', 'continuation_indent_size' : '4'])
ktfmt(deps.versions.ktfmt).googleStyle()
licenseHeaderFile rootProject.file('config/spotless/copyright.kt')
trimTrailingWhitespace()
endWithNewline()
}
java {
target "src/*/java/**/*.java"
googleJavaFormat(deps.versions.gjf)
licenseHeaderFile rootProject.file('config/spotless/copyright.java')
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
groovyGradle {
target '**/*.gradle'
trimTrailingWhitespace()
endWithNewline()
}
}

afterEvaluate {
boolean isAndroidApp = project.plugins.hasPlugin("com.android.application")
boolean isAndroidLibrary = project.plugins.hasPlugin("com.android.library")
boolean isIntelliJPlugin = project.plugins.hasPlugin("com.android.library")
boolean usesErrorProne = project.name in useErrorProneProjects
boolean isKotlinLibrary = project.plugins.hasPlugin("org.jetbrains.kotlin.jvm") || project.plugins.hasPlugin("org.jetbrains.kotlin.android")

if ((isAndroidLibrary || isAndroidApp) && usesErrorProne) {
def configurer = { variant ->
variant.getJavaCompileProvider().configure {
options.errorprone.nullaway {
severity = CheckSeverity.ERROR
annotatedPackages.add("com.uber")
}
options.errorprone.excludedPaths = ".*/build/generated/.*"
}
}
if (isAndroidLibrary) {
project.android.libraryVariants.configureEach(configurer)
}
if (isAndroidApp) {
project.android.applicationVariants.configureEach(configurer)
}
project.android.testVariants.configureEach(configurer)
project.android.unitTestVariants.configureEach(configurer)
}
if (isAndroidLibrary || isAndroidApp) {
// TODO replace with https://issuetracker.google.com/issues/72050365 once released.
project.android {
if (isAndroidLibrary) {
variantFilter { variant ->
if (variant.buildType.name == 'debug') {
variant.setIgnore(true)
}
}
}
if (isAndroidApp) {
buildTypes {
debug {
matchingFallbacks = ['release']
}
}
variantFilter { variant ->
if (variant.buildType.name == "release") {
variant.setIgnore(true)
}
}
}
}
}

if (isKotlinLibrary) {
def extraCompilerArgs = [
// See https://github.com/bazelbuild/bazel/issues/15144
"-Xjvm-default=enable",
"-opt-in=kotlin.RequiresOptIn",
]
if (project.name in moduleFriends.keySet()) {
def friendName = moduleFriends[project.name]
def friendProject = rootProject.subprojects.stream().filter { it.name == friendName }.findFirst().get()
def outputJarPath = friendProject.plugins.hasPlugin("com.android.library")
? "build/intermediates/compile_library_classes_jar/release/classes.jar"
: "build/libs/$friendName-${project.property('VERSION_NAME')}.jar"
def friendPath="${project.rootDir}/libraries/${moduleFriends[project.name]}/$outputJarPath"
extraCompilerArgs.add("-Xfriend-paths=$friendPath")
}
if (isAndroidLibrary || isAndroidApp) {
project.android.sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
androidTest.java.srcDirs += 'src/androidTest/kotlin'
}

tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs = extraCompilerArgs
jvmTarget = "11"
}
}
} else if(!isIntelliJPlugin) {
project.compileKotlin {
kotlinOptions {
freeCompilerArgs = extraCompilerArgs
jvmTarget = "11"
}
}
project.compileTestKotlin {
kotlinOptions {
freeCompilerArgs = extraCompilerArgs
jvmTarget = "11"
}
}
}
}
}
}

tasks.register('clean', Delete) {
delete rootProject.buildDir
}

apply from: rootProject.file('gradle/japicmp.gradle')
37 changes: 37 additions & 0 deletions android/conventions/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (C) 2023. Uber Technologies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
}

repositories {
google()
mavenCentral()
gradlePluginPortal()
}

dependencies {
// Workaround for using version catalog on precompiled scripts.
// https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
implementation(gradleApi())
implementation(libs.gradle.android.plugin)
implementation(libs.gradle.kotlin.plugin)
implementation(libs.gradle.errorprone.plugin)
implementation(libs.gradle.nullaway.plugin)
implementation(libs.gradle.spotless.plugin)
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.uber.rib.workers.root.main.workers.monitoring

fun interface BackendReporter {
fun report(genericMessage: String)
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

rootProject.name = "conventions"
47 changes: 47 additions & 0 deletions android/conventions/src/main/kotlin/Extensions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (C) 2023. Uber Technologies
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.android.build.gradle.AbstractAppExtension
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.TestedExtension
import com.android.build.gradle.api.BaseVariant
import net.ltgt.gradle.errorprone.CheckSeverity
import net.ltgt.gradle.errorprone.errorprone
import net.ltgt.gradle.nullaway.nullaway

fun AbstractAppExtension.errorprone() {
applicationVariants.configureEach { errorprone() }
testErrorprone()
}

fun LibraryExtension.errorprone() {
libraryVariants.configureEach { errorprone() }
testErrorprone()
}

fun TestedExtension.testErrorprone() {
testVariants.configureEach { errorprone() }
unitTestVariants.configureEach { errorprone() }
}

fun BaseVariant.errorprone() {
javaCompileProvider.configure {
options.errorprone.nullaway {
severity.set(CheckSeverity.ERROR)
annotatedPackages.add("com.uber")
}
options.errorprone.excludedPaths.set(".*/build/generated/.*")
}
}
Loading
Loading