Skip to content

Commit

Permalink
Merge branch 'dotnet:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
devanathan-vaithiyanathan authored Jan 16, 2025
2 parents 7666e57 + 6f45ae6 commit 19d79a6
Show file tree
Hide file tree
Showing 52 changed files with 871 additions and 89 deletions.
50 changes: 44 additions & 6 deletions eng/pipelines/arcade/setup-test-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ parameters:
buildConfig: Debug
repoLogPath: $(Build.Arcade.LogsPath)
installPackageArtifacts: true
buildMSBuildTasks: false
androidSdkRoot: $(ANDROID_SDK_ROOT)

steps:
- checkout: self
Expand All @@ -11,14 +13,24 @@ steps:

- template: /eng/pipelines/common/setup-jdk.yml

- script: |
sudo xcode-select -s /Applications/Xcode_$(REQUIRED_XCODE).app
xcrun xcode-select --print-path
xcodebuild -version
sudo xcodebuild -license accept
sudo xcodebuild -downloadPlatform iOS
sudo xcodebuild -runFirstLaunch
displayName: Select Xcode Version
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
timeoutInMinutes: 30

- task: UseDotNet@2
displayName: 'Use .NET SDK $(DOTNET_VERSION)'
inputs:
packageType: sdk
version: $(DOTNET_VERSION)
includePreviewVersions: true


- ${{ if eq(parameters.installPackageArtifacts, true) }}:
- task: DownloadPipelineArtifact@2
displayName: Download PackageArtifacts
Expand All @@ -33,11 +45,23 @@ steps:
projects: ${{ parameters.mauiSourcePath }}/src/DotNet/DotNet.csproj
arguments: '-p:InstallWorkloadPacks=false -c ${{ parameters.buildConfig }} -bl:${{ parameters.repoLogPath }}/install-dotnet.binlog'

- task: DotNetCoreCLI@2
displayName: Install dotnet preview workloads from PackageArtifacts
inputs:
projects: ${{ parameters.mauiSourcePath }}/src/DotNet/DotNet.csproj
arguments: '-t:Install -c ${{ parameters.buildConfig }} -bl:${{ parameters.repoLogPath }}/install-dotnet.binlog'
- template: /eng/pipelines/common/run-dotnet-preview.yml
parameters:
displayName: Install dotnet preview workloads from PackageArtifacts
mauiSourcePath: ${{ parameters.mauiSourcePath }}
project: ${{ parameters.mauiSourcePath }}/src/DotNet/DotNet.csproj
arguments: '-t:Install -c ${{ parameters.buildConfig }} -bl:${{ parameters.repoLogPath }}/install-dotnet-workload.binlog'

- pwsh: |
Get-ChildItem artifacts -Filter 'Microsoft.Maui.Controls.*.nupkg' | Where-Object { $_.Name -match '^Microsoft\.Maui\.Controls\.([\d\.]+.*)\.nupkg$' }
$version = $Matches.1
if (!$version) {
Write-Error "Failed to extract the version from the nupkgs"
exit 1
}
Write-Host "Found .NET MAUI version (MAUI_PACKAGE_VERSION): $version"
Write-Host "##vso[task.setvariable variable=MAUI_PACKAGE_VERSION]$version"
displayName: Read the .NET MAUI version from the nugets
- ${{ else }}:
- task: DotNetCoreCLI@2
Expand All @@ -46,9 +70,23 @@ steps:
projects: ${{ parameters.mauiSourcePath }}/src/DotNet/DotNet.csproj
arguments: '-c ${{ parameters.buildConfig }} -bl:${{ parameters.repoLogPath }}/install-dotnet.binlog'

- template: /eng/pipelines/common/setup-android-dependencies.yml
parameters:
mauiSourcePath: ${{ parameters.mauiSourcePath }}
repoLogPath: ${{ parameters.repoLogPath }}
androidSdkRoot: ${{ parameters.androidSdkRoot }}

- ${{ if eq(parameters.buildMSBuildTasks, true) }}:
- template: /eng/pipelines/common/run-dotnet-preview.yml
parameters:
displayName: Build MSBuild Tasks
mauiSourcePath: ${{ parameters.mauiSourcePath }}
project: ${{ parameters.mauiSourcePath }}/Microsoft.Maui.BuildTasks.slnf
arguments: '-c ${{ parameters.buildConfig }} -bl:${{ parameters.repoLogPath }}/Microsoft.Maui.BuildTasks.binlog'

- template: /eng/pipelines/common/run-dotnet-preview.yml
parameters:
displayName: Restore dotnet preview tools
mauiSourcePath: ${{ parameters.mauiSourcePath }}
command: tool
arguments: restore
48 changes: 48 additions & 0 deletions eng/pipelines/arcade/stage-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
parameters:
stageDependsOn: []
jobMatrix: [] # Should define jobMatrix.name, jobMatrix.displayName, jobMatrix.pool, jobMatrix.timeout, jobMatrix.testCategory
mauiSourcePath: $(Build.SourcesDirectory)
buildConfig: Debug
repoLogPath: $(Build.Arcade.LogsPath)
publishTaskPrefix: '1ES.'

stages:
- stage: IntegrationTests
displayName: Run Integration Tests
dependsOn: ${{ parameters.stageDependsOn }}
jobs:
- ${{ each job in parameters.jobMatrix }}:
- job: ${{ job.name }}
displayName: ${{ job.testCategory }} ${{ job.pool.os }}
pool: ${{ job.pool }}
timeoutInMinutes: ${{ job.timeout }}
steps:
- template: /eng/pipelines/arcade/setup-test-env.yml
parameters:
mauiSourcePath: ${{ parameters.mauiSourcePath }}
buildConfig: ${{ parameters.buildConfig }}
repoLogPath: ${{ parameters.repoLogPath }}

- template: /eng/pipelines/common/run-dotnet-preview.yml
parameters:
displayName: Run Integration Tests - ${{ job.testCategory }} ${{ job.pool.os }}
mauiSourcePath: ${{ parameters.mauiSourcePath }}
command: test
project: ${{ parameters.mauiSourcePath }}/src/TestUtils/src/Microsoft.Maui.IntegrationTests/Microsoft.Maui.IntegrationTests.csproj
arguments: '-c ${{ parameters.buildConfig }} --filter "Category=${{ job.testCategory }}" --logger trx --results-directory $(Agent.TempDirectory)/Microsoft.Maui.IntegrationTests'
useExitCodeForErrors: true

- task: PublishTestResults@2
inputs:
testResultsFormat: VSTest
testResultsFiles: $(Agent.TempDirectory)/Microsoft.Maui.IntegrationTests/*.trx
testRunTitle: Integration Tests - ${{ job.testCategory }} ${{ job.pool.os }}

- task: ${{ parameters.publishTaskPrefix }}PublishPipelineArtifact@1
displayName: Publish Logs
inputs:
targetPath: ${{ parameters.repoLogPath }}
artifact: Logs - Integration Tests ${{ job.testCategory }} ${{ job.pool.os }} $(System.JobAttempt)
condition: always()

- template: /eng/pipelines/common/fail-on-issue.yml
12 changes: 6 additions & 6 deletions eng/pipelines/arcade/stage-pack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ parameters:
- name: sourceIndexParams
type: object
default: []
- name: publishTaskPrefix
type: string
default: '1ES.'
- name: runAsPublic
type: boolean
default: false

stages:
- stage: Pack
Expand Down Expand Up @@ -57,7 +57,7 @@ stages:
displayName: 🛠️ Build

# Run on public pipeline
- ${{ if eq(variables['_RunAsPublic'], 'true') }}:
- ${{ if eq(parameters.runAsPublic, 'true') }}:
- script: $(_buildScript)
-restore -pack
-publish $(_PublishArgs)
Expand All @@ -67,7 +67,7 @@ stages:
displayName: Pack & Publish

# Run on internal pipeline
- ${{ if eq(variables['_RunAsInternal'], 'true') }}:
- ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- script: $(_buildScript)
-restore -pack
-sign $(_SignArgs)
Expand All @@ -88,7 +88,7 @@ stages:
$(_OfficialBuildIdArgs)
displayName: Build Workloads

- task: ${{ parameters.publishTaskPrefix }}PublishPipelineArtifact@1
- task: 1ES.PublishPipelineArtifact@1
displayName: Publish VSDrop MSIs
inputs:
targetPath: '$(Build.SourcesDirectory)/artifacts/VSSetup/$(_BuildConfig)'
Expand Down
3 changes: 2 additions & 1 deletion eng/pipelines/arcade/stage-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ stages:
buildConfig: ${{ parameters.buildConfig }}
repoLogPath: ${{ parameters.repoLogPath }}
installPackageArtifacts: false
buildMSBuildTasks: true

- template: /eng/pipelines/common/run-dotnet-preview.yml
parameters:
Expand Down Expand Up @@ -164,7 +165,7 @@ stages:
displayName: Publish Logs
inputs:
targetPath: ${{ parameters.repoLogPath }}
artifact: Run Unit Tests - ${{ job.testOS }} Logs
artifact: Logs - Unit Tests ${{ job.testOS }} $(System.JobAttempt)
condition: always()

- template: /eng/pipelines/common/fail-on-issue.yml
94 changes: 87 additions & 7 deletions eng/pipelines/azure-pipelines-public.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,105 @@ stages:
- template: /eng/pipelines/arcade/stage-pack.yml@self
parameters:
pool: ${{ parameters.VM_IMAGE_HOST }}
publishTaskPrefix: ''
runAsPublic: ${{ eq(variables['_RunAsPublic'], 'true') }}

- template: /eng/pipelines/arcade/stage-unit-tests.yml@self
parameters:
jobMatrix:
- name: win_unit_tests
displayName: Windows Unit Tests
pool:
name: Azure Pipelines
vmImage: $(HostedWindowsImage)
os: windows
timeout: 120
pool: ${{ parameters.VM_IMAGE_HOST }}
timeout: 90
testOS: Windows
- name: mac_unit_tests
displayName: macOS Unit Tests
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
os: macOS
timeout: 120
timeout: 90
testOS: macOS
publishTaskPrefix: ''

- template: /eng/pipelines/arcade/stage-integration-tests.yml@self
parameters:
stageDependsOn: Pack
publishTaskPrefix: ''
jobMatrix:
- name: win_sample_tests
pool: ${{ parameters.VM_IMAGE_HOST }}
timeout: 120
testCategory: Samples
- name: mac_sample_tests
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
os: macOS
timeout: 120
testCategory: Samples

- name: win_wintemplate_tests
pool: ${{ parameters.VM_IMAGE_HOST }}
timeout: 120
testCategory: WindowsTemplates
- name: mac_wintemplate_tests
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
os: macOS
timeout: 120
testCategory: WindowsTemplates

- name: win_buildtemplate_tests
pool: ${{ parameters.VM_IMAGE_HOST }}
timeout: 120
testCategory: Build
- name: mac_buildtemplate_tests
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
os: macOS
timeout: 120
testCategory: Build

- name: win_blazortemplate_tests
pool: ${{ parameters.VM_IMAGE_HOST }}
timeout: 120
testCategory: Blazor
- name: mac_blazortemplate_tests
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
os: macOS
timeout: 120
testCategory: Blazor

- name: win_multitemplate_tests
pool: ${{ parameters.VM_IMAGE_HOST }}
timeout: 120
testCategory: MultiProject
- name: mac_multitemplate_tests
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
os: macOS
timeout: 120
testCategory: MultiProject

# TODO: macOSTemplates and AOT template categories

- name: mac_runandroid_tests
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
os: macOS
timeout: 180
testCategory: RunOnAndroid

- name: mac_runios_tests
pool:
name: Azure Pipelines
vmImage: $(HostedMacImage)
os: macOS
timeout: 180
testCategory: RunOniOS
2 changes: 1 addition & 1 deletion eng/pipelines/common/provision.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ steps:
xcrun xcode-select --print-path
xcodebuild -version
sudo xcodebuild -license accept
sudo xcodebuild -downloadAllPlatforms
sudo xcodebuild -downloadPlatform iOS
sudo xcodebuild -runFirstLaunch
displayName: Select Xcode Version
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
Expand Down
20 changes: 20 additions & 0 deletions eng/pipelines/common/setup-android-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
parameters:
mauiSourcePath: $(Build.SourcesDirectory)
repoLogPath: $(Build.Arcade.LogsPath)
androidSdkRoot: $(ANDROID_SDK_ROOT)

steps:
- template: /eng/pipelines/common/run-dotnet-preview.yml
parameters:
displayName: Create temporary android project
mauiSourcePath: ${{ parameters.mauiSourcePath }}
command: new
arguments: android -o $(Agent.TempDirectory)/TempDroid

- template: /eng/pipelines/common/run-dotnet-preview.yml
parameters:
displayName: Install android dependencies
mauiSourcePath: ${{ parameters.mauiSourcePath }}
project: $(Agent.TempDirectory)/TempDroid/TempDroid.csproj
arguments: '-t:InstallAndroidDependencies -p:AndroidSdkDirectory=${{ parameters.androidSdkRoot }} -p:AcceptAndroidSdkLicenses=true -v:n -bl:${{ parameters.repoLogPath }}/install-android-dependencies.binlog'
retryCountOnTaskFailure: 3
2 changes: 1 addition & 1 deletion eng/pipelines/common/variables.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ variables:
)]
# Common Agent Pools in use
- name: HostedMacImage
value: macOS-14
value: macOS-15
- name: HostedWindowsImage
value: windows-2022
- name: LogDirectory
Expand Down
9 changes: 6 additions & 3 deletions src/Compatibility/Core/src/iOS/ContextActionCell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,18 @@ void ActivateMore()
if (controller == null)
throw new InvalidOperationException("No UIViewController found to present.");

if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone)
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone || (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad && actionSheet.PopoverPresentationController == null))
{
var cancel = UIAlertAction.Create(StringResources.Cancel, UIAlertActionStyle.Cancel, null);
actionSheet.AddAction(cancel);
}
else
{
actionSheet.PopoverPresentationController.SourceView = _tableView;
actionSheet.PopoverPresentationController.SourceRect = sourceRect;
if (actionSheet.PopoverPresentationController != null)
{
actionSheet.PopoverPresentationController.SourceView = _tableView;
actionSheet.PopoverPresentationController.SourceRect = sourceRect;
}
}

controller.PresentViewController(actionSheet, true, null);
Expand Down
15 changes: 11 additions & 4 deletions src/Compatibility/Core/src/iOS/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -518,17 +518,24 @@ static void PresentPopUp(UIWindow window, UIAlertController alert, ActionSheetAr
{
UIDevice.CurrentDevice.BeginGeneratingDeviceOrientationNotifications();
var observer = NSNotificationCenter.DefaultCenter.AddObserver(UIDevice.OrientationDidChangeNotification,
n => { alert.PopoverPresentationController.SourceRect = window.RootViewController.View.Bounds; });
n =>
{
if (alert.PopoverPresentationController != null)
alert.PopoverPresentationController.SourceRect = window.RootViewController.View.Bounds;
});

arguments.Result.Task.ContinueWith(t =>
{
NSNotificationCenter.DefaultCenter.RemoveObserver(observer);
UIDevice.CurrentDevice.EndGeneratingDeviceOrientationNotifications();
}, TaskScheduler.FromCurrentSynchronizationContext());

alert.PopoverPresentationController.SourceView = window.RootViewController.View;
alert.PopoverPresentationController.SourceRect = window.RootViewController.View.Bounds;
alert.PopoverPresentationController.PermittedArrowDirections = 0; // No arrow
if (alert.PopoverPresentationController != null)
{
alert.PopoverPresentationController.SourceView = window.RootViewController.View;
alert.PopoverPresentationController.SourceRect = window.RootViewController.View.Bounds;
alert.PopoverPresentationController.PermittedArrowDirections = 0; // No arrow
}
}

window.RootViewController.PresentViewController(alert, true, null);
Expand Down
Loading

0 comments on commit 19d79a6

Please sign in to comment.