Skip to content
This repository has been archived by the owner on Nov 6, 2018. It is now read-only.

Add a task to generate a manifest with the file system structure of the original files #308

Merged
merged 1 commit into from
Dec 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions FileSystem.sln
Original file line number Diff line number Diff line change
Expand Up @@ -54,48 +54,152 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{315EAB76
build\repo.props = build\repo.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FS.Embedded.Manifest.Task", "src\FS.Embedded.Manifest.Task\FS.Embedded.Manifest.Task.csproj", "{CDEFB59F-C4D1-4573-A6C7-F11C34936450}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FS.Embedded.Manifest.Task.Test", "test\FS.Embedded.Manifest.Task.Test\FS.Embedded.Manifest.Task.Test.csproj", "{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Debug|x64.ActiveCfg = Debug|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Debug|x64.Build.0 = Debug|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Debug|x86.ActiveCfg = Debug|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Debug|x86.Build.0 = Debug|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Release|Any CPU.Build.0 = Release|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Release|x64.ActiveCfg = Release|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Release|x64.Build.0 = Release|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Release|x86.ActiveCfg = Release|Any CPU
{DD94B7E8-3A59-4F84-98A0-8139BE259A87}.Release|x86.Build.0 = Release|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Debug|x64.ActiveCfg = Debug|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Debug|x64.Build.0 = Debug|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Debug|x86.ActiveCfg = Debug|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Debug|x86.Build.0 = Debug|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Release|Any CPU.Build.0 = Release|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Release|x64.ActiveCfg = Release|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Release|x64.Build.0 = Release|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Release|x86.ActiveCfg = Release|Any CPU
{970449A2-3BBB-4E87-8513-C41F109B1A3E}.Release|x86.Build.0 = Release|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Debug|x64.ActiveCfg = Debug|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Debug|x64.Build.0 = Debug|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Debug|x86.ActiveCfg = Debug|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Debug|x86.Build.0 = Debug|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Release|Any CPU.Build.0 = Release|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Release|x64.ActiveCfg = Release|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Release|x64.Build.0 = Release|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Release|x86.ActiveCfg = Release|Any CPU
{45A5A942-4EFB-4839-AEA3-EB1D2BAB332C}.Release|x86.Build.0 = Release|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Debug|x64.ActiveCfg = Debug|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Debug|x64.Build.0 = Debug|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Debug|x86.ActiveCfg = Debug|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Debug|x86.Build.0 = Debug|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Release|Any CPU.Build.0 = Release|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Release|x64.ActiveCfg = Release|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Release|x64.Build.0 = Release|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Release|x86.ActiveCfg = Release|Any CPU
{BD98C115-7FA6-4A78-8198-9650A4706B79}.Release|x86.Build.0 = Release|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Debug|x64.ActiveCfg = Debug|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Debug|x64.Build.0 = Debug|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Debug|x86.ActiveCfg = Debug|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Debug|x86.Build.0 = Debug|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Release|Any CPU.Build.0 = Release|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Release|x64.ActiveCfg = Release|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Release|x64.Build.0 = Release|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Release|x86.ActiveCfg = Release|Any CPU
{BA56E837-C793-4A7D-824D-84492028E066}.Release|x86.Build.0 = Release|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Debug|x64.ActiveCfg = Debug|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Debug|x64.Build.0 = Debug|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Debug|x86.ActiveCfg = Debug|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Debug|x86.Build.0 = Debug|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Release|Any CPU.Build.0 = Release|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Release|x64.ActiveCfg = Release|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Release|x64.Build.0 = Release|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Release|x86.ActiveCfg = Release|Any CPU
{6B6BA57A-B32D-430A-AF39-09CAA85308C2}.Release|x86.Build.0 = Release|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Debug|x64.ActiveCfg = Debug|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Debug|x64.Build.0 = Debug|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Debug|x86.ActiveCfg = Debug|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Debug|x86.Build.0 = Debug|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Release|Any CPU.Build.0 = Release|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Release|x64.ActiveCfg = Release|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Release|x64.Build.0 = Release|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Release|x86.ActiveCfg = Release|Any CPU
{66FE5FDF-BBF9-4573-A7B7-53551731C0F9}.Release|x86.Build.0 = Release|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Debug|x64.ActiveCfg = Debug|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Debug|x64.Build.0 = Debug|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Debug|x86.ActiveCfg = Debug|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Debug|x86.Build.0 = Debug|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Release|Any CPU.Build.0 = Release|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Release|x64.ActiveCfg = Release|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Release|x64.Build.0 = Release|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Release|x86.ActiveCfg = Release|Any CPU
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254}.Release|x86.Build.0 = Release|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Debug|x64.ActiveCfg = Debug|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Debug|x64.Build.0 = Debug|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Debug|x86.ActiveCfg = Debug|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Debug|x86.Build.0 = Debug|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Release|Any CPU.Build.0 = Release|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Release|x64.ActiveCfg = Release|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Release|x64.Build.0 = Release|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Release|x86.ActiveCfg = Release|Any CPU
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494}.Release|x86.Build.0 = Release|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Debug|x64.ActiveCfg = Debug|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Debug|x64.Build.0 = Debug|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Debug|x86.ActiveCfg = Debug|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Debug|x86.Build.0 = Debug|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Release|Any CPU.Build.0 = Release|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Release|x64.ActiveCfg = Release|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Release|x64.Build.0 = Release|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Release|x86.ActiveCfg = Release|Any CPU
{CDEFB59F-C4D1-4573-A6C7-F11C34936450}.Release|x86.Build.0 = Release|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Debug|x64.ActiveCfg = Debug|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Debug|x64.Build.0 = Debug|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Debug|x86.ActiveCfg = Debug|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Debug|x86.Build.0 = Debug|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Release|Any CPU.Build.0 = Release|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Release|x64.ActiveCfg = Release|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Release|x64.Build.0 = Release|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Release|x86.ActiveCfg = Release|Any CPU
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -111,6 +215,8 @@ Global
{CAAF52EF-F91B-474D-AC56-FE9D96FF8254} = {A1477614-E825-4204-A684-385004B63AEB}
{C2EA9BD0-C986-4B60-9E45-5EA51E1EA494} = {E399495E-82B8-4C06-8779-C1D02BEF4495}
{315EAB76-E28A-4A6C-84EE-041E68D90846} = {1A060559-74DD-4B5A-BBA1-E8A441E729C1}
{CDEFB59F-C4D1-4573-A6C7-F11C34936450} = {A1477614-E825-4204-A684-385004B63AEB}
{AEFA9DDF-5F56-474B-B5E8-61573D389AE6} = {E399495E-82B8-4C06-8779-C1D02BEF4495}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E7B0BEF0-05DF-4276-8F71-176D1067D2D7}
Expand Down
11 changes: 10 additions & 1 deletion NuGetPackageVerifier.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
"Default": { // Rules to run for packages not listed in any other set.
"rules": [
"DefaultCompositeRule"
]
],
"packages": {
"Microsoft.Extensions.FileProviders.Embedded.Manifest.Task": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove this now.

"Exclusions": {
"DOC_MISSING": {
"lib/netstandard2.0/Microsoft.Extensions.FileProviders.Embedded.Manifest.Task.dll": "It is an MSBuild task"
}
}
}
}
}
}
4 changes: 4 additions & 0 deletions build/dependencies.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
<PropertyGroup Label="Package Versions">
<InternalAspNetCoreSdkPackageVersion>2.1.0-preview1-15626</InternalAspNetCoreSdkPackageVersion>
<MicrosoftAspNetCoreTestingPackageVersion>2.1.0-preview1-27849</MicrosoftAspNetCoreTestingPackageVersion>
<MicrosoftBuildFrameworkPackageVersion>15.3.409</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildPackageVersion>15.3.409</MicrosoftBuildPackageVersion>
<MicrosoftBuildTasksCorePackageVersion>15.3.409</MicrosoftBuildTasksCorePackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>15.3.409</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>2.1.0-preview1-27849</MicrosoftExtensionsHashCodeCombinerSourcesPackageVersion>
<MicrosoftExtensionsPrimitivesPackageVersion>2.1.0-preview1-27849</MicrosoftExtensionsPrimitivesPackageVersion>
<MicrosoftNETCoreApp20PackageVersion>2.0.0</MicrosoftNETCoreApp20PackageVersion>
Expand Down
21 changes: 21 additions & 0 deletions src/FS.Embedded.Manifest.Task/EmbeddedItem.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;

namespace Microsoft.Extensions.FileProviders.Embedded.Manifest.Task
{
public class EmbeddedItem : IEquatable<EmbeddedItem>
{
public string ManifestFilePath { get; set; }

public string AssemblyResourceName { get; set; }

public bool Equals(EmbeddedItem other) =>
string.Equals(ManifestFilePath, other?.ManifestFilePath, StringComparison.Ordinal) &&
string.Equals(AssemblyResourceName, other?.AssemblyResourceName, StringComparison.Ordinal);

public override bool Equals(object obj) => Equals(obj as EmbeddedItem);
public override int GetHashCode() => ManifestFilePath.GetHashCode() ^ AssemblyResourceName.GetHashCode();
}
}
121 changes: 121 additions & 0 deletions src/FS.Embedded.Manifest.Task/Entry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace Microsoft.Extensions.FileProviders.Embedded.Manifest.Task.Internal
{
/// <summary>
/// This type is for internal uses only and is not meant to be consumed by any other library.
/// </summary>
[DebuggerDisplay("{Name,nq}")]
public class Entry : IEquatable<Entry>
{
public bool IsFile { get; private set; }

public string Name { get; private set; }

public string AssemblyResourceName { get; private set; }

public ISet<Entry> Children { get; } = new SortedSet<Entry>(NameComparer.Instance);

public static Entry Directory(string name) =>
new Entry { Name = name };

public static Entry File(string name, string assemblyResourceName) =>
new Entry { Name = name, AssemblyResourceName = assemblyResourceName, IsFile = true };

internal void AddChild(Entry child)
{
if (IsFile)
{
throw new InvalidOperationException("Tried to add children to a file.");
}

if (Children.Contains(child))
{
throw new InvalidOperationException($"An item with the name '{child.Name}' already exists.");
}

Children.Add(child);
}

internal Entry GetDirectory(string currentSegment)
{
if (IsFile)
{
throw new InvalidOperationException("Tried to get a directory from a file.");
}

foreach (var child in Children)
{
if (child.HasName(currentSegment))
{
if (child.IsFile)
{
throw new InvalidOperationException("Tried to find a directory but found a file instead");
}
else
{
return child;
}
}
}

return null;
}

public bool Equals(Entry other)
{
if (other == null || !other.HasName(Name) || other.IsFile != IsFile)
{
return false;
}

if (IsFile)
{
return string.Equals(other.AssemblyResourceName, AssemblyResourceName, StringComparison.Ordinal);
}
else
{
return SameChildren(Children, other.Children);
}
}

private bool HasName(string currentSegment)
{
return string.Equals(Name, currentSegment, StringComparison.Ordinal);
}

private bool SameChildren(ISet<Entry> left, ISet<Entry> right)
{
if (left.Count != right.Count)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't there a SetEquals on set?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Equality for these sets is not based solely on the name. We check that we aren't adding two files with the same name but different metadata

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. But you should be able to use ``SortedSet.CreateSetComparer(EqualityComparer.Default).Equals(left, right);`

{
return false;
}

var le = left.GetEnumerator();
var re = right.GetEnumerator();
while (le.MoveNext() && re.MoveNext())
{
if (!le.Current.Equals(re.Current))
{
return false;
}
}

return true;
}

private class NameComparer : IComparer<Entry>
{
public static NameComparer Instance { get; } = new NameComparer();

public int Compare(Entry x, Entry y) =>
string.Compare(x?.Name, y?.Name, StringComparison.Ordinal);
}
}
}
21 changes: 21 additions & 0 deletions src/FS.Embedded.Manifest.Task/FS.Embedded.Manifest.Task.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>Microsoft.Extensions.FileProviders.Embedded.Manifest.Task</RootNamespace>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you considered putting this inside the Microsoft.Extensions.FileProviders.Embedded nuget package, instead of making a new package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean the MSBuild part of it? (The targets file). I would definitely keep the assembly separate

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assembly definitely needs to be separate. One way to layout this package is like this:

- Microsoft.Extensions.FileProviders.Embedded.nupkg
  - lib/
     - netstandard2.0/
        + Microsoft.Extensions.FileProviders.Embedded.dll
  - build/
     - netstandard2.0/
         + Microsoft.Extensions.FileProviders.Embedded.targets
         + Microsoft.Extensions.FileProviders.Embedded.Manifest.Task.dll

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

<AssemblyName>Microsoft.Extensions.FileProviders.Embedded.Manifest.Task</AssemblyName>
<Description>MSBuild task to generate a manifest that can be used by Microsoft.Extensions.FileProviders.Embedded to preserve
metadata of the files embedded in the assembly at compilation time.</Description>
<TargetFrameworks>netstandard1.5;net461</TargetFrameworks>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<EnableApiCheck>false</EnableApiCheck>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Build" Version="$(MicrosoftBuildPackageVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Framework" Version="$(MicrosoftBuildFrameworkPackageVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Tasks.Core" Version="$(MicrosoftBuildTasksCorePackageVersion)" PrivateAssets="All" />
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="$(MicrosoftBuildUtilitiesCorePackageVersion)" PrivateAssets="All" />
</ItemGroup>

</Project>
Loading