Merge branch 'master' of https://git.ivasoft.cz/SW/DllExports
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
2025-02-18 19:00:35 +01:00
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
## Following is based on build.ps1
- 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
- find DllExports.MSBuild/bin/Release/nupkg/lib ! -name 'DllExports.dll' -type f -exec rm -f {} +
# Tasks are not supported on netstandard2.0
@@ -24,8 +24,8 @@ steps:
- 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
# Re-pack
- rm DllExports.MSBuild/bin/Release/IvDllExports.0.1.1.nupkg
- (cd DllExports.MSBuild/bin/Release/nupkg; zip -r ../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.2.nupkg ./)
# Cli
- dotnet build --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
nuget_uri: https://git.ivasoft.cz/api/packages/SW/nuget/index.json
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.Cli/bin/Release/IvDllExports-Cli.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.2.nupkg --api-key $$PLUGIN_NUGET_APIKEY --source $$PLUGIN_NUGET_URI --skip-duplicate
when:
event: tag

View File

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

View File

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

View File

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

View File

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

View File

@@ -48,7 +48,8 @@ namespace DllExports.MSBuild
(string) arr[2],
(string[]) arr[3],
(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 string KeyFile { get; set; }
internal (string Path, string Name, bool? Is32Bit)[] CalculateOutputFiles()
{
var outputFile = GetOutputFileName();

View File

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

View File

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