8181 <UsingTask Condition =" $(OnPremiseBuild)" TaskName =" CorporateValidation" AssemblyFile =" $(CIToolsPath)/Microsoft.WindowsAzure.Tools.Build.Tasks.OnPremise.dll" />
8282 <Import Condition =" $(OnPremiseBuild)" Project =" $(CIToolsPath)/Microsoft.WindowsAzure.Build.OnPremise.msbuild" />
8383 <UsingTask TaskName =" ESRPSignTask" AssemblyFile =" $(CISignRepoPath)/tools/sdkbuildtools/tasks/MS.Az.Sdk.OnPremise.Build.Tasks.dll" />
84+ <UsingTask TaskName =" FilesChangedTask" AssemblyFile =" $(RepoArtifacts)Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.dll" />
85+ <UsingTask TaskName =" FilterTask" AssemblyFile =" $(RepoArtifacts)Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.dll" />
8486
8587 <Target Name =" Clean" >
8688 <Message Importance =" high" Text =" Cleaning Cmdlets..." />
9395 <Exec Command =" $(PowerShellCoreCommandPrefix) " Get-ChildItem -Path $(MSBuildThisFileDirectory) -Recurse -Include 'bin','obj','TestResults' | Remove-Item -Recurse -Force -ErrorAction Ignore" " IgnoreExitCode =" true" />
9496 </Target >
9597
96- <Target Name =" FilterBuild" >
98+ <Target Name =" FilterBuild" Condition =" $(PullRequestNumber) != ''" >
99+ <Message Importance =" high" Text =" Filtering projects and modules..." />
97100 <Exec Command =" $(PowerShellCoreCommandPrefix) " . $(RepoTools)/CreateFilterMappings.ps1" " />
98101
102+ <!-- Build the Microsoft.Azure.Build.Tasks project -->
103+ <Exec Command =" dotnet publish $(RepoTools)BuildPackagesTask/Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.csproj -c $(Configuration) -f netstandard2.0" />
104+
99105 <!-- Get all of the files changed in the given pull request -->
100106 <FilesChangedTask RepositoryOwner =" Azure" RepositoryName =" azure-powershell" PullRequestNumber =" $(PullRequestNumber)" >
101107 <Output TaskParameter =" FilesChanged" ItemName =" FilesChanged" />
105111 <FilterTask FilesChanged =" @(FilesChanged)" MapFilePath =" ./ModuleMappings.json" >
106112 <Output TaskParameter =" Output" ItemName =" ModulesChanged" />
107113 </FilterTask >
108- <Message Text =" Filtering help generation and StaticAnalysis by the following modules:" />
109- <Message Text =" %(ModulesChanged.Identity)" />
110- <Message Text =" Total: @(ModulesChanged->Count())" />
111- <Message Text =" " />
112-
113- <!-- Get the list of solutions to build -->
114- <FilterTask FilesChanged =" @(FilesChanged)" MapFilePath =" ./SolutionMappings.json" >
115- <Output TaskParameter =" Output" ItemName =" CmdletSolutionsToBuild" />
116- </FilterTask >
117- <Message Text =" Filtering solutions to build by the following:" />
118- <Message Text =" %(CmdletSolutionsToBuild.Identity)" />
119- <Message Text =" Total: @(CmdletSolutionsToBuild->Count())" />
120- <Message Text =" " />
121-
122- <!-- 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.-->
123- <FilterTask FilesChanged =" @(FilesChanged)" MapFilePath =" ./TestMappings.json" >
124- <Output TaskParameter =" Output" ItemName =" XUnitTests" />
114+ <Message Importance =" high" Text =" Filtering help generation and StaticAnalysis by the following modules:" />
115+ <Message Importance =" high" Text =" %(ModulesChanged.Identity)" />
116+ <Message Importance =" high" Text =" Total: @(ModulesChanged->Count())" />
117+ <Message Importance =" high" Text =" " />
118+
119+ <!-- Get the list of projects to build -->
120+ <FilterTask FilesChanged =" @(FilesChanged)" MapFilePath =" ./CsprojMappings.json" >
121+ <Output TaskParameter =" Output" ItemName =" ProjectsToBuild" />
125122 </FilterTask >
126- <Message Text =" Using these test assemblies :" />
127- <Message Text =" %(XUnitTests .Identity)" />
128- <Message Text =" Total: @(XunitTests ->Count())" />
129- <Message Text =" " />
123+ <Message Importance = " high " Text =" Filtering projects to build by the following :" />
124+ <Message Importance = " high " Text =" %(ProjectsToBuild .Identity)" />
125+ <Message Importance = " high " Text =" Total: @(ProjectsToBuild ->Count())" />
126+ <Message Importance = " high " Text =" " />
130127 </Target >
131128
132129 <!-- Build all flavors of the Cmdlets -->
133- <!-- TODO: Reimplement the FilterBuild and update RepoTasks to NetStandard -->
134- <Target Name =" Build" >
130+ <Target Name =" Build" DependsOnTargets =" FilterBuild" >
135131 <Message Importance =" high" Text =" Building Cmdlets..." />
136132
137133 <MakeDir Directories =" $(RepoArtifacts)" />
142138 <!-- Build and create package content -->
143139 <Exec Command =" dotnet --version" />
144140 <Exec Command =" dotnet new sln -n Azure.PowerShell -o $(RepoArtifacts) --force" />
145- <ItemGroup >
141+ <ItemGroup Condition = " $(PullRequestNumber) == '' " >
146142 <CsprojFiles Include =" $(RepoRoot)src/**/*.csproj" Exclude =" $(RepoRoot)src/**/*.Test.csproj;$(RepoRoot)src/**/Authenticators.csproj" />
147143 <CsprojFiles Include =" $(RepoRoot)src/**/*.Test.csproj" Exclude =" $(Net472TestExclude)" Condition =" '$(Configuration)' != 'Release' and '$(TestsToRun)' == 'All'" />
148144 <CsprojFiles Include =" $(RepoRoot)src/**/*.Test.csproj" Exclude =" $(CoreTests)$(Net472TestExclude)" Condition =" '$(Configuration)' != 'Release' and '$(TestsToRun)' == 'NonCore'" />
149145 <CsprojFiles Include =" $(CoreTests)" Exclude =" $(Net472TestExclude)" Condition =" '$(Configuration)' != 'Release' and '$(TestsToRun)' == 'Core'" />
150146 <CsprojFiles Include =" $(RepoRoot)src/**/Authenticators.csproj" Condition =" '$([MSBuild]::IsOsPlatform(" Windows" ))' == 'true' and '$(TestFramework)' != 'net472'" />
151147 </ItemGroup >
148+ <ItemGroup Condition =" $(PullRequestNumber) != ''" >
149+ <!-- Always build and test common code -->
150+ <CsprojFiles Include =" $(LibraryRoot)src/Accounts/**/*.csproj;$(LibraryRoot)tools/TestFx/TestFx.csproj" Exclude =" $(LibraryRoot)src/**/Authenticators.csproj" />
151+ <CsprojFiles Include =" %(ProjectsToBuild.Identity)" />
152+ <CsprojFiles Include =" $(LibraryRoot)src/**/Authenticators.csproj" Condition =" '$([MSBuild]::IsOsPlatform(" Windows" ))' == 'true'" />
153+ </ItemGroup >
152154 <!-- https://github.com/dotnet/cli/issues/6295#issuecomment-346973582 -->
153155 <Exec Command =" dotnet sln $(RepoArtifacts)Azure.PowerShell.sln add " %(CsprojFiles.FullPath)" " />
154156 <PropertyGroup >
@@ -297,7 +299,7 @@ $(RepoArtifacts)/$(Configuration)/**/Microsoft.Azure.PowerShell.Authenticators.d
297299 <!-- RemoveCodeSignArtifacts.ps1 -->
298300 <Message Text =" variables.Remove artifacts section" Importance =" high" />
299301 <Exec Command =" $(PowerShellCoreCommandPrefix) " Get-ChildItem -Path $(RepoArtifacts) -Recurse -Include 'Signed','Unsigned' | Remove-Item -Recurse -Force -Confirm:$false -ErrorAction Ignore" " IgnoreExitCode =" true" />
300-
302+
301303 <!-- CheckSignature.ps1 -->
302304 <Message Text =" variables.CheckSignature section" Importance =" high" />
303305 <Exec Command =" $(PowerShellCoreCommandPrefix) " . $(RepoTools)/CheckSignature.ps1 -CustomPath $(RepoArtifacts)/$(Configuration)" " Condition =" '$(Scope)' != 'Stack'" />
@@ -326,4 +328,4 @@ $(RepoArtifacts)/$(Configuration)/**/Microsoft.Azure.PowerShell.Authenticators.d
326328 <SetEnvVar EnvName =" SignedMsiDir" EnvValue =" $(SignedOutputRootDir)" />
327329 </Target >
328330
329- </Project >
331+ </Project >
0 commit comments