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
Changes from 1 commit
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
61 changes: 60 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,18 @@ 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
public static async Task<IEnumerable<string>> ExtractPackageAsync(
string source,
Stream packageStream,
Expand Down Expand Up @@ -140,6 +152,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="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>
public static async Task<IEnumerable<string>> ExtractPackageAsync(
string source,
PackageReaderBase packageReader,
Expand Down Expand Up @@ -241,6 +266,18 @@ 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>
public static async Task<IEnumerable<string>> ExtractPackageAsync(
string source,
PackageReaderBase packageReader,
Expand Down Expand Up @@ -336,16 +373,20 @@ 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.
Expand Down Expand Up @@ -592,6 +633,24 @@ 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>
public static async Task<bool> InstallFromSourceAsync(
PackageIdentity packageIdentity,
IPackageDownloader packageDownloader,
Expand Down