Closed Bug 1198013 Opened 9 years ago Closed 7 years ago

Allow multiple template calls that append to a HierarchicalStringList

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(firefox58 fixed)

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: jryans, Assigned: jryans)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

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
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 jryans@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f541c03beb5f
DevToolsModules now safe to call multiple times. r=miker
https://hg.mozilla.org/mozilla-central/rev/f541c03beb5f
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: