Hmm.  Keep in mind that there are two situations:

1) After bin/js-debug is deleted (note that "ant clean" copied from our repos 
will not report errors if it deleting the wrong folders), JS files are copied 
from the SWCs and contain lots of goog.requires and a comment containing a list 
of static dependencies the compiler could detect. GoogDepsWriter reads and 
processes these goog.requires and computes a different set, based on static and 
circular dependencies, which is written back to each JS file.  The original set 
of goog.requires is stored in those JS files as a comma separated list in 
another comment, and this recent change also modifies the comment containing 
the list of static dependencies to add any static dependencies detected by 
GoogDepsWriter.
2) When compiling without having deleted bin/js-debug, GoogDepsWriter will 
notice the comments containing the lists and use those instead of reading the 
list of goog.requires again, since those may have been edited in situation 1.

So, when debugging these things, it could be that it works after deleting 
bin/js-debug, but not on subsequent builds which would imply that the lists in 
the comments is not able to reproduce the same database that reading the 
original goog.requires did.  Then the focus for fixing would be on being able 
to reproduce the database from the comments.  But if the situation 1 is not 
producing the right results then the focus for fixing will be on the logic that 
uses the database.

Also, files in the source-path are re-generated on every build so 
GoogDepsWriter will always be in scenario 1 for those files.  The dependency 
you posted below indicates that it is one of your files, which must be being 
used by another one of your files, so the question is whether the file that 
couldn't find that dependency is in your source path or is coming from a SWC 
that was compiled earlier.

And, finally, an important data point is when that TypeError is thrown.  If it 
is during the loading of JS files, then the code in GoogDepsWriter that is 
trying to figure out what other code is being used at load time needs 
adjusting.  In theory, it shouldn't be after the main app is instantiated, but 
you never know.

HTH,
-Alex

On 11/30/18, 5:49 AM, "Yishay Weiss" <yishayj...@hotmail.com> wrote:

    Oops, spoke too soon. I’m still getting a run-time error:
    
    
    
    Uncaught TypeError: com.printui.textLayout.elements.Configuration is not a 
constructor
    
    
    
    I’m not going to be available for this, this week so maybe Harbs can follow 
this up in case he runs into it.
    
    
    
    ________________________________
    From: Yishay Weiss <yishayj...@hotmail.com>
    Sent: Friday, November 30, 2018 3:21:41 PM
    To: dev@royale.apache.org
    Subject: Re: Dependency Missing
    
    Thanks for the explanation. Manually deleting js-debug fixed it. I had 
thought running ant clean would be sufficient... Anyway, it's working now.
    ________________________________
    From: Alex Harui <aha...@adobe.com.INVALID>
    Sent: Thursday, November 29, 2018 5:14:56 PM
    To: dev@royale.apache.org
    Subject: Re: Dependency Missing
    
    When a class becomes a static dependency, it's goog.require goes in the 
class that statically depends on it, unless the GoogDepsWriter can determine 
that some other class has already goog.require'd it.  All other dependencies 
are gathered and stuffed into the main app.  So yes, when we come up other 
reasons a dependency has to be "static" (might be needed as the scripts load 
instead of after the main app is created, these dependencies will disappear 
from the main app's list, and should show up elsewhere.  So grep for 
goog.require of the missing class and it should show up in another file.
    
    But if you didn't blow away all of your files in bin/js-debug, they may 
contain cached dependency information that is now invalid.   Please confirm 
that you deleted all of those files.
    
    Allowing more files to be in the requires for the main app might fix your 
problem, but could introduce a circular dependency in other situations, so it 
is best to truly understand whether the missing dependency is listed elsewhere 
or not and why.  Also, please provide the error you are getting and why you are 
getting it.
    
    -Alex
    
    On 11/29/18, 6:46 AM, "Yishay Weiss" <yishayj...@hotmail.com> wrote:
    
        By “dependency list” I mean the list of
    
    
    
        goog.require('…');
    
    
    
        statements at the beginning of the transpiled application file.
    
    
    
        After debugging this, I found out that in GoogDepsWriter:229 replacing
    
    
    
                                          if 
(!restOfDeps.contains(gd.className) && !gd.fileInfo.isExtern && 
!isExternal(gd.className) && !usedDeps.contains(gd.class Name))
    
    
    
        with
    
                                          if 
(!restOfDeps.contains(gd.className) && !gd.fileInfo.isExtern && 
!isExternal(gd.className)) seems to fix this particular problem.
    
    
    
        I’m still not sure what the proper fix is. Our class (A) gets added to 
usedDeps in this snippet
    
    
    
                                          if (gd.fileInfo.staticDeps != null)
    
                                          {
    
                                                 for (String dep : 
gd.fileInfo.staticDeps)
    
                                                 {
    
                                                       if (!deps.contains(dep))
    
                                                              deps.add(dep);
    
                                                       if 
(!usedDeps.contains(dep))
    
                                                              usedDeps.add(dep);
    
                                                 }
    
                                          }
    
        When I inspect this I see that gd.className == A, and 
gd.fileInfo.staticDeps[0] is also A.
    
    
    
        Does that make sense?
    
    
    
    
    
    
    
    
    
    
    
        ________________________________
        From: Alex Harui <aha...@adobe.com.INVALID>
        Sent: Wednesday, November 28, 2018 7:03:55 PM
        To: dev@royale.apache.org
        Subject: Re: Dependency Missing
    
        What is the "dependency list" you are referring to?
    
        On 11/28/18, 8:55 AM, "Yishay Weiss" <yishayj...@hotmail.com> wrote:
    
            Hi Alex,
    
            It  looks like commit 3252eb312b09cbf5270d78aadc785d757743d323 (fix 
deps writing when we promote requires from static initializers)  in the 
compiler has broken our app. One of the classes isn’t added to the dependency 
list despite being imported.
    
            I still haven’t been able to isolate this to a test case, but one 
thing that strikes me about the missing dependency is that it has a static 
function before the constructor. Also, the constructor takes an argument.
    
            If something pops to mind, please let us know. Otherwise, I’ll try 
to debug the compiler tomorrow.
    
            Thanks.
    
    
    
    
    
    

Reply via email to