Re: [qooxdoo-devel] Part dependency help
Brought to you by:
ecker,
martinwittemann
From: thron7 <tho...@1u...> - 2013-11-28 08:25:42
|
You have probably seen the guidelines for configuring parts in the manual [1]. The issue you might be running into is rule 2, don't put load dependencies of one part in the "include" list of another. [1] http://manual.qooxdoo.org/3.0.x/pages/development/parts_using.html#in-depth-configuring-the-include-key-of-your-parts On 11/27/2013 11:34 PM, csfahey wrote: > My application has grown large enough that it warrants breaking it up to help > load speed. Needless to say, I am trying to build it into parts. The > problem I seem to be having is that I have a dependency problem and don't > seem to understand parts dependency well enough to know where to look for > the problem. > Here is the config entry: > > "packages" : { "parts" : { > "boot": { "include" : [ "Application" ] }, > "user" : { "include" : [ "MainWindow", "DataManager", "class1", > "class2", ... ] }, > "report" : { "include" : [ "Report", "GenerateReport" ]} > }} > > I am getting the error "Attempt to block load-time dependency of class > DataManager of Application" message. ... it's probably "DataManager *to* Application", right?! > The Application class does not have > any references to DataManager or any other classes within it. But that's not what it says. It says that DataManager has a dependency to Application. This dependency might not be obvious (i.e. in the form of a literal mentioning of "Application" in DataManager's code). Rather, DataManager might reference a class that references a class that references a class ... which has a reference to Application. And the crucial part is that this chain of dependencies is required at load-time. So in DataManager, look out for class references in the 'defer' section, or in initialization expressions of class members (which are all required at load-time), and make your way from there. (The Generator could dump all dependencies of DataManager but that's an advanced feature so I'm sparing you this for the moment). > Instead, it > creates an instance of MainWindow which is the only relationship between the > two. Here is the creation code: > > qx.io.PartLoader.require(["user"], function() > { > // if the window is not created > if( !this._mainWindow ) > { > this._mainWindow = new MainWindow( ).set( { backgroundColor: "white" } ); > } > }, this ); > > If I move the "DataManager" into the "boot" part, it then gives the error > that yet another class from the "user" part is dependent. I continue to > receive the error until the only class that is left is "MainWindow". > > What would cause this? I would appreciate any help determining where this > dependency issue is coming from. My take is, in some class, maybe deep down in your application, you have a reference back to the Application class. Wherever such a class is used (transitively), you get the dependency to Application. You need to resolve those dependencies to Application. HTH, T. |