forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.proj
357 lines (295 loc) · 22.3 KB
/
build.proj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<?xml version="1.0" encoding="utf-8"?>
<!--
Available Targets:
/t:Clean
Removes temporary build outputs.
/t:Build
Builds assemblies.
/t:Test
Runs tests
/t:Publish
Creates local nuget packages and MSI
/p:CodeSign=True
Code sign binaries, mainly for official release. Default is false.
/p:CodeSign=True;DelaySign=True
Test the code sign workflow locally.
/p:Scope
'Subfolder under src': An individual cmdlet module
By default, it builds everything
/p:SkipHelp=True
Skips help generation, mainly for local builds to save time.
-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)Repo.props" />
<!-- Define default build properties -->
<PropertyGroup>
<LibraryRoot>$(MSBuildThisFileDirectory)</LibraryRoot>
<LibrarySourceFolder>$(LibraryRoot)src</LibrarySourceFolder>
<LibraryToolsFolder>$(LibraryRoot)tools</LibraryToolsFolder>
<LibraryArtifactsFolder>$(LibraryRoot)artifacts</LibraryArtifactsFolder>
<LocalFeedFolder>$(LibraryToolsFolder)/LocalFeed</LocalFeedFolder>
<Configuration Condition=" '$(Configuration)' != 'Release'">Debug</Configuration>
<CodeSign Condition ="'$(CodeSign)' == ''">false</CodeSign>
<!--Set this true only if you want to test the code sign workflow locally-->
<DelaySign Condition ="'$(DelaySign)' == ''">false</DelaySign>
<SignedOutputRootDir>$(LibraryRoot)signed</SignedOutputRootDir>
<PackageDirectory>$(LibraryRoot)/artifacts</PackageDirectory>
<TestOutputDirectory>$(PackageDirectory)/TestResults</TestOutputDirectory>
<StaticAnalysisOutputDirectory>$(PackageDirectory)/StaticAnalysisResults</StaticAnalysisOutputDirectory>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' == '' ">$(LibrarySourceFolder)</NuGetPublishingSource>
<Scope Condition="$(Scope) == ''" >All</Scope>
<TestsToRun Condition="$(TestsToRun) == ''" >All</TestsToRun>
<CoreTests Condition="'$(TestsToRun)' != 'All'">$(LibraryRoot)src/Compute/Compute.Test/Compute.Test.csproj;$(LibraryRoot)src/Network/Network.Test/Network.Test.csproj;$(LibraryRoot)src/Resources/Resources.Test/Resources.Test.csproj;$(LibraryRoot)src/Sql/Sql.Test/Sql.Test.csproj;$(LibraryRoot)src/Websites/Websites.Test/Websites.Test.csproj;</CoreTests>
<NetCore Condition="'$(NetCore)' != 'false'">true</NetCore>
<RunStaticAnalysis Condition="'$(RunStaticAnalysis)' != 'false'">true</RunStaticAnalysis>
<Scope Condition="$(NetCore) == 'true'">Netcore</Scope>
<!-- Set Skips -->
<SkipHelp Condition ="'$(SkipHelp)' != 'true'">false</SkipHelp>
<NuGetCommand>$(MSBuildProjectDirectory)/tools/NuGet.exe</NuGetCommand>
<LibraryNugetPackageFolder>$(LibrarySourceFolder)/packages</LibraryNugetPackageFolder>
<NuGetRestoreConfigFile>$(MSBuildProjectDirectory)/NuGet.Config</NuGetRestoreConfigFile>
<!-- Partial Commands -->
<PowerShellCoreCommand Condition=" '$(PowerShellCoreCommand)' == '' ">pwsh</PowerShellCoreCommand>
<PowerShellCoreCommandPrefix>$(PowerShellCoreCommand) -NonInteractive -NoLogo -NoProfile -Command</PowerShellCoreCommandPrefix>
<!-- CI build related -->
<CIToolsPath>$(OnPremiseBuildTasks)</CIToolsPath>
<OnPremiseBuild Condition="Exists($(OnPremiseBuildTasks))">true</OnPremiseBuild>
<OnPremiseBuild Condition="!Exists($(OnPremiseBuildTasks))">false</OnPremiseBuild>
<!-- CISignRepo is an environment variable that points to ci-signing repo clone -->
<CISignRepoPath>$(CISignRepo)</CISignRepoPath>
</PropertyGroup>
<!-- Tasks -->
<UsingTask TaskName="SetEnvVar" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)/Microsoft.Build.Tasks.Core.dll" >
<ParameterGroup>
<EnvName ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[System.Environment.SetEnvironmentVariable(EnvName, EnvValue);]]>
</Code>
</Task>
</UsingTask>
<UsingTask Condition="$(OnPremiseBuild)" TaskName="CorporateValidation" AssemblyFile="$(CIToolsPath)/Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
<Import Condition="$(OnPremiseBuild)" Project="$(CIToolsPath)/Microsoft.WindowsAzure.Build.OnPremise.msbuild" />
<UsingTask TaskName="ESRPSignTask" AssemblyFile="$(CISignRepoPath)/tools/sdkbuildtools/tasks/MS.Az.Sdk.OnPremise.Build.Tasks.dll" />
<!-- Clean the build in all configurations -->
<Target Name="Clean">
<Message Importance="high" Text="Cleaning Cmdlets..." />
<!-- Clean out the NuGet cache -->
<Exec Command="dotnet nuget locals global-packages --clear" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />
<!-- Remove Package, Publish, bin, obj, and TestResults directories -->
<Exec Command="$(PowerShellCoreCommandPrefix) "Remove-Item -Path $(PackageDirectory) -Recurse -Force -ErrorAction Ignore"" IgnoreExitCode="true" />
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(MSBuildThisFileDirectory) -Recurse -Include 'bin','obj','TestResults' | Remove-Item -Recurse -Force -ErrorAction Ignore"" IgnoreExitCode="true" />
</Target>
<Target Name="FilterBuild">
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/CreateFilterMappings.ps1"" />
<!-- Get all of the files changed in the given pull request -->
<FilesChangedTask RepositoryOwner="Azure" RepositoryName="azure-powershell" PullRequestNumber="$(PullRequestNumber)">
<Output TaskParameter="FilesChanged" ItemName="FilesChanged" />
</FilesChangedTask>
<!-- Get the list of modules changed -->
<FilterTask FilesChanged="@(FilesChanged)" MapFilePath="./ModuleMappings.json">
<Output TaskParameter="Output" ItemName="ModulesChanged" />
</FilterTask>
<Message Text="Filtering help generation and StaticAnalysis by the following modules:" />
<Message Text="%(ModulesChanged.Identity)" />
<Message Text="Total: @(ModulesChanged->Count())" />
<Message Text="" />
<!-- Get the list of solutions to build -->
<FilterTask FilesChanged="@(FilesChanged)" MapFilePath="./SolutionMappings.json">
<Output TaskParameter="Output" ItemName="CmdletSolutionsToBuild" />
</FilterTask>
<Message Text="Filtering solutions to build by the following:" />
<Message Text="%(CmdletSolutionsToBuild.Identity)" />
<Message Text="Total: @(CmdletSolutionsToBuild->Count())" />
<Message Text="" />
<!--Get the list of tests to be run based on files changed from a specified PullRequestNumber. Mapping between paths and test DLLs is used to produce the list.-->
<FilterTask FilesChanged="@(FilesChanged)" MapFilePath="./TestMappings.json">
<Output TaskParameter="Output" ItemName="XUnitTests" />
</FilterTask>
<Message Text="Using these test assemblies:" />
<Message Text="%(XUnitTests.Identity)" />
<Message Text="Total: @(XunitTests->Count())" />
<Message Text="" />
</Target>
<!-- Build all flavors of the Cmdlets -->
<!-- TODO: Reimplement the FilterBuild and update RepoTasks to NetStandard -->
<Target Name="Build">
<Message Importance="high" Text="Building Cmdlets..." />
<MakeDir Directories="$(PackageDirectory)" />
<!-- Copy appropriate targets -->
<Copy SourceFiles="$(RepoBuild)after.Azure.PowerShell.sln.targets" DestinationFolder="$(RepoArtifacts)" />
<!-- Build and create package content -->
<Exec Command="dotnet --version" />
<Exec Command="dotnet new sln -n Azure.PowerShell -o $(RepoArtifacts) --force" />
<ItemGroup>
<CsprojFiles Include="$(LibraryRoot)src/**/*.csproj" Exclude="$(LibraryRoot)src/**/*.Test.csproj;$(LibraryRoot)src/**/Authenticators.csproj" />
<CsprojFiles Include="$(LibraryRoot)src/**/*.Test.csproj" Condition="'$(CodeSign)' == 'false' and '$(TestsToRun)' == 'All'" />
<CsprojFiles Include="$(LibraryRoot)src/**/*.Test.csproj" Exclude="$(CoreTests)" Condition="'$(CodeSign)' == 'false' and '$(TestsToRun)' == 'NonCore'" />
<CsprojFiles Include="$(CoreTests)" Condition="'$(CodeSign)' == 'false' and '$(TestsToRun)' == 'Core'" />
<CsprojFiles Include="$(LibraryRoot)src/**/Authenticators.csproj" Condition="'$([MSBuild]::IsOsPlatform("Windows"))' == 'true'" />
</ItemGroup>
<!-- https://github.com/dotnet/cli/issues/6295#issuecomment-346973582 -->
<Exec Command="dotnet sln $(RepoArtifacts)Azure.PowerShell.sln add "%(CsprojFiles.FullPath)"" />
<PropertyGroup>
<BuildAction Condition="'$(CodeSign)' == 'false'">build</BuildAction>
<BuildAction Condition="'$(CodeSign)' == 'true'">publish</BuildAction>
</PropertyGroup>
<Exec Command="dotnet $(BuildAction) $(RepoArtifacts)Azure.PowerShell.sln -c $(Configuration)" />
<!-- Build version controller -->
<Exec Command="dotnet build $(RepoTools)VersionController/VersionController.Netcore.csproj -c $(Configuration)" />
<!-- Publish static analysis for use cross-platform -->
<Exec Command="dotnet publish $(RepoTools)StaticAnalysis/StaticAnalysis.Netcore.csproj -c $(Configuration) -f netcoreapp2.1" />
<!-- Delete powershell runtime files -->
<PropertyGroup>
<RuntimeDllsIncludeList>Microsoft.Powershell.*.dll,System*.dll,Microsoft.VisualBasic.dll,Microsoft.CSharp.dll,Microsoft.CodeAnalysis.dll,Microsoft.CodeAnalysis.CSharp.dll</RuntimeDllsIncludeList>
<RuntimeDllsExcludeList>System.Security.Cryptography.ProtectedData.dll,System.Configuration.ConfigurationManager.dll,System.Runtime.CompilerServices.Unsafe.dll,System.IO.FileSystem.AccessControl.dll,System.Buffers.dll,System.Text.Encodings.Web.dll,System.CodeDom.dll</RuntimeDllsExcludeList>
</PropertyGroup>
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(PackageDirectory)/$(Configuration) -Recurse -Include $(RuntimeDllsIncludeList) -Exclude $(RuntimeDllsExcludeList) | Remove-Item -Recurse -Force"" />
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(PackageDirectory)/$(Configuration) -Recurse -Include 'runtimes' | Remove-Item -Recurse -Force"" Condition="'$(CodeSign)' == 'true'" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope)"" />
</Target>
<Target Name="OnPremChecks" Condition="'$(OnPremiseBuild)'">
<Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)CheckBinScope.ps1 -BuildConfig $(Configuration) -CIToolsPath $(CIToolsPath)"" />
<Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)CheckPoliCheck.ps1 -BuildConfig $(Configuration) -CIToolsPath $(CIToolsPath)"" />
<Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)CheckCredScan.ps1 -CIToolsPath $(CIToolsPath) -PullRequestNumber $(PullRequestNumber)"" />
<OnError ExecuteTargets="OnPremChecksErrorMessage" />
</Target>
<Target Name="OnPremChecksErrorMessage">
<Error Text="BinScope or PoliCheck failed. Please check the files in artifacts/BinScope, or Severity 1 issues in artifacts/PoliCheck-Scan.html" />
</Target>
<Target Name="GenerateHelp" Condition="'$(SkipHelp)' == 'false'">
<Message Importance="high" Text="Running help generation..." />
<MakeDir Directories="$(StaticAnalysisOutputDirectory)" />
<Exec Command="$(PowerShellCoreCommandPrefix) "Set-Variable -Name ProgressPreference -Value 'SilentlyContinue';. $(LibraryToolsFolder)/GenerateHelp.ps1 -ValidateMarkdownHelp -GenerateMamlHelp -BuildConfig $(Configuration)"" />
<Exec Command="dotnet $(RepoArtifacts)StaticAnalysis/StaticAnalysis.Netcore.dll -p $(RepoArtifacts)$(Configuration) -r $(StaticAnalysisOutputDirectory) -h -u -m @(ModulesChanged)" Condition="'$(RunStaticAnalysis)' == 'true'" />
</Target>
<!-- Everything except Publish -->
<Target Name="Full" DependsOnTargets="Clean;Build;OnPremChecks;GenerateHelp;StaticAnalysis;Test" />
<Target Name="StaticAnalysis" Condition="'$(RunStaticAnalysis)' == 'true'">
<Message Importance="high" Text="Running static analysis..." />
<MakeDir Directories="$(StaticAnalysisOutputDirectory)" />
<Exec Command="dotnet $(RepoArtifacts)StaticAnalysis/StaticAnalysis.Netcore.dll -p $(RepoArtifacts)$(Configuration) -r $(StaticAnalysisOutputDirectory) -s -u -m @(ModulesChanged)" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/CheckAssemblies.ps1 -BuildConfig $(Configuration) "" />
<OnError ExecuteTargets="StaticAnalysisErrorMessage" />
</Target>
<Target Name="StaticAnalysisErrorMessage">
<Error Text="StaticAnalysis has failed. Please follow the instructions on this doc: https://github.com/Azure/azure-powershell/blob/master/documentation/Debugging-StaticAnalysis-Errors.md" />
</Target>
<Target Name="ChangeLogCheck">
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/CheckChangeLog.ps1 -FilesChanged '@(FilesChanged)'"" Condition=" '$(Scope)' == 'All' or '$(Scope)' == 'Latest' " />
<OnError ExecuteTargets="ChangeLogErrorMessage" />
</Target>
<Target Name="ChangeLogErrorMessage">
<Error Text="Modified files were found with no update to their change log. Please add a snippet to the affected modules' change log." />
</Target>
<Target Name="Publish" Condition="'$(CodeSign)' == 'true'">
<Message Importance="high" Text="Publishing Cmdlets using $(Scope) scope" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/NewOutputTypeIndex.ps1 -OutputFile $(PackageDirectory)/outputtypes.json -BuildConfig $(Configuration)"" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/NewHelpIndex.ps1 -OutputFile $(PackageDirectory)/index.json -BuildConfig $(Configuration)"" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/CleanupBuild.ps1 -BuildConfig $(Configuration)"" />
<Error Condition="'$(NuGetKey)' == ''" Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/PublishModules.ps1 -IsNetCore:$$(NetCore) -BuildConfig $(Configuration) -Scope $(Scope) -ApiKey $(NuGetKey) -RepositoryLocation \"$(NuGetPublishingSource)\"" -NugetExe $(NuGetCommand)" />
</Target>
<Target Name="BuildInstaller" AfterTargets="Publish" Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
<Exec Command="$(PowerShellCoreCommandPrefix) ". Register-PSRepository -Name MSIcreationrepository -SourceLocation $(PackageDirectory) -InstallationPolicy Trusted "" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryRoot)/setup/generate.ps1 -repository MSIcreationrepository "" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". Unregister-PSRepository -Name MSIcreationrepository "" />
</Target>
<Target Name="Test">
<Message Importance="high" Text="Running check in tests..." />
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
<PropertyGroup Condition="'$(Framework)' == ''">
<Framework>netcoreapp2.1</Framework>
</PropertyGroup>
<!-- https://github.com/Microsoft/msbuild/issues/3157#issuecomment-378002971 -->
<!-- https://github.com/xunit/xunit/issues/1154#issuecomment-405366373 -->
<Exec Command="dotnet test $(RepoArtifacts)Azure.PowerShell.sln --filter "AcceptanceType=CheckIn%26RunType!=DesktopOnly" --configuration $(Configuration) --framework $(Framework) --logger trx --results-directory "$(TestOutputDirectory)"" />
<OnError ExecuteTargets="TestFailureErrorMessage" />
</Target>
<Target Name="TestNet472">
<Message Importance="high" Text="Running check in tests..." />
<PropertyGroup>
<AuthExclusions>$(LibraryRoot)src/**/Authenticators.csproj;</AuthExclusions>
<AutomationExclusions>$(LibraryRoot)src/**/Automation.Test.csproj;</AutomationExclusions>
<StorageExclusions>$(LibraryRoot)src/**/Storage.Test.csproj;</StorageExclusions>
<PowerShellCommand Condition=" '$(PowerShellCommand)' == '' ">C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellCommand>
<!-- All PowerShell commands have this prefix -->
<PowerShellCommandPrefix>"$(PowerShellCommand)" -NonInteractive -NoLogo -NoProfile -Command</PowerShellCommandPrefix>
</PropertyGroup>
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
<Exec Command="dotnet new sln -n Azure.PowerShell --force" />
<ItemGroup>
<ModuleCsprojFiles Include="$(LibraryRoot)src/**/*.csproj" Exclude="$(AuthExclusions);$(AutomationExclusions);$(StorageExclusions)"/>
</ItemGroup>
<!-- https://stackoverflow.com/a/35477012/294804 -->
<ItemGroup>
<ModuleCsprojFilesRelative Include="@(ModuleCsprojFiles)">
<RelativePath>$([MSBuild]::MakeRelative($(LibraryRoot), %(ModuleCsprojFiles.FullPath)))</RelativePath>
</ModuleCsprojFilesRelative>
</ItemGroup>
<Exec Command="dotnet sln Azure.PowerShell.sln add @(ModuleCsprojFilesRelative->'%(RelativePath)', ' ')" />
<Exec Command="dotnet sln Azure.PowerShell.sln add $(LibraryRoot)tools/ScenarioTest.ResourceManager/ScenarioTest.ResourceManager.csproj $(LibraryRoot)tools/TestFx/TestFx.csproj" />
<!-- https://github.com/Microsoft/msbuild/issues/3157#issuecomment-378002971 -->
<!-- https://github.com/xunit/xunit/issues/1154#issuecomment-405366373 -->
<Exec Command="dotnet build Azure.PowerShell.sln --configuration $(Configuration)" />
<Exec Command="dotnet new console -n Net472Tests" />
<Exec Command="dotnet add Net472Tests package xunit.runner.console --version 2.4.0" />
<Exec Command="dotnet restore --packages ./artifacts/tools -f --no-cache Net472Tests" />
<Exec Command="$(PowerShellCommandPrefix) "$(LibraryToolsFolder)/TestNet472Modules.ps1 -TestExecPath '$(LibraryArtifactsFolder)/tools/xunit.runner.console/2.4.0/tools/net472/xunit.console.exe' "" />
<OnError ExecuteTargets="TestFailureErrorMessage" />
</Target>
<Target Name="TestFailureErrorMessage">
<Error Text="Test failures occured, check the files in artifacts/TestResults" />
</Target>
<Target Name="CodeSignBinaries" AfterTargets="Build" Condition="'$(CodeSign)' == 'true'">
<Message Text="====> Executing CodeSignBinaries Target..." Importance="high" />
<Message Text="----> Dlls signing section" Importance="high" />
<!-- Azure -->
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
<DelaySignedAssembliesToSign Include="
$(PackageDirectory)/$(Configuration)/**/Microsoft*Azure*PowerShell*Cmdlets*.dll;
$(PackageDirectory)/$(Configuration)/**/Microsoft.Azure.PowerShell.Authentication.dll;
$(PackageDirectory)/$(Configuration)/**/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll;
$(PackageDirectory)/$(Configuration)/**/Microsoft.Azure.PowerShell.Authenticators.dll" Exclude="$(PackageDirectory)/$(Configuration)/**/Microsoft*Azure*PowerShell*Cmdlets*.Test.dll" />
</ItemGroup>
<Message Importance="high" Text="$(PackageDirectory)/$(Configuration) does not contains any files to sign. Code sign will skip." Condition="'@(DelaySignedAssembliesToSign)' == ''" />
<ESRPSignTask CopyBackSignedFilesToOriginalLocation="true" UnsignedFileList="@(DelaySignedAssembliesToSign)" SignLogDirPath="$(LibraryRoot)dlls-signing.log" Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''" />
<!-- Copying shortcut to be signed -->
<Copy SourceFiles="$(LibraryRoot)tools/Az/Az.psm1" DestinationFolder="$(PackageDirectory)/$(Configuration)" Condition="'$(Scope)' == 'Netcore'" />
<Message Text="----> Scripts signing section" Importance="high" />
<!-- Azure -->
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
<ScriptsToSign Include="$(PackageDirectory)/$(Configuration)/**/*.ps1" />
<ScriptsToSign Include="$(PackageDirectory)/$(Configuration)/**/*.psm1" />
<ScriptsToSign Include="$(PackageDirectory)/$(Configuration)/**/*.ps1xml" />
<ScriptsToSign Include="$(PackageDirectory)/$(Configuration)/**/*.js" />
</ItemGroup>
<ESRPSignTask CopyBackSignedFilesToOriginalLocation="true" UnsignedFileList="@(ScriptsToSign)" SignLogDirPath="$(LibraryRoot)scripts-signing.log" Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''" />
<!-- RemoveCodeSignArtifacts.ps1 -->
<Message Text="----> Remove artifacts section" Importance="high" />
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(PackageDirectory) -Recurse -Include 'Signed','Unsigned' | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction Ignore"" IgnoreExitCode="true" />
<!-- CheckSignature.ps1 -->
<Message Text="----> CheckSignature section" Importance="high" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)/CheckSignature.ps1 -CustomPath $(PackageDirectory)/$(Configuration)"" Condition="'$(Scope)' != 'Stack'" />
<!-- Copy files back after signing -->
<Copy SourceFiles="$(PackageDirectory)/$(Configuration)/Az.psm1" DestinationFolder="$(LibraryRoot)tools/Az" Condition="'$(Scope)' == 'Netcore'" />
</Target>
<Target Name="CodeSignInstaller" AfterTargets="BuildInstaller" Condition="'$(CodeSign)' == 'true'">
<Message Text="----> CodeSignInstaller section" Importance="high" />
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
</GetFrameworkSdkPath>
<ItemGroup>
<InstallersToSign Include="$(LibraryRoot)/setup/*.msi" />
</ItemGroup>
<Message Importance="high" Text="$(LibraryRoot)/setup does not contain any installers to sign. Code sign will skip." Condition="'@(InstallersToSign)' == ''" />
<ESRPSignTask SignedFilesRootDirPath="$(SignedOutputRootDir)" UnsignedFileList="@(InstallersToSign)" SignLogDirPath="$(LibraryRoot)/msi-signing.log" Condition="!$(DelaySign) and '@(InstallersToSign)' != ''" />
<!--If we are testing locally then we copy the binaries and do not submit to the code sign server-->
<Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" />
<SetEnvVar EnvName="SignedMsiDir" EnvValue="$(SignedOutputRootDir)" />
</Target>
</Project>