-
Notifications
You must be signed in to change notification settings - Fork 8
Multiple Module
kyleduo edited this page Mar 12, 2018
·
1 revision
Rabbits support multiple module projects. Since I haven’t working on a multiple module project, I’m not sure what it should like.
When use Rabbits in multiple projects, here are something you need to know.
- Rabbits can only be initialized once in the entry module.
- If you want to add Interceptors in sub-module, you can just invoke
Rabbits.get().addInterceptor(Interceptor)
but the order is a problem you should concern. (Since the order is same as where you add.) - The paths annotated on the page from main module have higher priority than ones from sub-module, so you need to guarantee that no collision between paths. You can find error log from logcat panel if you open debug flag.
To turn multiple module mode, you need add these lines in your build.gradle file.
// add to main module
javaCompileOptions {
annotationProcessorOptions {
arguments = [rabbits_submodules: "sm1"]
}
}
// add to sub module
javaCompileOptions {
annotationProcessorOptions {
arguments = [rabbits_moduleName: "sm1", rabbits_submodules: "sm2"]
}
}
- rabbits_moduleName name of current module, do not set to main module.
- rabbits_submodules names of sub-modules, seperated by “,”.
You can also find that Rabbits support multiple level dependency. Main depends on sm1 and sm1 depends on sm2.