This logic was intented to zip up the .NET unit tests to run them on Windows,
but in the end we went with a different approach that doesn't require zipping.
This isn't very user friendly:
ILLink : unknown error IL7000: An error occurred while executing the custom linker steps. Please review the build log for more information.
ILLINK : error MT0073: Microsoft.iOS 18.0.8337 does not support a deployment target of 10.0 for iOS (the minimum is 11.0). Please select a newer deployment target in your project's Info.plist or change the SupportedOSPlatformVersion property in your project file.
ILLINK : error MT2301: The linker step 'Setup' failed during processing: Microsoft.iOS 18.0.8337 does not support a deployment target of 10.0 for iOS (the minimum is 11.0). Please select a newer deployment target in your project's Info.plist or change the SupportedOSPlatformVersion property in your project file.
[...]/packages/microsoft.net.illink.tasks/8.0.8/build/Microsoft.NET.ILLink.targets(87,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false.
So improve this to only show a single error message:
The SupportedOSPlatformVersion value '10.0' in the project file is lower than the minimum value '11.0'.
Fixes https://github.com/xamarin/xamarin-macios/issues/21368.
We still need some of the source files from the legacy Mono library, but it's
only a few files, so just add them to the git repo.
Also implement caching of the .NET download, which speeds up clean rebuilds
significantly.
Note: all the files in the `builds/mono-ios-sdk-destdir` are a straight import
from the Mono archive, so those shouldn't need much reviewing (nor will I
change them unless absolutely necessary).
This is another step towards removing Mono.
This required a few changes:
* Nullability updates in test code.
* Explicitly sorted list of strings in a warning message, to make the warning text stable.
* Stopped allowing the test assemblies to see internals of the task assembly. This was necessary for to solve a problem with duplicate types:
* The netstandard2.0 version of `System.Reflection.Metadata.dll` contains
the `UnconditionalSuppressMessageAttribute` type (internally).
* Since we ILMerge the tasks assembly, this type ends up in
Xamarin.iOS.Tasks.dll (internally).
* The test assembly can't be a net472 assembly, because that means using
the netfx/desktop versions of the Microsoft.Build.* assemblies, which
don't work on .NET (they check for Mono, but .NET isn't Mono, so the
check fails and a PlatformNotSupportedException is thrown).
* So I bumped the test assembly to be a net8.0 assembly, but then there's
a conflict between the `UnconditionalSuppressMessageAttribute` shipped
in .NET vs the one in `Xamarin.iOS.Tasks.dll` (because the test assembly
can see the internals of `Xamarin.iOS.Tasks.dll`).
* The fix that _doesn't work_ is to not merge system assemblies in the
`Xamarin.iOS.Tasks.dll` assembly anymore. `Xamarin.iOS.Tasks.Windows.dll`
already does this, but it doesn't work when building remotely.
* The fix that seems to work is to just not allow the test assemblies to
see the internals of the task assembly. This is really an anti-pattern
anyway, so no big loss. This required a few changes (make some API in
the task assembly public, remove some legacy tests that don't apply
anymore in .NET, etc.)
This is another step towards removing Mono.
This required a few changes:
* Nullability updates in test code.
* Explicitly sorted list of strings in a warning message, to make the warning text stable.
* Stopped merging system assemblies in the merged tasks assembly. This was necessary for to solve a problem with duplicate types:
* The netstandard2.0 version of `System.Reflection.Metadata.dll` contains
the `UnconditionalSuppressMessageAttribute` type (internally).
* Since we ILMerge the tasks assembly, this type ends up in
Xamarin.iOS.Tasks.dll (internally).
* The test assembly can't be a net472 assembly, because that means using
the netfx/desktop versions of the Microsoft.Build.* assemblies, which
don't work on .NET (they check for Mono, but .NET isn't Mono, so the
check fails and a PlatformNotSupportedException is thrown).
* So I bumped the test assembly to be a net8.0 assembly, but then there's
a conflict between the `UnconditionalSuppressMessageAttribute` shipped
in .NET vs the one in `Xamarin.iOS.Tasks.dll` (because the test assembly
can see the internals of `Xamarin.iOS.Tasks.dll`).
* The fix that seems to work is to *not* merge system assemblies in the
`Xamarin.iOS.Tasks.dll` assembly. `Xamarin.iOS.Tasks.Windows.dll`
already does this, so hopefully there are no problems on Windows, and on
macOS our tests doesn't reveal any problems.
This is because `EnablePreviewFeatures=true` doesn't quite work, since it
requires the building .NET and the target .NET to be on the same version.
We might want to build with .NET 9, but the Xcode branch is targeting .NET 8,
so it doesn't work.
This behavior is explained here:
https://github.com/dotnet/designs/blob/main/accepted/2021/preview-features/preview-features.md#meaning-of-property-in-multi-targeted-projects
The best solution seems to switch to using the Experimental attribute instead,
which was designed for our scenario (and explicitly to fix the problem we're
running into): bba3216250/accepted/2023/preview-apis/preview-apis.md
This also meant we had to augment `-nowarn` for bgen to:
* Pass any nowarn values to the compiler when bgen compiles stuff.
* Pass `$(NoWarn)` (the MSBuild property) to bgen when building a binding project.
---------
Co-authored-by: Alex Soto <alex@soto.dev>
Our tool to inject documentation for Apple APIs live in maccore, so if that
part of the build isn't enabled, we'll get a lot of false positives.
Instead just ignore the test if the Xamarin bits (in maccore) aren't enabled.
A few facts:
* We very rarely bump Mono (which is really the only time we should run the BCL tests).
* At the moment we're not shipping legacy Xamarin packages from main anymore.
* The BCL tests only apply to legacy Xamarin.
means that there's no need to run the BCL tests on every commit, we can just
run them manually *if* we happen to ever bump Mono again *and* we start
shipping legacy Xamarin packages from main again.
* Convert xharness.csproj and Xharness.Tests.csproj to .NET/sdk-style projects.
* Fix numerous nullability issues that came up.
* Adjust Make logic to do the correct thing now that the executable is named differently.
* Port usage of WebClient to HttpClient, since WebClient is deprecated.
* Find an alternative solution to System.Web.MimeMapping.GetMimeMapping, which
doesn’t exist in .NET.
* Fix misc other warnings and errors.
We're going to change the pack names to support multi-targeting, so ahead
of the pack name change I'm changing the existing logic to use a variable
for the pack name in most places (this will make the rename much easier and
simpler).
These changes should have no effect by themselves.
If only some platforms are enabled, some of the commands to find files to add
to package-test-libraries.zip won't find any files at all.
Asking 'zip' to add no files fails with:
zip error: Nothing to do!
and there's no way to add 'zip' to ignore this error condition.
However, we can instead try to not call zip at all when we don't find any
files, and we do that by using:
"find ... -exec zip"
instead of:
"find .. | zip ..."
Stop building the test dependencies on each test run, and instead use the archived test dependencies we have from the main build:
* Stop running 'make all' in tests/ on every separate test run.
* Add a lot more stuff in the package-test-libraries.zip archive.
* Extract all the new stuff on every test run. We add stuff from outside the tests/
directory, so adjust archive creation and extraction to use the root directory
of the repository as the root of the zip archive as well.
* Also add the introspection dependencies to the same archive to simplify the logic.
* Fix xharness to not store absolute paths in generated projects.
* Fix test project to not automatically run make in tests/test-libraries when running
on the bots.
Building the test dependencies takes ~10 minutes for each test run, so this saves
about that time for each test run.
* Update `SdkVersions.cs` after the latest Xcode 14.2 bump.
* Rename `[SdkVersions|ProductConstants].cs.in` to `[SdkVersions|ProductConstants].in.cs`.
This way the autoformatter makes sure it's formatted correctly.
Hopefully this fixes some of the recurrent build problems where we'd fail to
restore nuget packages.
Ref: https://github.com/xamarin/maccore/issues/2620
I wasn't able to execute ilrepack.exe with .NET, so that continues to be
executed with mono.
* Don't load maccore/mk/versions.mk anymore, which means we're not checking
any subsequent dependencies listed in maccore. Note that we still need the
maccore dependency itself for a little while longer.
* Remove some outdated testing code that called into maccore.
* Don't recurse into the maccore directory during make.
* Remove some code checking for ENABLE_XAMARIN that's not used anymore, in
particular in xharness.
This allows the CI to run ALL the tests that the project has in
parallel. This is divided in two main changes:
1. Xharness - We move away from using boolenas to use a flag that states
the tests to run.
2. yaml - We have move the code to use a template per label. This new
jobs all run in parallel and the results are later collected by a
funel job
3. pwsh - Added a new class that understands that we have several mark
downs with the tests results. The classes parses them and them writes
a single comment (and example can be found here: https://github.com/xamarin/xamarin-macios/pull/15201#issuecomment-1162366240
The changes gives the following advantages vs how we used to run tests:
1. The CI run for all tests moves from taking 13 hours to 3/4 hours
(depending on the number of bots in the pool).
2. The download needed to verify the results on a case of failure is
smaller. Rather than downloading several GBs we now just download
that part of the html that we are interested in.
3. Better bot utlization. Bots are just used to a max of 2 hours, this
means that we can use the bots better since they are fragmented.
4. Less VMs. VSDrops has added support for macOS and Linux, we take
advanges of that here.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
This makes it not necessary to check for the currently selected Xcode in our
system dependency check. It also means it'll become much easier to work with
multiple branches simultaneously where each branch needs its own Xcode.
Make our local .NET the default .NET (in the root's global.json), and then if
a directory wants to use the system .NET, then that directory would have to
opt-in (using its own global.json).
This way we don't have to copy global.json/NuGet.config files around to run
tests with the correct .NET setup.
Ask ditto to thin native libraries and frameworks when copying them to the app
bundle to remove slices for architectures we're not building for.
Also add tests.
Fixes https://github.com/xamarin/xamarin-macios/issues/13081.
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
Also rename DOTNET_VERSION to SYSTEM_DOTNET_VERSION to make it clear what it's
referring to (and to not clash with DOTNET6_VERSION which has now been renamed
to DOTNET_VERSION).
.NET 7 is right around the corner.
This makes it line up with our other make variables (SYSTEM_MSBUILD,
SYSTEM_MONO, SYSTEM_CSC, etc.), and also prepares for removing the version
from the DOTNET6 variable (so that it becomes just DOTNET).
The advantage of writing the label after each test is that the test result will also
be printed, which means it's possible to see if any tests failed during the test
run, as opposed to having to wait until the entire test run is completed (which can
take a while) to realize that pretty much every test failed with some silly mistake
which could have been quickly fixed before re-running the tests.