VMware Cloud Community
qc4vmware
Virtuoso
Virtuoso
Jump to solution

Creating a package does not include all actions in a module when only referencing the module.

I'm not sure if this is a bug or not but I figured I'd pose the question here.  I'm trying to adjust my coding to match suggestions in the guide so I am trying to reduce my System.getModule calls.  It seems like the module does not get included in a package if I set a variable in a scriptable task to just the module or if I set an attribute to the module.  I'd expect the package compiler to grab the whole module and include it in the package when I do this but that is not happening.  Is this expected behavior or a bug?  Seems like a bug to me.

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

This is the expected behavior of the current code, although it could also be considered a bug.

The code that scans scripting content to determine what elements are referenced scans for a pattern matching System.getModule("someModuleName").someAction(args) and, if found, adds the action someAction to the package. It doesn't detect System.getModule("someModuleName") pattern and hence doesn't add all actions from this module to the package.

This also means that the following pattern won't detect someAction as being referenced:

    var module = System.getModule("someModuleName");

    module.someAction(args);

The problem is that the reference scanner is not a proper Javascript language parser and doesn't recognize many valid Javascript constructs.

View solution in original post

0 Kudos
2 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

This is the expected behavior of the current code, although it could also be considered a bug.

The code that scans scripting content to determine what elements are referenced scans for a pattern matching System.getModule("someModuleName").someAction(args) and, if found, adds the action someAction to the package. It doesn't detect System.getModule("someModuleName") pattern and hence doesn't add all actions from this module to the package.

This also means that the following pattern won't detect someAction as being referenced:

    var module = System.getModule("someModuleName");

    module.someAction(args);

The problem is that the reference scanner is not a proper Javascript language parser and doesn't recognize many valid Javascript constructs.

0 Kudos
qc4vmware
Virtuoso
Virtuoso
Jump to solution

Thanks for the info.  Thats good to know!  I can work with that to make sure all actions get pulled in.

0 Kudos