Allow multiple template calls that append to a HierarchicalStringList

RESOLVED FIXED in Firefox 58

Status

RESOLVED FIXED
3 years ago
8 months ago

People

(Reporter: jryans, Assigned: jryans)

Tracking

(Blocks: 2 bugs)

unspecified
mozilla58
Dependency tree / graph

Firefox Tracking Flags

(firefox58 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
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
(Assignee)

Updated

3 years ago
Depends on: 912121
(Assignee)

Comment 1

a year ago
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 hidden (mozreview-request)
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+

Comment 4

a year ago
Pushed by jryans@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/f541c03beb5f
DevToolsModules now safe to call multiple times. r=miker

Comment 5

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/f541c03beb5f
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
status-firefox58: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla58

Updated

8 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.