I recently landed a new feature for the "mach" build tool [1]. You can now run mach from anywhere in the mozilla source tree.

To get started, add mach to your $PATH. You can do this by changing the PATH environment variable to include the mozilla source directory, or by copying the "mach" script from your source directory to a location like /usr/local/bin.

Then you can run mach commands from anywhere in your source directory, and you can use paths within your current directory. For example, if you are working on some devtools code you might run commands like:

  cd browser/devtools

  # Rebuild the code in browser/devtools/webconsole:
  mach build webconsole
  # Run browser-chrome tests from browser/devtools/webconsole/test:
  mach mochitest-browser webconsole/test

  # Most commands work the same no matter where you run them:
  mach clobber
  mach build   # Do a full rebuild
  mach package
  mach install

You can also run "mach" within an objdir. If you have multiple objdirs with different mozconfigs, mach automatically defaults to the mozconfig that built the current objdir. This means you can switch between configurations as easily as:

  cd obj-debug
  mach build
  mach xpcshell-test

  cd ../obj-optimized
  mach build
  mach xpcshell-test

(Note: the automatically-detected mozconfig is used as a default, but you can still override it by explicitly setting the MOZCONFIG environment variable.)

The "mach" script is now just a wrapper; it loads the actual mach code and configuration from whichever source directory you run it in. So you can add mach to your path once and it should work with any current or future mozilla-central directory. (For older trees, like the current aurora or beta repos, you still need to run mach the old way, using "./mach" in the top source directory.)

For development details, please see bugs 840588 and 840690 (but note that the feature changed a bit since those bugs were first filed). Huge thanks to gps and all the other people who helped in the design and implementation of this feature!

[1] https://developer.mozilla.org/en-US/docs/Developer_Guide/mach
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=840588
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=840690
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to