Closed Bug 1686256 Opened 3 years ago Closed 3 years ago

Introduce mach.bat or mach.ps1 for Windows to allow build on the default shell

Categories

(Firefox Build System :: General, enhancement)

enhancement

Tracking

(firefox86 fixed)

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: saschanaz, Assigned: saschanaz)

References

Details

Attachments

(1 file, 1 obsolete file)

This should make the build process more user friendly on Windows.

I tried this a bit and the main blocker was that bash in mozillabuild always opens at the home directory regardless of current working directory.

A couple questions for you:

  • There's many implicit-ish dependencies on the MozillaBuild runtime environment within the scripts in-tree. Making mach and its subcommands work on Windows without mozilla-build would be a larger project.
  • There's a fair amount of logic around choosing the right Python, etc, that goes on in the top-level ./mach file. It's port-able, but there'll be a maintenance cost.
  • MozillaBuild will still be an installation requirement, because we depend on Python/clang/all sorts of tools bundled within MozillaBuild.
  • Since this wouldn't obsolete MozillaBuild, what advantages would we get from introducing this Windows-specific mach entrypoint?
Flags: needinfo?(krosylight)

Oops, I skipped too much details.

What I propose is to add a wrapper that:

  1. Find and run bash from MozillaBuild directory, keeping the current working directory
  2. Run mach
  3. Exit

So no, it shouldn't add any significant maintenance cost as theoretically the wrapper should be nearly frozen.

Flags: needinfo?(krosylight)

Oh, I see! Interesting :)
FWIW, in addition to just being a bundle of pinned dependencies, MozillaBuild also does some environment setup prior to invoking bash - see start-shell.bat.

However, if all of that "setup" logic was moved from start-shell.bat to instead be part of every bash shell's init (the equivalent to /etc/profile, or something like that?) then this could be viable! There'd be a bit of effort getting a new MozillaBuild release out and having users update to it, fwiw.

(In reply to Mitchell Hentges [:mhentges] 🦀 from comment #3)

However, if all of that "setup" logic was moved from start-shell.bat to instead be part of every bash shell's init (the equivalent to /etc/profile, or something like that?) then this could be viable! There'd be a bit of effort getting a new MozillaBuild release out and having users update to it, fwiw.

Alternatively the wrapper can do that instead as it's not too long. Doing so won't require updating MozillaBuild and thus provide more smooth migration experience.

True, but then we'd have the additional concern of ensuring that start-shell.bat and mach.bat are consistently in-sync.

What I initially thought was just to call start-shell.bat from the wrapper, but failed to do that because it wasn't clear how to pass mach path properly. Maybe we could somehow modify start-shell.bat to allow that, if needed.

Assignee: nobody → krosylight

This allows running mach on PowerShell for better Windows build experience. It currently has a limitation that blocks any whitespace use but such use should be rare enough.

Attachment #9196955 - Attachment description: Bug 1686256 - Add Windows friendly wrapper for mach r=mhentges → Bug 1686256 - Add Windows friendly wrapper for mach
Depends on: 1686798
Depends on: 1686826

Comment on attachment 9197513 [details]
Bug 1686256 - Fire pagetitlechanged when initialized with an empty string

Revision D102054 was moved to bug 1686194. Setting attachment 9197513 [details] to obsolete.

Attachment #9197513 - Attachment is obsolete: true
Pushed by krosylight@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/934c3c3c4a3f
Add Windows friendly wrapper for mach r=mhentges,firefox-build-system-reviewers,dmajor
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Regressions: 1687640
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: