Skip to content

Commit 4eeaf4a

Browse files
zikifermhowlett
authored andcommitted
Confluent.Kafka.StrongName project and build (confluentinc#174)
* Added strong name project * Updates to appveyor to build both signed and unsigned * Combine commands into single statement * Removed special StrongName project, instead using build options to sign the assembly * Signed unit test project that consumes the signed Kafka library * Added readme file for strong-name unit test project
1 parent 56c4b57 commit 4eeaf4a

File tree

6 files changed

+51
-3
lines changed

6 files changed

+51
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
project.lock.json
22
bin/
3+
bin-sn/
34
obj/
45
*.so
56
*.dylib

appveyor.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,20 @@ environment:
1111
PATH: $(PATH);$(PROGRAMFILES)\dotnet\
1212

1313
build_script:
14+
- cmd: SET STRONG_NAME_OPTIONS=/p:SignAssembly=true;AssemblyOriginatorKeyFile=Confluent.Kafka.snk;PackageId=Confluent.Kafka.StrongName;AssemblyName=Confluent.Kafka.StrongName;BaseOutputPath=bin-sn\
1415
- appveyor-retry dotnet restore -v Minimal
16+
- appveyor-retry dotnet restore -v Minimal test/Confluent.Kafka.StrongName.UnitTests/Confluent.Kafka.StrongName.UnitTests.csproj
1517
- dotnet build Confluent.Kafka.sln -c %CONFIGURATION%
16-
- cmd: IF "%APPVEYOR_REPO_TAG%" == "true" (dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj -c %CONFIGURATION%)
17-
- cmd: IF NOT "%APPVEYOR_REPO_TAG%" == "true" (dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj -c %CONFIGURATION% --version-suffix ci-%APPVEYOR_BUILD_NUMBER%)
18+
- dotnet build src/Confluent.Kafka/Confluent.Kafka.csproj -c %CONFIGURATION% %STRONG_NAME_OPTIONS%
19+
- cmd: IF "%APPVEYOR_REPO_TAG%" == "true" (dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj -c %CONFIGURATION% & dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj -c %CONFIGURATION% %STRONG_NAME_OPTIONS%)
20+
- cmd: IF NOT "%APPVEYOR_REPO_TAG%" == "true" (dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj -c %CONFIGURATION% --version-suffix ci-%APPVEYOR_BUILD_NUMBER% & dotnet pack src/Confluent.Kafka/Confluent.Kafka.csproj -c %CONFIGURATION% %STRONG_NAME_OPTIONS% --version-suffix ci-%APPVEYOR_BUILD_NUMBER%)
1821

1922
test_script:
2023
- dotnet test -c %CONFIGURATION% --no-build test/Confluent.Kafka.UnitTests/Confluent.Kafka.UnitTests.csproj
24+
- dotnet test -c %CONFIGURATION% test/Confluent.Kafka.StrongName.UnitTests/Confluent.Kafka.StrongName.UnitTests.csproj
2125

2226
artifacts:
23-
- path: ./src/Confluent.Kafka/bin/Release/*.nupkg
27+
- path: ./src/Confluent.Kafka/bin*/Release/*.nupkg
2428

2529
#deploy:
2630
# provider: NuGet
596 Bytes
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
5+
<AssemblyName>Confluent.Kafka.StrongName.UnitTests</AssemblyName>
6+
<PackageId>Confluent.Kafka.StrongName.UnitTests</PackageId>
7+
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
8+
<SignAssembly>true</SignAssembly>
9+
<AssemblyOriginatorKeyFile>Confluent.Kafka.StrongName.UnitTests.snk</AssemblyOriginatorKeyFile>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<Compile Include="../Confluent.Kafka.UnitTests/**/*.cs" Exclude="../Confluent.Kafka.UnitTests/obj/**/*" />
14+
</ItemGroup>
15+
16+
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp1.1' ">
17+
<Reference Include="Confluent.Kafka.StrongName">
18+
<HintPath>../../src/Confluent.Kafka/bin-sn/$(Configuration)/netstandard1.3/Confluent.Kafka.StrongName.dll</HintPath>
19+
</Reference>
20+
</ItemGroup>
21+
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
22+
<Reference Include="Confluent.Kafka.StrongName">
23+
<HintPath>../../src/Confluent.Kafka/bin-sn/$(Configuration)/net45/Confluent.Kafka.StrongName.dll</HintPath>
24+
</Reference>
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<PackageReference Include="librdkafka.redist" Version="0.9.5" />
29+
</ItemGroup>
30+
31+
<ItemGroup>
32+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
33+
<PackageReference Include="xunit" Version="2.2.0" />
34+
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
35+
</ItemGroup>
36+
37+
</Project>
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Strongly Named Unit Tests
2+
=========================
3+
4+
This project, which is not included in the main solution, is designed for the sole purpose of verifying that the signed version of `Confluent.Kafka` (`Confluent.Kafka.StrongName`) has been built and signed correctly. This project is built and run by the Travis build script.
5+
6+
When the build script begins, it performs a `dotnet build` on the main solution file. After this has completed, it rebuilds the main `Confluent.Kafka` library, this time including signing information. The output of this build step is the `Confluent.Kafka.StrongName` assembly. Once `Confluent.Kafka.StrongName` has been built, this unit test assmbly, `Confluent.Kafka.StrongName.UnitTests`, is built and run against `Confluent.Kafka.StrongName`. The `Confluent.Kafka.StrongName.UnitTests` assmbly itself is signed, and as such requires all dependencies to also be signed. Should `Confluent.Kafka.StrongName` not actually be signed this build and test will fail.

0 commit comments

Comments
 (0)