Skip to content

Commit

Permalink
build: add new strong-named assemblies for dtm client DtmCommon, Dtmc…
Browse files Browse the repository at this point in the history
…li, Dtmgrpc, Dtmworkflow (#89)

* build: add strong name key file for assembly signing

- Add StringNameKey file and StringNamePublicKey properties for assembly signing

* feat(strong-name): add strong-named assemblies for dtm client

- Add new projects for creating strong-named assemblies
    - Dtmcli.StrongName
    - DtmCommon.StrongName, replace Dapper package with Dapper.StrongName
    - Dtmgrpc.StrongName
    - Dtmworkflow.StrongName
- New assembly is copied from .csproj file, and links .cs and .proto file to compile
- Update solution file to include new projects

* build(workflow): add strong-name builds to release process.
  • Loading branch information
wooln authored Dec 18, 2024
1 parent 94612d4 commit 40711b8
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/release_stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,29 @@ jobs:
- name: Build with dotnet
run: |
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/Dtmcli/Dtmcli.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/strong-name/Dtmcli.StrongName/Dtmcli.StrongName.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/Dtmgrpc/Dtmgrpc.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/strong-name/Dtmgrpc.StrongName/Dtmgrpc.StrongName.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/DtmCommon/DtmCommon.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/strong-name/DtmCommon.StrongName/DtmCommon.StrongName.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/DtmSERedisBarrier/DtmSERedisBarrier.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/DtmMongoBarrier/DtmMongoBarrier.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/DtmDapr/DtmDapr.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/Dtmworkflow/Dtmworkflow.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/strong-name/Dtmworkflow.StrongName/Dtmworkflow.StrongName.csproj
- name: Pack with dotnet
run: |
dotnet pack src/Dtmcli/Dtmcli.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/strong-name/Dtmcli.StrongName/Dtmcli.StrongName.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/Dtmgrpc/Dtmgrpc.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/strong-name/Dtmgrpc.StrongName/Dtmgrpc.StrongName.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/DtmCommon/DtmCommon.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/strong-name/DtmCommon.StrongName/DtmCommon.StrongName.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/DtmSERedisBarrier/DtmSERedisBarrier.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/DtmMongoBarrier/DtmMongoBarrier.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/DtmDapr/DtmDapr.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/Dtmworkflow/Dtmworkflow.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/strong-name/Dtmworkflow.StrongName/Dtmworkflow.StrongName.csproj -o /home/runner/work/nugetpkgs -c Release --no-build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/release_unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,30 @@ jobs:
- name: Build with dotnet
run: |
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/Dtmcli/Dtmcli.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/strong-name/Dtmcli.StrongName/Dtmcli.StrongName.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/Dtmgrpc/Dtmgrpc.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/strong-name/Dtmgrpc.StrongName/Dtmgrpc.StrongName.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/DtmCommon/DtmCommon.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/strong-name/DtmCommon.StrongName/DtmCommon.StrongName.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/DtmSERedisBarrier/DtmSERedisBarrier.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/DtmMongoBarrier/DtmMongoBarrier.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/DtmDapr/DtmDapr.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/Dtmworkflow/Dtmworkflow.csproj
dotnet build --configuration Release --source https://api.nuget.org/v3/index.json src/strong-name/Dtmworkflow.StrongName/Dtmworkflow.StrongName.csproj
- name: Pack with dotnet
run: |
ver=alpha`date +%Y%m%d%H%M%S`
dotnet pack src/Dtmcli/Dtmcli.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/strong-name/Dtmcli.StrongName/Dtmcli.StrongName.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/Dtmgrpc/Dtmgrpc.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/strong-name/Dtmgrpc.StrongName/Dtmgrpc.StrongName.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/DtmCommon/DtmCommon.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/strong-name/DtmCommon.StrongName/DtmCommon.StrongName.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/DtmSERedisBarrier/DtmSERedisBarrier.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/DtmMongoBarrier/DtmMongoBarrier.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/DtmDapr/DtmDapr.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/Dtmworkflow/Dtmworkflow.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
dotnet pack src/strong-name/Dtmworkflow.StrongName/Dtmworkflow.StrongName.csproj --version-suffix $ver -o /home/runner/work/nugetpkgs -c Release --no-build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
Expand Down
31 changes: 31 additions & 0 deletions DtmClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DtmDapr", "src\DtmDapr\DtmD
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DtmOnDaprSample", "samples\DtmOnDaprSample\DtmOnDaprSample.csproj", "{1791974A-8638-488B-A3B8-0D935E3A4D27}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "strong-name", "strong-name", "{A8DF688D-43CE-4227-B5FD-F65760DE7967}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DtmCommon.StrongName", "src\strong-name\DtmCommon.StrongName\DtmCommon.StrongName.csproj", "{199067A7-1587-44C2-8A05-6D79AED30F93}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dtmcli.StrongName", "src\strong-name\Dtmcli.StrongName\Dtmcli.StrongName.csproj", "{3196931A-26B1-4C48-BA66-003356153C34}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dtmgrpc.StrongName", "src\strong-name\Dtmgrpc.StrongName\Dtmgrpc.StrongName.csproj", "{60051A80-A987-43B7-A5D1-284B8FD330D4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dtmworkflow.StrongName", "src\strong-name\Dtmworkflow.StrongName\Dtmworkflow.StrongName.csproj", "{96634D84-A11E-448C-8033-CC643F96558A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -99,6 +109,22 @@ Global
{1791974A-8638-488B-A3B8-0D935E3A4D27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1791974A-8638-488B-A3B8-0D935E3A4D27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1791974A-8638-488B-A3B8-0D935E3A4D27}.Release|Any CPU.Build.0 = Release|Any CPU
{199067A7-1587-44C2-8A05-6D79AED30F93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{199067A7-1587-44C2-8A05-6D79AED30F93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{199067A7-1587-44C2-8A05-6D79AED30F93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{199067A7-1587-44C2-8A05-6D79AED30F93}.Release|Any CPU.Build.0 = Release|Any CPU
{3196931A-26B1-4C48-BA66-003356153C34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3196931A-26B1-4C48-BA66-003356153C34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3196931A-26B1-4C48-BA66-003356153C34}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3196931A-26B1-4C48-BA66-003356153C34}.Release|Any CPU.Build.0 = Release|Any CPU
{60051A80-A987-43B7-A5D1-284B8FD330D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60051A80-A987-43B7-A5D1-284B8FD330D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60051A80-A987-43B7-A5D1-284B8FD330D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60051A80-A987-43B7-A5D1-284B8FD330D4}.Release|Any CPU.Build.0 = Release|Any CPU
{96634D84-A11E-448C-8033-CC643F96558A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{96634D84-A11E-448C-8033-CC643F96558A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{96634D84-A11E-448C-8033-CC643F96558A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{96634D84-A11E-448C-8033-CC643F96558A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -118,6 +144,11 @@ Global
{89337EEF-EBCD-4591-BB6B-5A45067B12AF} = {6AD842A7-E86B-4FBE-B371-BA9DE4D0168E}
{D54ACCEF-2DD7-41B7-9895-6A8B155D67BA} = {AFCF4E29-660F-49FB-BF0A-4EB5CC4B7C1B}
{1791974A-8638-488B-A3B8-0D935E3A4D27} = {6AD842A7-E86B-4FBE-B371-BA9DE4D0168E}
{A8DF688D-43CE-4227-B5FD-F65760DE7967} = {AFCF4E29-660F-49FB-BF0A-4EB5CC4B7C1B}
{199067A7-1587-44C2-8A05-6D79AED30F93} = {A8DF688D-43CE-4227-B5FD-F65760DE7967}
{3196931A-26B1-4C48-BA66-003356153C34} = {A8DF688D-43CE-4227-B5FD-F65760DE7967}
{60051A80-A987-43B7-A5D1-284B8FD330D4} = {A8DF688D-43CE-4227-B5FD-F65760DE7967}
{96634D84-A11E-448C-8033-CC643F96558A} = {A8DF688D-43CE-4227-B5FD-F65760DE7967}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A872C3EE-D0B6-4943-8C7D-9ADD28AC029A}
Expand Down
Binary file added build/DtmClient.snk
Binary file not shown.
4 changes: 4 additions & 0 deletions build/dependencies.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<Project>
<PropertyGroup>
<!-- strong name -->
<StringNameKey>0024000004800000140100000602000000240000525341310008000001000100af985b61d0182de7678c452f994cd186320feeb7706d175663b9c8659e03ff14098841d1c633133fca59e1044f5f16edaf7ae9c47afa1076ff83a21d86b3f1202f532f404498079dca32c3d4fb35cda2603237291220fe61fe17865654c93d7dceffe0bbd47106a73b57319af4696e422cb5c6c57fcdf1ab491e9c81a5b28a2ef160f31fcada307a4388c2f25a66d441950f75df7edae2e750320d01ab2e446b2af095111e08d95665e9595c2070502ff055f1a6289c1f0bdb04983699403e1cfb060efc66e172501859fc2a7c42c7deede9ac35fbd7d62e4baaa293b1eaae3e1732e3037c4fb995bb9ad33afdc177a07ef5124c5370700e6b517315d5e0a798</StringNameKey>
<StringNamePublicKey>ad31ee3e27a4d060</StringNamePublicKey>

<!-- DtmCommon -->
<DapperPackageVersion>2.0.123</DapperPackageVersion>
<SystemTextJsonPackageVersion6>6.0.7</SystemTextJsonPackageVersion6>
Expand Down
52 changes: 52 additions & 0 deletions src/strong-name/DtmCommon.StrongName/DtmCommon.StrongName.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<Description>a c# client for distributed transaction framework dtm. 分布式事务管理器dtm的c#客户端</Description>
<PackageTags>dtm,csharp,distributed transaction,tcc,saga,msg</PackageTags>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\build\DtmClient.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="Dtmgrpc.StrongName" Key="$(StringNameKey)"/>
<InternalsVisibleTo Include="Dtmcli.StrongName" Key="$(StringNameKey)"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Dapper.StrongName" Version="$(DapperPackageVersion)"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonPackageVersion6)"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftExtensionsConfigurationNET6)"/>
<PackageReference Include="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsHttpNET6)"/>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="$(MicrosoftExtensionsOptionsConfigurationExtensionsNET6)"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonPackageVersion7)"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftExtensionsConfigurationNET7)"/>
<PackageReference Include="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsHttpNET7)"/>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="$(MicrosoftExtensionsOptionsConfigurationExtensionsNET7)"/>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1' OR '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" Version="$(SystemTextJsonPackageVersion7)"/>
<PackageReference Include="Microsoft.CSharp" Version="$(MicrosoftCSharpNSD21)"/>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="$(MicrosoftExtensionsConfigurationNSD21)"/>
<PackageReference Include="Microsoft.Extensions.Http" Version="$(MicrosoftExtensionsHttpNSD21)"/>
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="$(MicrosoftExtensionsOptionsConfigurationExtensionsNSD21)"/>
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\DtmCommon\**\*.cs" Exclude="..\..\DtmCommon\obj\**\*.cs"/>
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\build\DtmClient.snk">
<Link>DtmClient.snk</Link>
</None>
</ItemGroup>

</Project>
34 changes: 34 additions & 0 deletions src/strong-name/Dtmcli.StrongName/Dtmcli.StrongName.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<Description>a c# client for distributed transaction framework dtm. 分布式事务管理器dtm的c#客户端</Description>
<PackageTags>dtm,csharp,distributed transaction,tcc,saga,msg</PackageTags>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\build\DtmClient.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<InternalsVisibleTo Include="Dtmworkflow.StrongName" Key="$(StringNameKey)"/>
<!--<None Include="$(MSBuildThisFileDirectory)../../README.md" Pack="true" PackagePath="/" />-->
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'">
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DtmCommon.StrongName\DtmCommon.StrongName.csproj"/>
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Dtmcli\**\*.cs" Exclude="..\..\Dtmcli\obj\**\*.cs"/>
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\build\DtmClient.snk">
<Link>DtmClient.snk</Link>
</None>
</ItemGroup>

</Project>
38 changes: 38 additions & 0 deletions src/strong-name/Dtmgrpc.StrongName/Dtmgrpc.StrongName.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks>
<Description>a c# client for distributed transaction framework dtm. 分布式事务管理器dtm的c#客户端</Description>
<PackageTags>dtm,csharp,distributed transaction,tcc,saga,msg</PackageTags>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\build\DtmClient.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<Protobuf Include="..\..\Dtmgrpc\dtmgpb\dtmgimp.proto" GrpcServices="Client"/>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="$(GoogleProtobufPackageVersion)"/>
<PackageReference Include="Grpc.Net.ClientFactory" Version="$(GrpcNetClientFactoryPackageVersion)"/>
<PackageReference Include="Grpc.Tools" Version="$(GrpcToolsPackageVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DtmCommon.StrongName\DtmCommon.StrongName.csproj"/>
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Dtmgrpc\**\*.cs" Exclude="..\..\Dtmgrpc\obj\**\*.cs"/>
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\build\DtmClient.snk">
<Link>DtmClient.snk</Link>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<Description>a c# client for distributed transaction framework dtm. 分布式事务管理器dtm的c#客户端</Description>
<PackageTags>dtm,csharp,distributed transaction,tcc,saga,msg</PackageTags>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\..\build\DtmClient.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Dtmcli.StrongName\Dtmcli.StrongName.csproj"/>
<ProjectReference Include="..\Dtmgrpc.StrongName\Dtmgrpc.StrongName.csproj"/>
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Dtmworkflow\**\*.cs" Exclude="..\..\Dtmworkflow\obj\**\*.cs"/>
</ItemGroup>

<ItemGroup>
<None Include="..\..\..\build\DtmClient.snk">
<Link>DtmClient.snk</Link>
</None>
</ItemGroup>

</Project>

0 comments on commit 40711b8

Please sign in to comment.