Closed Bug 912197 Opened 11 years ago Closed 11 years ago

Move WebIDL binding definitions to moz.build

Categories

(Firefox Build System :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla26

People

(Reporter: gps, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-needed)

Attachments

(5 files, 1 obsolete file)

WebIDL binding files are currently defined in dom/webidl/WebIDL.mk. We should move the definition of dom bindings to moz.build so we can easily extract the set of relevant files (for use in install manifests, etc).

This is probably low priority. Just wanted to have a bug on file in case someone wants to tackle it.
We decided we were just going to have a high-level representation in moz.build, like WEBIDL_SOURCES, and have all the logic in the backend, right?
That's basically all WebIDL.mk has right now: a list of IDL files, and a second list of preprocessable IDL files.  Both possibly with #ifdefs.
WEBIDL_SOURCES - a list - (or equivalent) should be all that is needed in moz.build files. And, I'm even fine with the logic for "build the WebIDL files" to live in a make file forever. Maybe we move the logic from dom/bindings/Makefile to config/makefiles or something. But WebIDL generation is wonky and unless some larger build system project warrants us moving away from the existing make rules, I see no reason for us to ditch them. After all, we should be able to tell Tup "build WebIDL files by running |make -C webidl|, right?
Blocks: 907789
Little pieces are easier to review, right?  Simple classes first.
Attachment #800182 - Flags: review?(gps)
Bikeshedding on the variable names welcome.  I made WEBIDL_FILES a |list|
because sorting it according to Python's rules was getting on my nerves.
Attachment #800183 - Flags: review?(gps)
Another simple piece.
Attachment #800184 - Flags: review?(gps)
I kept the variable names the same in the generated makefile as the ones WebIDL.mk
uses, so that the next part wouldn't be cluttered.  Don't know if we have a policy
for this or not...
Attachment #800186 - Flags: review?(gps)
The final piece of the puzzle.
Attachment #800187 - Flags: review?(khuey)
Knew I was going to screw this up.  How about this slightly more complete patch?
Attachment #800187 - Attachment is obsolete: true
Attachment #800187 - Flags: review?(khuey)
Attachment #800195 - Flags: review?(khuey)
Comment on attachment 800183 [details] [diff] [review]
part 2 - add WebIDL variables to the sandbox

Review of attachment 800183 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozbuild/frontend/sandbox_symbols.py
@@ +388,5 @@
>  
>          These are .ipdl files that will be parsed and converted to .cpp files.
>          """),
>  
> +    'WEBIDL_FILES': (list, list, [],

StrictOrderingOnAppendList for the first
Comment on attachment 800182 [details] [diff] [review]
part 1 - add classes for WebIDL source files

Review of attachment 800182 [details] [diff] [review]:
-----------------------------------------------------------------

This looks good. Although I'm curious how all the logic will hook up. We typically do single patches for adding things to the frontend to make this easier to follow.

Nit: Some style guidelines want you to use 2 lines between classes. If you install my Mercurial extension from https://hg.mozilla.org/users/gszorc_mozilla.com/hgext-gecko-dev, it will automatically apply Python style checking as you qref patches and alert you of style violations. It's even smart enough to only report on the lines your patch has changed!
Attachment #800182 - Flags: review?(gps) → review+
Comment on attachment 800183 [details] [diff] [review]
part 2 - add WebIDL variables to the sandbox

Review of attachment 800183 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozbuild/frontend/sandbox_symbols.py
@@ +402,5 @@
> +
> +    'GENERATED_WEBIDL_FILES': (StrictOrderingOnAppendList, list, [],
> +         """Generated WebIDL source files.
> +
> +         These will be generated from some other files."""),

We'll eventually need the "how they are generated" bit to be defined in moz.build. But we can punt this to a followup bug.
Attachment #800183 - Flags: review?(gps) → review+
Comment on attachment 800184 [details] [diff] [review]
part 3 - emit WebIDL objects during traversal

Review of attachment 800184 [details] [diff] [review]:
-----------------------------------------------------------------

::: python/mozbuild/mozbuild/frontend/emitter.py
@@ +23,5 @@
>      XpcshellManifests,
> +    WebIDLFile,
> +    TestWebIDLFile,
> +    PreprocessedWebIDLFile,
> +    GeneratedWebIDLFile,

Nit: Sort.
Attachment #800184 - Flags: review?(gps) → review+
Comment on attachment 800186 [details] [diff] [review]
part 4 - write out lists of WebIDL source files for dom/bindings/

Review of attachment 800186 [details] [diff] [review]:
-----------------------------------------------------------------

Normally I'd ask for tests. But this is only used by a very small part of the build system and it would be pretty obvious if it stopped working. So I'm inclined to let the tests slide. Don't let me discourage you from writing them, however.

::: python/mozbuild/mozbuild/backend/recursivemake.py
@@ +29,5 @@
>      XpcshellManifests,
> +    WebIDLFile,
> +    TestWebIDLFile,
> +    PreprocessedWebIDLFile,
> +    GeneratedWebIDLFile,

Nit: sort

@@ +327,5 @@
> +            webidls.write('test_webidl_files += %s\n' % os.path.basename(webidl))
> +        for webidl in sorted(self._generated_webidl_sources):
> +            webidls.write('generated_webidl_files += %s\n' % os.path.basename(webidl))
> +        for webidl in sorted(self._preprocessed_webidl_sources):
> +            webidls.write('preprocessed_webidl_files += %s\n' % os.path.basename(webidl))

I'd just write these out on a single line. If nothing else, it's less work for the make parser and for variable evaluation, which profiling has shown is the bit slowing pymake down.
Attachment #800186 - Flags: review?(gps) → review+
Comment on attachment 800195 [details] [diff] [review]
part 5 - move WebIDL.mk over to moz.build

Review of attachment 800195 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/moz.build
@@ +71,5 @@
>      'camera',
>      'audiochannel',
>      'promise',
> +    'wappush',
> +    'webidl'

This remind me: we need a primitive for evaluating a moz.build in the context of a directory without necessarily adding it to directory traversal. I'll file a bug.
Attachment #800195 - Flags: feedback+
Something else I forgot: we'll want to add the destined-for-dist/include .h files to self._install_manifests['dist_include']. This will cause the header files to be tracked by the install manifest which will in turn prevent them from being deleted at the top of the build. You'll want to pretty much copy the code in _handle_idl_manager. Once things are in the install manifest, the webidl processing can generate the headers directly into dist/include, saving an extra file copy/install step and hopefully making the build a little faster.

We can punt this to a followup if you'd like.
Blocks: 914704
Blocks: 925750
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: