From 037d2860927a9c1369112fb3fa128430ae107dd5 Mon Sep 17 00:00:00 2001 From: Jonathan Pobst Date: Thu, 11 Jan 2024 14:28:02 -1000 Subject: [PATCH] [ci] Fix remaining permanent CI warnings. (#8595) Fix various CI warnings, such as: Specifying an exact version is not recommended on Microsoft-Hosted agents. Patch versions of Python can be replaced by new ones on Hosted agents without notice, which will cause builds to fail unexpectedly. It is recommended to specify only major or major and minor version (Example: `3` or `3.9`) Fix: only specify `major.minor` as requested. Or [MSB4011][0]: build-tools\scripts\RunTests.targets(3,3): Warning MSB4011: "C:\a\_work\1\s\Directory.Build.props" cannot be imported again. It was already imported at "C:\a\_work\1\s\build-tools\scripts\PrepareWindows.targets(3,3)". This is most likely a build authoring error. This subsequent import will be ignored. build-tools\scripts\RunTests.targets(7,3): Warning MSB4011: "C:\a\_work\1\s\Configuration.props" cannot be imported again. It was already imported at "C:\a\_work\1\s\build-tools\scripts\PrepareWindows.targets(11,3)". This is most likely a build authoring error. This subsequent import will be ignored. tests\api-compatibility\api-compatibility.targets(3,3): Warning MSB4011: "C:\a\_work\1\s\Configuration.props" cannot be imported again. It was already imported at "C:\a\_work\1\s\build-tools\scripts\PrepareWindows.targets(11,3)". This is most likely a build authoring error. This subsequent import will be ignored. Fix: add a flag denoting that we have already imported a project and a `Condition` to prevent duplicate imports. Or [CS8604][1]: build-tools\xaprepare\xaprepare\Application\Context.cs(608,42): Warning CS8604: Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'. Fix: add null check. Or: EXEC(0,0): Warning : dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/9.0.100-alpha.1.23610.1/dotnet-sdk-9.0.100-alpha.1.23610.1-win-x64.zip not found Fix: checking multiple URLs is part of the expected flow; downgrade the message to "info". Or: EXEC(0,0): Warning : Duplicate Third Party Notice 'IronyProject/Irony' (old class: Xamarin.Android.Prepare.XamarinAndroidBuildTasks_IronyProject_Irony_TPN; new class: Xamarin.Android.Prepare.XamarinAndroidToolsAidl_IronyProject_Irony_TPN) Fix: multiple projects may use the same dependencies; downgrade the message to "info". The remaining CI warnings are temporary because our MAUI integration tests are currently failing: ![image](https://github.com/xamarin/xamarin-android/assets/179295/1455637d-3f8d-4582-b5c8-50a23b1b8b25) [0]: https://learn.microsoft.com/visualstudio/msbuild/errors/msb4011 [1]: https://learn.microsoft.com/dotnet/csharp/language-reference/compiler-messages/nullable-warnings#possible-null-assigned-to-a-nonnullable-reference --- Configuration.props | 1 + Directory.Build.props | 1 + .../automation/yaml-templates/install-microbuild-tooling.yaml | 2 +- build-tools/scripts/RunTests.targets | 4 ++-- build-tools/xaprepare/xaprepare/Application/Context.cs | 3 ++- .../xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs | 2 +- .../xaprepare/xaprepare/Steps/Step_ThirdPartyNotices.cs | 2 +- tests/api-compatibility/api-compatibility.targets | 2 +- 8 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Configuration.props b/Configuration.props index 50c66232889..39fbe2b7149 100644 --- a/Configuration.props +++ b/Configuration.props @@ -17,6 +17,7 @@ Condition="Exists('$(MSBuildThisFileDirectory)Configuration.Override.props')" /> + true <_StandardLibraryPath Condition=" '$(TargetFrameworkVersion)' == '' ">$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries('.NETFramework', 'v4.7.2', '')) v4.7.2 diff --git a/Directory.Build.props b/Directory.Build.props index 9a4a134146e..a3e29cb5747 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,7 @@ + true 9.0 net$(DotNetTargetFrameworkVersion) $(DotNetTargetFramework)-android diff --git a/build-tools/automation/yaml-templates/install-microbuild-tooling.yaml b/build-tools/automation/yaml-templates/install-microbuild-tooling.yaml index a57dd9561a1..54fc4e6d6a0 100644 --- a/build-tools/automation/yaml-templates/install-microbuild-tooling.yaml +++ b/build-tools/automation/yaml-templates/install-microbuild-tooling.yaml @@ -11,7 +11,7 @@ steps: - task: UsePythonVersion@0 inputs: - versionSpec: 3.11.x + versionSpec: 3.11 # ESRP signing requires minimum azure client version 2.8.0 - template: azure-tools/az-client-update.yml@yaml-templates diff --git a/build-tools/scripts/RunTests.targets b/build-tools/scripts/RunTests.targets index 5445dab3a85..1542b584483 100644 --- a/build-tools/scripts/RunTests.targets +++ b/build-tools/scripts/RunTests.targets @@ -1,10 +1,10 @@ - + <_TopDir>$(MSBuildThisFileDirectory)..\.. - + diff --git a/build-tools/xaprepare/xaprepare/Application/Context.cs b/build-tools/xaprepare/xaprepare/Application/Context.cs index 811c0294a3d..97b948a6f1e 100644 --- a/build-tools/xaprepare/xaprepare/Application/Context.cs +++ b/build-tools/xaprepare/xaprepare/Application/Context.cs @@ -605,7 +605,8 @@ string GetLogDirectory () void WriteBuildToolsInventoryCsv () { - var inventoryFilePath = Path.Combine (Path.GetDirectoryName (MainLogFilePath), "buildtoolsinventory.csv"); + var mainLogFileDirectory = Path.GetDirectoryName (MainLogFilePath) ?? throw new ArgumentException ("Could not get directory for MainLogFilePath"); + var inventoryFilePath = Path.Combine (mainLogFileDirectory, "buildtoolsinventory.csv"); var lines = new List { "BuildToolName,BuildToolVersion", }; diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs b/build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs index 2ed0adfb120..2767f8fb376 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs @@ -119,7 +119,7 @@ async Task DownloadDotNetArchive (Context context, string archiveDestinati (bool success, ulong size, HttpStatusCode status) = await Utilities.GetDownloadSizeWithStatus (archiveUrl); if (!success) { if (status == HttpStatusCode.NotFound) { - Log.WarningLine ($"dotnet archive URL {archiveUrl} not found"); + Log.InfoLine ($"dotnet archive URL {archiveUrl} not found"); return false; } else { Log.WarningLine ($"Failed to obtain dotnet archive size. HTTP status code: {status} ({(int)status})"); diff --git a/build-tools/xaprepare/xaprepare/Steps/Step_ThirdPartyNotices.cs b/build-tools/xaprepare/xaprepare/Steps/Step_ThirdPartyNotices.cs index 1aa1c2cad04..6b28b261528 100644 --- a/build-tools/xaprepare/xaprepare/Steps/Step_ThirdPartyNotices.cs +++ b/build-tools/xaprepare/xaprepare/Steps/Step_ThirdPartyNotices.cs @@ -172,7 +172,7 @@ void ProcessTPN (SortedDictionary licenses, ThirdPart Log.StatusLine ($" {Context.Instance.Characters.Bullet} Processing: ", tpn.Name, ConsoleColor.Gray, ConsoleColor.White); if (licenses.ContainsKey (tpn.Name)) { - Log.WarningLine ($"Duplicate Third Party Notice '{tpn.Name}' (old class: {licenses [tpn.Name]}; new class: {tpn})"); + Log.InfoLine ($"Duplicate Third Party Notice '{tpn.Name}' (old class: {licenses [tpn.Name]}; new class: {tpn})"); return; } diff --git a/tests/api-compatibility/api-compatibility.targets b/tests/api-compatibility/api-compatibility.targets index 22a05eff7ae..1c2881fd3dc 100644 --- a/tests/api-compatibility/api-compatibility.targets +++ b/tests/api-compatibility/api-compatibility.targets @@ -1,6 +1,6 @@ - +