From 72aae8e508e6bd10300a76aadaf8115eee84de8b Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Wed, 8 Jan 2025 13:10:42 -0500 Subject: [PATCH 1/2] [Mono.Android] Generate API docs for API level 35 (#9647) Changes: https://github.com/dotnet/java-interop/compare/2a1e180086889a33c844e337a865093ab65193e7...03cb8e258735a5e0b8a5c703832639fb6b65f3c7 * dotnet/java-interop@03cb8e25: [Java.Interop.Tools.JavaSource] Support html tags with attributes Bump to dotnet/java-interop@03cb8e25 to get Javadoc import fixes. Updates xaprepare and Mono.Android to generate API Docs against API-35 sources. The `azure-pipelines-apidocs.yaml` pipeline has been updated to use the 1ES pipeline template to improve compatibility with existing yaml templates. The semi-automated API docs build and update workflow uses the .NET Framework version of Mdoc and the `RunMdoc` target has been updated to continue to mirror that workflow. --- .../automation/azure-pipelines-apidocs.yaml | 245 ++++++++++-------- .../Dependencies/AndroidToolchain.cs | 6 +- external/Java.Interop | 2 +- src/Mono.Android/Mono.Android.targets | 14 +- 4 files changed, 143 insertions(+), 124 deletions(-) diff --git a/build-tools/automation/azure-pipelines-apidocs.yaml b/build-tools/automation/azure-pipelines-apidocs.yaml index 6a17eedcdfc..e568abf1004 100644 --- a/build-tools/automation/azure-pipelines-apidocs.yaml +++ b/build-tools/automation/azure-pipelines-apidocs.yaml @@ -8,6 +8,13 @@ trigger: none pr: none +resources: + repositories: + - repository: 1esPipelines + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + parameters: - name: apiLevel displayName: AndroidApiLevel property value @@ -50,118 +57,130 @@ variables: value: '' -stages: -- stage: mac_build - displayName: Build - dependsOn: [] - jobs: - - job: mac_build_update_docs - displayName: Update API Docs - pool: - name: VSEng-VSMac-Xamarin-Shared - demands: - - macOS.Name -equals Ventura - - macOS.Architecture -equals x64 - timeoutInMinutes: 120 - workspace: - clean: all - steps: - - checkout: self - submodules: recursive - - - script: echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/android-toolchain/jdk-17" - displayName: set JI_JAVA_HOME - - # Set MSBuild property overrides if parameters are set - - ${{ if ne(parameters.apiLevel, 'default') }}: - - script: echo "##vso[task.setvariable variable=DocsApiLevelArg]-p:DocsApiLevel=${{ parameters.apiLevel }}" - displayName: set DocsApiLevelArg - - - ${{ if ne(parameters.platformId, 'default') }}: - - script: echo "##vso[task.setvariable variable=DocsPlatformIdArg]-p:DocsPlatformId=${{ parameters.platformId }}" - displayName: set DocsPlatformIdArg - - - ${{ if ne(parameters.frameworkVersion, 'default') }}: - - script: echo "##vso[task.setvariable variable=DocsFxVersionArg]-p:DocsFxVersion=${{ parameters.frameworkVersion }}" - displayName: set DocsFxVersionArg - - - ${{ if ne(parameters.mdocVersion, 'default') }}: - - script: echo "##vso[task.setvariable variable=MdocPackageVersionArg]-p:MdocPackageVersion=${{ parameters.mdocVersion }}" - displayName: set MdocPackageVersionArg - - - ${{ if ne(parameters.javadocVerbosity, 'default') }}: - - script: echo "##vso[task.setvariable variable=AndroidJavadocVerbosity]-p:AndroidJavadocVerbosity=${{ parameters.javadocVerbosity }}" - displayName: set AndroidJavadocVerbosity - - - template: yaml-templates/use-dot-net.yaml - - - task: NuGetAuthenticate@1 - displayName: authenticate with azure artifacts - inputs: - forceReinstallCredentialProvider: true - - - template: yaml-templates/run-xaprepare.yaml - parameters: - displayName: update mono - arguments: --s=UpdateMono - - - script: make prepare CONFIGURATION=$(XA.Build.Configuration) PREPARE_CI=1 PREPARE_AUTOPROVISION=1 - workingDirectory: $(Build.SourcesDirectory) - displayName: make prepare - - - script: >- - make update-api-docs CONFIGURATION=$(XA.Build.Configuration) - MSBUILD_ARGS='$(DocsApiLevelArg) $(DocsPlatformIdArg) $(DocsFxVersionArg) $(MdocPackageVersionArg) $(AndroidJavadocVerbosity)' - workingDirectory: $(Build.SourcesDirectory) - displayName: make update-api-docs - - - script: > - mkdir -p $(Build.StagingDirectory)/docs-binaries && - ln $(Build.SourcesDirectory)/bin/$(XA.Build.Configuration)/lib/xamarin.android/xbuild-frameworks/Microsoft.Android/34/*.dll $(Build.StagingDirectory)/docs-binaries/ && - ln $(Build.SourcesDirectory)/bin/$(XA.Build.Configuration)/lib/xamarin.android/xbuild-frameworks/Microsoft.Android/34/*.xml $(Build.StagingDirectory)/docs-binaries/ - displayName: copy docs files - - - task: PublishPipelineArtifact@1 - displayName: upload docs files - inputs: - artifactName: Binaries - targetPath: $(Build.StagingDirectory)/docs-binaries - - - script: > - mkdir -p $(Build.StagingDirectory)/api-doc-diff && - ln $(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)/UpdateApiDocs*.diff $(Build.StagingDirectory)/api-doc-diff/ - displayName: copy api docs diff - - - task: PublishPipelineArtifact@1 - displayName: upload api docs diff - inputs: - artifactName: Api Docs Diff - targetPath: $(Build.StagingDirectory)/api-doc-diff - - - template: yaml-templates/upload-results.yaml - parameters: - artifactName: Build Results - API Docs Update - includeBuildResults: true - condition: always() - - - powershell: | - $docsUpdateBinlog = Get-ChildItem -Path "$(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)" -Filter *UpdateApiDocs-*.binlog | Select-Object -First 1 - $buildLog = "$(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)/temp-build.log" - & "$(Build.SourcesDirectory)/bin/$(XA.Build.Configuration)/dotnet/dotnet" build $docsUpdateBinlog > $buildLog - - $issueContent = & { - Get-Content -Path $buildLog | Select-String "## Exception translating remarks" - Get-Content -Path $buildLog | Select-String "## Unable to translate remarks" - Get-Content -Path $buildLog | Select-String "JavadocImport-" - } - - if ($issueContent) { - Write-Host "The following issues were found, review the build log for more details:" - Write-Host "" - foreach ($line in $issueContent) { - Write-Host $line +extends: + ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: + template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines + ${{ else }}: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1esPipelines + parameters: + sdl: + sourceAnalysisPool: + name: AzurePipelines-EO + image: $(WindowsPoolImage1ESPT) + os: windows + suppression: + suppressionFile: $(Build.SourcesDirectory)\.gdn\.gdnsuppress + stages: + - stage: mac_build + displayName: Build + dependsOn: [] + jobs: + - job: mac_build_update_docs + displayName: Update API Docs + pool: + name: $(SharedMacPool) + demands: + - macOS.Name -equals $(SharedMacName) + - Agent.OSArchitecture -equals $(SharedMacArch) + os: macOS + timeoutInMinutes: 120 + workspace: + clean: all + templateContext: + outputs: + - output: pipelineArtifact + displayName: upload docs binaries + artifactName: Binaries + targetPath: $(Build.SourcesDirectory)/src/Mono.Android/obj/docs-gen-temp + - output: pipelineArtifact + displayName: upload docs diff + artifactName: Api Docs Diff + targetPath: $(Build.StagingDirectory)/api-doc-diff + steps: + - checkout: self + submodules: recursive + + - script: | + echo "##vso[task.setvariable variable=JI_JAVA_HOME]$HOME/android-toolchain/jdk-17" + echo "##vso[task.setvariable variable=JAVA_HOME]$HOME/android-toolchain/jdk-17" + displayName: set JI_JAVA_HOME + + # Set MSBuild property overrides if parameters are set + - ${{ if ne(parameters.apiLevel, 'default') }}: + - script: echo "##vso[task.setvariable variable=DocsApiLevelArg]-p:DocsApiLevel=${{ parameters.apiLevel }}" + displayName: set DocsApiLevelArg + + - ${{ if ne(parameters.platformId, 'default') }}: + - script: echo "##vso[task.setvariable variable=DocsPlatformIdArg]-p:DocsPlatformId=${{ parameters.platformId }}" + displayName: set DocsPlatformIdArg + + - ${{ if ne(parameters.frameworkVersion, 'default') }}: + - script: echo "##vso[task.setvariable variable=DocsFxVersionArg]-p:DocsFxVersion=${{ parameters.frameworkVersion }}" + displayName: set DocsFxVersionArg + + - ${{ if ne(parameters.mdocVersion, 'default') }}: + - script: echo "##vso[task.setvariable variable=MdocPackageVersionArg]-p:MdocPackageVersion=${{ parameters.mdocVersion }}" + displayName: set MdocPackageVersionArg + + - ${{ if ne(parameters.javadocVerbosity, 'default') }}: + - script: echo "##vso[task.setvariable variable=AndroidJavadocVerbosity]-p:AndroidJavadocVerbosity=${{ parameters.javadocVerbosity }}" + displayName: set AndroidJavadocVerbosity + + - template: /build-tools/automation/yaml-templates/use-dot-net.yaml@self + + - task: NuGetAuthenticate@1 + displayName: authenticate with azure artifacts + inputs: + forceReinstallCredentialProvider: true + + - script: dotnet tool update -v:n boots --version 1.1.0.36 --add-source "https://api.nuget.org/v3/index.json" --global + displayName: Install boots + + - script: boots https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.188.macos10.xamarin.universal.pkg + displayName: Install Mono + + - script: make prepare CONFIGURATION=$(XA.Build.Configuration) PREPARE_CI=1 PREPARE_AUTOPROVISION=1 + workingDirectory: $(Build.SourcesDirectory) + displayName: make prepare + + - script: >- + make update-api-docs CONFIGURATION=$(XA.Build.Configuration) + MSBUILD_ARGS='$(DocsApiLevelArg) $(DocsPlatformIdArg) $(DocsFxVersionArg) $(MdocPackageVersionArg) $(AndroidJavadocVerbosity)' + workingDirectory: $(Build.SourcesDirectory) + displayName: make update-api-docs + + - script: > + mkdir -p $(Build.StagingDirectory)/api-doc-diff && + ln $(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)/UpdateApiDocs*.diff $(Build.StagingDirectory)/api-doc-diff/ && + ln $(Build.SourcesDirectory)/external/android-api-docs/docs/xml/index.xml $(Build.StagingDirectory)/api-doc-diff/ + displayName: copy api docs diff + + - template: /build-tools/automation/yaml-templates/upload-results.yaml@self + parameters: + artifactName: Build Results - API Docs Update + includeBuildResults: true + condition: always() + + - powershell: | + $docsUpdateBinlog = Get-ChildItem -Path "$(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)" -Filter *UpdateApiDocs-*.binlog | Select-Object -First 1 + $buildLog = "$(Build.SourcesDirectory)/bin/Build$(XA.Build.Configuration)/temp-UpdateApiDocs-build.log" + & "$(Build.SourcesDirectory)/bin/$(XA.Build.Configuration)/dotnet/dotnet" build $docsUpdateBinlog > $buildLog + + $issueContent = & { + Get-Content -Path $buildLog | Select-String "## Exception translating remarks" -Context 0, 3 + Get-Content -Path $buildLog | Select-String "## Unable to translate remarks" -Context 0, 3 + Get-Content -Path $buildLog | Select-String "JavadocImport-" -Context 0, 3 + } + + if ($issueContent) { + Write-Host "The following issues were found, review the build log for more details:" Write-Host "" + foreach ($line in $issueContent) { + Write-Host $line + Write-Host "" + } + exit 1 } - exit 1 - } - displayName: Report issues in docs generation + Write-Host "No issues found." + displayName: Report issues in docs generation + continueOnError: true diff --git a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs index 72a9498277c..6e93ebc3263 100644 --- a/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs +++ b/build-tools/xaprepare/xaprepare/ConfigAndData/Dependencies/AndroidToolchain.cs @@ -73,11 +73,11 @@ public AndroidToolchain () new AndroidPlatformComponent ("platform-34-ext7_r02", apiLevel: "34", pkgRevision: "2"), new AndroidPlatformComponent ("platform-35_r01", apiLevel: "35", pkgRevision: "1", isLatestStable: true), - new AndroidToolchainComponent ("sources-34_r01", - destDir: Path.Combine ("sources", "android-34"), + new AndroidToolchainComponent ("source-35_r01", + destDir: Path.Combine ("sources", "android-35"), pkgRevision: "1", dependencyType: AndroidToolchainComponentType.BuildDependency, - buildToolVersion: "34.1" + buildToolVersion: "35.1" ), new AndroidToolchainComponent ("docs-24_r01", destDir: "docs", diff --git a/external/Java.Interop b/external/Java.Interop index 2a1e1800868..03cb8e25873 160000 --- a/external/Java.Interop +++ b/external/Java.Interop @@ -1 +1 @@ -Subproject commit 2a1e180086889a33c844e337a865093ab65193e7 +Subproject commit 03cb8e258735a5e0b8a5c703832639fb6b65f3c7 diff --git a/src/Mono.Android/Mono.Android.targets b/src/Mono.Android/Mono.Android.targets index 9b437c6e742..2f3093bd6c2 100644 --- a/src/Mono.Android/Mono.Android.targets +++ b/src/Mono.Android/Mono.Android.targets @@ -238,12 +238,15 @@ - 34 + 35 $(DocsApiLevel) net-android-$(DocsApiLevel).0 $(_MonoAndroidNETDefaultOutDir)Mono.Android.xml <_ExternalDocsRoot>$(XamarinAndroidSourcePath)external/android-api-docs/docs/xml <_LogPrefix>$(MSBuildThisFileDirectory)../../bin/Build$(Configuration)/UpdateApiDocs-$([System.DateTime]::Now.ToString ("yyyyMMddTHHmmss")) + <_ManagedRuntime Condition=" !$([MSBuild]::IsOSPlatform('windows')) ">mono + <_MdocExe Condition=" '$(Pkgmdoc)' != '' ">"$(Pkgmdoc)/tools/net471/mdoc.exe" + <_MdocExe Condition=" '$(Pkgmdoc)' == '' ">"$(XAPackagesDir)/mdoc/$(MdocPackageVersion)/tools/net471/mdoc.exe" <_Mdoc Condition=" '$(Pkgmdoc)' != '' ">"$(Pkgmdoc)/tools/net6.0/mdoc.dll" <_Mdoc Condition=" '$(Pkgmdoc)' == '' ">"$(XAPackagesDir)/mdoc/$(MdocPackageVersion)/tools/net6.0/mdoc.dll" @@ -270,6 +273,7 @@ /> + - From b369b0b888443b30df3867626b728fceaabd19c6 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Fri, 8 Nov 2024 09:29:00 -0800 Subject: [PATCH 2/2] [ci] Upgrade on-prem macOS pool to macOS-14 Sonoma (#9477) Build and test stages using the physical macOS pool have been updated to use macOS-14 Sonoma images, and builds will now prefer Apple silicon over Intel machines. --- .../automation/azure-pipelines-nightly.yaml | 14 +++++++------- .../automation/yaml-templates/build-macos.yaml | 6 +++--- .../yaml-templates/run-emulator-tests.yaml | 4 ++-- .../yaml-templates/run-msbuild-tests.yaml | 2 +- .../automation/yaml-templates/variables.yaml | 6 ++++++ 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/build-tools/automation/azure-pipelines-nightly.yaml b/build-tools/automation/azure-pipelines-nightly.yaml index 65a7cea6d8a..a6c89bbf41f 100644 --- a/build-tools/automation/azure-pipelines-nightly.yaml +++ b/build-tools/automation/azure-pipelines-nightly.yaml @@ -41,10 +41,10 @@ stages: - job: mac_build_create_installers displayName: macOS > Create Installers pool: - name: VSEng-VSMac-Xamarin-Shared + name: $(SharedMacPool) demands: - - macOS.Name -equals Ventura - - macOS.Architecture -equals x64 + - macOS.Name -equals $(SharedMacName) + - Agent.OSArchitecture -equals $(SharedMacArch) timeoutInMinutes: 420 workspace: clean: all @@ -185,9 +185,9 @@ stages: strategy: parallel: 3 pool: - name: VSEng-VSMac-Xamarin-Shared + name: $(SharedMacPool) demands: - - macOS.Name -equals Ventura + - macOS.Name -equals $(SharedMacName) - macOS.Architecture -equals x64 timeoutInMinutes: 120 workspace: @@ -241,9 +241,9 @@ stages: strategy: parallel: 6 pool: - name: VSEng-VSMac-Xamarin-Shared + name: $(SharedMacPool) demands: - - macOS.Name -equals Ventura + - macOS.Name -equals $(SharedMacName) - macOS.Architecture -equals x64 timeoutInMinutes: 150 workspace: diff --git a/build-tools/automation/yaml-templates/build-macos.yaml b/build-tools/automation/yaml-templates/build-macos.yaml index c279a6752ba..0a29943c4d8 100644 --- a/build-tools/automation/yaml-templates/build-macos.yaml +++ b/build-tools/automation/yaml-templates/build-macos.yaml @@ -29,10 +29,10 @@ stages: displayName: ${{ parameters.jobDisplayName }} pool: ${{ if or(eq(variables['Build.DefinitionName'], 'Xamarin.Android-PR'), eq(variables['Build.DefinitionName'], 'Xamarin.Android Nightly')) }}: - name: VSEng-VSMac-Xamarin-Shared + name: $(SharedMacPool) demands: - - macOS.Name -equals Ventura - - macOS.Architecture -equals x64 + - macOS.Name -equals $(SharedMacName) + - Agent.OSArchitecture -equals $(SharedMacArch) ${{ else }}: name: Azure Pipelines vmImage: $(HostedMacImage) diff --git a/build-tools/automation/yaml-templates/run-emulator-tests.yaml b/build-tools/automation/yaml-templates/run-emulator-tests.yaml index e3bac786ce3..cffa60b6b04 100644 --- a/build-tools/automation/yaml-templates/run-emulator-tests.yaml +++ b/build-tools/automation/yaml-templates/run-emulator-tests.yaml @@ -12,9 +12,9 @@ jobs: - job: mac_${{ parameters.jobName }}_tests displayName: ${{ parameters.jobName }} Emulator Tests pool: - name: VSEng-VSMac-Xamarin-Shared + name: $(SharedMacPool) demands: - - macOS.Name -equals Ventura + - macOS.Name -equals $(SharedMacName) - macOS.Architecture -equals x64 timeoutInMinutes: ${{ parameters.jobTimeout }} workspace: diff --git a/build-tools/automation/yaml-templates/run-msbuild-tests.yaml b/build-tools/automation/yaml-templates/run-msbuild-tests.yaml index 98dbce3f8bc..7853353e798 100644 --- a/build-tools/automation/yaml-templates/run-msbuild-tests.yaml +++ b/build-tools/automation/yaml-templates/run-msbuild-tests.yaml @@ -23,7 +23,7 @@ jobs: ${{ if eq(parameters.testOS, 'macOS') }}: pool: name: Azure Pipelines - vmImage: $(HostedMacImage) + image: $(HostedMacImage) os: macOS timeoutInMinutes: 240 cancelTimeoutInMinutes: 5 diff --git a/build-tools/automation/yaml-templates/variables.yaml b/build-tools/automation/yaml-templates/variables.yaml index efddd45ffab..c80f03fdc94 100644 --- a/build-tools/automation/yaml-templates/variables.yaml +++ b/build-tools/automation/yaml-templates/variables.yaml @@ -31,6 +31,12 @@ variables: value: $(github--pat--vs-mobiletools-engineering-service2) - name: HostedMacImage value: macOS-14 +- name: SharedMacPool + value: VSEng-VSMac-Xamarin-Shared +- name: SharedMacName + value: Sonoma +- name: SharedMacArch + value: arm64 - name: HostedWinImage value: windows-2022 - name: WindowsPoolImage1ESPT