Closed Bug 1198013 Opened 5 years ago Closed 3 years ago
Allow multiple template calls that append to a Hierarchical
59 bytes, text/x-review-board-request
In bug 912121, I'll soon land a DevToolsModules template Mike helped me construct in bug 1190024: @template def DevToolsModules(*modules): base = EXTRA_JS_MODULES for dir in RELATIVEDIR.split('/'): base = base[dir] base += [m for m in modules] However, it's currently not possible to call the template twice in the same moz.build file (in case of conditional compilation, etc.) Only one case of the in DevTools for now, so I can work around it by conditionally building a single list. Eventually, it would be nice to fix this so that the template can be invoked more like other moz.build rules, which multiple invocations generally work as expected. Mike explains the root cause: (Mike Hommey [:glandium] from bug 1190024 comment #7) > There are two things that prevent that from working: > - When merging the evaluation of a template back in the parent moz.build > context, we handle different types in different ways: > > http://hg.mozilla.org/mozilla-central/file/095988abdc56/python/mozbuild/ > mozbuild/frontend/reader.py#l405 > but EXTRA_JS_MODULES is a HierarchicalStringList, and that's the only list > type in mozbuild.util that doesn't inherit from list, so isinstance(value, > list) doesn't match it. > - Even after replacing with isinstance(value, (list, > HierarchicalStringList)), that still doesn't work, because > HierarchicalStringList doesn't support +='ing another > HierarchicalStringList. It only accepts lists: > > http://hg.mozilla.org/mozilla-central/file/095988abdc56/python/mozbuild/ > mozbuild/util.py#l576
5 years ago
Depends on: 912121
It appears this was fixed by :glandium as part of bug 1229241: https://hg.mozilla.org/mozilla-central/rev/63bfa84f09aa :mikeratcliffe noticed that using multiple DevToolsModules calls had started working. I'll use this bug to update the docs that currently say you can't do that.
Assignee: nobody → jryans
Status: NEW → ASSIGNED
Depends on: 1229241
Comment on attachment 8925095 [details] Bug 1198013 - DevToolsModules now safe to call multiple times. https://reviewboard.mozilla.org/r/196326/#review201684 Perfect, r+
Attachment #8925095 - Flags: review?(mratcliffe) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/f541c03beb5f DevToolsModules now safe to call multiple times. r=miker
You need to log in before you can comment on or make changes to this bug.