Migrate now moves all file copies to the None element.

This commit is contained in:
Livar Cunha 2017-02-22 22:06:45 -08:00
parent 3bbfcb428b
commit 14a7dd7ef1
7 changed files with 26 additions and 26 deletions

View file

@ -147,11 +147,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
new RemoveContextTransform("EmbeddedResource", condition: ic => ic != null);
private IncludeContextTransform CopyToOutputFilesTransform =>
new IncludeContextTransform("Content", transformMappings: true)
new IncludeContextTransform("None", transformMappings: true)
.WithMetadata("CopyToOutputDirectory", "PreserveNewest");
private IncludeContextTransform CopyToOutputFilesTransformForWeb =>
new UpdateContextTransform("Content", transformMappings: true)
new UpdateContextTransform("None", transformMappings: true)
.WithMetadata("CopyToOutputDirectory", "PreserveNewest");
private AddPropertyTransform<Project> GenerateRuntimeConfigurationFilesTransform =>

View file

@ -57,7 +57,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
packOptions => !string.IsNullOrEmpty(packOptions.RepositoryUrl));
private IncludeContextTransform PackFilesTransform =>
new IncludeContextTransform("Content", transformMappings: true)
new IncludeContextTransform("None", transformMappings: true)
.WithMetadata("Pack", "true")
.WithMappingsToTransform(_mappingsToTransfrom);

View file

@ -41,11 +41,11 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Rules
}
private IncludeContextTransform CopyToPublishDirectoryTransform =>
new IncludeContextTransform("Content", transformMappings: true)
new IncludeContextTransform("None", transformMappings: true)
.WithMetadata("CopyToPublishDirectory", "PreserveNewest");
private IncludeContextTransform CopyToPublishDirectoryTransformForWeb =>
new UpdateContextTransform("Content", transformMappings: true)
new UpdateContextTransform("None", transformMappings: true)
.WithMetadata("CopyToPublishDirectory", "PreserveNewest");
}
}

View file

@ -453,7 +453,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
[Theory]
[InlineData("compile", "Compile", 3, "")]
[InlineData("embed", "EmbeddedResource", 3, ";rootfile.cs")]
[InlineData("copyToOutput", "Content", 2, ";rootfile.cs")]
[InlineData("copyToOutput", "None", 2, ";rootfile.cs")]
private void MigratingGroupIncludeExcludePopulatesAppropriateProjectItemElement(
string group,
string itemName,
@ -529,7 +529,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
[Theory]
[InlineData("compile", "Compile", "")]
[InlineData("embed", "EmbeddedResource", ";rootfile.cs")]
[InlineData("copyToOutput", "Content", ";rootfile.cs")]
[InlineData("copyToOutput", "None", ";rootfile.cs")]
private void MigratingGroupIncludeOnlyPopulatesAppropriateProjectItemElement(
string group,
string itemName,
@ -725,7 +725,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
private static void VerifyContentMetadata(ProjectItemElement item)
{
if (item.ItemType == "Content")
if (item.ItemType == "None")
{
item.Metadata.Count(m => m.Name == "CopyToOutputDirectory").Should().Be(1);
}

View file

@ -176,7 +176,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(4);
@ -224,7 +224,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(5);
@ -280,7 +280,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(2);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(2);
@ -338,7 +338,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(3);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);
@ -410,7 +410,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(4);
@ -477,7 +477,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}
}");
var contentItems = mockProj.Items.Where(item => item.ItemType == "Content");
var contentItems = mockProj.Items.Where(item => item.ItemType == "None");
contentItems.Count().Should().Be(5);
contentItems.Where(i => i.ConditionChain().Count() == 1).Should().HaveCount(3);

View file

@ -200,7 +200,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}");
var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item => item.GetMetadataWithName("Pack").Value == "true");
contentItems.Count().Should().Be(1);
@ -223,7 +223,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}");
var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item =>
item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null);
@ -250,7 +250,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}");
var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item =>
item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null);
@ -284,7 +284,7 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
});
var contentItems = mockProj.Items
.Where(item => item.ItemType.Equals("Content", StringComparison.Ordinal))
.Where(item => item.ItemType.Equals("None", StringComparison.Ordinal))
.Where(item =>
item.GetMetadataWithName("Pack").Value == "true" &&
item.GetMetadataWithName("PackagePath") != null);

View file

@ -32,9 +32,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}",
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(2);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(2);
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
@ -82,9 +82,9 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}",
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(2);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(2);
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
item.Metadata.Count(m => m.Name == "CopyToPublishDirectory").Should().Be(1);
@ -126,13 +126,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}",
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(3);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(3);
// From ProjectReader #L725 (Both are empty)
var defaultIncludePatterns = Enumerable.Empty<string>();
var defaultExcludePatterns = Enumerable.Empty<string>();
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
if (item.Include.Contains(@"root\**\*"))
{
@ -189,13 +189,13 @@ namespace Microsoft.DotNet.ProjectJsonMigration.Tests
}",
testDirectory: testDirectory);
mockProj.Items.Count(i => i.ItemType.Equals("Content", StringComparison.Ordinal)).Should().Be(3);
mockProj.Items.Count(i => i.ItemType.Equals("None", StringComparison.Ordinal)).Should().Be(3);
// From ProjectReader #L725 (Both are empty)
var defaultIncludePatterns = Enumerable.Empty<string>();
var defaultExcludePatterns = Enumerable.Empty<string>();
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("Content", StringComparison.Ordinal)))
foreach (var item in mockProj.Items.Where(i => i.ItemType.Equals("None", StringComparison.Ordinal)))
{
var metadata = string.Join(",", item.Metadata.Select(m => m.Name));