Skip to content

Windows: add script to build a .msi package - #8579

Closed
laszlocsomor wants to merge 6 commits into
bazelbuild:masterfrom
laszlocsomor:installer-script
Closed

laszlocsomor wants to merge 6 commits into
bazelbuild:masterfrom
laszlocsomor:installer-script

Conversation

@laszlocsomor

Copy link
Copy Markdown
Contributor

Also add a test, though there's no build rule to
wrap it yet.

The generated installer:

  • is a standard .msi installer that users are
    familiar with
  • installs Bazel at a short and safe path (no
    space in path)
  • updates the PATH envvar
  • handles uninstall, upgrading, parallel installs:
    backwards-compatible versions can be upgraded
    (but not downgraded), while incompatible
    versions may be installed side by side
    (see guids.txt comments)

Example use:

c:\src\bazel>powershell scripts\packages\wix\make_msi.ps1 ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.exe
(...)
INFO[make_msi_lib.ps1 11:41:33] Creating wixobj
INFO[make_msi_lib.ps1 11:41:33] Creating msi
INFO[make_msi_lib.ps1 11:41:42] Done: ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.msi

c:\src\bazel>start ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.msi

TODO(@laszlocsomor) before we can use this:

  • figure out if we should bundle vc_redist with
    the Bazel installer
  • figure out the UpgradeCode for such a combined
    bundle

Also add a test, though there's no build rule to
wrap it yet.

The generated installer:
- is a standard .msi installer that users are
  familiar with
- installs Bazel at a short and safe path (no
  space in path)
- updates the PATH envvar
- handles upgrades and parallel installs:
  backwards-compatible versions can be upgraded
  (but not downgraded), while incompatible
  versions may be installed side by side
  (see guids.txt comments)

Example use:

```
c:\src\bazel>powershell scripts\packages\wix\make_msi.ps1 ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.exe
(...)
INFO[make_msi_lib.ps1 11:41:33] Creating wixobj
INFO[make_msi_lib.ps1 11:41:33] Creating msi
INFO[make_msi_lib.ps1 11:41:42] Done: ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.msi

c:\src\bazel>start ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.msi
```

TODO(@laszlocsomor) before we can use this:
- figure out if we should bundle vc_redist with
  the Bazel installer
- figure out the UpgradeCode for such a combined
  bundle
@laszlocsomor

laszlocsomor commented Jun 7, 2019 •

Copy link
Copy Markdown
Contributor Author

Installer

bazel-setup-1
bazel-setup-2
bazel-setup-3

Add or remove programs

bazel-setup-4

PATH envvar updated automatically (also on uninstall)

bazel-setup-5

@laszlocsomor laszlocsomor changed the title Windows: add script to build a .msi package WIP: Windows: add script to build a .msi package Jun 7, 2019
@laszlocsomor laszlocsomor changed the title WIP: Windows: add script to build a .msi package Windows: add script to build a .msi package Jun 7, 2019
This way the most recently installed Bazel version
will be the first on the PATH.

@meteorcloudy meteorcloudy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this!

Comment thread scripts/packages/wix/make_msi_lib.ps1 Resolved
@meteorcloudy

Copy link
Copy Markdown
Member

Awesome! Maybe this installer could help us installing extra dependencies of Bazel. For example, any dependencies of the future Windows sandbox.
FYI @rongjiecomputer

@aiuto

aiuto commented Jun 7, 2019

Copy link
Copy Markdown

You left a very thorny TODO

  • figure out if we should bundle vc_redist with the Bazel installer
  • figure out the UpgradeCode for such a combined bundle

I think the answer is no. Do not bundle it IF you want to a .MSI installer built with Wix. When you try to get two things in the MSI it leads to odd rollback cases if both do not cleanly install/update/delete together. An alternative to bundling is to say we require vc_redist and let MSI decide where to get it.\

Another thing to consider is if you want to write the script to run Wix in powershell or Python. We might find it easier to maintain the script in Python, since only a few people know powershell.

You put this in scripts/packages/wix, but is wix really the important thing in the path? I think scripts/packages/msi would be the clearer meaning.

@aiuto aiuto left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great start at a Windows installer. I have some concerns, but they should not get in the way of starting with this and trying to see how it goes.

Comment thread scripts/packages/wix/make_msi_lib.ps1 Resolved
@jin jin added the area-Windows Windows-specific issues and feature requests label Jun 10, 2019
@laszlocsomor

Copy link
Copy Markdown
Contributor Author

Thanks for your insights @aiuto !

Re: bundling vc_redist: I don't think we need to, for now. Most Bazel users will probably install VC++ which installs these DLLs. Arguably not everyone will, sure, but if people complain about this requirement then we can revisit this question.

Re: UpgradeCode: if we don't bundle vc_redist, then this is moot.

Re: package path: good idea, I'll rename the "wix" directory to "msi".

Re: python: I prefer to stay with PowerShell. I agree more Bazel core developers know Python than PS, but:

  • PS is a better tool for this job (calling binaries, generating GUIDs is just easier)
  • PS is native on Windows (we'd be fine with a Bash script if this were a Linux installer), and
  • PS is simple and well-documented, so maintenance shouldn't involve a steep learning curve. Writing this script took about 1.5 days, which involved learning PS.

@laszlocsomor

Copy link
Copy Markdown
Contributor Author

@aiuto : PTAL

@laszlocsomor

Copy link
Copy Markdown
Contributor Author

oh wait, you already approved, thanks :)

@meteorcloudy , does this LGTY?

@meteorcloudy meteorcloudy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@bazel-io bazel-io closed this in 400c2c7 Jun 24, 2019
@laszlocsomor
laszlocsomor deleted the installer-script branch June 24, 2019 13:27
siberex pushed a commit to siberex/bazel that referenced this pull request Jul 4, 2019
Also add a test, though there's no build rule to
wrap it yet.

The generated installer:
- is a standard .msi installer that users are
  familiar with
- installs Bazel at a short and safe path (no
  space in path)
- updates the PATH envvar
- handles uninstall, upgrading, parallel installs:
  backwards-compatible versions can be upgraded
  (but not downgraded), while incompatible
  versions may be installed side by side
  (see `guids.txt` comments)

Example use:

```
c:\src\bazel>powershell scripts\packages\msi\make_msi.ps1 ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.exe
(...)
INFO[make_msi_lib.ps1 11:41:33] Creating wixobj
INFO[make_msi_lib.ps1 11:41:33] Creating msi
INFO[make_msi_lib.ps1 11:41:42] Done: ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.msi

c:\src\bazel>start ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.msi
```

TODO(@laszlocsomor) before we can use this:
- figure out if we should bundle vc_redist with
  the Bazel installer
- figure out the UpgradeCode for such a combined
  bundle

Closes bazelbuild#8579.

PiperOrigin-RevId: 254744890
irengrig pushed a commit to irengrig/bazel that referenced this pull request Jul 15, 2019
Also add a test, though there's no build rule to
wrap it yet.

The generated installer:
- is a standard .msi installer that users are
  familiar with
- installs Bazel at a short and safe path (no
  space in path)
- updates the PATH envvar
- handles uninstall, upgrading, parallel installs:
  backwards-compatible versions can be upgraded
  (but not downgraded), while incompatible
  versions may be installed side by side
  (see `guids.txt` comments)

Example use:

```
c:\src\bazel>powershell scripts\packages\msi\make_msi.ps1 ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.exe
(...)
INFO[make_msi_lib.ps1 11:41:33] Creating wixobj
INFO[make_msi_lib.ps1 11:41:33] Creating msi
INFO[make_msi_lib.ps1 11:41:42] Done: ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.msi

c:\src\bazel>start ..\bazel-releases\0.26.1\bazel-0.26.1-windows-x86_64.msi
```

TODO(@laszlocsomor) before we can use this:
- figure out if we should bundle vc_redist with
  the Bazel installer
- figure out the UpgradeCode for such a combined
  bundle

Closes bazelbuild#8579.

PiperOrigin-RevId: 254744890
@philwo philwo added the team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website label Jun 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Windows Windows-specific issues and feature requests cla: yes team-OSS Issues for the Bazel OSS team: installation, release processBazel packaging, website

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants