Skip to content

Commit

Permalink
Merge branch 'devlead-feature/GH-1694' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
patriksvensson committed Jul 28, 2017
2 parents e54565a + aa7adaa commit c9561fe
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 46 deletions.
47 changes: 47 additions & 0 deletions src/Cake.NuGet.Tests/Fixtures/NuGetContentResolverFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,59 @@ protected NuGetContentResolverFixture(string framework)
Package = new PackageReference("nuget:?package=Foo");
}

public void CreateCLRAssembly(FilePath path)
{
FileSystem.CreateFile(path, ClrAssemblyData);
}

public void CreateNonCLRAssembly(FilePath path)
{
FileSystem.CreateFile(path, NonClrAssemblyData);
}

public IReadOnlyCollection<IFile> GetFiles()
{
var resolver = GetResolver();
return resolver.GetFiles(Path, Package, PackageType);
}

protected abstract INuGetContentResolver GetResolver();

private static readonly byte[] ClrAssemblyData = new byte[]
{
0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00,
0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f,
0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x50, 0x45, 0x00, 0x00, 0x4c, 0x01, 0x03, 0x00, 0x8a, 0x54, 0x4a, 0xf5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x22, 0x20, 0x0b, 0x01, 0x30, 0x00, 0x00, 0x84, 0x00, 0x00,
0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xa2, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x60, 0x85,
0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2e, 0xa2, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x88, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xe0, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x94, 0xa1, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00, 0x48
};

private static readonly byte[] NonClrAssemblyData = new byte[]
{
0x4d, 0x5a, 0x90, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x01, 0x00, 0x00,
0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, 0x21, 0xb8, 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x20, 0x63, 0x61, 0x6e, 0x6e, 0x6f,
0x74, 0x20, 0x62, 0x65, 0x20, 0x72, 0x75, 0x6e, 0x20, 0x69, 0x6e, 0x20, 0x44, 0x4f, 0x53, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x2e, 0x0d, 0x0d, 0x0a, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xab, 0x04, 0x28, 0x30, 0xef, 0x65, 0x46, 0x63, 0xef, 0x65, 0x46, 0x63, 0xef, 0x65, 0x46, 0x63, 0x71, 0xc5, 0x81, 0x63, 0xea, 0x65, 0x46, 0x63, 0xa9, 0x34, 0xa7, 0x63, 0xc2, 0x65, 0x46, 0x63,
0xa9, 0x34, 0xa6, 0x63, 0x71, 0x65, 0x46, 0x63, 0xa9, 0x34, 0x99, 0x63, 0xe4, 0x65, 0x46, 0x63, 0x32, 0x9a, 0x88, 0x63, 0xed, 0x65, 0x46, 0x63, 0x32, 0x9a, 0x8d, 0x63, 0xe0, 0x65, 0x46, 0x63,
0xef, 0x65, 0x47, 0x63, 0x43, 0x65, 0x46, 0x63, 0x5a, 0xfb, 0xa2, 0x63, 0x4d, 0x65, 0x46, 0x63, 0x5a, 0xfb, 0x9a, 0x63, 0xee, 0x65, 0x46, 0x63, 0xe2, 0x37, 0x9d, 0x63, 0xee, 0x65, 0x46, 0x63,
0xef, 0x65, 0xd1, 0x63, 0xee, 0x65, 0x46, 0x63, 0x5a, 0xfb, 0x98, 0x63, 0xee, 0x65, 0x46, 0x63, 0x52, 0x69, 0x63, 0x68, 0xef, 0x65, 0x46, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x45, 0x00, 0x00, 0x64, 0x86, 0x06, 0x00, 0xe2, 0xac, 0x47, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x22, 0x20,
0x0b, 0x02, 0x0c, 0x00, 0x00, 0x6e, 0x0d, 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x87, 0x0c, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x11, 0x00, 0x00, 0x04, 0x00, 0x00,
0xfe, 0x24, 0x12, 0x00, 0x03, 0x00, 0x60, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0xd9, 0x0f, 0x00, 0x8a, 0x62, 0x00, 0x00, 0x8c, 0x3b, 0x10, 0x00, 0xa0, 0x00, 0x00, 0x00,
0x00, 0x90, 0x11, 0x00, 0xb8, 0x05, 0x00, 0x00, 0x00, 0xb0, 0x10, 0x00, 0xb4, 0xd5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x11, 0x00, 0x3c, 0x09, 0x00, 0x00,
0xa0, 0x85, 0x0d, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x90, 0xcd, 0x0e, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0d, 0x00, 0x20, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public NuGetToolContentResolver(IFileSystem fileSystem, ICakeEnvironment environ
{
}

protected override IReadOnlyCollection<IFile> GetAddinAssemblies(DirectoryPath path)
protected override IReadOnlyCollection<IFile> GetAddinAssemblies(DirectoryPath path, PackageReference package)
{
throw new NotSupportedException("Only tools can be resolved with this resolver.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#if !NETCORE
using System.Linq;
using Cake.NuGet.Tests.Fixtures;
using Cake.Testing;
using Xunit;

namespace Cake.NuGet.Tests.Unit
Expand All @@ -16,8 +15,10 @@ public sealed class NuGetV2ContentResolverTests
public void Should_Throw_If_Path_Is_Null()
{
// Given
var fixture = new NuGetV2ContentResolverFixture();
fixture.Path = null;
var fixture = new NuGetV2ContentResolverFixture()
{
Path = null
};

// When
var result = Record.Exception(() => fixture.GetFiles());
Expand All @@ -31,12 +32,12 @@ public void Should_Return_Exact_Framework_If_Possible()
{
// Given
var fixture = new NuGetV2ContentResolverFixture(".NETFramework,Version=v4.5");
fixture.FileSystem.CreateFile("/Working/lib/net45/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net451/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net452/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net461/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/netstandard1.5/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/netstandard1.6/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net45/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net451/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net452/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net461/file.dll");
fixture.CreateCLRAssembly("/Working/lib/netstandard1.5/file.dll");
fixture.CreateCLRAssembly("/Working/lib/netstandard1.6/file.dll");

// When
var result = fixture.GetFiles();
Expand All @@ -51,10 +52,10 @@ public void Should_Return_Nearest_Compatible_Framework_If_An_Exact_Match_Is_Not_
{
// Given
var fixture = new NuGetV2ContentResolverFixture(".NETFramework,Version=v4.5.2");
fixture.FileSystem.CreateFile("/Working/lib/net45/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net451/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net461/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/netstandard1.5/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net45/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net451/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net461/file.dll");
fixture.CreateCLRAssembly("/Working/lib/netstandard1.5/file.dll");

// When
var result = fixture.GetFiles();
Expand All @@ -69,16 +70,32 @@ public void Should_Return_Empty_Result_If_Any_Match_Is_Not_Possible()
{
// Given
var fixture = new NuGetV2ContentResolverFixture(".NETStandard,Version=v4.5");
fixture.FileSystem.CreateFile("/Working/lib/net451/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net452/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net461/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net451/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net452/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net461/file.dll");

// When
var result = fixture.GetFiles();

// Then
Assert.Equal(0, result.Count);
}

[Fact]
public void Should_Return_Only_CLR_Assemblies()
{
// Given
var fixture = new NuGetV2ContentResolverFixture(".NETFramework,Version=v4.5.2");
fixture.CreateCLRAssembly("/Working/lib/net451/file.dll");
fixture.CreateNonCLRAssembly("/Working/lib/net451/lib/native.dll");

// When
var result = fixture.GetFiles();

// Then
Assert.Equal(1, result.Count);
Assert.Equal("/Working/lib/net451/file.dll", result.ElementAt(0).Path.FullPath);
}
}
}
#endif
48 changes: 32 additions & 16 deletions src/Cake.NuGet.Tests/Unit/V3/NuGetV3ContentResolverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#if NETCORE
using System.Linq;
using Cake.NuGet.Tests.Fixtures;
using Cake.Testing;
using Xunit;

namespace Cake.NuGet.Tests.Unit.V3
Expand All @@ -31,12 +30,12 @@ public void Should_Return_Exact_Framework_If_Possible()
{
// Given
var fixture = new NuGetV3ContentResolverFixture(".NETStandard,Version=v1.6");
fixture.FileSystem.CreateFile("/Working/lib/net45/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net451/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net452/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net461/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/netstandard1.5/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/netstandard1.6/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net45/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net451/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net452/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net461/file.dll");
fixture.CreateCLRAssembly("/Working/lib/netstandard1.5/file.dll");
fixture.CreateCLRAssembly("/Working/lib/netstandard1.6/file.dll");

// When
var result = fixture.GetFiles();
Expand All @@ -51,11 +50,11 @@ public void Should_Return_Nearest_Compatible_Framework_If_An_Exact_Match_Is_Not_
{
// Given
var fixture = new NuGetV3ContentResolverFixture(".NETStandard,Version=v1.6");
fixture.FileSystem.CreateFile("/Working/lib/net45/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net451/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net452/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net461/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/netstandard1.5/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net45/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net451/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net452/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net461/file.dll");
fixture.CreateCLRAssembly("/Working/lib/netstandard1.5/file.dll");

// When
var result = fixture.GetFiles();
Expand All @@ -70,17 +69,34 @@ public void Should_Return_Empty_Result_If_Any_Match_Is_Not_Possible()
{
// Given
var fixture = new NuGetV3ContentResolverFixture(".NETStandard,Version=v1.6");
fixture.FileSystem.CreateFile("/Working/lib/net45/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net451/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net452/file.dll");
fixture.FileSystem.CreateFile("/Working/lib/net461/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net45/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net451/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net452/file.dll");
fixture.CreateCLRAssembly("/Working/lib/net461/file.dll");

// When
var result = fixture.GetFiles();

// Then
Assert.Equal(0, result.Count);
}

[Fact]
public void Should_Return_Only_CLR_Assemblies()
{
// Given
var fixture = new NuGetV3ContentResolverFixture(".NETStandard,Version=v1.6");

fixture.CreateCLRAssembly("/Working/lib/netstandard1.6/file.dll");
fixture.CreateNonCLRAssembly("/Working/lib/netstandard1.6/lib/native.dll");

// When
var result = fixture.GetFiles();

// Then
Assert.Equal(1, result.Count);
Assert.Equal("/Working/lib/netstandard1.6/file.dll", result.ElementAt(0).Path.FullPath);
}
}
}
#endif
47 changes: 43 additions & 4 deletions src/Cake.NuGet/NuGetContentResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public IReadOnlyCollection<IFile> GetFiles(DirectoryPath path, PackageReference

if (type == PackageType.Addin)
{
return GetAddinAssemblies(path);
return GetAddinAssemblies(path, package);
}
if (type == PackageType.Tool)
{
Expand All @@ -46,7 +46,7 @@ public IReadOnlyCollection<IFile> GetFiles(DirectoryPath path, PackageReference
throw new InvalidOperationException("Unknown resource type.");
}

protected abstract IReadOnlyCollection<IFile> GetAddinAssemblies(DirectoryPath path);
protected abstract IReadOnlyCollection<IFile> GetAddinAssemblies(DirectoryPath path, PackageReference package);

private IReadOnlyCollection<IFile> GetToolFiles(DirectoryPath path, PackageReference package)
{
Expand All @@ -59,12 +59,12 @@ private IReadOnlyCollection<IFile> GetToolFiles(DirectoryPath path, PackageRefer
return result;
}

private IEnumerable<IFile> GetFiles(DirectoryPath path, PackageReference package)
protected IEnumerable<IFile> GetFiles(DirectoryPath path, PackageReference package, string[] patterns = null)
{
var collection = new FilePathCollection(new PathComparer(_environment));

// Get default files (exe and dll).
var patterns = new[] { path.FullPath + "/**/*.exe", path.FullPath + "/**/*.dll" };
patterns = patterns ?? new[] { path.FullPath + "/**/*.exe", path.FullPath + "/**/*.dll" };
foreach (var pattern in patterns)
{
collection.Add(_globber.GetFiles(pattern));
Expand Down Expand Up @@ -93,5 +93,44 @@ private IEnumerable<IFile> GetFiles(DirectoryPath path, PackageReference package
// Return the files.
return collection.Select(p => _fileSystem.GetFile(p)).ToArray();
}

protected bool IsCLRAssembly(IFile file)
{
if (!file.Exists || file.Length < 365)
{
return false;
}

using (var fs = file.OpenRead())
{
using (var reader = new System.IO.BinaryReader(fs))
{
const uint MagicOffset = 0x18;
const uint Magic32Bit = 0x10b;
const int Offset32Bit = 0x5e;
const int Offset64Bit = 0x6e;
const int OffsetDictionary = 0x70;

// PE Header Start
fs.Position = 0x3C;

// Go to Magic header
fs.Position = reader.ReadUInt32() + MagicOffset;

// Check magic to get 32 / 64 bit offset
var is32Bit = reader.ReadUInt16() == Magic32Bit;
var offset = fs.Position + (is32Bit ? Offset32Bit : Offset64Bit) + OffsetDictionary;

if (offset + 4 > fs.Length)
{
return false;
}

// Go to dictionary start
fs.Position = offset;
return reader.ReadUInt32() > 0;
}
}
}
}
}
13 changes: 6 additions & 7 deletions src/Cake.NuGet/V2/NuGetV2ContentResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public NuGetV2ContentResolver(
_log = log;
}

protected override IReadOnlyCollection<IFile> GetAddinAssemblies(DirectoryPath packageDirectory)
protected override IReadOnlyCollection<IFile> GetAddinAssemblies(DirectoryPath packageDirectory, PackageReference package)
{
if (packageDirectory == null)
{
Expand All @@ -50,7 +50,7 @@ protected override IReadOnlyCollection<IFile> GetAddinAssemblies(DirectoryPath p
return new List<IFile>();
}

var packageAssemblies = GetAllPackageAssemblies(packageDirectory);
var packageAssemblies = GetAllPackageAssemblies(packageDirectory, package);
if (!packageAssemblies.Any())
{
_log.Warning("Unable to locate any assemblies under {0}", packageDirectory.FullPath);
Expand All @@ -67,12 +67,11 @@ private IReadOnlyCollection<IFile> ResolveAssemblyFiles(IEnumerable<FilePath> co
return compatibleAssemblyPaths.Select(_fileSystem.GetFile).ToList().AsReadOnly();
}

private FilePath[] GetAllPackageAssemblies(DirectoryPath packageDirectory)
private FilePath[] GetAllPackageAssemblies(DirectoryPath packageDirectory, PackageReference package)
{
return _fileSystem.GetDirectory(packageDirectory).GetFiles("*.dll", SearchScope.Recursive)
.Where(
file =>
!"Cake.Core.dll".Equals(file.Path.GetFilename().FullPath, StringComparison.OrdinalIgnoreCase))
return GetFiles(packageDirectory, package, new[] { packageDirectory.FullPath + "/**/*.dll" })
.Where(file => !"Cake.Core.dll".Equals(file.Path.GetFilename().FullPath, StringComparison.OrdinalIgnoreCase)
&& IsCLRAssembly(file))
.Select(a => a.Path)
.ToArray();
}
Expand Down
Loading

0 comments on commit c9561fe

Please sign in to comment.