Skip to content

Commit

Permalink
fix(debugging): Publish debugger files in all modes
Browse files Browse the repository at this point in the history
This changes allows for the "start with debugger" command in VS to work even when running in release mode.
  • Loading branch information
jeromelaban committed Jan 15, 2021
1 parent 107d637 commit a351522
Showing 1 changed file with 32 additions and 35 deletions.
67 changes: 32 additions & 35 deletions src/Uno.Wasm.Bootstrap/ShellTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -557,53 +557,50 @@ private string AlignPath(string path, bool escape = false)

private void TryDeployDebuggerProxy()
{
if (RuntimeDebuggerEnabled)
{
var sdkName = Path.GetFileName(MonoWasmSDKPath);
var sdkName = Path.GetFileName(MonoWasmSDKPath);

var wasmDebuggerRootPath = Path.Combine(IntermediateOutputPath, "wasm-debugger");
DirectoryCreateDirectory(wasmDebuggerRootPath);
var wasmDebuggerRootPath = Path.Combine(IntermediateOutputPath, "wasm-debugger");
DirectoryCreateDirectory(wasmDebuggerRootPath);

if (!string.IsNullOrEmpty(CustomDebuggerPath))
{
CustomDebuggerPath = FixupPath(CustomDebuggerPath!);
}
if (!string.IsNullOrEmpty(CustomDebuggerPath))
{
CustomDebuggerPath = FixupPath(CustomDebuggerPath!);
}

var debuggerLocalPath = Path.Combine(wasmDebuggerRootPath, sdkName);
var debuggerLocalPath = Path.Combine(wasmDebuggerRootPath, sdkName);

Log.LogMessage($"Debugger CustomDebuggerPath:[{CustomDebuggerPath}], {wasmDebuggerRootPath}, {debuggerLocalPath}, {sdkName}");
Log.LogMessage($"Debugger CustomDebuggerPath:[{CustomDebuggerPath}], {wasmDebuggerRootPath}, {debuggerLocalPath}, {sdkName}");

if (!Directory.Exists(debuggerLocalPath))
if (!Directory.Exists(debuggerLocalPath))
{
foreach (var debugger in Directory.GetDirectories(wasmDebuggerRootPath))
{
foreach (var debugger in Directory.GetDirectories(wasmDebuggerRootPath))
{
Directory.Delete(debugger, recursive: true);
}
Directory.Delete(debugger, recursive: true);
}

DirectoryCreateDirectory(debuggerLocalPath);
DirectoryCreateDirectory(debuggerLocalPath);

var proxyBasePath = IsNetCoreWasm
? Path.Combine(MonoWasmSDKPath, "dbg-proxy", "net5", "Release")
: Path.Combine(MonoWasmSDKPath, "dbg-proxy", "netcoreapp3.0");
var proxyBasePath = IsNetCoreWasm
? Path.Combine(MonoWasmSDKPath, "dbg-proxy", "net5", "Release")
: Path.Combine(MonoWasmSDKPath, "dbg-proxy", "netcoreapp3.0");

var sourceBasePath = FixupPath(string.IsNullOrEmpty(CustomDebuggerPath) ? proxyBasePath : CustomDebuggerPath!);
var sourceBasePath = FixupPath(string.IsNullOrEmpty(CustomDebuggerPath) ? proxyBasePath : CustomDebuggerPath!);

foreach (var debuggerFilePath in Directory.EnumerateFiles(sourceBasePath))
{
var debuggerFile = Path.GetFileName(debuggerFilePath);
foreach (var debuggerFilePath in Directory.EnumerateFiles(sourceBasePath))
{
var debuggerFile = Path.GetFileName(debuggerFilePath);

string sourceFileName = Path.Combine(sourceBasePath, debuggerFile);
string destFileName = Path.Combine(debuggerLocalPath, debuggerFile);
string sourceFileName = Path.Combine(sourceBasePath, debuggerFile);
string destFileName = Path.Combine(debuggerLocalPath, debuggerFile);

if (File.Exists(sourceFileName))
{
Log.LogMessage(MessageImportance.High, $"Copying {sourceFileName} -> {destFileName}");
FileCopy(sourceFileName, destFileName);
}
else
{
Log.LogMessage($"Skipping [{sourceFileName}] as it does not exist");
}
if (File.Exists(sourceFileName))
{
Log.LogMessage(MessageImportance.High, $"Copying {sourceFileName} -> {destFileName}");
FileCopy(sourceFileName, destFileName);
}
else
{
Log.LogMessage($"Skipping [{sourceFileName}] as it does not exist");
}
}
}
Expand Down

0 comments on commit a351522

Please sign in to comment.