Skip to content

Commit b958303

Browse files
authored
Sign all packages and remove .Signed packages (#539)
* Signing packages in favor of separate .Signed assemblies. * Set assembly version when updating versions Set to major version (x.0.0.0) for version x.y.z as per recommendation. * Add assembly version to projects To version it as major part of <Version> element, per recommendation: https://docs.microsoft.com/en-us/dotnet/standard/library-guidance/strong-naming * Remove signed projects - Merge Common.props files into .csproj - Remove projects from solution * Remove signed projects from build scripts
1 parent f8b0b1a commit b958303

12 files changed

+98
-170
lines changed

Build/build-functions.psm1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ function Start-Tests {
8989
function Start-PackNugets {
9090
$projectPaths = @(
9191
"UnitsNet\UnitsNet.csproj",
92-
"UnitsNet\UnitsNet.Signed.csproj",
93-
"UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj",
94-
"UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Signed.csproj"
92+
"UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj"
9593
)
9694

9795
write-host -foreground blue "Pack nugets...`n---"

Build/set-version-UnitsNet.Serialization.JsonNet.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ Import-Module "$PSScriptRoot\set-version.psm1"
4848

4949
$root = Resolve-Path "$PSScriptRoot\.."
5050
$paramSet = $PsCmdlet.ParameterSetName
51-
$commonPropsFile = "$root\UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Common.props"
52-
$versionFiles = @($commonPropsFile)
51+
$projFile = "$root\UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj"
52+
$versionFiles = @($projFile)
5353
$projectName = "JsonNet"
5454

5555
# Use UnitsNet.Common.props version as base if bumping major/minor/patch
56-
$newVersion = Get-NewProjectVersion $commonPropsFile $paramSet $setVersion $bumpVersion
56+
$newVersion = Get-NewProjectVersion $projFile $paramSet $setVersion $bumpVersion
5757

58-
Set-ProjectVersion $commonPropsFile $newVersion
59-
Invoke-CommitAndTagVersion $projectName $versionFiles $newVersion
58+
Set-ProjectVersion $projFile $newVersion
59+
Invoke-CommitAndTagVersion $projectName $versionFiles $newVersion

Build/set-version-UnitsNet.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ Import-Module "$PSScriptRoot\set-version.psm1"
5050

5151
$root = Resolve-Path "$PSScriptRoot\.."
5252
$paramSet = $PsCmdlet.ParameterSetName
53-
$commonPropsFile = "$root\UnitsNet\UnitsNet.Common.props"
53+
$projFile = "$root\UnitsNet\UnitsNet.csproj"
5454
$winrtAssemblyInfoFile = "$root\UnitsNet\Properties\AssemblyInfo.WindowsRuntimeComponent.cs"
5555
$winrtNuspecFile = "$root\UnitsNet.WindowsRuntimeComponent\UnitsNet.WindowsRuntimeComponent.nuspec"
56-
$versionFiles = @($commonPropsFile, $winrtAssemblyInfoFile, $winrtNuspecFile)
56+
$versionFiles = @($projFile, $winrtAssemblyInfoFile, $winrtNuspecFile)
5757
$projectName = "UnitsNet"
5858

5959
# Use UnitsNet.Common.props version as base if bumping major/minor/patch
60-
$newVersion = Get-NewProjectVersion $commonPropsFile $paramSet $setVersion $bumpVersion
60+
$newVersion = Get-NewProjectVersion $projFile $paramSet $setVersion $bumpVersion
6161

62-
Set-ProjectVersion $commonPropsFile $newVersion
62+
Set-ProjectVersion $projFile $newVersion
6363
Set-AssemblyInfoVersion $winrtAssemblyInfoFile $newVersion
6464
Set-NuspecVersion $winrtNuspecFile $newVersion
6565
Invoke-CommitAndTagVersion $projectName $versionFiles $newVersion

Build/set-version.psm1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ function Invoke-CommitAndTagVersion(
4343
}
4444

4545
function Set-ProjectVersion([string] $file, [string] $version) {
46-
Write-Host "$file -> $version"
46+
$assemblyVersion = $version -replace "(\d+)(?:\.\d+)+.*", '$1.0.0.0'
47+
Write-Host "$file -> $version (AssemblyVersion $assemblyVersion)"
4748
(Get-Content $file) -replace '<Version>.*?</Version>', "<Version>$version</Version>" | Set-Content $file
49+
(Get-Content $file) -replace '<AssemblyVersion>.*?</AssemblyVersion>', "<AssemblyVersion>$assemblyVersion</AssemblyVersion>" | Set-Content $file
4850
}
4951

5052
function Set-AssemblyInfoVersion([string] $file, [string] $version) {

UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Common.props

Lines changed: 0 additions & 45 deletions
This file was deleted.

UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.Signed.csproj

Lines changed: 0 additions & 23 deletions
This file was deleted.

UnitsNet.Serialization.JsonNet/UnitsNet.Serialization.JsonNet.csproj

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<Import Project="UnitsNet.Serialization.JsonNet.Common.props" />
2+
<!-- NuGet properties -->
33
<PropertyGroup>
4+
<PackageId>UnitsNet.Serialization.JsonNet</PackageId>
5+
<Version>4.0.0-alpha4</Version>
6+
<Authors>Andreas Gullberg Larsen</Authors>
7+
<Title>Units.NET Serialization with Json.NET</Title>
8+
<Description>A helper library for serializing and deserializing types in Units.NET using Json.NET.</Description>
9+
<Copyright>Copyright (c) 2015 Andreas Gullberg Larsen</Copyright>
10+
<IncludeSymbols>true</IncludeSymbols>
11+
<IncludeSource>true</IncludeSource>
12+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
13+
<RepositoryUrl>https://github.com/angularsen/UnitsNet</RepositoryUrl>
14+
<PackageIconUrl>https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png</PackageIconUrl>
15+
<PackageProjectUrl>https://github.com/angularsen/UnitsNet</PackageProjectUrl>
16+
<PackageLicenseUrl>https://github.com/angularsen/UnitsNet/blob/master/LICENSE</PackageLicenseUrl>
17+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
18+
<PackageTags>unit units measurement json Json.NET Newtonsoft serialize deserialize serialization deserialization</PackageTags>
19+
</PropertyGroup>
20+
21+
<!-- Assembly and msbuild properties -->
22+
<PropertyGroup>
23+
<AssemblyVersion>4.0.0.0</AssemblyVersion> <!-- Should reflect major part of Version -->
424
<LangVersion>7.3</LangVersion>
25+
<NoWarn>CS1701;CS1702;CS1705;CS0618</NoWarn>
26+
<RootNamespace>UnitsNet.Serialization.JsonNet</RootNamespace>
27+
<TargetFrameworks>netstandard2.0;net40</TargetFrameworks>
528
</PropertyGroup>
629

7-
<!-- Unsigned project references, will also generate the corresponding nuget dependencies -->
30+
<!-- Strong name signing -->
31+
<PropertyGroup>
32+
<AssemblyOriginatorKeyFile>../UnitsNet.snk</AssemblyOriginatorKeyFile>
33+
<DelaySign>false</DelaySign>
34+
<SignAssembly>true</SignAssembly>
35+
</PropertyGroup>
36+
37+
<!-- NuGet references that work for both signed and unsigned -->
38+
<ItemGroup>
39+
<PackageReference Include="JetBrains.Annotations" Version="10.4.0" PrivateAssets="All" />
40+
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
41+
</ItemGroup>
42+
43+
<!-- Project references, will also generate the corresponding nuget dependencies -->
844
<ItemGroup>
945
<ProjectReference Include="..\UnitsNet\UnitsNet.csproj" />
1046
</ItemGroup>

UnitsNet.sln

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet", "UnitsNet\UnitsN
77
EndProject
88
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet", "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj", "{FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}"
99
EndProject
10-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet.Signed", "UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.Signed.csproj", "{7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}"
11-
EndProject
12-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Signed", "UnitsNet\UnitsNet.Signed.csproj", "{21C1AFDC-354E-4D97-947B-2DB63C529E6E}"
13-
EndProject
1410
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Serialization.JsonNet.Tests", "UnitsNet.Serialization.JsonNet.Tests\UnitsNet.Serialization.JsonNet.Tests.csproj", "{FFEEDF44-F32D-4D92-A75E-487CB0582EB1}"
1511
EndProject
1612
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitsNet.Tests", "UnitsNet.Tests\UnitsNet.Tests.csproj", "{0E3B7567-5DF2-44BD-88DB-CCF050D3F943}"
@@ -31,14 +27,6 @@ Global
3127
{FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Debug|Any CPU.Build.0 = Debug|Any CPU
3228
{FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|Any CPU.ActiveCfg = Release|Any CPU
3329
{FB696BFE-B303-4EBD-A0E6-4A7B19DE429B}.Release|Any CPU.Build.0 = Release|Any CPU
34-
{7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35-
{7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Debug|Any CPU.Build.0 = Debug|Any CPU
36-
{7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|Any CPU.ActiveCfg = Release|Any CPU
37-
{7798DBCF-DD59-4CAD-A754-FB7DCC6BD312}.Release|Any CPU.Build.0 = Release|Any CPU
38-
{21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
39-
{21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Debug|Any CPU.Build.0 = Debug|Any CPU
40-
{21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|Any CPU.ActiveCfg = Release|Any CPU
41-
{21C1AFDC-354E-4D97-947B-2DB63C529E6E}.Release|Any CPU.Build.0 = Release|Any CPU
4230
{FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
4331
{FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
4432
{FFEEDF44-F32D-4D92-A75E-487CB0582EB1}.Release|Any CPU.ActiveCfg = Release|Any CPU

UnitsNet/InternalHelpers/ReflectionBridgeExtensions.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@
2424
using System.Collections.Generic;
2525
using System.Reflection;
2626

27-
#if SIGNED
28-
[assembly: InternalsVisibleTo("UnitsNet.Serialization.JsonNet.Signed, PublicKey=002400000480000094000000060200000024000052534131000400000100010089abdcb0025f7d1c4c766686dd852b978ca5bb9fd80bba9d3539e8399b01170ae0ea10c0c3baa301b1d13090d5aff770532de00c88b67c4b24669fde7f9d87218f1c6c073a09016cbb2f87119b94227c2301f4e2a096043e30f7c47c872bbd8e0b80d924952e6b36990f13f847e83e9efb107ec2121fe39d7edaaa4e235af8c4")]
29-
#else
30-
[assembly: InternalsVisibleTo("UnitsNet.Serialization.JsonNet")]
31-
#endif
27+
[assembly: InternalsVisibleTo("UnitsNet.Serialization.JsonNet, PublicKey=002400000480000094000000060200000024000052534131000400000100010089abdcb0025f7d1c4c766686dd852b978ca5bb9fd80bba9d3539e8399b01170ae0ea10c0c3baa301b1d13090d5aff770532de00c88b67c4b24669fde7f9d87218f1c6c073a09016cbb2f87119b94227c2301f4e2a096043e30f7c47c872bbd8e0b80d924952e6b36990f13f847e83e9efb107ec2121fe39d7edaaa4e235af8c4")]
3228

3329
// Based on
3430
// https://github.com/StefH/ReflectionBridge/blob/c1e34e57fe3fc93507e83d5cebc1677396645397/ReflectionBridge/src/ReflectionBridge/Extensions/ReflectionBridgeExtensions.cs

UnitsNet/UnitsNet.Common.props

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,2 @@
11
<Project>
2-
<!-- NuGet properties -->
3-
<PropertyGroup>
4-
<PackageId>UnitsNet</PackageId>
5-
<Version>4.0.0-alpha5</Version>
6-
<Authors>Andreas Gullberg Larsen</Authors>
7-
<Title>Units.NET</Title>
8-
<Description>Get all the common units of measurement and the conversions between them. It is light-weight and thoroughly tested.</Description>
9-
<Copyright>Copyright (c) 2013 Andreas Gullberg Larsen</Copyright>
10-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11-
<RepositoryUrl>https://github.com/angularsen/UnitsNet</RepositoryUrl>
12-
<PackageIconUrl>https://raw.githubusercontent.com/angularsen/UnitsNet/ce85185429be345d77eb2ce09c99d59cc9ab8aed/Docs/Images/logo-32.png</PackageIconUrl>
13-
<PackageProjectUrl>https://github.com/angularsen/UnitsNet</PackageProjectUrl>
14-
<PackageLicenseUrl>https://github.com/angularsen/UnitsNet/blob/master/LICENSE</PackageLicenseUrl>
15-
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
16-
<PackageTags>unit units quantity quantities measurement si metric imperial abbreviation abbreviations convert conversion parse immutable</PackageTags>
17-
</PropertyGroup>
18-
19-
<!-- Assembly and msbuild properties -->
20-
<PropertyGroup>
21-
<TargetFrameworks>netstandard2.0;net40</TargetFrameworks>
22-
<RootNamespace>UnitsNet</RootNamespace>
23-
<NoWarn>CS1701;CS1702;CS1705;CS0618;CS0809;CS1591</NoWarn>
24-
25-
<!-- SourceLink -->
26-
<PublishRepositoryUrl>true</PublishRepositoryUrl>
27-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
28-
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
29-
</PropertyGroup>
30-
31-
<!-- NuGet references that work for both signed and unsigned -->
32-
<ItemGroup>
33-
<PackageReference Include="JetBrains.Annotations" Version="10.4.0" PrivateAssets="All" />
34-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="All"/>
35-
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
36-
</ItemGroup>
37-
38-
<!-- Exclude obj folder from default inclusion pattern -->
39-
<ItemGroup>
40-
<Compile Include="..\Common\**\*.cs" Exclude="**\obj\**">
41-
<Link>Common\%(RecursiveDir)%(Filename)%(Extension)</Link>
42-
</Compile>
43-
<None Include="..\Common\**\*" Exclude="**\obj\**">
44-
<Link>Common\%(RecursiveDir)%(Filename)%(Extension)</Link>
45-
</None>
46-
<Compile Remove="obj\**" />
47-
<Compile Remove="Properties\AssemblyInfo*.cs" />
48-
<EmbeddedResource Remove="obj\**" />
49-
<None Remove="obj\**" />
50-
</ItemGroup>
51-
522
</Project>

0 commit comments

Comments
 (0)