Skip to content

[build] fix MAUI Integration job #10036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025
Merged

Conversation

jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Apr 15, 2025

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

Android SDK licenses fail

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 }}

@jonathanpeppers
Copy link
Member Author

It works!

image

Going to rebase and cleanup the commit messages, etc.

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 }}
@jonathanpeppers jonathanpeppers force-pushed the dev/peppers/maui-integration-lane branch from b0dc07a to 412fdf0 Compare April 17, 2025 18:13
@jonathanpeppers jonathanpeppers marked this pull request as ready for review April 17, 2025 18:15
@jonathanpeppers jonathanpeppers enabled auto-merge (squash) April 17, 2025 20:01
@pjcollins pjcollins disabled auto-merge April 17, 2025 21:19
@pjcollins pjcollins merged commit 5f9aab0 into main Apr 17, 2025
57 of 59 checks passed
@pjcollins pjcollins deleted the dev/peppers/maui-integration-lane branch April 17, 2025 21:20
@github-actions github-actions bot locked and limited conversation to collaborators May 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants