Ability to define multiple patterns in Files contexts

RESOLVED FIXED in Firefox 64

Status

defect
RESOLVED FIXED
4 years ago
10 months ago

People

(Reporter: gps, Assigned: tcampbell)

Tracking

unspecified
mozilla64
Dependency tree / graph

Firefox Tracking Flags

(firefox64 fixed)

Details

Attachments

(1 attachment)

Currently, Files contexts accept a single pattern as their argument. There are places where we want to cherry-pick individual files. I think it makes sense to support passing multiple files to Files.__init__.
So, one thing that I was thinking would be useful for templates is some magic around the syntax:

with Template(...), Template(...):
    stuff

such that two sub contexts are emitted, and stuff is applied to both. This would involve a proxy context that dispatches to both sub contexts.

The problem is that it's hard to distinguish that form and:

with Template(...):
    with Template(...):
        stuff

Maybe looking at frame data?
I'd rather not depart too far from the Python language because it breaks understanding.

For this feature, I was thinking of using either *args or detecting an iterable as the argument and emitting multiple Files instances (rather than a single Files that has multiple patterns).

If you want to have a go at using the multiple context manager syntax and magic, I won't stop you. But I have a feeling people will want this feature soonish, which is why I'm inclined to go the easy route.
Immediate options:

with Files('{a,b}'):
with Files('a', 'b'):
with Files('a'), Files('b'):

I prefer the middle one. It still allows future extension possibilities:

with Files('a/**', 'b/**', exclude='*.js'):
Product: Core → Firefox Build System
Add support for |with Files('a/**', 'b/**')| in mozbuild config files.

MozReview-Commit-ID: IoM4qfEhXXc
Comment on attachment 9007357 [details]
Bug 1138579 - Support multiple Files patterns in moz.build

Gregory Szorc [:gps] has approved the revision.
Attachment #9007357 - Flags: review+
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/08f0bf17514d
Support multiple Files patterns in moz.build r=gps
Comment on attachment 9007357 [details]
Bug 1138579 - Support multiple Files patterns in moz.build

Fix other tests.
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=1f1d0db67e698acaa32cdfe8fb53f1eb37d76ae7
Flags: needinfo?(tcampbell)
Attachment #9007357 - Flags: review+ → review?(gps)
Comment on attachment 9007357 [details]
Bug 1138579 - Support multiple Files patterns in moz.build

Gregory Szorc [:gps] has approved the revision.
Attachment #9007357 - Flags: review+
Attachment #9007357 - Flags: review?(gps)
Pushed by tcampbell@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/3d2a3eb077ff
Support multiple Files patterns in moz.build r=gps
https://hg.mozilla.org/mozilla-central/rev/3d2a3eb077ff
Status: NEW → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.