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

21 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 4ce35769cf
[xtro] Improve assembly resolution to not load incorrect assemblies. (#17177)
Add support to xtro-sharpie for where to look for referenced assemblies, and
adjust assembly resolution to only look in those directories.

This makes sure xtro-sharpie loads the expected references, and fixes a
problem where the (broken) assembly resolution wouldn't find a .NET assembly
because it doesn't exist in legacy Xamarin (where it would look by default).

Fixes this problem that showed up in a different PR (due to new .NET API
referencing the System.Runtime.Loader assembly, which doesn't exist in legacy
Xamarin):

    mono64 --debug bin/Debug/xtro-sharpie.exe --output-directory api-annotations-dotnet appletvos16.1-arm64.pch ../../_build/Microsoft.tvOS.Runtime.tvos-arm64/runtimes/tvos-arm64/lib/net7.0/Microsoft.tvOS.dll
    Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'System.Runtime.Loader, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
      at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x000ff] in C:\src\cecil\Mono.Cecil\BaseAssemblyResolver.cs:172
      at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x00000] in C:\src\cecil\Mono.Cecil\BaseAssemblyResolver.cs:117
      at Mono.Cecil.DefaultAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name) [0x0001d] in C:\src\cecil\Mono.Cecil\DefaultAssemblyResolver.cs:33
      at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x0003a] in C:\src\cecil\Mono.Cecil\MetadataResolver.cs:110
      at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00000] in C:\src\cecil\Mono.Cecil\ModuleDefinition.cs:748
      at Mono.Cecil.TypeReference.Resolve () [0x0000f] in C:\src\cecil\Mono.Cecil\TypeReference.cs:280
      at Extrospection.Helpers.GetName (Mono.Cecil.MethodDefinition self) [0x00051] in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/xtro-sharpie/Helpers.cs:332
      at Extrospection.DesignatedInitializerCheck.VisitManagedMethod (Mono.Cecil.MethodDefinition method) [0x00001] in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/xtro-sharpie/DesignatedInitializerCheck.cs:43
      at Extrospection.AssemblyReader.ProcessType (Extrospection.BaseVisitor v, Mono.Cecil.TypeDefinition type) [0x0002b] in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/xtro-sharpie/Runner.cs:104
      at Extrospection.AssemblyReader.Process () [0x0008e] in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/xtro-sharpie/Runner.cs:93
      at Extrospection.Runner.Execute (System.String pchFile, System.Collections.Generic.IEnumerable`1[T] assemblyNames, System.String outputDirectory) [0x001af] in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/xtro-sharpie/Runner.cs:52
      at Extrospection.MainClass.Main (System.String[] arguments) [0x0008f] in /Users/rolf/work/maccore/whatever/xamarin-macios/tests/xtro-sharpie/Program.cs:28
    make: *** [.stamp-dotnet-classify-tvOS] Error 1

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2023-01-11 17:59:47 +01:00
Rolf Bjarne Kvinge bc95efb0ae
[autoformat] Add xtro. (#16622) 2022-11-08 17:44:13 +01:00
Rolf Bjarne Kvinge f8314a435e
Add a [NativeName] attribute we can use to declare the native name for a type (enum/struct). (#14918)
We already have a few attributes that can specify the native name for a type, whenever the native name doesn't match the managed name:

* [Register ("DifferentClassName"): specifies the Objective-C class name
* [Native ("DifferentEnumName")]: specifies the Objective-C enum name (and also that it's a native-sized enum)
* [Protocol ("DifferentProtocolName")]: specifies the Objective-C protocol name
* [Category ("DifferentCategoryName")]: specifies the Objective-C category name

Unfortunately this leaves (at least) two cracks:

* Objective-C structs.
* Objective-C enums which aren't native-sized.

So I'm adding a [NativeName] attribute for this purpose, and updating numerous
types to specify the native name (either using an existing [Native] attribute
for enums that already have one, or by adding a new [NativeName] attribute).

The static registrar needs to know the native name for such types, in case
they appear as parameter types in function signatures.

This also allows us to simplify xtro a bit, to not have a separate map of
managed name given a native name, because we can now build that map
dynamically.
2022-05-09 22:16:17 +02:00
Rolf Bjarne Kvinge e25163f573
[.NET] Rename our product assemblies. Fixes #13748. (#13847)
Rename our product assemblies to:

* Microsoft.iOS.dll
* Microsoft.tvOS.dll
* Microsoft.macOS.dll
* Microsoft.MacCatalyst.dll

This makes it easy to distinguish between legacy Xamarin and .NET whenever the
product assembly is mentioned, and I've also chosen the platform part of the
name to match how the platforms are named elsewhere (this also makes it
possible to simplify our build logic, since we can remove a lot of special
casing).

Fixes https://github.com/xamarin/xamarin-macios/issues/13748.
2022-02-16 21:30:32 +01:00
Rolf Bjarne Kvinge fc39a0df5b [xtro-sharpie] Detect UnsupportedOSPlatform attributes as a deprecation attribute. 2021-11-24 15:39:03 +01:00
Rolf Bjarne Kvinge 3c5dfab710
[xtro-sharpie] Add support for specifying the output directory. (#13408)
This makes it possible to have a different output directory for .NET assemblies.
2021-11-22 18:50:17 +01:00
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Rolf Bjarne Kvinge 22d65a560d
[tests] Add xtro support for Mac Catalyst. Fixes #10214. (#10289)
* [xtro] Add support for Mac Catalyst. Fixes #10214.

Fixes https://github.com/xamarin/xamarin-macios/issues/10214.

* Update xtro.

* Bump Objective-Sharpie.

* Delete .todo files for frameworks we don't support.

* And another one bites the dust.

* [xtro] Update.
2021-01-11 11:56:58 +01:00
Sebastien Pouliot 144f926cea
[tests][xtro] Check for missing/extra [Appearance]. Fix #7136 (#9765)
based on the header's `UI_APPEARANCE_SELECTOR` decorations

Fix https://github.com/xamarin/xamarin-macios/issues/7136
2020-10-02 13:51:55 -04:00
Sebastien Pouliot 1b09465acf
[tests][xtro] Fix NSUrl-based categories (#9029)
We were using the managed name, e.g. `NSUrl`, instead of the native name,
e.g. `NSURL`, when dealing with categories.

To fix this we must resolve the type and this caused issues as other
assemblies (e.g. OpenTK) were not already loaded/cached and some type
could not be resolved (and this throw exceptions)

The runner now loads all assemblies before starting to visit them.

The fix solved a known issue (iOS-NetworkExtension.ignore), some API
that were already bound (common-Foundation.ignore) and also caught an
additional API where we missed a `[NullAllowed]` on a return value
2020-07-08 09:26:54 -04:00
Sebastien Pouliot 8d3987b84a
[xtro][bindings] Add xtro support for nullability and fix some bindings (#8335)
Enabling this will ensure that future bindings (and Xcode updates that
change nullability information) are spotted right away.

The binding fixes are **not** complete, i.e. what was done was mostly
to debug the xtro rule and find corner cases. The backlog will be
_ignored_ so the builds won't fail.
2020-04-10 11:00:47 -04:00
Rolf Bjarne Kvinge 885efcc624
[xtro] Add new checker for '[return: Release]' attributes. Fixes #6014. (#6149)
Also add a 'u2ignore' tool that can copy the resulting unclassified (all 1612
of them) to the ignore files.

Fixes https://github.com/xamarin/xamarin-macios/issues/6014.
2019-05-28 08:19:30 -07:00
Chris Hamons 1082ce7a09
Add xtro test for [Deprecated] attributes and fix up usages (#4966)
- https://github.com/xamarin/xamarin-macios/issues/4431
2018-10-15 10:43:17 -05:00
Sebastien Pouliot ec744533b9
[generator] Add support for [RequiresSuper] attribute. Fixes #58350 (#3147)
* Add new attribute;
* Add generator support (re-copy attribute);
* Add xtro rule to detect missing/extra [RequiresSuper] attributes;
* Add attributes to the required API;

The generated code changes (reversed) can be verified with
https://gist.github.com/spouliot/1c91d6ee7c084a06890e5f3f2a475001

Reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=58350
2018-01-04 11:48:00 -05:00
Sebastien Pouliot 8d854a0f3d
[xtro] Split results by framework and add an HTML report (#3093)
* Not every old annotations have been migrated (work in progress, to be completed in another PR);

* Sanitation of the data files (e.g. removal of dupes and fixed, by Apple, entries) is done, but not automated (also a work in progress)

Even then this is immediately useful, i.e. better merged before 15.6 gets branched.
2017-12-15 14:08:09 -05:00
Rolf Bjarne Kvinge a6d978118e [xtro] The right platform for macOS is 'macos', not 'osx'. (#2677)
The platform name is used to filter availability attributes, and if we use the
wrong platform, we'll incorrectly skip all availability attributes.

The net result in unclassified entries: https://gist.github.com/rolfbjarne/a4474bc2a40c49a85cad495b51bb514f
2017-09-13 08:33:35 -04:00
Rolf Bjarne Kvinge a3314bc2ed [xtro-sharpie] Add a Simd check class to verify signatures with Simd types. 2017-08-31 14:03:10 +02:00
Rolf Bjarne Kvinge d113e62d0a [xtro-sharpie] Fix a compiler warning. (#2516)
Fixes these warnings:

Runner.cs(197,5): warning CS0642: Possible mistaken empty statement
Runner.cs(199,5): warning CS0642: Possible mistaken empty statement
Runner.cs(201,5): warning CS0642: Possible mistaken empty statement
Runner.cs(203,5): warning CS0642: Possible mistaken empty statement
Runner.cs(205,5): warning CS0642: Possible mistaken empty statement
2017-08-22 11:33:09 +02:00
Timothy Risi 86d45b0787 [FinderSync, MediaLibrary] Update to xcode 9 betas 1 and 2 (#2219)
* Add 2 unbound frameworks to the xtro mac exclusions
2017-06-28 11:38:05 -08:00
Chris Hamons b54bcd6ae0 [XM] Fix xtro-sharpie issues (#620) 2016-08-17 20:11:05 -04:00
Rolf Bjarne Kvinge ecfdea9508 [tests] Import 2016-05-26 15:06:52 +02:00