Address PR feedback

This commit is contained in:
Sridhar Periyasamy 2016-09-26 15:30:51 -07:00
parent 7ee2bd1f26
commit a50708ac5c
8 changed files with 86 additions and 8 deletions

View file

@ -0,0 +1,15 @@
// 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;
namespace TestLibrary
{
public static class ProjectE
{
public static string GetMessage()
{
return "This string came from ProjectF";
}
}
}

View file

@ -0,0 +1,22 @@
{
"version": "1.0.0-*",
"buildOptions": {
"nowarn": [
"CS1591"
],
"xmlDoc": true,
"additionalArguments": [
"-highentropyva+"
]
},
"dependencies": {
"ProjectG": {
"target": "project",
"version": "1.0.0-*"
},
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.5": {}
}
}

View file

@ -0,0 +1,15 @@
// 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;
namespace TestLibrary
{
public static class ProjectE
{
public static string GetMessage()
{
return "This string came from ProjectG";
}
}
}

View file

@ -0,0 +1,18 @@
{
"version": "1.0.0-*",
"buildOptions": {
"nowarn": [
"CS1591"
],
"xmlDoc": true,
"additionalArguments": [
"-highentropyva+"
]
},
"dependencies": {
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.5": {}
}
}

View file

@ -43,12 +43,11 @@ namespace Microsoft.DotNet.Tools.Migrate
foreach (var project in projectsToMigrate)
{
Console.WriteLine($"START migrating project {project}..");
Console.WriteLine($"Migrating project {project}..");
var projectDirectory = Path.GetDirectoryName(project);
var outputDirectory = projectDirectory;
var migrationSettings = new MigrationSettings(projectDirectory, outputDirectory, sdkVersion, msBuildTemplate, _xprojFilePath);
new ProjectMigrator().Migrate(migrationSettings, _skipProjectReferences);
Console.WriteLine($"END migrating project {project}.");
}
return 0;
@ -71,7 +70,7 @@ namespace Microsoft.DotNet.Tools.Migrate
}
else
{
throw new Exception($"Invalid project argument - {projectArg}");
throw new Exception($"Invalid project argument - '{projectArg}' is not a project.json file and a directory named '{projectArg}' doesn't exist.");
}
}

View file

@ -150,16 +150,25 @@ namespace Microsoft.DotNet.Migration.Tests
VerifyMigration(Enumerable.Repeat(projectName, 1), projectDirectory);
}
[Fact]
public void It_migrates_all_projects_in_given_directory()
[Theory]
[InlineData(true)]
[InlineData(false)]
public void It_migrates_all_projects_in_given_directory(bool skipRefs)
{
var projectDirectory = TestAssetsManager.CreateTestInstance("TestAppDependencyGraph").Path;
var projectDirectory = TestAssetsManager.CreateTestInstance("TestAppDependencyGraph", callingMethod: $"MigrateDirectory.SkipRefs.{skipRefs}").Path;
FixUpProjectJsons(projectDirectory);
MigrateCommand.Run(new [] { projectDirectory, "--skip-project-references" }).Should().Be(0);
if (skipRefs)
{
MigrateCommand.Run(new [] { projectDirectory, "--skip-project-references" }).Should().Be(0);
}
else
{
MigrateCommand.Run(new [] { projectDirectory }).Should().Be(0);
}
string[] migratedProjects = new string[] { "ProjectA", "ProjectB", "ProjectC", "ProjectD", "ProjectE" };
string[] migratedProjects = new string[] { "ProjectA", "ProjectB", "ProjectC", "ProjectD", "ProjectE", "ProjectF", "ProjectG" };
VerifyMigration(migratedProjects, projectDirectory);
}