-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.This issue involves adding, removing, clarification, or modification of an API.Feature Requestapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implemented
Description
Background and Motivation
In order to track changes to manifest resources during Hot Reload the IDE/dotnet-watch need to be able to retrieve resource specification from parsed command line (/resource argument).
Currently the compiler does not expose the information, it only exposes opaque ResourceDescription type that can be used for emitting.
Implemented in #78679
Proposed API
namespace Microsoft.CodeAnalysis;
public abstract class CommandLineArguments
{
/// <summary>
/// Resources specified as arguments to the compilation.
/// </summary>
public ImmutableArray<ResourceDescription> ManifestResources { get; }
+ /// <summary>
+ /// Manifest resource information parsed from <c>/resource</c> arguments.
+ /// </summary>
+ public ImmutableArray<CommandLineResource> ManifestResourceArguments { get; }
}
+/// <summary>
+/// Describes a manifest resource specification stored in command line arguments.
+/// </summary>
+public readonly struct CommandLineResource
+{
+ /// <summary>
+ /// Name of the manifest resource as it appears in metadata.
+ /// </summary>
+ public string ResourceName { get; }
+
+ /// <summary>
+ /// Full path to the resource content file.
+ /// </summary>
+ public string FullPath { get; }
+
+ /// <summary>
+ /// Accessibility of the resource.
+ /// </summary>
+ public bool IsPublic { get; }
+
+ /// <summary>
+ /// File name of a linked resource, or null if the resource is embedded.
+ /// </summary>
+ public string? LinkedResourceFileName { get; }
+
+ /// <summary>
+ /// True if the resource is embedded.
+ /// </summary>
+ public bool IsEmbedded { get; }
+
+ /// <summary>
+ /// True if the resource is linked.
+ /// </summary>
+ [MemberNotNullWhen(true, nameof(LinkedResourceFileName))]
+ public bool IsLinked { get; }
+
+ /// <summary>
+ /// Creates <see cref="ResourceDescription"/> for this resource.
+ /// </summary>
+ public ResourceDescription ToDescription();
+}Usage Examples
Alternative Designs
Risks
Metadata
Metadata
Assignees
Labels
Area-CompilersConcept-APIThis issue involves adding, removing, clarification, or modification of an API.This issue involves adding, removing, clarification, or modification of an API.Feature Requestapi-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implemented