3339 - Packager behavior when resolving externals


The packager works well in standard addon scenarios, but with libraries / abstract modules it lacks a feature, in short:

The packager should honor the pkgmeta of externals.

The longer version and my arguments why this should be the case: First lets set up a scenario.

AddonX relies on LibA which in turn relies on LibB.

As it is today, AddonX will have to reference both LibA and LibB as externals in its pkgmeta, and ensure that they are loaded in the correct order in the TOC. This is a problem for a number of reasons.

First reason is that AddonX must know that LibA relies on LibB. While this is fairly simple in this very simple scenario, it can quickly get less clear if the chain of dependencies is more complex.

The second, and most important reason, is that if at some point LibB implements changes that require yet another library LibC, then the author of AddonX must realize this and update his addon to also reference LibC as an external. In other words adding a new dependency to LibB (or LibA) becomes a breaking change, and it shouldn't have to be.

So what I suggest is that AddonX would only need to reference LibA as external. Then when the packager processes the external reference, it retrieves LibA from the source location specified. It then looks for a pkgmeta, and if it finds it, it processes it and so forth until the chain ends, i.e. until it reaches an external that has no external refs.

So in the example scenario it looks in LibA's pkgmeta and finds LibB as an external, it gets it looks for a pkgmeta and finds that there is none (or that it contains no externals). LibB is then put in the libs folder of LibA and libA in the libs folder of AddonX, and the package is complete with all references.

When the time comes where LibA adds an additional external and LibB does the same, the author of AddonX is blissfully unaware since the packager handles all of this, and nothing breaks. Obviously circular references should be short circuited.

My last point is that the packager should read the pkgmeta in the folder specified in the exernal url. So a libary project could well have two pkgmetas. One in the root alongside the TOC, changelog etc. used for normal packages (mostly used for nolibs) users. And one in a subfolder containig all the actual libary code.

  • LibA
    • pkgmeta
    • toc
    • Code
      • liba.lua
      • pkgmeta

Addons using LibA would have an exernal url of <repo>/LibA/mainline/trunk/Code

I believe that was it, I hope you can see my point. I would be happy to assist in the development of this new feature.

User When Change
Torhal Jul 23, 2013 at 23:25 UTC Changed status from New to Declined
Geminior Jan 23, 2013 at 11:51 UTC Create

You must login to post a comment. Don't have an account? Register to get one!


Last updated
Jul 23, 2013
Jan 23, 2013
Declined - We decided not to take action on this ticket.
Enhancement - A change which is intended to better the project in some way
Medium - Normal priority.

Reported by

Possible assignees