Граф коммитов

15570 Коммитов

Автор SHA1 Сообщение Дата
Git History Editor 9bcc96e171 [static registrar] Implement support for calling the generated UnmanagedCallersOnly method from the managed static registrar 2023-05-11 13:10:30 +02:00
Git History Editor 382ebae8d5 [tools] Add a managed static registrar. Fixes #17324.
This adds a managed static registrar, which is a variation of the static registrar
that takes advantage of a few new features in C# and the runtime, as well as avoiding
metadata tokens, which NativeAOT doesn't support.

This registrar will generate most of the trampoline/interop code as managed code
using Cecil, and the Objective-C part is as small as possible.

Fixes https://github.com/xamarin/xamarin-macios/issues/17324.
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge fb6ed7b770 [runtime] Add an API to look up the native symbol for an [UnmanagedCallersOnly] method.
Add an API to look up the native symbol for an [UnmanagedCallersOnly] method from native code.
2023-05-11 13:10:30 +02:00
Git History Editor cbfc59111b [src] Refactor Class.ResolveToken to take the assembly as a parameter.
This is to make the Class.ResolveToken usable from the managed static registrar.
2023-05-11 13:10:30 +02:00
Git History Editor 4bd045e491 [static registrar] Refactor code to make it easier to reuse code later on. 2023-05-11 13:10:30 +02:00
Git History Editor 4ab321d54c [dotnet-linker] Remove trimmed API from the registered types before generating native code when using the managed static registrar.
When using the managed static registrar, we register types with the static registrar
before the linker does its work, so we need to follow-up after the linker has figured
out what will be trimmed away to remove any such types from the list of registered types.
2023-05-11 13:10:30 +02:00
Git History Editor 72c654e4db [registrar] Refactor code to determine if a method is a property accessor to make it easier to reuse. 2023-05-11 13:10:30 +02:00
Git History Editor 2a40824cad [dotnet-linker] Add a helper class for keeping track of methods and types when emitting IL code with Cecil. 2023-05-11 13:10:30 +02:00
Git History Editor 47eddc568c [dotnet-linker] Add extension methods for making IL emission easier with Cecil. 2023-05-11 13:10:30 +02:00
Git History Editor dc56054d2a [registrar] Add an HasCustomAttribute overload that returns the found attribute (if any) 2023-05-11 13:10:30 +02:00
Git History Editor 53d7bc523e [tools] Move code to compute block signatures to the static registrar.
This makes it easier to use this code from the managed static registrar.
2023-05-11 13:10:30 +02:00
Git History Editor 70a39a70d5 [static registrar] Move token reference creation a little bit later.
It's not needed until later anyway.

This way we can add code for the managed static registrar (which does not need the
token reference, in fact creating a token reference for a method won't be possible
with the managed static registra) in the correct location in the code.
2023-05-11 13:10:30 +02:00
Git History Editor 8f1fb220cb [static registrar] Add support for generating block syntax in Objective-C method signatures.
This is required when generating a cast of a function pointer to an Objective-C method
signature (which the managed static registrar does).
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge 43b88af10a [src] Fix comparison between signed and unsigned int.
Comparing -1 to 0xFFFFFFFF doesn't get the right result otherwise.
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge a1e0e305e5 [registrar] Make some API from the registrar public so that the managed static registrar step can access them.
There are no functional changes here, just refactoring to make code easier to re-use.
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge e39c6fb1b2 [dotnet-linker] Rearrange registration and generation in the static registrar
The managed static registrar will add code to the processed assemblies, which means
it must run before the trimmer sweeps unused code.

This means we have to split the current registrar logic in two:

1. First we process all the assemblies.
2. Then we write out the results.

When not using the managed static registrar, these two steps happens right after
oneanother (like they do now), while when using the managed static registrar, the
processing is done before the trimmer sweeps (where we'll also generate all the new
IL code), and then the generated native code will be done at the end of the build
process (like for the old-school static registrar).
2023-05-11 13:10:30 +02:00
Rolf Bjarne Kvinge 57d40d9cf1 [dotnet-linker] Don't do anything in ManagedRegistrarStep unless the current registrar mode is 'ManagedStatic'. 2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge bf639a99d7 [dotnet-linker] Add the scaffolding for a ManagedRegistrarStep and a ManagedRegistrarLookupTablesStep. 2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge 34264cd98f [dotnet] Add an 'IsManagedStaticRegistrar' feature to the linker.
This way we can ask the linker to inline the Runtime.IsManagedStaticRegistrar property, and remove any dead code paths.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge cfb248ecac [tools] Add a ManagedStatic registrar mode.
This new mode is still considered a 'Static' registrar mode, it's just a variation of it.
2023-05-11 12:21:53 +02:00
Git History Editor a1410ac7fa [static registrar] Refactor code to make it easier to reuse code later on.
There are no functional changes here, just refactoring to make code easier to re-use.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge e66f82d5fc [static registrar] Refactor code to make it easier to reuse code later on.
There are no functional changes here, just refactoring to make code easier to re-use.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge 872af5d9e1 [static registrar] Refactor code to make it easier to reuse code later on.
There are no functional changes here, just refactoring to make code easier to re-use.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge 3ac9b8fc76 [xharness] Add new variations using the managed static registrar for monotouch-test. 2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge 4351674beb [dotnet-linker] Add a way for ConfigurationAwareStep subclasses to return exceptions.
Without having to throw them.
2023-05-11 12:21:53 +02:00
Rolf Bjarne Kvinge eb01507dd6 [dotnet-linker] Unify exception handling to go through the LinkerConfiguration.Report method.
Since LinkerConfiguration.Report uses the trimmer's API to report warnings and errors.
2023-05-11 12:16:48 +02:00
Rolf Bjarne Kvinge 9e112978fd [dotnet-linker] Don't fail trimming if all the exceptions we collect are warnings. 2023-05-11 12:16:48 +02:00
Rolf Bjarne Kvinge 7c7637ee75 [dotnet-linker] Reduce a bit of code duplication.
There are no functional changes here, just code simplification.
2023-05-11 12:16:48 +02:00
Rolf Bjarne Kvinge 527cba2382 [docs] Document the managed static registrar. 2023-05-11 12:16:48 +02:00
Rolf Bjarne Kvinge 69eb2755b5
[tests] Ignore a network failure condition on bots in the LinkSdk.AsyncTests.Bug12221 test. (#18252) 2023-05-11 07:28:38 +02:00
Rolf Bjarne Kvinge 792a223c37
[autoformat] Fix running sed on Linux. (#18254)
The autoformat action doesn't necessarily run on macOS, and sed's syntax is
different between macOS and Linux - so make sure to cope with these
differences.

Also execute the nullability fixes in a separate subshell to not interfere
with the rest of the script.

This fixes an issue where autoformat would fail with:

    + sed -i '' -e 's/!= null/is not null/g' -e 's/== null/is null/g' builds/fix-maccatalyst-assembly/Program.cs
    sed: can't read : No such file or directory
2023-05-11 07:27:47 +02:00
Manuel de la Pena 34b2b9466f
[CI] Disable the config detection in prs too. (#18153)
We do the same in the ci yaml already.
2023-05-10 18:43:03 -04:00
Rolf Bjarne Kvinge 199b43e2d9
[monotouch-test] Ignore network failures in CI for SecProtocolMetadataTest.TlsDefaults. Fixes #xamarin/maccore@2040. (#18255)
Fixes https://github.com/xamarin/maccore/issues/2040.
2023-05-10 11:04:53 +02:00
Rolf Bjarne Kvinge f358715a38
[xharness] Use our own SetProperty to set properties instead of the SetTopLevelPropertyGroupValue extension method. (#18253)
This is because the SetTopLevelPropertyGroupValue method doesn't always
work as expected (it doesn't always set seomthing), while SetProperty does.

Fixing the SetTopLevelPropertyGroup method is somewhat complex, since it
lives in the dotnet/xharness repository, so instead use the SetProperty
method, which is our own (working) version.
2023-05-10 10:53:53 +02:00
Filip Navara 7d8fa7fa41
Fix nullability of WebView.EditingDelegate (#18247)
Note that both the headers and the documentation are incorrect in this case. All of the `WebView.*Delegate` objects are documented as non-nullable, but in all cases it's wrong. The binding for the other `Delegate`s allows `null`s in Xamarin.

Failure to remove the `EditingDelegate` reference may result in a crash when the `WebView` object gets disposed:
```
16  xamarin_release_managed_ref + 108 (eM Client + 63772) [0x100ecf91c]
  16  -[Xilium_CefGlue_CefWebView release] + 32 (eM Client + 116128) [0x100edc5a0]
  16  xamarin_invoke_objc_method_implementation + 140 (eM Client + 73400) 
[0x100ed1eb8]
  16  -[WebView dealloc] + 112 (WebKitLegacy + 166520) [0x1ccf72a78]
  16  -[WebView(WebPrivate) _close] + 364 (WebKitLegacy + 167048) [0x1ccf72c88]
  16  WebCore::FrameLoader::detachFromParent() + 48 (WebCore + 628864) [0x1d248f880]
  16  WebCore::FrameLoader::closeURL() + 244 (WebCore + 26226672) [0x1d3cf8ff0]
  16  WebEditorClient::clearUndoRedoOperations() + 52 (WebKitLegacy + 102060) 
[0x1ccf62eac]
  16  -[WebView(WebViewEditing) undoManager] + 72 (WebKitLegacy + 153444) 
[0x1ccf6f764]
  16  _CF_forwarding_prep_0 + 96 (CoreFoundation + 408816) [0x1b6993cf0]
  16  ___forwarding___ + 1004 (CoreFoundation + 410012) [0x1b699419c]
  16  objc_opt_respondsToSelector + 48 (libobjc.A.dylib + 185536) [0x1b67944c0]
  7   PAL_DispatchExceptionWrapper + 16 (libcoreclr.dylib + 262040) [0x102db7f98]
```
2023-05-09 22:59:46 +02:00
VS MobileTools Engineering Service 2 e97707b224
Localized file check-in by OneLocBuild Task: Build definition ID 17751: Build ID 7737739 (#18238)
This is the pull request automatically created by the OneLocBuild task
in the build process to check-in localized files generated based upon
translation source files (.lcl files) handed-back from the downstream
localization pipeline. If there are issues in translations, visit
https://aka.ms/icxLocBug and log bugs for fixes. The OneLocBuild wiki is
https://aka.ms/onelocbuild and the localization process in general is
documented at https://aka.ms/AllAboutLoc.

---------

Co-authored-by: tj-devel709 <tjlambert@microsoft.com>
2023-05-09 11:03:52 -05:00
TJ Lambert aed4d7a5d0
[Localization] Bring More Translations Manually (#18241)
Until, we can try a VSEng PAT for the Pipeline as seen in this
[PR](https://github.com/xamarin/xamarin-macios/pull/18122#issuecomment-1533558542),
I will continue to bring the [not-yet usable] translation strings
manually!

---------

Co-authored-by: CSIGS <csigs@outlook.com>
2023-05-09 11:03:08 -05:00
Rolf Bjarne Kvinge 415086c4ce
[Foundation] Fix nullability issues in NSUserDefaults. Fixes #18243. (#18246)
Fixes https://github.com/xamarin/xamarin-macios/issues/18243.
2023-05-09 17:39:34 +02:00
Rolf Bjarne Kvinge 62a43f4fa9
[msbuild] Merge the MTouch and MTouchTaskBase classes. (#18212)
We no longer need to have overridable logic for remote builds, so the
non-abstract task class and the abstract base class can be merged.

Also enable nullability and fix any issues.
2023-05-08 16:40:59 +02:00
Rolf Bjarne Kvinge e56920642b
[runtime] Re-generate product.h when the current commit changes. (#18231)
This way the runtime libraries are always up-to-date after building
after making local commits.
2023-05-08 14:54:47 +02:00
Rolf Bjarne Kvinge da23c8e488
[tests] Install workloads on Windows without checking the signature of the packages. (#18210)
Hopefully fixes:

    MSBuild version 17.4.1+9a89d02ff for .NET
    D:\AzDO\_work\_tool\dotnet\sdk\7.0.102\MSBuild.dll --property:DisableImplicitNuGetFallbackFolder=true -bl:D:\AzDO\_work\2\s/xamarin-macios/tests/dotnet/Windows/install.binlog -consoleloggerparameters:Summary -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,D:\AzDO\_work\_tool\dotnet\sdk\7.0.102\dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,D:\AzDO\_work\_tool\dotnet\sdk\7.0.102\dotnet.dll -maxcpucount -restore -verbosity:m -verbosity:quiet D:\AzDO\_work\2\s/xamarin-macios/tests/dotnet/Windows/InstallDotNet.csproj
    EXEC : error : NU3004: The package is not signed. [D:\AzDO\_work\2\s\xamarin-macios\tests\dotnet\Windows\InstallDotNet.csproj]
2023-05-08 11:03:18 +02:00
Rolf Bjarne Kvinge eb7184831b
[msbuild] Merge the ILStrip and ILStripTaskBase classes. (#18211)
We no longer need to have overridable logic for remote builds, so the
non-abstract task class and the abstract base class can be merged.

Also enable nullability and fix any issues.
2023-05-08 11:03:00 +02:00
Rolf Bjarne Kvinge 32bf0b1996
[msbuild] Show a warning if asked to load an app manifest that doesn't exist. (#18222)
This makes it easier to diagnose problems loading/finding app manifests.

Specifying an app manifest that doesn't exist should probably be an
error, but that's very likely to break existing projects, so just make this a
warning for now.
2023-05-08 11:02:40 +02:00
Rolf Bjarne Kvinge 36af029204
Change all null checking expressions to use 'is' and 'is not'. (#18176)
Change all null checking expressions to use 'is null' and 'is not null'
instead of '== null' and '!= null'.

This was mostly done with sed, so code can probably be improved in many
other ways with manual inspection, but that will come over time.

Also add code to the autoformat script to automatically fix these issues in the future.
2023-05-05 17:52:19 +02:00
Rolf Bjarne Kvinge 6c3e745a93
[devops] Fail the 'Add summaries' task if something goes wrong. (#18227)
That way we can re-run it when something does go wrong (instead of
rerunning the _entire pipeline_).
2023-05-05 17:15:34 +02:00
Rolf Bjarne Kvinge 185a9a8c9a
[xharness] Add a release + all optimization test variation of monotouch-test for desktop. (#18140)
Add a 'release + all optimization' test variation of monotouch-test for
macOS and Mac Catalyst.
2023-05-05 11:24:26 +02:00
Rolf Bjarne Kvinge 17bcfbf4cb
[tests] Fix running dotnet with MSBUILD_EXE_PATH. (#18223)
'dotnet build' doesn't work when MSBUILD_EXE_PATH is set (which we do in
some places for legacy tests), so make sure to unset MSBUILD_EXE_PATH before running
'dotnet build'.
2023-05-05 11:16:54 +02:00
TJ Lambert a54fefd836
[Localization] Revert change to non-breaking space (#18216)
This change didn't really get rid of the non-breaking space and caused
extra changes after we built xamarin-macios.

Co-authored-by: tj-devel709 <tjlambert@microsoft.com>
2023-05-04 21:59:37 -05:00
dotnet-maestro[bot] ba52c29f88
[main] Update dependencies from dotnet/installer (#18201)
This pull request updates the following dependencies

## From https://github.com/dotnet/installer
- **Subscription**: fffd7604-ce46-455f-0f2f-08db24524baf
- **Build**: 20230504.11
- **Date Produced**: May 4, 2023 10:10:59 AM UTC
- **Commit**: ccc5191a306acdad77bbfea6675886dc72bf9454
- **Branch**: refs/heads/release/7.0.2xx

- **Updates**:
- **Microsoft.Dotnet.Sdk.Internal**: [from 7.0.204-servicing.23214.3 to
7.0.206-servicing.23254.11][2]
2023-05-04 23:42:23 +02:00
Rolf Bjarne Kvinge 21afe8a602
[msbuild] Simplify code by using updated API from Xamarin.MacDev. (#18090)
This also requires a Xamairn.MacDev bump.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@bab25f5 [Xamarin.MacDev] Add a few convenience
overloads to IAppleSdk.
* xamarin/Xamarin.MacDev@920e87e Update UnitTests.csproj
* xamarin/Xamarin.MacDev@ccc9bd4 Update Xamarin.MacDev.csproj

Diff:
74c95ee1c3..bab25f535f
2023-05-04 22:48:37 +02:00