Skip to content

Commit 2417577

Browse files
author
Azure IoT Builder
committed
Merge commit '23af288cca5f57f45cc945e18a4f45929a3d1dd0' into HEAD
2 parents 2710b6f + 23af288 commit 2417577

12 files changed

+138
-85
lines changed

build.ps1

Lines changed: 89 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@ Parameters:
1818
-xamarintests: Runs Xamarin tests. Requires additional SDKs and prerequisite configuration.
1919
-configuration {Debug|Release}
2020
-verbosity: Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic].
21-
.NOTES
21+
2222
Build will automatically detect if the machine is Windows vs Unix. On Windows development boxes, additional testing on .NET Framework will be performed.
2323
24-
.EXAMPLE
24+
The following environment variables can tune the build behavior:
25+
- AZURE_IOT_DONOTSIGN: disables delay-signing if set to 'TRUE'
26+
- AZURE_IOT_LOCALPACKAGES: the path to the local nuget source.
27+
Add a new source using: `nuget sources add -name MySource -Source <path>`
28+
Remove a source using: `nuget sources remove -name MySource`
29+
30+
.EXAMPLE
2531
.\build
2632
2733
Builds a Debug version of the SDK.
@@ -50,10 +56,30 @@ Param(
5056
[switch] $e2etests,
5157
[switch] $stresstests,
5258
[switch] $xamarintests,
59+
[switch] $sign,
5360
[string] $configuration = "Debug",
5461
[string] $verbosity = "q"
5562
)
5663

64+
Function IsWindowsDevelopmentBox()
65+
{
66+
return ([Environment]::OSVersion.Platform -eq [System.PlatformID]::Win32NT)
67+
}
68+
69+
Function CheckSignTools()
70+
{
71+
$commands = $("SignDotNetBinary", "SignBinary", "SignNuGetPackage", "SignMSIPackage")
72+
73+
foreach($command in $commands)
74+
{
75+
$info = Get-Command $command -ErrorAction SilentlyContinue
76+
if ($info -eq $null)
77+
{
78+
throw "Sign toolset not found: '$command' is missing."
79+
}
80+
}
81+
}
82+
5783
Function BuildProject($path, $message) {
5884

5985
$label = "BUILD: --- $message $configuration ---"
@@ -81,14 +107,30 @@ Function BuildPackage($path, $message) {
81107

82108
Write-Host
83109
Write-Host -ForegroundColor Cyan $label
84-
cd (Join-Path $rootDir $path)
85110

86-
$frameworkArgs = ""
111+
$projectPath = Join-Path $rootDir $path
112+
cd $projectPath
87113

88-
& dotnet pack --verbosity $verbosity --configuration $configuration --no-build --include-symbols --include-source --output $localPackages
114+
$projectName = (dir (Join-Path $projectPath *.csproj))[0].BaseName
115+
116+
if ($sign)
117+
{
118+
Write-Host -ForegroundColor Magenta "`tSigning binaries: $projectName"
119+
$filesToSign = dir -Recurse .\bin\Release\$projectName.dll
120+
SignDotNetBinary $filesToSign
121+
}
89122

123+
& dotnet pack --verbosity $verbosity --configuration $configuration --no-build --include-symbols --include-source --output $localPackages
124+
90125
if ($LASTEXITCODE -ne 0) {
91-
throw "Build failed: $label"
126+
throw "Package failed: $label"
127+
}
128+
129+
if ($sign)
130+
{
131+
Write-Host -ForegroundColor Magenta "`tSigning package: $projectName"
132+
$filesToSign = dir (Join-Path $localPackages "$projectName.nupkg")
133+
SignNuGetPackage $filesToSign
92134
}
93135
}
94136

@@ -122,47 +164,34 @@ Function RunApp($path, $message, $framework="netcoreapp2.0") {
122164
}
123165
}
124166

125-
Function IsWindowsDevelopmentBox()
126-
{
127-
return ([Environment]::OSVersion.Platform -eq [System.PlatformID]::Win32NT)
128-
}
129-
130167
$rootDir = (Get-Item -Path ".\" -Verbose).FullName
131168
$localPackages = Join-Path $rootDir "bin\pkg"
132169
$startTime = Get-Date
133170
$buildFailed = $true
134171
$errorMessage = ""
135172

136173
try {
174+
if ($sign)
175+
{
176+
CheckSignTools
177+
}
178+
137179
if (-not $nobuild)
138180
{
139181
# SDK binaries
140182
BuildProject shared\src "Shared Assembly"
141183
BuildProject iothub\device\src "IoT Hub DeviceClient SDK"
142-
BuildProject iothub\service\src "IoT Hub ServiceClient SDK"
184+
BuildProject iothub\service\src "IoT Hub ServiceClient SDK"
143185
BuildProject security\tpm\src "SecurityProvider for TPM"
144186
BuildProject provisioning\device\src "Provisioning Device Client SDK"
145187
BuildProject provisioning\transport\amqp\src "Provisioning Transport for AMQP"
146188
BuildProject provisioning\transport\http\src "Provisioning Transport for HTTP"
147189
BuildProject provisioning\transport\mqtt\src "Provisioning Transport for MQTT"
148190
BuildProject provisioning\service\src "Provisioning Service Client SDK"
149-
150-
# Samples
151-
BuildProject iothub\device\samples "IoT Hub DeviceClient Samples"
152-
BuildProject iothub\service\samples "IoT Hub ServiceClient Samples"
153-
BuildProject provisioning\device\samples "Provisioning Device Client Samples"
154-
BuildProject provisioning\service\samples "Provisioning Service Client Samples"
155-
BuildProject security\tpm\samples "SecurityProvider for TPM Samples"
156-
157-
# Xamarin samples (require Android, iOS and UWP SDKs and configured iOS remote)
158-
if ($xamarintests)
159-
{
160-
# TODO #335 - create new Xamarin automated samples/tests
161-
}
162191
}
163192

164193
# Unit Tests require InternalsVisibleTo and can only run in Debug builds.
165-
if ((-not $nounittests) -and ($configuration.ToLower() -eq "debug"))
194+
if ((-not $nounittests) -and ($configuration.ToUpperInvariant() -eq "DEBUG"))
166195
{
167196
Write-Host
168197
Write-Host -ForegroundColor Cyan "Unit Test execution"
@@ -177,7 +206,7 @@ try {
177206
RunTests security\tpm\tests "SecurityProvider for TPM Tests"
178207
RunTests provisioning\service\tests "Provisioning Service Client Tests"
179208
}
180-
209+
181210
if ((-not $nopackage))
182211
{
183212
BuildPackage shared\src "Shared Assembly"
@@ -191,6 +220,25 @@ try {
191220
BuildPackage provisioning\service\src "Provisioning Service Client SDK"
192221
}
193222

223+
if (-not [string]::IsNullOrWhiteSpace($env:AZURE_IOT_LOCALPACKAGES))
224+
{
225+
Write-Host
226+
Write-Host -ForegroundColor Cyan "Preparing local package source"
227+
Write-Host
228+
229+
if (-not (Test-Path $env:AZURE_IOT_LOCALPACKAGES))
230+
{
231+
throw "Local NuGet package source path invalid: $($env:AZURE_IOT_LOCALPACKAGES)"
232+
}
233+
234+
# Clear the NuGet cache and the old packages.
235+
dotnet nuget locals --clear all
236+
Remove-Item $env:AZURE_IOT_LOCALPACKAGES\*.*
237+
238+
# Copy new packages.
239+
copy (Join-Path $rootDir "bin\pkg\*.*") $env:AZURE_IOT_LOCALPACKAGES
240+
}
241+
194242
if ($e2etests)
195243
{
196244
Write-Host
@@ -200,7 +248,7 @@ try {
200248
# Override verbosity to display individual test execution.
201249
$oldVerbosity = $verbosity
202250
$verbosity = "normal"
203-
251+
204252
RunTests e2e\test "End-to-end tests (NetCoreApp)"
205253
if (IsWindowsDevelopmentBox)
206254
{
@@ -209,6 +257,19 @@ try {
209257
}
210258

211259
$verbosity = $oldVerbosity
260+
261+
# Samples
262+
BuildProject iothub\device\samples "IoT Hub DeviceClient Samples"
263+
BuildProject iothub\service\samples "IoT Hub ServiceClient Samples"
264+
BuildProject provisioning\device\samples "Provisioning Device Client Samples"
265+
BuildProject provisioning\service\samples "Provisioning Service Client Samples"
266+
BuildProject security\tpm\samples "SecurityProvider for TPM Samples"
267+
268+
# Xamarin samples (require Android, iOS and UWP SDKs and configured iOS remote)
269+
if ($xamarintests)
270+
{
271+
# TODO #335 - create new Xamarin automated samples/tests
272+
}
212273
}
213274

214275
if ($stresstests)

e2e/test/E2ETests.csproj

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,12 @@
7272
<PackageReference Include="Microsoft.Azure.EventHubs" Version="1.0.3" />
7373
</ItemGroup>
7474

75-
<!--
76-
For Debug runs, reference the local SDK build.
77-
Note: To run in Visual Studio, a SLN referencing all projects below is required.
78-
-->
79-
<!-- TODO: <ItemGroup Condition=" '$(Configuration)' == 'Debug' "> -->
80-
<ItemGroup>
75+
<ItemGroup Condition=" '$(AZURE_IOT_LOCALPACKAGES)' == '' ">
8176
<ProjectReference Include="$(RootDir)\iothub\device\src\Microsoft.Azure.Devices.Client.csproj" />
8277
<ProjectReference Include="$(RootDir)\iothub\service\src\Microsoft.Azure.Devices.csproj" />
8378
<ProjectReference Include="$(RootDir)\shared\src\Microsoft.Azure.Devices.Shared.csproj" />
8479
</ItemGroup>
85-
<!-- TODO: <ItemGroup Condition=" ('$(Configuration)' == 'Debug') And ( '$(TargetFramework)' != 'net451' ) "> -->
86-
<ItemGroup Condition=" '$(TargetFramework)' != 'net451' ">
80+
<ItemGroup Condition=" ('$(AZURE_IOT_LOCALPACKAGES)' == '') And ( '$(TargetFramework)' != 'net451' ) ">
8781
<ProjectReference Include="$(RootDir)\provisioning\device\src\Microsoft.Azure.Devices.Provisioning.Client.csproj" />
8882
<ProjectReference Include="$(RootDir)\provisioning\transport\amqp\src\Microsoft.Azure.Devices.Provisioning.Transport.Amqp.csproj" />
8983
<ProjectReference Include="$(RootDir)\provisioning\transport\http\src\Microsoft.Azure.Devices.Provisioning.Transport.Http.csproj" />
@@ -92,20 +86,18 @@
9286
<Compile Include="$(RootDir)\security\tpm\samples\SecurityProviderTpmSimulator\SecurityProviderTpmSimulator.cs" />
9387
</ItemGroup>
9488

95-
<!-- TODO: For Release runs, reference the latest NuGet packages.
96-
<ItemGroup Condition=" '$(Configuration)' == 'Release' ">
89+
<ItemGroup Condition=" '$(AZURE_IOT_LOCALPACKAGES)' != '' ">
9790
<PackageReference Include="Microsoft.Azure.Devices" Version="1.*" />
9891
<PackageReference Include="Microsoft.Azure.Devices.Shared" Version="1.*" />
9992
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.*" />
10093
</ItemGroup>
101-
<ItemGroup Condition=" ('$(Configuration)' == 'Release') And ( '$(TargetFramework)' != 'net451' ) ">
94+
<ItemGroup Condition=" ('$(AZURE_IOT_LOCALPACKAGES.ToUpper())' != '') And ( '$(TargetFramework)' != 'net451' ) ">
10295
<PackageReference Include="Microsoft.Azure.Devices.Provisioning.Client" Version="1.*" />
10396
<PackageReference Include="Microsoft.Azure.Devices.Provisioning.Transport.Amqp" Version="1.*" />
10497
<PackageReference Include="Microsoft.Azure.Devices.Provisioning.Transport.Http" Version="1.*" />
10598
<PackageReference Include="Microsoft.Azure.Devices.Provisioning.Transport.Mqtt" Version="1.*" />
10699
<PackageReference Include="Microsoft.Azure.Devices.Provisioning.Security.Tpm" Version="1.*" />
107100
<ProjectReference Include="$(RootDir)\security\tpm\samples\SecurityProviderTpmSimulator\SecurityProviderTpmSimulator.csproj" />
108101
</ItemGroup>
109-
-->
110102

111103
</Project>

iothub/device/src/Microsoft.Azure.Devices.Client.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
</PropertyGroup>
1616

1717
<!-- delay sign the assembly for Release build -->
18-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
18+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' AND '$(AZURE_IOT_DONOTSIGN.ToUpper())' != 'TRUE' ">
1919
<AssemblyOriginatorKeyFile>$(RootDir)\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
2020
<DelaySign>true</DelaySign>
2121
<SignAssembly>true</SignAssembly>
2222
</PropertyGroup>
2323

2424
<PropertyGroup>
25-
<VersionPrefix>1.6.2</VersionPrefix>
25+
<VersionPrefix>1.7.0</VersionPrefix>
2626
<Title>Microsoft Azure IoT Device Client SDK</Title>
2727
<Authors>Microsoft</Authors>
2828
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
@@ -56,8 +56,8 @@
5656
<Reference Include="System.Net.Http.WebRequest" />
5757
<Reference Include="System.Transactions" />
5858
<Reference Include="System.Web" />
59-
<PackageReference Include="System.Net.Http" Version="4.3.3" />
60-
<PackageReference Include="System.Net.Http.Formatting.Extension" Version="5.2.3" />
59+
<Reference Include="System.Net.Http"/>
60+
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.3" />
6161
<PackageReference Include="Microsoft.Owin" Version="4.0.0" />
6262
</ItemGroup>
6363

@@ -101,4 +101,4 @@
101101
<PackageReference Condition=" '$(Configuration)' == 'Debug' " Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.0-beta2" />
102102
</ItemGroup>
103103

104-
</Project>
104+
</Project>

iothub/service/src/Microsoft.Azure.Devices.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
</PropertyGroup>
1616

1717
<!-- delay sign the assembly for Release build -->
18-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
18+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' AND '$(AZURE_IOT_DONOTSIGN.ToUpper())' != 'TRUE' ">
1919
<AssemblyOriginatorKeyFile>$(RootDir)\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
2020
<DelaySign>true</DelaySign>
2121
<SignAssembly>true</SignAssembly>
2222
</PropertyGroup>
2323

2424
<PropertyGroup>
25-
<VersionPrefix>1.5.1</VersionPrefix>
25+
<VersionPrefix>1.6.0</VersionPrefix>
2626
<Title>Microsoft Azure IoT Service Client SDK</Title>
2727
<Authors>Microsoft</Authors>
2828
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
@@ -124,8 +124,8 @@
124124
<Reference Include="System.Configuration" />
125125
<Reference Include="System.Transactions" />
126126
<Reference Include="System.Web" />
127-
<PackageReference Include="System.Net.Http" Version="4.3.3" />
128-
<PackageReference Include="System.Net.Http.Formatting.Extension" Version="5.2.3" />
127+
<Reference Include="System.Net.Http"/>
128+
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.3" />
129129
<PackageReference Include="Microsoft.Owin" Version="4.0.0" />
130130
</ItemGroup>
131131

provisioning/device/src/Microsoft.Azure.Devices.Provisioning.Client.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<TargetFramework>netstandard2.0</TargetFramework>
44
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -10,29 +10,29 @@
1010
</PropertyGroup>
1111

1212
<!-- delay sign the assembly for Release build -->
13-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
13+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' AND '$(AZURE_IOT_DONOTSIGN.ToUpper())' != 'TRUE' ">
1414
<AssemblyOriginatorKeyFile>$(RootDir)\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
1515
<DelaySign>true</DelaySign>
1616
<SignAssembly>true</SignAssembly>
1717
</PropertyGroup>
1818

1919
<PropertyGroup>
20-
<VersionPrefix>1.0.2</VersionPrefix>
20+
<VersionPrefix>1.1.0</VersionPrefix>
2121
<Title>Microsoft Azure IoT Provisioning Device Client SDK</Title>
2222
<Authors>Microsoft</Authors>
2323
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2424
<PackageLicenseUrl>https://github.com/Azure/azure-iot-sdk-csharp/blob/master/LICENSE</PackageLicenseUrl>
2525
<Description>Provisioning Device Client SDK for Azure IoT Devices</Description>
2626
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
2727
<PackageProjectUrl>https://github.com/Azure/azure-iot-sdk-csharp</PackageProjectUrl>
28-
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
28+
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
2929
<PackageTags>Microsoft Azure IoT Provisioning Device Client .NET AMQP MQTT HTTP</PackageTags>
3030
</PropertyGroup>
31-
31+
3232
<PropertyGroup>
3333
<common>$(RootDir)\common\src</common>
3434
</PropertyGroup>
35-
35+
3636
<ItemGroup>
3737
<Compile Include="$(Common)\Logging.Common.cs">
3838
<Link>Common\Logging.Common.cs</Link>

provisioning/service/src/Microsoft.Azure.Devices.Provisioning.Service.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
</PropertyGroup>
1414

1515
<!-- delay sign the assembly for Release build -->
16-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
16+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' AND '$(AZURE_IOT_DONOTSIGN.ToUpper())' != 'TRUE' ">
1717
<AssemblyOriginatorKeyFile>$(RootDir)\35MSSharedLib1024.snk</AssemblyOriginatorKeyFile>
1818
<DelaySign>true</DelaySign>
1919
<SignAssembly>true</SignAssembly>
2020
</PropertyGroup>
2121

2222
<PropertyGroup>
23-
<VersionPrefix>1.0.1</VersionPrefix>
23+
<VersionPrefix>1.1.0</VersionPrefix>
2424
<Title>Microsoft Azure IoT Provisioning Service Client SDK</Title>
2525
<Authors>Microsoft</Authors>
2626
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>

0 commit comments

Comments
 (0)