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

Rename "NetSdkManaged" types to "FileBased" #23955

Merged
merged 3 commits into from
Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions build/RunTestsOnHelix.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ set TestExecutionDirectory=%TEMP%\dotnetSdkTests\%RandomDirectoryName%
set DOTNET_CLI_HOME=%TestExecutionDirectory%\.dotnet
mkdir %TestExecutionDirectory%
robocopy %HELIX_CORRELATION_PAYLOAD%\t\TestExecutionDirectoryFiles %TestExecutionDirectory%

REM call dotnet new so the first run message doesn't interfere with the first test
dotnet new
REM avoid potetial cocurrency issues when nuget is creating nuget.config
dotnet nuget list source
5 changes: 5 additions & 0 deletions build/RunTestsOnHelix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ export TestExecutionDirectory=$(pwd)/testExecutionDirectory
mkdir $TestExecutionDirectory
export DOTNET_CLI_HOME=$TestExecutionDirectory/.dotnet
cp -a $HELIX_CORRELATION_PAYLOAD/t/TestExecutionDirectoryFiles/. $TestExecutionDirectory/

# call dotnet new so the first run message doesn't interfere with the first test
dotnet new
# avoid potetial cocurrency issues when nuget is creating nuget.config
joeloff marked this conversation as resolved.
Show resolved Hide resolved
dotnet nuget list source
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace Microsoft.DotNet.Workloads.Workload.Install
{
internal class NetSdkManagedInstaller : IWorkloadPackInstaller
internal class FileBasedInstaller : IWorkloadPackInstaller
{
private readonly IReporter _reporter;
private readonly string _workloadMetadataDir;
Expand All @@ -31,13 +31,13 @@ internal class NetSdkManagedInstaller : IWorkloadPackInstaller
private readonly INuGetPackageDownloader _nugetPackageDownloader;
private readonly IWorkloadResolver _workloadResolver;
private readonly SdkFeatureBand _sdkFeatureBand;
private readonly NetSdkManagedInstallationRecordRepository _installationRecordRepository;
private readonly FileBasedInstallationRecordRepository _installationRecordRepository;
private readonly PackageSourceLocation _packageSourceLocation;
private readonly RestoreActionConfig _restoreActionConfig;

public int ExitCode => 0;

public NetSdkManagedInstaller(IReporter reporter,
public FileBasedInstaller(IReporter reporter,
SdkFeatureBand sdkFeatureBand,
IWorkloadResolver workloadResolver,
string userProfileDir,
Expand All @@ -62,7 +62,7 @@ public NetSdkManagedInstaller(IReporter reporter,
_reporter = reporter;
_sdkFeatureBand = sdkFeatureBand;
_workloadResolver = workloadResolver;
_installationRecordRepository = new NetSdkManagedInstallationRecordRepository(_workloadMetadataDir);
_installationRecordRepository = new FileBasedInstallationRecordRepository(_workloadMetadataDir);
_packageSourceLocation = packageSourceLocation;
}

Expand All @@ -78,7 +78,7 @@ public IWorkloadPackInstaller GetPackInstaller()

public IWorkloadInstaller GetWorkloadInstaller()
{
throw new Exception("NetSdkManagedInstaller is not a workload installer.");
throw new Exception($"{nameof(FileBasedInstaller)} is not a workload installer.");
}

public IWorkloadInstallationRecordRepository GetWorkloadInstallationRecordRepository()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@

namespace Microsoft.DotNet.Workloads.Workload.Install.InstallRecord
{
internal class NetSdkManagedInstallationRecordRepository : IWorkloadInstallationRecordRepository
internal class FileBasedInstallationRecordRepository : IWorkloadInstallationRecordRepository
{
private readonly string _workloadMetadataDir;
private const string InstalledWorkloadDir = "InstalledWorkloads";

public NetSdkManagedInstallationRecordRepository(string workloadMetadataDir)
public FileBasedInstallationRecordRepository(string workloadMetadataDir)
{
_workloadMetadataDir = workloadMetadataDir;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static IInstaller GetWorkloadInstaller(

userProfileDir ??= CliFolderPathCalculator.DotnetUserProfileFolderPath;

return new NetSdkManagedInstaller(reporter,
return new FileBasedInstaller(reporter,
sdkFeatureBand,
workloadResolver,
userProfileDir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@

namespace Microsoft.DotNet.Cli.Workload.Install.Tests
{
public class GivenNetSdkManagedWorkloadInstall : SdkTest
public class GivenFileBasedWorkloadInstall : SdkTest
{
private readonly BufferedReporter _reporter;
private readonly string _manifestPath;

public GivenNetSdkManagedWorkloadInstall(ITestOutputHelper log) : base(log)
public GivenFileBasedWorkloadInstall(ITestOutputHelper log) : base(log)
{
_reporter = new BufferedReporter();
_manifestPath = Path.Combine(_testAssetsManager.GetAndValidateTestProjectDirectory("SampleManifest"), "Sample.json");
Expand Down Expand Up @@ -428,15 +428,15 @@ public void GivenManagedInstallItCanErrorsWhenMissingOfflineCache()
exceptionThrown.Message.Should().Contain(cachePath);
}

private (string, NetSdkManagedInstaller, INuGetPackageDownloader) GetTestInstaller([CallerMemberName] string testName = "", bool failingInstaller = false, string identifier = "", bool manifestDownload = false,
private (string, FileBasedInstaller, INuGetPackageDownloader) GetTestInstaller([CallerMemberName] string testName = "", bool failingInstaller = false, string identifier = "", bool manifestDownload = false,
PackageSourceLocation packageSourceLocation = null)
{
var testDirectory = _testAssetsManager.CreateTestDirectory(testName, identifier: identifier).Path;
var dotnetRoot = Path.Combine(testDirectory, "dotnet");
INuGetPackageDownloader nugetInstaller = failingInstaller ? new FailingNuGetPackageDownloader(testDirectory) : new MockNuGetPackageDownloader(dotnetRoot, manifestDownload);
var workloadResolver = WorkloadResolver.CreateForTests(new MockManifestProvider(new[] { _manifestPath }), dotnetRoot);
var sdkFeatureBand = new SdkFeatureBand("6.0.100");
return (dotnetRoot, new NetSdkManagedInstaller(_reporter, sdkFeatureBand, workloadResolver, userProfileDir: testDirectory, nugetInstaller, dotnetRoot, packageSourceLocation: packageSourceLocation), nugetInstaller);
return (dotnetRoot, new FileBasedInstaller(_reporter, sdkFeatureBand, workloadResolver, userProfileDir: testDirectory, nugetInstaller, dotnetRoot, packageSourceLocation: packageSourceLocation), nugetInstaller);
}
}
}