Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public InstallRequest(string identifier, string? version = null, string? install
/// <summary>
/// Name to be used when display the request.
/// </summary>
public string DisplayName => string.IsNullOrWhiteSpace(Version) ? PackageIdentifier : $"{PackageIdentifier}::{Version}";
public string DisplayName => string.IsNullOrWhiteSpace(Version) ? PackageIdentifier : $"{PackageIdentifier}@{Version}";

/// <summary>
/// Installer to be used to install the request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ namespace Microsoft.TemplateEngine.Edge.Installers.NuGet
{
internal class DownloadException : Exception
{
public DownloadException(string packageIdentifier, string packageVersion, string filePath) : base($"Failed to download {packageIdentifier}::{packageVersion} from {filePath}")
public DownloadException(string packageIdentifier, string packageVersion, string filePath) : base($"Failed to download {packageIdentifier}@{packageVersion} from {filePath}")
{
PackageIdentifier = packageIdentifier;
PackageVersion = packageVersion;
PackageLocation = filePath;
}

public DownloadException(string packageIdentifier, string packageVersion, IEnumerable<string> attemptedSources) : base($"Failed to download {packageIdentifier}::{packageVersion} from NuGet feeds {string.Join(";", attemptedSources)}")
public DownloadException(string packageIdentifier, string packageVersion, IEnumerable<string> attemptedSources) : base($"Failed to download {packageIdentifier}@{packageVersion} from NuGet feeds {string.Join(";", attemptedSources)}")
{
PackageIdentifier = packageIdentifier;
PackageVersion = packageVersion;
SourcesList = attemptedSources;
}

public DownloadException(string packageIdentifier, string packageVersion, IEnumerable<string> attemptedSources, Exception inner) : base($"Failed to download {packageIdentifier}::{packageVersion} from NuGet feeds {string.Join(";", attemptedSources)}", inner)
public DownloadException(string packageIdentifier, string packageVersion, IEnumerable<string> attemptedSources, Exception inner) : base($"Failed to download {packageIdentifier}@{packageVersion} from NuGet feeds {string.Join(";", attemptedSources)}", inner)
{
PackageIdentifier = packageIdentifier;
PackageVersion = packageVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class PackageNotFoundException : Exception
SourcesList = attemptedSources;
}

public PackageNotFoundException(string packageIdentifier, NuGetVersion packageVersion, IEnumerable<string> attemptedSources) : base($"{packageIdentifier}::{packageVersion} was not found in NuGet feeds {string.Join(";", attemptedSources)}")
public PackageNotFoundException(string packageIdentifier, NuGetVersion packageVersion, IEnumerable<string> attemptedSources) : base($"{packageIdentifier}@{packageVersion} was not found in NuGet feeds {string.Join(";", attemptedSources)}")
{
PackageIdentifier = packageIdentifier;
PackageVersion = packageVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private NuGetManagedTemplatePackage(

public IManagedTemplatePackageProvider ManagedProvider { get; }

public string DisplayName => string.IsNullOrWhiteSpace(Version) ? Identifier : $"{Identifier}::{Version}";
public string DisplayName => string.IsNullOrWhiteSpace(Version) ? Identifier : $"{Identifier}@{Version}";

public string Identifier => Details[PackageIdKey];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ await GetLatestVersionInternalAsync(
_nugetLogger.LogWarning(
string.Format(
LocalizableStrings.NuGetApiPackageManager_Warning_FailedToDownload,
$"{packageMetadata.Identity.Id}::{packageMetadata.Identity.Version}",
$"{packageMetadata.Identity.Id}@{packageMetadata.Identity.Version}",
source.Source));
try
{
Expand All @@ -159,7 +159,7 @@ await GetLatestVersionInternalAsync(
_nugetLogger.LogWarning(
string.Format(
LocalizableStrings.NuGetApiPackageManager_Warning_FailedToDownload,
$"{packageMetadata.Identity.Id}::{packageMetadata.Identity.Version}",
$"{packageMetadata.Identity.Id}@{packageMetadata.Identity.Version}",
source.Source));
_nugetLogger.LogDebug($"Details: {e}.");
try
Expand Down Expand Up @@ -335,13 +335,13 @@ await Task.WhenAll(
NugetPackageMetadata? matchedVersion = foundPackages.FirstOrDefault(package => package.Identity.Version == packageVersion);
if (matchedVersion != null)
{
_nugetLogger.LogDebug($"{packageIdentifier}::{packageVersion} was found in {foundSource.Source}.");
_nugetLogger.LogDebug($"{packageIdentifier}@{packageVersion} was found in {foundSource.Source}.");
linkedCts.Cancel();
return (foundSource, matchedVersion);
}
else
{
_nugetLogger.LogDebug($"{packageIdentifier}::{packageVersion} is not found in NuGet feed {foundSource.Source}.");
_nugetLogger.LogDebug($"{packageIdentifier}@{packageVersion} is not found in NuGet feed {foundSource.Source}.");
}
}
if (!atLeastOneSourceValid)
Expand All @@ -351,7 +351,7 @@ await Task.WhenAll(
_nugetLogger.LogWarning(
string.Format(
LocalizableStrings.NuGetApiPackageManager_Warning_PackageNotFound,
$"{packageIdentifier}::{packageVersion}",
$"{packageIdentifier}@{packageVersion}",
string.Join(", ", sources.Select(source => source.Source))));
throw new PackageNotFoundException(packageIdentifier, packageVersion, sources.Select(source => source.Source));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public async Task Install_LocalPackage()
source.Owners.Should().BeNull();
source.Reserved.Should().Be("False");
source.Version.Should().NotBeNullOrEmpty();
source.DisplayName.Should().StartWith("Microsoft.TemplateEngine.TestTemplates::");
source.DisplayName.Should().StartWith("Microsoft.TemplateEngine.TestTemplates@");
source.Identifier.Should().Be("Microsoft.TemplateEngine.TestTemplates");
source.Installer.Should().Be(installer);
source.IsLocalPackage.Should().Be(true);
Expand Down Expand Up @@ -239,7 +239,7 @@ public async Task Install_RemotePackage()
source.Owners.Should().Be("Microsoft");
source.Reserved.Should().Be("True");
source.Version.Should().Be("1.0.0");
source.DisplayName.Should().Be("Microsoft.TemplateEngine.TestTemplates::1.0.0");
source.DisplayName.Should().Be("Microsoft.TemplateEngine.TestTemplates@1.0.0");
source.Identifier.Should().Be("Microsoft.TemplateEngine.TestTemplates");
source.Installer.Should().Be(installer);
source.IsLocalPackage.Should().Be(false);
Expand Down Expand Up @@ -447,7 +447,7 @@ public async Task Update_RemotePackage()
updatedSource!.MountPointUri.Should().ContainAll(new[] { installPath, "Microsoft.TemplateEngine.TestTemplates" });
updatedSource.Author.Should().Be("Microsoft");
updatedSource.Version.Should().Be("1.0.1");
updatedSource.DisplayName.Should().Be("Microsoft.TemplateEngine.TestTemplates::1.0.1");
updatedSource.DisplayName.Should().Be("Microsoft.TemplateEngine.TestTemplates@1.0.1");
updatedSource.Identifier.Should().Be("Microsoft.TemplateEngine.TestTemplates");
updatedSource.Installer.Should().Be(installer);
updatedSource.IsLocalPackage.Should().Be(false);
Expand Down Expand Up @@ -514,7 +514,7 @@ public void Deserialize(
source.Reserved.Should().Be(reserved);
source.Owners.Should().Be(owners);
source.Version.Should().Be(version);
source.DisplayName.Should().Be($"{identifier}::{version}");
source.DisplayName.Should().Be($"{identifier}@{version}");
source.Identifier.Should().Be(identifier);
source.Installer.Should().Be(installer);
source.IsLocalPackage.Should().Be(local);
Expand Down
6 changes: 3 additions & 3 deletions test/Microsoft.TemplateEngine.TestHelper/PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ internal async Task<string> DownloadPackageAsync(
}
else
{
_nugetLogger.LogDebug($"[NuGet Package Manager] Getting package metadata {identifier}::{version}.");
_nugetLogger.LogDebug($"[NuGet Package Manager] Getting package metadata {identifier}@{version}.");
packageVersion = new NuGetVersion(version!);
(source, packageMetadata) = await GetPackageMetadataAsync(identifier, packageVersion, packagesSources, cancellationToken);
}
Expand Down Expand Up @@ -284,7 +284,7 @@ await Task.WhenAll(

return current.package.Identity.Version > max.package.Identity.Version ? current : max;
});
_nugetLogger.LogDebug($"[NuGet Package Manager] Latest version is {latestVersion.Item2.Identity.Id}::{latestVersion.Item2.Identity.Version}, source: {latestVersion.Item1.Source}.");
_nugetLogger.LogDebug($"[NuGet Package Manager] Latest version is {latestVersion.Item2.Identity.Id}@{latestVersion.Item2.Identity.Version}, source: {latestVersion.Item1.Source}.");
return latestVersion;
}

Expand Down Expand Up @@ -321,7 +321,7 @@ await Task.WhenAll(
IPackageSearchMetadata? matchedVersion = foundPackages!.FirstOrDefault(package => package.Identity.Version == packageVersion);
if (matchedVersion != null)
{
_nugetLogger.LogDebug($"[NuGet Package Manager] Processed source {foundSource.Source}, found {matchedVersion.Identity.Id}:: {matchedVersion.Identity.Version} package, cancelling other tasks.");
_nugetLogger.LogDebug($"[NuGet Package Manager] Processed source {foundSource.Source}, found {matchedVersion.Identity.Id}@{matchedVersion.Identity.Version} package, cancelling other tasks.");
linkedCts.Cancel();
return (foundSource, matchedVersion);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public async Task CanDetectNewPackagesInDiffMode()
.And.HaveStdOutContaining(
@"Template packages:
new: 1
Test.Templates::1.0.0
Test.Templates@1.0.0
updated: 0
removed: 0
not changed: 0")
Expand Down Expand Up @@ -231,7 +231,7 @@ public async Task CanDetectNewPackagesInDiffMode()
.And.HaveStdOutContaining(
@"Template packages:
new: 1
Microsoft.Azure.WebJobs.ProjectTemplates::1.0.0
Microsoft.Azure.WebJobs.ProjectTemplates@1.0.0
updated: 0
removed: 0
not changed: 1")
Expand Down Expand Up @@ -278,7 +278,7 @@ public void CanDetectUpdatedPackagesInDiffMode()
.And.HaveStdOutContaining(
@"Template packages:
new: 1
Test.Templates::1.0.0
Test.Templates@1.0.0
updated: 0
removed: 0
not changed: 0")
Expand Down Expand Up @@ -365,7 +365,7 @@ public void CanDetectRemovedPackagesInDiffMode()
.And.HaveStdOutContaining(
@"Template packages:
new: 1
Test.Templates::1.0.0
Test.Templates@1.0.0
updated: 0
removed: 0
not changed: 0")
Expand Down Expand Up @@ -406,7 +406,7 @@ public void CanDetectRemovedPackagesInDiffMode()
new: 0
updated: 0
removed: 1
Test.Templates::1.0.0
Test.Templates@1.0.0
not changed: 0")
.And.HaveStdOutContaining(
@"Non template packages:
Expand All @@ -416,7 +416,7 @@ public void CanDetectRemovedPackagesInDiffMode()
not changed: 0")
.And.HaveStdOutContaining(
@"[Error]: the following 1 packages were removed
Test.Templates::1.0.0
Test.Templates@1.0.0
Checking template packages via API:
Package Test.Templates was unlisted.");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal static class AdditionalDataExtensions
}
catch (Exception ex)
{
Verbose.WriteLine($"Failed to produce additional data for {package.Name}::{package.Version} with producer {producer.DataUniqueName}, details: {ex}");
Verbose.WriteLine($"Failed to produce additional data for {package.Name}@{package.Version} with producer {producer.DataUniqueName}, details: {ex}");
}
}
if (additionalData.Any())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private async Task ProcessTemplatePackagesUsingSearchAsync(
count = ProcessCount(count);
if (newCache.ContainsKey(sourceInfo.Name) || filteredPackages.ContainsKey(sourceInfo.Name))
{
Verbose.WriteLine($"Package {sourceInfo.Name}::{sourceInfo.Version} is already processed.");
Verbose.WriteLine($"Package {sourceInfo.Name}@{sourceInfo.Version} is already processed.");
continue;
}
string? oldTemplateVersion = null;
Expand Down Expand Up @@ -209,7 +209,7 @@ private async Task CheckRemovedPackagesAsync(
IDownloadedPackInfo? packInfo = await provider.DownloadPackageAsync(package, cancellationToken).ConfigureAwait(false);
if (packInfo == null)
{
Console.WriteLine($"[Error] Package {package.Name}::{package.Version} is not processed.");
Console.WriteLine($"[Error] Package {package.Name}@{package.Version} is not processed.");
continue;
}
if (CheckIfPackageIsFiltered(packInfo, filteredPackages, scanningStats, null, oldNonTemplateVersion))
Expand All @@ -233,7 +233,7 @@ private bool CheckIfVersionIsKnownTemplatePackage(
{
if (sourceInfo.Version == existingInfo.Version)
{
Verbose.WriteLine($"Package {sourceInfo.Name}::{sourceInfo.Version} has not changed since last scan, updating metadata only.");
Verbose.WriteLine($"Package {sourceInfo.Name}@{sourceInfo.Version} has not changed since last scan, updating metadata only.");
newCache[sourceInfo.Name] = new TemplatePackageSearchData(sourceInfo, existingInfo.Templates, sourceInfo.ProduceAdditionalData(_additionalDataProducers));

scanningStats.SameTemplatePacksCount++;
Expand All @@ -258,7 +258,7 @@ private bool CheckIfVersionIsKnownNonTemplatePackage(
{
if (sourceInfo.Version == info.Version)
{
Verbose.WriteLine($"Package {sourceInfo.Name}::{sourceInfo.Version} has not changed since last scan, skipping as it was filtered last time.");
Verbose.WriteLine($"Package {sourceInfo.Name}@{sourceInfo.Version} has not changed since last scan, skipping as it was filtered last time.");
filteredPackages[sourceInfo.Name] = info;
scanningStats.SameNonTemplatePacksCount++;
return true;
Expand Down Expand Up @@ -296,7 +296,7 @@ private async Task ProcessTemplatePackageAsync(
CancellationToken cancellationToken)
{
IEnumerable<TemplateSearchData> foundTemplates = await TryGetTemplatesInPackAsync(sourceInfo, _additionalDataProducers, cancellationToken).ConfigureAwait(false);
Verbose.WriteLine($"{sourceInfo.Name}::{sourceInfo.Version} is processed");
Verbose.WriteLine($"{sourceInfo.Name}@{sourceInfo.Version} is processed");
if (foundTemplates.Any())
{
Verbose.WriteLine("Found templates:");
Expand Down Expand Up @@ -346,7 +346,7 @@ private void ProcessNonTemplatePackage(
string? oldTemplatePackageVersion,
string? oldNonTemplatePackageVersion)
{
Verbose.WriteLine($"{sourceInfo.Name}::{sourceInfo.Version} is skipped, {filterReason}");
Verbose.WriteLine($"{sourceInfo.Name}@{sourceInfo.Version} is skipped, {filterReason}");
filteredPackages[sourceInfo.Name] = new FilteredPackageInfo(sourceInfo, filterReason);
if (string.IsNullOrWhiteSpace(oldNonTemplatePackageVersion))
{
Expand Down Expand Up @@ -396,7 +396,7 @@ private async Task<IEnumerable<TemplateSearchData>> TryGetTemplatesInPackAsync(I
}
catch (Exception ex)
{
Console.WriteLine("Failed to read package {0}::{1}, details: {2}. The package will be skipped.", packInfo.Name, packInfo.Version, ex);
Console.WriteLine("Failed to read package {0}@{1}, details: {2}. The package will be skipped.", packInfo.Name, packInfo.Version, ex);
return [];
}
}
Expand Down Expand Up @@ -428,15 +428,15 @@ private async Task<IEnumerable<TemplateSearchData>> TryGetTemplatesInPackAsync(I
Console.WriteLine($"[Error]: the following {removedTemplatePacks.Count} packages were removed");
foreach (var package in removedTemplatePacks)
{
Console.WriteLine($" {package.Name}::{package.Version}");
Console.WriteLine($" {package.Name}@{package.Version}");
}
}
if (removedNonTemplatePacks.Any())
{
Console.WriteLine($"[Error]: the following {removedNonTemplatePacks.Count} non template packages were removed");
foreach (var package in removedNonTemplatePacks)
{
Console.WriteLine($" {package.Name}::{package.Version}");
Console.WriteLine($" {package.Name}@{package.Version}");
}
}
return (removedTemplatePacks, removedNonTemplatePacks);
Expand All @@ -449,7 +449,7 @@ private void DisplayScanningStats(ScanningStats scanningStats)
Console.WriteLine($" new: {scanningStats.NewTemplatePacks.Count}");
foreach (var package in scanningStats.NewTemplatePacks)
{
Console.WriteLine($" {package.Name}::{package.Version}");
Console.WriteLine($" {package.Name}@{package.Version}");
}

Console.WriteLine($" updated: {scanningStats.UpdatedTemplatePacks.Count}");
Expand All @@ -461,14 +461,14 @@ private void DisplayScanningStats(ScanningStats scanningStats)
Console.WriteLine($" removed: {scanningStats.RemovedTemplatePacks.Count}");
foreach (var package in scanningStats.RemovedTemplatePacks)
{
Console.WriteLine($" {package.Name}::{package.Version}");
Console.WriteLine($" {package.Name}@{package.Version}");
}
if (scanningStats.BecameTemplatePacks.Any())
{
Console.WriteLine($" became template packages: {scanningStats.BecameTemplatePacks.Count}");
foreach (var package in scanningStats.BecameTemplatePacks)
{
Console.WriteLine($" {package.Name}::{package.Version}");
Console.WriteLine($" {package.Name}@{package.Version}");
}
}
Console.WriteLine($" not changed: {scanningStats.SameTemplatePacksCount}");
Expand Down
Loading