Skip to content

Commit 6243a46

Browse files
authored
Merge pull request #19560 from unoplatform/mergify/bp/release/stable/5.6/pr-19528
fix(hr): Ignore bin and obj folders (backport #19528)
2 parents bd95d0e + 58959aa commit 6243a46

File tree

3 files changed

+24
-11
lines changed

3 files changed

+24
-11
lines changed

src/SourceGenerators/Uno.UI.SourceGenerators/RemoteControl/RemoteControlGenerator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public class RemoteControlGenerator : ISourceGenerator
4747
"MSBuildVersion",
4848
"UnoHotReloadDiagnosticsLogPath",
4949
"AppendRuntimeIdentifierToOutputPath",
50-
"OutputPath"
50+
"OutputPath",
51+
"IntermediateOutputPath"
5152
};
5253

5354
public void Initialize(GeneratorInitializationContext context)

src/Uno.UI.RemoteControl.Server.Processors/HotReload/ServerHotReloadProcessor.MetadataUpdate.cs

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ namespace Uno.UI.RemoteControl.Host.HotReload
2323
{
2424
partial class ServerHotReloadProcessor : IServerProcessor, IDisposable
2525
{
26-
private static readonly StringComparer _pathsComparer = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal;
26+
private static readonly StringComparer _pathsComparer = OperatingSystem.IsWindows() ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal;
27+
private static readonly StringComparison _pathsComparison = OperatingSystem.IsWindows() ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
2728

2829
private FileSystemWatcher[]? _solutionWatchers;
2930
private IDisposable? _solutionWatcherEventsDisposable;
@@ -96,6 +97,7 @@ private void InitializeInner(ConfigureServer configureServer)
9697
&& bool.TryParse(appendStr, out var append)
9798
&& append;
9899
var hasOutputPath = properties.Remove("OutputPath", out var outputPath);
100+
properties.Remove("IntermediateOutputPath", out var intermediateOutputPath);
99101

100102
if (properties.Remove("RuntimeIdentifier", out var runtimeIdentifier))
101103
{
@@ -116,7 +118,7 @@ private void InitializeInner(ConfigureServer configureServer)
116118
properties,
117119
CancellationToken.None);
118120

119-
ObserveSolutionPaths(result.Item1);
121+
ObserveSolutionPaths(result.Item1, intermediateOutputPath, outputPath);
120122

121123
await _remoteControlServer.SendFrame(new HotReloadWorkspaceLoadResult { WorkspaceInitialized = true });
122124
await Notify(HotReloadEvent.Ready);
@@ -136,16 +138,26 @@ private void InitializeInner(ConfigureServer configureServer)
136138
CancellationToken.None);
137139
}
138140

139-
private void ObserveSolutionPaths(Solution solution)
141+
private void ObserveSolutionPaths(Solution solution, params string?[] excludedDir)
140142
{
141143
var observedPaths =
142144
solution.Projects
143-
.SelectMany(p => p
144-
.Documents
145-
.Select(d => d.FilePath)
146-
.Concat(p.AdditionalDocuments
147-
.Select(d => d.FilePath)))
148-
.Select(Path.GetDirectoryName)
145+
.SelectMany(project =>
146+
{
147+
var projectDir = Path.GetDirectoryName(project.FilePath);
148+
ImmutableArray<string> excludedProjectDir = [.. from dir in excludedDir where dir is not null select Path.Combine(projectDir!, dir).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)];
149+
150+
var paths = project
151+
.Documents
152+
.Select(d => d.FilePath)
153+
.Concat(project.AdditionalDocuments.Select(d => d.FilePath))
154+
.Select(Path.GetDirectoryName)
155+
.Where(path => path is not null && !excludedProjectDir.Any(dir => path.StartsWith(dir, _pathsComparison)))
156+
.Distinct()
157+
.ToArray();
158+
159+
return paths;
160+
})
149161
.Distinct()
150162
.ToArray();
151163

src/Uno.UI.RemoteControl/HotReload/ClientHotReloadProcessor.Common.Status.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private string[] GetCuratedTypes()
215215
{
216216
return Types
217217
.Select(GetFriendlyName)
218-
.Where(name => name is { Length: > 0 })
218+
.Where(name => name is { Length: > 0 } and not "HotReloadException")
219219
.Distinct()
220220
.ToArray()!;
221221

0 commit comments

Comments
 (0)