|
20 | 20 | /p:Scope
|
21 | 21 | 'Subfolder under src': An individual cmdlet module
|
22 | 22 | By default, it builds everything
|
23 |
| - /p:TargetModule |
24 |
| - Just focus on one module and its dependency such as Az.Account. Module name doesn't need to lead with Az. |
25 | 23 | /p:SkipHelp=True
|
26 | 24 | Skips help generation, mainly for local builds to save time.
|
| 25 | + /p:ModifiedModuleBuild=True |
| 26 | + Only build changed module according to the changelog in root folder or according to another property "TargetModule" |
| 27 | + /p:TargetModule |
| 28 | + Just focus on modules and its dependency such as Az.Account. Module name doesn't need to lead with Az. Split by ":" |
27 | 29 | -->
|
28 | 30 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
29 | 31 |
|
|
36 | 38 | <TestFramework Condition="'$(TestFramework)' == ''">netcoreapp2.2</TestFramework>
|
37 | 39 | <IsGenerateBased Condition="'$(IsGenerateBased)' != 'true'">false</IsGenerateBased>
|
38 | 40 | <IsSecurityCheck Condition="'$(IsSecurityCheck)' != 'true'">false</IsSecurityCheck>
|
| 41 | + <ModifiedModuleBuild Condition="'$(ModifiedModuleBuild)' != 'true'">false</ModifiedModuleBuild> |
39 | 42 |
|
| 43 | + |
40 | 44 | <!-- Flags -->
|
41 | 45 | <CodeSign Condition ="'$(CodeSign)' == ''">false</CodeSign>
|
42 | 46 | <SkipHelp Condition ="'$(SkipHelp)' != 'true'">false</SkipHelp>
|
|
61 | 65 | <!-- Testing related -->
|
62 | 66 | <TestsToRun Condition="$(TestsToRun) == ''" >All</TestsToRun>
|
63 | 67 | <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>
|
64 |
| - <Net472TestExclude Condition="'$(TestFramework)' == 'net472'">$(RepoRoot)src/**/Automation.Test.csproj;$(RepoRoot)src/**/Storage.Test.csproj;</Net472TestExclude> |
| 68 | + <CoreTests Condition="'$(CoreTests)' == ''">null</CoreTests> |
65 | 69 |
|
66 | 70 | <!-- CI build related -->
|
67 | 71 | <CIToolsPath>$(OnPremiseBuildTasks)</CIToolsPath>
|
|
116 | 120 | <Exec Command="dotnet publish $(RepoTools)StaticAnalysis/StaticAnalysis.Netcore.csproj -c $(Configuration)" />
|
117 | 121 | </Target>
|
118 | 122 |
|
119 |
| - <Target Name="FilterBuild" Condition="$(PullRequestNumber) != '' OR $(TargetModule) != ''" DependsOnTargets="BuildTools"> |
| 123 | + <Target Name="FilterBuild" Condition="$(PullRequestNumber) != ''" DependsOnTargets="BuildTools"> |
120 | 124 | <Message Importance="high" Text="Filtering projects and modules..." />
|
121 | 125 |
|
122 | 126 | <Message Text="$(IsGenerateBased)" />
|
123 | 127 | <!-- Build the Microsoft.Azure.Build.Tasks project -->
|
124 | 128 | <Exec Command="dotnet publish $(RepoTools)BuildPackagesTask/Microsoft.Azure.Build.Tasks/Microsoft.Azure.Build.Tasks.csproj -c $(Configuration)" />
|
125 | 129 |
|
126 | 130 | <!-- Get all of the files changed in the given pull request -->
|
127 |
| - <FilesChangedTask RepositoryOwner="Azure" RepositoryName="azure-powershell" PullRequestNumber="$(PullRequestNumber)" TargetModule="$(TargetModule)" OutputFile="$(RepoArtifacts)/FilesChanged.txt"> |
| 131 | + <FilesChangedTask RepositoryOwner="Azure" RepositoryName="azure-powershell" PullRequestNumber="$(PullRequestNumber)" OutputFile="$(RepoArtifacts)/FilesChanged.txt"> |
128 | 132 | <Output TaskParameter="FilesChanged" ItemName="FilesChanged" />
|
129 | 133 | </FilesChangedTask>
|
130 | 134 |
|
131 | 135 | <Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)PrepareAutorestModule.ps1"" Condition="'$(IsGenerateBased)' == 'true'"/>
|
132 | 136 | <Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)/CreateFilterMappings.ps1"" />
|
133 | 137 | <Exec Command="$(PowerShellCoreCommandPrefix) "$(RepoTools)/PrepareForSecurityCheck.ps1"" Condition="'$(IsSecurityCheck)' == 'true'"/>
|
134 | 138 |
|
135 |
| - <CIFilterTask FilesChanged="@(FilesChanged)" TargetModule="$(TargetModule)" Mode="$(Configuration)" CsprojMapFilePath="./CsprojMappings.json"> |
| 139 | + <CIFilterTask FilesChanged="@(FilesChanged)" Mode="$(Configuration)" CsprojMapFilePath="./CsprojMappings.json"> |
136 | 140 | <Output TaskParameter="BuildCsprojList" ItemName="BuildCsprojList" />
|
137 | 141 | <Output TaskParameter="TestCsprojList" ItemName="TestCsprojList" />
|
138 | 142 | <Output TaskParameter="SubTasks" PropertyName="SubTasks" />
|
|
149 | 153 | <Copy SourceFiles="$(RepoTools)after.Azure.PowerShell.sln.targets" DestinationFolder="$(RepoArtifacts)" />
|
150 | 154 |
|
151 | 155 | <!-- Build and create package content -->
|
152 |
| - <Exec Command="dotnet --version" /> |
153 |
| - <Exec Command="dotnet new sln -n Azure.PowerShell -o $(RepoArtifacts) --force" /> |
154 | 156 | <CallTarget Targets="BuildNormalModules" />
|
155 | 157 | <CallTarget Targets="AzToolsPredictor" Condition="$(SubTasks.Contains('Predictor')) OR $(SubTasks.Contains('all'))" />
|
156 | 158 | <CallTarget Targets="AzToolsInstaller" Condition="$(SubTasks.Contains('Installer')) OR $(SubTasks.Contains('all'))" />
|
157 | 159 | </Target>
|
158 | 160 |
|
159 | 161 | <Target Name="BuildNormalModules">
|
160 |
| - <ItemGroup Condition="$(PullRequestNumber) == '' AND $(TargetModule) == ''"> |
161 |
| - <CsprojFiles Include="$(RepoRoot)src/**/*.csproj" Exclude="$(RepoRoot)src/**/*.Test.csproj;$(RepoRoot)src/**/Authenticators.csproj" /> |
162 |
| - <CsprojFiles Include="$(RepoRoot)src/**/*.Test.csproj" Exclude="$(Net472TestExclude)" Condition="'$(Configuration)' != 'Release' and '$(TestsToRun)' == 'All'" /> |
163 |
| - <CsprojFiles Include="$(RepoRoot)src/**/*.Test.csproj" Exclude="$(CoreTests)$(Net472TestExclude)" Condition="'$(Configuration)' != 'Release' and '$(TestsToRun)' == 'NonCore'" /> |
164 |
| - <CsprojFiles Include="$(CoreTests)" Exclude="$(Net472TestExclude)" Condition="'$(Configuration)' != 'Release' and '$(TestsToRun)' == 'Core'" /> |
165 |
| - <CsprojFiles Include="$(RepoRoot)src/**/Authenticators.csproj" Condition="'$([MSBuild]::IsOsPlatform("Windows"))' == 'true' and '$(TestFramework)' != 'net472'" /> |
166 |
| - </ItemGroup> |
167 |
| - <ItemGroup Condition="$(PullRequestNumber) != ''"> |
168 |
| - <!-- Always build and test common code --> |
169 |
| - <CsprojFiles Include="@(BuildCsprojList)" /> |
170 |
| - <CsprojFiles Include="@(TestCsprojList)" /> |
171 |
| - </ItemGroup> |
172 |
| - <ItemGroup Condition="$(TargetModule) != ''"> |
173 |
| - <!-- Add test projects only if Configuration is not Release --> |
174 |
| - <CsprojFiles Include="@(BuildCsprojList)" /> |
175 |
| - <CsprojFiles Include="@(TestCsprojList)" Condition="'$(Configuration)' != 'Release'" /> |
176 |
| - </ItemGroup> |
177 |
| - <!-- https://github.com/dotnet/cli/issues/6295#issuecomment-346973582 --> |
178 |
| - <Exec Command="dotnet sln $(RepoArtifacts)Azure.PowerShell.sln add "%(CsprojFiles.FullPath)"" Condition="'@(CsprojFiles)' != ''" /> |
| 162 | + <Exec Condition="$(PullRequestNumber) == '' AND $(TargetModule) == '' AND $(ModifiedModuleBuild) == 'false'" |
| 163 | + Command="$(PowerShellCoreCommandPrefix) ".\tools\BuildScripts\BuildModules.ps1 -RepoRoot $(RepoRoot) -Configuration $(Configuration) -TestsToRun $(TestsToRun) -CoreTests $(CoreTests) -RepoArtifacts $(RepoArtifacts) "" |
| 164 | + /> |
| 165 | + <Exec Condition="$(PullRequestNumber) != ''" |
| 166 | + Command="$(PowerShellCoreCommandPrefix) ".\tools\BuildScripts\BuildModules.ps1 -RepoRoot $(RepoRoot) -Configuration $(Configuration) -TestsToRun $(TestsToRun) -CoreTests $(CoreTests) -RepoArtifacts $(RepoArtifacts) -BuildCsprojList '@(BuildCsprojList)' -TestCsprojList '@(TestCsprojList)'"" |
| 167 | + /> |
| 168 | + <Exec Condition="$(ModifiedModuleBuild) != 'false'" |
| 169 | + Command="$(PowerShellCoreCommandPrefix) ".\tools\BuildScripts\BuildModules.ps1 -RepoRoot $(RepoRoot) -Configuration $(Configuration) -TestsToRun $(TestsToRun) -CoreTests $(CoreTests) -RepoArtifacts $(RepoArtifacts) -ModifiedModuleBuild $(ModifiedModuleBuild) "" |
| 170 | + /> |
| 171 | + <Exec Condition="$(TargetModule) != ''" |
| 172 | + Command="$(PowerShellCoreCommandPrefix) ".\tools\BuildScripts\BuildModules.ps1 -RepoRoot $(RepoRoot) -Configuration $(Configuration) -TestsToRun $(TestsToRun) -CoreTests $(CoreTests) -RepoArtifacts $(RepoArtifacts) -TargetModule $(TargetModule)"" |
| 173 | + /> |
179 | 174 | <PropertyGroup>
|
180 | 175 | <BuildAction Condition="'$(Configuration)' != 'Release'">build</BuildAction>
|
181 | 176 | <BuildAction Condition="'$(Configuration)' == 'Release'">publish</BuildAction>
|
|
251 | 246 | <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" />
|
252 | 247 | </Target>
|
253 | 248 |
|
254 |
| - <Target Name="ChangeLogCheck"> |
255 |
| - <Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)/CheckChangeLog.ps1 -FilesChanged '@(FilesChanged)'"" Condition=" '$(Scope)' == 'All' or '$(Scope)' == 'Latest' " /> |
256 |
| - <OnError ExecuteTargets="ChangeLogErrorMessage" /> |
257 |
| - </Target> |
258 |
| - |
259 | 249 | <Target Name="AzToolsInstaller">
|
260 | 250 | <Exec Command='dotnet msbuild $(RepoTools)/Az.Tools.Installer/build.proj /t:"clean;build;test"' />
|
261 | 251 | </Target>
|
|
264 | 254 | <Exec Command='dotnet msbuild $(RepoTools)/Az.Tools.Predictor/build.proj /t:"clean;build;test"' />
|
265 | 255 | </Target>
|
266 | 256 |
|
267 |
| - <Target Name="ChangeLogErrorMessage"> |
268 |
| - <Error Text="Modified files were found with no update to their change log. Please add a snippet to the affected modules' change log." /> |
269 |
| - </Target> |
270 |
| - |
271 | 257 | <Target Name="Publish" Condition="'$(Configuration)' == 'Release'">
|
272 | 258 | <Message Importance="high" Text="Publishing Cmdlets using $(Scope) scope" />
|
273 |
| - <Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)/NewOutputTypeIndex.ps1 -OutputFile $(RepoArtifacts)/outputtypes.json -BuildConfig $(Configuration)"" Condition="'$(TargetModule)' == ''"/> |
274 |
| - <Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)/NewHelpIndex.ps1 -OutputFile $(RepoArtifacts)/index.json -BuildConfig $(Configuration)"" Condition="'$(TargetModule)' == ''"/> |
| 259 | + <Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)/NewOutputTypeIndex.ps1 -OutputFile $(RepoArtifacts)/outputtypes.json -BuildConfig $(Configuration)""/> |
| 260 | + <Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)/NewHelpIndex.ps1 -OutputFile $(RepoArtifacts)/index.json -BuildConfig $(Configuration)""/> |
275 | 261 |
|
276 | 262 | <Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)/CleanupBuild.ps1 -BuildConfig $(Configuration) -GenerateDocumentationFile $(GenerateDocumentationFile) "" />
|
277 | 263 |
|
278 | 264 | <Error Condition="'$(NuGetKey)' == ''" Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
|
279 | 265 | <Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoTools)/PublishModules.ps1 -IsNetCore:$$(NetCore) -BuildConfig $(Configuration) -Scope $(Scope) -ApiKey $(NuGetKey) -RepositoryLocation \"$(NuGetPublishingSource)\"" -NugetExe $(NuGetCommand)" />
|
280 | 266 | </Target>
|
281 | 267 |
|
282 |
| - <Target Name="BuildInstaller" AfterTargets="Publish" Condition="('$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore') and '$(TargetModule)' == ''"> |
| 268 | + <Target Name="BuildInstaller" AfterTargets="Publish" Condition="('$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore')"> |
283 | 269 | <Exec Command="$(PowerShellCoreCommandPrefix) ". Register-PSRepository -Name MSIcreationrepository -SourceLocation $(RepoArtifacts) -InstallationPolicy Trusted "" />
|
284 | 270 | <Exec Command="$(PowerShellCoreCommandPrefix) ". $(RepoRoot)/setup/generate.ps1 -repository MSIcreationrepository "" />
|
285 | 271 | <Exec Command="$(PowerShellCoreCommandPrefix) ". Unregister-PSRepository -Name MSIcreationrepository "" />
|
|
301 | 287 | <OnError ExecuteTargets="TestFailureErrorMessage" />
|
302 | 288 | </Target>
|
303 | 289 |
|
304 |
| - <Target Name="TestNet472" Condition="'$(TestFramework)' == 'net472'"> |
305 |
| - <PropertyGroup> |
306 |
| - <PowerShellCommandPrefix>powershell -NonInteractive -NoLogo -NoProfile -Command</PowerShellCommandPrefix> |
307 |
| - </PropertyGroup> |
308 |
| - <Message Importance="high" Text="Running check in tests..." /> |
309 |
| - <MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" /> |
310 |
| - <Exec Command="dotnet build $(RepoArtifacts)Azure.PowerShell.sln -c $(Configuration)" /> |
311 |
| - <Exec Command="dotnet new console -n Net472Tests" /> |
312 |
| - <Exec Command="dotnet add Net472Tests package xunit.runner.console --version 2.4.0" /> |
313 |
| - <Exec Command="dotnet restore --packages $(RepoArtifacts)/xUnit -f --no-cache Net472Tests" /> |
314 |
| - <Exec Command="$(PowerShellCommandPrefix) "$(RepoTools)/TestNet472Modules.ps1 -TestExecPath '$(RepoArtifacts)/xUnit/xunit.runner.console/2.4.0/tools/net472/xunit.console.exe'"" /> |
315 |
| - <OnError ExecuteTargets="TestFailureErrorMessage" /> |
316 |
| - </Target> |
317 |
| - |
318 | 290 | <Target Name="TestFailureErrorMessage">
|
319 | 291 | <Error Text="Test failures occurred, check the files in artifacts/TestResults" />
|
320 | 292 | </Target>
|
|
0 commit comments