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

9392 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 4cf26937ce
[msbuild] Share the CodesignNativeLibraries target between Xamarin.iOS and Xamarin.Mac. (#9775) 2020-10-06 14:18:31 +02:00
Rolf Bjarne Kvinge 95b76d6ee8
[msbuild] Share the _*Metal tasks between Xamarin.iOS and Xamarin.Mac. (#9786)
* This fixes a bug in the Xamarin.Mac version, where the _ForgeMetal's Outputs
  value didn't match the actual output path (this was fixed in the iOS version).
* Also update the definition of the _ForgedMetal itemgroup to use a nested ItemGroup
  instead of the CreateItem task.
2020-10-06 14:17:56 +02:00
Sebastien Pouliot 0922f354fe
[generator] Fix potential warnings/errors when `[Sealed]` is used on types. Fix #9065 (#9782)
Fix build warnings
```
build/mac/mobile/ReplayKit/RPScreenRecorder.g.cs(113,22): warning CS0628: 'RPScreenRecorder.RPScreenRecorder(IntPtr)': new protected member declared in sealed class
build/mac/full/ReplayKit/RPScreenRecorder.g.cs(113,22): warning CS0628: 'RPScreenRecorder.RPScreenRecorder(IntPtr)': new protected member declared in sealed class
```
which still happens even if we disable XM in `main` :|

Added generator test based on Whitney's test case from github issue

ref: https://github.com/xamarin/xamarin-macios/issues/9065
2020-10-05 22:01:36 -04:00
Sebastien Pouliot d7f8825119
[tests][xtro] Add enum member/values checks. Fix #7527 (#9691)
Figure out if
* we're missing enum values (easy to workaround, but annoying for developers)
* we expose enum values that are not defined natively (potential bugs)

reference: https://github.com/xamarin/xamarin-macios/issues/7527
2020-10-05 15:57:18 -04:00
Rolf Bjarne Kvinge def5b66232
Add ikvm-fork as a submodule instead of using the sources embedded in the mono archive. (#9776)
There are two reasons for this:

* It grants us more independence from the mono archive for .NET 6.
* We need a bugfix in ikvm, but we can't necessarily bump mono.
2020-10-05 15:43:32 +02:00
Rolf Bjarne Kvinge 5117154dc1
[msbuild] Refactor how we figure out which native libraries to sign for Xamarin.Mac (#9768)
Refactor how we figure out which native libraries to sign for Xamarin.Mac to align it with how it's done for Xamarin.iOS.

* The MmpTask searched (and returned) and *.dylib files in the
  Contents/MonoBundle directory; replace this with MSBuild item group
  globbing. This also makes an error code unused, so remove that as well.
* The _TemperMetal task returned the compiled *.metallib file; replace this
  with MSBuild item group globbing.
2020-10-05 08:56:28 +02:00
Rolf Bjarne Kvinge 439e7d10f6
[msbuild] Refactor the ProjectPaths to use strongly typed properties. (#9769) 2020-10-05 08:56:09 +02:00
Rolf Bjarne Kvinge ac129fd082
[msbuild] Share the _CreatePkgInfo target between Xamarin.iOS and Xamarin.Mac. (#9770)
The Xamarin.Mac version of _CreatePkgInfo had a 'Ditto' call that seemed like
a copy-paste error (the target below has the exac same call to 'Ditto'), and
there's no reason to call 'Ditto' when creating the PkgInfo file, so I just
removed it.

The 'Ditto' call was added here: ca028ea150 (diff-ccded350e40e767d69171655acb86b01R586-R606)
2020-10-05 08:55:35 +02: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
Rolf Bjarne Kvinge 3e236d58c3
[msbuild] Fix warning text for the 0111 warning to use the correct format specifier. (#9759) 2020-10-02 08:56:50 +02:00
Rolf Bjarne Kvinge aa8de5ae95
Bump to .NET 5.0.100-rc.2.20459.1 (#9758)
@(SdkSupportedTargetPlatform) was renamed to
@(SdkSupportedTargetPlatformVersion), so match that and update our own
variable names as well.
2020-10-02 08:31:38 +02:00
Sebastien Pouliot 2b6eb8438a
[tests][intro] ConstantsCheck should only be executed on latest OS (#9751)
since the files, mapped by the constants, might not be present in earlier
versions of the OS. We can only be sure, of their presence, on the
current/supported SDK version

Fix intro running on iOS 10.3 (64 bits)

```
Introspection.iOSApiTypoTest
    [PASS] AttributeTypoTest
    [FAIL] ConstantsCheck :   NetworkLibrary
  Expected: True
  But was:  False
 :   at Introspection.ApiTypoTest.ConstantsCheck () [0x00168] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tests/introspection/ApiTypoTest.cs:1088
```
2020-10-01 22:30:04 -04:00
Manuel de la Pena 2c78255dbe
[Metal][Generator] Fix the SetBuffers methods in protocols. Fixes #9649 (#9651)
Add fixes for Metal for XAM_CORE_4. Fixing the methods takes us to a dangerous path, so we do not do it unless we have issues about the methods.

Fixes https://github.com/xamarin/xamarin-macios/issues/9649
2020-10-01 14:27:55 -04:00
Sebastien Pouliot 8a92716c89
Bump API diff to the released (stable) xcode12 version of XI (#9755) 2020-10-01 14:04:56 -04:00
Sebastien Pouliot 3cb3d60e2b
[tests][xtro] Consider class (static) methods when checking for deprecation. Fix #9026 (#9743)
ref: https://github.com/xamarin/xamarin-macios/issues/9026
2020-10-01 08:02:09 -04:00
Ryan Pendleton bcfbed9ae6
[Photos] Correct nullability attributes for the Photos framework (#9740) 2020-10-01 08:42:44 +02:00
Rolf Bjarne Kvinge 82be630003
[tests] Set the build environment when cleaning project as well in the mac msbuild tests. (#9739)
This way we don't depend on having a system install of Xamarin.Mac.
2020-10-01 08:42:05 +02:00
Rolf Bjarne Kvinge 49f03c13fd
[tests] Fix a couple of typos. (#9736) 2020-10-01 08:41:01 +02:00
Rolf Bjarne Kvinge 0293ae5153
Revert "[introspection] Adapt to .NET 5's vision of how ConstructorInfo.ToString () should behave." (#9738)
This reverts commit f69ed9a25e.

This is now fixed in .NET.
2020-10-01 08:38:21 +02:00
Rolf Bjarne Kvinge 8876444586
[msbuild] Share the _*CompileSceneKitAssets targets between Xamarin.iOS and Xamarin.Mac. (#9735)
The Xamarin.iOS version is more updated, so that's the version now for both
Xamarin.iOS and Xamarin.Mac:

* The iOS version contains Inputs/Outputs (important for incremental builds).
* It doesn't use FileWrites (see e97d69b25c why
  this was removed for iOS)

Additionally define the _SceneKitCache variable for macOS as well, previously
it was only defined for iOS (I'm adding more variables than just
_SceneKitCache to macOS, most of the others will be used in in macOS in
upcoming pull requests, and this way turned out to be simplest).

And also add a new Xamarin.Mac test that exercises the CompileSceneKitAssets targets.
2020-10-01 08:37:52 +02:00
Sebastien Pouliot e343e68725
[tests][cecil] Check that error-based enum values don't have availability attributes (#9737)
and fixes the ones that have some.

From https://github.com/xamarin/xamarin-macios/issues/9724

We do not _normally_ add availability attributes on enums **members** that represent error codes. In part because it's a lot of metadata and, foremost, because it's not really helpful to write code. E.g.

```csharp
var err = Call.Api (1);
switch (err) {
case NSError.Bad:
case NSError.Wrong:
   Console.WriteLine ($"API failed: {err});
   break;
case NSError.Ok:
   break;
default:
   Console.WriteLine ($"Unknown error code {err}");
   break;
}
```

Adding version checks inside this would be complicated (source wise) and not really helpful since
* API can return undefined error code (and the error logic should work);
* Availability information is not 100% accurate;

As such we default to not add them - but we some time forgot about it.
2020-09-30 15:15:18 -04:00
Rolf Bjarne Kvinge 24795d1306
[tests] Simplify ProjectTestHelpers.FindRootDirectory by re-using existing code. (#9734) 2020-09-30 19:12:54 +02:00
Rolf Bjarne Kvinge f4832392d7
[tests] Remove duplicated code to set the requirement environment variables for building locally. (#9733) 2020-09-30 19:09:55 +02:00
Rolf Bjarne Kvinge 94064cf3f8
[msbuild] Merge the CodesignNativeLibraries task into the Codesign task. (#9731)
Merge the CodesignNativeLibraries task into the Codesign task, since they're almost
identical (so this turns out to be a significant code reduction).

* Add a StampPath property to Codesign task, which, if set, specifies if and where
  a stamp file should be created for each signed file/directory. This replaces the
  IntermediateOutputPath property from the CodesignNativeLibraries task.
* Copy logic to detect if a file/directory needs to be resigned from the CodesignNativeLibraries
  task to the Codesign task, using any stamp files.
* Use the more descriptive error messages E0004/E0005 from the CodesignNativeLibraries
  task.
* The CodesignNativeLibraries task recursed into directories to find *.dylibs and
  *.metallib files to sign; replace this with MSBuild item group globbing.
2020-09-30 18:37:21 +02:00
Rolf Bjarne Kvinge 3f0cac77b7
[xharness] Disable iOS 32-bit simulator tests, they don't work on Xcode 12+. (Re)fixes #xamarin/maccore@2284. (#9732)
Fixes https://github.com/xamarin/maccore/issues/2284.
2020-09-30 18:11:10 +02:00
Sebastien Pouliot 4a050c5ae6
[tests][xtro] Check for deprecated p/invokes (C API) (#9700)
We already had support for ObjC API but nothing reported missing
availability attributes for p/invokes, used in manual bindings
2020-09-30 09:57:37 -04:00
Sebastien Pouliot 11cec5096a
[tests][cecil] Check for absence of `[NoX]` (Unavailable) in platform assemblies. Fix #4835 (#9686)
It's way too easy to forget that attributes like `[NoiOS]` means the code
is not generated (for bindings) on that platform but that they will be
compiled for _manual_ bindings (not run thru the generator).

This can expose types (and API) that are not usable on some platforms.
This new test checks that the `[No*]` and `[Unavailable]` attributes
are not in their respective platform assemblies.

For compatibility (existing mistakes) we ignore the check on API that
are decorated with `[Obsolete]` attributes.

Changes in the bindings are fix such mistakes - mostly adding the
`[Obsolete]` attribute.

Fix https://github.com/xamarin/xamarin-macios/issues/4835
2020-09-30 07:56:48 -04:00
Sebastien Pouliot 3e14650b6e
[tests][intro] Split attributes typos from API typos tests (#9652)
The latter requires the spellchecker which varies by OS versions, so we
only run it on the latest OS version (and simulator, except macOS).

The former are some internal rules and can be run on every commit and
avoid finding issues late in a release cycle.

Also changed to
- process members even if a type is obsoleted
- process the properties and events on types

About the strings...

Some were fine, others were not. Copy/pasted strings are hard to
maintain. Moving them to constants will help, both maintainability and
will reduce the metadata size of the platform assemblies.

ref: https://github.com/xamarin/xamarin-macios/issues/9353
2020-09-30 07:53:48 -04:00
Rolf Bjarne Kvinge c0bd03b09f
[xharness] The dotnet version of introspection/iOS 10.3 works fine now. (#9728) 2020-09-30 08:21:52 +02:00
Rolf Bjarne Kvinge 5c113d225d
[xharness] Only run xammac variations if macOS tests are included. (#9729)
This fixes a build error with a xammac test variation that is executed even if
the macOS build is disabled.
2020-09-30 08:21:24 +02:00
Rolf Bjarne Kvinge b111ce0e5c
[dotnet-linker] Add a CollectUnmarkedMembersStep that will keep linked away types around for the static registrar. (#9722)
The static registrar may need access to types that have been linked away, so
store unmarked types so that the static registrar can access them later.

This also makes all the monotouch-test variations green, so enable them all.

Fixes this monotouch-test when all optimizations are enabled:

    MonoTouchFixtures.ObjCRuntime.RegistrarTest
        [FAIL] TestProtocolRegistration :   UIApplicationDelegate/17669
            Expected: True
            But was:  False
                at MonoTouchFixtures.ObjCRuntime.RegistrarTest.TestProtocolRegistration() in xamarin-macios/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs:line 1350
2020-09-29 16:41:47 +02:00
Rolf Bjarne Kvinge d861a2d348
[msbuild] Pass -F <dir> -framework <framework> for user frameworks. (#9721)
This fixes a build failure in the MyiOSAppWithBinding test.
2020-09-29 15:39:44 +02:00
Rolf Bjarne Kvinge ee1a91cd5b
[msbuild] Fix setting the IsXcode8 variable. (#9723)
This got accidentially dropped here: 95d71c8ee1 (diff-f677cd73ddfb82ecd3c565024fe0029cL68)
2020-09-29 15:39:22 +02:00
Rolf Bjarne Kvinge a5d06f0d1e
[dotnet-linker] Add a RemoveAttributesStep that will remove some of the attributes we don't need. (#9707)
The .NET linker comes with a way to remove attributes (by passing '--link-attributes
some.xml' as a command-line argument), but this has a few problems:

* We'd need to figure out which attributes to remove before running the linker,
  but the code to figure out which optimizations have been enabled (and which attributes
  should be removed) is in our custom linker code. We'd need to refactor a big chunk
  of code to move this logic out of our custom linker code.
* We need to keep the removed attributes around, because the static registrar needs
  them. Our custom linker logic is not notified for removed attributes, which means
  we'd need to store all attributes for the attribute types we're interested in (as
  opposed to this solution, where we only store attributes that are actually removed).
* The attributes we want removed may contain references to types we don't want
  linked away. If we ask the linker to remove those attributes, then the types may
  be linked away as well, and there's no good way around this.

The end result is that a custom step is the best solution for now.

Fixes these monotouch-test tests when enabling all optimizations:

    Xamarin.BindingTests.ProtocolTest
        [FAIL] OnlyProtocol :   [Protocol] IP1
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.OnlyProtocol() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 47

        [FAIL] ProtocolWithBaseType :   [Protocol] IP2
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.ProtocolWithBaseType() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 79

        [FAIL] ProtocolWithBaseTypeAndModel :   [Protocol] IP3
            Expected: 0
            But was:  1
                at Xamarin.BindingTests.ProtocolTest.ProtocolWithBaseTypeAndModel() in /Users/rolf/work/maccore/main/xamarin-macios/tests/bindings-test/ProtocolTest.cs:line 115
2020-09-29 09:12:22 +02:00
Rolf Bjarne Kvinge fa58a24161
[msbuild] Port the test projects to .NET, and add a test case that compares the built .app (#9706)
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.
2020-09-29 08:44:08 +02:00
Rolf Bjarne Kvinge ddde72ad2a
[msbuild] Use the ParseBundlerArguments task to parse mmp's --custom_bundle_name argument. (#9709) 2020-09-29 08:42:28 +02:00
Manuel de la Pena b1672546fe
[VSMac] Bump max version to current stable. (#9711) 2020-09-28 12:24:32 -04:00
Alex Soto 89211aa6a2
[README] Add stable d16-7 version with Xcode 12 support (#9710) 2020-09-28 10:58:32 -04:00
Rolf Bjarne Kvinge 15efbe4a69
[msbuild] Share the _*CompileInterfaceDefinitions targets between Xamarin.iOS and Xamarin.Mac. (#9708)
The Xamarin.iOS version seemed more updated, so that's the version now for
both Xamarin.iOS and Xamarin.Mac.

A few differences in the Xamarin.iOS versions are:

* The _CoreCompileInterfaceDefinitions target contains Inputs/Outputs
  (important for incremental builds).
* EnableOnDemandResources is set to $(EnableOnDemandResources), not hardcoded
  to 'false' (there is no real difference right now, because
  $(EnableOnDemandResources) defaults to 'false' in Xamarin.Mac).
* It doesn't use FileWrites (see e97d69b25c why
  this was removed for iOS)
2020-09-28 09:17:50 +02:00
Rolf Bjarne Kvinge 58d546f2eb
[tools] Remove unnecessary conditional code (#9705)
The conditional code was only there to make the code compile; now it compiles so
no need for the condition anymore.
2020-09-28 08:36:47 +02:00
Rolf Bjarne Kvinge 5aed65d45e
[xharness] Fix rendering human-readable results for parameterized tests. Fixes #9400. (#9704)
We weren't probably parsing nested test-suite elements in the xml, so
implement parsing of test-suite elements using recursion, which is easier and
less error-prone (and turns out to work fine too).

Also use TextReader/Writer instead of StreamReader/Writer in a few places.
This makes it easier to write tests, since TextReader/Writer can use in-memory
streams (no need to mess with temporary files).

Fixes https://github.com/xamarin/xamarin-macios/issues/9400.
2020-09-25 19:18:37 +02:00
Manuel de la Pena 764734d20a
[Main][Xcode12] Add support for Xcode 12 2020-09-25 12:58:29 -04:00
Rolf Bjarne Kvinge 5ced9ee978
[xharness] Use XmlReaderSettings to ignore stuff we don't care about when parsing xml. (#9703)
At the very least this makes stepping through code while debugging much
faster, since stepping through whitespace and comments is useless.
2020-09-25 18:17:47 +02:00
Rolf Bjarne Kvinge 3b38f2242e
[xharness] Fix typo in test case creating two identical test cases. (#9702) 2020-09-25 17:30:04 +02:00
Rolf Bjarne Kvinge ac496baabb
[dotnet-linker] Make sure to preserve block-related generated code. Fixes #9562. (#9685)
Fixes https://github.com/xamarin/xamarin-macios/issues/9562.

It also fixes this monotouch-test when enabling all optimizations:

    [FAIL] BlockReturnTest : ObjCRuntime.RuntimeException : Invalid DelegateProxyAttribute for the return value for the method MonoTouchFixtures.ObjCRuntime.RegistrarTest+BlockReturnTestClass.MethodReturningBlock: DelegateType (ObjCRuntime.Trampolines+SDRegistrarTestBlock) specifies a type without a 'Handler' field.
2020-09-25 16:57:04 +02:00
Rolf Bjarne Kvinge 2e52dfdb3b [tools] Unify information about CoreNFC in the Frameworks class, and fix selecting whether a framework should be linked weakly or not in dotnet-linker.
This fixes a startup crash in the simulator with Xcode 12:

    Library not loaded: /usr/lib/libnfshared.dylib
      Referenced from: /Applications/Xcode_12.0.0-GMb.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/CoreNFC.framework/CoreNFC
      Reason: no suitable image found.  Did find:
    	/usr/lib/libnfshared.dylib: mach-o, but not built for platform iOS-sim

Ref: https://stackoverflow.com/q/63915728/183422
2020-09-25 13:07:42 +02:00
Manuel de la Pena 022f5d331c [DotNet] Ignore those tests that require Mac OS X if not enabled. 2020-09-24 17:46:22 -04:00
Manuel de la Pena c962651df7 [Localizations] Update Errors.cs with the new error. 2020-09-24 13:35:14 -04:00
Manuel de la Pena 34fc106bad [xtro] Fix osome ignores. 2020-09-24 11:56:12 -04:00
Manuel de la Pena 591c28d882 [MSbuild] Remove duplicated target. 2020-09-24 11:36:25 -04:00