Skip to content

Commit

Permalink
update the global install method entry point
Browse files Browse the repository at this point in the history
  • Loading branch information
JL03-Yue committed Jun 29, 2023
1 parent 04b27a9 commit d61c651
Showing 1 changed file with 1 addition and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public override int Execute()
toolPath = new DirectoryPath(_toolPath);
}

//same class for IToolpackagestore, storequery and installer
(IToolPackageStore toolPackageStore, IToolPackageStoreQuery toolPackageStoreQuery, IToolPackageInstaller toolPackageInstaller) =
_createToolPackageStoresAndInstaller(toolPath, _forwardRestoreArguments);

Expand All @@ -126,14 +125,13 @@ public override int Execute()

try
{
//ToolPackageStoreAndQuery downloaderStore = ToolPackageFactory.CreateConcreteToolPackageStore(toolPath);
IToolPackage package = null;
// transaction scope: if something fails in the middle undo the process
using (var scope = new TransactionScope(
TransactionScopeOption.Required,
TimeSpan.Zero))
{
var toolPackageDownloader = new ToolPackageDownloader();
var toolPackageDownloader = new ToolPackageDownloader(toolPackageStore);
package = toolPackageDownloader.InstallPackageAsync(
new PackageLocation(nugetConfig: configFile, additionalFeeds: _source),
packageId: _packageId,
Expand Down Expand Up @@ -169,48 +167,6 @@ public override int Execute()
scope.Complete();
}



// Original Code Below
/*IToolPackage package = null;
// transaction scope: if something fails in the middle undo the process
using (var scope = new TransactionScope(
TransactionScopeOption.Required,
TimeSpan.Zero))
{
package = toolPackageInstaller.InstallPackage(
new PackageLocation(nugetConfig: configFile, additionalFeeds: _source),
packageId: _packageId,
versionRange: versionRange,
targetFramework: _framework, verbosity: _verbosity);
NuGetFramework framework;
if (string.IsNullOrEmpty(_framework) && package.Frameworks.Count() > 0)
{
framework = package.Frameworks
.Where(f => f.Version < (new NuGetVersion(Product.Version)).Version)
.MaxBy(f => f.Version);
}
else
{
framework = string.IsNullOrEmpty(_framework) ?
null :
NuGetFramework.Parse(_framework);
}
string appHostSourceDirectory = _shellShimTemplateFinder.ResolveAppHostSourceDirectoryAsync(_architectureOption, framework, RuntimeInformation.ProcessArchitecture).Result;
IShellShimRepository shellShimRepository = _createShellShimRepository(appHostSourceDirectory, toolPath);
// actual executable that runs
foreach (var command in package.Commands)
{
shellShimRepository.CreateShim(command.Executable, command.Name, package.PackagedShims);
}
scope.Complete();
}*/


foreach (string w in package.Warnings)
{
_reporter.WriteLine(w.Yellow());
Expand Down

0 comments on commit d61c651

Please sign in to comment.