Skip to content

Commit

Permalink
C#: Relax dotnet rule.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnebel committed Sep 30, 2024
1 parent 6f74387 commit e8f244b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion csharp/autobuilder/Semmle.Autobuild.CSharp/DotNetRule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public BuildScript Analyse(IAutobuilder<CSharpAutobuildOptions> builder, bool au
NotDotNetProjects = builder.ProjectsOrSolutionsToBuild
.SelectMany(p => new[] { p }.Concat(p.IncludedProjects))
.OfType<Project<CSharpAutobuildOptions>>()
.Where(p => !p.DotNetProject);
.Where(p => !p.MaybeDotNetProject);
var notDotNetProject = NotDotNetProjects.FirstOrDefault();

if (notDotNetProject is not null)
Expand Down
8 changes: 6 additions & 2 deletions csharp/autobuilder/Semmle.Autobuild.Shared/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class Project<TAutobuildOptions> : ProjectOrSolution<TAutobuildOptions> w
/// <summary>
/// Holds if this project is for .Net core.
/// </summary>
public bool DotNetProject { get; private set; }
public bool MaybeDotNetProject { get; init; }

public bool ValidToolsVersion { get; private set; }

Expand All @@ -32,7 +32,11 @@ public Project(Autobuilder<TAutobuildOptions> builder, string path) : base(build
includedProjectsLazy = new Lazy<List<Project<TAutobuildOptions>>>(() => new List<Project<TAutobuildOptions>>());

if (!builder.Actions.FileExists(FullPath))
{
// We can't out-rule that this is a dotnet project.
MaybeDotNetProject = true;
return;
}

XmlDocument projFile;
try
Expand All @@ -51,7 +55,7 @@ public Project(Autobuilder<TAutobuildOptions> builder, string path) : base(build
{
if (root.HasAttribute("Sdk"))
{
DotNetProject = true;
MaybeDotNetProject = true;
return;
}

Expand Down

0 comments on commit e8f244b

Please sign in to comment.