mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
When determining the target of `msbuild` or `dotnet build`, first look for `.proj` files, then `.sln` files, and finally `.csproj`/`.vcxproj` files. In all three cases, choose the project/solution file closest to the root.
22 lines
629 B
C#
22 lines
629 B
C#
namespace Semmle.Autobuild
|
|
{
|
|
public sealed class Language
|
|
{
|
|
public static readonly Language Cpp = new Language(".vcxproj");
|
|
public static readonly Language CSharp = new Language(".csproj");
|
|
|
|
public bool ProjectFileHasThisLanguage(string path) =>
|
|
System.IO.Path.GetExtension(path) == ProjectExtension;
|
|
|
|
public readonly string ProjectExtension;
|
|
|
|
private Language(string extension)
|
|
{
|
|
ProjectExtension = extension;
|
|
}
|
|
|
|
public override string ToString() =>
|
|
ProjectExtension == Cpp.ProjectExtension ? "C/C++" : "C#";
|
|
}
|
|
}
|