From f9e4c4d386bb1e2f1ea4738dc36beaf53612bd02 Mon Sep 17 00:00:00 2001
From: Jason Dove <1695733+jasongdove@users.noreply.github.com>
Date: Tue, 9 Dec 2025 14:17:05 -0600
Subject: [PATCH] improve build time by only running analyzers explicitly
(#2710)
* improve build time by only running analyzers explicitly
* don't exclude scanner from analyzers
* Revert "don't exclude scanner from analyzers"
This reverts commit d927f9850a26b169dbb66547c1424230b003ff39.
* fix sed syntax for linux
---
.github/workflows/pr.yml | 25 +++++++++++++++++++
Directory.Build.targets | 15 +++++++++++
.../ErsatzTV.Application.csproj | 4 ---
.../ErsatzTV.Core.Tests.csproj | 4 ---
ErsatzTV.Core/ErsatzTV.Core.csproj | 4 ---
.../HardwareCapabilitiesFactory.cs | 8 +++---
ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj | 1 +
.../ErsatzTV.Infrastructure.Tests.csproj | 2 +-
.../ErsatzTV.Infrastructure.csproj | 4 ---
ErsatzTV/ErsatzTV.csproj | 4 ---
10 files changed, 46 insertions(+), 25 deletions(-)
create mode 100644 Directory.Build.targets
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 9cafba33f..3e4490a6a 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -2,6 +2,31 @@
on:
pull_request:
jobs:
+ build_and_analyze:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Get the sources
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ submodules: true
+
+ - name: Setup dotnet
+ uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '10.0.x'
+
+ - name: Clean
+ run: dotnet clean --configuration Release && dotnet nuget locals all --clear
+
+ - name: Install dependencies
+ run: dotnet restore
+
+ - name: Prep project file
+ run: sed -i '/Scanner/d' ErsatzTV/ErsatzTV.csproj
+
+ - name: Build
+ run: dotnet build --configuration Release --no-restore /p:EnableThreadingAnalyzers=true
build_and_test_windows:
runs-on: windows-latest
steps:
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 000000000..2e906ed8e
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,15 @@
+
+
+ false
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
diff --git a/ErsatzTV.Application/ErsatzTV.Application.csproj b/ErsatzTV.Application/ErsatzTV.Application.csproj
index bd8d54c51..ebf56b274 100644
--- a/ErsatzTV.Application/ErsatzTV.Application.csproj
+++ b/ErsatzTV.Application/ErsatzTV.Application.csproj
@@ -16,10 +16,6 @@
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
diff --git a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj
index 3c94325d5..59c0352ce 100644
--- a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj
+++ b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj
@@ -16,10 +16,6 @@
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
diff --git a/ErsatzTV.Core/ErsatzTV.Core.csproj b/ErsatzTV.Core/ErsatzTV.Core.csproj
index 8b66bbf6b..da5ae0985 100644
--- a/ErsatzTV.Core/ErsatzTV.Core.csproj
+++ b/ErsatzTV.Core/ErsatzTV.Core.csproj
@@ -22,10 +22,6 @@
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
diff --git a/ErsatzTV.FFmpeg/Capabilities/HardwareCapabilitiesFactory.cs b/ErsatzTV.FFmpeg/Capabilities/HardwareCapabilitiesFactory.cs
index 150ef1f7b..f7c72f817 100644
--- a/ErsatzTV.FFmpeg/Capabilities/HardwareCapabilitiesFactory.cs
+++ b/ErsatzTV.FFmpeg/Capabilities/HardwareCapabilitiesFactory.cs
@@ -471,9 +471,9 @@ public partial class HardwareCapabilitiesFactory(
return new NoHardwareCapabilities();
}
- string display = vaapiDisplay.IfNone("drm");
- string driver = vaapiDriver.IfNone(string.Empty);
- string device = vaapiDevice.IfNone(string.Empty);
+ string display = await vaapiDisplay.IfNoneAsync("drm");
+ string driver = await vaapiDriver.IfNoneAsync(string.Empty);
+ string device = await vaapiDevice.IfNoneAsync(string.Empty);
string generation = string.Empty;
var cacheKey = string.Format(CultureInfo.InvariantCulture, VaapiCacheKeyFormat, display, driver, device);
var generationCacheKey = string.Format(
@@ -557,7 +557,7 @@ public partial class HardwareCapabilitiesFactory(
return new NoHardwareCapabilities();
}
- string device = qsvDevice.IfNone(string.Empty);
+ string device = await qsvDevice.IfNoneAsync(string.Empty);
var cacheKey = string.Format(CultureInfo.InvariantCulture, QsvCacheKeyFormat, device);
if (memoryCache.TryGetValue(cacheKey, out List? profileEntrypoints) &&
diff --git a/ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj b/ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj
index a406a29fc..9eb38f718 100644
--- a/ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj
+++ b/ErsatzTV.FFmpeg/ErsatzTV.FFmpeg.csproj
@@ -7,6 +7,7 @@
latest-Recommended
true
true
+ VSTHRD200
diff --git a/ErsatzTV.Infrastructure.Tests/ErsatzTV.Infrastructure.Tests.csproj b/ErsatzTV.Infrastructure.Tests/ErsatzTV.Infrastructure.Tests.csproj
index f9d32ec96..8fee18a65 100644
--- a/ErsatzTV.Infrastructure.Tests/ErsatzTV.Infrastructure.Tests.csproj
+++ b/ErsatzTV.Infrastructure.Tests/ErsatzTV.Infrastructure.Tests.csproj
@@ -4,7 +4,7 @@
net10.0
enable
enable
-
+ VSTHRD200
false
diff --git a/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj b/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj
index bda4d13e4..f9a8c1c2a 100644
--- a/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj
+++ b/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj
@@ -29,10 +29,6 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-
diff --git a/ErsatzTV/ErsatzTV.csproj b/ErsatzTV/ErsatzTV.csproj
index aaee4b7dd..152dc9de8 100644
--- a/ErsatzTV/ErsatzTV.csproj
+++ b/ErsatzTV/ErsatzTV.csproj
@@ -52,10 +52,6 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
- all
- runtime; build; native; contentfiles; analyzers; buildtransitive
-