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

15025 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 6c04f7621a
[tools] Update SdkVersions.cs after the latest Xcode 14.2 bump. (#17101)
* Update `SdkVersions.cs` after the latest Xcode 14.2 bump.
* Rename `[SdkVersions|ProductConstants].cs.in` to `[SdkVersions|ProductConstants].in.cs`.
  This way the autoformatter makes sure it's formatted correctly.
2022-12-21 17:44:27 +01:00
Rolf Bjarne Kvinge e99c71ad36
[tests] Fix a few nullability issues in cecil-tests and the .NET tests. (#17095)
Also make any nullability warnings show up as errors.
2022-12-21 10:19:13 +01:00
Alex Soto a7502b2b8d
[main] Bump bindings to Xcode 14.2 (#17037) 2022-12-21 08:39:03 +01:00
Rolf Bjarne Kvinge 68a08ad217
[Foundation] Make NSAttributedStringDocumentType a strongly-typed enum. (#17094)
This simplifies our code somewhat, and in XAMCORE_5_0 we can simplify
even more.

Ref: https://github.com/xamarin/xamarin-macios/issues/14489
2022-12-21 07:45:56 +01:00
Rolf Bjarne Kvinge fe5abf4d2d
[AppKit] Add missing fields to the NSKey enum. Fixes #17085. (#17086)
Fixes https://github.com/xamarin/xamarin-macios/issues/17085.
2022-12-21 07:44:51 +01:00
Rolf Bjarne Kvinge 43170cb37e
[tests] Add cecil-test to verify that the obsolete messages are identical between platforms for a given API. (#17089) 2022-12-21 07:44:15 +01:00
Rolf Bjarne Kvinge d9bae59f69
[src/generator/tests] Verify that availability attributes don't include useless version information. Fixes #11029. (#17090)
* Change the generator to not write the version in SupportedOSPlatform
  attributes unless it's greater than min OS version.
* Fix a few redundant Mac Catalyst availability versions.
* Uncomment the test to verify that availability attributes don't include
  useless version information.

Fixes https://github.com/xamarin/xamarin-macios/issues/11029.
2022-12-21 07:44:02 +01:00
Rolf Bjarne Kvinge 83b0727967
[tests] Port and improve the availability attribute test from introspection. (#17083)
Port the availability attribute test from introspection to cecil-tests. It's much
easier and faster to test attributes using Cecil using a desktop executable than
having to execute a test app on each target platform.

This also means that we can make the ApiAvailabilityTest in introspection
legacy-only.

Ref: https://github.com/xamarin/xamarin-macios/issues/10834
2022-12-20 12:46:06 +01:00
Rolf Bjarne Kvinge a227b77402
[generator] tvOS attributes aren't implied from iOS attributes. (#17057)
This hasn't been a problem until now because we've always had tvOS attributes on
most API, but when bumping min OS versions for .NET 8, we'll also remove a lot of
redundant availability attributes. This would break a case where a type is unavailable
on all platforms except tvOS (but without any tvOS availability attribute), and then
we'd get the (implied) iOS (un)availability attribute.
2022-12-20 07:29:19 +01:00
Rolf Bjarne Kvinge e10e5e51aa
[MapKit] Move MKOverlayView.MKRoadWidthAtZoomScale to MKOverlayRenderer. (#17078)
MKRoadWidthAtZoomScale is a P/Invoke we decided to put in the MKOverlayView
class a long time ago.

This is problematic, because the P/Invoke is available on more platforms than
MKOverlayView (and the MKOverlayView class is deprecated, while the P/Invoke
is not), which it impossible to get the availability attributes right.

So instead move the P/Invoke to the MKOverlayRenderer class (but keep the old
code around until XAMCORE_5_0 for backwards compat reasons). The
MKOverlayRenderer class is the replacement for the deprecated MKOverlayView
class, and it's also available on all the platforms the P/Invoke is available,
so the availability attributes are now trivial.
2022-12-19 20:58:43 +01:00
Rolf Bjarne Kvinge 968f9d1214
[WebKit] Merge WKWebKit into WebKit. (#17062)
A long time ago, Apple created WebKit bindings for macOS, and we bound those in the webkit.cs and WebKit/*.cs files. These were later deprecated in macOS 10.14.

A bit later (iOS 8.0 / macOS 10.10) Apple created new (and severely limited) WebKit API for both iOS and macOS, and since these were quite different/new, we bound them in wkwebkit.cs and WKWebKit/*.cs files.

However, the actual namespace for both is WebKit, which leaves us with a few special-cases in our code to handle the fact that we've bound the same namespace in different files/directories.

Unifying these implementations in webkit.cs and WebKit/*.cs, makes it possible to avoid these special cases.

I've also explicitly added No* availability attributes to the old and deprecated macOS bindings for all other platforms than macOS, in order to avoid more special-casing when it comes to availability attributes (and that logic is already complicated enough as it is).
2022-12-19 18:37:53 +01:00
Rolf Bjarne Kvinge 01123bfb0e
[tests] Fix the AppWithNativeDynamicLibrariesInPackageReference to work when not all platforms are enabled. (#17081) 2022-12-19 18:37:10 +01:00
Rolf Bjarne Kvinge e06f49dd90
[dotnet] We no longer need to add the entry assembly as a root assembly for the linker. (#17026)
It's automatically done in the linker's MSBuild logic.

Not only is it no longer necessary (hasn't been for a while), it'll be wrong
in .NET 8 after https://github.com/dotnet/linker/pull/3124.
2022-12-19 18:36:54 +01:00
Rolf Bjarne Kvinge 65f362a115
[dotnet] Add [SupportedOSPlatformGuard] attributes to UIDevice.CheckSystemVersion. Fixes #16250. (#16513)
This requires the fix for https://github.com/dotnet/roslyn-analyzers/issues/6204
to be shipped in .NET 7 first. This will likely happen in .NET 7.0.200, which we'll
likely ship from main, thus I'm merging this into main.

Fixes https://github.com/xamarin/xamarin-macios/issues/16250.
2022-12-16 17:22:41 +01:00
Rolf Bjarne Kvinge d6cb31402f
[tools] Split tools/common/SdkVersions.cs in two files. (#17067)
We need parts of tools/common/SdkVersions.cs when building tests on Windows.
In order to simplify our Windows-life, we're going to check in the generated
SdkVersions.cs file, that way it won't have to be re-generated on Windows (the
logic is very make-based, and not easily executed on Windows).

However, parts of SdkVersions.cs would change every commit, which would make
the above solution rather annoying. So split out those parts into a new file
(ProductConstants.cs), which is still generated during the build (and not
checked in).
2022-12-16 15:25:53 +01:00
Rolf Bjarne Kvinge e69d361c11
[Foundation] Unify the source code for NSAttributedStringDocumentAttributes. (#17069)
Unify the source code for NSAttributedStringDocumentAttributes between
iOS and maOS.

As a result, we're now exposing a few APIs on macOS that were previously
only exposed on iOS.

This PR might be easier to review commit-by-commit.
2022-12-16 15:23:24 +01:00
Rolf Bjarne Kvinge 574031059d
[tests] Improve the Bug35176 generator test. (#17070)
Make it assert on the exact list of attributes we're expecting. This makes it
much easier to see what changed.
2022-12-16 15:20:06 +01:00
Andoni Morales Alastruey 4cfccff38e
Fix libs reidentification deployed in a subdirectory (#16706)
Dynamic libraries might be deployed in subdirectories such as libclrjit.dylib from the nuget package cefglue.common:
Contents/MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

The library ID for that library should be: @executable_path/../MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

Instead of: @executable_path/../MonoBundle/libclrjit.dylib

Beside the library ID being wrong, when it's combined with the nuget package microsoft.netcore.app.runtime.osx-x64 providing a library with the same name, both uses the same `ReidentifiedPath`, which can cause a failure in the InstallNameTool tasks that are run in parallel operating on the same temporary file.

The following patch uses the `RelativePath` for the tempory file used by `InstallNameTool` so that there are no clashes with other files with the same name deployed in other directories. It also uses the `RelativePath` to create the correct library id: @executable_path/../../Contents/MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

Partially fixes https://github.com/xamarin/xamarin-macios/issues/15173 for this scenario
2022-12-16 09:17:01 +01:00
Rolf Bjarne Kvinge fc487c2f59
[src] Remove unnecessary versions in .NET availability attributes. (#17061)
There's no need to specify versions earlier than the earlier OS version we support.

This was done with a bit of sed:

    # SupportedOSPlatform ("ios7.0") -> SupportedOSPlatform ("ios")
    sed -i '' -E 's/SupportedOSPlatform [\(]"ios7[.]0"[\)]/SupportedOSPlatform ("ios")/' ./*.cs ./*/*.cs

    # SupportedOSPlatform ("tvos9.0") -> SupportedOSPlatform ("tvos")
    sed -i '' -E 's/SupportedOSPlatform [\(]"tvos9[.]0"[\)]/SupportedOSPlatform ("tvos")/' ./*.cs ./*/*.cs

    # SupportedOSPlatform ("macos10.(7|8|9|10|11|12|13).*") -> SupportedOSPlatform ("macos")
    # SupportedOSPlatform ("macos10.(7|8|9|10|11|12|13") -> SupportedOSPlatform ("macos")
    # SupportedOSPlatform ("macos10.14.0") -> SupportedOSPlatform ("macos")
    # SupportedOSPlatform ("macos10.14") -> SupportedOSPlatform ("macos")
    sed -i '' -E 's/SupportedOSPlatform [\(]"macos10[.](7|8|9|10|11|12|13)[.][0-9]*"[\)]/SupportedOSPlatform ("macos")/' ./*.cs ./*/*.cs
    sed -i '' -E 's/SupportedOSPlatform [\(]"macos10[.](7|8|9|10|11|12|13)"[\)]/SupportedOSPlatform ("macos")/' ./*.cs ./*/*.cs
    sed -i '' -E 's/SupportedOSPlatform [\(]"macos10[.]14[.]0"[\)]/SupportedOSPlatform ("macos")/' ./*.cs ./*/*.cs
    sed -i '' -E 's/SupportedOSPlatform [\(]"macos10[.]14"[\)]/SupportedOSPlatform ("macos")/' ./*.cs ./*/*.cs
2022-12-16 08:21:32 +01:00
Rolf Bjarne Kvinge eeb5e50d0f
[CloudKit] Update availability attributes for CKShareParticipantType. (#17066)
* The iOS attribute is incorrect (iOS 10.10 doesn't exist), so fix that
  according to headers (should be iOS 10.0).
* When looking at the header, I realized the enum is deprecated, so fix that
  too.
2022-12-16 08:13:51 +01:00
Rolf Bjarne Kvinge 9f1d9e6d38
[src] Remove a few more old availability attributes. (#17068) 2022-12-16 08:13:24 +01:00
Rolf Bjarne Kvinge aee3f88ae8
[msbuild/dotnet] Use a more unique property name than _AOTCompiler. (#17049)
Use a more unique property name than _AOTCompiler (use _XamarinAOTCompiler
instead) to try to prevent any problems if somebody else tries to use
'_AOTCompiler' somewhere.

Ref: https://github.com/xamarin/xamarin-macios/pull/17033#discussion_r1047823981
2022-12-16 07:22:51 +01:00
Rolf Bjarne Kvinge 9bf322525e
Bump Xamarin.MacDev. (#17056)
This requires a few nullability updates in our code as well.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@14d5361 Enable nullability in PListObject.cs

Diff: ac2647b643..14d53612d4
2022-12-16 07:22:37 +01:00
GitHub Actions Autoformatter 697bfa06c6 Auto-format source code 2022-12-15 15:43:16 +00:00
Rolf Bjarne Kvinge 41a4abe54b [xtro] Update. 2022-12-15 16:35:40 +01:00
Steve Hawley 4f409ef771
[dotnet] security string pinvokes (#17054)
- Renamed NativeString.cs -> TransientString.cs
- Added an encoding parameter for available Marshal methods
- Added encoding in the ctor
- Handled security strings
2022-12-15 09:20:48 -05:00
Rolf Bjarne Kvinge f06c4f2df1
[tests] Remove ignore due to custom code that's been gone for almost two years. (#17027)
We had custom code with Console.WriteLine for macOS 10.12 for a while, but that was removed here:

a93bcdec34

So there's no need to skip the test that verifies we don't call Console.WriteLine anymore.
2022-12-15 14:28:51 +01:00
Rolf Bjarne Kvinge 139bced87d [Foundation] Clean up some dead code. 2022-12-15 13:20:05 +01:00
Rolf Bjarne Kvinge 547bb73ab9 [Foundation] Move NSAttributedStringDocumentAttributes.Timeout to shared code. 2022-12-15 13:20:05 +01:00
Rolf Bjarne Kvinge 556c5fd58d [Foundation] Move NSAttributedStringDocumentAttributes.TextSizeMultiplier to shared code. 2022-12-15 13:20:05 +01:00
Rolf Bjarne Kvinge 08749c2baf [Foundation] Move NSAttributedStringDocumentAttributes.TextEncodingName to shared code. 2022-12-15 13:20:05 +01:00
Rolf Bjarne Kvinge 5ee6c6229c [Foundation] Move NSAttributedStringDocumentAttributes.BaseUrl to shared code. 2022-12-15 13:20:05 +01:00
Rolf Bjarne Kvinge 6773c68a6f [Foundation] Move NSAttributedStringDocumentAttributes.WebResourceLoadDelegate to shared code. 2022-12-15 13:20:05 +01:00
Rolf Bjarne Kvinge b6d8e52961 [Foundation] Move NSAttributedStringDocumentAttributes.WebPreferences to shared code. 2022-12-15 13:20:04 +01:00
Rolf Bjarne Kvinge 24f42015b7 [Foundation] Move NSAttributedStringDocumentAttributes.DefaultTabInterval to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:14 +01:00
Rolf Bjarne Kvinge a34b630304 [Foundation] Move NSAttributedStringDocumentAttributes.HyphenationFator to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:14 +01:00
Rolf Bjarne Kvinge 01f770c24d [Foundation] Move NSAttributedStringDocumentAttributes.BackgroundColor to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 0392e9803f [Foundation] Move NSAttributedStringDocumentAttributes.ReadOnly to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.

Also make the property nullable for macOS and XAMCORE_5_0.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 22a8aae9e0 [Foundation] Move NSAttributedStringDocumentAttributes.ViewMode to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge cb12b9ebb9 [Foundation] Move NSAttributedStringDocumentAttributes.ViewZoom to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 82126c0ed2 [Foundation] Move NSAttributedStringDocumentAttributes.ViewSize to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 40c3b428ec [Foundation] Move NSAttributedStringDocumentAttributes.PaperMargin to shared code. 2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 3aa180c2ae [Foundation] Move NSAttributedStringDocumentAttributes.PaperSize to shared code.
This property has also been added on macOS (where it didn't exist before), since
both documentation and headers reveal it's available there.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 947855e1eb [Foundation] Unify NSAttributedStringDocumentAttributes.WeakDefaultAttributes.
The iOS code uses the NSDefaultAttributesDocumentAttribute key, while the macOS code
uses the NSDefaultAttributesDocumentOption key, but according to Apple's documentation
these keys have the same underlying string value, so just use NSDefaultAttributesDocumentAttribute
for all platforms to simplify code.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 4d695bd1df [Foundation] Move NSAttributedStringDocumentAttributes.ReadAccessUrl to shared code. 2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 235c9afe45 [Foundation] Unify NSAttributedStringDocumentAttributes.DocumentType.
The iOS code uses the NSDocumentTypeDocumentAttribute key, while the macOS code uses
the NSDocumentTypeDocumentOption key, but according to Apple's documentation these
keys have the same underlying string value, so just use NSDocumentTypeDocumentAttribute
for all platforms to simplify code.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 41f1541650 [Foundation] Unify NSAttributedStringDocumentAttributes.WeakDocumentType.
The iOS code uses the NSDocumentTypeDocumentAttribute key, while the macOS code uses
the NSDocumentTypeDocumentOption key, but according to Apple's documentation these
keys have the same underlying string value, so just use NSDocumentTypeDocumentAttribute
for all platforms to simplify code.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 5bed159c0b [Foundation] Unify NSAttributedStringDocumentAttributes.StringEncoding.
The iOS code uses the NSCharacterEncodingDocumentAttribute key, while the macOS code
uses the NSCharacterEncodingDocumentOption key, but according to Apple's documentation
these keys have the same underlying string value, so just use NSCharacterEncodingDocumentAttribute
for all platforms to simplify code.
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge 8f03d49a59 [Foundation] Start unifying the source code for NSAttributedStringDocumentAttributes.
Constructors first!
2022-12-15 13:18:13 +01:00
Rolf Bjarne Kvinge d52fd8ddc8
[tests] Assert that we don't have any private IntPtr constructors in cecil-tests. (#17055) 2022-12-15 13:13:21 +01:00