forked from Azure/azure-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
344 lines (275 loc) · 21.4 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
<?xml version="1.0" encoding="utf-8"?>
<!--
# Targets
/t:Clean
Removes temporary build outputs.
/t:Build
Builds assemblies.
/t:Test
Runs tests
/t:Publish
Creates local nuget packages and MSI
/t:CopyAboutTopics
Copys about topics to culture folders
# Properties
/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.
/p:ModifiedModuleBuild=True
Only build changed module according to the changelog in root folder or according to another property "TargetModule"
/p:TargetModule
Just focus on modules and its dependency such as Az.Account. Module name doesn't need to lead with Az. Split by ":"
-->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)Repo.props" />
<PropertyGroup>
<!-- General -->
<Configuration Condition="'$(Configuration)' != 'Release'">Debug</Configuration>
<Scope Condition="$(Scope) == ''">All</Scope>
<TestFramework Condition="'$(TestFramework)' == ''">netcoreapp2.2</TestFramework>
<IsGenerateBased Condition="'$(IsGenerateBased)' != 'true'">false</IsGenerateBased>
<IsSecurityCheck Condition="'$(IsSecurityCheck)' != 'true'">false</IsSecurityCheck>
<ModifiedModuleBuild Condition="'$(ModifiedModuleBuild)' != 'true'">false</ModifiedModuleBuild>
<!-- Flags -->
<CodeSign Condition ="'$(CodeSign)' == ''">false</CodeSign>
<SkipHelp Condition ="'$(SkipHelp)' != 'true'">false</SkipHelp>
<TargetBuild Condition="'$(TargetModule)' != ''">true</TargetBuild>
<TargetBuild Condition="'$(TargetModule)' == ''">false</TargetBuild>
<!-- Set this true only if you want to test the CodeSign workflow locally -->
<DelaySign Condition ="'$(DelaySign)' == ''">false</DelaySign>
<NetCore Condition="'$(NetCore)' != 'false'">true</NetCore>
<RunStaticAnalysis Condition="'$(RunStaticAnalysis)' != 'false'">true</RunStaticAnalysis>
<!-- Folders -->
<SignedOutputRootDir>$(RepoRoot)signed</SignedOutputRootDir>
<TestOutputDirectory>$(RepoArtifacts)TestResults</TestOutputDirectory>
<StaticAnalysisOutputDirectory>$(RepoArtifacts)StaticAnalysisResults</StaticAnalysisOutputDirectory>
<NuGetPublishingSource Condition="'$(NuGetPublishingSource)' == ''">$(RepoSrc)</NuGetPublishingSource>
<!-- Misc -->
<NuGetCommand>$(MSBuildProjectDirectory)/tools/NuGet.exe</NuGetCommand>
<Scope Condition="$(NetCore) == 'true'">Netcore</Scope>
<!-- PS command related -->
<PowerShellCoreCommandPrefix>pwsh -NonInteractive -NoLogo -NoProfile -Command</PowerShellCoreCommandPrefix>
<!-- Testing related -->
<TestsToRun Condition="$(TestsToRun) == ''" >All</TestsToRun>
<CoreTests Condition="'$(TestsToRun)' != 'All'">$(RepoRoot)src/Compute/Compute.Test/Compute.Test.csproj;$(RepoRoot)src/Network/Network.Test/Network.Test.csproj;$(RepoRoot)src/Resources/Resources.Test/Resources.Test.csproj;$(RepoRoot)src/Sql/Sql.Test/Sql.Test.csproj;$(RepoRoot)src/Websites/Websites.Test/Websites.Test.csproj;</CoreTests>
<CoreTests Condition="'$(CoreTests)' == ''">null</CoreTests>
<!-- 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>
<!-- Docker related -->
<DockerRoot>$(RepoRoot)docker</DockerRoot>
<DockerTools>$(RepoTools)Docker</DockerTools>
<DockerImageName Condition="'$(DockerImageName)' == ''">azure-powershell</DockerImageName>
<!-- XML documentation related -->
<GenerateDocumentationFile Condition="'$(GenerateDocumentationFile)' != 'false'">true</GenerateDocumentationFile>
<!-- Test coverage flag -->
<TurnOnTestCoverage Condition="'$(TurnOnTestCoverage)' != 'true'">false</TurnOnTestCoverage>
</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" />
<UsingTask TaskName="FilesChangedTask" AssemblyFile="$(RepoArtifacts)Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.dll" />
<UsingTask TaskName="CIFilterTask" AssemblyFile="$(RepoArtifacts)Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.dll" />
<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 $(RepoArtifacts) -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="BuildTools">
<Exec Command="dotnet publish $(RepoTools)StaticAnalysis/StaticAnalysis.Netcore.csproj -c $(Configuration)" />
</Target>
<Target Name="FilterBuild" Condition="$(PullRequestNumber) != ''" DependsOnTargets="BuildTools">
<Message Importance="high" Text="Filtering projects and modules..." />
<Message Text="$(IsGenerateBased)" />
<!-- Build the Microsoft.Azure.Build.Tasks project -->
<Exec Command="dotnet publish $(RepoTools)BuildPackagesTask/Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.csproj -c $(Configuration)" />
<!-- Get all of the files changed in the given pull request -->
<FilesChangedTask RepositoryOwner="Azure" RepositoryName="azure-powershell" PullRequestNumber="$(PullRequestNumber)" OutputFile="$(RepoArtifacts)FilesChanged.txt">
<Output TaskParameter="FilesChanged" ItemName="FilesChanged" />
</FilesChangedTask>
<Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)PrepareAutorestModule.ps1"" Condition="'$(IsGenerateBased)' == 'true'"/>
<Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)CreateFilterMappings.ps1"" />
<Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)PrepareForSecurityCheck.ps1"" Condition="'$(IsSecurityCheck)' == 'true'"/>
<CIFilterTask FilesChanged="@(FilesChanged)" Mode="$(Configuration)" CsprojMapFilePath="./CsprojMappings.json">
<Output TaskParameter="BuildCsprojList" ItemName="BuildCsprojList" />
<Output TaskParameter="TestCsprojList" ItemName="TestCsprojList" />
<Output TaskParameter="SubTasks" PropertyName="SubTasks" />
</CIFilterTask>
</Target>
<!-- Build all flavors of the Cmdlets -->
<Target Name="Build" DependsOnTargets="FilterBuild">
<Message Importance="high" Text="Building Cmdlets..." />
<MakeDir Directories="$(RepoArtifacts)" />
<!-- Copy appropriate targets -->
<Copy SourceFiles="$(RepoTools)after.Azure.PowerShell.sln.targets" DestinationFolder="$(RepoArtifacts)" />
<!-- Build and create package content -->
<CallTarget Targets="BuildNormalModules" />
<CallTarget Targets="AzToolsPredictor" Condition="$(SubTasks.Contains('Predictor')) OR $(SubTasks.Contains('all'))" />
<CallTarget Targets="AzToolsInstaller" Condition="$(SubTasks.Contains('Installer')) OR $(SubTasks.Contains('all'))" />
</Target>
<Target Name="BuildNormalModules">
<Exec Condition="$(PullRequestNumber) == '' AND $(TargetModule) == '' AND $(ModifiedModuleBuild) == 'false'"
Command="$(PowerShellCoreCommandPrefix) "./tools/BuildScripts/BuildModules.ps1 -RepoRoot $(RepoRoot) -Configuration $(Configuration) -TestsToRun $(TestsToRun) -CoreTests $(CoreTests) -RepoArtifacts $(RepoArtifacts) ""
/>
<Exec Condition="$(PullRequestNumber) != ''"
Command="$(PowerShellCoreCommandPrefix) "./tools/BuildScripts/BuildModules.ps1 -RepoRoot $(RepoRoot) -Configuration $(Configuration) -TestsToRun $(TestsToRun) -CoreTests $(CoreTests) -RepoArtifacts $(RepoArtifacts) -BuildCsprojList '@(BuildCsprojList)' -TestCsprojList '@(TestCsprojList)'""
/>
<Exec Condition="$(ModifiedModuleBuild) != 'false'"
Command="$(PowerShellCoreCommandPrefix) "./tools/BuildScripts/BuildModules.ps1 -RepoRoot $(RepoRoot) -Configuration $(Configuration) -TestsToRun $(TestsToRun) -CoreTests $(CoreTests) -RepoArtifacts $(RepoArtifacts) -ModifiedModuleBuild $(ModifiedModuleBuild) ""
/>
<Exec Condition="$(TargetModule) != ''"
Command="$(PowerShellCoreCommandPrefix) "./tools/BuildScripts/BuildModules.ps1 -RepoRoot $(RepoRoot) -Configuration $(Configuration) -TestsToRun $(TestsToRun) -CoreTests $(CoreTests) -RepoArtifacts $(RepoArtifacts) -TargetModule $(TargetModule)""
/>
<PropertyGroup>
<BuildAction Condition="'$(Configuration)' != 'Release'">build</BuildAction>
<BuildAction Condition="'$(Configuration)' == 'Release'">publish</BuildAction>
</PropertyGroup>
<Exec Command="$(PowerShellCoreCommandPrefix) "./tools/ExecuteCIStep.ps1 -Build -RepoArtifacts $(RepoArtifacts) -Configuration $(Configuration) -GenerateDocumentationFile $(GenerateDocumentationFile) -EnableTestCoverage $(TurnOnTestCoverage) -BuildAction $(BuildAction)"" Condition="$(PullRequestNumber) == ''"/>
<Exec Command="$(PowerShellCoreCommandPrefix) "./tools/ExecuteCIStep.ps1 -Build -PullRequestNumber $(PullRequestNumber) -RepoArtifacts $(RepoArtifacts) -Configuration $(Configuration) -GenerateDocumentationFile $(GenerateDocumentationFile) -EnableTestCoverage $(TurnOnTestCoverage) -BuildAction $(BuildAction)"" Condition="$(PullRequestNumber) != ''"/>
<!-- Build version controller -->
<Exec Command="dotnet build $(RepoTools)VersionController/VersionController.Netcore.csproj -c $(Configuration)" />
<!-- Delete powershell runtime files & .deps.json files -->
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)BuildScripts/RemoveUnwantedFiles.ps1 -RootPath $(RepoArtifacts)$(Configuration) -CodeSign $(CodeSign)""/>
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)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>
<!-- Copy about topics to culture folders -->
<Target Name="CopyAboutTopics" Condition="'$(SkipHelp)' == 'false'">
<Message Importance="high" Text="Copying about topics to culture folders..." />
<Exec Command="$(PowerShellCoreCommandPrefix) "Set-Variable -Name ProgressPreference -Value 'SilentlyContinue';. $(RepoTools)Docs/CopyAboutTopics.ps1 -BuildConfig $(Configuration)"" />
</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';. $(RepoTools)GenerateHelp.ps1 -ValidateMarkdownHelp -GenerateMamlHelp -BuildConfig $(Configuration)"" />
</Target>
<!-- Everything except Publish -->
<Target Name="Full" DependsOnTargets="Clean;Build;OnPremChecks;CopyAboutTopics;GenerateHelp;StaticAnalysis;Test" />
<Target Name="StaticAnalysisExample" Condition="'$(RunStaticAnalysis)' == 'true'" AfterTargets="StaticAnalysisHelp">
<Message Importance="high" Text="Running static analysis for PowerShell examples..." />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)StaticAnalysis/ExampleAnalyzer/Measure-MarkdownOrScript.ps1 -MarkdownPaths $(RepoArtifacts)FilesChanged.txt -RulePaths $(RepoTools)StaticAnalysis/ExampleAnalyzer/AnalyzeRules/*.psm1 -NotCleanScripts ""/>
</Target>
<Target Name="StaticAnalysisFileChange" Condition="'$(RunStaticAnalysis)' == 'true'">
<Message Importance="high" Text="Running static analysis for file changes..." />
<Exec Command="$(PowerShellCoreCommandPrefix) "./tools/StaticAnalysis/FileChangeAnalyzer/Test-FileChange.ps1 "" />
</Target>
<Target Name="StaticAnalysis" DependsOnTargets="StaticAnalysisExample;StaticAnalysisFileChange">
<Message Importance="high" Text="Running static analysis..." />
<Exec Command="$(PowerShellCoreCommandPrefix) "./tools/ExecuteCIStep.ps1 -StaticAnalysis -RepoArtifacts $(RepoArtifacts) -Configuration $(Configuration) -StaticAnalysisOutputDirectory $(StaticAnalysisOutputDirectory)"" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)StaticAnalysis/CollectStaticAnalysisPipelineResult.ps1 -StaticAnalysisOutputDirectory $(StaticAnalysisOutputDirectory) ""/>
<Exec Command="dotnet $(RepoArtifacts)StaticAnalysis/StaticAnalysis.Netcore.dll -p $(RepoArtifacts)$(Configuration) -r $(StaticAnalysisOutputDirectory) --analyzers check-error" />
<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="AzToolsInstaller">
<Exec Command='dotnet msbuild $(RepoTools)Az.Tools.Installer/build.proj /t:"clean;build;test"' />
</Target>
<Target Name="AzToolsPredictor">
<Exec Command='dotnet msbuild $(RepoTools)Az.Tools.Predictor/build.proj /t:"clean;build;test"' />
</Target>
<Target Name="Publish" Condition="'$(Configuration)' == 'Release'">
<Message Importance="high" Text="Publishing Cmdlets using $(Scope) scope" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)CleanupBuild.ps1 -BuildConfig $(Configuration) -GenerateDocumentationFile $(GenerateDocumentationFile) "" />
<Error Condition="'$(NuGetKey)' == ''" Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)PublishModules.ps1 -TargetBuild $(TargetBuild) -IsNetCore:$$(NetCore) -BuildConfig $(Configuration) -Scope $(Scope) -ApiKey $(NuGetKey) -RepositoryLocation "$(NuGetPublishingSource)"" -NugetExe $(NuGetCommand)" />
</Target>
<Target Name="BuildImages">
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(DockerTools)/GetArtifacts.ps1 -Artifacts $(RepoArtifacts) -Docker $(DockerRoot) "" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(DockerTools)/BuildImages.ps1 -DOCKER $(DockerRoot) -DockerImageName $(DockerImageName) "" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(DockerTools)/CleanArtifacts.ps1 -Docker $(DockerRoot) "" />
</Target>
<Target Name="Test" Condition="'$(IsGenerateBased)' == 'false'">
<Message Importance="high" Text="Running check in tests..." />
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
<!-- https://github.com/Microsoft/msbuild/issues/3157#issuecomment-378002971 -->
<!-- https://github.com/xunit/xunit/issues/1154#issuecomment-405366373 -->
<Exec Command="$(PowerShellCoreCommandPrefix) "./tools/ExecuteCIStep.ps1 -Test -RepoArtifacts $(RepoArtifacts) -Configuration $(Configuration) -TestFramework $(TestFramework) -TestOutputDirectory $(TestOutputDirectory)"" />
<Message Importance="high" Text="Finish running tests..." />
<OnError ExecuteTargets="TestFailureErrorMessage" />
</Target>
<Target Name="TestFailureErrorMessage">
<Error Text="Test failures occurred, check the files in artifacts/TestResults" />
</Target>
<Target Name="CodeSignBinaries" AfterTargets="Build" Condition="'$(CodeSign)' == 'true'">
<Message Text="====> Executing CodeSignBinaries Target..." Importance="high" />
<Message Text="variables.Dlls signing section" Importance="high" />
<!-- Azure -->
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
<DelaySignedAssembliesToSign Include="
$(RepoArtifacts)$(Configuration)/**/Microsoft*Azure*PowerShell*Cmdlets*.dll;
$(RepoArtifacts)$(Configuration)/**/Microsoft.Azure.PowerShell.Authentication.dll;
$(RepoArtifacts)$(Configuration)/**/Microsoft.Azure.PowerShell.Authentication.ResourceManager.dll;
$(RepoArtifacts)$(Configuration)/**/Microsoft.Azure.PowerShell.Authenticators.dll" Exclude="$(RepoArtifacts)$(Configuration)/**/Microsoft*Azure*PowerShell*Cmdlets*.Test.dll" />
</ItemGroup>
<Message Importance="high" Text="$(RepoArtifacts)$(Configuration) does not contains any files to sign. Code sign will skip." Condition="'@(DelaySignedAssembliesToSign)' == ''" />
<ESRPSignTask CopyBackSignedFilesToOriginalLocation="true" UnsignedFileList="@(DelaySignedAssembliesToSign)" SignLogDirPath="$(RepoRoot)dlls-signing.log" Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''" />
<!-- Copying shortcut to be signed -->
<Copy SourceFiles="$(RepoRoot)tools/Az/Az.psm1" DestinationFolder="$(RepoArtifacts)$(Configuration)" Condition="'$(Scope)' == 'Netcore'" />
<Message Text="variables.Scripts signing section" Importance="high" />
<!-- Azure -->
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
<ScriptsToSign Include="$(RepoArtifacts)$(Configuration)/**/*.ps1" />
<ScriptsToSign Include="$(RepoArtifacts)$(Configuration)/**/*.psm1" />
<ScriptsToSign Include="$(RepoArtifacts)$(Configuration)/**/*.ps1xml" />
<ScriptsToSign Include="$(RepoArtifacts)$(Configuration)/**/*.js" />
</ItemGroup>
<ESRPSignTask CopyBackSignedFilesToOriginalLocation="true" UnsignedFileList="@(ScriptsToSign)" SignLogDirPath="$(RepoRoot)scripts-signing.log" Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''" />
<!-- RemoveCodeSignArtifacts.ps1 -->
<Message Text="variables.Remove artifacts section" Importance="high" />
<Exec Command="$(PowerShellCoreCommandPrefix) "Get-ChildItem -Path $(RepoArtifacts) -Recurse -Include 'Signed','Unsigned' | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction Ignore"" IgnoreExitCode="true" />
<!-- CheckSignature.ps1 -->
<Message Text="variables.CheckSignature section" Importance="high" />
<Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)CheckSignature.ps1 -CustomPath $(RepoArtifacts)$(Configuration)"" Condition="'$(Scope)' != 'Stack'" />
<!-- Copy files back after signing -->
<Copy SourceFiles="$(RepoArtifacts)$(Configuration)/Az.psm1" DestinationFolder="$(RepoRoot)tools/Az" Condition="'$(Scope)' == 'Netcore'" />
</Target>
<Target Name="CodeSignInstaller" AfterTargets="BuildInstaller" Condition="'$(CodeSign)' == 'true'">
<Message Text="variables.CodeSignInstaller section" Importance="high" />
<GetFrameworkSdkPath>
<Output TaskParameter="Path" PropertyName="WindowsSdkPath" />
</GetFrameworkSdkPath>
<ItemGroup>
<InstallersToSign Include="$(RepoRoot)/setup/*.msi" />
</ItemGroup>
<Message Importance="high" Text="$(RepoRoot)/setup does not contain any installers to sign. Code sign will skip." Condition="'@(InstallersToSign)' == ''" />
<ESRPSignTask SignedFilesRootDirPath="$(SignedOutputRootDir)" UnsignedFileList="@(InstallersToSign)" SignLogDirPath="$(RepoRoot)/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>