Milad-Akarie / injectable

Code Generator for get_it
MIT License
534 stars 140 forks source link

Scopes inside of micropackages do not lead to code generation #352

Open svsk417 opened 1 year ago

svsk417 commented 1 year ago

Hi there! We have a package structure like:

               (micropackage)         (micropackages)    (micropackages)
main app ->      bootstrap      |->    data          ->  data_feature1
                                |->    domain    ->      domain_feature1
                                |->    ...                        |
                                |                                 |
                                ---------------------------------

Now I want to use scopes within bootstrap to not load the dependencies from the feature module during integration testing. Therefore in bootstrap I do:

@InjectableInit.microPackage(externalPackageModulesAfter: [
  ExternalModule(DataFeature1PackageModule,
      scope: 'feature1'),
  ExternalModule(DomainFeature1PackageModule,
      scope: 'feature1'),
  ExternalModule(Data),
  ExternalModule(Domain),
])
initMicroPackage() {}

But this will not generate code. My expectation was that this would generate an extension of getIt within bootstrap_package_module.dart. As a side note: I have introduced the bootstrap module in order to not have direct dependencies coming from the main app to the single layers, because then I can make sure thruough static code analysis that only the dependencies that belong into the view layer are provided within my main app and nothing e.g. coming from the data layer directly. Did I miss something? Thanks for your help and the awesome work on this package!

svsk417 commented 1 year ago

I have decided against this approach and am instead working with environments

svsk417 commented 4 months ago

Now, one year later, I have run into the same issue again. Therefore, I am reopening it.

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions