List all the assemblies in the app bundle and pass them to MonoVM/CoreCLR's in
the TRUSTED_PLATFORM_ASSEMBLIES initialization property.
This way CoreCLR knows where to find System.Private.CoreLib.dll for fat apps
(it's in the runtimeidentifier-specific subdirectory, and by default CoreCLR
will only look next to libcoreclr.dylib).
Fixes https://github.com/xamarin/xamarin-macios/issues/12265.
* Add support for the interpreter everywhere.
* Add support for the AOT compiler everywhere we didn't support it before,
because the interpreter needs it (at least System.Private.CoreLib.dll must
be AOT-compiled when using the interpreter).
* Do FullAOT compilation on Mac Catalyst/ARM64 if we're not using the
interpreter, since we can't use the JIT.
* Fix monotouch-test to be green on Mac Catalyst/ARM64.
Fixes https://github.com/xamarin/xamarin-macios/issues/11724.
Fixes https://github.com/xamarin/xamarin-macios/issues/11421.
* Move the templates to a common subdirectory.
* Add .NET unit test to verify that all the templates build and that they have
no warnings.
* Modify the template code to:
* Use the UIApplication.Main overload that takes a Type.
* Use top-level statements for the Main method to simplify code.
* Remove a few unnecessary usings.
Partial fix for #12085.
* We need to specify a minimum OS version, because otherwise we'll pick the
latest OS version we support, and at least for macOS, we might very well try
to execute on earlier OS versions, leading to confusing failures like this:
Xamarin.Tests.DotNetProjectTest.BuildAndExecuteNativeReferencesTestApp("NativeDynamicLibraryReferencesApp",MacOSX,"osx-x64"): Contains magic word
Expected: String containing "dc8bd019-bea2-4c86-92dc-dda22e2e6b88"
But was: "dyld: Library not loaded: /System/Library/Frameworks/CHIP.framework/Versions/A/CHIP
Referenced from: /Users/builder/azdo/_work/1/s/xamarin-macios/tests/dotnet/NativeDynamicLibraryReferencesApp/macOS/bin/Debug/net6.0-macos/osx-x64/NativeDynamicLibraryReferencesApp.app/Contents/MacOS/NativeDynamicLibraryReferencesApp
Reason: image not found
* We only need a minimum OS version (for now at least) in the Info.plist, so
remove everything else.
to make sure the latest locally build nuget are used
Also document `make strip-dotnet` as a time-saver to analyze the binary
assemblies produced for dotnet
Also add tests:
* Remove RuntimeIdentifier from a few sample projects. These projects should
continue to build just fine.
* Add tests for invalid RuntimeIdentifiers.
Fixes https://github.com/xamarin/xamarin-macios/issues/10861.
* [tests] Augment the .NET unit tests to verify that more runtime identifiers build.
* [dotnet] Show a better error if the AOT compiler doesn't exist.
* [dotnet] Use the official path for the AOT compiler.
* [dotnet] Use platform-specific templates for WorkloadManifest.json.
* [dotnet] Generate the workload targets before the nupkgs.
This avoids a random build failure when doing parallel make.
* [builds] Install the runtime workloads for iOS and tvOS so that we have the AOT compilers downloaded for our local tests.
* [dotnet] Make the iOS and tvOS workloads load the AOT compiler packages from Mono.
* [dotnet] Move the workloads into a common subdirectory.
Also delete the watchOS workload, we're not shipping it for now.
* [dotnet] Set DOTNETSDK_WORKLOAD_MANIFEST_ROOTS when install workloads to get our local ones.
* Set DOTNETSDK_WORKLOAD_MANIFEST_ROOTS to where our local workloads are to use them when installing our locally built workloads into .NET (the local one).
* Stop installing workloads from builds/
* Get NuGet.config with local feed, and make sure those feed contain local build before running 'workload install'.
* Fix makefile logic.
* Another tweak.
Using the AOT LLVM-backend is recommended for release and should be used
when comparing sizes.
Also add some basic instruction to ease comparing `oldnet` and `dotnet`
app bundles since IL stripping is not yet available to dotnet builds (and
without considering this the _real_ numbers are a bit off)
* Update dependencies from https://github.com/dotnet/installer build 20210530.2
Microsoft.Dotnet.Sdk.Internal
From Version 6.0.100-preview.6.21274.3 -> To Version 6.0.100-preview.6.21280.2
Dependency coherency updates
Microsoft.NET.ILLink.Tasks
From Version 6.0.100-preview.5.21271.1 -> To Version 6.0.100-preview.6.21277.2 (parent: Microsoft.Dotnet.Sdk.Internal
* Bump to MSBuild.StructuredLogger v2.1.500 to get support for log format v14.
* [tests] Skip code that needs System.ComponentModel.Composition or System.Json due to #11710.
Ref: https://github.com/xamarin/xamarin-macios/issues/11710
* [tests] Adjust logic to find MSBuild items after the last MSBuild.StructuredLogger update.
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
* Add a configure option to use a locally built dotnet/runtime.
* Add documentation how to build dotnet/runtime the way we need it built.
* Modify our build to consume the custom dotnet/runtime if so configured.
This is useful when trying to debug the runtime locally, or trying out new
features there are no packages for yet.
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
* Pass any native references to the LinkNativeCode task so that they're linked
with the main executable.
* Copy frameworks and dynamic libraries to the app bundle (also add support for
MSBuild metadata - the CopyToAppBundle property - to avoid copying a framework
/ dynamic library to the app bundle).
* Add tests.
Fixes https://github.com/xamarin/xamarin-macios/issues/11061.
- Make git ignore the generated `report.md`
- Fix `.aotdata` reported total size in reports (was always 0)
- Add option to strip the dotnet app bundle (until [1]) so it's easier to compare with _oldnet_ sizes.
[1] https://github.com/xamarin/xamarin-macios/issues/11445
Context: https://github.com/dotnet/maui/pull/807
When implementing a new `@(MauiSplashScreen)` feature for .NET MAUI, I
found out that Catalyst doesn't have support for splash screens.
I even tested this in Xcode:
* Create a new Objective-C iOS app
* Make `LaunchScreen.storyboard` red and `Main.storyboard` green.
* Check the new `macOS` checkbox in project settings to enable
Catalyst and be a multiplatform app.
I see red, then green on iOS but only green on macOS. I think Catalyst
completely ignores `UILaunchStoryboardName`.
This removes splash screens from the `dotnet new maccatalyst` template
as well as the `MyCatalystApp` sample project.
* [build] Use arcade dependency management tooling
* Apply feedback
* Apply second round of feedback
* Always make dotnet.config before trying to read it
* Debugging
* Update dependencies, trim tabs and spaces
* [dotnet] Remove the existing workload shipped with .NET and install our locally built ones.
The new version of .NET ships with our workloads, but those aren't
the workloads we want to use, so replace them with our own.
* Update .gitignores.
* Bump to 6.0.100-preview.3.21181.5
That required renaming simulator runtime packs...
* More rename for simulator packages
* moar (hopefully all)
* Bump to 6.0.100-preview.3.21201.11
This fix the issue with `Wait` that failed several tests in monotouch-tests
However it does not include the fix for AppConext.GetData on device (AOT)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Sebastien Pouliot <sebastien@xamarin.com>
With P3 addition on ICU we must now link the native executable as C++.
Remove an old workaround, in many tests, referencing old (5.0/previews)
packages that caused native link time failures.
ref: https://github.com/mono/linker/issues/1139
* Bump to .NET 6.0.100-preview.3.21152.10
* Bump to 6.0.100-preview.3.21152.10.
* Bump to 6.0.100-preview.3.21161.7.
* Bump to .NET 6.0.100-preview.3.21161.23.
* [dotnet-linker] Bump ILink and use the supported method of getting an assembly's location.
* Bump to MSBuild.StructuredLogger 2.1.364 to get support for newer binlog versions.
* Fix build failure
Fixes:
TestHelpers/BuildEngine.cs(161,24): error CS0433: The type 'ProjectEvaluationFinishedEventArgs' exists in both 'Microsoft.Build.Framework, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'StructuredLogger, Version=2.1.0.0, Culture=neutral, PublicKeyToken=d4c7181801cb6448' [/Users/builder/azdo/_work/1/s/xamarin-macios/tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj]
* Update parsing binlog properties.
* Be more defensive.
* [tests] Make sure the InternalsVisibleToAttribute constructor isn't linked away.
* [tests] Implement better printing of binlogs.
The latest MSBuild.StructuredLogger made some internal changes to the Message
property which confuses some of our test logic. So implement manual printing
of the log entries that we care about to make sure they conform to the
expected format by the tests (the output is mimicing what 'msbuild /v:diag
foo.binlog' would show).
Also
* Fix the Mac Catalyst sample to use the correct contents.json and images sizes
for Mac Catalyst app icons.
* Fix the contents.json and image sizes for the Mac Catalyst test project as well.
* Add unit test for Mac Catalyst that ensures that Assets.car is in the final app.
Fixes https://github.com/xamarin/xamarin-macios/issues/10804.
* [dotnet] Use the expected case for ARM64.
We use case-sensitive comparisons somewhere else, so make sure to use the same casing
for the architecture as other platforms do.
* [tests] Add tests to verify that Mac Catalyst builds successfully for ARM64.
* [msbuild] Fix platform name in condition.
* [msbuild] Pass -isysroot when building Mac Catalyst apps as well.
Ohterwise clang will use the SDK from the command line tools, which may have
nothing to do with the SDK we want to build with.
* Bump .NET to 6.0.100-preview.2.21114.3.
* [dotnet-linker] Several steps are now gone, so load our custom step before the new first step (MarkStep).
* [dotnet-linker] Dump the current steps if we fail to call InsertBefore/InsertAfter.
* [dotnet-linker] Load the CollectAssembliesStep as the first step, and make it load every assembly.
* [dotnet] Set InvariantGlobalization=true because that's the only thing .NET supports for now.
* [dotnet-linker] Use recommended workaround for linker's inability to do load assemblies in custom step.
* [tests] Bump version of MSBuild.StructuredLogger to get support for new log version.
Otherwise this happens in tests that read binary logs:
System.NotSupportedException : Unsupported log file format. Latest supported version is 9, the log file has version 10.
* [introspection] Ignore P/Invokes to QCall for LogThreadPool* P/Invokes.
* [dotnet-linker] Inject a dummy implementation of mono_config_parse_memory as a temporary solution for mono's removal of the same method.
* [tests] Add test case for single-project properties in .NET.
* [msbuild] Add support for the single-project ApplicationId MSBuild property.
* [msbuild] Add support for the single-project ApplicationTitle, ApplicationVersion and AppleShortVersion MSBuild properties.
* [dotnet] Enable the single-project MSBuild properties by default.
* [dotnet] Add a short doc about single project properties.
* [tests] Fix the GeneratePlistTaskTests.BundleIdentifier test according to bundle identifier changes.
This test asserts that the CFBundleIdentifier value in the Info.plist isn't
overwritten, and does so by calling the CompileAppManifest task, giving it a
different value for the bundle identifier than what's in the Info.plist.
The behavior change is that now we do things in the following manner:
DetectSigningIdentityTask will read the Info.plist, compute a bundle
identifier (which will be the value from the Info.plist if it's there), and
returns it to the MSBuild code. Eventually that value will be passed to the
CompileAppManifestTask, which will write it to the Info.plist.
However, this test doesn't run the DetectSigningIdentityTask, which means that
the initial value for the bundle identifier doesn't come from the Info.plist.
* [dotnet-linker] Add the RemoveUserResources sub step.
This comes with a few changes to the RemoveUserResources sub step as well:
* Bail out earlier if we're in the simulator (no need to do any processing at
all - we know at the very beginning if we're building for the simulator).
* Do a positive simulator check, instead of a negative device check (because
Mac[Catalyst] are neither devices - so they pass the negative device check).
* Remove all the conditional mtouch/mmp code, and figure out at runtime which
resource prefixes we need to check for.
It was also necessary to change where steps are added to the pipeline: we have
to remove resources before the OutputStep, but at the same time we have to do
it after the ExtractBindingLibraries step, otherwise the
ExtractBindingLibraries step won't find any binding libraries to extract. So
move the ExtractBindingLibraries, LoadNonSkippedAssemblies and
ListExportedSymbols to before the OutputStep (to keep their internal order),
and then add the RemoveUserResources after those.
This fixes the following link sdk/link all test when running on device:
BundledResources.ResourcesTest
[FAIL] Bundled : No resources
Expected: 0
But was: 2
* [tests] Update the BuildInterdependentBindingProjects test now that we're removing resources.
Update the .NET unit tests to parse the binlog instead of standard output for
specific build output, since we're not printing a diagnostic build log to
standard output anymore.
This fixes numerous test failures in the .NET unit tests:
* Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("watchOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildBundledResources("iOS","monotouch"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("iOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildBundledResources("watchOS","monotouch"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("tvOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("tvOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildBindingsTest("iOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildBundledResources("tvOS","monotouch"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildMyTVApp: Linker did not executed as expected.
Expected: String containing "Building target "_RunILLink" completely."
But was: "Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for .NET [...]"
* Xamarin.Tests.DotNetProjectTest.BuildMySingleView: Linker did not executed as expected.
Expected: String containing "Building target "_RunILLink" completely."
But was: "Microsoft (R) Build Engine version 16.8.0-preview-20475-05+aed5e7ed0 for .NET [...]"
* Xamarin.Tests.DotNetProjectTest.BuildInterdependentBindingProjects("iOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("tvOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("watchOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("tvOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("watchOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildEmbeddedResourcesTest("watchOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildBindingsTest2("iOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildInterdependentBindingProjects("tvOS"): Assemblies
Expected: not <empty>
But was: <empty>
* Xamarin.Tests.DotNetProjectTest.BuildFSharpLibraryTest("iOS"): Assemblies
Expected: not <empty>
But was: <empty>
Port the iOS/tvOS/watchOS msbuild test projects to .NET, and add a unit test
that builds both the old-style and new-style test projects and compares the
output in the resulting .app directories.
There are many expected differences in the apps, those will be ignored during
the comparison.
There are also numerous features that are not implemented yet in .NET, with
the corresponding adjustments in the comparison logic (they show up as TODO in
the code), these TODOs will be removed as features are implemented in the .NET
build.
There are a couple of test projects that can't be compared yet, because they
just don't build yet. Those are also TODOs.
Make the bgen tests pass in the path to the attribute library, platform
assembly and all the .NET reference assemblies to bgen. This way we execute
these tests using the .NET version of everything.
* [src] Build the .NET version of our product assemblies using a .NET 5 BCL.
We're not shipping the .NET product assemblies in any stable release, so we
can use a preview version of the .NET 5 BCL.
Also:
* Add all the nuget feeds we need to the top-level NuGet.config, even for .NET
5/6, there shouldn't be any conflicts with stable feeds since we use exact
version numbers.
* Generate a top-level global5.json which is copied to every directory that
needs a .NET 5 global.json (overriding the .NET 3.1 global.json in the root
directory).
* Use the expected dotnet binary during our local build.
* [tests] Fix the bgen tests to use .NET 5.
* [xharness] Set the current directory to the project directory when running .NET tests.
This way we end up using the dotnet version that's configured in global.json for the tests.
* [dotnet] Pass the Optimize flags from the extra bundler arguments to the linker configuration.
Also call Application.InitializeCommon to initialize the application instance. The
important part here is that InitializeCommon calls Optimizations.Initialize to compute
the default optimizations. It also calls Set*ExceptionMode and sets the default EnableCoopGC
value (so we don't need to call/set those anymore), and it does a few other initialization
tasks which we don't need yet, but eventually will.
And finally remember to parse the bundler arguments before using them in the dotnet
build logic. How did this not cause problems before? 🤦
* [tests] Set the verbosity using the additional args instead of an internal variable.
The internal _BundlerVerbosity variable is overwritten now (with the verbosity
value from the additional args).
* [xharness] Disable tvOS generation for the introspection/.NET test, it incorrect and needs fixing.
* Port the BundledResources test to .NET.
* Fix a minor issue in the BundledResources test to make sure it works on macOS.
* Add a unit test to make sure resources are bundled as expected.
* Modify the .NET build logic to bundle/unbundle resources.
* Bump .NET 5 and the linker.
The old linker run into a problem that seems fixed in the new linker, so bump.
* [tests] Add a workaround for a .NET bug in the fsharplibrary tests.
It's now the default to produce reference assemblies, but the F# compiler
doesn't support producing reference assemblies, so when there's no reference
assembly afterwards the MSBuild tasks complain. So explicitly disable
reference assemblies for our F# library.
* [tests] Skip reference assemblies when iterating over produced assemblies in the .NET unit tests.
Also simplify the code a little bit.
This happens because producing reference assemblies is now the default.
Put NuGet packages in tests/dotnet, instead of a directory next to the project
file, so that default item inclusions / globs don't pick up anything from
them.
This fixes an issue where the build would pick up a Program.cs that ships with NUnitLite,
and include it in the build, which would then cause build failures because that Program.cs
has a Main method, which would conflict with our Main method.
* [dotnet] Only pass a single custom step to the linker.
The linker will load the assemblies with the custom steps once per custom step
argument, which means that each step is effectively in a different assembly,
making it impossible to share state between steps.
This behavior is filed as a linker bug: https://github.com/mono/linker/issues/1314
Until this is fixed, we can just have a single step that injects all the other
steps programmatically.
* [tests] Adjust .NET tests according to new behavior.
This avoids a possible difference in behavior, because in our system
dependency check we verify that the system has a specific version (which might
succeed), but if we don't pick a specific dotnet version in global.json,
dotnet will pick the latest version, which may behave differently than the one
we have in Make.config.
Thus always use the exact same version, so that we don't run into a difference
in behavior between developers and/or bots.
* Create a simple Xamarin.Utils.Execution class that can handle all our
process execution needs:
* Captures or streams stdout/stderr (in UTF8).
* Supports async
* Supports a timeout
* Does not depend on any other source file we have, only uses BCL API.
* Have the execution helper classes from mtouch/mmp
(Xamarin.BundlerDriver.RunCommand) and the tests
(Xamarin.Tests.ExecutionHelper) use this new class.
* Some simplifications were made:
* All API that took a string array for the environment now takes a
Dictionary<string, string>.
* The Driver.RunCommand methods were split out to a separate file. This
file also contains a Verbosity field, which is conditioned on not being
in mtouch nor mmp, which makes including this file from other projects
simpler (such as bgen - in particular bgen was modified to use this
Verbosity field instead of its own).
* [dotnet] Detect, compile and publish Info.plist into the app.
* Automatically detect any property lists in the root project directory, and
include them into the build.
* Introduce the existing build targets to detect and compile Info.plist into
the .NET build.
* Add documentation for default inclusion. This document will grow over time
as more file types are automatically included.
* Add some tests.
* [dotnet] Adjust default inclusion behavior.
* Use a single platform-specific variable to control all types of
platform-specific inclusions.
* [dotnet] Move the default inclusion to .targets instead of .props, so that .NET's default inclusion logic is already imported.
.NET sets EnableDefaultItems in their .targets: https://github.com/dotnet/sdk/blob/master/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.DefaultItems.targets#L16
* [tests] Add a unit test project to test our net5 support.
* [tests] Fix clearing environment variables when launching processes.
* [tests] Add net5 macOS test app.
* [tests] Add net5 tvOS test app.
* [tests] Add net5 watchOS test app.
* [msbuild] Exclude CreateAppBundleDependsOn from net5 builds as well.
* [msbuild] We're not required to know the signing identity to figure out the app extension bundle name.
Also add another nuget source to get Mono's net5 runtime packs.
This makes the tests/dotnet/MySingleView test app:
* Compile managed code successfully, referencing Xamarin.iOS.dll.
* Resolve the correct targeting and runtime packs (aka Mono).
The compiled result is not put into an .app bundle as iOS expects, so the
result isn't actually executable.
Also add a very simple net5 test app (which doesn't build yet).
Current (expected) build result:
> xamarin-macios/tests/dotnet/MySingleView $ dotnet build
Microsoft (R) Build Engine version 16.7.0-preview-20258-02+26f6d1d87 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102: Unable to find package Microsoft.NETCore.App.Runtime.ios-x64 with version (= 5.0.0-preview.6.20264.1)
xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102: - Found 1 version(s) in nuget.org [ Nearest version: 5.0.0-preview.4.20251.6 ]
xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102: - Found 1 version(s) in Nuget Official [ Nearest version: 5.0.0-preview.4.20251.6 ]
xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102: - Found 0 version(s) in local-dotnet-feed
xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj : error NU1102: - Found 0 version(s) in Dotnet arcade
Failed to restore xamarin-macios/tests/dotnet/MySingleView/MySingleView.csproj (in 951 ms).
This fails because the .NET build logic isn't being told that it should look
for the mono runtime packs instead of the .NET Core runtime packs.