From f5c52f8e62d01481b21b5e814ccc9b0010549144 Mon Sep 17 00:00:00 2001 From: Jan Wichelmann Date: Fri, 14 Apr 2023 16:11:44 +0200 Subject: [PATCH] Support multiple DWARF path prefixes in CI report generator --- Tools/CiReportGenerator/Program.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Tools/CiReportGenerator/Program.cs b/Tools/CiReportGenerator/Program.cs index 93ec924..37b49c2 100644 --- a/Tools/CiReportGenerator/Program.cs +++ b/Tools/CiReportGenerator/Program.cs @@ -22,7 +22,7 @@ Console.WriteLine("Supported map modes:"); Console.WriteLine(" dwarf"); Console.WriteLine(" - Directory with DWARF dumps, e.g. \"/mw/dwarf/\""); - Console.WriteLine(" - Path prefix which all source files share and which should be removed, e.g. \"/mw/src/\""); + Console.WriteLine(" - Path prefix(es) which all source files share and which should be removed, separated by colons, e.g. \"/mw/src/\""); Console.WriteLine(" js-map"); Console.WriteLine(" - Directory with MAP files generated by the JavascriptTracer plugin, e.g. \"/mw/maps/\""); return; @@ -50,7 +50,7 @@ if(argMode == "dwarf") { string argDwarfDirectory = args[argIndex++]; - string argUriPrefix = args[argIndex++]; + string[] argUriPrefixes = args[argIndex++].Split(':'); // Read DWARF files and extract statement info foreach(var dwarfFile in Directory.EnumerateFiles(argDwarfDirectory, "*.dwarf")) @@ -102,9 +102,15 @@ // Remove quotation marks uri = uri.Substring(1, uri.Length - 2); - // Remove path prefix - if(uri.StartsWith(argUriPrefix)) - uri = uri.Substring(argUriPrefix.Length); + // Remove path prefix and relative stuff + foreach(var prefix in argUriPrefixes) + { + if(uri.StartsWith(prefix)) + uri = uri.Substring(prefix.Length); + } + uri = uri.Replace("/./", "/"); + if(uri.StartsWith("./")) + uri = uri.Substring(2); if(uri.StartsWith('/')) uri = uri.Substring(1);