Closed
Bug 794162
Opened 12 years ago
Closed 11 years ago
Add a script which generates a proper .clang_complete file based on the mozconfig in use
Categories
(Firefox Build System :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla21
People
(Reporter: ehsan.akhgari, Assigned: gps)
Details
Attachments
(1 file, 1 obsolete file)
2.36 KB,
patch
|
ehsan.akhgari
:
review+
|
Details | Diff | Splinter Review |
I have written a script which helps people generate a proper .clang_complete file in the top of their source directory based on the mozconfig they have in use, which I believe is useful enough for us to have in the tree.
Reporter | ||
Comment 1•12 years ago
|
||
Assignee | ||
Comment 2•12 years ago
|
||
We should just refactor the mozconfig parsing code to emit JSON of the results. Data centric alleviates the need for alternate "execution contexts" like this script provides.
Assignee | ||
Comment 3•12 years ago
|
||
And by "mozconfig parsing code" I obviously mean the shell environment from which mozconfigs execute.
Comment 4•12 years ago
|
||
Comment on attachment 664573 [details] [diff] [review] Patch (v1) Review of attachment 664573 [details] [diff] [review]: ----------------------------------------------------------------- ::: build/generate_clang_complete.sh @@ +44,5 @@ > + . "$FOUND_MOZCONFIG" > +fi > + > +if [ -z "$MOZ_OBJDIR" ]; then > + echo 'Your .mozconfig does not define MOZ_OBJDIR' A .mozconfig doesn't have to define MOZ_OBJDIR. And MOZ_OBJDIR may contain make variables (for instance, my .mozconfig defines it with $(CONFIG_GUESS)).
Assignee | ||
Comment 5•12 years ago
|
||
FWIW, I have code in bug 780329 nearing landing that "parses" mozconfig files and exposes the results to Python. I'm sensitive to wheel reinvention. My code in that bug did it. The patch here does it. There's obviously room for consolidation. Presumably the code in bug 780329 is the future (as client.mk dies). So, I'd prefer to land something there that would work for this bug. Also, this bug should probably be refactored as a mach sub-command (bug 751795). I'm *really* close to landing that. Just need to fix Mike Hommey's review feedback w.r.t. coincidentally mozconfig integration!
Comment on attachment 664573 [details] [diff] [review] Patch (v1) gps seems to want this one!
Attachment #664573 -
Flags: review?(khuey) → review?(gps)
Reporter | ||
Comment 7•12 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #4) > ::: build/generate_clang_complete.sh > @@ +44,5 @@ > > + . "$FOUND_MOZCONFIG" > > +fi > > + > > +if [ -z "$MOZ_OBJDIR" ]; then > > + echo 'Your .mozconfig does not define MOZ_OBJDIR' > > A .mozconfig doesn't have to define MOZ_OBJDIR. And MOZ_OBJDIR may contain > make variables (for instance, my .mozconfig defines it with $(CONFIG_GUESS)). Shoot! (In reply to Gregory Szorc [:gps] from comment #5) > FWIW, I have code in bug 780329 nearing landing that "parses" mozconfig > files and exposes the results to Python. I'm sensitive to wheel reinvention. > My code in that bug did it. The patch here does it. There's obviously room > for consolidation. Presumably the code in bug 780329 is the future (as > client.mk dies). So, I'd prefer to land something there that would work for > this bug. That sounds fine to me, as long as the mozconfig parsing code is something that I can use through a simple API, and that it handles the case that glandium is talking about above. > Also, this bug should probably be refactored as a mach sub-command > (bug 751795). I'm *really* close to landing that. Just need to fix Mike > Hommey's review feedback w.r.t. coincidentally mozconfig integration! How does one create mach sub-commands? I'm willing to do that, but I don't know much python so I need some docs to rescue. :-)
Assignee | ||
Comment 8•12 years ago
|
||
(In reply to Ehsan Akhgari [:ehsan] from comment #7) > How does one create mach sub-commands? I'm willing to do that, but I don't > know much python so I need some docs to rescue. :-) See https://hg.mozilla.org/mozilla-central/file/default/python/mach/README.rst and the various Python modules in python/mach/mach. e.g. settings.py or testing.py.
Assignee | ||
Comment 9•12 years ago
|
||
Comment on attachment 664573 [details] [diff] [review] Patch (v1) Ehsan: With your permission, I'd like to refactor this into a mach command. Some of the work in bug 808357 will add a Python API to "parse" mozconfig files. And, since the output of |make showbuild| is redundant with the data already in config.status (a Python file!), this should turn into about a dozen lines of Python I think. I think this approach will be simpler, easier to maintain, and more discoverable.
Attachment #664573 -
Flags: review?(gps)
Reporter | ||
Comment 10•12 years ago
|
||
Sounds good to me, specially if you're going to do the work. ;-)
Reporter | ||
Updated•12 years ago
|
Assignee: ehsan → gps
Assignee | ||
Comment 11•12 years ago
|
||
I think I ported everything from the shell script. Do you think we should just write out .clang_complete or should we have the user do shell redirects?
Attachment #664573 -
Attachment is obsolete: true
Attachment #688631 -
Flags: review?(ehsan)
Reporter | ||
Comment 12•12 years ago
|
||
We should just write it down, I think.
Reporter | ||
Comment 13•12 years ago
|
||
Comment on attachment 688631 [details] [diff] [review] Mach command to generate a .clang_complete file, v1 Review of attachment 688631 [details] [diff] [review]: ----------------------------------------------------------------- Looks good overall, but can you please attach a .clang_complete file that is generated by this? Thanks! ::: python/mozbuild/mozbuild/mach_commands.py @@ +171,5 @@ > + > + print_from_variable('COMPILE_CXXFLAGS') > + > + print('-I%s/ipc/chromium/src' % self.topsrcdir) > + print('-I%s/ipc/glu' % self.topsrcdir) typo here.
Reporter | ||
Comment 14•12 years ago
|
||
Comment on attachment 688631 [details] [diff] [review] Mach command to generate a .clang_complete file, v1 Clearing the request for now.
Attachment #688631 -
Flags: review?(ehsan)
Assignee | ||
Comment 15•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b546bd987ed4
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
Reporter | ||
Updated•11 years ago
|
Attachment #688631 -
Flags: review+
Comment 16•11 years ago
|
||
Is this script better than the instructions in https://wiki.mozilla.org/Clang_complete_in_mozilla (found with Google)? Should they be updated?
Comment 17•11 years ago
|
||
The plan is to land and finish bug 892973 which gives the best results overall.
Updated•6 years ago
|
Product: Core → Firefox Build System
You need to log in
before you can comment on or make changes to this bug.
Description
•