From 44e97c73ff988d1781d22770ff626bb9d3b2ef40 Mon Sep 17 00:00:00 2001 From: xinchen Date: Fri, 28 Jul 2017 14:11:41 -0700 Subject: [PATCH 1/3] Increase assembly version --- Microsoft.Azure.Amqp/Properties/Version.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Amqp/Properties/Version.cs b/Microsoft.Azure.Amqp/Properties/Version.cs index 7fe26a23..e61300f1 100644 --- a/Microsoft.Azure.Amqp/Properties/Version.cs +++ b/Microsoft.Azure.Amqp/Properties/Version.cs @@ -2,5 +2,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0")] From 8bb7e0abd8eba634cc841a7630dee9dc735906d4 Mon Sep 17 00:00:00 2001 From: xinchen Date: Fri, 28 Jul 2017 14:38:10 -0700 Subject: [PATCH 2/3] Update package script --- Microsoft.Azure.Amqp/Nuget/make_nuget_package.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.Azure.Amqp/Nuget/make_nuget_package.ps1 b/Microsoft.Azure.Amqp/Nuget/make_nuget_package.ps1 index f0089c83..c86282b2 100644 --- a/Microsoft.Azure.Amqp/Nuget/make_nuget_package.ps1 +++ b/Microsoft.Azure.Amqp/Nuget/make_nuget_package.ps1 @@ -16,7 +16,7 @@ if (-Not (Test-Path 'NuGet.exe')) { } $PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition -$AssemblyInfoFile = "$PSScriptRoot\..\Properties\AssemblyInfo.cs" +$AssemblyInfoFile = "$PSScriptRoot\..\Properties\Version.cs" $BuildConfig = "Release" $OutputDirectory = [IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\$BuildConfig\") From 3c5460cea57a0c9108cad46178c9866f623efd11 Mon Sep 17 00:00:00 2001 From: xinchen Date: Mon, 31 Jul 2017 14:01:30 -0700 Subject: [PATCH 3/3] Update build script and nuspec --- .../Nuget/Microsoft.Azure.Amqp.nuspec | 24 ------- Microsoft_Azure_Amqp.sln | 6 +- build/Microsoft.Azure.Amqp.nuspec | 17 +++++ build/build.cmd | 66 +++++++++---------- .../Nuget => build}/make_nuget_package.ps1 | 26 ++++++-- 5 files changed, 73 insertions(+), 66 deletions(-) delete mode 100644 Microsoft.Azure.Amqp/Nuget/Microsoft.Azure.Amqp.nuspec create mode 100644 build/Microsoft.Azure.Amqp.nuspec rename {Microsoft.Azure.Amqp/Nuget => build}/make_nuget_package.ps1 (55%) diff --git a/Microsoft.Azure.Amqp/Nuget/Microsoft.Azure.Amqp.nuspec b/Microsoft.Azure.Amqp/Nuget/Microsoft.Azure.Amqp.nuspec deleted file mode 100644 index a0aa83b7..00000000 --- a/Microsoft.Azure.Amqp/Nuget/Microsoft.Azure.Amqp.nuspec +++ /dev/null @@ -1,24 +0,0 @@ - - - - Microsoft.Azure.Amqp - $Version$ - Microsoft Azure Amqp - Microsoft - true - https://github.com/Azure/azure-amqp/blob/master/LICENSE.txt - Package for Azure AMQP - http://go.microsoft.com/fwlink/?LinkID=288890 - en-US - - - - - - - - - - - - diff --git a/Microsoft_Azure_Amqp.sln b/Microsoft_Azure_Amqp.sln index e19ba0f6..15c18cf4 100644 --- a/Microsoft_Azure_Amqp.sln +++ b/Microsoft_Azure_Amqp.sln @@ -21,13 +21,15 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{0D7D9775-844A-407D-980A-4E0FA53F1D01}" ProjectSection(SolutionItems) = preProject build\build.cmd = build\build.cmd + build\make_nuget_package.ps1 = build\make_nuget_package.ps1 + build\Microsoft.Azure.Amqp.nuspec = build\Microsoft.Azure.Amqp.nuspec EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Test.Microsoft.Amqp", "test\Test.Microsoft.Amqp\Test.Microsoft.Amqp.csproj", "{683D2AD2-E000-4DE1-AC8E-44A64E420F5B}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.Microsoft.Amqp.Uwp", "test\Test.Microsoft.Amqp.Uwp\Test.Microsoft.Amqp.Uwp.csproj", "{2F827371-C1A6-4795-A298-3CE9A255F3B5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAmqpClient", "test\TestAmqpClient\TestAmqpClient.csproj", "{A08B02A1-4BCE-4DF5-A1E9-1809E9515D87}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestAmqpClient", "test\TestAmqpClient\TestAmqpClient.csproj", "{A08B02A1-4BCE-4DF5-A1E9-1809E9515D87}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -252,7 +254,7 @@ Global {A08B02A1-4BCE-4DF5-A1E9-1809E9515D87} = {07A72A72-7CE5-46AE-B383-F4EA6408AE3C} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - EnterpriseLibraryConfigurationToolBinariesPath = packages\TransientFaultHandling.Core.5.1.1209.1\lib\NET4 EnterpriseLibraryConfigurationToolBinariesPathV6 = packages\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\lib\portable-net45+win+wp8;packages\EnterpriseLibrary.TransientFaultHandling.WindowsAzure.Storage.6.0.1304.1\lib\NET45;packages\EnterpriseLibrary.TransientFaultHandling.Data.6.0.1304.1\lib\NET45 + EnterpriseLibraryConfigurationToolBinariesPath = packages\TransientFaultHandling.Core.5.1.1209.1\lib\NET4 EndGlobalSection EndGlobal diff --git a/build/Microsoft.Azure.Amqp.nuspec b/build/Microsoft.Azure.Amqp.nuspec new file mode 100644 index 00000000..97f55925 --- /dev/null +++ b/build/Microsoft.Azure.Amqp.nuspec @@ -0,0 +1,17 @@ + + + + Microsoft.Azure.Amqp + $Version$ + Microsoft Azure Amqp + Microsoft + true + https://github.com/Azure/azure-amqp/blob/master/LICENSE.txt + Package for Azure AMQP + http://go.microsoft.com/fwlink/?LinkID=288890 + en-US + + + + + diff --git a/build/build.cmd b/build/build.cmd index bd60fec3..a08599e4 100644 --- a/build/build.cmd +++ b/build/build.cmd @@ -2,26 +2,18 @@ @echo off set current-path=%~dp0 -rem // remove trailing slash -set current-path=%current-path:~0,-1% - -set build-root=%current-path%\.. +set build-root=%current-path%.. rem // resolve to fully qualified path for %%i in ("%build-root%") do set build-root=%%~fi rem ensure nuget.exe exists -where /q nuget.exe -if not !errorlevel! == 0 ( -@Echo Azure IoT SDK needs to download nuget.exe from https://www.nuget.org/nuget.exe -@Echo https://www.nuget.org -choice /C yn /M "Do you want to download and run nuget.exe" -if not !errorlevel!==1 goto :eof -rem if nuget.exe is not found, then ask user -Powershell.exe wget -outf nuget.exe https://nuget.org/nuget.exe - if not exist .\nuget.exe ( - echo nuget does not exist - exit /b 1 - ) +if not exist %current-path%\NuGet.exe ( + @Echo Downloading NuGet.exe from https://www.nuget.org + Powershell.exe wget -outf %current-path%\NuGet.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe +) +if not exist %current-path%\NuGet.exe ( + echo Failed to download NuGet.exe + exit /b 1 ) rem ----------------------------------------------------------------------------- @@ -30,8 +22,8 @@ rem ---------------------------------------------------------------------------- rem // default build options set build-clean=0 -set build-config=Release -set build-platform="Any CPU" +set build-config=Debug +set build-platform=Any CPU :args-loop if "%1" equ "" goto args-done @@ -64,17 +56,31 @@ goto args-loop :args-done rem ----------------------------------------------------------------------------- -rem -- build csharp iot client +rem -- build solution rem ----------------------------------------------------------------------------- -call nuget restore "%build-root%\microsoft_azure_amqp.sln" +call "%current-path%\nuget.exe" restore "%build-root%\microsoft_azure_amqp.sln" if %build-clean%==1 ( - call :clean-a-solution "%build-root%\microsoft_azure_amqp.sln" %build-config% %build-platform% + call :clean-a-solution "%build-root%\microsoft_azure_amqp.sln" "%build-config%" "%build-platform%" if not !errorlevel!==0 exit /b !errorlevel! ) -call :build-a-solution "%build-root%\microsoft_azure_amqp.sln" %build-config% %build-platform% + +call :build-a-solution "%build-root%\microsoft_azure_amqp.sln" "%build-config%" "%build-platform%" if not !errorlevel!==0 exit /b !errorlevel! +set dest-path=%build-root%\bin\Payload +if /I "%build-config%" == "Signed" ( + rd /s /q "%dest-path%" + mkdir "%dest-path%" + xcopy "%build-root%\Microsoft.Azure.Amqp\bin\signed\net45\Microsoft.Azure.Amqp.dll" "%dest-path%\lib\net45\" /F + xcopy "%build-root%\Microsoft.Azure.Amqp\bin\signed\net45\Microsoft.Azure.Amqp.xml" "%dest-path%\lib\net45\" /F + xcopy "%build-root%\Microsoft.Azure.Amqp\bin\signed\netstandard1.3\Microsoft.Azure.Amqp.dll" "%dest-path%\lib\netstandard1.3\" /F + xcopy "%build-root%\Microsoft.Azure.Amqp\bin\signed\netstandard1.3\Microsoft.Azure.Amqp.xml" "%dest-path%\lib\netstandard1.3\" /F + xcopy "%build-root%\Microsoft.Azure.Amqp.Uwp\bin\signed\Microsoft.Azure.Amqp.dll" "%dest-path%\lib\uap10.0\" /F + xcopy "%build-root%\Microsoft.Azure.Amqp.Uwp\bin\signed\Microsoft.Azure.Amqp.pri" "%dest-path%\lib\uap10.0\" /F + xcopy "%build-root%\Microsoft.Azure.Amqp.Android\bin\signed\Microsoft.Azure.Amqp.dll" "%dest-path%\lib\monoandroid\" /F + xcopy "%build-root%\Microsoft.Azure.Amqp.Pcl\bin\signed\Microsoft.Azure.Amqp.dll" "%dest-path%\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\" /F +) rem ----------------------------------------------------------------------------- rem -- done rem ----------------------------------------------------------------------------- @@ -87,19 +93,19 @@ rem -- subroutines rem ----------------------------------------------------------------------------- :clean-a-solution -call :_run-msbuild "Clean" %1 %2 %3 +call :_run-msbuild Clean %1 %2 %3 echo %errorlevel% goto :eof :build-a-solution -call :_run-msbuild "Build" %1 %2 %3 +call :_run-msbuild Build %1 %2 %3 goto :eof :usage echo build.cmd [options] echo options: echo -c, --clean delete artifacts from previous build before building -echo --config ^ [Debug] build configuration (e.g. Debug, Release) +echo --config ^ [Debug] build configuration (e.g. Debug, Release, Signed) echo --platform ^ [Win32] build platform (e.g. Win32, x64, ...) goto :eof @@ -109,13 +115,7 @@ rem -- helper subroutines rem ----------------------------------------------------------------------------- :_run-msbuild -rem // optionally override configuration|platform -setlocal EnableExtensions -set build-target= -if "%~1" neq "Build" set "build-target=/t:%~1" -if "%~3" neq "" set build-config=%~3 -if "%~4" neq "" set build-platform=%~4 - -msbuild /m %build-target% "/p:Configuration=%build-config%;Platform=%build-platform%" %2 +echo msbuild /t:%1 /v:m "/p:Configuration=%~3;Platform=%~4" %2 +msbuild /t:%1 /v:m "/p:Configuration=%~3;Platform=%~4" %2 if not %errorlevel%==0 exit /b %errorlevel% goto :eof diff --git a/Microsoft.Azure.Amqp/Nuget/make_nuget_package.ps1 b/build/make_nuget_package.ps1 similarity index 55% rename from Microsoft.Azure.Amqp/Nuget/make_nuget_package.ps1 rename to build/make_nuget_package.ps1 index c86282b2..0b20d12d 100644 --- a/Microsoft.Azure.Amqp/Nuget/make_nuget_package.ps1 +++ b/build/make_nuget_package.ps1 @@ -11,14 +11,26 @@ function GetAssemblyVersionFromFile($filename) { exit } -if (-Not (Test-Path 'NuGet.exe')) { - Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile 'NuGet.exe' +$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition +$NugetPath = "$PSScriptRoot\NuGet.exe" +$AssemblyInfoFile = "$PSScriptRoot\..\Microsoft.Azure.Amqp\Properties\Version.cs" +$InputDirectory = [IO.Path]::GetFullPath("$PSScriptRoot\..\bin\Payload\") +$OutputDirectory = [IO.Path]::GetFullPath("$PSScriptRoot\..\bin\Package\") + +echo "$InputDirectory -> $OutputDirectory" + +if (-Not (Test-Path $NugetPath)) { + Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile $NugetPath } -$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition -$AssemblyInfoFile = "$PSScriptRoot\..\Properties\Version.cs" -$BuildConfig = "Release" -$OutputDirectory = [IO.Path]::GetFullPath("$PSScriptRoot\..\..\bin\$BuildConfig\") +if (-Not (Test-Path $InputDirectory)) { + echo "Input directory does not exist. Make sure build is complete and successful." + exit 2 +} + +if (-Not (Test-Path $OutputDirectory)) { + New-Item -ItemType Directory -Force -Path $OutputDirectory +} # Delete existing packages to force rebuild ls "$OutputDirectory\Microsoft.Azure.Amqp.*.nupkg" | % { del $_ } @@ -27,4 +39,4 @@ $ver = GetAssemblyVersionFromFile($AssemblyInfoFile) $id='Microsoft.Azure.Amqp' echo "Creating NuGet package $id version $ver" -.\NuGet.exe pack "$PSScriptRoot\$id.nuspec" -Prop Configuration=$BuildConfig -Prop Version=$ver -OutputDirectory $OutputDirectory \ No newline at end of file +& "$NugetPath" pack "$PSScriptRoot\$id.nuspec" -Prop InputDirectory=$InputDirectory -Prop Version=$ver -OutputDirectory $OutputDirectory \ No newline at end of file