Closed caramdache closed 5 years ago
The cyclical dependency warning was added last as part of the build process to bring attention to them. Your project may have always had them (or gems you depended on), this just brings them to light and become more important if you end up monkey patching classes that have cyclical dependencies.
I've been trying to understand the error message and so I've included the code that you published earlier at: https://github.com/rubymotion/motion-support/issues/38#issuecomment-366676898.
However, in cyclic?
, only file paths are available. Is there any way to find out the class(es) that trigger the cyclic dependency?
Besides, when I use defined?
, RM print a duplicate warning for that file. Is this not supposed to turn the warning/issue off instead?
Applying the following patch will give you the full graph: https://github.com/infinitered/ProMotion/issues/810
There is also this gem that will let you visualize your dependencies: https://github.com/emad-elsaid/rubrowser
Thanks for the pointers. https://github.com/infinitered/ProMotion/issues/810 only displays dependencies between files, NOT classes, as far as I can see.
rubrowser
is excellent, thanks! However, it does not show any dependency between EventsController
and AboutController
. However, RM points out a circular dependency between ./app/events_controller.rb
and ./app/about_controller.rb
. Doesn't this look like a possible bug?
run
seems like a more appropriate place to display the warning, as there can be multiple classes per file. Here is a suggested patch:
if cyclic?(dependency, def_path, ref_path)
App.warn("Possible cyclical dependency for #{const} between #{def_path} and #{ref_path}'s. Consider revision if runtime exceptions occur around undefined
# remove cyclic
next
end
@caramdache are you monkey patching any gems you depend on?
Make sure you are including files in both app
and lib
No, but I'm monkey patching quite a few UIKit classes by myself. This is what the lib
directory is for.
Are any of the libraries that you depend on also monkepatching the same UIKit libraries?
I don't think it'll be an issue given that it's all UIKit related. If you want you can email me at ar@amirrajan.net or DM on the Slack and I can help with your private repo.
It's been a while since I compiled one of my projects and it suddenly raises warnings for possible cyclical dependencies. A while later, CoreData complains that some dynamic accessors cannot be resolved.
Intriguing, because these issues were never raised before by earlier version of RM. All the more intriguing that another project that follows a similar template (same class structure, same use of core data, use of the same RM lib, etc.) compiles and runs just fine.
Could this be a bug in RM 5.14 ?