<?xml version="1.0" encoding="UTF-8"?>

<!--
  IronPython installer root features, upgrades, and product definition
  2006-01-01 BobArnso Created
-->

<!-- 
WHEN PERFORMING MAJOR IP UPGRADES (e.g., 2.5 => 2.6):
1. Update the UpgradeCode GUID
2. Check that the IronPython "ARP*" property links are still valid
-->

<?include Version.wxi ?>

<?define UpgradeCode = "a162604e-d515-4155-9b8b-2854502d1588" ?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" UpgradeCode="$(var.UpgradeCode)" Name="$(var.ProductShortName) $(var.ProductVersionText)" Version="$(var.ProductVersion)" Language="1033" Manufacturer="$(var.Manufacturer)">
    <Package Id="*" Compressed="yes" Description="$(var.ProductShortName) $(var.ProductVersionText) ($(var.ProductVersion))" InstallerVersion="200" ShortNames="no" Manufacturer="$(var.Manufacturer)" InstallScope="perMachine" />
    <Media Id="1" Cabinet="IronPy.cab" EmbedCab="yes" CompressionLevel="high" />

    <!-- Major upgrade -->
    <Upgrade Id="$(var.UpgradeCode)">
      <UpgradeVersion Minimum="$(var.ProductVersion)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" />
      <UpgradeVersion Minimum="0.0.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED" OnlyDetect="no" />
    </Upgrade>

    <!-- Properties -->
    <Property Id="ARPHELPLINK" Value="http://ironpython.net/support/" />
    <Property Id="ARPURLINFOABOUT" Value="http://www.ironpython.net" />
    <Property Id="ARPURLUPDATEINFO" Value="http://ironpython.codeplex.com" />

    <!-- We search for an existing file type for .py files.  If it's found we'll use it, otherwise we'll default to Python.File which matches CPython -->
    <Property Id="PYTHONFILETYPE" Value="Python.File">
      <RegistrySearch Id="PythonFileTypeSearch" Root="HKCR" Key=".py" Type="raw" />
    </Property>

    <!-- Same thing but used to decide if we should install the default info for the file type -->
    <Property Id="PYTHONFILETYPENODEFAULT" >
      <RegistrySearch Id="PythonFileTypeNoDefaultSearch" Root="HKCR" Key=".py" Type="raw" />
    </Property>

    <!-- Launch conditions -->
    <Condition Message="An administrator must approve or install [ProductName]."> Privileged </Condition>
    <Condition Message="A later version of [ProductName] is already installed."> NOT NEWERVERSIONDETECTED </Condition>
    <Condition Message="[ProductName] requires .NET Framework 4.0 or later.">  Installed OR MsiNetAssemblySupport >= "4.0.0.0" </Condition>

    <!-- Root directories -->
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramMenuFolder">
        <Directory Id="IronPythonStartMenu" Name="$(var.ProductShortName) $(var.ReleaseSeries)" />
      </Directory>

      <Directory Id="ProgramFilesFolder">
        <Directory Id="INSTALLDIR" Name="$(var.ProductShortName) $(var.ReleaseSeries)" />
      </Directory>

      <Directory Id="GAC" Name="GAC" />
    </Directory>

    <DirectoryRef Id="IronPythonStartMenu">
      <Component Id="IronPythonCommonShortcuts">
        <Shortcut Id="IronPython_Help" Name="IronPython Documentation" Target="[INSTALLDIR]Doc\IronPython.chm" />
        <Shortcut Id="IronPython_Readme" Name="IronPython Readme" Target="[INSTALLDIR]Readme.html" />
        <Shortcut Id="IronPython_Console" Name="IronPython Console" Target="[INSTALLDIR]ipy.exe" />
        
        <RegistryValue Root="HKCU" Key="SOFTWARE\IronPython\$(var.ReleaseSeries)" Name="ipy" Type="integer" Value="1" KeyPath="yes"/>
        <RemoveFolder Id="IronPythonStartMenu" On="uninstall" />
      </Component>
      
      <Component Id="IronPython64bitShortcuts">
        <Condition>VersionNT64</Condition>
        <Shortcut Id="IronPython_Console64" Name="IronPython Console (64-bit)" Target="[INSTALLDIR]ipy64.exe" />
        
        <RegistryValue Root="HKCU" Key="SOFTWARE\IronPython\$(var.ReleaseSeries)" Name="ipy64" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>

    <!-- Features - listed in the UI in the same order as they appear here -->
    <Feature Id="Feature_IronPython" ConfigurableDirectory="INSTALLDIR" Absent="disallow" AllowAdvertise="no" Display="expand" Level="1" Title="IronPython">
      <Feature Id="Feature_Core" Absent="disallow" AllowAdvertise="no" Display="collapse" Level="1" Title="IronPython" Description="IronPython binaries for the Desktop CLR.">
        <ComponentGroupRef Id='Dlr' />
        <ComponentGroupRef Id='IronPython' />
        <ComponentGroupRef Id='IronPythonStdLib' />

        <ComponentRef Id='IronPythonCommonShortcuts'/>
        <ComponentRef Id='IronPython64bitShortcuts'/>

        <Feature Id='IronPython_Core_Gac' AllowAdvertise='no' Level='1' Title='GAC Assemblies' Description='Install the IronPython assemblies into the GAC.'>
          <ComponentGroupRef Id='DlrGac' />
          <ComponentGroupRef Id='IronPythonGac' />
        </Feature>
      </Feature>

      <Feature Id='IronPython_Docs' AllowAdvertise='no' Level='1' Title='Documentation' Description='IronPython Documentation'>
        <ComponentGroupRef Id='IronPythonDocs' />
      </Feature>

      <Feature Id='IronPython_Platforms' AllowAdvertise='no' Level='1' Title='Platforms' Description='Development libraries for additional platforms.'>
        <Feature Id='IronPython_Platforms_Net35' AllowAdvertise='no' Level='1' Title='.NET 3.5' Description='Development assemblies for .NET 3.5.'>
          <ComponentGroupRef Id='IronPythonPlatformsNet35'/>
        </Feature>

        <Feature Id='IronPython_Platforms_Net40' AllowAdvertise='no' Level='1' Title='.NET 4' Description='Development assemblies for .NET 4.'>
          <ComponentGroupRef Id='IronPythonPlatformsNet40'/>
        </Feature>
        
        <Feature Id='IronPython_Platforms_Net45' AllowAdvertise='no' Level='1' Title='.NET 4.5' Description='Development assemblies for .NET 4.5.'>
          <ComponentGroupRef Id='IronPythonPlatformsNet45'/>
        </Feature>

        <Feature Id='IronPython_Platforms_Sl5' AllowAdvertise='no' Level='1' Title='Silverlight 5' Description='Development assemblies for Silverlight 5.'>
          <ComponentGroupRef Id='IronPythonPlatformsSl5'/>
        </Feature>
      </Feature>
      <Feature Id='IronPython_SilverlightTools' AllowAdvertise='no' Level='1' Title='Silverlight Tools' Description='Tools for developing Silverlight apps with IronPython (Chiron.exe et al.).'>
        <ComponentGroupRef Id='IronPythonSilverlightTools' />
      </Feature>

      <Feature Id='IronPython_Tools' AllowAdvertise='no' Level='1' Title='Scripts' Description='Some useful scripts that have been written for IronPython.'>
        <ComponentGroupRef Id='IronPythonTools' />
      </Feature>

      <Feature Id='IronPython_Tutorial' AllowAdvertise='no' Level='1' Title='Tutorial' Description='IronPython Tutorial'>
        <ComponentGroupRef Id='IronPythonTutorial' />
      </Feature>
    </Feature>

    <!-- Sequences -->
    <InstallExecuteSequence>
      <RemoveExistingProducts After="InstallInitialize"  />
      <Custom Action='SetInstallLocation' After="InstallValidate" />
    </InstallExecuteSequence>

    <InstallUISequence>
      <!-- Because we have a launch condition that uses the results of FindRelatedProducts, put it first. -->
      <LaunchConditions After="FindRelatedProducts" />
    </InstallUISequence>

    <!-- User interface -->
    <UIRef Id="WixUI_FeatureTree" />
    <WixVariable Id="WixUILicenseRtf" Value="License.rtf" />

    <!-- InstallLocation key -->
    <CustomAction Id="SetInstallLocation" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />

  </Product>

</Wix>
