Skip to content

Commit

Permalink
P4EXP 2024.2 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
shraddhaborate committed Feb 4, 2025
1 parent 8da627f commit df13221
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 146 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2021, Perforce Software, Inc. All rights reserved.
Copyright (c) 2024, Perforce Software, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Expand Down
47 changes: 45 additions & 2 deletions P4EXPProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ public static void Login(RepoStorage store, bool force = false)
if (enterPW.DialogResult == DialogResult.Cancel)
{
store.loginCancelled = true;
LogOff(store);
}
if (enterPW.DialogResult == DialogResult.OK)
{
Expand Down Expand Up @@ -1790,6 +1789,36 @@ public static void OpenInP4V(IList<FileMetaData> commandFiles)
FileLogger.stopDebugLogging(Properties.Resources.FileLogger_Open_in_P4V);
return;
}

if(!string.IsNullOrEmpty(p4vPath) && System.IO.File.Exists(p4vPath))
{
string version = FileVersionInfo.GetVersionInfo(p4vPath).ToString();
string[] filelines = version.Split('\n');
string line = filelines[3].Replace("FileVersion:", "").Trim();
line = line.Remove(6);
double versionnum = Convert.ToDouble(line);

//recalculate p4v path based on version.
// P4V deprecated options p4v -s and p4v -t in 2024.1 release.
// These options needs to be replaced by p4vc -workspacewindow -s / -t
if (versionnum >= 2024.1)
{
string p4vcPath = P4VCPath();

if (string.IsNullOrEmpty(p4vcPath) || !System.IO.File.Exists(p4vcPath))
{
string message = Properties.Resources.MessageDlg_CannotLocateP4VC;
Message dlg = new Message(Properties.Resources.MessageDlg_MissingApplication, message);
dlg.ShowDialog();
FileLogger.LogMessage(1, Properties.Resources.FileLogger_Open_in_P4V, message);
FileLogger.stopDebugLogging(Properties.Resources.FileLogger_Open_in_P4V);
return;
}
p4vPath = p4vcPath;
}

}

Process startP4V = new Process();
startP4V.StartInfo.FileName = p4vPath;
RepoStorage store = getRepoStorage(commandFiles);
Expand All @@ -1806,12 +1835,26 @@ public static void OpenInP4V(IList<FileMetaData> commandFiles)
{
charset = " -C " + charset;
}
startP4V.StartInfo.Arguments =

if (p4vPath.Contains("p4vc"))
{
startP4V.StartInfo.Arguments =
" -p " + rep.Connection.Server.Address.Uri
+ " -u " + rep.Connection.UserName
+ " -c " + rep.Connection.Client.Name
+ charset
+ " workspacewindow -s \"" + commandFiles[0].LocalPath.Path + "\"";
startP4V.StartInfo.UseShellExecute = false;
}
else
{
startP4V.StartInfo.Arguments =
" -p " + rep.Connection.Server.Address.Uri
+ " -u " + rep.Connection.UserName
+ " -c " + rep.Connection.Client.Name
+ charset
+ " -s \"" + commandFiles[0].LocalPath.Path + "\"";
}

startP4V.StartInfo.CreateNoWindow = true;
startP4V.Start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<Payload SourceFile="$(var.WixWPFWizardBA.TargetPath)"/>
<Payload SourceFile="$(var.WixWPFWizardBA.TargetDir)\GetP4Vars.exe"/>
<Payload SourceFile="$(var.WixWPFWizardBA.TargetDir)\Microsoft.Deployment.WindowsInstaller.dll"/>
<Payload SourceFile="..\..\res\versions.txt"/>
<!-- To support localisation, we have to include the sattelite assemblies too! -->
<Payload SourceFile="$(var.WixWPFWizardBA.TargetDir)\ja-JP\WixWPFWizardBA.resources.dll" Name="ja-JP\WixWPFWizardBA.resources.dll"/>
</BootstrapperApplicationRef>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
Text="{x:Static wixWpfWizardBa:Localisation.SelectApplicationsPage_ProductName}" />
<TextBlock Grid.Row="2"
Foreground="Gray"
Text="{Binding Bootstrapper.Engine.StringVariables[VersionForPage],
Text="{Binding p4expVersion,
StringFormat={x:Static wixWpfWizardBa:Localisation.SelectApplicationsPage_Version}}" />
<TextBlock Grid.Row="3"
HorizontalAlignment="Left"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace WixWPFWizardBA.Views.Pages.SelectApplicationsPage
{
using Common;
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
using System.IO; // File, Path
using System.Reflection; // Assembly
using WixWPFWizardBA.Utilities; // WixVariableHelper
using WixWPFWizardBA.Dialogs.FolderBrowser; // FolderBrowserDialog
public class SelectApplicationsPageViewModel : PageViewModel
Expand All @@ -27,6 +29,8 @@ public SelectApplicationsPageViewModel(WizardViewModel wizardViewModel)
wizardViewModel.LaunchAction = LaunchAction.Install;
// TODO Need this? Or put in ReadyToInstall? this.BeginNextPhase();

GetVersionOfApps(this);

this._selectAppsFolderHelper = new WixVariableHelper(wizardViewModel.Bootstrapper, "InstallDir");
this._dialogTitle = string.Format(Localisation.Wizard_WindowTitle,
Bootstrapper.Engine.StringVariables["WixBundleName"],
Expand All @@ -47,6 +51,24 @@ public SelectApplicationsPageViewModel(WizardViewModel wizardViewModel)
}, _ => true);
}

/// <summary>
/// Read version of each app from versions.txt file (which is cached with bootstrapper).
/// Assume this doesn't take long to do so can do it each time the dialog opens.
/// </summary>
/// <param name="pageViewModel">We need this for access to version variables. TODO: Not best practice?</param>
private static void GetVersionOfApps(SelectApplicationsPageViewModel pageViewModel)
{
string versionFile = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "versions.txt");

foreach (string line in File.ReadAllLines(versionFile))
{
if (line.Contains("P4EXP"))
{
pageViewModel.p4expVersion = line.Substring(line.LastIndexOf(' ') + 1);
}
}
}

// This string is our access to the bundle's InstallDir variable.
// The Get may return the initial path from Bundle.wxs,
// [ProgramFiles64Folder]Perforce\, so format it to get the path.
Expand All @@ -62,6 +84,7 @@ public string ApplicationsFolder
}
}

public string p4expVersion { get; set; }
public SimpleCommand SelectAppsFolderBrowseCommand { get; }
}
}
26 changes: 4 additions & 22 deletions Packaging/WiX/p4exp-installer/p4exp-installer/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
<!-- Find P4V -->
<!-- We need to make these secure so that Remove will have them in server
context so there won't be an error that P4V not installed when it is.-->
<Property Id="P4VCOMPONENT32" Secure="yes">
<ComponentSearch Id="SearchForP4Vx86" Guid="{40F9427F-E0D9-4E5A-BCBA-33AB8FD6B717}" />
</Property>

<Property Id="P4VCOMPONENT64" Secure="yes">
<ComponentSearch Id="SearchForP4Vx64" Guid="{0FB3B9A2-2BBE-45C0-9291-13E4278749C3}" />
Expand Down Expand Up @@ -95,9 +92,6 @@

<!-- Find previously set P4 registry settings. -->

<Property Id="PREV_INSTALLDIR_PMX86">
<RegistrySearch Id="RegSearchPREV_INSTALLDIR_PMX86" Root="HKLM" Key="SOFTWARE\Perforce\Environment" Win64="no" Name="P4INSTROOT" Type="raw"/>
</Property>
<Property Id="PREV_INSTALLDIR_PMX64">
<RegistrySearch Id="RegSearchPREV_INSTALLDIR_PMX64" Root="HKLM" Key="SOFTWARE\Perforce\Environment" Win64="yes" Name="P4INSTROOT" Type="raw"/>
</Property>
Expand Down Expand Up @@ -164,7 +158,6 @@

<Binary Id="CustomActions" SourceFile="..\CA\bin\Release\CustomActions.dll"/>

<CustomAction Id="SetPREV_P4INSTALLDIR1_PMX86" Property="PREV_P4INSTALLDIR" Value="[PREV_INSTALLDIR_PMX86]" />
<CustomAction Id="SetPREV_P4INSTALLDIR1_PMX64" Property="PREV_P4INSTALLDIR" Value="[PREV_INSTALLDIR_PMX64]" />
<CustomAction Id="SetPREV_P4INSTALLDIR1_PU" Property="PREV_P4INSTALLDIR" Value="[PREV_INSTALLDIR_PU]" />

Expand Down Expand Up @@ -223,16 +216,9 @@
<CustomAction Id="UnRegisterDLLx64" BinaryKey="WixCA" DllEntry="WixQuietExec64" Execute="deferred" Impersonate="no" Return="ignore" />
<?endif ?>

<!-- We need these in x64 also, so no condition to include. -->
<SetProperty Id="RegisterDLLx86" Value="&quot;[P4EXP_32_BIT]srm86.exe&quot; install &quot;[P4EXP_32_BIT]p4exp.dll&quot; -codebase" Sequence="execute" Before="RegisterDLLx86"/>
<CustomAction Id="RegisterDLLx86" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="commit" Impersonate="no" Return="check" />
<!-- After="RemoveRegistryValues"-->
<SetProperty Id="UnRegisterDLLx86" Value="&quot;[P4EXP_32_BIT]srm86.exe&quot; uninstall &quot;[P4EXP_32_BIT]p4exp.dll&quot;" Sequence="execute" Before="UnRegisterDLLx86" />
<CustomAction Id="UnRegisterDLLx86" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="deferred" Impersonate="no" Return="ignore" />

<InstallExecuteSequence>
<Custom Action="SetPREV_P4INSTALLDIR1_PMX86" After="AppSearch"><![CDATA[UILevel < 5 AND PREV_INSTALLDIR_PMX86]]></Custom>
<Custom Action="SetPREV_P4INSTALLDIR1_PMX64" After="SetPREV_P4INSTALLDIR1_PMX86"><![CDATA[UILevel < 5 AND PREV_INSTALLDIR_PMX64]]></Custom>
<Custom Action="SetPREV_P4INSTALLDIR1_PMX64" After="AppSearch"><![CDATA[UILevel < 5 AND PREV_INSTALLDIR_PMX64]]></Custom>
<Custom Action="SetPREV_P4INSTALLDIR1_PU" After="SetPREV_P4INSTALLDIR1_PMX64"><![CDATA[UILevel < 5 AND PREV_INSTALLDIR_PU]]></Custom>
<Custom Action="SetPREV_P4EDITOR1_PM" After="SetPREV_P4INSTALLDIR1_PU"><![CDATA[UILevel < 5 AND PREV_P4EDITOR_PM]]></Custom>
<Custom Action="SetPREV_P4EDITOR2_PU" After="SetPREV_P4EDITOR1_PM"><![CDATA[UILevel < 5 AND PREV_P4EDITOR_PU]]></Custom>
Expand Down Expand Up @@ -263,20 +249,17 @@
<Custom Action="DeleteSettings" After="RemoveFiles">Installed OR WIX_UPGRADE_DETECTED</Custom>
<!-- Registering and unregistering DLLs.
Bundle sets REINSTALL to ALL so also check for that. -->
<Custom Action="RegisterDLLx86" After="RegisterTypeLibraries"><![CDATA[&P4EXP = 3 OR REINSTALL >< "P4EXP" OR REINSTALL = "ALL"]]></Custom>
<?if $(var.Platform) = x64 ?>
<Custom Action="RegisterDLLx64" After="RegisterDLLx86"><![CDATA[&P4EXP = 3 OR REINSTALL >< "P4EXP" OR REINSTALL = "ALL"]]></Custom>
<Custom Action="RegisterDLLx64" After="RegisterTypeLibraries"><![CDATA[&P4EXP = 3 OR REINSTALL >< "P4EXP" OR REINSTALL = "ALL"]]></Custom>
<?endif ?>
<Custom Action="UnRegisterDLLx86" After="RemoveRegistryValues"><![CDATA[&P4EXP = 2]]></Custom>
<?if $(var.Platform) = x64 ?>
<Custom Action="UnRegisterDLLx64" After="UnRegisterDLLx86"><![CDATA[&P4EXP = 2]]></Custom>
<Custom Action="UnRegisterDLLx64" After="RemoveRegistryValues"><![CDATA[&P4EXP = 2]]></Custom>
<?endif ?>
</InstallExecuteSequence>

<InstallUISequence>
<!-- Collect properties from system searches into appropriate properties (PREV_(property)). -->
<Custom Action="SetPREV_P4INSTALLDIR1_PMX86" After="AppSearch">PREV_INSTALLDIR_PMX86</Custom>
<Custom Action="SetPREV_P4INSTALLDIR1_PMX64" After="SetPREV_P4INSTALLDIR1_PMX86">PREV_INSTALLDIR_PMX64</Custom>
<Custom Action="SetPREV_P4INSTALLDIR1_PMX64" After="AppSearch">PREV_INSTALLDIR_PMX64</Custom>
<Custom Action="SetPREV_P4INSTALLDIR1_PU" After="SetPREV_P4INSTALLDIR1_PMX64">PREV_INSTALLDIR_PU</Custom>
<Custom Action="SetPREV_P4EDITOR1_PM" After="SetPREV_P4INSTALLDIR1_PU">PREV_P4EDITOR_PM</Custom>
<Custom Action="SetPREV_P4EDITOR2_PU" After="SetPREV_P4EDITOR1_PM">PREV_P4EDITOR_PU</Custom>
Expand Down Expand Up @@ -347,7 +330,6 @@ See: http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/WiX-devs-wix-
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="INSTALLDIR" Name="Perforce">
<Directory Id="P4EXP" Name="P4EXP"/>
<Directory Id="P4EXP_32_BIT" Name="P4EXP 32-bit"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
Expand Down
98 changes: 0 additions & 98 deletions Packaging/WiX/p4exp-installer/p4exp-installer/files.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,6 @@
<ComponentRef Id="p4exp_icons_x64"/>
<ComponentRef Id="Microsoft.Deployment.WindowsInstaller.dll_x64"/>
<ComponentRef Id="cmpp4exp.resources.dll_64"/>
<!-- Since we also install x86 on x64, also include them. -->
<MergeRef Id="VisualC++10CRTx86"/>
<ComponentRef Id="cmpApex.WinForms.dll_x86"/>
<ComponentRef Id="p4exp_p4api_dot_net_x86"/>
<ComponentRef Id="p4exp_p4bridge_x86"/>
<ComponentRef Id="p4exp_x86"/>
<ComponentRef Id="cmpSharpShell.dll_x86"/>
<ComponentRef Id="cmpsrm86.exe"/>
<ComponentRef Id="p4exp_icons_x86"/>
<ComponentRef Id="cmpp4exp.resources.dll_x86"/>
<?else ?>
<!-- 32-bit components go here -->
<MergeRef Id="VisualC++10CRTx86"/>
<ComponentRef Id="cmpApex.WinForms.dll_x86"/>
<ComponentRef Id="p4exp_p4api_dot_net_x86"/>
<ComponentRef Id="p4exp_p4bridge_x86"/>
<ComponentRef Id="p4exp_x86"/>
<ComponentRef Id="cmpSharpShell.dll_x86"/>
<ComponentRef Id="cmpsrm86.exe"/>
<ComponentRef Id="p4exp_icons_x86"/>
<ComponentRef Id="Microsoft.Deployment.WindowsInstaller.dll_x86"/>
<ComponentRef Id="cmpp4exp.resources.dll_x86"/>
<?endif ?>
</Feature>

Expand Down Expand Up @@ -292,82 +270,6 @@
</Component>
</Directory>
</DirectoryRef>
<!-- We want to also install 32-bit files on a 64-bit system, so include here.-->
<DirectoryRef Id="P4EXP_32_BIT">
<Merge Id="VisualC++10CRTx86" SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC100_CRT_x86.msm" DiskId="1" Language="1033" />
<Component Id="cmpApex.WinForms.dll_x86" Guid="{324EF60E-0375-4327-B096-A6B8D23A24F8}" Win64="no">
<!-- New file. -->
<File Id="filApex.WinForms.dll_x86" KeyPath="yes" Source="$(env.Bin86)\Apex.WinForms.dll" />
</Component>
<Component Id="p4exp_p4api_dot_net_x86" Guid="{A131270B-9C99-402E-BB89-72DB70327F1E}" Win64="no">
<!-- Same GUID. -->
<File Id="filp4api.net.dll_x86" KeyPath="yes" Source="$(env.Bin86)\p4api.net.dll" />
</Component>
<Component Id="p4exp_p4bridge_x86" Guid="{3E728D38-6A22-41FC-88E8-1B9E64F5B1A4}" Win64="no">
<!-- Same GUID. -->
<File Id="filp4bridge.dll_x86" KeyPath="yes" Source="$(env.Bin86)\p4bridge.dll" />
</Component>
<Component Id="p4exp_x86" Guid="{2057397C-08A7-4DB2-9805-FE5510CC234C}" Win64="no">
<!-- Same GUID. -->
<File Id="filp4exp.dll_x86" KeyPath="yes" Source="$(env.Bin86)\p4exp.dll"/>
</Component>
<Component Id="cmpSharpShell.dll_x86" Guid="{51F2ECC9-6288-4B65-BFA1-F561C149EAD4}" Win64="no">
<!-- New file. -->
<File Id="filSharpShell.dll_x86" KeyPath="yes" Source="$(env.Bin86)\SharpShell.dll" />
</Component>
<Component Id="cmpsrm86.exe" Guid="{682A2C45-0286-4A12-A7F3-E45A80FA92CD}" Win64="no">
<File Id="filsrm86.exe" KeyPath="yes" Source="$(env.Bin86)\srm86.exe" />
</Component>
<Component Id="p4exp_icons_x86" Guid="{8906ADC1-DBD4-421F-9DCE-D826BCF36C51}" Win64="no">
<!-- Same GUID. -->
<File Id="filadd.ico_x86" Source="$(env.Bin86)\add.ico" KeyPath="yes" />
<File Id="filchecked_out.ico_x86" Source="$(env.Bin86)\checked-out.ico" />
<File Id="fillatest_rev.ico_x86" Source="$(env.Bin86)\latest_rev.ico" />
<File Id="filstale_rev.ico_x86" Source="$(env.Bin86)\stale_rev.ico" />
</Component>
<Directory Id="JA_32_BIT" Name="ja">
<Component Id="cmpp4exp.resources.dll_x86" Guid="{1619CFF6-41A5-4695-B6D8-82BDF6DDDB28}" Win64="no">
<File Id="filp4exp.resources.dll_x86" KeyPath="yes" Source="$(env.Bin86)\ja\p4exp.resources.dll" />
</Component>
</Directory>
</DirectoryRef>
<?else?>
<!-- 32-bit files -->
<DirectoryRef Id="P4EXP_32_BIT">
<Merge Id="VisualC++10CRTx86" SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC100_CRT_x86.msm" DiskId="1" Language="1033" />
<Component Id="cmpApex.WinForms.dll_x86" Guid="{324EF60E-0375-4327-B096-A6B8D23A24F8}" Win64="no"> <!-- New file. -->
<File Id="filApex.WinForms.dll" KeyPath="yes" Source="$(env.Bin86)\Apex.WinForms.dll" />
</Component>
<Component Id="p4exp_p4api_dot_net_x86" Guid="{A131270B-9C99-402E-BB89-72DB70327F1E}" Win64="no"> <!-- Same GUID. -->
<File Id="filp4api.net.dll" KeyPath="yes" Source="$(env.Bin86)\p4api.net.dll" />
</Component>
<Component Id="p4exp_p4bridge_x86" Guid="{3E728D38-6A22-41FC-88E8-1B9E64F5B1A4}" Win64="no"> <!-- Same GUID. -->
<File Id="filp4bridge.dll" KeyPath="yes" Source="$(env.Bin86)\p4bridge.dll" />
</Component>
<Component Id="p4exp_x86" Guid="{2057397C-08A7-4DB2-9805-FE5510CC234C}" Win64="no"> <!-- Same GUID. -->
<File Id="filp4exp.dll" KeyPath="yes" Source="$(env.Bin86)\p4exp.dll"/>
</Component>
<Component Id="cmpSharpShell.dll_x86" Guid="{51F2ECC9-6288-4B65-BFA1-F561C149EAD4}" Win64="no"> <!-- New file. -->
<File Id="filSharpShell.dll" KeyPath="yes" Source="$(env.Bin86)\SharpShell.dll" />
</Component>
<Component Id="cmpsrm86.exe" Guid="{682A2C45-0286-4A12-A7F3-E45A80FA92CD}" Win64="no">
<File Id="filsrm86.exe" KeyPath="yes" Source="$(env.Bin86)\srm86.exe" />
</Component>
<Component Id="p4exp_icons_x86" Guid="{8906ADC1-DBD4-421F-9DCE-D826BCF36C51}" Win64="no"> <!-- Same GUID. -->
<File Id="filadd.ico" Source="$(env.Bin86)\add.ico" KeyPath="yes" />
<File Id="filchecked_out.ico" Source="$(env.Bin86)\checked-out.ico" />
<File Id="fillatest_rev.ico" Source="$(env.Bin86)\latest_rev.ico" />
<File Id="filstale_rev.ico" Source="$(env.Bin86)\stale_rev.ico" />
</Component>
<Component Id="Microsoft.Deployment.WindowsInstaller.dll_x86" Guid="{3CA7AB63-AC92-429A-BA14-C6A48A6B0EBC}" Win64="no"> <!-- New file. -->
<File Id="filMicrosoft.Deployment.WindowsInstaller.dll" Source="$(env.Bin86)\Microsoft.Deployment.WindowsInstaller.dll" />
</Component>
<Directory Id="JA_32_BIT" Name="ja">
<Component Id="cmpp4exp.resources.dll_x86" Guid="{1619CFF6-41A5-4695-B6D8-82BDF6DDDB28}" Win64="no">
<File Id="filp4exp.resources.dll_x86" KeyPath="yes" Source="$(env.Bin86)\ja\p4exp.resources.dll" />
</Component>
</Directory>
</DirectoryRef>
<?endif?>
</Fragment>
</Wix>
Loading

0 comments on commit df13221

Please sign in to comment.