From a50708ac5c52bdac716a25c2be4a09176dee29d2 Mon Sep 17 00:00:00 2001 From: Sridhar Periyasamy Date: Mon, 26 Sep 2016 15:30:51 -0700 Subject: [PATCH] Address PR feedback --- .../ProjectF/.noautobuild | 0 .../TestAppDependencyGraph/ProjectF/Helper.cs | 15 +++++++++++++ .../ProjectF/project.json.1 | 22 +++++++++++++++++++ .../ProjectG/.noautobuild | 0 .../TestAppDependencyGraph/ProjectG/Helper.cs | 15 +++++++++++++ .../ProjectG/project.json.1 | 18 +++++++++++++++ .../commands/dotnet-migrate/MigrateCommand.cs | 5 ++--- .../GivenThatIWantToMigrateTestApps.cs | 19 +++++++++++----- 8 files changed, 86 insertions(+), 8 deletions(-) create mode 100644 TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/.noautobuild create mode 100644 TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/Helper.cs create mode 100644 TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/project.json.1 create mode 100644 TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/.noautobuild create mode 100644 TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/Helper.cs create mode 100644 TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/project.json.1 diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/.noautobuild b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/.noautobuild new file mode 100644 index 000000000..e69de29bb diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/Helper.cs b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/Helper.cs new file mode 100644 index 000000000..5c17a2e36 --- /dev/null +++ b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/Helper.cs @@ -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"; + } + } +} diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/project.json.1 b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/project.json.1 new file mode 100644 index 000000000..d2b7a9a21 --- /dev/null +++ b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectF/project.json.1 @@ -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": {} + } +} diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/.noautobuild b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/.noautobuild new file mode 100644 index 000000000..e69de29bb diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/Helper.cs b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/Helper.cs new file mode 100644 index 000000000..a7d766b09 --- /dev/null +++ b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/Helper.cs @@ -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"; + } + } +} diff --git a/TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/project.json.1 b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/project.json.1 new file mode 100644 index 000000000..48bc772d8 --- /dev/null +++ b/TestAssets/TestProjects/TestAppDependencyGraph/ProjectG/project.json.1 @@ -0,0 +1,18 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "nowarn": [ + "CS1591" + ], + "xmlDoc": true, + "additionalArguments": [ + "-highentropyva+" + ] + }, + "dependencies": { + "NETStandard.Library": "1.6.0" + }, + "frameworks": { + "netstandard1.5": {} + } +} diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs index 34e67d35b..a0a949f6a 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommand.cs @@ -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."); } } diff --git a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs index 4ae34b6ff..9d02e67e2 100644 --- a/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs +++ b/test/dotnet-migrate.Tests/GivenThatIWantToMigrateTestApps.cs @@ -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); }