diff --git a/Jenkinsfile b/Jenkinsfile
index 8851753a4..ad1c7fa61 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,6 +1,6 @@
#!groovy
-/* Copyright (c) Cloud Software Group, Inc.
+/* Copyright (c) Cloud Software Group, Inc.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
@@ -30,10 +30,10 @@
* SUCH DAMAGE.
*/
-def XENADMIN_BRANDING_TAG = 'v5.1'
+def XENADMIN_BRANDING_TAG = 'v5.2'
-@Library(['PacmanSharedLibrary', "xencenter-pipeline@v4.9"])
-import com.citrix.pipeline.xencenter.*
+@Library(['PacmanSharedLibrary', "xencenter-pipeline@v4.10"])
+import com.xenserver.pipeline.xencenter.*
properties([
[
diff --git a/README.md b/README.md
index 060b3b9e9..cb6052ca1 100644
--- a/README.md
+++ b/README.md
@@ -54,3 +54,7 @@ To run the [NUnit](http://www.nunit.org/) tests you will need the following libr
* Moq.dll
which can be obtained from .
+
+Note that the build script assumes that you have added MSBuild's location (usually
+`C:\Program Files\Microsoft Visual Studio\2022\\MSBuild\Current\Bin`)
+to your `PATH` environment variable.
diff --git a/WixInstaller/XenCenter.wxs b/WixInstaller/XenCenter.wxs
index 211d6a81a..f026e6129 100644
--- a/WixInstaller/XenCenter.wxs
+++ b/WixInstaller/XenCenter.wxs
@@ -40,7 +40,7 @@
-
+
@@ -56,11 +56,11 @@
-
+
-
+
@@ -149,16 +149,16 @@
INSTALLSHORTCUT
-
+
-
+
@@ -172,9 +172,9 @@
-
+
-
+
@@ -200,7 +200,7 @@
= "#528040")]]>
-
+
diff --git a/WixInstaller/branding.wxi b/WixInstaller/branding.wxi
index b3eadb202..b4be2e929 100644
--- a/WixInstaller/branding.wxi
+++ b/WixInstaller/branding.wxi
@@ -1,7 +1,7 @@
Required
Disk Size
Volume
-+
++
+ A newer version of this product is already installed.
+ Install for:
+ &All Users
@@ -600,10 +600,10 @@ diff -ru wixlib/WixUI_FeatureTree.wxs wixlib/WixUI_FeatureTree.wxs
1
1
1
-+
++
+ 1
+ 1
-+
++
@@ -1023,4 +1023,5 @@ diff --git wixlib/MsiRMFilesInUse.wxs wixlib/MsiRMFilesInUse.wxs
+ 1
- 1
\ No newline at end of file
+ 1
+
\ No newline at end of file
diff --git a/XenAdmin/Alerts/Types/ClientUpdateAlert.cs b/XenAdmin/Alerts/Types/ClientUpdateAlert.cs
index 6fcb5bc2a..233d19324 100644
--- a/XenAdmin/Alerts/Types/ClientUpdateAlert.cs
+++ b/XenAdmin/Alerts/Types/ClientUpdateAlert.cs
@@ -98,7 +98,7 @@ namespace XenAdmin.Alerts
public static void DownloadAndInstallNewClient(ClientUpdateAlert updateAlert, IWin32Window parent)
{
- var outputPathAndFileName = Path.Combine(Path.GetTempPath(), $"{BrandManager.BrandConsoleNoSpace}.msi");
+ var outputPathAndFileName = Path.Combine(Path.GetTempPath(), $"{BrandManager.BrandConsole}.msi");
var downloadAndInstallClientAction = new DownloadAndUpdateClientAction(updateAlert.Name, new Uri(updateAlert.NewVersion.Url), outputPathAndFileName, updateAlert.Checksum);
diff --git a/XenAdmin/Core/Registry.cs b/XenAdmin/Core/Registry.cs
index 7f411ea27..5607ffbe8 100644
--- a/XenAdmin/Core/Registry.cs
+++ b/XenAdmin/Core/Registry.cs
@@ -266,7 +266,7 @@ namespace XenAdmin.Core
private const string FORCE_SYSTEM_FONTS = "ForceSystemFonts";
private const string DISABLE_PLUGINS = "DisablePlugins";
private const string DONT_SUDO = "DontSudo";
- private static readonly string XENCENTER_LOCAL_KEYS = $"SOFTWARE\\{BrandManager.ProductBrand}\\{BrandManager.BrandConsoleNoSpace}";
+ private static readonly string XENCENTER_LOCAL_KEYS = $"SOFTWARE\\{BrandManager.ProductBrand}\\{BrandManager.BrandConsole}";
private const string PSExecutionPolicyKey = @"Software\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell";
private const string PSExecutionPolicyName = "ExecutionPolicy";
private const string PowerShellKey = @"Software\Microsoft\PowerShell\1";
diff --git a/XenAdmin/Program.cs b/XenAdmin/Program.cs
index df3a70bf0..ce5b95b63 100644
--- a/XenAdmin/Program.cs
+++ b/XenAdmin/Program.cs
@@ -125,12 +125,12 @@ namespace XenAdmin
var logFolder = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
BrandManager.ProductBrand,
- BrandManager.BrandConsoleNoSpace,
+ BrandManager.BrandConsole,
"logs");
- log4net.GlobalContext.Properties["LOG_FILE"] = Path.Combine(logFolder, $"{BrandManager.BrandConsoleNoSpace}.log");
- log4net.GlobalContext.Properties["AUDIT_TRAIL"] = Path.Combine(logFolder, $"{BrandManager.BrandConsoleNoSpace}-AuditTrail.log");
- log4net.GlobalContext.Properties["NETWORK_TRACE"] = Path.Combine(logFolder, $"{BrandManager.BrandConsoleNoSpace}-NetworkTrace.log");
+ log4net.GlobalContext.Properties["LOG_FILE"] = Path.Combine(logFolder, $"{BrandManager.BrandConsole}.log");
+ log4net.GlobalContext.Properties["AUDIT_TRAIL"] = Path.Combine(logFolder, $"{BrandManager.BrandConsole}-AuditTrail.log");
+ log4net.GlobalContext.Properties["NETWORK_TRACE"] = Path.Combine(logFolder, $"{BrandManager.BrandConsole}-NetworkTrace.log");
log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(Assembly.GetCallingAssembly().Location + ".config"));
log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -145,7 +145,7 @@ namespace XenAdmin
public static void Main(string[] args)
{
string appGuid = ((GuidAttribute)Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false).GetValue(0)).Value;
- _pipePath = string.Format(PIPE_PATH_PATTERN, BrandManager.BrandConsoleNoSpace, Process.GetCurrentProcess().SessionId, Environment.UserName, appGuid);
+ _pipePath = string.Format(PIPE_PATH_PATTERN, BrandManager.BrandConsole, Process.GetCurrentProcess().SessionId, Environment.UserName, appGuid);
if (NamedPipes.Pipe.ExistsPipe(_pipePath))
{
diff --git a/XenAdmin/Settings.cs b/XenAdmin/Settings.cs
index 9114b387a..e261d661d 100644
--- a/XenAdmin/Settings.cs
+++ b/XenAdmin/Settings.cs
@@ -781,7 +781,7 @@ namespace XenAdmin
Version previousVersion = null;
Version currentVersion = Program.Version;
- var directories = companyFolder.GetDirectories($"{BrandManager.BrandConsoleNoSpace}*");
+ var directories = companyFolder.GetDirectories($"{BrandManager.BrandConsole}*");
foreach (var dir in directories)
{
diff --git a/XenAdmin/XenAdmin.csproj b/XenAdmin/XenAdmin.csproj
index 80686813f..6f449aa5c 100755
--- a/XenAdmin/XenAdmin.csproj
+++ b/XenAdmin/XenAdmin.csproj
@@ -9,7 +9,7 @@
WinExe
Properties
XenAdmin
- [XenCenter_No_Space]
+ [XenCenter]
..\Branding\Images\AppIcon.ico
v4.8
publish\
diff --git a/XenAdminTests/CodeTests/AssemblyTests.cs b/XenAdminTests/CodeTests/AssemblyTests.cs
index b926443d6..3b104b882 100644
--- a/XenAdminTests/CodeTests/AssemblyTests.cs
+++ b/XenAdminTests/CodeTests/AssemblyTests.cs
@@ -44,7 +44,7 @@ namespace XenAdminTests.CodeTests
[TestFixture, Category(TestCategories.Unit)]
public class AssemblyTests
{
- private static readonly string MainAssemblyName = BrandManager.BrandConsoleNoSpace;
+ private static readonly string MainAssemblyName = BrandManager.BrandConsole;
public class TestDataClass
{
diff --git a/XenModel/Actions/StatusReport/ClientSideStatusReportAction.cs b/XenModel/Actions/StatusReport/ClientSideStatusReportAction.cs
index 9db566bed..cd1ba8379 100644
--- a/XenModel/Actions/StatusReport/ClientSideStatusReportAction.cs
+++ b/XenModel/Actions/StatusReport/ClientSideStatusReportAction.cs
@@ -82,7 +82,7 @@ namespace XenAdmin.Actions
private void CopyClientLogs()
{
- string logDestination = string.Format("{0}\\{1}-{2}.log", filePath, timeString, BrandManager.BrandConsoleNoSpace);
+ string logDestination = string.Format("{0}\\{1}-{2}.log", filePath, timeString, BrandManager.BrandConsole);
if (includeClientLogs)
{
string logPath = XenAdminConfigManager.Provider.GetLogFile();
diff --git a/XenModel/BrandManager.cs b/XenModel/BrandManager.cs
index 4eb024500..e22b52b86 100644
--- a/XenModel/BrandManager.cs
+++ b/XenModel/BrandManager.cs
@@ -47,7 +47,6 @@ namespace XenAdmin.Core
var customBranding = (CustomBrandingAttribute)assembly.GetCustomAttribute(typeof(CustomBrandingAttribute));
BrandConsole = customBranding.BrandConsole;
- BrandConsoleNoSpace = customBranding.BrandConsoleNoSpace;
CompanyNameShort = customBranding.CompanyNameShort;
ProductBrand = customBranding.ProductBrand;
ProductVersionPost82 = customBranding.ProductVersionText;
@@ -66,8 +65,6 @@ namespace XenAdmin.Core
public static readonly string BrandConsole;
- public static readonly string BrandConsoleNoSpace;
-
public static readonly string Cis = Get("CIS");
public static readonly string CompanyNameLegacy = Get("COMPANY_NAME_LEGACY");
diff --git a/XenModel/Properties/AssemblyInfo.cs b/XenModel/Properties/AssemblyInfo.cs
index 9042d0205..7d94ae0e4 100644
--- a/XenModel/Properties/AssemblyInfo.cs
+++ b/XenModel/Properties/AssemblyInfo.cs
@@ -34,7 +34,7 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using XenAdmin.Properties;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
@@ -43,8 +43,8 @@ using XenAdmin.Properties;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("[XenCenter]")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
@@ -55,7 +55,6 @@ using XenAdmin.Properties;
[assembly: CustomBranding(
"[XenCenter]",
- "[XenCenter_No_Space]",
"[Vendor]",
"[XenServerProduct]",
"[XenServer version]",
@@ -77,7 +76,6 @@ namespace XenAdmin.Properties
{
public CustomBrandingAttribute(
string brandConsole,
- string brandConsoleNoSpace,
string companyNameShort,
string productBrand,
string productVersionText,
@@ -94,7 +92,6 @@ namespace XenAdmin.Properties
)
{
BrandConsole = brandConsole;
- BrandConsoleNoSpace = brandConsoleNoSpace;
CompanyNameShort = companyNameShort;
ProductBrand = productBrand;
ProductVersionText = productVersionText;
@@ -111,7 +108,6 @@ namespace XenAdmin.Properties
}
public string BrandConsole { get; }
- public string BrandConsoleNoSpace { get; }
public string CompanyNameShort { get; }
public string ProductBrand { get; }
public string ProductVersionText { get; }
diff --git a/Branding/branding.sh b/scripts/branding.ps1
similarity index 60%
rename from Branding/branding.sh
rename to scripts/branding.ps1
index 7817016a4..f90f3e4f6 100644
--- a/Branding/branding.sh
+++ b/scripts/branding.ps1
@@ -1,6 +1,4 @@
-#!/bin/sh
-
-# Copyright (c) Cloud Software Group, Inc.
+# Copyright (c) Cloud Software Group, Inc.
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
@@ -29,23 +27,22 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
-BRANDING_COMPANY_NAME_LEGAL="[Vendor Legal]"
-BRANDING_COMPANY_NAME_SHORT="[Vendor]"
-BRANDING_PRODUCT_BRAND="[XenServerProduct]"
-BRANDING_SERVER="[XenServer host]"
-BRANDING_BRAND_CONSOLE="[XenCenter]"
-BRANDING_BRAND_CONSOLE_NO_SPACE="[XenCenter]"
-BRANDING_BRAND_CONSOLE_SHORT=XenCente
-BRANDING_HELP_PATH=xencenter/current-release/
-BRANDING_PV_TOOLS="[Guest Tools]"
-BRANDING_PRODUCT_VERSION_TEXT=0.0.0
-BRANDING_XC_PRODUCT_VERSION=0.0.0
-BRANDING_XC_PRODUCT_VERSION_INSTALLER=0.0.0
-XC_UPDATES_URL="[Xc updates url]"
-CFU_URL="[Cfu url]"
-YUM_REPO_BASE_BIN="[YumRepoBaseBin]"
-YUM_REPO_BASE_SRC="[YumRepoBaseSource]"
-YUM_REPO_EARLY_ACCESS_BIN="[YumRepoEarlyAccessBin]"
-YUM_REPO_EARLY_ACCESS_SRC="[YumRepoEarlyAccessSource]"
-YUM_REPO_NORMAL_BIN="[YumRepoNormalBin]"
-YUM_REPO_NORMAL_SRC="[YumRepoNormalSource]"
+$BRANDING_COMPANY_NAME_LEGAL="[Vendor Legal]"
+$BRANDING_COMPANY_NAME_SHORT="[Vendor]"
+$BRANDING_PRODUCT_BRAND="[XenServerProduct]"
+$BRANDING_SERVER="[XenServer host]"
+$BRANDING_BRAND_CONSOLE="[XenCenter]"
+$BRANDING_BRAND_CONSOLE_SHORT="XenCente"
+$BRANDING_HELP_PATH="xencenter/current-release/"
+$BRANDING_PV_TOOLS="[Guest Tools]"
+$BRANDING_PRODUCT_VERSION_TEXT="0.0.0"
+$BRANDING_XC_PRODUCT_VERSION="0.0.0"
+$BRANDING_XC_PRODUCT_VERSION_INSTALLER="0.0.0"
+$XC_UPDATES_URL="[Xc updates url]"
+$CFU_URL="[Cfu url]"
+$YUM_REPO_BASE_BIN="[YumRepoBaseBin]"
+$YUM_REPO_BASE_SRC="[YumRepoBaseSource]"
+$YUM_REPO_EARLY_ACCESS_BIN="[YumRepoEarlyAccessBin]"
+$YUM_REPO_EARLY_ACCESS_SRC="[YumRepoEarlyAccessSource]"
+$YUM_REPO_NORMAL_BIN="[YumRepoNormalBin]"
+$YUM_REPO_NORMAL_SRC="[YumRepoNormalSource]"
diff --git a/scripts/re-branding.sh b/scripts/re-branding.sh
deleted file mode 100644
index 3065ec8af..000000000
--- a/scripts/re-branding.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) Cloud Software Group, Inc.
-#
-#Redistribution and use in source and binary forms, with or without modification,
-#are permitted provided that the following conditions are met:
-#
-#1. Redistributions of source code must retain the above copyright notice, this
-#list of conditions and the following disclaimer.
-#
-#2. Redistributions in binary form must reproduce the above copyright notice,
-#this list of conditions and the following disclaimer in the documentation and/or
-#other materials provided with the distribution.
-#
-#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-#ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-#IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-#INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-#NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-#PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-#WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-#ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-#POSSIBILITY OF SUCH DAMAGE.
-
-echo Entered re-branding.sh
-set -u
-
-GLOBAL_BUILD_NUMBER=$1
-
-REPO="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
-
-version_csharp()
-{
- sed -b -i -e "s/0\.0\.0\.0/${BRANDING_XC_PRODUCT_VERSION}.${GLOBAL_BUILD_NUMBER}/g" \
- -e "s/0000/${BRANDING_XC_PRODUCT_VERSION}.${GLOBAL_BUILD_NUMBER}/g" \
- $1
-}
-
-rebranding_global()
-{
- sed -b -i -e "s#\[Vendor Legal\]#${BRANDING_COMPANY_NAME_LEGAL}#g" \
- -e "s#\[Vendor\]#${BRANDING_COMPANY_NAME_SHORT}#g" \
- -e "s#\[Guest Tools\]#${BRANDING_PV_TOOLS}#g" \
- -e "s#\[XenServerProduct\]#${BRANDING_PRODUCT_BRAND}#g" \
- -e "s#\[XenServer version\]#${BRANDING_PRODUCT_VERSION_TEXT}#g" \
- -e "s#\[XenServer host\]#${BRANDING_SERVER}#g" \
- -e "s#\[XenCenter\]#${BRANDING_BRAND_CONSOLE}#g" \
- -e "s#\[XenCenter_No_Space\]#${BRANDING_BRAND_CONSOLE_NO_SPACE}#g" \
- -e "s#xencenter\/current-release\/#${BRANDING_HELP_PATH}#g" \
- -e "s#\[Xc updates url\]#${XC_UPDATES_URL}#g" \
- -e "s#\[Cfu url\]#${CFU_URL}#g" \
- -e "s#\[YumRepoBaseBin\]#${YUM_REPO_BASE_BIN}#g" \
- -e "s#\[YumRepoBaseSource\]#${YUM_REPO_BASE_SRC}#g" \
- -e "s#\[YumRepoEarlyAccessBin\]#${YUM_REPO_EARLY_ACCESS_BIN}#g" \
- -e "s#\[YumRepoEarlyAccessSource\]#${YUM_REPO_EARLY_ACCESS_SRC}#g" \
- -e "s#\[YumRepoNormalBin\]#${YUM_REPO_NORMAL_BIN}#g" \
- -e "s#\[YumRepoNormalSource\]#${YUM_REPO_NORMAL_SRC}#g" \
- $1
-}
-
-version_csharp "${REPO}/CommonAssemblyInfo.cs"
-rebranding_global "${REPO}/CommonAssemblyInfo.cs"
-
-#AssemblyInfo rebranding
-for projectDir in CFUValidator CommandLib xe XenAdmin XenAdminTests XenCenterLib XenModel XenOvfApi
-do
- assemblyInfo="${REPO}/${projectDir}/Properties/AssemblyInfo.cs"
- version_csharp ${assemblyInfo}
- rebranding_global ${assemblyInfo}
-done
-
-rebranding_global ${REPO}/XenAdmin/XenAdmin.csproj
-
-PRODUCT_GUID=$(uuidgen | tr [a-z] [A-Z] | tr -d [:space:])
-
-sed -b -i -e "s/@AUTOGEN_PRODUCT_GUID@/${PRODUCT_GUID}/g" \
- -e "s/@PRODUCT_VERSION@/${BRANDING_XC_PRODUCT_VERSION_INSTALLER}/g" \
- -e "s/@COMPANY_NAME_LEGAL@/${BRANDING_COMPANY_NAME_LEGAL}/g" \
- -e "s/@COMPANY_NAME_SHORT@/${BRANDING_COMPANY_NAME_SHORT}/g" \
- -e "s/@BRAND_CONSOLE@/${BRANDING_BRAND_CONSOLE}/g" \
- -e "s/@BRAND_CONSOLE_NO_SPACE@/${BRANDING_BRAND_CONSOLE_NO_SPACE}/g" \
- -e "s/@BRAND_CONSOLE_SHORT@/${BRANDING_BRAND_CONSOLE_SHORT}/g" \
- -e "s/@PRODUCT_BRAND@/${BRANDING_PRODUCT_BRAND}/g" \
- ${REPO}/WixInstaller/branding.wxi
-
-#XenAdminTests
-rebranding_global ${REPO}/XenAdminTests/TestResources/ContextMenuBuilderTestResults.xml
-rebranding_global ${REPO}/XenAdminTests/XenAdminTests.csproj
-
-set +u
diff --git a/scripts/rebranding.ps1 b/scripts/rebranding.ps1
new file mode 100644
index 000000000..8531a4f53
--- /dev/null
+++ b/scripts/rebranding.ps1
@@ -0,0 +1,122 @@
+# Copyright (c) Cloud Software Group, Inc.
+#
+# Redistribution and use in source and binary forms,
+# with or without modification, are permitted provided
+# that the following conditions are met:
+#
+# * Redistributions of source code must retain the above
+# copyright notice, this list of conditions and the
+# following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the
+# following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+Param(
+ [Parameter(HelpMessage = "Global build number", Mandatory = $true)]
+ [int]$buildNumber
+)
+
+$verbose = $false
+if ($PSBoundParameters.ContainsKey('Verbose')) {
+ $verbose = $PsBoundParameters['Verbose']
+}
+
+####################
+# Helper functions #
+####################
+
+function version_csharp([string]$file) {
+ Write-Verbose "Versioning file $file" -Verbose:$verbose
+
+ (Get-Content -Path $file -Encoding "utf8") `
+ -replace "0.0.0.0", "$BRANDING_XC_PRODUCT_VERSION.$buildNumber" `
+ -replace "0000", "$BRANDING_XC_PRODUCT_VERSION.$buildNumber" |`
+ Set-Content -Path $file -Encoding "utf8"
+}
+
+function rebranding_global([string]$file) {
+ Write-Verbose "Rebranding file $file" -Verbose:$verbose
+
+ (Get-Content -Path $file -Encoding "utf8") `
+ -replace "\[Vendor Legal\]", $BRANDING_COMPANY_NAME_LEGAL `
+ -replace "\[Vendor\]", $BRANDING_COMPANY_NAME_SHORT `
+ -replace "\[Guest Tools\]", $BRANDING_PV_TOOLS `
+ -replace "\[XenServerProduct\]", $BRANDING_PRODUCT_BRAND `
+ -replace "\[XenServer version\]", $BRANDING_PRODUCT_VERSION_TEXT `
+ -replace "\[XenServer host\]", $BRANDING_SERVER `
+ -replace "\[XenCenter\]", $BRANDING_BRAND_CONSOLE `
+ -replace "xencenter/current-release/", $BRANDING_HELP_PATH `
+ -replace "\[Xc updates url\]", $XC_UPDATES_URL `
+ -replace "\[Cfu url\]", $CFU_URL `
+ -replace "\[YumRepoBaseBin\]", $YUM_REPO_BASE_BIN `
+ -replace "\[YumRepoBaseSource\]", $YUM_REPO_BASE_SRC `
+ -replace "\[YumRepoEarlyAccessBin\]", $YUM_REPO_EARLY_ACCESS_BIN `
+ -replace "\[YumRepoEarlyAccessSource\]", $YUM_REPO_EARLY_ACCESS_SRC `
+ -replace "\[YumRepoNormalBin\]", $YUM_REPO_NORMAL_BIN `
+ -replace "\[YumRepoNormalSource\]", $YUM_REPO_NORMAL_SRC |`
+ Set-Content -Path $file -Encoding "utf8"
+}
+
+##########################
+# Rebrand solution files #
+##########################
+
+Write-Host "Started product rebranding"
+
+$REPO = Get-Item "$PSScriptRoot\.." | Select-Object -ExpandProperty FullName
+
+. $REPO\scripts\branding.ps1
+
+version_csharp $REPO\CommonAssemblyInfo.cs
+rebranding_global $REPO\CommonAssemblyInfo.cs
+
+$projects = @("CFUValidator", "CommandLib", "xe", "XenAdmin", "XenAdminTests", "XenCenterLib", "XenModel", "XenOvfApi")
+
+foreach ($project in $projects) {
+ $assemblyInfo = "$REPO\$project\Properties\AssemblyInfo.cs"
+ version_csharp $assemblyInfo
+ rebranding_global $assemblyInfo
+}
+
+rebranding_global $REPO\XenAdmin\XenAdmin.csproj
+
+rebranding_global $REPO\XenAdminTests\TestResources\ContextMenuBuilderTestResults.xml
+rebranding_global $REPO\XenAdminTests\XenAdminTests.csproj
+
+#####################
+# Rebrand installer #
+#####################
+
+$PRODUCT_GUID = [guid]::NewGuid().ToString()
+
+$wxiFile="$REPO\WixInstaller\branding.wxi"
+
+Write-Verbose "Rebranding file $wxiFile" -Verbose:$verbose
+
+(Get-Content -Path $wxiFile -Encoding "utf8") `
+ -replace "@AUTOGEN_PRODUCT_GUID@", $PRODUCT_GUID `
+ -replace "@PRODUCT_VERSION@", $BRANDING_XC_PRODUCT_VERSION_INSTALLER `
+ -replace "@COMPANY_NAME_LEGAL@", $BRANDING_COMPANY_NAME_LEGAL `
+ -replace "@COMPANY_NAME_SHORT@", $BRANDING_COMPANY_NAME_SHORT `
+ -replace "@BRAND_CONSOLE@", $BRANDING_BRAND_CONSOLE `
+ -replace "@BRAND_CONSOLE_SHORT@", $BRANDING_BRAND_CONSOLE_SHORT `
+ -replace "@PRODUCT_BRAND@", $BRANDING_PRODUCT_BRAND |`
+ Set-Content -Path $wxiFile -Encoding "utf8"
+
+Write-Host "Completed product rebranding"
diff --git a/scripts/xenadmin-build.ps1 b/scripts/xenadmin-build.ps1
new file mode 100644
index 000000000..0f00b72c4
--- /dev/null
+++ b/scripts/xenadmin-build.ps1
@@ -0,0 +1,339 @@
+# Copyright (c) Cloud Software Group, Inc.
+#
+# Redistribution and use in source and binary forms,
+# with or without modification, are permitted provided
+# that the following conditions are met:
+#
+# * Redistributions of source code must retain the above
+# copyright notice, this list of conditions and the
+# following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the
+# following disclaimer in the documentation and/or other
+# materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+Param(
+ [Parameter(HelpMessage = "Global build number", Mandatory = $true)]
+ [int]$buildNumber,
+
+ [Parameter(HelpMessage = "Thumbprint of the certificate to use for signing")]
+ [string]$thumbPrint,
+
+ [Parameter(HelpMessage = "Timestamp server to use for signing")]
+ [string]$timestampServer
+)
+
+$verbose = $false
+if ($PSBoundParameters.ContainsKey('Verbose')) {
+ $verbose = $PsBoundParameters['Verbose']
+}
+
+$ErrorActionPreference = "Stop"
+
+####################
+# Helper functions #
+####################
+
+function mkdir_clean([string]$path) {
+ if ([System.IO.Directory]::Exists($path)) {
+ Remove-Item -Path $path -Force -Recurse -Verbose:$verbose
+ }
+ New-Item -ItemType Directory -Path $path -Verbose:$verbose
+}
+
+function build([string]$solution) {
+ msbuild /m /verbosity:minimal /p:Configuration=Release /p:TargetFrameworkVersion=v4.8 /p:VisualStudioVersion=17.0 $solution
+}
+
+function get_locale_id([string]$locale) {
+ switch ($locale) {
+ "ja-jp" { 1041 }
+ "zh-cn" { 2052 }
+ "zh-tw" { 1028 }
+ default { 1033 } #en-us
+ }
+}
+
+######################
+# clean working area #
+######################
+
+$REPO = Get-Item "$PSScriptRoot\.." | Select-Object -ExpandProperty FullName
+$SCRATCH_DIR="$REPO\_scratch"
+$OUTPUT_DIR="$REPO\_output"
+
+Write-Host "INFO: Cleaning scratch and output directories"
+mkdir_clean $SCRATCH_DIR
+mkdir_clean $OUTPUT_DIR
+
+. $REPO\scripts\branding.ps1
+$appName = $BRANDING_BRAND_CONSOLE
+
+############################################
+# package sources BEFORE applying branding #
+############################################
+
+Write-Host "INFO: Packaging source files"
+
+$gitCommit = git rev-parse HEAD
+git archive --format=zip -o "$SCRATCH_DIR\xenadmin-sources.zip" $gitCommit
+
+Compress-Archive -Path "$SCRATCH_DIR\xenadmin-sources.zip","$REPO\packages\dotnet-packages-sources.zip" `
+ -DestinationPath "$OUTPUT_DIR\$appName-source.zip" -Verbose:$verbose
+
+##################
+# apply branding #
+##################
+
+.$REPO\scripts\rebranding.ps1 $buildNumber -Verbose:$verbose
+
+Write-Host "INFO: Expanding External Tools"
+Expand-Archive -Path $REPO\packages\XenCenterOVF.zip -DestinationPath $SCRATCH_DIR -Verbose:$verbose
+
+Write-Host "INFO: Building solution"
+build $REPO\XenAdmin.sln
+
+##############
+# sign files #
+##############
+
+if ([System.IO.File]::Exists("$REPO\scripts\sign.ps1")) {
+ . $REPO\scripts\sign.ps1
+
+ $filesToSign = @(
+ "$REPO\XenAdmin\bin\Release\CommandLib.dll",
+ "$REPO\XenAdmin\bin\Release\MSTSCLib.dll",
+ "$REPO\XenAdmin\bin\Release\CoreUtilsLib.dll",
+ "$REPO\XenAdmin\bin\Release\XenModel.dll",
+ "$REPO\XenAdmin\bin\Release\XenOvf.dll",
+ "$REPO\XenAdmin\bin\Release\$appName.exe",
+ "$REPO\xe\bin\Release\xe.exe",
+ "$REPO\XenAdmin\ReportViewer\Microsoft.ReportViewer.Common.dll",
+ "$REPO\XenAdmin\ReportViewer\Microsoft.ReportViewer.ProcessingObjectModel.dll",
+ "$REPO\XenAdmin\ReportViewer\Microsoft.ReportViewer.WinForms.dll",
+ "$REPO\XenAdmin\ReportViewer\Microsoft.ReportViewer.Common.resources.dll",
+ "$REPO\XenAdmin\ReportViewer\Microsoft.ReportViewer.WinForms.resources.dll"
+ )
+
+ foreach ($file in $filesToSign) {
+ sign_artifact $file $appName $thumbPrint $timestampServer
+ }
+
+ sign_artifact $REPO\XenAdmin\bin\Release\CookComputing.XmlRpcV2.dll "XML-RPC.NET" $thumbPrint $timestampServer
+ sign_artifact $REPO\XenAdmin\bin\Release\Newtonsoft.Json.CH.dll "JSON.NET" $thumbPrint $timestampServer
+ sign_artifact $REPO\XenAdmin\bin\Release\log4net.dll "Log4Net" $thumbPrint $timestampServer
+ sign_artifact $REPO\XenAdmin\bin\Release\ICSharpCode.SharpZipLib.dll "SharpZipLib" $thumbPrint $timestampServer
+ sign_artifact $REPO\XenAdmin\bin\Release\DiscUtils.dll "DiscUtils" $thumbPrint $timestampServer
+
+}
+else {
+ Write-Host "INFO: Sign script does not exist; skip signing binaries"
+}
+
+###############
+# prepare Wix #
+###############
+
+Write-Host "INFO: Preparing Wix binaries and UI sources"
+mkdir_clean $SCRATCH_DIR\wixbin
+Expand-Archive -Path $REPO\packages\wix311-binaries.zip -DestinationPath $SCRATCH_DIR\wixbin
+mkdir_clean $SCRATCH_DIR\wixsrc
+Expand-Archive -Path $REPO\packages\wix311-debug.zip -DestinationPath $SCRATCH_DIR\wixsrc
+
+Copy-Item -Recurse $REPO\WixInstaller $SCRATCH_DIR -Verbose:$verbose
+Copy-Item -Recurse $SCRATCH_DIR\wixsrc\src\ext\UIExtension\wixlib $SCRATCH_DIR\WixInstaller -Verbose:$verbose
+Copy-Item $SCRATCH_DIR\WixInstaller\wixlib\CustomizeDlg.wxs $SCRATCH_DIR\WixInstaller\wixlib\CustomizeStdDlg.wxs -Verbose:$verbose
+
+if ("XenCenter" -ne $appName) {
+ Rename-Item -Path $SCRATCH_DIR\WixInstaller\XenCenter.wxs -NewName "$appName.wxs" -Verbose:$verbose
+}
+
+$origLocation = Get-Location
+Set-Location $SCRATCH_DIR\WixInstaller\wixlib -Verbose:$verbose
+try {
+ Write-Host "INFO: Patching Wix UI library"
+ git apply --verbose $SCRATCH_DIR\WixInstaller\wix_src.patch
+ Write-Host "INFO: Patching Wix UI library completed"
+}
+finally {
+ Set-Location $origLocation -Verbose:$verbose
+}
+
+New-Item -ItemType File -Path $SCRATCH_DIR\WixInstaller\PrintEula.dll -Verbose:$verbose
+
+###############
+# compile Wix #
+###############
+
+$CANDLE="$SCRATCH_DIR\wixbin\candle.exe"
+$LIT="$SCRATCH_DIR\wixbin\lit.exe"
+$LIGHT="$SCRATCH_DIR\wixbin\light.exe"
+
+$installerUiFiles = @(
+ "BrowseDlg",
+ "CancelDlg",
+ "Common",
+ "CustomizeDlg",
+ "CustomizeStdDlg",
+ "DiskCostDlg",
+ "ErrorDlg",
+ "ErrorProgressText",
+ "ExitDialog",
+ "FatalError",
+ "FilesInUse",
+ "InstallDirDlg",
+ "InvalidDirDlg",
+ "LicenseAgreementDlg",
+ "MaintenanceTypeDlg",
+ "MaintenanceWelcomeDlg",
+ "MsiRMFilesInUse",
+ "OutOfDiskDlg",
+ "OutOfRbDiskDlg",
+ "PrepareDlg",
+ "ProgressDlg",
+ "ResumeDlg",
+ "SetupTypeDlg",
+ "UserExit",
+ "VerifyReadyDlg",
+ "WaitForCostingDlg",
+ "WelcomeDlg",
+ "WixUI_InstallDir",
+ "WixUI_FeatureTree"
+)
+
+$candleList = $installerUiFiles | ForEach-Object { "$SCRATCH_DIR\WixInstaller\wixlib\$_.wxs" }
+$candleListString = $candleList -join " "
+$litList = $installerUiFiles | ForEach-Object { "$SCRATCH_DIR\WixInstaller\wixlib\$_.wixobj" }
+$litListString = $litList -join " "
+
+$env:RepoRoot=$REPO
+$env:WixLangId=get_locale_id $locale
+
+Write-Host "INFO: Compiling Wix UI"
+Invoke-Expression "$CANDLE -v -out $SCRATCH_DIR\WixInstaller\wixlib\ $candleListString"
+Invoke-Expression "$LIT -v -out $SCRATCH_DIR\WixInstaller\wixlib\WixUiLibrary.wixlib $litListString"
+
+##########################################################
+# for each locale create an msi containing all resources #
+##########################################################
+
+$locales = @("en-us")
+
+foreach ($locale in $locales) {
+ if ($locale -eq "en-us") {
+ $name=$appName
+ }
+ else {
+ $name=$appName.$locale
+ }
+
+ Write-Host "INFO: Building msi installer"
+
+ Invoke-Expression "$CANDLE -v -ext WiXNetFxExtension -ext WixUtilExtension -out $SCRATCH_DIR\WixInstaller\ $SCRATCH_DIR\WixInstaller\$appName.wxs"
+
+ Invoke-Expression "$LIGHT -v -sval -ext WiXNetFxExtension -ext WixUtilExtension -out $SCRATCH_DIR\WixInstaller\$name.msi -loc $SCRATCH_DIR\WixInstaller\wixlib\wixui_$locale.wxl -loc $SCRATCH_DIR\WixInstaller\$locale.wxl $SCRATCH_DIR\WixInstaller\$appName.wixobj $SCRATCH_DIR\WixInstaller\wixlib\WixUiLibrary.wixlib"
+}
+
+########################################
+# copy and sign the combined installer #
+########################################
+
+if ([System.IO.File]::Exists("$REPO\scripts\sign.ps1")) {
+ sign_artifact "$SCRATCH_DIR\WixInstaller\$appName.msi" $appName $thumbPrint $timestampServer
+}
+else {
+ Write-Host "INFO: Sign script does not exist; skip signing installer"
+}
+
+Copy-Item "$SCRATCH_DIR\WixInstaller\$appName.msi" $OUTPUT_DIR
+
+###################
+# build the tests #
+###################
+
+Write-Host "INFO: Building the tests"
+build $REPO\XenAdminTests\XenAdminTests.csproj
+Copy-Item $REPO\XenAdmin\ReportViewer\* $REPO\XenAdminTests\bin\Release\ -Verbose:$verbose
+
+Compress-Archive -Path $REPO\XenAdminTests\bin\Release -DestinationPath $OUTPUT_DIR\XenAdminTests.zip -Verbose:$verbose
+Compress-Archive -Path $REPO\XenAdmin\TestResources\* -DestinationPath "$OUTPUT_DIR\$($appName)TestResources.zip" -Verbose:$verbose
+
+####################################################
+# include cfu validator binary in output directory #
+####################################################
+
+Compress-Archive -Path $REPO\CFUValidator\bin\Release\*.dll -DestinationPath $OUTPUT_DIR\CFUValidator.zip -Verbose:$verbose
+Compress-Archive -Path $REPO\CFUValidator\bin\Release\CFUValidator.exe -Update -DestinationPath $OUTPUT_DIR\CFUValidator.zip -Verbose:$verbose
+Compress-Archive -Path $REPO\CFUValidator\bin\Release\$appName.exe -Update -DestinationPath $OUTPUT_DIR\CFUValidator.zip -Verbose:$verbose
+
+####################
+# package the pdbs #
+####################
+
+Compress-Archive -Path $REPO\packages\*.pdb,$REPO\XenAdmin\bin\Release\*.pdb,$REPO\xe\bin\Release\xe.pdb `
+ -DestinationPath "$OUTPUT_DIR\$appName.Symbols.zip" -Verbose:$verbose
+
+################################################
+# calculate installer and source zip checksums #
+################################################
+
+$msi_checksum = (Get-FileHash -Path "$OUTPUT_DIR\$appName.msi" -Algorithm SHA256 |`
+ Select-Object -ExpandProperty Hash).ToLower()
+
+$msi_checksum | Out-File -FilePath "$OUTPUT_DIR\$appName.msi.checksum" -Encoding utf8
+
+Write-Host "INFO: Calculated checksum installer checksum: $msi_checksum"
+
+$source_checksum = (Get-FileHash -Path "$OUTPUT_DIR\$appName-source.zip" -Algorithm SHA256 |`
+ Select-Object -ExpandProperty Hash).ToLower()
+
+$source_checksum | Out-File -FilePath "$OUTPUT_DIR\$appName-source.zip.checksum" -Encoding utf8
+
+Write-Host "INFO: Calculated checksum source checksum: $source_checksum"
+
+$xmlFormat=@"
+
+
+
+
+
+
+"@
+
+$msi_url = $XC_UPDATES_URL -replace "XCUpdates.xml","$appName.msi"
+$date=(Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
+$productFullName = "$appName $productVersion"
+$productVersion = "$BRANDING_XC_PRODUCT_VERSION.$buildNumber"
+
+Write-Host "INFO: Generating XCUpdates.xml"
+
+[string]::Format($xmlFormat, $productFullName, $date, $msi_url, $msi_checksum, $productVersion) |`
+ Out-File -FilePath $OUTPUT_DIR\XCUpdates.xml -Encoding utf8
+
+Write-Host "INFO: Generating stage-test-XCUpdates.xml. URL is a placeholder value"
+
+[string]::Format($xmlFormat, $productFullName, $date, "@DEV_MSI_URL_PLACEHOLDER@", $msi_checksum, $productVersion) |`
+ Out-File -FilePath $OUTPUT_DIR\stage-test-XCUpdates.xml -Encoding utf8
diff --git a/scripts/xenadmin-build.sh b/scripts/xenadmin-build.sh
deleted file mode 100644
index 01e5a4cc0..000000000
--- a/scripts/xenadmin-build.sh
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) Cloud Software Group, Inc.
-#
-# Redistribution and use in source and binary forms,
-# with or without modification, are permitted provided
-# that the following conditions are met:
-#
-# * Redistributions of source code must retain the above
-# copyright notice, this list of conditions and the
-# following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the
-# following disclaimer in the documentation and/or other
-# materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
-# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-
-# Script parameters:
-# 1 Global build number
-
-set -exu
-
-UNZIP="unzip -q -o"
-
-mkdir_clean()
-{
- rm -rf $1 && mkdir -p $1
-}
-
-REPO="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
-SCRATCH_DIR=${REPO}/_scratch
-OUTPUT_DIR=${REPO}/_output
-
-#build
-MSBUILD="/cygdrive/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin/MSBuild.exe"
-SWITCHES="/m /verbosity:minimal /p:Configuration=Release /p:TargetFrameworkVersion=v4.8 /p:VisualStudioVersion=17.0"
-
-if [ ! -f "${MSBUILD}" ] ; then
- echo "DEBUG: Did not find VS Community edition. Trying Professional"
- MSBUILD="/cygdrive/c/Program Files/Microsoft Visual Studio/2022/Professional/MSBuild/Current/Bin/MSBuild.exe"
-fi
-
-if [ ! -f "${MSBUILD}" ] ; then
- echo "DEBUG: Did not find VS Professional edition. Trying Enterprise"
- MSBUILD="/cygdrive/c/Program Files/Microsoft Visual Studio/2022/Enterprise/MSBuild/Current/Bin/MSBuild.exe"
-fi
-
-mkdir_clean ${SCRATCH_DIR}
-mkdir_clean ${OUTPUT_DIR}
-
-source ${REPO}/Branding/branding.sh
-source ${REPO}/scripts/re-branding.sh $1
-
-#packages sources
-mkdir_clean ${SCRATCH_DIR}/SOURCES
-cd ${REPO}
-gitCommit=`git rev-parse HEAD`
-git archive --format=zip -o "_scratch/SOURCES/xenadmin-sources.zip" ${gitCommit}
-cp ${REPO}/packages/dotnet-packages-sources.zip ${SCRATCH_DIR}/SOURCES
-cd ${SCRATCH_DIR}/SOURCES && zip ${OUTPUT_DIR}/${BRANDING_BRAND_CONSOLE_NO_SPACE}-source.zip dotnet-packages-sources.zip xenadmin-sources.zip
-
-${UNZIP} -d ${SCRATCH_DIR} ${REPO}/packages/XenCenterOVF.zip
-cd ${REPO} && "${MSBUILD}" ${SWITCHES} XenAdmin.sln
-
-#sign files only if all parameters are set and non-empty
-SIGN_BAT="${REPO}/scripts/sign.bat"
-
-if [ -f "${SIGN_BAT}" ] ; then
- for file in ${BRANDING_BRAND_CONSOLE_NO_SPACE}.exe CommandLib.dll MSTSCLib.dll CoreUtilsLib.dll XenModel.dll XenOvf.dll
- do
- cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} ${file} "${BRANDING_BRAND_CONSOLE}"
- done
-
- cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} ${BRANDING_BRAND_CONSOLE_NO_SPACE}.exe "${BRANDING_BRAND_CONSOLE}"
- cd ${REPO}/xe/bin/Release && ${SIGN_BAT} xe.exe "${BRANDING_BRAND_CONSOLE}"
-
- for file in Microsoft.ReportViewer.Common.dll Microsoft.ReportViewer.ProcessingObjectModel.dll Microsoft.ReportViewer.WinForms.dll Microsoft.ReportViewer.Common.resources.dll Microsoft.ReportViewer.WinForms.resources.dll
- do
- cd ${REPO}/XenAdmin/ReportViewer && ${SIGN_BAT} ${file} "${BRANDING_BRAND_CONSOLE}"
- done
-
- cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} CookComputing.XmlRpcV2.dll "XML-RPC.NET"
- cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} Newtonsoft.Json.CH.dll "JSON.NET"
- cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} log4net.dll "Log4Net"
- cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} ICSharpCode.SharpZipLib.dll "SharpZipLib"
- cd ${REPO}/XenAdmin/bin/Release && ${SIGN_BAT} DiscUtils.dll "DiscUtils"
-
-else
- echo "Sign script does not exist; skip signing binaries"
-fi
-
-#prepare wix
-
-WIX_BIN=${SCRATCH_DIR}/wixbin
-WIX_SRC=${SCRATCH_DIR}/wixsrc
-WIX=${SCRATCH_DIR}/WixInstaller
-
-CANDLE=${WIX_BIN}/candle.exe
-LIT=${WIX_BIN}/lit.exe
-LIGHT=${WIX_BIN}/light.exe
-
-mkdir_clean ${WIX_BIN} && ${UNZIP} ${REPO}/packages/wix311-binaries.zip -d ${WIX_BIN}
-mkdir_clean ${WIX_SRC} && ${UNZIP} ${REPO}/packages/wix311-debug.zip -d ${WIX_SRC}
-cp -r ${REPO}/WixInstaller ${SCRATCH_DIR}/
-cp -r ${WIX_SRC}/src/ext/UIExtension/wixlib ${WIX}/
-cd ${WIX}/wixlib && cp CustomizeDlg.wxs CustomizeStdDlg.wxs
-cd ${WIX}/wixlib && patch -p1 --binary < ${WIX}/wix_src.patch
-touch ${WIX}/PrintEula.dll
-
-#compile_wix
-chmod -R u+rx ${WIX_BIN}
-cd ${WIX} && mkdir -p obj lib
-RepoRoot=$(cygpath -w ${REPO}) ${CANDLE} -out obj/ @candleList.txt
-${LIT} -out lib/WixUI_InstallDir.wixlib @litList.txt
-
-locale_id() {
- case "$1" in
- "ja-jp") echo 1041 ;;
- "zh-cn") echo 2052 ;;
- "zh-tw") echo 1028 ;;
- *) echo 1033 ;; #en-us
- esac
-}
-
-if [ "XenCenter" != "${BRANDING_BRAND_CONSOLE}" ] ; then
- cd ${WIX} && mv XenCenter.wxs ${BRANDING_BRAND_CONSOLE_NO_SPACE}.wxs
-fi
-
-#for each locale create an msi containing all resources
-
-for locale in en-us
-do
- if [ "${locale}" = "en-us" ] ; then
- name=${BRANDING_BRAND_CONSOLE_NO_SPACE}
- else
- name=${BRANDING_BRAND_CONSOLE_NO_SPACE}.${locale}
- fi
-
- cd ${WIX}
- mkdir -p obj${name} out${name}
-
- WixLangId=$(locale_id ${locale} | tr -d [:space:]) RepoRoot=$(cygpath -w ${REPO}) \
- ${CANDLE} -ext WiXNetFxExtension -ext WixUtilExtension -out obj${name}/ ${BRANDING_BRAND_CONSOLE_NO_SPACE}.wxs
-
- ${LIGHT} -sval -ext WiXNetFxExtension -ext WixUtilExtension -out out${name}/${name}.msi \
- -loc wixlib/wixui_${locale}.wxl -loc ${locale}.wxl \
- obj${name}/${BRANDING_BRAND_CONSOLE_NO_SPACE}.wixobj lib/WixUI_InstallDir.wixlib
-
- cp ${WIX}/out${name}/${name}.msi ${WIX}
-done
-
-#copy and sign the combined installer
-
-if [ -f "${SIGN_BAT}" ] ; then
- cd ${WIX} && chmod a+rw ${BRANDING_BRAND_CONSOLE_NO_SPACE}.msi && ${SIGN_BAT} ${BRANDING_BRAND_CONSOLE_NO_SPACE}.msi "${BRANDING_BRAND_CONSOLE}"
-else
- echo "Sign script does not exist; skip signing installer"
-fi
-
-cp ${WIX}/${BRANDING_BRAND_CONSOLE_NO_SPACE}.msi ${OUTPUT_DIR}
-
-#build the tests
-echo "INFO: Build the tests..."
-cd ${REPO}/XenAdminTests && "${MSBUILD}" ${SWITCHES}
-cp ${REPO}/XenAdmin/ReportViewer/* ${REPO}/XenAdminTests/bin/Release/
-cd ${REPO}/XenAdminTests/bin/ && zip -r ${OUTPUT_DIR}/XenAdminTests.zip Release
-cd ${REPO}/XenAdmin/TestResources && zip -r ${OUTPUT_DIR}/${BRANDING_BRAND_CONSOLE_NO_SPACE}TestResources.zip *
-
-#include cfu validator binary in output directory
-cd ${REPO}/CFUValidator/bin/Release && zip ${OUTPUT_DIR}/CFUValidator.zip ./{*.dll,CFUValidator.exe,${BRANDING_BRAND_CONSOLE_NO_SPACE}.exe}
-
-#now package the pdbs
-cp ${REPO}/packages/*.pdb ${OUTPUT_DIR}
-
-cp ${REPO}/XenAdmin/bin/Release/{CommandLib.pdb,${BRANDING_BRAND_CONSOLE_NO_SPACE}.pdb,CoreUtilsLib.pdb,${BRANDING_BRAND_CONSOLE_NO_SPACE}.pdb,XenModel.pdb,XenOvf.pdb} \
- ${REPO}/xe/bin/Release/xe.pdb \
- ${OUTPUT_DIR}
-
-cd ${OUTPUT_DIR} && zip -r -m ${BRANDING_BRAND_CONSOLE_NO_SPACE}.Symbols.zip *.pdb
-
-msi_checksum_with_file_name=`sha256sum ./${BRANDING_BRAND_CONSOLE_NO_SPACE}.msi`
-echo $msi_checksum_with_file_name > ${OUTPUT_DIR}/${BRANDING_BRAND_CONSOLE_NO_SPACE}.msi.checksum
-msi_checksum=($msi_checksum_with_file_name)
-
-sha256sum ${OUTPUT_DIR}/${BRANDING_BRAND_CONSOLE_NO_SPACE}-source.zip > ${OUTPUT_DIR}/${BRANDING_BRAND_CONSOLE_NO_SPACE}-source.zip.checksum
-
-echo "INFO: Generating XCUpdates.xml"
-
-# UPDATE_URL points at the updates XML, we need to point to the MSI
-msi_url="${XC_UPDATES_URL/XCUpdates.xml/$BRANDING_BRAND_CONSOLE_NO_SPACE.msi}"
-
-output_xml="
-
-
-
-
-"
-
-echo $output_xml > ${OUTPUT_DIR}/XCUpdates.xml
-
-echo "INFO: Generating stage-test-XCUpdates.xml. URL is a placeholder value"
-
-echo "${output_xml/"url=\"${msi_url}\""/"url=\"@DEV_MSI_URL_PLACEHOLDER@\""}" > ${OUTPUT_DIR}/stage-test-XCUpdates.xml
-
-set +u