@ncalexander

Firefox "artifact builds" for Mac OS X

Thu 31 December 2015 / tagged: firefox, desktop, build system, artifacts, mac os x

I’m thrilled to announce support for Mac OS X artifact builds. Artifact builds trade expensive compile times for (variable) download times and some restrictions on what parts of the Firefox codebase can be modified. For Mac OS X, the downloaded binaries are about 100Mb, which might take just a minute to fetch. The hard restriction is that only the non-compiled parts of the browser can be developed, which means that artifact builds are really only useful for front-end developers. The Firefox for Android front-end team has been using artifact builds with great success for almost a year (see Build Fennec frontend fast with mach artifact! and my other posts on this blog).

I intend to update the MDN documentation and the build bootstrapper (see Bug 1221200) as soon as I can, but in the meantime, here’s a quick start guide.

Quick start

You’ll need to have run mach mercurial-setup and installed the mozext extension (see Bug 1234912). In your mozconfig file, add the lines

ac_add_options --enable-artifact-builds
mk_add_options MOZ_OBJDIR=./objdir-artifact

You’ll want to run mach configure again to make sure the change is recognized. This sets --disable-compile-environment and opts you in to running mach artifact install automatically.

After this, you should find that mach build downloads and installs the required artifact binaries automatically, based off your current Mercurial commit. To test, just try

./mach build && ./mach run

After the initial build, incremental mach build DIR should also maintain the state of the artifact binaries — even across hg commit and hg pull && hg update.

You should find that mach build faster works as expected, and that the occasional mach build browser/app/repackage is required.

Restrictions

Oh, so many. Here are some of the major ones:

  • Right now, artifact builds are only available to developers working on Mac OS X Desktop builds (Bug 1207890) and Firefox for Android builds. I expect Linux support to follow shortly (tracked in Bug 1236110). Windows support is urgently needed but I don’t yet know how much work it will be (tracked in Bug 1236111).
  • Right now, artifact builds are only available to Mercurial users. There’s no hard technical reason they can’t be made available to git users, and I expect it to happen eventually, but it’s non-trivial and really needs a dedicated git-using engineer to scratch her own itch. This is tracked by Bug 1234913.
  • Artifact builds don’t allow developing the C++ source code. As soon as you need to change a compiled component, you’ll need a regular build. Unfortunately, things like Telemetry are compiled (but see tickets like Bug 1206117).
  • Artifact builds are somewhat heuristic, in that the downloaded binary artifacts may not correspond to your actual source tree perfectly. That is, we’re not hashing the inputs and mapping to a known binary: we’re choosing binaries from likely candidates based on your version control status and pushes to Mozilla automation. Binary mismatches for Fennec builds are rare (but do exist, see, for example, Bug 1222636), but I expect them to be much more common for Desktop builds. Determining if an error is due to an artifact build is a black art. We’ll all have to learn what the symptoms look like (often, binary component UUID mismatches) and how to minimize them.
  • Support for running tests is limited. I don’t work on Desktop builds myself, so I haven’t really explored this. I expect a little work will be needed to get xpcshell tests running, since we’ll need to arrange for a downloaded xpcshell binary to get to the right place at the right time. Please file a bug if some test suite doesn’t work so that we can investigate.

Troubleshooting

The command that installs binaries is mach artifact install. Start by understanding what happens when you run

./mach artifact install --verbose

See the troubleshooting section of my older blog post for more. As a last resort, the Firefox for Android MDN documentation may be helpful.

Conclusion

Thanks to Gregory Szorc (@indygreg) and Mike Hommey for reviewing this work. Many thanks to Mark Finkle (@mfinkle) for providing paid time for me to pursue this line of work and to the entire Firefox for Android team for being willing guinea pigs.

There’s a huge amount of work to be done here, and I’ve tried to include Bugzilla ticket links so that interested folks can contribute or just follow along. Dan Minor will be picking up some of this artifact build work in the first quarter of 2016.

Mozilla is always making things better for the front-end teams and our valuable contributors! Get involved with code contribution at Mozilla!

Discussion is best conducted on the dev-builds mailing list and I’m nalexander on irc.mozilla.org/#developers and @ncalexander on Twitter.

Changes

  • Thu 31 December 2015: Initial version.

Notes

Nick Alexander

About Nick Alexander

Mathematician. Mozillian. Runner. Master of Disguise.