Merge branch 'rel/1.0.0' into dev/jgoshi/enableSolutionBuildTestsRel100

This commit is contained in:
Piotr Puszkiewicz 2017-02-21 20:02:20 -08:00 committed by GitHub
commit 3457f0894e
7 changed files with 13 additions and 80 deletions

View file

@ -7,7 +7,7 @@
<CLI_NETSDK_Version>1.0.0-alpha-20170217-2</CLI_NETSDK_Version>
<CLI_NuGet_Version>4.0.0-rtm-2283</CLI_NuGet_Version>
<CLI_WEBSDK_Version>1.0.0-alpha-20170130-3-281</CLI_WEBSDK_Version>
<CLI_TestPlatform_Version>15.0.0-preview-20170210-02</CLI_TestPlatform_Version>
<CLI_TestPlatform_Version>15.0.0-preview-20170217-05</CLI_TestPlatform_Version>
<TemplateEngineVersion>1.0.0-beta1-20170202-111</TemplateEngineVersion>
<TemplateEngineTemplateVersion>1.0.0-beta1-20170206-112</TemplateEngineTemplateVersion>
<PlatformAbstractionsVersion>1.1.1</PlatformAbstractionsVersion>

View file

@ -50,15 +50,6 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
propertyGroup,
mergeExisting: true);
}
_transformApplicator.Execute(
RuntimeIdentifiersTransform.Transform(migrationRuleInputs.ProjectContexts),
propertyGroup,
mergeExisting: true);
_transformApplicator.Execute(
RuntimeIdentifierTransform.Transform(migrationRuleInputs.ProjectContexts),
propertyGroup,
mergeExisting: true);
}
private void CleanExistingProperties(ProjectRootElement csproj)
@ -127,36 +118,5 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
"TargetFramework",
framework => framework.GetShortFolderName(),
framework => true);
private AddPropertyTransform<IEnumerable<ProjectContext>> RuntimeIdentifiersTransform =>
new AddPropertyTransform<IEnumerable<ProjectContext>>(
"RuntimeIdentifiers",
projectContexts => RuntimeIdentifiers,
projectContexts => !projectContexts.HasRuntimes() &&
!projectContexts.HasLibraryOutput() &&
projectContexts.HasBothCoreAndFullFrameworkTFMs());
private AddPropertyTransform<IEnumerable<ProjectContext>> RuntimeIdentifierTransform =>
new AddPropertyTransform<IEnumerable<ProjectContext>>(
"RuntimeIdentifier",
projectContexts => "win7-x86",
projectContexts => !projectContexts.HasRuntimes() &&
!projectContexts.HasLibraryOutput() &&
projectContexts.HasFullFrameworkTFM())
.WithMSBuildCondition(projectContexts =>
{
string msBuildCondition = null;
if (projectContexts.HasBothCoreAndFullFrameworkTFMs())
{
msBuildCondition = string.Join(
" OR ",
projectContexts.Where(p => p.IsFullFramework()).Select(
p => $"'$(TargetFramework)' == '{p.TargetFramework.GetShortFolderName()}'"));
msBuildCondition = $" {msBuildCondition} ";
}
return msBuildCondition;
});
}
}

View file

@ -69,7 +69,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void MigratingCoreAndDesktopTFMsAddsAllRuntimeIdentifiersIfTheProjectDoesNothaveAnyAlready()
public void MigratingCoreAndDesktopTFMsDoesNoAddRuntimeIdentifiersOrRuntimeIdentifierWhenTheProjectDoesNothaveAnyAlready()
{
var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssetsManager)
@ -88,35 +88,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(1);
mockProj.Properties.First(p => p.Name == "RuntimeIdentifiers")
.Value.Should().Be("win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64");
}
[Fact]
public void MigratingCoreAndDesktopTFMsAddsRuntimeIdentifierWithWin7x86ConditionOnAllFullFrameworksWhenNoRuntimesExistAlready()
{
var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssetsManager)
.FromTestAssetBase("PJAppWithMultipleFrameworks")
.SaveToDisk(testDirectory);
var projectContexts = ProjectContext.CreateContextForEachFramework(testDirectory);
var mockProj = ProjectRootElement.Create();
var migrationSettings = MigrationSettings.CreateMigrationSettingsTestHook(testDirectory, testDirectory, mockProj);
var migrationInputs = new MigrationRuleInputs(
projectContexts,
mockProj,
mockProj.AddItemGroup(),
mockProj.AddPropertyGroup());
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifier").Should().Be(1);
var runtimeIdentifier = mockProj.Properties.First(p => p.Name == "RuntimeIdentifier");
runtimeIdentifier.Value.Should().Be("win7-x86");
runtimeIdentifier.Condition.Should().Be(" '$(TargetFramework)' == 'net20' OR '$(TargetFramework)' == 'net35' OR '$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'net461' ");
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifier").Should().Be(0);
}
[Fact]
@ -144,7 +117,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void MigratingProjectWithFullFrameworkTFMsOnlyAddsARuntimeIdentifierWin7x86WhenNoRuntimesExistAlready()
public void MigratingProjectWithFullFrameworkTFMsDoesNotAddRuntimeIdentifiersOrRuntimeIdentiferWhenNoRuntimesExistAlready()
{
var testDirectory = Temp.CreateDirectory().Path;
var testPJ = new ProjectJsonBuilder(TestAssetsManager)
@ -165,8 +138,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
new MigrateTFMRule().Apply(migrationSettings, migrationInputs);
mockProj.Properties.Count(p => p.Name == "RuntimeIdentifiers").Should().Be(0);
mockProj.Properties.Where(p => p.Name == "RuntimeIdentifier").Should().HaveCount(1);
mockProj.Properties.Single(p => p.Name == "RuntimeIdentifier").Value.Should().Be("win7-x86");
mockProj.Properties.Where(p => p.Name == "RuntimeIdentifier").Should().HaveCount(0);
}
[Fact]

View file

@ -19,6 +19,7 @@ namespace Microsoft.DotNet.Tools.Test.Utilities
{
protected const string DefaultFramework = "netcoreapp1.0";
protected const string DefaultLibraryFramework = "netstandard1.5";
protected const string ConsoleLoggerOutputNormal = "--logger:console;verbosity=normal";
private TempRoot _temp;
private static TestAssetsManager s_testsAssetsMgr;
private static TestAssets s_testAssets;

View file

@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
var result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.WithRuntime(runtime)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
result.StdOut
.Should().Contain("Total tests: 3. Passed: 2. Failed: 1. Skipped: 0.", "because .NET 4.6 tests will pass")
@ -61,7 +61,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
// Verify
// for target framework net46

View file

@ -32,7 +32,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
// Verify
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
@ -60,7 +60,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
// Call test
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(testProjectDirectory)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
// Verify
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
@ -205,7 +205,7 @@ namespace Microsoft.DotNet.Cli.Test.Tests
CommandResult result = new DotnetTestCommand()
.WithWorkingDirectory(rootPath)
.ExecuteWithCapturedOutput();
.ExecuteWithCapturedOutput(TestBase.ConsoleLoggerOutputNormal);
result.StdOut.Should().Contain("Total tests: 2. Passed: 1. Failed: 1. Skipped: 0.");
result.StdOut.Should().Contain("Passed TestNamespace.VSTestTests.VSTestPassTest");

View file

@ -34,7 +34,7 @@ namespace Microsoft.DotNet.Cli.VSTest.Tests
.GetDirectory("bin", configuration, "netcoreapp1.0")
.GetFile($"{testAppName}.dll");
var argsForVstest = $"\"{outputDll.FullName}\"";
var argsForVstest = $"\"{outputDll.FullName}\" {TestBase.ConsoleLoggerOutputNormal}";
// Call vstest
var result = new VSTestCommand().ExecuteWithCapturedOutput(argsForVstest);