Skip to content

Commit

Permalink
Made indentation (somewhat) consistent in build.proj and CodeSign.tar…
Browse files Browse the repository at this point in the history
…gets. Normalized asset loading for test projects.
  • Loading branch information
MiYanni committed Dec 26, 2018
1 parent 36b2194 commit 9f8b1fb
Show file tree
Hide file tree
Showing 72 changed files with 136 additions and 772 deletions.
179 changes: 87 additions & 92 deletions CodeSign.targets
Original file line number Diff line number Diff line change
@@ -1,99 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

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

<PropertyGroup>
<!-- CISignRepo is an environment variable that points to ci-signing repo clone -->
<CISignRepoPath>$(CISignRepo)</CISignRepoPath>
</PropertyGroup>

<Target Name="CodeSignBinaries" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask">
<Message Text="====> Executing CodeSignBinaries Target..." Importance="high"/>

<PropertyGroup>
<!-- CISignRepo is an environment variable that points to ci-signing repo clone -->
<CISignRepoPath>$(CISignRepo)</CISignRepoPath>
<!--public token associated with MSSharedLibKey.snk-->
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
</PropertyGroup>

<Target Name="CodeSignBinaries" DependsOnTargets="RestoreNugetPackages;BuildMsBuildTask">

<Message Text="====> Executing CodeSignBinaries Target..." Importance="high"/>

<PropertyGroup>
<!--public token associated with MSSharedLibKey.snk-->
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
</PropertyGroup>

<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" />
<DelaySignedAssembliesToSign Include="$(PackageDirectory)\$(Configuration)\**\Microsoft.Azure.Management.Sql.Legacy.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)' != ''"/>

<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope) &quot;" />

<!-- 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) &quot;Get-ChildItem -Path $(PackageDirectory) -Recurse -Include 'Signed','Unsigned' | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction Ignore&quot;"
ContinueOnError="WarnAndContinue"
IgnoreExitCode="true" />

<!-- CheckSignature.ps1 -->
<Message Text="----> CheckSignature section" Importance="high"/>
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(PackageDirectory)\$(Configuration) &quot;" Condition="'$(Scope)' != 'Stack'" ContinueOnError="ErrorAndContinue" />

<!-- Copy files back after signing -->
<Copy SourceFiles="$(PackageDirectory)\$(Configuration)\Az.psm1" DestinationFolder="$(LibraryRoot)tools\Az" Condition="'$(Scope)' == 'Netcore'" />
</Target>

<Target Name="CodeSignInstaller">
<Message Text="----> CodeSignInstaller section" Importance="high"/>
<PropertyGroup>
<!--public token associated with MSSharedLibKey.snk-->
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
</PropertyGroup>
<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>

<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" />
</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)' != ''"/>

<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\UpdateModules.ps1 -BuildConfig $(Configuration) -Scope $(Scope) &quot;" />

<!-- 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) &quot;Get-ChildItem -Path $(PackageDirectory) -Recurse -Include 'Signed','Unsigned' | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction Ignore&quot;"
ContinueOnError="WarnAndContinue"
IgnoreExitCode="true" />

<!-- CheckSignature.ps1 -->
<Message Text="----> CheckSignature section" Importance="high"/>
<Exec Command="$(PowerShellCommandPrefix) &quot;. $(LibraryToolsFolder)\CheckSignature.ps1 -CustomPath $(PackageDirectory)\$(Configuration) &quot;" Condition="'$(Scope)' != 'Stack'" ContinueOnError="ErrorAndContinue" />

<!-- Copy files back after signing -->
<Copy SourceFiles="$(PackageDirectory)\$(Configuration)\Az.psm1" DestinationFolder="$(LibraryRoot)tools\Az" Condition="'$(Scope)' == 'Netcore'" />
</Target>

<Target Name="CodeSignInstaller">
<Message Text="----> CodeSignInstaller section" Importance="high"/>
<PropertyGroup>
<!--public token associated with MSSharedLibKey.snk-->
<StrongNameToken Condition=" '$(StrongNameToken)' == '' ">31bf3856ad364e35</StrongNameToken>
</PropertyGroup>
<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>
24 changes: 12 additions & 12 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@
<UsingTask TaskName="FilesChangedTask" AssemblyFile="$(BuildTasksPath)\Microsoft.Azure.Build.Tasks.dll" />
<UsingTask TaskName="FilterTask" AssemblyFile="$(BuildTasksPath)\Microsoft.Azure.Build.Tasks.dll" />
<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>
<EnvName ParameterType="System.String" Required="true" />
<EnvValue ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[System.Environment.SetEnvironmentVariable(EnvName, EnvValue);]]>
<![CDATA[System.Environment.SetEnvironmentVariable(EnvName, EnvValue);]]>
</Code>
</Task>
</UsingTask>
Expand Down Expand Up @@ -170,7 +170,7 @@

<!-- Get all of the files changed in the given pull request -->
<FilesChangedTask RepositoryOwner="Azure" RepositoryName="azure-powershell" PullRequestNumber="$(PullRequestNumber)">
<Output TaskParameter="FilesChanged" ItemName="FilesChanged" />
<Output TaskParameter="FilesChanged" ItemName="FilesChanged" />
</FilesChangedTask>

<!-- Get the list of modules changed -->
Expand All @@ -184,7 +184,7 @@

<!-- Get the list of solutions to build -->
<FilterTask FilesChanged="@(FilesChanged)" MapFilePath=".\SolutionMappings.json">
<Output TaskParameter="Output" ItemName="CmdletSolutionsToBuild" />
<Output TaskParameter="Output" ItemName="CmdletSolutionsToBuild" />
</FilterTask>
<Message Text="Filtering solutions to build by the following:" />
<Message Text="%(CmdletSolutionsToBuild.Identity)" />
Expand All @@ -193,7 +193,7 @@

<!--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" />
<Output TaskParameter="Output" ItemName="XUnitTests" />
</FilterTask>
<Message Text="Using these test assemblies:" />
<Message Text="%(XUnitTests.Identity)" />
Expand Down Expand Up @@ -285,13 +285,13 @@
<Exec ContinueOnError="false"
Command="$(PowerShellCoreCommandPrefix) &quot; . $(LibraryToolsFolder)\NewHelpIndex.ps1 -OutputFile $(PackageDirectory)\index.json -BuildConfig $(Configuration) &quot;"
Condition="'$(CodeSign)' == 'true'"/>

<CallTarget Targets="BinScopeCheck" Condition="'$(OnPremiseBuild)'" />

<CallTarget Targets="RunPoliCheck" Condition="'$(OnPremiseBuild)'" />

<CallTarget Targets="CodeSignBinaries" Condition="'$(CodeSign)' == 'true'" />

<Exec ContinueOnError="false" Command="$(PowerShellCoreCommandPrefix) &quot;. $(LibraryToolsFolder)\NewOutputTypeIndex.ps1 -OutputFile $(PackageDirectory)\outputtypes.json -BuildConfig $(Configuration)&quot;" Condition="('$(Scope)' == 'All' or '$(Scope)' == 'Latest') and $(CodeSign) == 'true'" />

<Message Importance="high" Text="Running Static Analyser" />
Expand Down Expand Up @@ -322,7 +322,7 @@
<Message Importance="high" Text="Running dependency analysis..." />

<PropertyGroup>
<SkipHelpValue Condition=" '$(SkipHelp)' == 'true' ">-s</SkipHelpValue>
<SkipHelpValue Condition=" '$(SkipHelp)' == 'true' ">-s</SkipHelpValue>
</PropertyGroup>
<!-- TODO: Use '-m @(ModulesChanged)' in command when FilterBuild is fixed. -->
<!-- <Exec Command="dotnet $(MSBuildThisFileDirectory)src/Package/StaticAnalysis/StaticAnalysis.Netcore.dll -p $(MSBuildThisFileDirectory)src/Package/$(Configuration) -r $(MSBuildThisFileDirectory)src/Package/StaticAnalysis $(SkipHelpValue) -u" /> -->
Expand Down
6 changes: 6 additions & 0 deletions src/Az.Test.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@
<DefineConstants>TRACE;RELEASE;NETSTANDARD</DefineConstants>
</PropertyGroup>

<!-- Assets -->
<ItemGroup>
<None Update="SessionRecords\**\*.json" CopyToOutputDirectory="PreserveNewest" />
<None Update="ScenarioTests\*.ps1" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,4 @@
<PackageReference Include="Microsoft.Azure.Management.Advisor" Version="0.9.5-preview" />
</ItemGroup>

<!-- <ItemGroup>
<ProjectReference Include="..\Commands.Advisor\Commands.Advisor.Netcore.csproj" />
</ItemGroup> -->

<ItemGroup>
<None Update="SessionRecords\**\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
10 changes: 1 addition & 9 deletions src/ResourceManager/Aks/Commands.Aks.Test/Aks.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@
</ItemGroup>

<ItemGroup>
<None Update="SessionRecords\**\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fixtures\*.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Fixtures\*.*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,4 @@
<ProjectReference Include="..\Commands.AnalysisServices.Dataplane\AnalysisServices.Dataplane.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="SessionRecords\**\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@
</ItemGroup>

<ItemGroup>
<None Update="SessionRecords\**\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

<ItemGroup>
<None Update="powershelltest.pfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="powershelltest.pfx" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@
</ItemGroup>

<ItemGroup>
<None Update="SessionRecords\**\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\*.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Resources\*.*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,4 @@
<PackageReference Include="Microsoft.Azure.Management.ApplicationInsights" Version="0.2.0-preview" />
</ItemGroup>

<ItemGroup>
<None Update="SessionRecords\**\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,8 @@
</ItemGroup>

<ItemGroup>
<None Update="SessionRecords\**\*.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.cer">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\Resources\*.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ScenarioTests\*.cer" CopyToOutputDirectory="PreserveNewest" />
<None Update="ScenarioTests\Resources\*.*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
Loading

0 comments on commit 9f8b1fb

Please sign in to comment.