Skip to content

Commit 4a90f13

Browse files
committed
build fixes
1 parent 16e9822 commit 4a90f13

5 files changed

Lines changed: 43 additions & 13 deletions

File tree

src/code/ContainerRegistryServerAPICalls.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections;
6+
using System.Collections.Concurrent;
67
using System.Collections.Generic;
78
using System.Collections.ObjectModel;
89
using System.IO;
@@ -81,12 +82,12 @@ public ContainerRegistryServerAPICalls(PSRepositoryInfo repository, PSCmdlet cmd
8182

8283
#region Overridden Methods
8384

84-
public override Task<FindResults> FindVersionAsync(string packageName, string version, ResourceType type)
85+
public override Task<FindResults> FindVersionAsync(string packageName, string version, ResourceType type, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
8586
{
8687
throw new NotImplementedException("FindVersionAsync is not implemented for ContainerRegistryServerAPICalls.");
8788
}
8889

89-
public override Task<FindResults> FindVersionGlobbingAsync(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest)
90+
public override Task<FindResults> FindVersionGlobbingAsync(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
9091
{
9192
throw new NotImplementedException("FindVersionGlobbingAsync is not implemented for ContainerRegistryServerAPICalls.");
9293
}
@@ -157,7 +158,7 @@ public override FindResults FindName(string packageName, bool includePrerelease,
157158
}
158159

159160

160-
public override Task<FindResults> FindNameAsync(string packageName, bool includePrerelease, ResourceType type)
161+
public override Task<FindResults> FindNameAsync(string packageName, bool includePrerelease, ResourceType type, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
161162
{
162163
throw new NotImplementedException("FindNameAsync is not implemented for ContainerRegistryServerAPICalls.");
163164
}

src/code/LocalServerApiCalls.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using System.Management.Automation;
1515
using System.Runtime.ExceptionServices;
1616
using System.Threading.Tasks;
17+
using System.Collections.Concurrent;
1718

1819
namespace Microsoft.PowerShell.PSResourceGet.Cmdlets
1920
{
@@ -40,12 +41,12 @@ public LocalServerAPICalls (PSRepositoryInfo repository, PSCmdlet cmdletPassedIn
4041

4142
#region Overridden Methods
4243

43-
public override Task<FindResults> FindVersionAsync(string packageName, string version, ResourceType type)
44+
public override Task<FindResults> FindVersionAsync(string packageName, string version, ResourceType type, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
4445
{
4546
throw new NotImplementedException();
4647
}
4748

48-
public override Task<FindResults> FindVersionGlobbingAsync(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest)
49+
public override Task<FindResults> FindVersionGlobbingAsync(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
4950
{
5051
throw new NotImplementedException();
5152
}
@@ -119,7 +120,7 @@ public override FindResults FindName(string packageName, bool includePrerelease,
119120
return FindNameHelper(packageName, Utils.EmptyStrArray, includePrerelease, type, out errRecord);
120121
}
121122

122-
public override Task<FindResults> FindNameAsync(string packageName, bool includePrerelease, ResourceType type)
123+
public override Task<FindResults> FindNameAsync(string packageName, bool includePrerelease, ResourceType type, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
123124
{
124125
throw new NotImplementedException();
125126
}

src/code/NuGetServerAPICalls.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using System.Net;
1414
using System.Runtime.ExceptionServices;
1515
using System.Management.Automation;
16+
using System.Collections.Concurrent;
1617

1718
namespace Microsoft.PowerShell.PSResourceGet.Cmdlets
1819
{
@@ -48,12 +49,12 @@ public NuGetServerAPICalls (PSRepositoryInfo repository, PSCmdlet cmdletPassedIn
4849

4950
#region Overridden Methods
5051

51-
public override Task<FindResults> FindVersionAsync(string packageName, string version, ResourceType type)
52+
public override Task<FindResults> FindVersionAsync(string packageName, string version, ResourceType type, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
5253
{
5354
throw new NotImplementedException("FindVersionAsync is not implemented for NuGetServerAPICalls.");
5455
}
5556

56-
public override Task<FindResults> FindVersionGlobbingAsync(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest)
57+
public override Task<FindResults> FindVersionGlobbingAsync(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
5758
{
5859
throw new NotImplementedException("FindVersionGlobbingAsync is not implemented for NuGetServerAPICalls.");
5960
}
@@ -192,7 +193,7 @@ public override FindResults FindName(string packageName, bool includePrerelease,
192193
return new FindResults(stringResponse: new string[]{ response }, hashtableResponse: emptyHashResponses, responseType: FindResponseType);
193194
}
194195

195-
public override Task<FindResults> FindNameAsync(string packageName, bool includePrerelease, ResourceType type)
196+
public override Task<FindResults> FindNameAsync(string packageName, bool includePrerelease, ResourceType type, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
196197
{
197198
throw new NotImplementedException("FindNameAsync is not implemented for NuGetServerAPICalls.");
198199
}

src/code/V2ServerAPICalls.cs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,33 @@ public override Stream InstallPackage(string packageName, string packageVersion,
981981
return results;
982982
}
983983

984-
results = InstallVersionAsync(packageName, packageVersion).GetAwaiter().GetResult();
984+
results = InstallVersion(packageName, packageVersion, out errRecord);
985+
return results;
986+
}
987+
988+
/// <summary>
989+
/// Installs a specific package.
990+
/// User may request to install package with or without providing version (as seen in examples below), but prior to calling this method the package is located and package version determined.
991+
/// Therefore, package version should not be null in this method.
992+
/// Name: no wildcard support.
993+
/// Examples: Install "PowerShellGet"
994+
/// Install "PowerShellGet" -Version "3.0.0"
995+
/// </summary>
996+
public async Task<Stream> InstallPackageAsync(string packageName, string packageVersion, bool includePrerelease, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
997+
{
998+
Stream results = new MemoryStream();
999+
if (string.IsNullOrEmpty(packageVersion))
1000+
{
1001+
errorMsgs.Enqueue(new ErrorRecord(
1002+
exception: new ArgumentNullException($"Package version could not be found for {packageName}"),
1003+
"PackageVersionNullOrEmptyError",
1004+
ErrorCategory.InvalidArgument,
1005+
this));
1006+
1007+
return results;
1008+
}
1009+
1010+
results = await InstallVersionAsync(packageName, packageVersion, errorMsgs, debugMsgs);
9851011
return results;
9861012
}
9871013

src/code/V3ServerAPICalls.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using System.Threading.Tasks;
1515
using System.Collections;
1616
using System.Management.Automation;
17+
using System.Collections.Concurrent;
1718

1819
namespace Microsoft.PowerShell.PSResourceGet.Cmdlets
1920
{
@@ -88,12 +89,12 @@ public V3ServerAPICalls(PSRepositoryInfo repository, PSCmdlet cmdletPassedIn, Ne
8889

8990
#region Overridden Methods
9091

91-
public override Task<FindResults> FindVersionAsync(string packageName, string version, ResourceType type)
92+
public override Task<FindResults> FindVersionAsync(string packageName, string version, ResourceType type, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
9293
{
9394
throw new NotImplementedException("FindVersionAsync is not implemented for V3ServerAPICalls.");
9495
}
9596

96-
public override Task<FindResults> FindVersionGlobbingAsync(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest)
97+
public override Task<FindResults> FindVersionGlobbingAsync(string packageName, VersionRange versionRange, bool includePrerelease, ResourceType type, bool getOnlyLatest, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
9798
{
9899
throw new NotImplementedException("FindVersionAsync is not implemented for V3ServerAPICalls.");
99100
}
@@ -165,7 +166,7 @@ public override FindResults FindName(string packageName, bool includePrerelease,
165166
return FindNameHelper(packageName, tags: Utils.EmptyStrArray, includePrerelease, type, out errRecord);
166167
}
167168

168-
public override Task<FindResults> FindNameAsync(string packageName, bool includePrerelease, ResourceType type)
169+
public override Task<FindResults> FindNameAsync(string packageName, bool includePrerelease, ResourceType type, ConcurrentQueue<ErrorRecord> errorMsgs, ConcurrentQueue<string> debugMsgs)
169170
{
170171
throw new NotImplementedException("FindVersionAsync is not implemented for V3ServerAPICalls.");
171172
}

0 commit comments

Comments
 (0)