wix

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	YesNoUnspecified = YesNoType(iota)
	Yes
	No
)

Supported YesNoType values

View Source
const (
	InstallUninstallUnspecified = InstallUninstallType(iota) // unspecified
	InstallOnly                                              // install-only action
	UninstallOnly                                            // uninstall-only action
	InstallAndUninstall                                      // action that occurs both when installing and uninstalling
)

Supported InstallUninstallType values

View Source
const XMLNamespace = "http://schemas.microsoft.com/wix/2006/wi"

XMLNamespace is the xml namespace wix compiler wants to see as a root node attribute

Variables

View Source
var ErrInvalidInstallUninstall = errors.New("invalid InstallUninstallType value")

ErrInvalidInstallUninstall is an error that indicates invalid InstallUninstallType value

View Source
var ErrInvalidYesNoValue = errors.New("invalid InstallUninstallType value")

ErrInvalidYesNoValue is an error that indicates invalid YesNoType value

Functions

func CheckFileHasContent

func CheckFileHasContent(fn string, buf []byte) bool

CheckFileHasContent returns true if the specified file exists and has content that matches buf.

func WriteFileIfChanged

func WriteFileIfChanged(fn string, buf []byte) error

WriteFileIfChanged writes buf into a file. Does not overwrite if the file already has the specified content. Uses 0666 permission if overwriting is neccessary.

Types

type Builder

type Builder struct {
	WorkDir       string
	WixBinaryPath string // path to wix binary dir
	WsxFile       string
	WixobjFile    string
	CandleArgs    []string
	LightArgs     []string
}

Builder produces MSI files

func NewBuilder

func NewBuilder(workdir string, fnbase string) *Builder

NewBuilder constructs a new builder instance

func (*Builder) AddCandleArgs

func (b *Builder) AddCandleArgs(args ...string)

AddCandleArgs can be used to add flags and arguments for Wix Candle

func (*Builder) AddLightArgs

func (b *Builder) AddLightArgs(args ...string)

AddLightArgs can be used to add flags and arguments for Wix Light

func (*Builder) Run

func (b *Builder) Run(w *Wix) error

Run builds the MSI package

type Component

type Component struct {
	ID              string            `xml:"Id,attr"`
	GUID            uuid.UUID         `xml:"Guid,attr"`
	Win64           YesNoType         `xml:",attr,omitempty"`
	Files           []*File           `xml:"File"`
	ServiceInstalls []*ServiceInstall `xml:"ServiceInstall"`
	ServiceControls []*ServiceControl `xml:"ServiceControl"`
	Environments    []*Environment    `xml:"Environment"`
}

Component implements Wix.Component element https://wixtoolset.org/documentation/manual/v3/xsd/wix/component.html

func (*Component) AddFile

func (c *Component) AddFile(id string, source string) *File

AddFile adds a child File element to a Component

func (*Component) AddServiceControl

func (c *Component) AddServiceControl(id string, svcname string) *ServiceControl

AddServiceControl adds a child ServiceControl element to a Component with Start/Stop/Remove preconfigured for most common service use cases

func (*Component) AddServiceInstall

func (c *Component) AddServiceInstall(id string, svcname string) *ServiceInstall

AddServiceInstall adds a child ServiceInstall element to a Component

type ComponentRef

type ComponentRef struct {
	ID      string    `xml:"Id,attr"`
	Primary YesNoType `xml:",attr,omitempty"`
}

ComponentRef implements Wix.ComponentRef element https://wixtoolset.org/documentation/manual/v3/xsd/wix/componentref.html

type Directory

type Directory struct {
	ID         string       `xml:"Id,attr"`
	Name       string       `xml:"Name,attr,omitempty"`
	Subdirs    []*Directory `xml:"Directory,omitempty"`
	Components []*Component `xml:"Component,omitempty"`
}

Directory implements Wix.Directory element https://wixtoolset.org/documentation/manual/v3/xsd/wix/directory.html

func (*Directory) AddComponent

func (d *Directory) AddComponent(id string, guid uuid.UUID, win64 bool) *Component

AddComponent adds a child Component element to a Directory

func (*Directory) AddProgramFilesSubdir

func (d *Directory) AddProgramFilesSubdir(win64 bool) *Directory

AddProgramFilesSubdir adds a Directory with "ProgramFilesFolder" or "ProgramFiles64Folder" id depending on win64 parameter

func (*Directory) AddSubdir

func (d *Directory) AddSubdir(id string, name string) *Directory

AddSubdir adds a child Directory element to a Directory

type Environment

type Environment struct {
	ID        string    `xml:"Id,attr"`
	Name      string    `xml:"Name,attr"`       // Name of the service
	Action    string    `xml:",attr,omitempty"` // create/set/remove
	Part      string    `xml:",attr,omitempty"` // all,first,last
	Permanent YesNoType `xml:",attr,omitempty"`
	System    YesNoType `xml:",attr,omitempty"`
	Value     string    `xml:",attr,omitempty"`
}

Environment implements Wix.Environment element https://wixtoolset.org/documentation/manual/v3/xsd/wix/environment.html

type Feature

type Feature struct {
	ID                    string          `xml:"Id,attr"`
	Level                 string          `xml:",attr"`
	Title                 string          `xml:",attr,omitempty"`
	Description           string          `xml:",attr,omitempty"`
	Display               string          `xml:",attr,omitempty"` // "collapse", "expand" or "hidden"
	ConfigurableDirectory string          `xml:",attr,omitempty"` // Specify the Id of a Directory that can be configured by the user at installation time, must be UPPERCASE
	ComponentRefs         []*ComponentRef `xml:"ComponentRef"`
	Subfeatures           []*Feature      `xml:"Subfeatures"`
}

Feature implements Wix.Feature element https://wixtoolset.org/documentation/manual/v3/xsd/wix/feature.html

func (*Feature) AddComponentRefs

func (f *Feature) AddComponentRefs(refnames ...string)

AddComponentRefs adds a ComponentRef child elements to a Feature

func (*Feature) AddSubfeature

func (f *Feature) AddSubfeature(id string, level string, title string, description string) *Feature

AddSubfeature adds a child Feature element to a Feature

type File

type File struct {
	ID       string    `xml:"Id,attr"`
	Source   string    `xml:",attr"`
	KeyPath  YesNoType `xml:",attr"`
	Checksum YesNoType `xml:",attr,omitempty"`
	Vital    YesNoType `xml:",attr,omitempty"`
}

File implements Wix.File element https://wixtoolset.org/documentation/manual/v3/xsd/wix/file.html

type InstallExecuteSequence

type InstallExecuteSequence struct {
	ExistingProductRemovals []*RemoveExistingProducts `xml:"RemoveExistingProducts"`
}

InstallExecuteSequence implements Wix.InstallExecuteSequence element https://wixtoolset.org/documentation/manual/v3/xsd/wix/installexecutesequence.html

type InstallUninstallType

type InstallUninstallType int

InstallUninstallType implements Wix.InstallUninstallType

func (*InstallUninstallType) MarshalJSON

func (v *InstallUninstallType) MarshalJSON() ([]byte, error)

MarshalJSON is used when writing InstallUninstallType into a JSON stream

func (*InstallUninstallType) MarshalText

func (v *InstallUninstallType) MarshalText() ([]byte, error)

MarshalText implements TextMarshaler interface for InstallUninstallType

type MajorUpgrade

type MajorUpgrade struct {
	AllowDowngrades          YesNoType `xml:",attr,omitempty"`
	AllowSameVersionUpgrades YesNoType `xml:",attr,omitempty"`
	Disallow                 YesNoType `xml:",attr,omitempty"`
	IgnoreRemoveFailure      YesNoType `xml:",attr,omitempty"`
	MigrateFeatures          YesNoType `xml:",attr,omitempty"`
	RemoveFeatures           string    `xml:",attr,omitempty"`
	Schedule                 string    `xml:",attr,omitempty"`
	DowngradeErrorMessage    string    `xml:",attr,omitempty"`
}

MajorUpgrade implements Wix.MajorUpgrade element https://wixtoolset.org/documentation/manual/v3/xsd/wix/majorupgrade.html

type MediaTemplate

type MediaTemplate struct {
	EmbedCab YesNoType `xml:",attr"`
}

MediaTemplate implements Wix.MediaTemplate element https://wixtoolset.org/documentation/manual/v3/xsd/wix/mediatemplate.html

type Package

type Package struct {
	ID                string    `xml:"Id,attr"` // use "*"
	Keywords          string    `xml:",attr,omitempty"`
	Description       string    `xml:",attr,omitempty"`
	Comments          string    `xml:",attr,omitempty"`
	Manufacturer      string    `xml:",attr"`
	InstallerVersion  uint32    `xml:",attr,omitempty"` // use 200
	InstallPrivileges string    `xml:",attr,omitempty"` // "limited" or "elevated" (default=elevated)
	InstallScope      string    `xml:",attr,omitempty"` // "perMachine" "perUser"
	Platform          string    `xml:",attr,omitempty"` // "x86" "x64"
	Languages         uint16    `xml:",attr"`
	Compressed        YesNoType `xml:",attr"`
	SummaryCodepage   uint16    `xml:",attr"`
}

Package implements Wix.Package element https://wixtoolset.org/documentation/manual/v3/xsd/wix/package.html

type Product

type Product struct {
	Name                   string                  `xml:",attr"`
	Manufacturer           string                  `xml:",attr"`
	ID                     string                  `xml:"Id,attr"`
	UpgradeCode            uuid.UUID               `xml:",attr"`
	Language               uint16                  `xml:",attr"`
	Codepage               uint16                  `xml:",attr"`
	Version                string                  `xml:",attr"`
	Package                *Package                `xml:"Package"`
	Upgrades               []*Upgrade              `xml:"Upgrade"`
	MajorUpgrades          []*MajorUpgrade         `xml:"MajorUpgrade"`
	InstallExecuteSequence *InstallExecuteSequence `xml:"InstallExecuteSequence"`
	Features               []*Feature              `xml:"Feature"`
	MediaTemplate          []*MediaTemplate        `xml:"MediaTemplate"`
	UIRefs                 []*UIRef                `xml:"UIRef"`
	WixVariables           []*WixVariable          `xml:"WixVariable"`
	Properties             []*Property             `xml:"Property"`
	Directories            []*Directory            `xml:"Directory"`
}

Product implements Wix.Product element https://wixtoolset.org/documentation/manual/v3/xsd/wix/product.html

func (*Product) AddFeature

func (p *Product) AddFeature(id string, level string, title string, description string) *Feature

AddFeature adds a root Feature element to a Product

func (*Product) AddMajorUpgrade

func (p *Product) AddMajorUpgrade(v *MajorUpgrade)

AddMajorUpgrade adds a new MajorUpgrade element to a Product

func (*Product) AddMediaTemplate

func (p *Product) AddMediaTemplate()

AddMediaTemplate adds a media template with EmbedCab="Yes"

func (*Product) AddProperty

func (p *Product) AddProperty(id string, value string) *Property

AddProperty adds a new Property to a Product

func (*Product) AddTargetDirectory

func (p *Product) AddTargetDirectory() *Directory

AddTargetDirectory adds a root "TARGETDIR" directory

func (*Product) AddUIRef

func (p *Product) AddUIRef(id string) *UIRef

AddUIRef adds a UIRef element to a product

func (*Product) AddUpgrade

func (p *Product) AddUpgrade(id uuid.UUID) *Upgrade

AddUpgrade adds a new Upgrade element to a Product

func (*Product) AddWixVariable

func (p *Product) AddWixVariable(id string, value string)

AddWixVariable adds a WixVariable element to a Product

type Property

type Property struct {
	ID     string    `xml:"Id,attr"`
	Value  string    `xml:",attr,omitempty"`
	Secure YesNoType `xml:",attr,omitempty"`
}

Property implements Wix.Property element https://wixtoolset.org/documentation/manual/v3/xsd/wix/property.html

type RemoveExistingProducts

type RemoveExistingProducts struct {
	Before      string    `xml:",attr,omitempty"`
	After       string    `xml:",attr,omitempty"`
	Overridable YesNoType `xml:",attr,omitempty"`
	Sequence    int       `xml:",attr,omitempty"`
	Suppress    YesNoType `xml:",attr,omitempty"`
}

RemoveExistingProducts implements Wix.RemoveExistingProducts element https://wixtoolset.org/documentation/manual/v3/xsd/wix/removeexistingproducts.html

type ServiceControl

type ServiceControl struct {
	ID     string               `xml:"Id,attr"`
	Name   string               `xml:",attr"` // Name of the service
	Remove InstallUninstallType `xml:",attr,omitempty"`
	Start  InstallUninstallType `xml:",attr,omitempty"`
	Stop   InstallUninstallType `xml:",attr,omitempty"`
	Wait   YesNoType            `xml:",attr,omitempty"` // Specifies whether or not to wait for the service to complete before continuing. The default is 'yes'.
}

ServiceControl implements Wix.ServiceControl element https://wixtoolset.org/documentation/manual/v3/xsd/wix/servicecontrol.html

type ServiceInstall

type ServiceInstall struct {
	ID           string    `xml:"Id,attr"`
	Name         string    `xml:",attr"`           // Service system name
	DisplayName  string    `xml:",attr"`           // Service display name
	Description  string    `xml:",attr,omitempty"` // Sets the description of the service
	Arguments    string    `xml:",attr,omitempty"` // Contains any command line arguments or properties required to run the service
	ErrorControl string    `xml:",attr,omitempty"` // use "ignore", "normal", or "crirical"
	Interactive  YesNoType `xml:",attr,omitempty"` // Whether or not the service interacts with the desktop
	Start        string    `xml:",attr,omitempty"` // "auto", "demand",or "disabled"
	Type         string    `xml:",attr,omitempty"` // "ownProcess" or "shareProcess", required
	Vital        YesNoType `xml:",attr,omitempty"` // The overall install should fail if this service fails to install
}

ServiceInstall implements Wix.ServiceInstall element https://wixtoolset.org/documentation/manual/v3/xsd/wix/servicecontrol.html

type Shortcut

type Shortcut struct {
	ID               string    `xml:"Id,attr"`
	Directory        string    `xml:"Directory,attr"`
	Name             string    `xml:"Name,attr"`
	WorkingDirectory string    `xml:"WorkingDirectory,attr"`
	Icon             string    `xml:"Icon,attr"`
	IconIndex        int       `xml:",attr"`
	Advertise        YesNoType `xml:",attr,omitempty"` // default "No"
}

Shortcut implements Wix.Shortcut element https://wixtoolset.org/documentation/manual/v3/xsd/wix/shortcut.html

type UIRef

type UIRef struct {
	ID string `xml:"Id,attr"`
}

UIRef implements Wix.UIRef element https://wixtoolset.org/documentation/manual/v3/xsd/wix/uiref.html

type Upgrade

type Upgrade struct {
	ID       uuid.UUID         `xml:"Id,attr"`
	Versions []*UpgradeVersion `xml:"UpgradeVersion"`
}

Upgrade implements Wix.Upgrade element https://wixtoolset.org/documentation/manual/v3/xsd/wix/upgrade.html

func (*Upgrade) AddVersion

func (u *Upgrade) AddVersion(v *UpgradeVersion)

AddVersion adds a UpgradeVersion element to an Upgrade

type UpgradeVersion

type UpgradeVersion struct {
	Property            string    `xml:",attr"`
	Minimum             string    `xml:",attr,omitempty"`
	IncludeMinimum      YesNoType `xml:",attr,omitempty"`
	Maximum             string    `xml:",attr,omitempty"`
	IncludeMaximum      YesNoType `xml:",attr,omitempty"`
	OnlyDetect          YesNoType `xml:",attr,omitempty"`
	MigrateFeatures     string    `xml:",attr,omitempty"`
	RemoveFeatures      string    `xml:",attr,omitempty"`
	IgnoreRemoveFailure YesNoType `xml:",attr,omitempty"`
}

UpgradeVersion implements Wix.UpgradeVersion element https://wixtoolset.org/documentation/manual/v3/xsd/wix/upgradeversion.html

type Wix

type Wix struct {
	XMLNs   string   `xml:"xmlns,attr"` // use XMLNamespace here
	Product *Product `xml:"Product"`
}

Wix is the root node tag

type WixVariable

type WixVariable struct {
	ID          string    `xml:"Id,attr"`
	Value       string    `xml:",attr"`
	Overridable YesNoType `xml:",attr,omitempty"`
}

WixVariable implements Wix.WixVariable element https://wixtoolset.org/documentation/manual/v3/xsd/wix/wixvariable.html

type YesNoType

type YesNoType int

YesNoType implements Wix.YesNoType

func ToYesNo

func ToYesNo(v bool) YesNoType

ToYesNo converts true->Yes and false->No

func (*YesNoType) MarshalJSON

func (v *YesNoType) MarshalJSON() ([]byte, error)

MarshalJSON is used when writing YesNoType into a JSON stream

func (*YesNoType) MarshalText

func (v *YesNoType) MarshalText() ([]byte, error)

MarshalText implements TextMarshaler interface for YesNoType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL