Hi all,

in a little discussion I had with Carlos this morning I think we got a bit 
closer to solving my last issue ...

The problem is: 
If you build application and modules in a single project, then all is fine and 
the problems I am observing don't seem to apply (TourDeJewl)

However this setup is not really scalable for larger projects ... projects with 
multiple teams.

If the modules are built in separate modules, the compiler really can't know if 
a type has been declared before.
I mean ... I could use a type in two modules, but the compiler just impossibly 
can know which module is loaded first (In my case the server tells the client 
which modules to load after logging in)

I think the only way to fix this, is to perhaps change the way the 
goog.addDependency entries are generated for modules.
I would propose to leave things the way they are for types of the module 
itself, but change the way the dependencies of third party dependencies are 
added.
So if a module uses a Royale Framework Type it would not generate a: 
goog.addDependency but something like a goog.addDependencyIfUndeclared instead.
The difference would be that in this case it simply doesn't produce an error if 
you try to define a type that already was defined.

I know this could be causing strange side-effects if you would build some 
modules with different versions of dependencies, but I would just say: If you 
do that ... you've deserved the problems you get ;-)


Chris



Am 24.08.20, 23:46 schrieb "Christofer Dutz" <[email protected]>:

    Hi all,

    Thanks to Carlos' off-list tip I had another look at the "module-output" 
compiler option.
    From a look at the documentation it looked as if it would just copy stuff 
somewhere else, but it actually does what I was doing with the replacer.
    So I was able to clean up my configuration quite a bit, however still when 
loading the duplicate classes I am getting errors.

    I hope with this compiler option I'll be able to also use the js-release 
versions ... will try that out asap.

    Chris




    Am 24.08.20, 22:08 schrieb "Christofer Dutz" <[email protected]>:

        Hi Carlos,

        I had used your blog post to create my initial version ... but I added 
your copy-resources solution to stage my test-code. Thanks for that.
        But I also needed to replace the goog.addDependency urls in all of the 
modules to use the relative path or my modules wouldn't load.
        Now it's working, as I said yesterday, but if a module uses a class 
that the main application also provides I get an error as soon as the
        the module tries to add the already loaded type ... it doesn't cause an 
error, but I get error reports in the developer-tools.

        Chris


        Am 24.08.20, 12:19 schrieb "Carlos Rovira" <[email protected]>:

            Hi Chris,

            I solved that in blog example [1] via maven [2].
            Maybe a hack similar to what you did?

            Anyway I think I vaguely remember to see something related to that 
in repo,
            going to check and see if I find it and will come back.

            I think this could be improved.

            [1]
            
https://royale.apache.org/dividing-an-apache-royale-application-with-modules/
            [2]
            
https://github.com/apache/royale-asjs/blob/fad51dad1cc77d27492dbf224233179da8483e36/examples/blog/BE0013_Dividing_an_Apache_Royale_application_with_modules/JewelModule/pom.xml#L48

            El dom., 23 ago. 2020 a las 22:44, Christofer Dutz (<
            [email protected]>) escribió:

            > Ok ... so my replace plugin hack worked.
            >
            > Now I got the next little issue:
            >
            > - If a module declares a type which was declared somewhere else, 
I am
            > getting errors in the browser, however the application still 
seems to work.
            >
            > Is there a way to tell the system to not fire errors if a type 
was already
            > declared?
            >
            > Chris
            >
            >
            >
            > Am 23.08.20, 22:04 schrieb "Christofer Dutz" 
<[email protected]>:
            >
            >     Ok ... so I got even further.
            >
            >     If I modify the TestAModule__deps.js file and replaced the 
"../../../"
            > prefixes with "../../../main/TestAModule/".
            >     It seems to work ... so is there a way to have this generated 
by the
            > compiler?
            >
            >     Otherwise I'll probably just have to use a replace maven 
plugin to
            > modify the files.
            >
            >     Chris
            >
            >
            >     Am 23.08.20, 21:24 schrieb "Christofer Dutz" <
            > [email protected]>:
            >
            >         Ok ... so it seems to be picking up the 
"TestAModule__deps.js"
            > correctly ...
            >
            >         However this tells the application to load stuff from the 
root (No
            > idea why all entries there have "../../../" as prefix. But it 
seems all
            > output files of Royale have this 3-segment prefix.
            >
            >         Chris
            >
            >
            >         Am 23.08.20, 20:57 schrieb "Christofer Dutz" <
            > [email protected]>:
            >
            >             Hi all,
            >
            >             today I extended my experiments to loading of 
modules. So as
            > soon as a user logs in, it gets a list of modules he’s allowed to 
use.
            >             Then the application dynamically loads only these 
modules.
            >
            >             So I managed to get the ModuleLoader to correctly 
load the css
            > file from a subdirectory:
            >
            >             <j:SectionContent name="TestAModule">
            >               <j:ModuleLoader height="100%" width="100%" 
autoLoad="true"
            >                               moduleName="TestAModule"
            > modulePath="main/TestAModule"/>
            >             </j:SectionContent>
            >
            >             In the browser I can see it loading some stuff from 
the
            > subdirectory “main/TestAModule” … unfortunately it tries to load 
the js
            > file “TestAModule.js” from the root and not from that 
sub-directory.
            >
            >             What do I have to do to make it load this from the 
right place?
            >
            >             Chris
            >
            >
            >
            >
            >

            -- 
            Carlos Rovira
            http://about.me/carlosrovira



Reply via email to