Fixing nuget API calls and fixing the nuget test package directory creation, so that nuget can restore using it.

This commit is contained in:
Livar Cunha 2017-01-10 10:43:05 -08:00 committed by Eric Erhardt
parent 4fe36fd1e5
commit d3157de6ee
4 changed files with 20 additions and 5 deletions

View file

@ -70,6 +70,8 @@
<TestDirectory>$(RepoRoot)/test/</TestDirectory> <TestDirectory>$(RepoRoot)/test/</TestDirectory>
<DotnetUnderTest>$(Stage2Directory)</DotnetUnderTest> <DotnetUnderTest>$(Stage2Directory)</DotnetUnderTest>
</PropertyGroup> </PropertyGroup>
<MakeDir Directories="$(TestPackagesDir)" Condition="!Exists('$(TestPackagesDir)')"/>
</Target> </Target>
<Target Name="BuildTests" <Target Name="BuildTests"
@ -213,9 +215,10 @@
<DotNetPackMsbuildArgs Condition=" '$(IsDesktopAvailable)' == 'True' And '%(TestPackageProject.PackRuntime)' != '' ">/p:RuntimeIdentifier=%(TestPackageProject.PackRuntime)</DotNetPackMsbuildArgs> <DotNetPackMsbuildArgs Condition=" '$(IsDesktopAvailable)' == 'True' And '%(TestPackageProject.PackRuntime)' != '' ">/p:RuntimeIdentifier=%(TestPackageProject.PackRuntime)</DotNetPackMsbuildArgs>
</PropertyGroup> </PropertyGroup>
<DotNetRestore ToolPath="$(Stage2Directory)" <DotNetRestore ToolPath="$(Stage0Directory)"
Source="$(TestPackagesDir)" Source="$(TestPackagesDir)"
WorkingDirectory="%(TestPackageProject.FullPath)" /> ConfigFile="$(RepoRoot)\NuGet.Config"
ProjectPath="%(TestPackageProject.ProjectPath)" />
<DotNetBuild Framework="%(TestPackageProject.Framework)" <DotNetBuild Framework="%(TestPackageProject.Framework)"
Runtime="%(TestPackageProject.Runtime)" Runtime="%(TestPackageProject.Runtime)"

View file

@ -12,9 +12,11 @@ namespace Microsoft.DotNet.Cli.Build
protected override string Args protected override string Args
{ {
get { return $"{GetProjectPath()} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; } get { return $"{GetProjectPath()} {GetConfigFile()} {GetSource()} {GetPackages()} {GetSkipInvalidConfigurations()} {GetRuntime()} {GetAdditionalParameters()}"; }
} }
public string ConfigFile { get; set; }
public string AdditionalParameters { get; set; } public string AdditionalParameters { get; set; }
public string ProjectPath { get; set; } public string ProjectPath { get; set; }
@ -27,6 +29,16 @@ namespace Microsoft.DotNet.Cli.Build
public string Runtime { get; set; } public string Runtime { get; set; }
private string GetConfigFile()
{
if (!string.IsNullOrEmpty(ConfigFile))
{
return $"--configfile {ConfigFile}";
}
return null;
}
private string GetSource() private string GetSource()
{ {
if (!string.IsNullOrEmpty(Source)) if (!string.IsNullOrEmpty(Source))

View file

@ -21,7 +21,7 @@ namespace Microsoft.DotNet.Cli.Utils
public DepsJsonBuilder() public DepsJsonBuilder()
{ {
// This resolver is only used for building file names, so that base path is not required. // This resolver is only used for building file names, so that base path is not required.
_versionFolderPathResolver = new VersionFolderPathResolver(path: null); _versionFolderPathResolver = new VersionFolderPathResolver(rootPath: null);
} }
public DependencyContext Build( public DependencyContext Build(

View file

@ -28,7 +28,7 @@ namespace Microsoft.DotNet.Internal.ProjectModel.Resolution
_packagePathResolver = new FallbackPackagePathResolver(nugetPathContext); _packagePathResolver = new FallbackPackagePathResolver(nugetPathContext);
// This resolver is only used for building file names, so that base path is not required. // This resolver is only used for building file names, so that base path is not required.
_versionFolderPathResolver = new VersionFolderPathResolver(path: null); _versionFolderPathResolver = new VersionFolderPathResolver(rootPath: null);
} }
_frameworkReferenceResolver = frameworkReferenceResolver; _frameworkReferenceResolver = frameworkReferenceResolver;