Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add XMLDoc comments on public PackageExtractor methods #6095

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 69 additions & 1 deletion src/NuGet.Core/NuGet.Packaging/PackageExtractor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ namespace NuGet.Packaging
{
public static class PackageExtractor
{
/// <summary>
/// Extracts a package, using the packages.config directory layout
/// </summary>
/// <remarks>For PackageReference directory layout, use <see cref="PackageExtractor.InstallFromSourceAsync(string, PackageIdentity, Func{Stream, Task}, VersionFolderPathResolver, PackageExtractionContext, CancellationToken, Guid)"/></remarks>
/// <param name="source">The source from which the package was downloaded</param>
/// <param name="packageStream">A <see cref="Stream"/> for the nupkg file that is being extracted.</param>
/// <param name="packagePathResolver">The V2 (packages.config) <see cref="PackagePathResolver"/>.</param>
/// <param name="packageExtractionContext">The <see cref="PackageExtractionContext"/> with settings for how the extraction should be configured.</param>
/// <param name="token">A cancellation token.</param>
/// <param name="parentId">Telemetry parent ID.</param>
/// <returns>A collection of files that were extracted.</returns>
/// <exception cref="ArgumentNullException">If packageReader, packagePathResolver, or packageExtractionContext are null.</exception>
zivkan marked this conversation as resolved.
Show resolved Hide resolved
/// <exception cref="ArgumentException">If packageStream is not seekable.</exception>
/// <exception cref="SignatureException">If the package signature couldn't be validated. See exception message for more details.</exception>
public static async Task<IEnumerable<string>> ExtractPackageAsync(
string source,
Stream packageStream,
Expand Down Expand Up @@ -140,6 +154,21 @@ await VerifyPackageSignatureAsync(
}
}

/// <summary>
/// Extracts a package, using the packages.config directory layout
/// </summary>
/// <remarks>For PackageReference directory layout, use <see cref="PackageExtractor.InstallFromSourceAsync(string, PackageIdentity, Func{Stream, Task}, VersionFolderPathResolver, PackageExtractionContext, CancellationToken, Guid)"/></remarks>
/// <param name="source">The source from which the package was downloaded</param>
/// <param name="packageReader">A <see cref="PackageReaderBase"/> with the package opened.</param>
/// <param name="packageStream">A <see cref="Stream"/> for the nupkg file that is being extracted.</param>
/// <param name="packagePathResolver">The V2 (packages.config) <see cref="PackagePathResolver"/>.</param>
/// <param name="packageExtractionContext">The <see cref="PackageExtractionContext"/> with settings for how the extraction should be configured.</param>
/// <param name="token">A cancellation token.</param>
/// <param name="parentId">Telemetry parent ID.</param>
/// <returns>A collection of files that were extracted.</returns>
/// <exception cref="ArgumentNullException">If packageReader, packagePathResolver, or packageExtractionContext are null.</exception>
/// <exception cref="ArgumentException">If packagestream is not seekable.</exception>
/// <exception cref="SignatureException">If the package signature couldn't be validated. See exception message for more details.</exception>
public static async Task<IEnumerable<string>> ExtractPackageAsync(
string source,
PackageReaderBase packageReader,
Expand Down Expand Up @@ -241,6 +270,19 @@ await VerifyPackageSignatureAsync(
}
}

/// <summary>
/// Extracts a package, using the packages.config directory layout
/// </summary>
/// <remarks>For PackageReference directory layout, use <see cref="PackageExtractor.InstallFromSourceAsync(string, PackageIdentity, Func{Stream, Task}, VersionFolderPathResolver, PackageExtractionContext, CancellationToken, Guid)"/></remarks>
/// <param name="source">The source from which the package was downloaded</param>
/// <param name="packageReader">A <see cref="PackageReaderBase"/> with the package opened.</param>
/// <param name="packagePathResolver">The V2 (packages.config) <see cref="PackagePathResolver"/>.</param>
/// <param name="packageExtractionContext">The <see cref="PackageExtractionContext"/> with settings for how the extraction should be configured.</param>
/// <param name="token">A cancellation token.</param>
/// <param name="parentId">Telemetry parent ID.</param>
/// <returns>A collection of files that were extracted.</returns>
/// <exception cref="ArgumentNullException">If packageReader, packagePathResolver, or packageExtractionContext are null.</exception>
/// <exception cref="SignatureException">If the package signature couldn't be validated. See exception message for more details.</exception>
public static async Task<IEnumerable<string>> ExtractPackageAsync(
string source,
PackageReaderBase packageReader,
Expand Down Expand Up @@ -336,20 +378,26 @@ await VerifyPackageSignatureAsync(
}

/// <summary>
/// Uses a copy function to install a package to a global packages directory.
/// Uses a copy function to install a package to a global packages directory with the PackageReference directory layout.
/// </summary>
/// <param name="source">The source where the nupkg was downloaded from.</param>
/// <param name="packageIdentity">The package id + version being installed.</param>
/// <param name="copyToAsync">
/// A function which should copy the package to the provided destination stream.
/// </param>
/// <param name="versionFolderPathResolver">The path resolver for PackageReference layout.</param>
/// <param name="packageExtractionContext">
/// The version folder path context, which encapsulates all of the parameters to observe
/// while installing the package.
/// </param>
/// <param name="token">The cancellation token.</param>
/// <param name="parentId">The telemetry parent ID.</param>
/// <returns>
/// True if the package was installed. False if the package already exists and therefore
/// resulted in no copy operation.
/// </returns>
/// <exception cref="ArgumentNullException">If copyToAsync or packageExtractionContext is null.</exception>
/// <exception cref="SignatureException">If the package signature couldn't be validated. See exception message for more details.</exception>
public static async Task<bool> InstallFromSourceAsync(
string source,
PackageIdentity packageIdentity,
Expand Down Expand Up @@ -592,6 +640,26 @@ private static void DeleteTargetAndTempPaths(string targetPath, string targetTem
}
}

/// <summary>
/// Uses a copy function to install a package to a global packages directory with the PackageReference directory layout.
/// </summary>
/// <param name="packageIdentity">The package id + version being installed.</param>
/// <param name="packageDownloader">
/// A <see cref="IPackageDownloader"/> to download the nupkg.
/// </param>
/// <param name="versionFolderPathResolver">The path resolver for PackageReference layout.</param>
/// <param name="packageExtractionContext">
/// The version folder path context, which encapsulates all of the parameters to observe
/// while installing the package.
/// </param>
/// <param name="token">The cancellation token.</param>
/// <param name="parentId">The telemetry parent ID.</param>
/// <returns>
/// True if the package was installed. False if the package already exists and therefore
/// resulted in no copy operation.
/// </returns>
/// <exception cref="ArgumentNullException">If packageDownlaoder or packageExtractionContext is null.</exception>
/// <exception cref="SignatureException">If the package signature couldn't be validated. See exception message for more details.</exception>
public static async Task<bool> InstallFromSourceAsync(
PackageIdentity packageIdentity,
IPackageDownloader packageDownloader,
Expand Down
3 changes: 2 additions & 1 deletion src/NuGet.Core/NuGet.Packaging/PackagePathResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public class PackagePathResolver
public bool UseSideBySidePaths { get; }

/// <summary>
/// Initializes a new instance of the <see cref="PackagePathResolver"/> class.
/// Initializes a new instance of the <see cref="PackagePathResolver"/> class, which calculates packages.config style package directory layouts.
/// </summary>
/// <remarks>See <see cref="VersionFolderPathResolver"/> for PackageReference and global packages folder layouts.</remarks>
/// <param name="rootDirectory">The root directory.</param>
/// <param name="useSideBySidePaths">A value indicating whether to use side-by-side paths.</param>
/// <exception cref="System.ArgumentException">If rootDirectory is null, empty or does not contain an absolute path. </exception>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace NuGet.Packaging
{
/// <summary>
/// A V3 path resolver.
/// A path resolver to calculate package paths for PackageReference (Global Packages Folder) style directory layouts.
/// </summary>
public class VersionFolderPathResolver
{
Expand Down
Loading