Madrapps / dagger-plugin

Plugin that supports easy usage of Dagger 2 library in IntelliJ iDEA or Android Studio
Apache License 2.0
30 stars 9 forks source link

Component graph is not complete #29

Closed gmazzo closed 3 years ago

gmazzo commented 4 years ago

In our app, we have several Dagger components, and our main one declares them as a dependency.

I only see the child components in the graph, but no the main one GlovoAppComponent:

Log:

2020-08-13 12:11:57,682 [  61100]   INFO -                         STDOUT - Dagger Plugin : Processor - taskManager:com.intellij.tasks.impl.TaskManagerImpl@2d02a3a4 
2020-08-13 12:11:57,687 [  61105]   INFO -                         STDOUT - Dagger Plugin : Processor - Start background task 
2020-08-13 12:11:57,688 [  61106]   INFO -                         STDOUT - Dagger Plugin : Processor - Running background task 
2020-08-13 12:11:57,866 [  61284]   INFO -                         STDOUT - Dagger Plugin : Processor - Compiling .[8].[230]. 
2020-08-13 12:11:58,421 [  61839]   INFO -                         STDOUT - Dagger Plugin : Processor - Compile success? true 
2020-08-13 12:11:58,627 [  62045]   INFO -                         STDOUT - Dagger Plugin : Processor - Compiling .[1866].[623]. 
2020-08-13 12:12:03,065 [  66483]   INFO -                         STDOUT - Dagger Plugin : ------------------------------------------------------------ 
2020-08-13 12:12:03,066 [  66484]   INFO -                         STDOUT - Dagger Plugin : RootComponent - glovoapp.di.GlovoAppComponent 
2020-08-13 12:12:03,066 [  66484]   INFO -                         STDOUT - Dagger Plugin : ComponentNodes - 159 
2020-08-13 12:12:03,066 [  66484]   INFO -                         STDOUT - Dagger Plugin : ------------------------------------------------------------ 
2020-08-13 12:12:03,066 [  66484]   INFO -                         STDOUT -  
2020-08-13 12:12:03,082 [  66500]   INFO -                         STDOUT - Dagger Plugin : Exception Handled 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR - java.lang.RuntimeException: kotlin.KotlinNullPointerException 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.sun.tools.javac.main.Main.compile(Main.java:553) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.madrapps.dagger.core.Processor.compile(Processor.kt:111) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.madrapps.dagger.core.Processor.access$compile(Processor.kt:37) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.madrapps.dagger.core.Processor$process$task$1.run(Processor.kt:74) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:932) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:434) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.ProgressRunner.lambda$null$3(ProgressRunner.java:233) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:166) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:627) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:572) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:61) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:153) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:233) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at java.lang.Thread.run(Thread.java:748) 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR - Caused by: kotlin.KotlinNullPointerException 
2020-08-13 12:12:03,083 [  66501]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.createNode(SpiPlugin.kt:140) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.access$createNode(SpiPlugin.kt:35) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin$addNodes$1.accept(SpiPlugin.kt:99) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin$addNodes$1.accept(SpiPlugin.kt:35) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at java.util.Optional.ifPresent(Optional.java:159) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.addNodes(SpiPlugin.kt:98) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.addNodes(SpiPlugin.kt:115) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.access$addNodes(SpiPlugin.kt:35) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin$addBindings$1.run(SpiPlugin.kt:63) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:869) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.addBindings(SpiPlugin.kt:56) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.madrapps.dagger.core.SpiPlugin.visitGraph(SpiPlugin.kt:50) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.BindingGraphValidator.runPlugins(BindingGraphValidator.java:100) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.BindingGraphValidator.visitPlugins(BindingGraphValidator.java:90) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.BindingGraphValidator.isValid(BindingGraphValidator.java:64) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.isValid(ComponentProcessingStep.java:254) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.processRootComponent(ComponentProcessingStep.java:151) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:131) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:62) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.TypeCheckingProcessingStep.lambda$process$0(TypeCheckingProcessingStep.java:51) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.google.common.collect.RegularImmutableMap.forEach(RegularImmutableMap.java:185) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.validation.TypeCheckingProcessingStep.process(TypeCheckingProcessingStep.java:48) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:124) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:62) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.internal.codegen.statistics.DaggerStatisticsCollectingProcessingStep.process(DaggerStatisticsCollectingProcessingStep.java:52) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:330) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:181) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:802) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:713) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1800(JavacProcessingEnvironment.java:91) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1043) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1184) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170) 
2020-08-13 12:12:03,084 [  66502]   INFO -                         STDERR -     at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856) 
2020-08-13 12:12:03,085 [  66503]   INFO -                         STDERR -     at com.sun.tools.javac.main.Main.compile(Main.java:523) 
2020-08-13 12:12:03,085 [  66503]   INFO -                         STDERR -     ... 18 more 
thsaravana commented 4 years ago

Thanks for reporting this. We will debug and get back to you.

thsaravana commented 3 years ago

@gmazzo Are you still facing this issue in the latest version of the plugin? Also are you using Android Studio or Intellij iDEA ? And the version?

gmazzo commented 3 years ago

Still the same, the error is gone now (or at least I couldn't find it) but still the main component is missing.

thsaravana commented 3 years ago

Can you share us the below details?

gmazzo commented 3 years ago

Platform

Android Studio 4.2 Canary 16 Build #AI-202.7660.26.42.6939830, built on October 29, 2020 Runtime version: 11.0.8+10-b944.6842174 x86_64 VM: OpenJDK 64-Bit Server VM by N/A macOS 10.16 GC: G1 Young Generation, G1 Old Generation Memory: 6144M Cores: 12 Registry: external.system.auto.import.disabled=true Non-Bundled Plugins: com.jetbrains.ChooseRuntime, org.jetbrains.kotlin, com.madrapps.dagger-plugin, org.intellij.plugins.markdown

Kotlin Plugin

202-1.4.30-release-AS8194.7

Dagger

dagger-2.29.1

thsaravana commented 3 years ago

Thanks @gmazzo Can you test with this? Just download the zip and drag drop it in the IDE and restart your IDE. Please let us know if the issue is resolved.

gmazzo commented 3 years ago

Still the same. May be our project is too complex? We have several Gradle modules and some of them expose full dagger components (those are shown). Then the main app component has them as dependencies (and that's the one it's missing).

Is there any debug/intermediate file I can check or send to you?

thsaravana commented 3 years ago

Yes. Go to Preferences -> Appearance & Behaviour -> Notifications. Turn on the "Log" option for the "Dagger Group". Now hit the "Refresh" button in the Dagger toolwindow. The logs will get printed in the Event Log. Could you copy the entire log and mail to madrasappfactory@gmail.com ? We will debug it and get back to you.

gmazzo commented 3 years ago

Now it has appeared 🤔 , but also other components are missing. Strange.

image

How this perform with big scale Dagger projects and with an extensive usage of dagger-android? Seems it's blocking the IntelliJ UI to me.

I think I can close the ticket now. But I'm not sure I can promote the tool internally in our company (yet). Seems a bit unstable, but goes in a great direction!

thsaravana commented 3 years ago

We have rolled out the fix to all versions we currently support. We have tested with Components with around 50+ sub components. Ideally the graph is calculated in the background thread, and then the tree is updated in the UI thread. So there shouldn't be anything blocking. I will close this issue, and if you continue to face performance issues please raise a new one. Meanwhile we are testing the plugin for performance problems.