Skip to content

Commit e12a1e4

Browse files
authored
Build Layout PerfView Command (#2099)
Add the ability to build a fully extracted and self-contained PerfView layout. This is designed to avoid using the user-specific %appdata% installation of PerfView for scenarios where systems need to control updates and deployment of PerfView.
1 parent 18fa52b commit e12a1e4

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

src/PerfView/App.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,25 @@ public static int Main(string[] args)
5454
(string.Compare(args[0], "/noGui", StringComparison.OrdinalIgnoreCase) == 0 ||
5555
string.Compare(args[0], 0, "/logFile", 0, 8, StringComparison.OrdinalIgnoreCase) == 0));
5656

57+
// Users will need to check the return code for failure because there is no console setup yet and we can't log any status.
58+
var buildLayout = args.Length > 1 && string.Compare(args[0], "/buildLayout", StringComparison.OrdinalIgnoreCase) == 0;
59+
if (buildLayout)
60+
{
61+
string destDirectory = args[1];
62+
if (Directory.Exists(destDirectory))
63+
{
64+
return retCode;
65+
}
66+
67+
SupportFiles.SetSupportFilesDir(destDirectory);
68+
App.Unpack();
69+
App.WriteDefaultAppConfigDataFile(destDirectory);
70+
71+
retCode = 0;
72+
return retCode;
73+
}
74+
75+
5776
// If we need to install, display the splash screen early, otherwise wait
5877
if (!Directory.Exists(SupportFiles.SupportFileDir) && !noGui)
5978
{
@@ -394,6 +413,11 @@ public static ConfigData AppConfigData
394413
}
395414
}
396415

416+
public static void WriteDefaultAppConfigDataFile(string directoryPath)
417+
{
418+
string defaultConfig = "<ConfigData>\r\n <SupportFilesDir>.\\</SupportFilesDir>\r\n</ConfigData>";
419+
File.WriteAllText(Path.Combine(directoryPath, "AppConfig.xml"), defaultConfig);
420+
}
397421

398422
// Logfile
399423
/// <summary>

src/PerfView/Utilities/SupportFiles.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,11 @@ private static void UnpackResources()
338338
}
339339
}
340340

341+
internal static void SetSupportFilesDir(string supportFilesDir)
342+
{
343+
s_supportFileDir = supportFilesDir;
344+
}
345+
341346
private static void Cleanup()
342347
{
343348
string cleanupMarkerFile = Path.Combine(SupportFileDirBase, "CleanupNeeded");

0 commit comments

Comments
 (0)