Optional assembly signing key
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
2024-12-19 18:41:00 +01:00
parent 8d5a58e7a6
commit 7c8b00ea1c
9 changed files with 31 additions and 13 deletions

View File

@@ -14,7 +14,7 @@ steps:
- dotnet pack --configuration Release DllExports.MSBuild/DllExports.MSBuild.csproj - dotnet pack --configuration Release DllExports.MSBuild/DllExports.MSBuild.csproj
## Following is based on build.ps1 ## Following is based on build.ps1
- apt update && apt install -y zip unzip - apt update && apt install -y zip unzip
- unzip -d DllExports.MSBuild/bin/Release/nupkg DllExports.MSBuild/bin/Release/IvDllExports.0.1.1.nupkg - unzip -d DllExports.MSBuild/bin/Release/nupkg DllExports.MSBuild/bin/Release/IvDllExports.0.1.1.2.nupkg
- cp -r DllExports.MSBuild/bin/Release/nupkg/lib DllExports.MSBuild/bin/Release/nupkg/tasks - cp -r DllExports.MSBuild/bin/Release/nupkg/lib DllExports.MSBuild/bin/Release/nupkg/tasks
- find DllExports.MSBuild/bin/Release/nupkg/lib ! -name 'DllExports.dll' -type f -exec rm -f {} + - find DllExports.MSBuild/bin/Release/nupkg/lib ! -name 'DllExports.dll' -type f -exec rm -f {} +
# Tasks are not supported on netstandard2.0 # Tasks are not supported on netstandard2.0
@@ -24,8 +24,8 @@ steps:
- rm -rf DllExports.MSBuild/bin/Release/nupkg/lib/net5.0 - rm -rf DllExports.MSBuild/bin/Release/nupkg/lib/net5.0
- sed -i -E '/(NETFramework4.7.2|net5.0)/d' DllExports.MSBuild/bin/Release/nupkg/IvDllExports.nuspec - sed -i -E '/(NETFramework4.7.2|net5.0)/d' DllExports.MSBuild/bin/Release/nupkg/IvDllExports.nuspec
# Re-pack # Re-pack
- rm DllExports.MSBuild/bin/Release/IvDllExports.0.1.1.nupkg - rm DllExports.MSBuild/bin/Release/IvDllExports.0.1.1.2.nupkg
- (cd DllExports.MSBuild/bin/Release/nupkg; zip -r ../IvDllExports.0.1.1.nupkg ./) - (cd DllExports.MSBuild/bin/Release/nupkg; zip -r ../IvDllExports.0.1.1.2.nupkg ./)
# Cli # Cli
- dotnet build --configuration Release DllExports.Cli/DllExports.Cli.csproj - dotnet build --configuration Release DllExports.Cli/DllExports.Cli.csproj
- dotnet pack --configuration Release DllExports.Cli/DllExports.Cli.csproj - dotnet pack --configuration Release DllExports.Cli/DllExports.Cli.csproj
@@ -37,7 +37,7 @@ steps:
from_secret: drone_release from_secret: drone_release
nuget_uri: https://git.ivasoft.cz/api/packages/Ivasoft/nuget/index.json nuget_uri: https://git.ivasoft.cz/api/packages/Ivasoft/nuget/index.json
commands: commands:
- dotnet nuget push DllExports.MSBuild/bin/Release/IvDllExports.0.1.1.nupkg --api-key $$PLUGIN_NUGET_APIKEY --source $$PLUGIN_NUGET_URI --skip-duplicate - dotnet nuget push DllExports.MSBuild/bin/Release/IvDllExports.0.1.1.2.nupkg --api-key $$PLUGIN_NUGET_APIKEY --source $$PLUGIN_NUGET_URI --skip-duplicate
- dotnet nuget push DllExports.Cli/bin/Release/IvDllExports-Cli.0.1.1.nupkg --api-key $$PLUGIN_NUGET_APIKEY --source $$PLUGIN_NUGET_URI --skip-duplicate - dotnet nuget push DllExports.Cli/bin/Release/IvDllExports-Cli.0.1.1.2.nupkg --api-key $$PLUGIN_NUGET_APIKEY --source $$PLUGIN_NUGET_URI --skip-duplicate
when: when:
event: tag event: tag

View File

@@ -65,6 +65,9 @@ class A
else else
options.RemoveInputFile = a; options.RemoveInputFile = a;
break; break;
case "keyfile":
options.KeyFile = args[++i];
break;
default: default:
Console.Error.WriteLine($"Unknown option '{arg}'."); Console.Error.WriteLine($"Unknown option '{arg}'.");

View File

@@ -47,6 +47,12 @@ namespace DllExports.MSBuild
set => options.RemoveInputFile = value; set => options.RemoveInputFile = value;
} }
public string KeyFile
{
get => options.KeyFile;
set => options.KeyFile = value;
}
public override bool Execute() public override bool Execute()
{ {
if (!Enabled) if (!Enabled)

View File

@@ -54,7 +54,8 @@ namespace DllExports.MSBuild
options.OutputFile, options.OutputFile,
options.Architectures, options.Architectures,
options.ArchitectureNameFormat, options.ArchitectureNameFormat,
options.RemoveInputFile options.RemoveInputFile,
options.KeyFile
}); });
} }

View File

@@ -63,7 +63,8 @@ namespace DllExports.MSBuild
options.OutputFile, options.OutputFile,
options.Architectures, options.Architectures,
options.ArchitectureNameFormat, options.ArchitectureNameFormat,
options.RemoveInputFile options.RemoveInputFile,
options.KeyFile
} }
); );
} }

View File

@@ -48,7 +48,8 @@ namespace DllExports.MSBuild
(string) arr[2], (string) arr[2],
(string[]) arr[3], (string[]) arr[3],
(string) arr[4], (string) arr[4],
(bool) arr[5] (bool) arr[5],
(string) arr[6]
); );
} }

View File

@@ -18,6 +18,8 @@ namespace DllExports
public bool RemoveInputFile { get; set; } public bool RemoveInputFile { get; set; }
public string KeyFile { get; set; }
internal (string Path, string Name, bool? Is32Bit)[] CalculateOutputFiles() internal (string Path, string Name, bool? Is32Bit)[] CalculateOutputFiles()
{ {
var outputFile = GetOutputFileName(); var outputFile = GetOutputFileName();

View File

@@ -23,7 +23,8 @@ namespace DllExports
string outputFile, string outputFile,
string[] architectures, string[] architectures,
string architectureNameFormat, string architectureNameFormat,
bool removeInputFile) bool removeInputFile,
string keyFile)
{ {
var options = new ExportOptions var options = new ExportOptions
{ {
@@ -32,7 +33,8 @@ namespace DllExports
OutputFile = outputFile, OutputFile = outputFile,
Architectures = architectures, Architectures = architectures,
ArchitectureNameFormat = architectureNameFormat, ArchitectureNameFormat = architectureNameFormat,
RemoveInputFile = removeInputFile RemoveInputFile = removeInputFile,
KeyFile = keyFile
}; };
var moduleContext = ModuleDef.CreateModuleContext(); var moduleContext = ModuleDef.CreateModuleContext();
@@ -124,6 +126,8 @@ namespace DllExports
foreach (var output in outputFiles) foreach (var output in outputFiles)
{ {
var moduleOptions = GetModuleOptions(module, output.Is32Bit); var moduleOptions = GetModuleOptions(module, output.Is32Bit);
if (!string.IsNullOrEmpty(options.KeyFile))
moduleOptions.StrongNameKey = new StrongNameKey(options.KeyFile);
var dir = Path.GetDirectoryName(output.Path); var dir = Path.GetDirectoryName(output.Path);

View File

@@ -1,8 +1,8 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<Version>0.1.1</Version> <Version>0.1.1.2</Version>
<AssemblyVersion>0.1.0.0</AssemblyVersion> <AssemblyVersion>0.1.0.0</AssemblyVersion>
<FileVersion>0.1.1.0</FileVersion> <FileVersion>0.1.1.2</FileVersion>
<InformationalVersion>0.1.1</InformationalVersion> <InformationalVersion>0.1.1.2</InformationalVersion>
</PropertyGroup> </PropertyGroup>
</Project> </Project>