1
0
mirror of https://github.com/golang/go synced 2024-11-23 11:30:06 -07:00
go/misc/windows/installer.wxs
Joe Poirier 984b4e381d misc/windows packager development intermediate check-in
The installer now: allows a user to select an alternative
install directory, it now adds a Go folder to the Programs
Menu, and it places two shortcuts on the user's desktop.
The Program Menu folder contains shortcuts to the uninstaller
and two batch files, go.bat and godoc.bat. The desktop
shortcuts also point to go.bat and godoc.bat.

go.bat sets the Go environment, including Path, and spawns a
Window's shell. godoc.bat starts the godoc server at
localhost:6060 then spawns a browser window pointing to the
document server.

Setting the environment temporarily and spawning a shell, via
go.bat, should be safer than messing with the system's environment
and it makes the user experience a bit more streamlined.

The packager does work in its current state but it still needs
some polishing. And yes, the plan is to add a dialogue to allow
the user to decline the desktop shortcuts.

R=rsc, alex.brainman, tjyang2001
CC=golang-dev
https://golang.org/cl/5399042
2011-11-17 17:54:06 -06:00

153 lines
4.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<!--
# Copyright 2010 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-->
<?if $(var.Arch) = 386 ?>
<?define SYSFOLDER=SystemFolder ?>
<?define Win64=no ?>
<?else?>
<?define SYSFOLDER=System64Folder ?>
<?define Win64=yes ?>
<?endif?>
<Product
Id="FF5B30B2-08C2-11E1-85A2-6ACA4824019B"
Name="The Go Programming Language $(var.Arch) $(var.Version)"
Language="1033"
Version="0.0.0.0"
Manufacturer="http://golang.org"
UpgradeCode="1C3114EA-08C3-11E1-9095-7FCA4824019B" >
<!-- Version="$(var.Version)" TODO: Version requires X.X.X.X format -->
<Package
Id='*' Keywords='Installer'
Description="The Go Programming Language Installer"
Comments="The Go programming language is an open source project to make programmers more productive."
InstallerVersion="300"
Compressed="yes"
Manufacturer="http://golang.org"
InstallScope="perMachine"
Languages="1033" />
<!-- Platform="x86 or x64" -->
<!--
<Upgrade Id="">
<UpgradeVersion
IncludeMaximum="yes"
IncludeMinimum="yes"
Language="1033"
Maximum=""
Minimum=""
Property="" />
</Upgrade>
-->
<Media Id='1' Cabinet="go.cab" EmbedCab="yes" CompressionLevel="high" />
<Condition Message="Windows 2000 or greater required."> VersionNT >= 500</Condition>
<SetDirectory Id="INSTALLDIRROOT" Value="C:\"/>
<CustomAction
Id="SetApplicationRootDirectory"
Property="ARPINSTALLLOCATION"
Value="[INSTALLDIR]" />
<!-- Define the directory structure and environment variables -->
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="INSTALLDIRROOT">
<Directory Id="INSTALLDIR" Name="Go"/>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="GoProgramShortcutsDir" Name="Go Programming"/>
</Directory>
<Directory Id="DesktopFolder" Name="Desktop"/>
</Directory>
<!-- Programs Menu & Desktop Shortcuts -->
<DirectoryRef Id="GoProgramShortcutsDir">
<Component Id="Component_GoShortCuts" Guid="f5fbfb5e-6c5c-423b-9298-21b0e3c98f4b">
<Shortcut
Id="GoEnvStartMenuShortcut"
Name="GoEnv"
Description="Sets the Go environment and spawns a shell window"
Target="[INSTALLDIR]goenv.bat" />
<Shortcut
Id="GoEnvDesktopShortcut"
Directory="DesktopFolder"
Name="GoEnv"
Description="Sets the Go environment and spawns a shell window"
Target="[INSTALLDIR]goenv.bat" />
<Shortcut
Id="GoDocServerStartMenuShortcut"
Name="GoDocServer"
Description="Starts the godoc server on localhost:6060"
Target="[INSTALLDIR]godocserver.bat" />
<Shortcut
Id="GoDocServerDesktopShortcut"
Directory="DesktopFolder"
Name="GoDocServer"
Description="Starts the godoc server on localhost:6060"
Target="[INSTALLDIR]godocserver.bat" />
<Shortcut
Id="UninstallShortcut"
Name="Uninstall Go"
Description="Uninstalls Go and all of its components"
Target="[$(var.SYSFOLDER)]msiexec.exe"
Arguments="/x [ProductCode]" />
<RemoveFolder
Id="GoProgramShortcutsDir"
On="uninstall" />
<RegistryValue
Root="HKCU"
Key="Software\Microsoft\TheGoProgrammingLanguage"
Name="installed"
Type="integer"
Value="1"
KeyPath="yes" />
</Component>
</DirectoryRef>
<!-- Components -->
<DirectoryRef Id="INSTALLDIR">
<Component Id="Component_GoDocServerBAT" Guid="c40ea60a-4290-4a91-864d-e1d8eb5cf693">
<File
Id="FILE_GoDocServerBat"
Source="godocserver.bat"
KeyPath="yes" />
</Component>
<Component Id="Component_GoEnvBAT" Guid="ee4587d3-fba3-47f9-b45e-ec9ca9c8a9c3">
<File
Id="FILE_GoEnvBat"
Source="goenv.bat"
KeyPath="yes" />
</Component>
</DirectoryRef>
<!-- Install the files -->
<Feature
Id="GoTools"
Title="Go"
Level="1">
<ComponentGroupRef Id="AppFiles" />
<ComponentRef Id="Component_GoDocServerBAT" />
<ComponentRef Id="Component_GoEnvBAT" />
<ComponentRef Id="Component_GoShortCuts" />
</Feature>
<!-- Update the environment -->
<InstallExecuteSequence>
<Custom
Action="SetApplicationRootDirectory"
Before="InstallFinalize" />
</InstallExecuteSequence>
<!-- Include the user interface -->
<WixVariable Id="WixUILicenseRtf" Value="LICENSE" />
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
</Product>
</Wix>