Addressing code review comments.

This commit is contained in:
Livar Cunha 2017-01-04 12:25:48 -08:00
parent 47eafb9ef4
commit a4dcff9ea8
5 changed files with 19 additions and 17 deletions

View file

@ -28,6 +28,8 @@ namespace Microsoft.DotNet.ProjectJsonMigration
}
}
public bool IsMultiTFM => ProjectContexts.Count() > 1;
public MigrationRuleInputs(
IEnumerable<ProjectContext> projectContexts,
ProjectRootElement outputMSBuildProject,

View file

@ -63,7 +63,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
MigrateImports(
migrationRuleInputs.CommonPropertyGroup,
targetFramework,
migrationRuleInputs.ProjectContexts.Count() > 1);
migrationRuleInputs.IsMultiTFM);
MigrateDependencies(
project,

View file

@ -32,7 +32,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
csproj,
scriptSet.Value,
scriptSet.Key,
migrationRuleInputs.ProjectContexts.Count() > 1);
migrationRuleInputs.IsMultiTFM);
}
}

View file

@ -34,20 +34,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
CleanExistingProperties(csproj);
CleanExistingPackageReferences(csproj);
if(migrationRuleInputs.ProjectContexts.Count() == 1)
{
_transformApplicator.Execute(
FrameworkTransform.Transform(
migrationRuleInputs.ProjectContexts.Single().TargetFramework),
propertyGroup,
mergeExisting: true);
_transformApplicator.Execute(
FrameworkRuntimeIdentifiersTransform.Transform(
migrationRuleInputs.ProjectContexts.Single()),
propertyGroup,
mergeExisting: true);
}
else
if(migrationRuleInputs.IsMultiTFM)
{
_transformApplicator.Execute(
FrameworksTransform.Transform(
@ -65,6 +52,19 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
propertyGroup,
mergeExisting: true);
}
else
{
_transformApplicator.Execute(
FrameworkTransform.Transform(
migrationRuleInputs.ProjectContexts.Single().TargetFramework),
propertyGroup,
mergeExisting: true);
_transformApplicator.Execute(
FrameworkRuntimeIdentifiersTransform.Transform(
migrationRuleInputs.ProjectContexts.Single()),
propertyGroup,
mergeExisting: true);
}
}
private void CleanExistingProperties(ProjectRootElement csproj)

View file

@ -201,7 +201,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
[Fact]
public void ItDoesNotConditionToPackageTargetFallBackWhenMigratingASingleTFM()
public void ItDoesNotAddConditionToPackageTargetFallBackWhenMigratingASingleTFM()
{
var importPropertyName = "PackageTargetFallback";