From e8f244be3adbafd135939de209c02c558b90393a Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Thu, 20 Jun 2024 11:56:07 +0200 Subject: [PATCH] C#: Relax dotnet rule. --- csharp/autobuilder/Semmle.Autobuild.CSharp/DotNetRule.cs | 2 +- csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/csharp/autobuilder/Semmle.Autobuild.CSharp/DotNetRule.cs b/csharp/autobuilder/Semmle.Autobuild.CSharp/DotNetRule.cs index 43efcd0352f0..7224a8ff76b9 100644 --- a/csharp/autobuilder/Semmle.Autobuild.CSharp/DotNetRule.cs +++ b/csharp/autobuilder/Semmle.Autobuild.CSharp/DotNetRule.cs @@ -32,7 +32,7 @@ public BuildScript Analyse(IAutobuilder builder, bool au NotDotNetProjects = builder.ProjectsOrSolutionsToBuild .SelectMany(p => new[] { p }.Concat(p.IncludedProjects)) .OfType>() - .Where(p => !p.DotNetProject); + .Where(p => !p.MaybeDotNetProject); var notDotNetProject = NotDotNetProjects.FirstOrDefault(); if (notDotNetProject is not null) diff --git a/csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs b/csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs index c318ef09805d..0e95070ab357 100644 --- a/csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs +++ b/csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs @@ -17,7 +17,7 @@ public class Project : ProjectOrSolution w /// /// Holds if this project is for .Net core. /// - public bool DotNetProject { get; private set; } + public bool MaybeDotNetProject { get; init; } public bool ValidToolsVersion { get; private set; } @@ -32,7 +32,11 @@ public Project(Autobuilder builder, string path) : base(build includedProjectsLazy = new Lazy>>(() => new List>()); if (!builder.Actions.FileExists(FullPath)) + { + // We can't out-rule that this is a dotnet project. + MaybeDotNetProject = true; return; + } XmlDocument projFile; try @@ -51,7 +55,7 @@ public Project(Autobuilder builder, string path) : base(build { if (root.HasAttribute("Sdk")) { - DotNetProject = true; + MaybeDotNetProject = true; return; }