Skip to content

Decoupled Android EventBus from Core EventBus. Removed the need to Jetify this library. - #665

Closed
andob wants to merge 4 commits into
greenrobot:masterfrom
andob:master
Closed

Decoupled Android EventBus from Core EventBus. Removed the need to Jetify this library.#665
andob wants to merge 4 commits into
greenrobot:masterfrom
andob:master

Conversation

@andob

@andob andob commented May 10, 2021

Copy link
Copy Markdown
Contributor
  • Removed Android dependencies from the core EventBus altogether. Thus, the core library can be used in plain java.
  • Made another module to support Android projects. Decoupled Android-related functionalities (logging, main thread support) into this module.
  • Removed error dialog classes.
  • This would remove the need to use Jetifier in our Android projects. Core eventbus doesn't depend on anything, eventbus-android module depends only on Android SDK. No need to use support libraries or AndroidX, thus no need to Jetify

Java users will import the library with:

implementation 'org.greenrobot:eventbus:<version>'

Android users will import the library with:

implementation 'org.greenrobot:eventbus:<version>'
implementation 'org.greenrobot:eventbus-android:<version>'
annotationProcessor 'org.greenrobot:eventbus-processor:<version>'

If android users will import the library forgetting to also import android compatibility module:

implementation 'org.greenrobot:eventbus:<version>'
annotationProcessor 'org.greenrobot:eventbus-processor:<version>'

A runtime exception will be thown at eventBus.register(this): Looks like you are using the latest version of EventBus on Android..., crashing the application. This will help users when they update the library, notifying them of the breaking change.

@andob andob changed the title Decoupled Android EventBus from Core EventBus. Removed the need to use Jetifier for this library. Decoupled Android EventBus from Core EventBus. Removed the need to Jetify this library. May 11, 2021
@greenrobot-team

greenrobot-team commented May 11, 2021

Copy link
Copy Markdown
Collaborator

This is actually a great idea to work off, thanks for this!

@greenrobot Thoughts?

Edit: would make sense to name the base library eventbus-java and use the existing eventbus name for the Android only library. Assuming most users use EventBus on Android to make updating simple.

@greenrobot-team greenrobot-team self-assigned this May 11, 2021
@andob

andob commented May 21, 2021

Copy link
Copy Markdown
Contributor Author

would make sense to name the base library eventbus-java and use the existing eventbus name for the Android only library

@greenrobot-team Do you need me to do something on my side regarding this, or you will do this change after the review / merge?

Also I think naming can be configured when publishing maven artifacts, no need to rename the modules.
We can use current module / directory names, and publish them with different names:
/EventBus -> org.greenrobot:eventbus-java
/eventbus-android -> org.greenrobot:eventbus

@greenrobot-team

Copy link
Copy Markdown
Collaborator

There is nothing for you to do, thanks again for the suggestion!

@greenrobot-team

Copy link
Copy Markdown
Collaborator

Closed in favor of #670.

@greenrobot-team greenrobot-team added this to the 3.3.0 milestone Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants