Skip to content

Commit 5f9aab0

Browse files
[build] fix MAUI Integration job (#10036)
This is a list of things I fixed... ~~ dotnet/arcade tasks require .NET 10 ~~ The `MAUI Integration` job looks to be failing, because we are building with a .NET 9 SDK: C:\Users\cloudtest\.nuget\packages\microsoft.dotnet.arcade.sdk\10.0.0-beta.25212.1\tools\RepositoryValidation.proj(33,5): error MSB4018: The "Microsoft.DotNet.Arcade.Sdk.GetLicenseFilePath" task failed unexpectedly. System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. File name: 'System.Runtime, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' at Microsoft.DotNet.Arcade.Sdk.GetLicenseFilePath.ExecuteImpl() at Microsoft.DotNet.Arcade.Sdk.GetLicenseFilePath.Execute() in /_/src/Microsoft.DotNet.Arcade.Sdk/src/GetLicenseFilePath.cs:line 32 at Microsoft.Build.BackEnd.TaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) Earlier in the log says: MSBuild executable path = "C:\Program Files\dotnet\sdk\9.0.202\MSBuild.dll" Lets try .NET 10 and see if the problem goes away. The fact we previously had `dotnetQuality: preview` in the yaml: - template: /build-tools/automation/yaml-templates/setup-test-environment.yaml@self parameters: xaSourcePath: $(Build.SourcesDirectory)/android androidSdkPlatforms: $(DefaultTestSdkPlatforms) dotnetVersion: 9.0 dotnetQuality: preview This means we were using a preview version of .NET 9 while .NET 9 was in development. Makes sense to move to .NET 10 now. ~~ Missing logs ~~ When investigating the failures here, I noticed the `Copy logs` step would say: found 0 files I added an additional path: $(Build.SourcesDirectory)/android/bin/*$(XA.Build.Configuration)/*.*log ~~ Java fails to install ~~ `xaprepare` was failing to accept Android SDK licenses, due to: ERROR: JAVA_HOME is set to an invalid directory: C:\Users\cloudtest\android-toolchain\jdk-21 Please set the JAVA_HOME variable in your environment to match the location of your Java installation. We had code checking `$(JavaSdkDirectory)` which looked to be blank, then we fall back to: var androidToolchainDirectory = Context.Instance.Properties.GetValue (KnownProperties.AndroidToolchainDirectory)?.Trim () ?? String.Empty; JavaHome = Path.Combine (androidToolchainDirectory, Configurables.Defaults.JdkFolder); Earlier in the build, we have a step that sets: set JAVA_HOME and JI_JAVA_HOME Setting variable 'JI_JAVA_HOME_DEFAULT' to 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\17.0.14-7\x64' Setting variable 'JAVA_HOME' and 'JI_JAVA_HOME' to 'C:\hostedtoolcache\windows\Java_Temurin-Hotspot_jdk\17.0.14-7\x64' I updated `OS.cs` to look at `$JI_JAVA_HOME` first, which appears to use the right path now. ~~ `dotnet.exe` not found ~~ Next we got the error: The term 'C:\a_work\1\s\bin\Release\dotnet\dotnet.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. The path above is missing `s\android\bin\Release\dotnet\dotnet.exe`, where I noticed we were missing this in one yaml template: xaSourcePath: ${{ parameters.xaSourcePath }}
1 parent 1be3e2a commit 5f9aab0

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ extends:
137137
parameters:
138138
xaSourcePath: $(Build.SourcesDirectory)/android
139139
androidSdkPlatforms: $(DefaultTestSdkPlatforms)
140-
dotnetVersion: 9.0
141-
dotnetQuality: preview
140+
dotnetVersion: $(DotNetPreviewSdkVersion)
141+
dotnetQuality: $(DotNetPreviewSdkQuality)
142142

143143
- task: NuGetAuthenticate@1
144144
displayName: authenticate with azure artifacts
@@ -230,6 +230,7 @@ extends:
230230
condition: always()
231231
inputs:
232232
Contents: |
233+
$(Build.SourcesDirectory)/android/bin/*$(XA.Build.Configuration)/*.*log
233234
$(Build.SourcesDirectory)/maui/artifacts/logs/**
234235
TargetFolder: $(Build.StagingDirectory)/logs
235236
flattenFolders: true
@@ -346,11 +347,10 @@ extends:
346347
clean: true
347348
submodules: recursive
348349

349-
- task: UseDotNet@2
350-
displayName: Install .NET 10.x
351-
inputs:
352-
version: 10.x
353-
includePreviewVersions: true
350+
- template: /build-tools/automation/yaml-templates/use-dot-net.yaml@self
351+
parameters:
352+
version: $(DotNetPreviewSdkVersion)
353+
quality: $(DotNetPreviewSdkQuality)
354354

355355
# Download symbols to be published to the symbols artifact drop declared above
356356
- task: DownloadPipelineArtifact@2

build-tools/automation/yaml-templates/setup-test-environment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ steps:
7575
- template: /build-tools/automation/yaml-templates/run-dotnet-preview.yaml
7676
parameters:
7777
displayName: extract workload packs
78+
xaSourcePath: ${{ parameters.xaSourcePath }}
7879
project: ${{ parameters.xaSourcePath }}/build-tools/create-packs/Microsoft.Android.Sdk.proj
7980
arguments: -t:ExtractWorkloadPacks -c ${{ parameters.configuration }} -v:n -bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/extract-workloads.binlog
8081

build-tools/automation/yaml-templates/variables.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ variables:
2727
value: 9.0
2828
- name: DotNetSdkQuality
2929
value: GA
30+
- name: DotNetPreviewSdkVersion
31+
value: 10.0
32+
- name: DotNetPreviewSdkQuality
33+
value: preview
3034
- name: GitHub.Token
3135
value: $(github--pat--vs-mobiletools-engineering-service2)
3236
- name: HostedMacImage

build-tools/xaprepare/xaprepare/OperatingSystems/OS.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ abstract class OS : AppObject
134134
/// </summary>
135135
protected virtual bool InitOS ()
136136
{
137-
JavaHome = Context.Instance.Properties.GetValue (KnownProperties.JavaSdkDirectory)?.Trim () ?? String.Empty;
137+
JavaHome = Environment.GetEnvironmentVariable ("JI_JAVA_HOME") ?? String.Empty;
138+
if (string.IsNullOrEmpty (JavaHome)) {
139+
JavaHome = Context.Instance.Properties.GetValue (KnownProperties.JavaSdkDirectory)?.Trim () ?? String.Empty;
140+
}
138141
if (String.IsNullOrEmpty (JavaHome)) {
139142
var androidToolchainDirectory = Context.Instance.Properties.GetValue (KnownProperties.AndroidToolchainDirectory)?.Trim () ?? String.Empty;
140143
JavaHome = Path.Combine (androidToolchainDirectory, Configurables.Defaults.JdkFolder);

0 commit comments

Comments
 (0)