Skip to content

Commit f419116

Browse files
PR comments fix
1 parent f6d6449 commit f419116

File tree

1 file changed

+91
-93
lines changed

1 file changed

+91
-93
lines changed

CodeSign.targets

Lines changed: 91 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,97 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33

4-
<UsingTask TaskName="ESRPSignTask" AssemblyFile="$(CISignRepoPath)\tools\sdkbuildtools\tasks\MS.Az.Sdk.OnPremise.Build.Tasks.dll" />
4+
<UsingTask TaskName="ESRPSignTask" AssemblyFile="$(CISignRepoPath)\tools\sdkbuildtools\tasks\MS.Az.Sdk.OnPremise.Build.Tasks.dll" />
55

6-
<PropertyGroup>
7-
<!-- CISignRepo is an environment variable that points to ci-signing repo clone -->
8-
<CISignRepoPath>$(CISignRepo)</CISignRepoPath>
9-
</PropertyGroup>
6+
<PropertyGroup>
7+
<!-- CISignRepo is an environment variable that points to ci-signing repo clone -->
8+
<CISignRepoPath>$(CISignRepo)</CISignRepoPath>
9+
</PropertyGroup>
1010

11-
<Target Name="CodeSignBinaries" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask">
12-
13-
<Message Text="====> Executing CodeSignBinaries Target..." Importance="high"/>
14-
15-
<PropertyGroup>
16-
<!--public token associated with MSSharedLibKey.snk-->
17-
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
18-
</PropertyGroup>
19-
20-
<Message Text="----> Dlls signing section" Importance="high"/>
21-
22-
<!-- Azure -->
23-
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
24-
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft*Azure*PowerShell*Cmdlets*.dll" />
25-
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft.Azure.Management.Sql.Legacy.dll" />
26-
</ItemGroup>
27-
28-
<Message Importance="high" Text="$(PackageDirectory)\$(Configuration) does not contains any files to sign. Code sign will skip."
29-
Condition="'@(DelaySignedAssembliesToSign)' == ''" />
30-
31-
<ESRPSignTask
32-
CopyBackSignedFilesToOriginalLocation="true"
33-
UnsignedFileList="@(DelaySignedAssembliesToSign)"
34-
SignLogDirPath="$(LibraryRoot)dlls-signing.log"
35-
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>
36-
37-
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope) &quot;" />
38-
39-
<!-- Copying shortcut to be signed -->
40-
<Copy SourceFiles="$(LibraryRoot)tools\Az\Az.psm1" DestinationFolder="$(PackageDirectory)\$(Configuration)" Condition="'$(Scope)' == 'Netcore'" />
41-
42-
<Message Text="----> Scripts signing section" Importance="high"/>
43-
44-
<!-- Azure -->
45-
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
46-
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1" />
47-
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.psm1" />
48-
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1xml" />
49-
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.js" />
50-
</ItemGroup>
51-
52-
<ESRPSignTask
53-
CopyBackSignedFilesToOriginalLocation="true"
54-
UnsignedFileList="@(ScriptsToSign)"
55-
SignLogDirPath="$(LibraryRoot)scripts-signing.log"
56-
Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''"/>
57-
58-
<!-- RemoveCodeSignArtifacts.ps1 -->
59-
<Message Text="----> Remove artifacts section" Importance="high"/>
60-
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\RemoveCodeSignArtifacts.ps1 -Path $(PackageDirectory)\$(Configuration) &quot;"
61-
Condition="'$(Scope)' != 'Stack'"
62-
ContinueOnError="ErrorAndContinue" />
63-
64-
<!-- CheckSignature.ps1 -->
65-
<Message Text="----> CheckSignature section" Importance="high"/>
66-
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(PackageDirectory)\$(Configuration) &quot;" Condition="'$(Scope)' != 'Stack'" ContinueOnError="ErrorAndContinue" />
67-
68-
<!-- Copy files back after signing -->
69-
<Copy SourceFiles="$(PackageDirectory)\$(Configuration)\Az.psm1" DestinationFolder="$(LibraryRoot)tools\Az" Condition="'$(Scope)' == 'Netcore'" />
70-
</Target>
71-
72-
<Target Name="CodeSignInstaller">
73-
<Message Text="----> CodeSignInstaller section" Importance="high"/>
74-
<PropertyGroup>
75-
<!--public token associated with MSSharedLibKey.snk-->
76-
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
77-
</PropertyGroup>
78-
<GetFrameworkSdkPath>
79-
<Output TaskParameter="Path" PropertyName="WindowsSdkPath"/>
80-
</GetFrameworkSdkPath>
81-
82-
<ItemGroup>
83-
<InstallersToSign Include="$(LibraryRoot)\setup\*.msi" />
84-
</ItemGroup>
85-
86-
<Message Importance="high" Text="$(LibraryRoot)\setup does not contain any installers to sign. Code sign will skip."
87-
Condition="'@(InstallersToSign)' == ''" />
88-
89-
<ESRPSignTask
90-
SignedFilesRootDirPath="$(SignedOutputRootDir)"
91-
UnsignedFileList="@(InstallersToSign)"
92-
SignLogDirPath="$(LibraryRoot)\msi-signing.log"
93-
Condition="!$(DelaySign) and '@(InstallersToSign)' != ''"/>
94-
95-
<!--If we are testing locally then we copy the binaries and do not submit to the code sign server-->
96-
<Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" />
97-
<SetEnvVar EnvName="SignedMsiDir" EnvValue="$(SignedOutputRootDir)" />
98-
</Target>
11+
<Target Name="CodeSignBinaries" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask">
12+
13+
<Message Text="====> Executing CodeSignBinaries Target..." Importance="high"/>
14+
15+
<PropertyGroup>
16+
<!--public token associated with MSSharedLibKey.snk-->
17+
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
18+
</PropertyGroup>
19+
20+
<Message Text="----> Dlls signing section" Importance="high"/>
21+
22+
<!-- Azure -->
23+
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
24+
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft*Azure*PowerShell*Cmdlets*.dll" />
25+
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft.Azure.Management.Sql.Legacy.dll" />
26+
</ItemGroup>
27+
28+
<Message Importance="high" Text="$(PackageDirectory)\$(Configuration) does not contains any files to sign. Code sign will skip."
29+
Condition="'@(DelaySignedAssembliesToSign)' == ''" />
30+
31+
<ESRPSignTask
32+
CopyBackSignedFilesToOriginalLocation="true"
33+
UnsignedFileList="@(DelaySignedAssembliesToSign)"
34+
SignLogDirPath="$(LibraryRoot)dlls-signing.log"
35+
Condition="!$(DelaySign) and '@(DelaySignedAssembliesToSign)' != ''"/>
36+
37+
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope) &quot;" />
38+
39+
<!-- Copying shortcut to be signed -->
40+
<Copy SourceFiles="$(LibraryRoot)tools\Az\Az.psm1" DestinationFolder="$(PackageDirectory)\$(Configuration)" Condition="'$(Scope)' == 'Netcore'" />
41+
42+
<Message Text="----> Scripts signing section" Importance="high"/>
43+
44+
<!-- Azure -->
45+
<ItemGroup Condition="'$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore'">
46+
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1" />
47+
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.psm1" />
48+
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.ps1xml" />
49+
<ScriptsToSign Include="$(PackageDirectory)\$(Configuration)\**\*.js" />
50+
</ItemGroup>
51+
52+
<ESRPSignTask
53+
CopyBackSignedFilesToOriginalLocation="true"
54+
UnsignedFileList="@(ScriptsToSign)"
55+
SignLogDirPath="$(LibraryRoot)scripts-signing.log"
56+
Condition="!$(DelaySign) and '@(ScriptsToSign)' != ''"/>
57+
58+
<!-- RemoveCodeSignArtifacts.ps1 -->
59+
<Message Text="----> Remove artifacts section" Importance="high"/>
60+
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;Remove-Item -Path $(PackageDirectory)\$(Configuration)\Signed,$(PackageDirectory)\$(Configuration)\Unsigned -Recurse -Force -Confirm:$false -ErrorAction Ignore&quot;" ContinueOnError="WarnAndContinue" IgnoreExitCode="true" />
61+
62+
<!-- CheckSignature.ps1 -->
63+
<Message Text="----> CheckSignature section" Importance="high"/>
64+
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(PackageDirectory)\$(Configuration) &quot;" Condition="'$(Scope)' != 'Stack'" ContinueOnError="ErrorAndContinue" />
65+
66+
<!-- Copy files back after signing -->
67+
<Copy SourceFiles="$(PackageDirectory)\$(Configuration)\Az.psm1" DestinationFolder="$(LibraryRoot)tools\Az" Condition="'$(Scope)' == 'Netcore'" />
68+
</Target>
69+
70+
<Target Name="CodeSignInstaller">
71+
<Message Text="----> CodeSignInstaller section" Importance="high"/>
72+
<PropertyGroup>
73+
<!--public token associated with MSSharedLibKey.snk-->
74+
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
75+
</PropertyGroup>
76+
<GetFrameworkSdkPath>
77+
<Output TaskParameter="Path" PropertyName="WindowsSdkPath"/>
78+
</GetFrameworkSdkPath>
79+
80+
<ItemGroup>
81+
<InstallersToSign Include="$(LibraryRoot)\setup\*.msi" />
82+
</ItemGroup>
83+
84+
<Message Importance="high" Text="$(LibraryRoot)\setup does not contain any installers to sign. Code sign will skip."
85+
Condition="'@(InstallersToSign)' == ''" />
86+
87+
<ESRPSignTask
88+
SignedFilesRootDirPath="$(SignedOutputRootDir)"
89+
UnsignedFileList="@(InstallersToSign)"
90+
SignLogDirPath="$(LibraryRoot)\msi-signing.log"
91+
Condition="!$(DelaySign) and '@(InstallersToSign)' != ''"/>
92+
93+
<!--If we are testing locally then we copy the binaries and do not submit to the code sign server-->
94+
<Copy SourceFiles="@(InstallersToSign)" DestinationFolder="signed" Condition="$(DelaySign)" />
95+
<SetEnvVar EnvName="SignedMsiDir" EnvValue="$(SignedOutputRootDir)" />
96+
</Target>
9997
</Project>

0 commit comments

Comments
 (0)