Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
1 change: 0 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<PackageVersion Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.14.0" />
<PackageVersion Include="System.Text.Json" Version="9.0.8" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
<PackageVersion Include="Mono.Cecil" Version="0.11.6" />
</ItemGroup>

<ItemGroup Label="Test projects dependencies">
Expand Down
45 changes: 0 additions & 45 deletions src/NuSeal/AssemblyUtils.cs

This file was deleted.

2 changes: 0 additions & 2 deletions src/NuSeal/Assets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ public static string GenerateTargets(ConsumerParameters parameters)
{condition}>

<NuSeal.{TASK_NAME}
PackageReferences="@(PackageReference)"
ResolvedCompileFileDefinitions="@(ResolvedCompileFileDefinitions)"
MainAssemblyPath="$(TargetPath)"
ProtectedPackageId="{parameters.PackageId}"
ProtectedAssemblyName="{parameters.AssemblyName}"
Expand Down
6 changes: 1 addition & 5 deletions src/NuSeal/NuSeal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
<PackageReference Include="Microsoft.Build.Utilities.Core" PrivateAssets="all" ExcludeAssets="runtime" />
<PackageReference Include="System.Text.Json" PrivateAssets="all" ExcludeAssets="runtime" />
<PackageReference Include="BouncyCastle.Cryptography" PrivateAssets="all" />
<PackageReference Include="Mono.Cecil" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand All @@ -64,10 +63,7 @@
<ItemGroup>
<BuildOutputInPackage
Include="@(ReferenceCopyLocalPaths)"
TargetPath="%(ReferenceCopyLocalPaths.DestinationSubPath)"
Condition="'%(ReferenceCopyLocalPaths.Filename)' != 'Mono.Cecil.Mdb' AND
'%(ReferenceCopyLocalPaths.Filename)' != 'Mono.Cecil.Pdb' AND
'%(ReferenceCopyLocalPaths.Filename)' != 'Mono.Cecil.Rocks'" />
TargetPath="%(ReferenceCopyLocalPaths.DestinationSubPath)" />
</ItemGroup>
</Target>

Expand Down
40 changes: 1 addition & 39 deletions src/NuSeal/ValidateLicenseTask.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Cecil;
using System;
using System.Linq;

namespace NuSeal;

public partial class ValidateLicenseTask : Task
{
public ITaskItem[] PackageReferences { get; set; } = Array.Empty<ITaskItem>();
public ITaskItem[] ResolvedCompileFileDefinitions { get; set; } = Array.Empty<ITaskItem>();
public string MainAssemblyPath { get; set; } = "";
public string ProtectedPackageId { get; set; } = "";
public string ProtectedAssemblyName { get; set; } = "";
Expand All @@ -35,15 +32,6 @@ public override bool Execute()

var options = new NuSealOptions(ValidationMode, ValidationScope);

if (!TryGetProtectedDllPath(options, out var protectedDll))
{
// If this task is being executed, it must have come from a protected package.
// Something went wrong if we can't find the protected dll.
// But we won't break end users' builds.
Log.LogMessage(MessageImportance.High, "NuSeal: No protected DLL was found for NuGet Package: {0}", ProtectedPackageId);
return true;
}

try
{
var pems = Pems.Select(x =>
Expand Down Expand Up @@ -100,35 +88,9 @@ public override bool Execute()
}
catch (Exception ex)
{
Log.LogMessage(MessageImportance.High, "NuSeal: Failed to process {0}. Error: {1}", protectedDll, ex.Message);
Log.LogMessage(MessageImportance.High, "NuSeal: Failed to process license validation for {0}. Error: {1}", ProtectedPackageId, ex.Message);
}

return true;
}

private bool TryGetProtectedDllPath(
NuSealOptions options,
out string dllPath)
{
if (options.ValidationScope == NuSealValidationScope.Direct
&& !PackageReferences.Any(x => string.Equals(x.ItemSpec, ProtectedPackageId, StringComparison.OrdinalIgnoreCase)))
{
dllPath = "";
return false;
}

foreach (var file in ResolvedCompileFileDefinitions)
{
var nugetPackageId = file.GetMetadata("NuGetPackageId");
if (string.Equals(nugetPackageId, ProtectedPackageId, StringComparison.OrdinalIgnoreCase))
{
dllPath = file.ItemSpec;
return true;
}

}

dllPath = "";
return false;
}
}
2 changes: 0 additions & 2 deletions src/NuSeal/build/NuSeal.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

<PropertyGroup>
<NuSealAssembly>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', '..', 'tasks', 'netstandard2.0', 'NuSeal.dll'))</NuSealAssembly>
<!--Needed while debugging locally-->
<!--<NuSealAssembly Condition="!Exists('$(NuSealAssembly)')">$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)', '..', 'bin', 'Debug', 'netstandard2.0', 'NuSeal.dll'))</NuSealAssembly>-->
</PropertyGroup>

<UsingTask
Expand Down
212 changes: 0 additions & 212 deletions tests/NuSeal.Tests/AssemblyUtils_ExtractPemsTests.cs

This file was deleted.

4 changes: 0 additions & 4 deletions tests/NuSeal.Tests/AssetsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ public void GenerateTargets_ReturnUniqueAssetWithNoCondition_GivenDirectScope()
>

<NuSeal.ValidateLicenseTask
PackageReferences="@(PackageReference)"
ResolvedCompileFileDefinitions="@(ResolvedCompileFileDefinitions)"
MainAssemblyPath="$(TargetPath)"
ProtectedPackageId="Prefix.PackageId1"
ProtectedAssemblyName="Assembly1"
Expand Down Expand Up @@ -138,8 +136,6 @@ public void GenerateTargets_ReturnUniqueAssetWithCondition_GivenTransitiveScope(
Condition="'$(OutputType)' == 'Exe' Or '$(OutputType)' == 'WinExe' Or '$(MSBuildProjectSdk)' == 'Microsoft.NET.Sdk.Web'">

<NuSeal.ValidateLicenseTask
PackageReferences="@(PackageReference)"
ResolvedCompileFileDefinitions="@(ResolvedCompileFileDefinitions)"
MainAssemblyPath="$(TargetPath)"
ProtectedPackageId="Prefix.PackageId1"
ProtectedAssemblyName="Assembly1"
Expand Down
Loading