Skip to content

Commit 037d286

Browse files
authored
[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
1 parent eac0c3a commit 037d286

File tree

8 files changed

+10
-7
lines changed

8 files changed

+10
-7
lines changed

Configuration.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
Condition="Exists('$(MSBuildThisFileDirectory)Configuration.Override.props')"
1818
/>
1919
<PropertyGroup>
20+
<ConfigurationPropsImported>true</ConfigurationPropsImported>
2021
<!-- TFV for all projects, try v4.7.2 but fallback if needed -->
2122
<_StandardLibraryPath Condition=" '$(TargetFrameworkVersion)' == '' ">$([Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries('.NETFramework', 'v4.7.2', ''))</_StandardLibraryPath>
2223
<TargetFrameworkVersion Condition=" '$(TargetFrameworkVersion)' == '' And '$(UsingMicrosoftNETSdk)' != 'true' And '$(_StandardLibraryPath)' != '' ">v4.7.2</TargetFrameworkVersion>

Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project>
22

33
<PropertyGroup>
4+
<DirectoryBuildPropsImported>true</DirectoryBuildPropsImported>
45
<DotNetTargetFrameworkVersion>9.0</DotNetTargetFrameworkVersion>
56
<DotNetTargetFramework>net$(DotNetTargetFrameworkVersion)</DotNetTargetFramework>
67
<DotNetAndroidTargetFramework>$(DotNetTargetFramework)-android</DotNetAndroidTargetFramework>

build-tools/automation/yaml-templates/install-microbuild-tooling.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ steps:
1111

1212
- task: UsePythonVersion@0
1313
inputs:
14-
versionSpec: 3.11.x
14+
versionSpec: 3.11
1515

1616
# ESRP signing requires minimum azure client version 2.8.0
1717
- template: azure-tools/az-client-update.yml@yaml-templates

build-tools/scripts/RunTests.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="RunAllTests" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props'))" />
3+
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props'))" Condition=" '$(DirectoryBuildPropsImported)' != 'true' " />
44
<PropertyGroup>
55
<_TopDir>$(MSBuildThisFileDirectory)..\..</_TopDir>
66
</PropertyGroup>
7-
<Import Project="$(_TopDir)\Configuration.props" />
7+
<Import Project="$(_TopDir)\Configuration.props" Condition=" '$(ConfigurationPropsImported)' != 'true' " />
88
<UsingTask AssemblyFile="$(PrepTasksAssembly)" TaskName="Xamarin.Android.BuildTools.PrepTasks.RunParallelTargets" />
99
<UsingTask AssemblyFile="$(PrepTasksAssembly)" TaskName="Xamarin.Android.BuildTools.PrepTasks.SetEnvironmentVariable" />
1010
<PropertyGroup>

build-tools/xaprepare/xaprepare/Application/Context.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,8 @@ string GetLogDirectory ()
605605

606606
void WriteBuildToolsInventoryCsv ()
607607
{
608-
var inventoryFilePath = Path.Combine (Path.GetDirectoryName (MainLogFilePath), "buildtoolsinventory.csv");
608+
var mainLogFileDirectory = Path.GetDirectoryName (MainLogFilePath) ?? throw new ArgumentException ("Could not get directory for MainLogFilePath");
609+
var inventoryFilePath = Path.Combine (mainLogFileDirectory, "buildtoolsinventory.csv");
609610
var lines = new List<string> {
610611
"BuildToolName,BuildToolVersion",
611612
};

build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ async Task<bool> DownloadDotNetArchive (Context context, string archiveDestinati
119119
(bool success, ulong size, HttpStatusCode status) = await Utilities.GetDownloadSizeWithStatus (archiveUrl);
120120
if (!success) {
121121
if (status == HttpStatusCode.NotFound) {
122-
Log.WarningLine ($"dotnet archive URL {archiveUrl} not found");
122+
Log.InfoLine ($"dotnet archive URL {archiveUrl} not found");
123123
return false;
124124
} else {
125125
Log.WarningLine ($"Failed to obtain dotnet archive size. HTTP status code: {status} ({(int)status})");

build-tools/xaprepare/xaprepare/Steps/Step_ThirdPartyNotices.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ void ProcessTPN (SortedDictionary <string, ThirdPartyNotice> licenses, ThirdPart
172172
Log.StatusLine ($" {Context.Instance.Characters.Bullet} Processing: ", tpn.Name, ConsoleColor.Gray, ConsoleColor.White);
173173

174174
if (licenses.ContainsKey (tpn.Name)) {
175-
Log.WarningLine ($"Duplicate Third Party Notice '{tpn.Name}' (old class: {licenses [tpn.Name]}; new class: {tpn})");
175+
Log.InfoLine ($"Duplicate Third Party Notice '{tpn.Name}' (old class: {licenses [tpn.Name]}; new class: {tpn})");
176176
return;
177177
}
178178

tests/api-compatibility/api-compatibility.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="..\..\Configuration.props" />
3+
<Import Project="..\..\Configuration.props" Condition=" '$(ConfigurationPropsImported)' != 'true' " />
44
<UsingTask AssemblyFile="$(BootstrapTasksAssembly)" TaskName="Xamarin.Android.Tools.BootstrapTasks.Zip" />
55
<Target Name="UpdateMonoAndroidContract">
66
<Error

0 commit comments

Comments
 (0)