File: Generated\Basic.CompilerLog.Util\Basic.CompilerLog.Util.Impl.BasicGeneratedFilesAnalyzerReference\CacheFormat.g.cs
Project: Microsoft.NET.ProjectData.Tasks.csproj (Microsoft.NET.ProjectData.Tasks)
// <auto-generated/>
// Generated from project-data-schema.json by DataModelSchemaGenerator.

using System.Collections.Generic;

namespace Microsoft.NET.ProjectData.Tasks;

/// <summary>
/// Wire-format tokens for the on-disk <c>.lscache</c> file. Shared by the writer
/// (<c>Microsoft.NET.ProjectData.Tasks</c>) and the reader
/// (<c>Microsoft.NET.ProjectData</c>) so renames cannot silently drop a section.
/// </summary>
internal static class CacheFormat
{
	public const string VersionHeader = "version=2.2";
	public const string HashHeaderPrefix = "hash=";
	public const string SliceSeparator = "---";
	public const string SectionOpen = "[";
	public const string SectionClose = "]";
	public const char CommentChar = '#';
	public const string ProjectHeaderPrefix = "project=";
	public const string LanguagePrefix = "language=";
	public const string PrimaryMarker = "primary";
	public const string LastDtbSucceededMarker = "lastDtbSucceeded";

	/// <summary>Section names emitted as <c>[name]</c> by the writer and matched without brackets by the reader.</summary>
	public static class Sections
	{
		/// <summary>Project identity, language, and slice markers.</summary>
		public const string Project = "project";
		/// <summary>Per-slice dimensions (e.g., TargetFramework=net10.0).</summary>
		public const string SliceDimensions = "sliceDimensions";
		/// <summary>MSBuild properties evaluated for the project/slice.</summary>
		public const string Properties = "properties";
		/// <summary>Compiler command-line arguments in evaluation order.</summary>
		public const string CommandLineArguments = "commandLineArguments";
		/// <summary>Source files in the @(Compile) item set.</summary>
		public const string SourceFiles = "sourceFiles";
		/// <summary>Assembly references (@(MetadataReference)) with optional aliases/embedInteropTypes.</summary>
		public const string MetadataReferences = "metadataReferences";
		/// <summary>Roslyn analyzer assemblies (@(AnalyzerReference)).</summary>
		public const string AnalyzerReferences = "analyzerReferences";
		/// <summary>EditorConfig / global analyzer config files.</summary>
		public const string AnalyzerConfigFiles = "analyzerConfigFiles";
		/// <summary>Files passed to analyzers via @(AdditionalFile).</summary>
		public const string AdditionalFiles = "additionalFiles";
		/// <summary>Resolved project-to-project references.</summary>
		public const string ProjectReferences = "projectReferences";
		/// <summary>Embedded resource files (.resx, etc.) with optional Generator/LastGenOutput/CustomToolNamespace metadata.</summary>
		public const string EmbeddedResources = "embeddedResources";
		/// <summary>Project capabilities flags.</summary>
		public const string Capabilities = "capabilities";
		/// <summary>Ref-pack names (e.g. Microsoft.NETCore.App.Ref); reader probes the SDK install first, then the NuGet cache, so the same cache works whether the writing machine resolved the pack from &lt;DOTNET&gt;/packs/ or from &lt;NUGET&gt;/.</summary>
		public const string FrameworkPacks = "frameworkPacks";
		/// <summary>SDK-shipped analyzer NuGet package IDs; reader enumerates analyzers/dotnet/&lt;lang&gt;/ on disk.</summary>
		public const string SdkAnalyzerPacks = "sdkAnalyzerPacks";
		/// <summary>Policy entries for SDK-shipped analyzer config files; reader resolves them under the bound SDK.</summary>
		public const string SdkAnalyzerConfigPolicy = "sdkAnalyzerConfigPolicy";

		public static readonly string[] All = ["project", "sliceDimensions", "properties", "commandLineArguments", "sourceFiles", "metadataReferences", "analyzerReferences", "analyzerConfigFiles", "additionalFiles", "projectReferences", "embeddedResources", "capabilities", "frameworkPacks", "sdkAnalyzerPacks", "sdkAnalyzerConfigPolicy"];

		/// <summary>
		/// Item <c>@metadata</c> keys the writer can emit, keyed by the WIRE section that carries
		/// them (resolved through the section's <c>itemType</c> link in the schema). Used by
		/// forward-compatibility preservation to judge "known" metadata <em>per section</em>, so a
		/// newer writer that reuses an existing metadata name on a different item type is still
		/// preserved rather than mistaken for regenerable data. Only sections whose item type
		/// emits metadata appear here; a section absent from the map emits no metadata.
		/// </summary>
		public static readonly Dictionary<string, string[]> MetadataBySection = new(System.StringComparer.Ordinal)
		{
			["sourceFiles"] = ["Link"],
			["metadataReferences"] = ["aliases", "embedInteropTypes"],
			["projectReferences"] = ["ReferenceOutputAssembly"],
			["embeddedResources"] = ["Generator", "LastGenOutput", "CustomToolNamespace"],
		};
	}

	/// <summary>Returns <paramref name="name"/> wrapped in section delimiters, e.g. <c>[sourceFiles]</c>.</summary>
	public static string SectionHeader(string name) => SectionOpen + name + SectionClose;
}