xamarin-macios/tests/generator
Chris Hamons 1dcefc9c56
[NET Attribute Conversion][generator] Generate NET style attributes (#14779)
This PR teaches our code generator to generate .NET 6 style availability attributes, adds a 4th Cecil test to verify our generated attributes, and a metric ton of API changes to satisfy that test.

The generator work is the core of this PR, and includes:

- Hacking out chunks of generator.cs that "helpfully" remove duplicate attributes, which are no longer duplicate in the new order that NET6 attributes force upon us. See changes in FilterMinimumVersion and PrintPlatformAttributes
- Prevent a crash when the generator processes availability attributes with no version included (example: introduced on iOS but no version). See Is64BitiOSOnly.
- The meat, GetPlatformAttributesToPrint, which synthesizes many attributes "out of thing air" from:
        - The parent context
        - Implied introduced just because the class exists on a given framework at all
        - Implied Catalyst because iOS exists
- A few cludgy hacks PrintPlatformAttributesNoDuplicates and GenerateProperty because the existing PrintPlatformAttributes did not pass down parent context down, and the refactor was dangerous/too time consuming given time pressure.

There are two intended API changes introduced by the reviews in this PR:

- GetCurrentInputDevice was obviously intended by availability attributes to exist on Catalyst but due to define confusion was excluded. It is an addition in Microsoft.MacCatalyst.dll only.
- The NEAppRule constructors were mis-marked on platforms, and were showing up incorrectly on Mac/Catalyst. I corrected the Catalyst one unconditionally, as we have not shipped Catalyst yet, but Mac is only fixed in NET6.

There is a lot of follow up work in https://github.com/xamarin/xamarin-macios/issues/14802 to do to remove a number of hard coded test failures, but this should be almost all of the remaining work in NET6 attributes.

🤞 this doesn't break too much for future us.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-05-02 09:44:25 -05:00
..
tests [generator] Avoid NRE when using native enums on delegates (#14396) 2022-03-14 11:56:34 -04:00
.gitignore [tests] Import 2016-05-26 15:06:52 +02:00
Asserts.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
BGenTests.cs [NET Attribute Conversion][generator] Generate NET style attributes (#14779) 2022-05-02 09:44:25 -05:00
BGenTool.cs [tools] Make the TargetFramework.DotNet* variables version-agnostic. (#14669) 2022-04-06 21:33:46 +02:00
ErrorTests.cs [tests] Fix logic to make generator tests work with a system install. (#14497) 2022-03-30 21:36:09 +02:00
GeneratorTests.cs [tools] Make the TargetFramework.DotNet* variables version-agnostic. (#14669) 2022-04-06 21:33:46 +02:00
Makefile [tests] Request labels after each test from NUnit. (#14628) 2022-04-04 19:19:45 +02:00
NSApplicationPublicEnsureMethods.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
README.md [tests] Import 2016-05-26 15:06:52 +02:00
arrayfromhandlebug.cs [tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
bi1036.cs [tests][generator] Port XI/Classic tests to XI/Unified. (#1745) 2017-02-22 16:47:11 +01:00
bi1042.cs [generator] Fix reporting BI1042. (#13587) 2021-12-17 21:47:24 +01:00
bi1046.cs [tests][generator] Port XI/Classic tests to XI/Unified. (#1745) 2017-02-22 16:47:11 +01:00
bi1059.cs [bgen] Avoid a NullReferenceException when reporting multiple attributes on a type. Fixes #10310. (#10311) 2020-12-17 15:12:32 +01:00
bindas1048error.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bindas1049error.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bindas1050modelerror.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bindas1050protocolerror.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bindastests.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bmac-with-hyphen-in-name.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bmac_smoke.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
btouch-with-hyphen-in-name.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug15283.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug15307.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug15799.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug16036.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug17232.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug23041.cs [tests][generator] Port XI/Classic tests to XI/Unified. (#1745) 2017-02-22 16:47:11 +01:00
bug24078-ignore-methods-events.cs [tests][generator] Port XI/Classic tests to XI/Unified. (#1745) 2017-02-22 16:47:11 +01:00
bug27428.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug27430.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug27986.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug29493.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug31788.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug34042.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug35176.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug36457.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug37527-missing-property.cs [tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
bug37527-wrong-property.cs [tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
bug39614.cs [tests] Port the makefile-based generator tests to NUnit. (#3019) 2017-11-20 14:55:16 +01:00
bug40282.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug42742.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug42855.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug43579.cs [tests][generator] Port XI/Classic tests to XI/Unified. (#1745) 2017-02-22 16:47:11 +01:00
bug46292.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug52570allowstaticmembers.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug52570classinternal.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug52570methodinternal.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug53076.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug53076withmodel.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
bug57531.cs [generator] Support [Async] inside categories, fixes bugzilla #57531 (#3229) 2018-01-16 08:41:25 -05:00
bug57870.cs [generator] Teach generator about WrapAttribute on Getters and Setters (#3388) 2018-02-05 21:14:08 -06:00
classNameCollision-enum.cs [tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
classNameCollision.cs [tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
desk63279A.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
desk63279B.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
desk79124.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
fieldenumtests.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
forcedtype.cs [tests][generator] Port XI/Classic tests to XI/Unified. (#1745) 2017-02-22 16:47:11 +01:00
forum54078.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
generator-tests.csproj [cecil] Update all package references to the latest 0.11.4 (#12379) 2021-08-09 10:18:16 -04:00
generic-strong-dictionary.cs [tests] Fix bgen test to compile by adding missing using. (#5932) 2019-04-23 16:26:38 +01:00
ghissue3869.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ghissue5416a.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ghissue5416b.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ghissue5444.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ghissue5692.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ghissue6626.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ghissue6863_method.cs [Generator] Provide clear error message on type mismatch with BindAs error (#7016) 2019-09-19 21:05:22 -04:00
ghissue6863_property.cs [Generator] Provide clear error message on type mismatch with BindAs error (#7016) 2019-09-19 21:05:22 -04:00
ghissue7304.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
ghissue9065.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
issue3875.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
issue3875B.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
issue3875C.cs [src] Remove the ModelAttribute.AutoGeneratedName property in .NET. (#13619) 2021-12-22 21:28:19 +01:00
missing-export-property.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
multiple-api-definitions1.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
multiple-api-definitions2-a.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
multiple-api-definitions2-b.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
noasyncinternalwrapper.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
noasyncwarningcs0219.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
nowarn.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
property-redefination-ios.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
property-redefination-mac.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
protocol-duplicate-abstract-error.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
protocol-duplicate-abstract.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
protocol-duplicate-method-diff-length.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
protocol-duplicate-method-diff-out.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
protocol-duplicate-method-diff-return.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
protocol-duplicate-method-diff-type.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
smartenumwithframework.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
sof20696157.cs [tests][generator] Remove references to iAd.framework types (#11953) 2021-06-16 14:58:45 -04:00
sof20696157.sh [tests][generator] Port XI/Classic tests to XI/Unified. (#1745) 2017-02-22 16:47:11 +01:00
strong-dict-native-enum.cs [generator] Add support for [Native] enums inside [StrongDictionaries] (#6763) 2019-08-13 18:36:36 -04:00
strong-dict-support-templated-dicts.cs [tests] Remove Classic code from all tests. (#8702) 2020-05-28 16:35:09 +02:00
virtualwrap.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00
warnaserror.cs Fix some whitespace issues in various files. (#12399) 2021-08-11 10:06:46 +02:00

README.md

Tests for the binding generator

New test

  • Create a C# file with the api definition.
  • Add the C# file to the Makefile, like all the other tests. Remember to add it to the 'all' target.