6262 pool :
6363 vmImage : windows-2019
6464 steps :
65- - task : CmdLine@2
66- displayName : ' Clear Local NuGet Cache' # https://github.com/actions/virtual-environments/issues/1090#issuecomment-748452120
67- inputs :
68- script : ' nuget locals all -clear'
69- - task : MSBuild@1
70- displayName : ' Clean Solution'
71- inputs :
72- solution : $(PathToSamplesSln)
73- msbuildArguments : ' /t:Clean'
7465 - task : MSBuild@1
7566 displayName : Build Solution
7667 inputs :
@@ -88,25 +79,19 @@ jobs:
8879 inputs :
8980 version : $(NETCORE_VERSION)
9081 includePreviewVersions : false
82+
9183 - task : UseDotNet@2
9284 displayName : ' Install .NET 3.1 Test SDK'
9385 inputs :
9486 version : $(NETCORE_TEST_VERSION_3_1)
9587 includePreviewVersions : false
88+
9689 - task : UseDotNet@2
9790 displayName : ' Install .NET 2.1 Test SDK'
9891 inputs :
9992 version : $(NETCORE_TEST_VERSION_2_1)
10093 includePreviewVersions : false
101- - task : CmdLine@2
102- displayName : ' Clear Local NuGet Cache' # https://github.com/actions/virtual-environments/issues/1090#issuecomment-748452120
103- inputs :
104- script : ' nuget locals all -clear'
105- - task : MSBuild@1
106- displayName : ' Clean Solution'
107- inputs :
108- solution : $(PathToSamplesSln)
109- msbuildArguments : ' /t:Clean'
94+
11095 # if this is a tagged build, then update the version number
11196 - powershell : |
11297 $buildSourceBranch = "$(Build.SourceBranch)"
@@ -115,6 +100,7 @@ jobs:
115100 Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
116101 displayName: Set NuGet Version to Tag Number
117102 condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
103+
118104 # if this is a PR build, then update the version number
119105 - powershell : |
120106 $prNumber = $env:System_PullRequest_PullRequestNumber
@@ -125,56 +111,68 @@ jobs:
125111 Write-Host "##vso[build.updatebuildnumber]$fullVersionString"
126112 displayName: Set NuGet Version to PR Version
127113 condition: and(succeeded(), eq(variables['build.reason'], 'PullRequest'))
114+
128115 # restore, build and pack the packages
129116 - task : MSBuild@1
130117 displayName : Build Xamarin.CommunityToolkit.csproj
131118 inputs :
132119 solution : $(PathToCommunityToolkitCsproj)
133120 configuration : Release
134121 msbuildArguments : ' /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
122+
135123 - task : CopyFiles@2
136124 inputs :
137125 Contents : ' SignList.xml'
138- TargetFolder : ' $(Build.ArtifactStagingDirectory)/nuget'
126+ TargetFolder : ' $(Build.ArtifactStagingDirectory)'
127+
139128 - task : MSBuild@1
140129 displayName : Pack Community Toolkit NuGets
141130 inputs :
142131 solution : $(PathToCommunityToolkitCsproj)
143132 configuration : Release
144- msbuildArguments : ' /t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
133+ msbuildArguments : ' /t:Pack /p:PackageVersion=$(NugetPackageVersion)'
134+
145135 - task : MSBuild@1
146136 displayName : Build Markup Project
147137 inputs :
148138 solution : $(PathToMarkupCsproj)
149139 configuration : Release
150140 msbuildArguments : ' /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
141+
151142 - task : MSBuild@1
152143 displayName : Pack Markup NuGet
153144 inputs :
154145 solution : $(PathToMarkupCsproj)
155146 configuration : Release
156- msbuildArguments : ' /t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
157- # - task: DotNetCoreCLI@2
158- # displayName: Publish to GitHub NuGet Packages
159- # condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/heads/main'))
160- # inputs:
161- # command: 'custom'
162- # custom: 'nuget'
163- # arguments: 'push --source https://nuget.pkg.github.com/xamarin/index.json --api-key $(GitHub.NuGet.Token) "$(Build.ArtifactStagingDirectory)\nuget\*.nupkg"'
147+ msbuildArguments : ' /t:Pack /p:PackageVersion=$(NugetPackageVersion)'
148+
164149 - task : CmdLine@2
165150 displayName : ' Run Markup Unit Tests'
166151 inputs :
167152 script : dotnet test $(PathToMarkupUnitTestCsproj) -c Release --collect "Code coverage" -p:BuildInParallel=false
153+
168154 - task : CmdLine@2
169155 displayName : ' Run Community Toolkit Unit Tests'
170156 inputs :
171157 script : dotnet test $(PathToCommunityToolkitUnitTestCsproj) -c Release --collect "Code coverage" -p:BuildInParallel=false
158+
172159 # publish the packages
160+ - task : PowerShell@2
161+ displayName : ' Copy NuGet Packages to Staging Directory'
162+ inputs :
163+ targetType : ' inline'
164+ script : |
165+ $source = ".\src"
166+ $filter = "nupkg"
167+ Get-ChildItem -Path $source -Recurse | Where-Object { $_.Extension -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
168+ pwsh : true
169+
173170 - task : PublishBuildArtifacts@1
174171 displayName : ' Publish Unsigned NuGets'
175172 inputs :
176173 artifactName : nuget
177- pathToPublish : ' $(Build.ArtifactStagingDirectory)/nuget'
174+ pathToPublish : ' $(Build.ArtifactStagingDirectory)'
175+
178176 # make sure we are following the rules, but only on the main build
179177 - ${{ if eq(variables['System.TeamProject'], 'devdiv') }} :
180178 - task : ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
@@ -202,19 +200,23 @@ jobs:
202200 script : |
203201 curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 6.0.300-preview.22204.3 --quality preview
204202 dotnet --info
203+
205204 - task : CmdLine@2
206205 displayName : ' Install .NET MAUI Workload'
207206 inputs :
208207 script : ' dotnet workload install maui'
208+
209209 - task : JavaToolInstaller@0
210210 displayName : ' Install Java SDK 11.0'
211211 inputs :
212212 versionSpec : ' 11'
213213 jdkArchitectureOption : ' x64'
214214 jdkSourceOption : ' PreInstalled'
215+
215216 - powershell : |
216217 $mauiCompatExists = Test-Path -Path "$(PathToMauiCompatCommunityToolkitCsproj)"
217218 Write-Output "##vso[task.setvariable variable=MauiCompatExists]$mauiCompatExists"
219+
218220 - task : CmdLine@2
219221 displayName : ' Run MauiCompat Generator'
220222 condition : eq (variables['MauiCompatExists'], False)
@@ -240,21 +242,18 @@ jobs:
240242 - download : current
241243 artifact : drop
242244
243- - task : CopyFiles@2
244- inputs :
245- Contents : ' $(Pipeline.Workspace)\drop\SignList.xml'
246- TargetFolder : ' $(Build.ArtifactStagingDirectory)/nuget'
247-
248245 - powershell : |
249246 wget https://dot.net/v1/dotnet-install.ps1 -OutFile C:\dotnet-install.ps1
250247 C:\dotnet-install.ps1 -Version 6.0.300-preview.22204.3
251248 dotnet --info
252249 Write-Host "##vso[task.prependpath]C:\\Users\\VssAdministrator\\AppData\\Local\\Microsoft\\dotnet"
253250 displayName: Install .NET 6.0.300-preview.22204.3
251+
254252 - task : CmdLine@2
255253 displayName : ' Install .NET MAUI Workload'
256254 inputs :
257255 script : ' dotnet workload install maui'
256+
258257 - task : JavaToolInstaller@0
259258 displayName : ' Install Java SDK 11.0'
260259 inputs :
@@ -268,6 +267,7 @@ jobs:
268267 script : |
269268 cd $(Pipeline.Workspace)\drop
270269 dotnet new globaljson --sdk-version 6.0.300-preview.22204.3 --roll-forward latestMajor --force
270+
271271 # if this is a tagged build, then update the version number
272272 - powershell : |
273273 $buildSourceBranch = "$(Build.SourceBranch)"
@@ -283,21 +283,32 @@ jobs:
283283 inputs :
284284 solution : ' $(Pipeline.Workspace)\drop\$(PathToMauiCompatCommunityToolkitCsproj)'
285285 configuration : ' Release'
286- msbuildArgs : ' /restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget" '
286+ msbuildArgs : ' /restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg'
287287
288288 - task : VSBuild@1
289289 displayName : ' Build and Pack Markup NuGet'
290290 inputs :
291291 solution : ' $(Pipeline.Workspace)\drop\$(PathToMauiCompatMarkupCsproj)'
292292 configuration : ' Release'
293- msbuildArgs : ' /restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget" '
293+ msbuildArgs : ' /restore -t:pack -p:PackageVersion=$(NugetPackageVersion) -p:Version=$(NugetPackageVersion) -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg'
294294
295295 # publish the packages
296+ - task : PowerShell@2
297+ displayName : ' Copy NuGet Packages to Staging Directory'
298+ inputs :
299+ targetType : ' inline'
300+ script : |
301+ $source = "$(Pipeline.Workspace)\drop\src"
302+ $filter = "nupkg"
303+ Get-ChildItem -Path $source -Recurse | Where-Object { $_.Extension -match $filter } | Copy-Item -Destination "$(Build.ArtifactStagingDirectory)"
304+ pwsh : true
305+
296306 - task : PublishBuildArtifacts@1
297307 displayName : ' Publish Unsigned NuGets'
298308 inputs :
299309 artifactName : nuget
300- pathToPublish : ' $(Build.ArtifactStagingDirectory)/nuget'
310+ pathToPublish : ' $(Build.ArtifactStagingDirectory)'
311+
301312 # make sure we are following the rules, but only on the main build
302313 - ${{ if eq(variables['System.TeamProject'], 'devdiv') }} :
303314 - task : ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
@@ -327,52 +338,54 @@ jobs:
327338 Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$tagVersion")
328339 displayName: Set NuGet Version to Tag Number
329340 condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
330- # 16feb21 jfversluis: let's not pin this anymore and use latest
331- # make sure to select the correct Xamarin and mono
332- # - bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
333- # displayName: Switch to the latest Xamarin SDK
334- # - bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
335- # displayName: Switch to the latest Xcode
336- # restore, build and pack the packages
341+
337342 - task : UseDotNet@2
338343 displayName : ' Install .NET SDK'
339344 inputs :
340345 version : $(NETCORE_VERSION)
341346 includePreviewVersions : false
347+
342348 - task : UseDotNet@2
343349 displayName : ' Install .NET 3.1 Test SDK'
344350 inputs :
345351 version : $(NETCORE_TEST_VERSION_3_1)
346352 includePreviewVersions : false
353+
347354 - task : UseDotNet@2
348355 displayName : ' Install .NET 2.1 Test SDK'
349356 inputs :
350357 version : $(NETCORE_TEST_VERSION_2_1)
351358 includePreviewVersions : false
359+
352360 - task : CmdLine@2
353361 displayName : ' Build Markup'
354362 inputs :
355363 script : ' $(PathToMsBuildOnMacOS) $(PathToMarkupCsproj) /p:Configuration=Release /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
364+
356365 - task : CmdLine@2
357366 displayName : ' Build Community Toolkit'
358367 inputs :
359368 script : ' $(PathToMsBuildOnMacOS) $(PathToCommunityToolkitCsproj) /p:Configuration=Release /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false'
369+
360370 - task : CmdLine@2
361371 displayName : ' Run Markup Unit Tests'
362372 inputs :
363373 script : ' dotnet test $(PathToMarkupUnitTestCsproj) -c Release -p:BuildInParallel=false'
374+
364375 - task : CmdLine@2
365376 displayName : ' Run Community Toolkit Unit Tests'
366377 inputs :
367378 script : ' dotnet test $(PathToCommunityToolkitUnitTestCsproj) -c Release -p:BuildInParallel=false'
379+
368380 - task : CmdLine@2
369381 displayName : ' Pack Markup NuGets'
370382 inputs :
371- script : ' $(PathToMsBuildOnMacOS) $(PathToMarkupUnitTestCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget"'
383+ script : ' $(PathToMsBuildOnMacOS) $(PathToMarkupUnitTestCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion)'
384+
372385 - task : CmdLine@2
373386 displayName : ' Pack CommunityToolkit NuGets'
374387 inputs :
375- script : ' $(PathToMsBuildOnMacOS) $(PathToCommunityToolkitCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion) /p:PackageOutputPath="$(Build.ArtifactStagingDirectory)/nuget" '
388+ script : ' $(PathToMsBuildOnMacOS) $(PathToCommunityToolkitCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion)'
376389
377390 - ${{ if eq(variables['System.TeamProject'], 'devdiv') }} :
378391 - template : sign-artifacts/jobs/v2.yml@internal-templates
0 commit comments