1

I'm trying to integrate Toothpick library without reflection into my multi modules project. I follow this guide in order to connect all my modules with DI. For example I have three module: :app, :feature1, :feature2. :app module dependes both on :feature1 and :feature2. I need to inject classes from both of feature modules. So in :app's build.gradle file I need to write somethig like this (using annotationProccessor - not kapt):

annotationProcessorOptions { arguments = [ 
    toothpick_registry_package_name : 'com.example.app',
    toothpick_registry_children_package_names : "com.example.feature1,com.example.feature2" 
    ]}

As you can see toothpick_registry_children_package_names argument has two values (list of two values). But how to set several values for one key using kapt plugin? I've tried to do it like so:

kapt {
    arguments {
        arg("toothpick_registry_package_name", "com.example.app")
        arg("toothpick_registry_children_package_names", ['com.example.feature1','com.example.feature2'])
    }
}

But the generated code looks like this:

public MemberInjectorRegistry() {
    addChildRegistry(new [com.example.feature1.MemberInjectorRegistry());
    addChildRegistry(new com.example.feature2].MemberInjectorRegistry());
    registerGroup0();
  }

As you can see arguments includes square brackets (first argument starts with "[", and second finished with "]"). What am I doing wrong? I tried to remove square brackets but then both modules names are just concatenated like this:

public MemberInjectorRegistry() {
    addChildRegistry(new com.example.feature1 com.example.feature2.MemberInjectorRegistry());
    registerGroup0();
  }

Is it bug in kapt plugin or am I doing something wrong?

Sergey
  • 140
  • 1
  • 10

0 Answers0