|
51 | 51 | <LocalFeedFolder>$(LibraryToolsFolder)\LocalFeed</LocalFeedFolder> |
52 | 52 | <PublishDirectory>$(LibrarySourceFolder)\Publish</PublishDirectory> |
53 | 53 | <Configuration Condition=" '$(Configuration)' != 'Release'">Debug</Configuration> |
54 | | - <CodeSign Condition=" '$(CodeSign)' == '' ">false</CodeSign> |
| 54 | + <CodeSign>false</CodeSign> |
55 | 55 | <!--Set this true only if you want to test the code sign workflow locally--> |
56 | 56 | <DelaySign Condition =" '$(DelaySign)' == '' ">false</DelaySign> |
57 | 57 | <SignedOutputRootDir>$(LibraryRoot)signed</SignedOutputRootDir> |
|
121 | 121 | <OnPremiseBuild Condition=" ! Exists($(OnPremiseBuildTasks)) ">false</OnPremiseBuild> |
122 | 122 | </PropertyGroup> |
123 | 123 |
|
124 | | - <UsingTask Condition=" $(OnPremiseBuild) " TaskName="CodeSigningTask" AssemblyFile="$(CIToolsPath)\Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" /> |
125 | 124 | <UsingTask Condition=" $(OnPremiseBuild) " TaskName="CorporateValidation" AssemblyFile="$(CIToolsPath)\Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" /> |
126 | 125 | <Import Condition=" $(OnPremiseBuild) " Project="$(CIToolsPath)\Microsoft.WindowsAzure.Build.OnPremise.msbuild" /> |
| 126 | + <Import Project="CodeSign.targets"/> |
127 | 127 |
|
128 | 128 | <UsingTask AssemblyFile="$(MSBuildProjectDirectory)\packages\xunit.runner.msbuild.2.1.0\build\portable-net45+win8+wp8+wpa81\xunit.runner.msbuild.dll" TaskName="Xunit.Runner.MSBuild.xunit" /> |
129 | 129 |
|
|
291 | 291 | <CallTarget Targets="RunPoliCheck" Condition="'$(OnPremiseBuild)'" /> |
292 | 292 |
|
293 | 293 | <CallTarget Targets="CodeSignBinaries" Condition="'$(CodeSign)' == 'true'" /> |
294 | | - |
| 294 | + |
295 | 295 | <Exec ContinueOnError="false" Command="$(PowerShellCoreCommandPrefix) ". $(LibraryToolsFolder)\NewOutputTypeIndex.ps1 -OutputFile $(PackageDirectory)\outputtypes.json -BuildConfig $(Configuration)"" Condition="('$(Scope)' == 'All' or '$(Scope)' == 'Latest') and $(CodeSign) == 'true'" /> |
296 | 296 |
|
297 | 297 | <Message Importance="high" Text="Running Static Analyser" /> |
|
310 | 310 | <MSBuild Projects="@(LocalBuildTasks)" Targets="Build" Properties="Configuration=$(Configuration);Platform=Any CPU" /> |
311 | 311 | </Target> |
312 | 312 |
|
313 | | - <Target Name="CodeSignBinaries" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask"> |
314 | | - <PropertyGroup> |
315 | | - <!--public token associated with MSSharedLibKey.snk--> |
316 | | - <StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken> |
317 | | - </PropertyGroup> |
318 | | - <GetFrameworkSdkPath> |
319 | | - <Output TaskParameter="Path" PropertyName="WindowsSdkPath" /> |
320 | | - </GetFrameworkSdkPath> |
321 | | - |
322 | | - <!-- Azure --> |
323 | | - <ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'"> |
324 | | - <DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft*Azure*PowerShell*Cmdlets*.dll" /> |
325 | | - <DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft.Azure.Management.Sql.Legacy.dll" /> |
326 | | - </ItemGroup> |
327 | | - |
328 | | - <Message Importance="high" Text="$(PackageDirectory)\$(Configuration) does not contains any files to sign. Code sign will skip." Condition="'@(DelaySignedAssembliesToSign)' == ''" /> |
329 | | - |
330 | | - <ValidateStrongNameSignatureTask |
331 | | - WindowsSdkPath="$(WindowsSdkPath)" |
332 | | - Assembly="%(DelaySignedAssembliesToSign.Identity)" |
333 | | - ExpectedTokenSignature="$(StrongNameToken)" |
334 | | - ExpectedDelaySigned="true" |
335 | | - ContinueOnError="false" |
336 | | - Condition="'@(DelaySignedAssembliesToSign)' != ''" /> |
337 | | - |
338 | | - <CodeSigningTask |
339 | | - Description="Microsoft Azure PowerShell" |
340 | | - Keywords="Microsoft Azure PowerShell" |
341 | | - UnsignedFiles="@(DelaySignedAssembliesToSign)" |
342 | | - DestinationPath="$(LibrarySourceFolder)" |
343 | | - BasePath="$(LibrarySourceFolder)" |
344 | | - Certificates="72, 400" |
345 | | - SigningLogPath="$(LibraryRoot)\signing.log" |
346 | | - ToolsPath="$(CIToolsPath)" |
347 | | - Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''" /> |
348 | | - |
349 | | - <ValidateStrongNameSignatureTask |
350 | | - WindowsSdkPath="$(WindowsSdkPath)" |
351 | | - Assembly="%(DelaySignedAssembliesToSign.Identity)" |
352 | | - ExpectedTokenSignature="$(StrongNameToken)" |
353 | | - ExpectedDelaySigned="false" |
354 | | - ContinueOnError="false" |
355 | | - Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''" /> |
356 | | - |
357 | | - <Exec Command="$(PowerShellCommandPrefix) ". $(LibraryToolsFolder)\UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope) "" /> |
358 | | - |
359 | | - <!-- Copying shortcut to be signed --> |
360 | | - <Copy SourceFiles="$(LibraryRoot)tools\Az\Az.psm1" DestinationFolder="$(PackageDirectory)\$(Configuration)" Condition="'$(Scope)' == 'Netcore'" /> |
361 | | - |
362 | | - <!-- Azure --> |
363 | | - <ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'"> |
364 | | - <ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1" /> |
365 | | - <ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.psm1" /> |
366 | | - <ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1xml" /> |
367 | | - <ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.js" /> |
368 | | - </ItemGroup> |
369 | | - |
370 | | - <CodeSigningTask |
371 | | - Description="Microsoft Azure PowerShell" |
372 | | - Keywords="Microsoft Azure PowerShell" |
373 | | - UnsignedFiles="@(ScriptsToSign)" |
374 | | - DestinationPath="$(LibrarySourceFolder)" |
375 | | - BasePath="$(LibrarySourceFolder)" |
376 | | - Certificates="400" |
377 | | - SigningLogPath="$(LibraryRoot)\signing-scripts.log" |
378 | | - ToolsPath="$(CIToolsPath)" |
379 | | - Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''" /> |
380 | | - |
381 | | - <Exec Command="$(PowerShellCommandPrefix) ". $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(PackageDirectory)\$(Configuration) "" Condition="'$(Scope)' != 'Stack'" ContinueOnError="ErrorAndContinue" /> |
382 | | - |
383 | | - <!-- Copy files back after signing --> |
384 | | - <Copy SourceFiles="$(PackageDirectory)\$(Configuration)\Az.psm1" DestinationFolder="$(LibraryRoot)tools\Az" Condition="'$(Scope)' == 'Netcore'" /> |
385 | | - </Target> |
386 | | - |
387 | 313 | <Target Name="BuildInstaller" Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'"> |
388 | 314 | <Exec Command="$(PowerShellCommandPrefix) ". Register-PSRepository -Name MSIcreationrepository -SourceLocation $(PackageDirectory) -InstallationPolicy Trusted " " /> |
389 | 315 | <Exec Command="$(PowerShellCommandPrefix) ". $(LibraryRoot)\setup\generate.ps1 -repository MSIcreationrepository " " /> |
390 | 316 | <Exec Command="$(PowerShellCommandPrefix) ". Unregister-PSRepository -Name MSIcreationrepository " " /> |
391 | 317 | <CallTarget Targets="CodeSignInstaller" Condition=" '$(CodeSign)' == 'true'" /> |
392 | 318 | </Target> |
393 | 319 |
|
394 | | - <Target Name="CodeSignInstaller"> |
395 | | - <PropertyGroup> |
396 | | - <!--public token associated with MSSharedLibKey.snk--> |
397 | | - <StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken> |
398 | | - </PropertyGroup> |
399 | | - <GetFrameworkSdkPath> |
400 | | - <Output TaskParameter="Path" PropertyName="WindowsSdkPath" /> |
401 | | - </GetFrameworkSdkPath> |
402 | | - |
403 | | - <ItemGroup> |
404 | | - <InstallersToSign Include="$(LibraryRoot)\setup\*.msi" /> |
405 | | - </ItemGroup> |
406 | | - |
407 | | - <Message Importance="high" Text="$(LibraryRoot)\setup does not contain any installers to sign. Code sign will skip." |
408 | | - Condition="'@(InstallersToSign)' == ''" /> |
409 | | - |
410 | | - <CodeSigningTask |
411 | | - Description="Microsoft Azure PowerShell" |
412 | | - Keywords="Microsoft Azure PowerShell" |
413 | | - UnsignedFiles="@(InstallersToSign)" |
414 | | - DestinationPath="$(SignedOutputRootDir)" |
415 | | - SigningLogPath="$(LibraryRoot)\msi-signing.log" |
416 | | - Certificates="402" |
417 | | - ToolsPath="$(CIToolsPath)" |
418 | | - Condition="!$(DelaySign) and '@(InstallersToSign)' != ''" /> |
419 | | - |
420 | | - <!--If we are testing locally then we copy the binaries and do not submit to the code sign server--> |
421 | | - <Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" /> |
422 | | - <SetEnvVar EnvName="SignedMsiDir" EnvValue="$(SignedOutputRootDir)" /> |
423 | | - </Target> |
424 | | - |
425 | 320 | <!-- Run Validation --> |
426 | 321 | <Target Name="DependencyAnalysis" Condition="'$(SkipDependencyAnalysis)' == 'false'"> |
427 | 322 | <Message Importance="high" Text="Running dependency analysis..." /> |
|
0 commit comments