The Endian dependency should be added to the main application dependency. The entire list should be included there. (I have 872 dependencies listed.) ‘org.apache.royale.utils.Endian’ is one of them.
I am also using URLStream and URLBinaryLoader which list Endian as a dependency, so it’s possible it’s being pulled from there. I’m not sure I have an application which uses BinaryData without one of those. > On Jul 19, 2018, at 3:19 PM, Harbs <[email protected]> wrote: > > That’s weird. I believe the default is false (although I think the default > should be true). > > Try setting -remove-circulars to true. I think that should resolve it. > > Yes. I’m using BinaryData extensively. > >> On Jul 19, 2018, at 3:15 PM, Frost, Andrew <[email protected]> wrote: >> >> Hi >> >> I'm not using it on my build command line, i.e. it's set as the default >> 'true'. >> >> If I do set it to 'false' then I get what I would expect from the code, i.e. >> it ignores the interfaces and just outputs the discovered dependencies - >> including the google one: >> goog.addDependency('../../../org/apache/royale/utils/BinaryData.js', >> ['org.apache.royale.utils.BinaryData'], ['goog.DEBUG', >> 'org.apache.royale.utils.Endian']); >> >> But now I get hundreds of errors from the browser's JS engine e.g. >> IStatesObject.js:42 Uncaught TypeError: Cannot read property >> 'IEventDispatcher' of undefined >> at IStatesObject.js:42 >> (anonymous) @ IStatesObject.js:42 >> IUIBase.js:58 Uncaught TypeError: Cannot read property 'IEventDispatcher' of >> undefined >> at IUIBase.js:58 >> (anonymous) @ IUIBase.js:58 >> IBeadModel.js:38 Uncaught TypeError: Cannot read property 'IEventDispatcher' >> of undefined >> at IBeadModel.js:38 >> (anonymous) @ IBeadModel.js:38 >> Event.js:33 Uncaught TypeError: Cannot read property 'Event' of undefined >> at Event.js:33 >> (anonymous) @ Event.js:33 >> base.js:2484 Uncaught TypeError: Cannot read property 'prototype' of >> undefined >> at Object.goog.inherits (base.js:2484) >> at UIBase.js:44 >> goog.inherits @ base.js:2484 >> (anonymous) @ UIBase.js:44 >> base.js:2484 Uncaught TypeError: Cannot read property 'prototype' of >> undefined >> at Object.goog.inherits (base.js:2484) >> at eventtarget.js:96 >> goog.inherits @ base.js:2484 >> (anonymous) @ eventtarget.js:96 >> base.js:2484 Uncaught TypeError: Cannot read property 'prototype' of >> undefined >> at Object.goog.inherits (base.js:2484) >> at HTMLElementWrapper.js:28 >> ..... >> >> >> I'm assuming I'm not meant to be editing the html dependency list manually >> (there's another one to change, Namespace.js has a dependency on Language.js >> due to the use of "is") so unless something here is project-specific that's >> changing how it's outputting/parsing the dependencies, I'm not sure what's >> up. >> >> If anyone has a project that uses BinaryData, are they able to check what >> they see in the generated HTML for that one, to see whether it's just me who >> doesn't have the Endian dependency added..? FWIW I've been trying both with >> 0.9.2 downloaded via NPM, and the latest develop branch (well perhaps a week >> out of date now..) >> >> thanks >> >> Andrew >> >> >> -----Original Message----- >> From: Harbs [mailto:[email protected]] >> Sent: 19 July 2018 12:18 >> To: [email protected] >> Subject: [EXTERNAL] Re: Query on Royale dependency generation >> >> Are you using the -remove-circulars compiler option? >> >>> On Jul 19, 2018, at 1:05 PM, Frost, Andrew <[email protected]> wrote: >>> >>> Hi guys >>> >>> I'd been getting an error when running a simple Royale application: >>> Uncaught TypeError: Cannot read property 'BIG_ENDIAN' of undefined >>> at new org.apache.royale.utils.BinaryData (BinaryData.js:28) >>> >>> the line in question is from the constructor: >>> org.apache.royale.utils.BinaryData = function(bytes) { bytes = typeof >>> bytes !== 'undefined' ? bytes : null; this._endian = >>> org.apache.royale.utils.Endian.BIG_ENDIAN; >>> and "Endian" is undefined. >>> >>> After a little digging I found this is because the BinaryData object is >>> being constructed without the JS engine having knowledge of the "Endian" >>> class: something went wrong with the google dependency thing. In my >>> generated html page I have a line: >>> goog.addDependency('../../../org/apache/royale/utils/BinaryData.js', >>> ['org.apache.royale.utils.BinaryData'], >>> ['org.apache.royale.utils.IBinaryDataInput', >>> 'org.apache.royale.utils.IBinaryDataOutput']); >>> and if I change this to: >>> goog.addDependency('../../../org/apache/royale/utils/BinaryData.js', >>> ['org.apache.royale.utils.BinaryData'], >>> ['org.apache.royale.utils.IBinaryDataInput', >>> 'org.apache.royale.utils.IBinaryDataOutput', >>> 'org.apache.royale.utils.Endian']); >>> then it works. >>> >>> Looking at where this comes from in the compiler: >>> compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/Go >>> ogleDepsWriter.java function "generateDeps" is creating these lists, >>> and if the "removeCirculars" value is true (which it is by default unless >>> changed on the command-line) then we add dependencies for the interfaces >>> that we implement (gd.fileInfo.impls) and any static dependencies >>> (gd.fileInfo.staticDeps) but we don't add the actual dependencies that were >>> calculated (gd.deps or gd.fileInfo.deps - both of these contain the Endian >>> definition). >>> >>> So I can fix my project by updating the compiler to do: >>> if (gd.fileInfo.deps != null) >>> deps.addAll(gd.fileInfo.deps); and then it works: the >>> generated line though is: >>> goog.addDependency('../../../org/apache/royale/utils/BinaryData.js', >>> ['org.apache.royale.utils.BinaryData'], ['goog.DEBUG', >>> 'org.apache.royale.utils.Endian', >>> 'org.apache.royale.utils.IBinaryDataInput', >>> 'org.apache.royale.utils.IBinaryDataOutput']); >>> >>> >>> So my questions: >>> >>> 1. where is the fault here? Am I right in thinking that there's a >>> missing set of dependencies that need to also be added per the above >>> snippet, or should the Endian definition be listed as a dependency in the >>> gd.fileInfo.staticDeps list (which is null for me) 2. presumably we don't >>> want "goog.DEBUG" to end up in the dependency list: is there a sensible way >>> of getting rid of this (or should we just manually filter out anything >>> starting "goog.")? >>> 3. if we should be adding these dependencies separately, is there a >>> preference for "gd.deps" vs "gd.fileInfo.deps"? >>> >>> thanks >>> >>> Andrew >>> >>> >> >
