-
Notifications
You must be signed in to change notification settings - Fork 906
Android Tooling
In order to ensure smooth adoption of the RIB architecture, we have built tooling to (1) make RIBs easier to use (2) take advantage by the invariants created by adopting RIBs. Tools we have open sourced are:
- RIBs Code Generation Plugin for Android Studio and IntelliJ
- NullAway: Fast Annotation-Based Null Checking for Java
- AutoDispose Error Prone Checker
We have created an Android Studio / IntelliJ plugin to generate RIBs scaffolding, making RIB usage and adoption easier. The scaffolded classes have RIB structures in place. Test scaffolding for classes that should have business logic is also generated for use.
After installing the plugin, RIBs can be added with the New -> New RIB...
command. This generates:
- Scaffolding: [RIBName]Builder, [RIBName]Interactor, [RIBName]Router and [RIBName]View
- Test classes for unit testing: [RIBName]InteractorTest, [RIBName]RouterTest
RIBs can be generated with or without Presenter and View classes.
In Android Studio or Intellij, open IntelliJ IDEA > Preferences > Plugins
and select Install Plugins From Disk
. Then install the RIBs plugin jar. After this, the plugin will appear in the New
menu.
To install the plugin locally:
- Run
./gradlew :tooling:rib-intellij-plugin:buildPlugin -Dorg.gradle.configureondemand=true -Dbuild.intellijplugin=true
- Install the jar file generated within
build
- Make sure you've installed the correct jar. If you install the wrong jar, you could see runtime crashes.
NullAway is the tool we built to help eliminate NullPointerExceptions
(NPEs) in Java code. We use this tool on top of our RIBs stack for static analysis.
The project is open sourced on its own. You can read more about it and download it on the NullAway Github page.
You can configure the RIB AutoDispose checker similarly to usage of NullAway. Once applied to your project you can't build your app when you forget to apply AutoDispose
to an rx subscription inside a RIB. If you do forget you'll see an error like the following
error: [RxJavaMissingAutodisposeErrorChecker] Always apply an Autodispose scope before subscribing
.subscribe(new Consumer<String>() {
^
Copyright © 2017 Uber Technologies Inc.
Once you've read through the documentation, learn the core concepts of RIBs by running through the tutorials and use RIBs more efficiently with the platform-specific tooling we've built.