Merge remote-tracking branch 'refs/remotes/origin/feature/msbuild'
Conflicts: src/dotnet/Program.cs
This commit is contained in:
commit
578adf072c
81 changed files with 625 additions and 286 deletions
|
@ -8,7 +8,7 @@
|
|||
"type": "platform",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000914"
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-003395"
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.6": {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"xunit": "2.2.0-beta3-build3330"
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"System.Linq.Expressions": "4.1.0",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.InternalAbstractions": {
|
||||
"target": "project"
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"Microsoft.NETCore.App": "1.0.0",
|
||||
"Microsoft.CSharp": "4.0.1",
|
||||
"System.Dynamic.Runtime": "4.0.11",
|
||||
"System.Reflection.Metadata": "1.3.0",
|
||||
"System.Reflection.Metadata": "1.4.1-beta-24410-02",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"System.Xml.XmlSerializer": "4.0.11",
|
||||
"WindowsAzure.Storage": "6.2.2-preview"
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<BinaryToCorehostifyRelDir>runtimes/any/native</BinaryToCorehostifyRelDir>
|
||||
<CoreSDKDir>$(RepoRoot)/resources/MSBuildImports</CoreSDKDir>
|
||||
<MSBuildImportsDir>$(RepoRoot)/resources/MSBuildImports</MSBuildImportsDir>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PublishOutputExtensions Include="$(ExeExtension);.dll;.pdb;.deps.json;.runtimeconfig.json" />
|
||||
<FilesToMove Include="$(BinaryToCorehostifyRelDir)/csc.exe;$(BinaryToCorehostifyRelDir)/MSBuild.exe;" />
|
||||
<BundledTools Include="csc;MSBuild;NuGet.CommandLine.XPlat;dotnet" />
|
||||
<CoreSDKContent Include="$(CoreSDKDir)/**/*" />
|
||||
<MSBuildImportsContent Include="$(MSBuildImportsDir)/**/*" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="Compile" DependsOnTargets="Prepare;
|
||||
|
@ -165,7 +165,7 @@
|
|||
DestinationFiles="$(SdkOutputDirectory)/$(HostPolicyBaseName)" />
|
||||
|
||||
<!-- copy core sdk -->
|
||||
<Copy SourceFiles="@(CoreSDKContent)"
|
||||
<Copy SourceFiles="@(MSBuildImportsContent)"
|
||||
DestinationFolder="$(SdkOutputDirectory)/%(RecursiveDir)" />
|
||||
|
||||
<!-- Crossgen the Shared Framework -->
|
||||
|
@ -197,8 +197,8 @@
|
|||
CrossgenPath="$(CrossgenPath)"
|
||||
ReadyToRun="True"
|
||||
PlatformAssemblyPaths="@(PlatformAssemblies);
|
||||
$(SharedFrameworkNameVersionPath);
|
||||
@(CompileStageSdkDirectories)" />
|
||||
@(CompileStageSdkDirectories);
|
||||
$(SharedFrameworkNameVersionPath)" />
|
||||
|
||||
<!-- Generate .version file -->
|
||||
<WriteLinesToFile File="$(SdkOutputDirectory)/.version"
|
||||
|
|
|
@ -27,13 +27,28 @@
|
|||
<TestTaskEnvironmentVariables Include="TEST_ARTIFACTS=$(TestArtifactsEnv)" />
|
||||
</ItemGroup>
|
||||
|
||||
<DotNetTest WorkingDirectory="%(TestProjects.ProjectDir)"
|
||||
EnvironmentVariables="@(TestTaskEnvironmentVariables)"
|
||||
ToolPath="$(Stage2Directory)"
|
||||
Configuration="$(Configuration)"
|
||||
NoBuild="True"
|
||||
NoTrait="category=failing"
|
||||
Xml="$(TestResultXmlDir)/%(TestProjects.OutputName)-testResults.xml" />
|
||||
<PropertyGroup>
|
||||
<RunTestEnvironmentVariables>@(TestTaskEnvironmentVariables)</RunTestEnvironmentVariables>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectsToTest Include="build/test/RunTest.proj">
|
||||
<Properties>
|
||||
CLIBuildDll=$(CLIBuildDll);
|
||||
Configuration=$(Configuration);
|
||||
EnvironmentVariables=$(RunTestEnvironmentVariables);
|
||||
TestProjectName=%(TestProjects.OutputName);
|
||||
TestResultXmlDir=$(TestResultXmlDir);
|
||||
ToolPath=$(Stage2Directory);
|
||||
WorkingDirectory=%(TestProjects.ProjectDir)
|
||||
</Properties>
|
||||
</ProjectsToTest>
|
||||
</ItemGroup>
|
||||
|
||||
<MSBuild
|
||||
BuildInParallel="True"
|
||||
Projects="@(ProjectsToTest)">
|
||||
</MSBuild>
|
||||
</Target>
|
||||
|
||||
<Target Name="PrepareTests"
|
||||
|
@ -63,7 +78,7 @@
|
|||
|
||||
<Target Name="RestoreTests"
|
||||
DependsOnTargets="CreateTestAssetPackageNuPkgs;
|
||||
CleanTestProjectsBinObj;
|
||||
CleanTestProjectsBinObjProjectJson;
|
||||
SetupRestoreTestsInputs;"
|
||||
Inputs="@(RestoreTestsInputs)"
|
||||
Outputs="@(RestoreTestsInputs->'%(RelativeDir)project.lock.json')">
|
||||
|
@ -74,13 +89,13 @@
|
|||
WorkingDirectory="$(TestDirectory)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="CleanTestProjectsBinObj"
|
||||
<Target Name="CleanTestProjectsBinObjProjectJson"
|
||||
DependsOnTargets="SetupRestoreTestsInputs;"
|
||||
Inputs="@(RestoreTestsInputs)"
|
||||
Outputs="@(RestoreTestsInputs->'%(RelativeDir)project.lock.json')">
|
||||
<ItemGroup>
|
||||
<FilesToDelete Include="$(TestDirectory)**/bin/**/*.*" />
|
||||
<FilesToDelete Include="$(TestDirectory)**/obj/**/*.*" />
|
||||
<FilesToDelete Include="$(TestDirectory)**/bin/**/project.json" />
|
||||
<FilesToDelete Include="$(TestDirectory)**/obj/**/project.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<Delete Files="@(FilesToDelete)" />
|
||||
|
|
21
build/test/RunTest.proj
Normal file
21
build/test/RunTest.proj
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTarget="RunTest" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- workaround for https://github.com/Microsoft/msbuild/issues/885 -->
|
||||
<PropertyGroup>
|
||||
<CLIBuildDll Condition=" '!Exists($(CLIBuildDll))' ">$([MSBuild]::Unescape($(CLIBuildDll)))</CLIBuildDll>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<UsingTask TaskName="DotNetTest" AssemblyFile="$(CLIBuildDll)" />
|
||||
|
||||
<Target Name="RunTest">
|
||||
<DotNetTest WorkingDirectory="$(WorkingDirectory)"
|
||||
EnvironmentVariables="$(EnvironmentVariables)"
|
||||
ToolPath="$(ToolPath)"
|
||||
Configuration="$(Configuration)"
|
||||
NoBuild="True"
|
||||
NoTrait="category=failing"
|
||||
Xml="$(TestResultXmlDir)/$(TestProjectName)-testResults.xml" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -8,7 +8,7 @@
|
|||
"NETStandard.Library": "1.6.0",
|
||||
"System.Diagnostics.Process": "4.1.0",
|
||||
"System.Reflection.TypeExtensions": "4.1.0",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.5": {
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
"Microsoft.NETCore.Runtime.CoreCLR": "1.0.2",
|
||||
"Microsoft.CSharp": "4.0.1",
|
||||
"System.Dynamic.Runtime": "4.0.11",
|
||||
"System.Reflection.Metadata": "1.3.0",
|
||||
"System.Reflection.Metadata": "1.4.1-beta-24410-02",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"System.Xml.XmlSerializer": "4.0.11",
|
||||
"WindowsAzure.Storage": "6.2.2-preview",
|
||||
"NuGet.CommandLine.XPlat": "3.6.0-beta.1.msbuild.1",
|
||||
"Microsoft.Build.Framework": "0.1.0-preview-00029-160805",
|
||||
"Microsoft.Build.Utilities.Core": "0.1.0-preview-00029-160805",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
"NETStandard.Library": "1.6.0",
|
||||
"Microsoft.CSharp": "4.0.1",
|
||||
"System.Dynamic.Runtime": "4.0.11",
|
||||
"System.Reflection.Metadata": "1.3.0",
|
||||
"System.Reflection.Metadata": "1.4.1-beta-24410-02",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"System.Xml.XmlSerializer": "4.0.11",
|
||||
"WindowsAzure.Storage": "6.2.2-preview",
|
||||
"Microsoft.DotNet.Cli.Build.Framework": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netstandard1.6": {
|
||||
|
|
|
@ -71,10 +71,10 @@ $env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|||
if ($NoBuild)
|
||||
{
|
||||
Write-Host "Not building due to --nobuild"
|
||||
Write-Host "Command that would be run: 'dotnet build3 build.proj /p:Architecture=$Architecture $ExtraParameters'"
|
||||
Write-Host "Command that would be run: 'dotnet build3 build.proj /m /p:Architecture=$Architecture $ExtraParameters'"
|
||||
}
|
||||
else
|
||||
{
|
||||
dotnet build3 build.proj /p:Architecture=$Architecture $ExtraParameters
|
||||
dotnet build3 build.proj /m /p:Architecture=$Architecture $ExtraParameters
|
||||
if($LASTEXITCODE -ne 0) { throw "Failed to build" }
|
||||
}
|
||||
|
|
|
@ -117,8 +117,8 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|||
echo "${args[@]}"
|
||||
|
||||
if [ $BUILD -eq 1 ]; then
|
||||
dotnet build3 build.proj /p:Architecture=$ARCHITECTURE "${args[@]}"
|
||||
dotnet build3 build.proj /m /p:Architecture=$ARCHITECTURE "${args[@]}"
|
||||
else
|
||||
echo "Not building due to --nobuild"
|
||||
echo "Command that would be run is: 'dotnet build3 build.proj /p:Architecture=$ARCHITECTURE ${args[@]}'"
|
||||
echo "Command that would be run is: 'dotnet build3 build.proj /m /p:Architecture=$ARCHITECTURE ${args[@]}'"
|
||||
fi
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"Microsoft.DotNet.ProjectModel": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919",
|
||||
"NuGet.Versioning": "3.6.0-beta.1.msbuild.1",
|
||||
"NuGet.Packaging": "3.6.0-beta.1.msbuild.1",
|
||||
"NuGet.Frameworks": "3.6.0-beta.1.msbuild.1",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"Microsoft.CodeAnalysis.CSharp.Workspaces": "1.3.0",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
|
|
|
@ -146,8 +146,8 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
export.NativeLibraryGroups.Select(CreateRuntimeAssetGroup).ToArray(),
|
||||
export.ResourceAssemblies.Select(CreateResourceAssembly),
|
||||
libraryDependencies,
|
||||
serviceable
|
||||
);
|
||||
serviceable,
|
||||
GetLibraryPath(export.Library));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -168,10 +168,28 @@ namespace Microsoft.Extensions.DependencyModel
|
|||
export.Library.Hash,
|
||||
assemblies,
|
||||
libraryDependencies,
|
||||
serviceable);
|
||||
serviceable,
|
||||
GetLibraryPath(export.Library));
|
||||
}
|
||||
}
|
||||
|
||||
private string GetLibraryPath(LibraryDescription description)
|
||||
{
|
||||
var packageDescription = description as PackageDescription;
|
||||
|
||||
if (packageDescription != null)
|
||||
{
|
||||
// This is the relative path appended to a NuGet packages directory to find the directory containing
|
||||
// the package assets. This string should mastered only byNuGet, but has the format:
|
||||
// {lowercase-package-ID}/{lowercase-package-version}
|
||||
//
|
||||
// For example: newtonsoft.json/9.0.1
|
||||
return packageDescription.PackageLibrary?.Path;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private RuntimeAssetGroup CreateRuntimeAssetGroup(LibraryAssetGroup libraryAssetGroup)
|
||||
{
|
||||
return new RuntimeAssetGroup(
|
||||
|
|
|
@ -17,5 +17,7 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
public string Sha512 { get; set; }
|
||||
|
||||
public IList<string> Files { get; set; } = new List<string>();
|
||||
|
||||
public string Path { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,6 +144,9 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
|
||||
var type = _symbols.GetString(value.Value<string>("type"));
|
||||
|
||||
var pathValue = value["path"];
|
||||
var path = pathValue == null ? null : ReadString(pathValue);
|
||||
|
||||
if (type == null || string.Equals(type, "package", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
lockFile.PackageLibraries.Add(new LockFilePackageLibrary
|
||||
|
@ -152,7 +155,8 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
Version = version,
|
||||
IsServiceable = ReadBool(value, "serviceable", defaultValue: false),
|
||||
Sha512 = ReadString(value["sha512"]),
|
||||
Files = ReadPathArray(value["files"], ReadString)
|
||||
Files = ReadPathArray(value["files"], ReadString),
|
||||
Path = path
|
||||
});
|
||||
}
|
||||
else if (type == "project")
|
||||
|
@ -163,8 +167,7 @@ namespace Microsoft.DotNet.ProjectModel.Graph
|
|||
Version = version
|
||||
};
|
||||
|
||||
var pathValue = value["path"];
|
||||
projectLibrary.Path = pathValue == null ? null : ReadString(pathValue);
|
||||
projectLibrary.Path = path;
|
||||
|
||||
var buildTimeDependencyValue = value["msbuildProject"];
|
||||
projectLibrary.MSBuildProject = buildTimeDependencyValue == null ? null : ReadString(buildTimeDependencyValue);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel
|
||||
|
|
|
@ -19,7 +19,8 @@ namespace Microsoft.DotNet.ProjectModel
|
|||
framework: null,
|
||||
resolved: false,
|
||||
compatible: false)
|
||||
{ }
|
||||
{
|
||||
}
|
||||
|
||||
public ProjectDescription(
|
||||
LibraryRange libraryRange,
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
},
|
||||
"description": "Types to model a .NET Project",
|
||||
"dependencies": {
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000914",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914",
|
||||
"Microsoft.Extensions.DependencyModel": "1.0.1-beta-000919",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919",
|
||||
"Newtonsoft.Json": "9.0.1",
|
||||
"NuGet.Configuration": "3.6.0-beta.1.msbuild.1",
|
||||
"NuGet.Packaging": "3.6.0-beta.1.msbuild.1",
|
||||
"NuGet.RuntimeModel": "3.6.0-beta.1.msbuild.1",
|
||||
"System.Reflection.Metadata": "1.3.0"
|
||||
"System.Reflection.Metadata": "1.4.1-beta-24410-02"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
"target": "project"
|
||||
},
|
||||
"Microsoft.DiaSymReader": "1.0.8",
|
||||
"Microsoft.DiaSymReader.Native": "1.4.0-rc2"
|
||||
"Microsoft.DiaSymReader.Native": "1.4.0-rc2",
|
||||
"System.Reflection.Metadata": "1.4.1-beta-24410-02"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
|
|
|
@ -15,7 +15,7 @@ using Microsoft.DotNet.Tools.Compiler;
|
|||
using Microsoft.DotNet.Tools.Compiler.Csc;
|
||||
using Microsoft.DotNet.Tools.Help;
|
||||
using Microsoft.DotNet.Tools.New;
|
||||
using Microsoft.DotNet.Tools.NuGet;
|
||||
using Microsoft.DotNet.Tools.Pack3;
|
||||
using Microsoft.DotNet.Tools.Publish;
|
||||
using Microsoft.DotNet.Tools.Restore;
|
||||
using Microsoft.DotNet.Tools.Restore3;
|
||||
|
@ -42,6 +42,7 @@ namespace Microsoft.DotNet.Cli
|
|||
["build3"] = Build3Command.Run,
|
||||
["run3"] = Run3Command.Run,
|
||||
["restore3"] = Restore3Command.Run,
|
||||
["pack3"] = Pack3Command.Run,
|
||||
};
|
||||
|
||||
public static int Main(string[] args)
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"dependencies": {
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"xunit": "2.1.0",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-192208-24",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.InternalAbstractions": "1.0.0"
|
||||
},
|
||||
"testRunner": "xunit",
|
||||
|
|
87
src/dotnet/commands/dotnet-pack3/Pack3Command.cs
Normal file
87
src/dotnet/commands/dotnet-pack3/Pack3Command.cs
Normal file
|
@ -0,0 +1,87 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.DotNet.Cli;
|
||||
using Microsoft.DotNet.Cli.CommandLine;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
|
||||
namespace Microsoft.DotNet.Tools.Pack3
|
||||
{
|
||||
public class Pack3Command
|
||||
{
|
||||
public static int Run(string[] args)
|
||||
{
|
||||
DebugHelper.HandleDebugSwitch(ref args);
|
||||
|
||||
CommandLineApplication cmd = new CommandLineApplication(throwOnUnexpectedArg: false)
|
||||
{
|
||||
Name = "pack3",
|
||||
FullName = "pack3",
|
||||
Description = "pack for msbuild"
|
||||
};
|
||||
|
||||
cmd.HelpOption("-h|--help");
|
||||
|
||||
var output = cmd.Option("-o|--output <OUTPUT_DIR>",
|
||||
"Directory in which to place outputs",
|
||||
CommandOptionType.SingleValue);
|
||||
var noBuild = cmd.Option("--no-build",
|
||||
"Do not build project before packing",
|
||||
CommandOptionType.NoValue);
|
||||
var configuration = cmd.Option("-c|--configuration <CONFIGURATION>",
|
||||
"Configuration under which to build",
|
||||
CommandOptionType.SingleValue);
|
||||
var versionSuffix = cmd.Option("--version-suffix <VERSION_SUFFIX>",
|
||||
"Defines what `*` should be replaced with in version field in project.json",
|
||||
CommandOptionType.SingleValue);
|
||||
var serviceable = cmd.Option("-s|--serviceable",
|
||||
"Set the serviceable flag in the package",
|
||||
CommandOptionType.NoValue);
|
||||
var argRoot = cmd.Argument("<PROJECT>",
|
||||
"The project to pack, defaults to the project file in the current directory. Can be a path to any project file",
|
||||
multipleValues:true);
|
||||
|
||||
cmd.OnExecute(() =>
|
||||
{
|
||||
var msbuildArgs = new List<string>()
|
||||
{
|
||||
"/t:pack"
|
||||
};
|
||||
|
||||
if (noBuild.HasValue())
|
||||
{
|
||||
msbuildArgs.Add($"/p:NoBuild=true");
|
||||
}
|
||||
|
||||
if (output.HasValue())
|
||||
{
|
||||
msbuildArgs.Add($"/p:PackageOutputPath={output.Value()}");
|
||||
}
|
||||
|
||||
if (configuration.HasValue())
|
||||
{
|
||||
msbuildArgs.Add($"/p:Configuration={configuration.Value()}");
|
||||
}
|
||||
|
||||
if (versionSuffix.HasValue())
|
||||
{
|
||||
msbuildArgs.Add($"/p:VersionSuffix={versionSuffix.Value()}");
|
||||
}
|
||||
|
||||
if (serviceable.HasValue())
|
||||
{
|
||||
msbuildArgs.Add($"/p:Serviceable=true");
|
||||
}
|
||||
|
||||
msbuildArgs.AddRange(argRoot.Values);
|
||||
|
||||
msbuildArgs.AddRange(cmd.RemainingArguments);
|
||||
return new MSBuildForwardingApp(msbuildArgs).Execute();
|
||||
});
|
||||
|
||||
return cmd.Execute(args);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -65,7 +65,7 @@
|
|||
"Microsoft.Build": "0.1.0-preview-00029-160805",
|
||||
"Microsoft.Build.Framework": "0.1.0-preview-00029-160805",
|
||||
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"xunit.netcore.extensions": "1.0.0-prerelease-00206",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
var configuration = "Debug";
|
||||
|
||||
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDependencyDesktopAndPortable")
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepDesktopAndPortable")
|
||||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
|
@ -52,7 +52,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
var configuration = "Debug";
|
||||
|
||||
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDependencyDesktopAndPortable")
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepDesktopAndPortable")
|
||||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
|
@ -83,7 +83,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
var configuration = "Release";
|
||||
|
||||
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDependencyDesktopAndPortable")
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepDesktopAndPortable")
|
||||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
|
@ -114,7 +114,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
var configuration = "Release";
|
||||
|
||||
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "DesktopTestProjects"));
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDependencyDesktopAndPortable")
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepDesktopAndPortable")
|
||||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
|
@ -145,7 +145,7 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
var configuration = "Debug";
|
||||
|
||||
var testAssetManager = new TestAssetsManager(Path.Combine(RepoRoot, "TestAssets", "TestProjects"));
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDependencyWithOutputName")
|
||||
var testInstance = testAssetManager.CreateTestInstance("AppWithDirectDepWithOutputName")
|
||||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
|
|
|
@ -12,11 +12,10 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.DotNet.Cli.Utils.Tests
|
||||
{
|
||||
public class GivenAProjectDependenciesCommandResolver
|
||||
public class GivenAProjectDependenciesCommandResolver : TestBase
|
||||
{
|
||||
|
||||
private static readonly string s_liveProjectDirectory =
|
||||
Path.Combine(AppContext.BaseDirectory, "TestAssets/TestProjects/AppWithDirectDependency");
|
||||
private const string TestProjectName = "AppWithDirectDep";
|
||||
|
||||
[Fact]
|
||||
public void It_returns_null_when_CommandName_is_null()
|
||||
|
@ -61,11 +60,14 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "command",
|
||||
CommandArguments = new string[] { "" },
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = "Debug",
|
||||
Framework = null
|
||||
};
|
||||
|
@ -80,11 +82,14 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "command",
|
||||
CommandArguments = new string[] { "" },
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = null,
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
};
|
||||
|
@ -99,11 +104,14 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "nonexistent-command",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = "Debug",
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
};
|
||||
|
@ -118,11 +126,15 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "dotnet-hello",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = "Debug",
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
};
|
||||
|
@ -143,11 +155,15 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "dotnet-hello",
|
||||
CommandArguments = new[] { "arg with space" },
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = "Debug",
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
};
|
||||
|
@ -159,15 +175,19 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void It_passes_depsfile_arg_to_host_when_returning_a_commandspec()
|
||||
public void It_passes_depsfile_arg_to_host_when_returning_a_CommandSpec()
|
||||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "dotnet-hello",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = "Debug",
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
};
|
||||
|
@ -182,26 +202,30 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
public void It_sets_depsfile_in_output_path_in_commandspec()
|
||||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
var outputDir = Path.Combine(AppContext.BaseDirectory, "outdir");
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var outputDir = Path.Combine(testInstance.Path, "outdir");
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments
|
||||
{
|
||||
CommandName = "dotnet-hello",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = "Debug",
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
OutputPath = outputDir
|
||||
};
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
Path.Combine(s_liveProjectDirectory, "project.json"),
|
||||
Path.Combine(testInstance.Path, "project.json"),
|
||||
output: outputDir,
|
||||
framework: FrameworkConstants.CommonFrameworks.NetCoreApp10.ToString())
|
||||
.Execute().Should().Pass();
|
||||
|
||||
var projectContext = ProjectContext.Create(
|
||||
s_liveProjectDirectory,
|
||||
testInstance.Path,
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
|
||||
|
||||
|
@ -218,26 +242,30 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
public void It_sets_depsfile_in_build_base_path_in_commandspec()
|
||||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
var buildBasePath = Path.Combine(AppContext.BaseDirectory, "basedir");
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var buildBasePath = Path.Combine(testInstance.Path, "basedir");
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments
|
||||
{
|
||||
CommandName = "dotnet-hello",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = "Debug",
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
BuildBasePath = buildBasePath
|
||||
};
|
||||
|
||||
var buildCommand = new BuildCommand(
|
||||
Path.Combine(s_liveProjectDirectory, "project.json"),
|
||||
Path.Combine(testInstance.Path, "project.json"),
|
||||
buildBasePath: buildBasePath,
|
||||
framework: FrameworkConstants.CommonFrameworks.NetCoreApp10.ToString())
|
||||
.Execute().Should().Pass();
|
||||
|
||||
var projectContext = ProjectContext.Create(
|
||||
s_liveProjectDirectory,
|
||||
testInstance.Path,
|
||||
FrameworkConstants.CommonFrameworks.NetCoreApp10,
|
||||
RuntimeEnvironmentRidExtensions.GetAllCandidateRuntimeIdentifiers());
|
||||
|
||||
|
@ -255,11 +283,15 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectDependenciesCommandResolver = SetupProjectDependenciesCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "dotnet-hello",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory,
|
||||
ProjectDirectory = testInstance.Path,
|
||||
Configuration = "Debug",
|
||||
Framework = FrameworkConstants.CommonFrameworks.NetCoreApp10
|
||||
};
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||
using FluentAssertions;
|
||||
using Microsoft.DotNet.ProjectModel;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Versioning;
|
||||
|
@ -14,12 +15,11 @@ using Xunit;
|
|||
|
||||
namespace Microsoft.DotNet.Cli.Utils.Tests
|
||||
{
|
||||
public class GivenAProjectToolsCommandResolver
|
||||
public class GivenAProjectToolsCommandResolver : TestBase
|
||||
{
|
||||
private static readonly NuGetFramework s_toolPackageFramework = FrameworkConstants.CommonFrameworks.NetCoreApp10;
|
||||
|
||||
private static readonly string s_liveProjectDirectory =
|
||||
Path.Combine(AppContext.BaseDirectory, "TestAssets/TestProjects/AppWithToolDependency");
|
||||
private const string TestProjectName = "AppWithToolDependency";
|
||||
|
||||
[Fact]
|
||||
public void It_returns_null_when_CommandName_is_null()
|
||||
|
@ -60,11 +60,14 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "nonexistent-command",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory
|
||||
ProjectDirectory = testInstance.Path
|
||||
};
|
||||
|
||||
var result = projectToolsCommandResolver.Resolve(commandResolverArguments);
|
||||
|
@ -77,11 +80,14 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "dotnet-portable",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory
|
||||
ProjectDirectory = testInstance.Path
|
||||
};
|
||||
|
||||
var result = projectToolsCommandResolver.Resolve(commandResolverArguments);
|
||||
|
@ -100,11 +106,14 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "dotnet-portable",
|
||||
CommandArguments = new[] { "arg with space" },
|
||||
ProjectDirectory = s_liveProjectDirectory
|
||||
ProjectDirectory = testInstance.Path
|
||||
};
|
||||
|
||||
var result = projectToolsCommandResolver.Resolve(commandResolverArguments);
|
||||
|
@ -118,11 +127,14 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "dotnet-portable",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory
|
||||
ProjectDirectory = testInstance.Path
|
||||
};
|
||||
|
||||
var result = projectToolsCommandResolver.Resolve(commandResolverArguments);
|
||||
|
@ -138,14 +150,17 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
{
|
||||
var projectToolsCommandResolver = SetupProjectToolsCommandResolver();
|
||||
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var commandResolverArguments = new CommandResolverArguments()
|
||||
{
|
||||
CommandName = "dotnet-portable",
|
||||
CommandArguments = null,
|
||||
ProjectDirectory = s_liveProjectDirectory
|
||||
ProjectDirectory = testInstance.Path
|
||||
};
|
||||
|
||||
var context = ProjectContext.Create(Path.Combine(s_liveProjectDirectory, "project.json"), s_toolPackageFramework);
|
||||
var context = ProjectContext.Create(Path.Combine(testInstance.Path, "project.json"), s_toolPackageFramework);
|
||||
|
||||
var nugetPackagesRoot = context.PackagesDirectory;
|
||||
var toolPathCalculator = new ToolPathCalculator(nugetPackagesRoot);
|
||||
|
@ -180,7 +195,10 @@ namespace Microsoft.DotNet.Cli.Utils.Tests
|
|||
[Fact]
|
||||
public void Generate_deps_json_method_doesnt_overwrite_when_deps_file_already_exists()
|
||||
{
|
||||
var context = ProjectContext.Create(Path.Combine(s_liveProjectDirectory, "project.json"), s_toolPackageFramework);
|
||||
var testInstance = TestAssetsManager.CreateTestInstance(TestProjectName)
|
||||
.WithLockFiles();
|
||||
|
||||
var context = ProjectContext.Create(Path.Combine(testInstance.Path, "project.json"), s_toolPackageFramework);
|
||||
|
||||
var nugetPackagesRoot = context.PackagesDirectory;
|
||||
var toolPathCalculator = new ToolPathCalculator(nugetPackagesRoot);
|
||||
|
|
|
@ -14,20 +14,12 @@ namespace StreamForwarderTests
|
|||
public class StreamForwarderTests : TestBase
|
||||
{
|
||||
private static readonly string s_rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
private static readonly string s_testProjectRoot = Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects");
|
||||
|
||||
private TempDirectory _root;
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
Console.WriteLine("Dummy Entrypoint");
|
||||
}
|
||||
|
||||
public StreamForwarderTests()
|
||||
{
|
||||
_root = Temp.CreateDirectory();
|
||||
}
|
||||
|
||||
public static IEnumerable<object[]> ForwardingTheoryVariations
|
||||
{
|
||||
get
|
||||
|
@ -127,15 +119,15 @@ namespace StreamForwarderTests
|
|||
|
||||
private string SetupTestProject()
|
||||
{
|
||||
var sourceTestProjectPath = Path.Combine(s_testProjectRoot, "OutputStandardOutputAndError");
|
||||
|
||||
var binTestProjectPath = _root.CopyDirectory(sourceTestProjectPath).Path;
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("OutputStandardOutputAndError")
|
||||
.WithLockFiles();
|
||||
|
||||
var buildCommand = new BuildCommand(Path.Combine(binTestProjectPath, "project.json"));
|
||||
var buildCommand = new BuildCommand(Path.Combine(testInstance.Path, "project.json"));
|
||||
buildCommand.Execute();
|
||||
|
||||
var buildOutputExe = "OutputStandardOutputAndError" + Constants.ExeSuffix;
|
||||
var buildOutputPath = Path.Combine(binTestProjectPath, "bin/Debug/netcoreapp1.0", buildOutputExe);
|
||||
var buildOutputPath = Path.Combine(testInstance.Path, "bin/Debug/netcoreapp1.0", buildOutputExe);
|
||||
|
||||
return buildOutputPath;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@
|
|||
},
|
||||
"moq.netcore": "4.4.0-beta8",
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"FluentAssertions": "4.0.0",
|
||||
"moq.netcore": "4.4.0-beta8",
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -7,24 +7,18 @@ namespace Microsoft.DotNet.ProjectModel.Tests
|
|||
{
|
||||
public class LibraryExporterTests : TestBase
|
||||
{
|
||||
private readonly string _testProjectsRoot;
|
||||
|
||||
public LibraryExporterTests()
|
||||
{
|
||||
_testProjectsRoot = Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetLibraryExportsWithoutLockFile()
|
||||
{
|
||||
var root = Temp.CreateDirectory().CopyDirectory(Path.Combine(_testProjectsRoot, "TestAppWithLibrary"));
|
||||
|
||||
foreach (var lockfile in Directory.GetFiles(root.Path, "project.lock.json"))
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("TestAppWithLibrary");
|
||||
|
||||
foreach (var lockfile in Directory.GetFiles(testInstance.Path, "project.lock.json"))
|
||||
{
|
||||
File.Delete(lockfile);
|
||||
}
|
||||
|
||||
var builder = new ProjectContextBuilder().WithProjectDirectory(Path.Combine(root.Path, "TestApp"));
|
||||
var builder = new ProjectContextBuilder().WithProjectDirectory(Path.Combine(testInstance.Path, "TestApp"));
|
||||
|
||||
foreach (var context in builder.BuildAllTargets())
|
||||
{
|
||||
|
|
120
test/Microsoft.DotNet.ProjectModel.Tests/LockFileReaderTests.cs
Normal file
120
test/Microsoft.DotNet.ProjectModel.Tests/LockFileReaderTests.cs
Normal file
|
@ -0,0 +1,120 @@
|
|||
// Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Tests
|
||||
{
|
||||
public class LockFileReaderTests : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void ReadsAllLibraryPropertiesWhenPathIsPresent()
|
||||
{
|
||||
// Arrange
|
||||
var lockFileJson = @"
|
||||
{
|
||||
""libraries"": {
|
||||
""PackageA/1.0.1-Alpha"": {
|
||||
""sha512"": ""FAKE-HASH"",
|
||||
""type"": ""package"",
|
||||
""serviceable"": true,
|
||||
""files"": [
|
||||
""a.txt"",
|
||||
""foo/b.txt""
|
||||
],
|
||||
""path"": ""PackageA/1.0.1-beta-PATH""
|
||||
},
|
||||
""ProjectA/1.0.2-Beta"": {
|
||||
""type"": ""project"",
|
||||
""path"": ""ProjectA-PATH"",
|
||||
""msbuildProject"": ""some-msbuild""
|
||||
}
|
||||
}
|
||||
}";
|
||||
|
||||
var lockFileStream = new MemoryStream(Encoding.UTF8.GetBytes(lockFileJson));
|
||||
var lockFileReader = new LockFileReader();
|
||||
|
||||
// Act
|
||||
var lockFile = lockFileReader.ReadLockFile(
|
||||
lockFilePath: null,
|
||||
stream: lockFileStream,
|
||||
designTime: true);
|
||||
|
||||
// Assert
|
||||
lockFile.PackageLibraries.Should().HaveCount(1);
|
||||
var package = lockFile.PackageLibraries.First();
|
||||
package.Name.Should().Be("PackageA");
|
||||
package.Version.ToString().Should().Be("1.0.1-Alpha");
|
||||
package.Sha512.Should().Be("FAKE-HASH");
|
||||
package.IsServiceable.Should().BeTrue();
|
||||
package.Files.Should().HaveCount(2);
|
||||
package.Files[0].Should().Be("a.txt");
|
||||
package.Files[1].Should().Be(Path.Combine("foo", "b.txt"));
|
||||
package.Path.Should().Be("PackageA/1.0.1-beta-PATH");
|
||||
|
||||
lockFile.ProjectLibraries.Should().HaveCount(1);
|
||||
var project = lockFile.ProjectLibraries.First();
|
||||
project.Name.Should().Be("ProjectA");
|
||||
project.Version.ToString().Should().Be("1.0.2-Beta");
|
||||
project.Path.Should().Be("ProjectA-PATH");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReadsAllLibraryPropertiesWhenPathIsNotPresent()
|
||||
{
|
||||
// Arrange
|
||||
var lockFileJson = @"
|
||||
{
|
||||
""libraries"": {
|
||||
""PackageA/1.0.1-Alpha"": {
|
||||
""sha512"": ""FAKE-HASH"",
|
||||
""type"": ""package"",
|
||||
""serviceable"": true,
|
||||
""files"": [
|
||||
""a.txt"",
|
||||
""foo/b.txt""
|
||||
]
|
||||
},
|
||||
""ProjectA/1.0.2-Beta"": {
|
||||
""type"": ""project"",
|
||||
""msbuildProject"": ""some-msbuild""
|
||||
}
|
||||
}
|
||||
}";
|
||||
|
||||
var lockFileStream = new MemoryStream(Encoding.UTF8.GetBytes(lockFileJson));
|
||||
var lockFileReader = new LockFileReader();
|
||||
|
||||
// Act
|
||||
var lockFile = lockFileReader.ReadLockFile(
|
||||
lockFilePath: null,
|
||||
stream: lockFileStream,
|
||||
designTime: true);
|
||||
|
||||
// Assert
|
||||
lockFile.PackageLibraries.Should().HaveCount(1);
|
||||
var package = lockFile.PackageLibraries.First();
|
||||
package.Name.Should().Be("PackageA");
|
||||
package.Version.ToString().Should().Be("1.0.1-Alpha");
|
||||
package.Sha512.Should().Be("FAKE-HASH");
|
||||
package.IsServiceable.Should().BeTrue();
|
||||
package.Files.Should().HaveCount(2);
|
||||
package.Files[0].Should().Be("a.txt");
|
||||
package.Files[1].Should().Be(Path.Combine("foo", "b.txt"));
|
||||
package.Path.Should().BeNull();
|
||||
|
||||
lockFile.ProjectLibraries.Should().HaveCount(1);
|
||||
var project = lockFile.ProjectLibraries.First();
|
||||
project.Name.Should().Be("ProjectA");
|
||||
project.Version.ToString().Should().Be("1.0.2-Beta");
|
||||
project.Path.Should().BeNull();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.ProjectModel.Graph;
|
||||
using Microsoft.DotNet.ProjectModel.Resolution;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
|
@ -8,16 +10,46 @@ using NuGet.Configuration;
|
|||
using NuGet.Frameworks;
|
||||
using NuGet.Versioning;
|
||||
using Xunit;
|
||||
using System.IO;
|
||||
|
||||
namespace Microsoft.DotNet.ProjectModel.Tests
|
||||
{
|
||||
public class PackageDependencyProviderTests : TestBase
|
||||
{
|
||||
[Fact]
|
||||
public void GetDescriptionShouldLeavePackageLibraryPathAlone()
|
||||
{
|
||||
// Arrange
|
||||
var provider = new PackageDependencyProvider(
|
||||
NuGetPathContext.Create("/foo/packages"),
|
||||
new FrameworkReferenceResolver("/foo/references"));
|
||||
var package = new LockFilePackageLibrary();
|
||||
package.Name = "Something";
|
||||
package.Version = NuGetVersion.Parse("1.0.0");
|
||||
package.Files.Add("lib/dotnet/_._");
|
||||
package.Files.Add("runtimes/any/native/Microsoft.CSharp.CurrentVersion.targets");
|
||||
package.Path = "SomePath";
|
||||
|
||||
var target = new LockFileTargetLibrary();
|
||||
target.Name = "Something";
|
||||
target.Version = package.Version;
|
||||
|
||||
target.RuntimeAssemblies.Add("lib/dotnet/_._");
|
||||
target.CompileTimeAssemblies.Add("lib/dotnet/_._");
|
||||
target.NativeLibraries.Add("runtimes/any/native/Microsoft.CSharp.CurrentVersion.targets");
|
||||
|
||||
// Act
|
||||
var p = provider.GetDescription(NuGetFramework.Parse("netcoreapp1.0"), package, target);
|
||||
|
||||
// Assert
|
||||
p.PackageLibrary.Path.Should().Be("SomePath");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetDescriptionShouldNotModifyTarget()
|
||||
{
|
||||
var provider = new PackageDependencyProvider(NuGetPathContext.Create("/foo/packages"), new FrameworkReferenceResolver("/foo/references"));
|
||||
var provider = new PackageDependencyProvider(
|
||||
NuGetPathContext.Create("/foo/packages"),
|
||||
new FrameworkReferenceResolver("/foo/references"));
|
||||
var package = new LockFilePackageLibrary();
|
||||
package.Name = "Something";
|
||||
package.Version = NuGetVersion.Parse("1.0.0");
|
||||
|
@ -48,7 +80,9 @@ namespace Microsoft.DotNet.ProjectModel.Tests
|
|||
[Fact]
|
||||
public void HasCompileTimePlaceholderChecksAllCompileTimeAssets()
|
||||
{
|
||||
var provider = new PackageDependencyProvider(NuGetPathContext.Create("/foo/packages"), new FrameworkReferenceResolver("/foo/references"));
|
||||
var provider = new PackageDependencyProvider(
|
||||
NuGetPathContext.Create("/foo/packages"),
|
||||
new FrameworkReferenceResolver("/foo/references"));
|
||||
var package = new LockFilePackageLibrary();
|
||||
package.Name = "Something";
|
||||
package.Version = NuGetVersion.Parse("1.0.0");
|
||||
|
@ -76,7 +110,9 @@ namespace Microsoft.DotNet.ProjectModel.Tests
|
|||
[Fact]
|
||||
public void HasCompileTimePlaceholderReturnsFalseIfEmpty()
|
||||
{
|
||||
var provider = new PackageDependencyProvider(NuGetPathContext.Create("/foo/packages"), new FrameworkReferenceResolver("/foo/references"));
|
||||
var provider = new PackageDependencyProvider(
|
||||
NuGetPathContext.Create("/foo/packages"),
|
||||
new FrameworkReferenceResolver("/foo/references"));
|
||||
var package = new LockFilePackageLibrary();
|
||||
package.Name = "Something";
|
||||
package.Version = NuGetVersion.Parse("1.0.0");
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
"dependencies": {
|
||||
"FluentAssertions": "4.0.0",
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.TestFramework": { "target": "project" },
|
||||
"Microsoft.DotNet.Cli.Utils": { "target": "project" },
|
||||
"Microsoft.DotNet.ProjectModel": { "target": "project" },
|
||||
"Microsoft.DotNet.InternalAbstractions": {
|
||||
"target": "project"
|
||||
},
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"xunit.netcore.extensions": "1.0.0-prerelease-00206",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.xunit.performance": "1.0.0-alpha-build0028"
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"FluentAssertions": "4.2.2"
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"FluentAssertions": "4.2.2",
|
||||
"moq.netcore": "4.4.0-beta8"
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"version": "1.0.0-*",
|
||||
"dependencies": {
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.NETCore.Platforms": "1.0.1",
|
||||
"Microsoft.DotNet.Tools.Tests.Utilities": {
|
||||
"target": "project"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -13,28 +13,18 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
{
|
||||
public class CompilerTests : TestBase
|
||||
{
|
||||
private readonly string _testProjectsRoot;
|
||||
|
||||
public CompilerTests()
|
||||
{
|
||||
_testProjectsRoot = Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void XmlDocumentationFileIsGenerated()
|
||||
{
|
||||
// create unique directories in the 'temp' folder
|
||||
var root = Temp.CreateDirectory();
|
||||
root.CopyFile(Path.Combine(_testProjectsRoot, "global.json"));
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("TestAppWithLibrary")
|
||||
.WithLockFiles();
|
||||
|
||||
var testLibDir = root.CreateDirectory("TestLibrary");
|
||||
var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestAppWithLibrary", "TestLibrary");
|
||||
|
||||
CopyProjectToTempDir(sourceTestLibDir, testLibDir);
|
||||
var testLibDir = Path.Combine(testInstance.TestRoot, "TestLibrary");
|
||||
|
||||
// run compile
|
||||
var outputDir = Path.Combine(testLibDir.Path, "bin");
|
||||
var testProject = GetProjectPath(testLibDir);
|
||||
var outputDir = Path.Combine(testLibDir, "bin");
|
||||
var testProject = Path.Combine(testLibDir, "project.json");
|
||||
var buildCommand = new BuildCommand(testProject, output: outputDir, framework: DefaultLibraryFramework);
|
||||
var result = buildCommand.ExecuteWithCapturedOutput();
|
||||
result.Should().Pass();
|
||||
|
@ -49,16 +39,15 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
[Fact]
|
||||
public void SatelliteAssemblyIsGeneratedByDotnetBuild()
|
||||
{
|
||||
// create unique directories in the 'temp' folder
|
||||
var root = Temp.CreateDirectory();
|
||||
var testLibDir = root.CreateDirectory("TestProjectWithCultureSpecificResource");
|
||||
var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestProjectWithCultureSpecificResource");
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("TestProjectWithCultureSpecificResource")
|
||||
.WithLockFiles();
|
||||
|
||||
CopyProjectToTempDir(sourceTestLibDir, testLibDir);
|
||||
var testLibDir = testInstance.TestRoot;
|
||||
|
||||
// run compile on a project with resources
|
||||
var outputDir = Path.Combine(testLibDir.Path, "bin");
|
||||
var testProject = GetProjectPath(testLibDir);
|
||||
var outputDir = Path.Combine(testLibDir, "bin");
|
||||
var testProject = Path.Combine(testLibDir, "project.json");
|
||||
var buildCmd = new BuildCommand(testProject, output: outputDir, framework: DefaultFramework);
|
||||
var result = buildCmd.ExecuteWithCapturedOutput();
|
||||
result.Should().Pass();
|
||||
|
@ -75,15 +64,15 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
[Fact]
|
||||
public void LibraryWithAnalyzer()
|
||||
{
|
||||
var root = Temp.CreateDirectory();
|
||||
var testLibDir = root.CreateDirectory("TestLibraryWithAnalyzer");
|
||||
var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestLibraryWithAnalyzer");
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("TestLibraryWithAnalyzer")
|
||||
.WithLockFiles();
|
||||
|
||||
CopyProjectToTempDir(sourceTestLibDir, testLibDir);
|
||||
var testLibDir = testInstance.TestRoot;
|
||||
|
||||
// run compile
|
||||
var outputDir = Path.Combine(testLibDir.Path, "bin");
|
||||
var testProject = GetProjectPath(testLibDir);
|
||||
var outputDir = Path.Combine(testLibDir, "bin");
|
||||
var testProject = Path.Combine(testLibDir, "project.json");
|
||||
var buildCmd = new BuildCommand(testProject, output: outputDir, framework: DefaultLibraryFramework);
|
||||
var result = buildCmd.ExecuteWithCapturedOutput();
|
||||
result.Should().Pass();
|
||||
|
@ -96,12 +85,15 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
{
|
||||
var root = Temp.CreateDirectory();
|
||||
|
||||
var spaceBufferDirectory = root.CreateDirectory("space directory");
|
||||
var testAppDir = spaceBufferDirectory.CreateDirectory("TestAppCompilationContext");
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("TestAppCompilationContext", identifier: "A SPACE")
|
||||
.WithLockFiles();
|
||||
|
||||
CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestAppCompilationContext"), testAppDir);
|
||||
var testProjectDir = Path.Combine(
|
||||
Directory.GetParent(testInstance.TestRoot).FullName,
|
||||
"TestAppCompilationContext",
|
||||
"TestApp");
|
||||
|
||||
var testProjectDir = Path.Combine(_testProjectsRoot, "TestAppCompilationContext", "TestApp");
|
||||
var testProject = Path.Combine(testProjectDir, "project.json");
|
||||
|
||||
var buildCommand = new BuildCommand(testProject);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"moq.netcore": "4.4.0-beta8",
|
||||
"FluentAssertions": "4.2.2"
|
||||
},
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -17,49 +17,41 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
{
|
||||
private readonly string _testProjectsRoot;
|
||||
|
||||
public PackTests()
|
||||
{
|
||||
_testProjectsRoot = Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OutputsPackagesToConfigurationSubdirWhenOutputParameterIsNotPassed()
|
||||
{
|
||||
var root = Temp.CreateDirectory();
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("TestLibraryWithConfiguration")
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var testLibDir = root.CreateDirectory("TestLibrary");
|
||||
var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestLibraryWithConfiguration");
|
||||
|
||||
CopyProjectToTempDir(sourceTestLibDir, testLibDir);
|
||||
|
||||
var testProject = GetProjectPath(testLibDir);
|
||||
var testProject = Path.Combine(testInstance.Path, "project.json");
|
||||
var packCommand = new PackCommand(testProject, configuration: "Test");
|
||||
var result = packCommand.Execute();
|
||||
result.Should().Pass();
|
||||
|
||||
var outputDir = new DirectoryInfo(Path.Combine(testLibDir.Path, "bin", "Test"));
|
||||
var outputDir = new DirectoryInfo(Path.Combine(testInstance.Path, "bin", "Test"));
|
||||
outputDir.Should().Exist();
|
||||
outputDir.Should().HaveFiles(new [] { "TestLibrary.1.0.0.nupkg" , "TestLibrary.1.0.0.symbols.nupkg" });
|
||||
outputDir.Should().HaveFiles(new [] { "TestLibraryWithConfiguration.1.0.0.nupkg" , "TestLibraryWithConfiguration.1.0.0.symbols.nupkg" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OutputsPackagesFlatIntoOutputDirWhenOutputParameterIsPassed()
|
||||
{
|
||||
var root = Temp.CreateDirectory();
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("TestLibraryWithConfiguration")
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var testLibDir = root.CreateDirectory("TestLibrary");
|
||||
var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestLibraryWithConfiguration");
|
||||
var testProject = Path.Combine(testInstance.Path, "project.json");
|
||||
|
||||
CopyProjectToTempDir(sourceTestLibDir, testLibDir);
|
||||
|
||||
var outputDir = new DirectoryInfo(Path.Combine(testLibDir.Path, "bin2"));
|
||||
var testProject = GetProjectPath(testLibDir);
|
||||
var outputDir = new DirectoryInfo(Path.Combine(testInstance.Path, "bin2"));
|
||||
var packCommand = new PackCommand(testProject, output: outputDir.FullName);
|
||||
var result = packCommand.Execute();
|
||||
result.Should().Pass();
|
||||
|
||||
outputDir.Should().Exist();
|
||||
outputDir.Should().HaveFiles(new[] { "TestLibrary.1.0.0.nupkg", "TestLibrary.1.0.0.symbols.nupkg" });
|
||||
outputDir.Should().HaveFiles(new[] { "TestLibraryWithConfiguration.1.0.0.nupkg", "TestLibraryWithConfiguration.1.0.0.symbols.nupkg" });
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -100,7 +92,8 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
[Fact]
|
||||
public void HasIncludedFiles()
|
||||
{
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("EndToEndTestApp")
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("EndToEndTestApp")
|
||||
.WithLockFiles()
|
||||
.WithBuildArtifacts();
|
||||
|
||||
|
@ -156,27 +149,25 @@ namespace Microsoft.DotNet.Tools.Compiler.Tests
|
|||
[Fact]
|
||||
public void HasServiceableFlagWhenArgumentPassed()
|
||||
{
|
||||
var root = Temp.CreateDirectory();
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("TestLibraryWithConfiguration")
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var testLibDir = root.CreateDirectory("TestLibrary");
|
||||
var sourceTestLibDir = Path.Combine(_testProjectsRoot, "TestLibraryWithConfiguration");
|
||||
|
||||
CopyProjectToTempDir(sourceTestLibDir, testLibDir);
|
||||
|
||||
var testProject = GetProjectPath(testLibDir);
|
||||
var testProject = Path.Combine(testInstance.Path, "project.json");
|
||||
var packCommand = new PackCommand(testProject, configuration: "Debug", serviceable: true);
|
||||
var result = packCommand.Execute();
|
||||
result.Should().Pass();
|
||||
|
||||
var outputDir = new DirectoryInfo(Path.Combine(testLibDir.Path, "bin", "Debug"));
|
||||
var outputDir = new DirectoryInfo(Path.Combine(testInstance.Path, "bin", "Debug"));
|
||||
outputDir.Should().Exist();
|
||||
outputDir.Should().HaveFiles(new[] { "TestLibrary.1.0.0.nupkg", "TestLibrary.1.0.0.symbols.nupkg" });
|
||||
outputDir.Should().HaveFiles(new[] { "TestLibraryWithConfiguration.1.0.0.nupkg", "TestLibraryWithConfiguration.1.0.0.symbols.nupkg" });
|
||||
|
||||
var outputPackage = Path.Combine(outputDir.FullName, "TestLibrary.1.0.0.nupkg");
|
||||
var outputPackage = Path.Combine(outputDir.FullName, "TestLibraryWithConfiguration.1.0.0.nupkg");
|
||||
var zip = ZipFile.Open(outputPackage, ZipArchiveMode.Read);
|
||||
zip.Entries.Should().Contain(e => e.FullName == "TestLibrary.nuspec");
|
||||
zip.Entries.Should().Contain(e => e.FullName == "TestLibraryWithConfiguration.nuspec");
|
||||
|
||||
var manifestReader = new StreamReader(zip.Entries.First(e => e.FullName == "TestLibrary.nuspec").Open());
|
||||
var manifestReader = new StreamReader(zip.Entries.First(e => e.FullName == "TestLibraryWithConfiguration.nuspec").Open());
|
||||
var nuspecXml = XDocument.Parse(manifestReader.ReadToEnd());
|
||||
var node = nuspecXml.Descendants().Single(e => e.Name.LocalName == "serviceable");
|
||||
Assert.Equal("true", node.Value);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
[Fact]
|
||||
public void PublishExcludesBuildDependencies()
|
||||
{
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("AppWithDirectDependencyAndTypeBuild")
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("AppWithDirectDepAndTypeBuild")
|
||||
.WithLockFiles();
|
||||
|
||||
var publishCommand = new PublishCommand(testInstance.TestRoot);
|
||||
|
@ -37,7 +37,7 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
// Check the deps file
|
||||
var reader = new DependencyContextJsonReader();
|
||||
DependencyContext context;
|
||||
using (var file = File.OpenRead(Path.Combine(publishDir.FullName, "AppWithDirectDependencyAndTypeBuild.deps.json")))
|
||||
using (var file = File.OpenRead(Path.Combine(publishDir.FullName, "AppWithDirectDepAndTypeBuild.deps.json")))
|
||||
{
|
||||
context = reader.Read(file);
|
||||
}
|
||||
|
|
|
@ -14,14 +14,8 @@ namespace Microsoft.DotNet.Tools.Publish.Tests
|
|||
{
|
||||
public class PublishTests : TestBase
|
||||
{
|
||||
private readonly string _testProjectsRoot;
|
||||
private readonly Func<string, string, string> _getProjectJson = ProjectUtils.GetProjectJson;
|
||||
|
||||
public PublishTests()
|
||||
{
|
||||
_testProjectsRoot = Path.Combine(RepoRoot, "TestAssets", "TestProjects");
|
||||
}
|
||||
|
||||
private static readonly dynamic[] CrossPublishTestData = new[]
|
||||
{
|
||||
new
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"xunit.netcore.extensions": "1.0.0-prerelease-00206",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0"
|
||||
},
|
||||
"frameworks": {
|
||||
|
|
|
@ -12,24 +12,16 @@ namespace Microsoft.DotNet.Tools.Resgen.Tests
|
|||
{
|
||||
public class ResgenTests : TestBase
|
||||
{
|
||||
private readonly string _testProjectsRoot;
|
||||
private readonly TempDirectory _root;
|
||||
|
||||
public ResgenTests()
|
||||
{
|
||||
_testProjectsRoot = Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects");
|
||||
_root = Temp.CreateDirectory();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Test_Build_Project_with_Resources_with_Space_in_Path_Should_Succeed()
|
||||
{
|
||||
var spaceBufferDirectory = _root.CreateDirectory("space directory");
|
||||
var testAppDir = spaceBufferDirectory.CreateDirectory("TestProjectWithResource");
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("TestProjectWithResource", identifier: "A SPACE")
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
CopyProjectToTempDir(Path.Combine(_testProjectsRoot, "TestProjectWithResource"), testAppDir);
|
||||
var testProject = Path.Combine(testInstance.Path, "project.json");
|
||||
|
||||
var testProject = GetProjectPath(testAppDir);
|
||||
var buildCommand = new BuildCommand(testProject);
|
||||
|
||||
buildCommand.Execute().Should().Pass();
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"xunit.netcore.extensions": "1.0.0-prerelease-00206",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
"target": "project"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"moq.netcore": "4.4.0-beta8",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
"System.Net.Sockets": "4.1.0",
|
||||
"System.Runtime.Serialization.Primitives": "4.1.1",
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"exclude": "Compile"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"moq.netcore": "4.4.0-beta8",
|
||||
"FluentAssertions": "4.2.2"
|
||||
},
|
||||
|
|
|
@ -31,14 +31,15 @@ namespace Microsoft.DotNet.Tests
|
|||
|
||||
_firstDotnetNonVerbUseCommandResult = command.ExecuteWithCapturedOutput("--info");
|
||||
_firstDotnetVerbUseCommandResult = command.ExecuteWithCapturedOutput("new");
|
||||
|
||||
_nugetCacheFolder = new DirectoryInfo(testNugetCache);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Using_dotnet_for_the_first_time_succeeds()
|
||||
{
|
||||
_firstDotnetVerbUseCommandResult.Should().Pass();
|
||||
_firstDotnetVerbUseCommandResult
|
||||
.Should()
|
||||
.Pass();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -46,7 +47,9 @@ namespace Microsoft.DotNet.Tests
|
|||
{
|
||||
const string firstTimeNonVerbUseMessage = @".NET Command Line Tools";
|
||||
|
||||
_firstDotnetNonVerbUseCommandResult.StdOut.Should().StartWith(firstTimeNonVerbUseMessage);
|
||||
_firstDotnetNonVerbUseCommandResult.StdOut
|
||||
.Should()
|
||||
.StartWith(firstTimeNonVerbUseMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
@ -64,19 +67,25 @@ Configuring...
|
|||
-------------------
|
||||
A command is running to initially populate your local package cache, to improve restore speed and enable offline access. This command will take up to a minute to complete and will only happen once.";
|
||||
|
||||
_firstDotnetVerbUseCommandResult.StdOut.Should().StartWith(firstTimeUseWelcomeMessage);
|
||||
_firstDotnetVerbUseCommandResult.StdOut
|
||||
.Should()
|
||||
.StartWith(firstTimeUseWelcomeMessage);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_restores_the_nuget_packages_to_the_nuget_cache_folder()
|
||||
{
|
||||
_nugetCacheFolder.Should().HaveFile($"{GetDotnetVersion()}.dotnetSentinel");
|
||||
_nugetCacheFolder
|
||||
.Should()
|
||||
.HaveFile($"{GetDotnetVersion()}.dotnetSentinel");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void It_creates_a_sentinel_file_under_the_nuget_cache_folder()
|
||||
{
|
||||
_nugetCacheFolder.Should().HaveDirectory("microsoft.netcore.app");
|
||||
_nugetCacheFolder
|
||||
.Should()
|
||||
.HaveDirectory("microsoft.netcore.app");
|
||||
}
|
||||
|
||||
private string GetDotnetVersion()
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.IO;
|
|||
using System.Runtime.InteropServices;
|
||||
using FluentAssertions;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.DotNet.TestFramework;
|
||||
using Microsoft.DotNet.Tools.Test.Utilities;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Xunit;
|
||||
|
@ -15,19 +16,18 @@ namespace Microsoft.DotNet.Tests
|
|||
{
|
||||
public class PackagedCommandTests : TestBase
|
||||
{
|
||||
private readonly string _testProjectsRoot;
|
||||
private readonly string _desktopTestProjectsRoot;
|
||||
private readonly TestAssetsManager _desktopTestAssetsManager = GetTestGroupTestAssetsManager("DesktopTestProjects");
|
||||
|
||||
public static IEnumerable<object[]> DependencyToolArguments
|
||||
{
|
||||
get
|
||||
{
|
||||
var rid = RuntimeEnvironmentRidExtensions.GetLegacyRestoreRuntimeIdentifier();
|
||||
var projectOutputPath = $"AppWithDirectDependencyDesktopAndPortable\\bin\\Debug\\net451\\{rid}\\dotnet-desktop-and-portable.exe";
|
||||
var projectOutputPath = $"AppWithDirectDepDesktopAndPortable\\bin\\Debug\\net451\\{rid}\\dotnet-desktop-and-portable.exe";
|
||||
return new[]
|
||||
{
|
||||
new object[] { ".NETCoreApp,Version=v1.0", "CoreFX", "lib\\netcoreapp1.0\\dotnet-desktop-and-portable.dll", true },
|
||||
new object[] { ".NETFramework,Version=v4.5.1", "NetFX", projectOutputPath, true }
|
||||
new object[] { "CoreFX", ".NETCoreApp,Version=v1.0", "lib\\netcoreapp1.0\\dotnet-desktop-and-portable.dll", true },
|
||||
new object[] { "NetFX", ".NETFramework,Version=v4.5.1", projectOutputPath, true }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -40,24 +40,22 @@ namespace Microsoft.DotNet.Tests
|
|||
var projectOutputPath = $"LibraryWithDirectDependencyDesktopAndPortable\\bin\\Debug\\net451\\dotnet-desktop-and-portable.exe";
|
||||
return new[]
|
||||
{
|
||||
new object[] { ".NETStandard,Version=v1.6", "CoreFX", "lib\\netstandard1.6\\dotnet-desktop-and-portable.dll", true },
|
||||
new object[] { ".NETFramework,Version=v4.5.1", "NetFX", projectOutputPath, true }
|
||||
new object[] { "CoreFX", ".NETStandard,Version=v1.6", "lib\\netstandard1.6\\dotnet-desktop-and-portable.dll", true },
|
||||
new object[] { "NetFX", ".NETFramework,Version=v4.5.1", projectOutputPath, true }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public PackagedCommandTests()
|
||||
{
|
||||
_testProjectsRoot = Path.Combine(AppContext.BaseDirectory, "TestAssets", "TestProjects");
|
||||
_desktopTestProjectsRoot = Path.Combine(AppContext.BaseDirectory, "TestAssets", "DesktopTestProjects");
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("AppWithDirectAndToolDependency")]
|
||||
[InlineData("AppWithDirectAndToolDep")]
|
||||
[InlineData("AppWithToolDependency")]
|
||||
public void TestProjectToolIsAvailableThroughDriver(string appName)
|
||||
{
|
||||
var appDirectory = Path.Combine(_testProjectsRoot, appName);
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance(appName, identifier: appName)
|
||||
.WithLockFiles();
|
||||
|
||||
var appDirectory = testInstance.Path;
|
||||
|
||||
new BuildCommand(Path.Combine(appDirectory, "project.json"))
|
||||
.Execute()
|
||||
|
@ -75,7 +73,11 @@ namespace Microsoft.DotNet.Tests
|
|||
[Fact]
|
||||
public void CanInvokeToolWhosePackageNameIsDifferentFromDllName()
|
||||
{
|
||||
var appDirectory = Path.Combine(_testProjectsRoot, "AppWithDependencyOnToolWithOutputName");
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("AppWithDepOnToolWithOutputName")
|
||||
.WithLockFiles();
|
||||
|
||||
var appDirectory = testInstance.Path;
|
||||
|
||||
new BuildCommand(Path.Combine(appDirectory, "project.json"))
|
||||
.Execute()
|
||||
|
@ -93,7 +95,12 @@ namespace Microsoft.DotNet.Tests
|
|||
[Fact]
|
||||
public void CanInvokeToolFromDirectDependenciesIfPackageNameDifferentFromToolName()
|
||||
{
|
||||
var appDirectory = Path.Combine(_testProjectsRoot, "AppWithDirectDependencyWithOutputName");
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("AppWithDirectDepWithOutputName")
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var appDirectory = testInstance.Path;
|
||||
const string framework = ".NETCoreApp,Version=v1.0";
|
||||
|
||||
new BuildCommand(Path.Combine(appDirectory, "project.json"))
|
||||
|
@ -112,14 +119,19 @@ namespace Microsoft.DotNet.Tests
|
|||
// need conditional theories so we can skip on non-Windows
|
||||
[Theory]
|
||||
[MemberData("DependencyToolArguments")]
|
||||
public void TestFrameworkSpecificDependencyToolsCanBeInvoked(string framework, string args, string expectedDependencyToolPath, bool windowsOnly)
|
||||
public void TestFrameworkSpecificDependencyToolsCanBeInvoked(string identifier, string framework, string expectedDependencyToolPath, bool windowsOnly)
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && windowsOnly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var appDirectory = Path.Combine(_desktopTestProjectsRoot, "AppWithDirectDependencyDesktopAndPortable");
|
||||
var testInstance = _desktopTestAssetsManager
|
||||
.CreateTestInstance("AppWithDirectDepDesktopAndPortable", identifier: identifier)
|
||||
.WithBuildArtifacts()
|
||||
.WithLockFiles();
|
||||
|
||||
var appDirectory = testInstance.Path;
|
||||
|
||||
new BuildCommand(Path.Combine(appDirectory, "project.json"))
|
||||
.Execute()
|
||||
|
@ -127,10 +139,10 @@ namespace Microsoft.DotNet.Tests
|
|||
.Pass();
|
||||
|
||||
CommandResult result = new DependencyToolInvokerCommand { WorkingDirectory = appDirectory }
|
||||
.ExecuteWithCapturedOutput("desktop-and-portable", framework, args);
|
||||
.ExecuteWithCapturedOutput("desktop-and-portable", framework, identifier);
|
||||
|
||||
result.Should().HaveStdOutContaining(framework);
|
||||
result.Should().HaveStdOutContaining(args);
|
||||
result.Should().HaveStdOutContaining(identifier);
|
||||
result.Should().HaveStdOutContaining(expectedDependencyToolPath);
|
||||
result.Should().NotHaveStdErr();
|
||||
result.Should().Pass();
|
||||
|
@ -138,14 +150,18 @@ namespace Microsoft.DotNet.Tests
|
|||
|
||||
[Theory]
|
||||
[MemberData("LibraryDependencyToolArguments")]
|
||||
public void TestFrameworkSpecificLibraryDependencyToolsCannotBeInvoked(string framework, string args, string expectedDependencyToolPath, bool windowsOnly)
|
||||
public void TestFrameworkSpecificLibraryDependencyToolsCannotBeInvoked(string identifier, string framework, string expectedDependencyToolPath, bool windowsOnly)
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && windowsOnly)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var appDirectory = Path.Combine(_desktopTestProjectsRoot, "LibraryWithDirectDependencyDesktopAndPortable");
|
||||
var testInstance = _desktopTestAssetsManager
|
||||
.CreateTestInstance("LibraryWithDirectDependencyDesktopAndPortable", identifier: identifier)
|
||||
.WithLockFiles();
|
||||
|
||||
var appDirectory = testInstance.Path;
|
||||
|
||||
new BuildCommand(Path.Combine(appDirectory, "project.json"))
|
||||
.Execute()
|
||||
|
@ -153,7 +169,7 @@ namespace Microsoft.DotNet.Tests
|
|||
.Pass();
|
||||
|
||||
CommandResult result = new DependencyToolInvokerCommand { WorkingDirectory = appDirectory }
|
||||
.ExecuteWithCapturedOutput("desktop-and-portable", framework, args);
|
||||
.ExecuteWithCapturedOutput("desktop-and-portable", framework, identifier);
|
||||
|
||||
result.Should().HaveStdOutContaining("Command not found");
|
||||
result.Should().Fail();
|
||||
|
@ -162,7 +178,9 @@ namespace Microsoft.DotNet.Tests
|
|||
[Fact]
|
||||
public void ToolsCanAccessDependencyContextProperly()
|
||||
{
|
||||
var appDirectory = Path.Combine(_testProjectsRoot, "DependencyContextFromTool");
|
||||
var testInstance = TestAssetsManager.CreateTestInstance("DependencyContextFromTool");
|
||||
|
||||
var appDirectory = testInstance.Path;
|
||||
|
||||
CommandResult result = new DependencyContextTestCommand() { WorkingDirectory = appDirectory }
|
||||
.Execute(Path.Combine(appDirectory, "project.json"));
|
||||
|
@ -173,8 +191,11 @@ namespace Microsoft.DotNet.Tests
|
|||
[Fact]
|
||||
public void TestProjectDependencyIsNotAvailableThroughDriver()
|
||||
{
|
||||
var appName = "AppWithDirectDependency";
|
||||
var appDirectory = Path.Combine(_testProjectsRoot, appName);
|
||||
var testInstance = TestAssetsManager
|
||||
.CreateTestInstance("AppWithDirectDep")
|
||||
.WithLockFiles();
|
||||
|
||||
var appDirectory = testInstance.Path;
|
||||
|
||||
new BuildCommand(Path.Combine(appDirectory, "project.json"))
|
||||
.Execute()
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
"type": "build"
|
||||
},
|
||||
"xunit": "2.2.0-beta3-build3330",
|
||||
"dotnet-test-xunit": "1.0.0-rc2-318883-21",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000914"
|
||||
"dotnet-test-xunit": "1.0.0-rc2-330423-54",
|
||||
"Microsoft.DotNet.PlatformAbstractions": "1.0.1-beta-000919"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue