Skip to content

Commit

Permalink
Added ability to sign assemblies before packaging
Browse files Browse the repository at this point in the history
Added snk file
Updated build script
Create separate solution for packaging so the Test projects are not build
Bumped the package version number
  • Loading branch information
marto83 committed Jun 13, 2017
1 parent 3b1b9fa commit 93cfca9
Show file tree
Hide file tree
Showing 9 changed files with 469 additions and 41 deletions.
Binary file added IO.Ably.snk
Binary file not shown.
7 changes: 5 additions & 2 deletions default.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ properties {

$project_name = "IO.Ably"
$build_number = "0.8.4"
$main_version = "0.8"
$solution_dir = "$build_script_dir\$sln_dir"
$signKeyPath = "$build_script_dir\IO.Ably.snk"

$build_artifacts_dir_base = "$build_script_dir\build\artifacts"
$build_artifacts_dir = "$build_artifacts_dir_base\library"
Expand All @@ -35,7 +37,8 @@ task Assembly_Info {
-file "$base_dir\CommonAssemblyInfo.cs" `
-company "Ably" `
-product "Ably .Net Library" `
-version $build_number `
-assembly_version $main_version `
-full_version $build_number `
-copyright "Ably" . [DateTime]::Now`
}

Expand All @@ -44,7 +47,7 @@ task Build -depends Assembly_Info, Init {

$base_dir = "$build_script_dir\$sln_dir"

run_msbuild "$base_dir\$sln_name" $configuration
run_msbuild "$base_dir\$sln_name" $configuration $signKeyPath

$package_dir = "$base_dir\$project_name\bin\$configuration"
}
Expand Down
18 changes: 9 additions & 9 deletions functions.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function global:run_msbuild($solutionPath, $configuration)
function global:run_msbuild($solutionPath, $configuration, $signKeyPath)
{
clear-obj-artifacts $solutionPath

Expand All @@ -7,10 +7,9 @@ function global:run_msbuild($solutionPath, $configuration)
try {
switch($configuration)
{
"test" { exec { msbuild $solutionPath "/t:clean;build" "/v:Quiet"
"/p:Configuration=$configuration;Platform=Any CPU" } }
"release" { exec { msbuild $solutionPath "/t:clean;build" "/p:Configuration=$configuration;Platform=Any CPU" } }
default { exec { msbuild $solutionPath "/t:clean;build" "/p:Configuration=$configuration;Platform=Any CPU" } }
"package" { exec { msbuild $solutionPath "/t:clean;build" "/p:Configuration=release;Platform=Any CPU" "/p:AssemblyOriginatorKeyFile=$signKeyPath" "/p:SignAssembly=true" "/p:DefineConstants=PACKAGE" } }
"release" { exec { msbuild $solutionPath "/t:clean;build" "/p:Configuration=$configuration;Platform=Any CPU"} }
default { exec { msbuild $solutionPath "/t:clean;build" "/p:Configuration=$configuration;Platform=Any CPU" } }
}
}
catch {
Expand Down Expand Up @@ -193,11 +192,12 @@ param(
[string]$company,
[string]$product,
[string]$copyright,
[string]$version,
[string]$full_version,
[string]$assembly_version,
[string]$file = $(throw "file is a required parameter.")
)

$fileVersion = $version -replace "-\w+$", ""
$fileVersion = $full_version -replace "-\w+$", ""

$asmInfo = "using System;
using System.Reflection;
Expand All @@ -208,8 +208,8 @@ using System.Runtime.InteropServices;
[assembly: AssemblyDescription(""Client for ably.io realtime service"")]
[assembly: AssemblyProductAttribute(""$product"")]
[assembly: AssemblyCopyrightAttribute(""$copyright"")]
[assembly: AssemblyVersionAttribute(""$fileVersion"")]
[assembly: AssemblyInformationalVersionAttribute(""$version"")]
[assembly: AssemblyVersionAttribute(""$assembly_version"")]
[assembly: AssemblyInformationalVersionAttribute(""$full_version"")]
[assembly: AssemblyFileVersionAttribute(""$fileVersion"")]
"

Expand Down
13 changes: 13 additions & 0 deletions generate_key.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@ECHO OFF
IF EXIST "C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\sn.exe" GOTO FOUND
goto USEPATH

:FOUND
"C:\Program Files\Microsoft SDKs\Windows\v7.0\Bin\sn.exe" -k %~dp0\IO.Ably.snk
GOTO EXIT

:USEPATH
sn.exe -k %~dp0\IO.Ably.snk
GOTO EXIT

:EXIT
4 changes: 2 additions & 2 deletions nuget/io.ably.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ably.io</id>
<version>0.8.4.4</version>
<version>0.8.4.5</version>
<title>ably.io</title>
<authors>Yavor Ivanov,Martin Georgiev</authors>
<authors>Martin Georgiev, Yavor Ivanov</authors>
<owners>Ably Real-time Ltd</owners>
<licenseUrl>https://github.com/ably/ably-dotnet/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/ably/ably-dotnet</projectUrl>
Expand Down
9 changes: 7 additions & 2 deletions package.ps1
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe /property:Configuration=Release .\\src\\Ably.sln
C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe /property:Configuration="Release 4.0" .\\src\\Ably.sln
import-module .\tools\psake\psake.psm1

$psake.use_exit_on_error = $true
invoke-psake ./default.ps1 Build -properties @{ configuration = "package"; sln_name = "IO.Ably.Package.sln" } -framework '4.0'

remove-module psake

.\\tools\\NuGet.exe pack .\\nuget\\io.ably.nuspec
2 changes: 2 additions & 0 deletions src/IO.Ably.Net45/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
#if !PACKAGE
[assembly: InternalsVisibleTo("IO.Ably.Tests")]
#endif

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2d265650-b1ec-4f8d-b043-a2e3dcc23fd8")]
Loading

0 comments on commit 93cfca9

Please sign in to comment.