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

7366 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 06d5fc8df7
[tests] Fix MTLResidencySet tests on macOS Sequoia. (#21662) 2024-11-20 08:58:29 +01:00
Rolf Bjarne Kvinge 34666f5228
[CoreLocation] Fix misspelled field. Fixes #21641. (#21652)
Fixes https://github.com/xamarin/xamarin-macios/issues/21641.
2024-11-19 13:42:17 +01:00
Manuel de la Pena 6bfececed5
[Rgen] Implement the generation of the smart enums. (#21562)
Add the code generation for smart enumerators. This means the following
changes:

1. Refactor the way we register the diff pipelines.
2. Add code that generates the Extension class for the enums.
3. Add code that will generate the Library.g.cs partial class.

---------

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2024-11-19 06:55:43 -05:00
Rolf Bjarne Kvinge 0a52c56892
[static registrar] Make sure to save any changes made by the managed static registrar. Fixes #21606. (#21637)
If an assembly only required the lookup tables from the managed static
registrar (and not any other code), we wouldn't save those changes.

This would lead to a runtime exception:

```
Microsoft.iOS: Processing Objective-C exception for exception marshalling (mode: 2):
Could not find the type 'ObjCRuntime.__Registrar__' in the assembly 'X.Y.Z'. (ObjCRuntime.RuntimeException)
   at ObjCRuntime.RegistrarHelper.GetMapEntry(String assemblyName) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 105
   at ObjCRuntime.RegistrarHelper.GetMapEntry(Assembly assembly) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 93
   at ObjCRuntime.RegistrarHelper.LookupRegisteredType(Assembly assembly, UInt32 id) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/RegistrarHelper.cs:line 199
   at ObjCRuntime.Class.ResolveToken(Assembly assembly, Module module, UInt32 token) in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Class.cs:line 521
```

The fix is to save the assembly if the managed static registrar added
lookup
tables to the assembly.

Fixes https://github.com/xamarin/xamarin-macios/issues/21606.
2024-11-18 20:31:34 -05:00
Rolf Bjarne Kvinge 98bee4d133
[cecil-tests] Add two more tests. (#21625)
Add two more Cecil tests:

* Verify that we don't call the NSObject.Handle setter, we're supposed to call
  NSObject.InitializeHandle instead (which throws an exception if the handle
  is null),
* Verify that we never call the base class' default constructor (very easy
  mistake to make) in manually bound constructors - we're supposed to call the
  overload that takes an `NSObjectFlag` parameter instead.
2024-11-18 10:18:13 -08:00
Rolf Bjarne Kvinge e9009b4371
[UIKit] Fix nullability for numerous UIView members. Fixes #21598. (#21621)
Fixes https://github.com/xamarin/xamarin-macios/issues/21598.
2024-11-15 07:47:27 -08:00
Rolf Bjarne Kvinge 305f4e2abe
[AppKit] Fix nullability for numerous NSView members. Fixes #21598. (#21619)
Fixes https://github.com/xamarin/xamarin-macios/issues/21598.

---------

Co-authored-by: Sergey Nechaev <6499856+snechaev@users.noreply.github.com>
2024-11-15 07:47:16 -08:00
Rolf Bjarne Kvinge ad61471e8b
[tests] Use a file as the Outputs property in MSBuild. (#21596)
Use a file (as opposed to a directory) as the Outputs property in MSBuild targets.

Directories have unintuitive file stamp behavior sometimes, which may confuse incremental builds, so use files instead to drive incremental builds.
2024-11-15 00:48:08 +01:00
Rolf Bjarne Kvinge 0e1c717bfc
[tests] Cache the evaluation of the DOTNET_DIR variable. (#21600)
This speeds up the tests somewhat, since it's fetched quite a few times.
2024-11-15 00:47:22 +01:00
Rolf Bjarne Kvinge 9ea3cff36c
[AppKit/MediaExtension/introspection] Fix issues found with introspection on Sequoia. (#21587)
* Mark a few MediaExtension fields as Notification fields.
* Remove extreanous NSSharingCollaborationModeRestriction.AlertRecoverySuggestionButtonLaunchUrl setter.
* introspection: ignore methods that start with '_Init', aren't publicly
  visible, and bind an Objective-C constructor when verifying that a managed
  method doesn't bind an Objective-C constructor.
2024-11-08 11:35:11 +01:00
Rolf Bjarne Kvinge 2e9273a2ec
Delete some legacy Xamarin files and other unused stuff. (#21583) 2024-11-07 08:06:50 +01:00
Rolf Bjarne Kvinge 49b837fc9e
[introspection] Numerous technical debt fixes. (#21584)
* Remove all legacy code.
* Fix all warnings.
* Enable warnings as errors.
* Started unifying code between macOS vs iOS/tvOS/MacCatalyst.
* Updated README slightly.
2024-11-07 08:06:31 +01:00
Rolf Bjarne Kvinge 95a0ad2e27
[tests] Add make target to build (not run) all the test suites. (#21575)
This is useful to verify that sweeping code changes actually compile everywhere.
2024-11-06 17:34:47 +01:00
Rolf Bjarne Kvinge 0daefa2212
Remove a lot of legacy logic. (#21576) 2024-11-06 11:34:39 +01:00
Rolf Bjarne Kvinge eafa2d1b63
[tests] Improve PasteboardTest.ImagesTest to hopefully work better. (#21571)
Retry the test 10 times if it fails - it uses a shared resource (the
pasteboard), so it's possible to run into race conditions if the same test
also runs in a different process at the same time.

Also remove code that we removed a long time ago, so that the test actually
runs: 86ab2bc1d1.

Hopefully fixes https://github.com/xamarin/maccore/issues/2569.
2024-11-05 11:56:18 +01:00
Rolf Bjarne Kvinge 67d072e454
[msbuild] Add support for alternate app icons. (#21475)
This adds support for including all app icons in the app, as well as for specifying alternate app icons.

Including all app icons is enabled by setting the following MSBuild property:

```xml
<PropertyGroup>
    <IncludeAllAppIcons>true</IncludeAllAppIcons>
</PropertyGroup>
````

This will make the `ACTool` task pass `--include-all-app-icons` to `actool` when compiling the asset catalog.

Specifying alternate app icon(s) is enabled by setting the following MSBuild item:

```xml
<ItemGroup>
    <AlternateAppIcon Include="MyAlternateAppIcon" />
    <AlternateAppIcon Include="MyOtherAlternateAppIcon" />
</ItemGroup>
```

Note that the included value is the name if the icon in question, not the path or the filename of the actual icon file (this way there's no need to have different items for different platforms, because there are some platform differences with regards to paths and icon file extensions).

In order to make the behavior consistent, this PR also adds support for specifying the app icon itself using an MSBuild property (in addition to the existing Info.plist property `XSAppIconAssets`, which will eventually be deprecated):

```xml
<PropertyGroup>
    <AppIcon>MyAppIcon</AppIcon>
</PropertyGroup>
```

The same note applies here: the value is the name of the icon.

Note about platforms: the code is there for all platforms (iOS, tvOS, macOS and Mac Catalyst), but alternate app icons only seem to work for iOS and tvOS. `UIApplication.SupportsAlternateIcons` always returns `false` on Mac Catalyst (googling only find people in the same situation), and macOS doesn't have this API to begin with (nor anything similar):

Also:

* Add a bunch of tests.
* Document on our website: https://github.com/dotnet/docs-mobile/pull/53
* Samples for iOS and tvOS: https://github.com/dotnet/macios-samples/pull/2

Fixes https://github.com/xamarin/xamarin-macios/issues/12790.
Fixes https://github.com/xamarin/xamarin-macios/issues/20182.
2024-11-04 18:24:00 +01:00
Rolf Bjarne Kvinge 1faaf032de
[tests] Remove the legacy scripted tests. (#21568)
These tests haven't found any issues in many years, and they're also based on
legacy Xamarin, so just remove them instead of porting them to .NET.
2024-11-04 11:32:21 +01:00
Rolf Bjarne Kvinge 589dd741b2
[devops] Improve Windows tests a little bit. (#21558)
* Run both sets of Windows tests (local and remote), and fail afterwards if there
  are test failures. This way we get both test suites executed even if the first
  one fails.
* Create a script for executing the local tests (makes it easier to run locally
  as well).
* Make it possible to use a custom built .NET locally by honoring any DOTNET variable
  instead of blindly setting it (makes it easier to test locally).
* Add a .gitignore for the test configuration file we create to run tests on Windows.
* Some minor code simplifications.
2024-11-04 10:22:18 +01:00
Rolf Bjarne Kvinge 0c2aa7522a
[csharp] Port the run-with-timeout script in tests/ to a .NET project. (#21563) 2024-11-01 08:56:38 +01:00
Manuel de la Pena 524279ffc0
[Rgen] Simplify the way we execute tests on all platforms. (#21547)
There is no need to write a line per platform when we can use an
attribvute for that.

---------

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2024-10-30 19:15:33 -04:00
Manuel de la Pena 69895c9598
[RGen] Move common shared code to its own project. (#21548)
This simplifies the usage of those external file, specially for test
projects.
2024-10-30 10:59:01 -04:00
Manuel de la Pena d51fa94c3d
[Rgen] Provide a data model to make the code generator more performant. (#21517)
In order to fully take advantage of the
[caching](https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md#caching)
provided by the incremental code generator infrastructure we move to use
a data model that will represent the code changes that will trigger a
regeneration of certain classes.

The current implementation only takes care of the changes that will
trigger a regeneration on enums:

1. Enum fully qualified name changed.
2. Attributes added or removed in the enum.
2. Enum values added/removed.

We provide our own Comparer to have more control on how the structures
are compared.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2024-10-29 13:58:20 -04:00
Alex Soto e581020612
[main] Merge xcode16.1 into main (#21539) 2024-10-29 06:43:01 -04:00
Alex Soto 3b9c704209
[xcode16.1] Bump to stable release of Xcode 16.1 (#21538) 2024-10-28 20:28:35 -04:00
Rolf Bjarne Kvinge 3ac70f74fb
[tests] Improve the AssetsTest test. (#21532)
* Remove test cases for 32-bit arm, which we don't support anymore.
* Use test-level test cases instead of fixture-level test cases, because the
  fixture-level test cases are all rendered identically in both the console
  output and the html report, making it impossible to figure out which
  variation failed when something goes wrong.
* Add new assets related to app icons.
* Update according to new test project assets.
* Ask 'assetutil` to write the output we care about to a file, that way we
  don't  have to take random stdout output into account.
* Simplify how the test asserts asset catalog contents to include all assets,
  not just a selection of them.

Note: might be easier to review commit-by-commit, because there's a lot of new
assets and I'm adding them in a separate commit.
2024-10-28 15:28:57 +01:00
Alex Soto 34ebd5776d
[xcode16.1] Merge main into Xcode 16.1 (#21528) 2024-10-26 11:08:03 -04:00
Alex Soto 0c21018d8f
[xcode16.1] Update NetworkExtension all the way to Xcode 16.1 RC (#21518) 2024-10-26 07:10:22 -04:00
Alex Soto 7618edb1ac Merge remote-tracking branch 'origin/main' into xcode16.1 2024-10-25 18:09:22 -04:00
Alex Soto ae9a1ed767
[xcode16.1] Update PencilKit all the way to Xcode 16.1 RC (#21519)
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2024-10-25 07:19:11 -04:00
Alex Soto a80e2ce8c1
[xcode16.1] Update UIKit all the way to Xcode 16.1 RC (#21522) 2024-10-25 07:18:23 -04:00
Rolf Bjarne Kvinge 9caa2cf6bc
[dotnet] Port misc build/test logic to .NET. (#21497)
More steps towards removing our build-time Mono dependency.
2024-10-25 09:27:41 +02:00
Alex Soto 13b56f0bbe [xcode16.1] Update TVServices all the way to Xcode 16.1 RC 2024-10-24 16:40:16 -04:00
Rolf Bjarne Kvinge f7dae27fa2
[src/tests] Remove the XAMCORE_3_0 define. (#21506)
It's always defined, now that legacy Xamarin is not supported anymore, so just
remove it.
2024-10-24 16:55:32 +02:00
Rolf Bjarne Kvinge a6ca85f5fd
[msbuild] Add support for the 'overwrite' metadata for PartialAppManifest items. (#21508)
This makes it possible to provide partial app manifests with default
values, which can then be overridden in the main Info.plist.
2024-10-24 16:37:30 +02:00
Rolf Bjarne Kvinge ddd75fc1da
[msbuild] Unify escaping algorithm for mangled resources, and remove code duplication. (#21488)
When embedding bundle resources to an assembly as assembly resources, we store
the LogicalName property for the resource. We do this by using the LogicalName
property as the resource name - but we need to encode forward and backward
slashes, since they don't work properly has resource names.

In the past, we've encoded forward and backward slashes differently, but this
results in different encodings depending on whether the resources are embedded
on Windows or macOS.

So change the encoding, so that both forward and backward slashes are encoded
the same way, and then they're extracted using the platform's path character.
This way we get consistent behavior on both platforms.
2024-10-24 13:49:24 +02:00
Alex Soto 9b8f44a036
[xcode16.1] Update HealthKit all the way to Xcode 16.1 RC (#21510)
Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2024-10-24 06:15:00 -04:00
Rolf Bjarne Kvinge 71a29e3777
[msbuild] Use MSBuild assemblies from NuGet instead of Mono's installation. (#21471)
Use MSBuild assemblies from NuGet instead of Mono's installation. Try to get
the closest version to Mono's assemblies.

This avoids a Mono dependency.
2024-10-23 21:10:21 +02:00
Rolf Bjarne Kvinge b4c0019542
[msbuild/dotnet] Add support for compressed xcframeworks in binding projects and as NativeReference items. Fixes #21294. (#21492)
Now it's possible to reference a compressed xcframework like this:

```xml
<NativeReference Include="path/to/myframework.xcframework.zip" />
```

This makes it easier to work with xcframeworks on Windows, because
xcframeworks can contain symlinks, and by zipping them up the whole symlink
problem is avoided.

Turns out there's already a NuGet that adds a .xcframework.zip file as a
NativeReference (Microsoft.ML.OnnxRuntime), so this makes that NuGet work.

Fixes https://github.com/xamarin/xamarin-macios/issues/21294.
Fixes https://github.com/xamarin/xamarin-macios/issues/21450.
2024-10-23 21:09:55 +02:00
Alex Soto 220d98c2a3
[xcode16.1] Update xcode version to Xcode 16.1 RC (#21502) 2024-10-23 13:18:34 -04:00
Manuel de la Pena d8a46a6abb
[Rgen] Set the projects to fail on warnings. Fix warnings. (#21500) 2024-10-22 17:37:44 -04:00
Rolf Bjarne Kvinge 57f68953b2
[xtro] Port the xtro-sharpie.csproj to a new style project and build with .NET. (#21468)
Note that it's still executed with Mono, because we load a native library that
needs Mono at runtime.
2024-10-22 16:36:09 +02:00
Rolf Bjarne Kvinge d30fd58018
[xibuild] Remove. (#21482)
This is a tool used to build legacy projects, so it's no longer needed.

I haven't removed everything that depends on xibuild, in particular some of
the tests need to be ported to .NET instead of just removed.
2024-10-22 16:34:52 +02:00
Manuel de la Pena 5de6b1a8fe
[Rgen] Provide all the wiring to allow to emit code. (#21460)
Add the following:

1. Code needed to register the changes in the compiler pipeline.
2. Code that will add the using statements for the generated code that
match those in the binding file.
3. Code that allows to write tabbed code in a way we do not have to keep
track of indentation.

We have the first unit test that verifies code generation by checking
the using statements.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2024-10-22 07:19:35 -04:00
dotnet-maestro[bot] 99250b64a8
[main] Update dependencies from dotnet/sdk (#21373)
This pull request updates the following dependencies

## Coherency Updates

The following updates ensure that dependencies with a *CoherentParentDependency*
attribute were produced in a build used as input to the parent dependency's build.
See [Dependency Description Format](https://github.com/dotnet/arcade/blob/master/Documentation/DependencyDescriptionFormat.md#dependency-description-overview)

- **Coherency Updates**:
  - **Microsoft.NET.ILLink.Tasks**: from 9.0.0-rtm.24515.9 to 9.0.0 (parent: Microsoft.NET.Sdk)
  - **Microsoft.AspNetCore.App.Ref**: from 9.0.0-rtm.24514.7 to 9.0.0 (parent: Microsoft.NET.Sdk)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-rtm.24515.9 to 9.0.0 (parent: Microsoft.NET.Sdk)
  - **Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport**: from 9.0.0-rtm.24513.1 to 9.0.0-rtm.24515.1 (parent: Microsoft.NETCore.App.Ref)
  - **Microsoft.NETCore.App.Ref**: from 9.0.0-rtm.24515.9 to 9.0.0 (parent: Microsoft.NET.Sdk)

## From https://github.com/dotnet/sdk

- **Subscription**: afa459aa-bd64-46cb-8138-9f6f795963d4
- **Build**: 20241020.4
- **Date Produced**: October 21, 2024 5:47:08 AM UTC
- **Commit**: 95bea787c14e3402b47311007dba6b3f503b34e7
- **Branch**: refs/heads/release/9.0.1xx

- **Updates**:
  - **Microsoft.NET.Sdk**: [from 9.0.100-rtm.24518.42 to 9.0.100-rtm.24520.4][28]

[28]: f5127b18a8...95bea787c1
2024-10-22 09:25:15 +02:00
Rolf Bjarne Kvinge a8a7ed0599
[msbuild] Make the Unzip task cancellable. (#21456) 2024-10-22 08:00:05 +02:00
Rolf Bjarne Kvinge a53cb25dcf
[tests] Don't build in parallel when packaging macOS tests, it pretty much fails all the time. (#21473) 2024-10-21 19:26:59 +02:00
Rolf Bjarne Kvinge c8300a1502
[tests] Simplify/unify code to build test NuGets. (#21472)
Also avoid the 'nuget' binary, which requires Mono.
2024-10-21 10:36:51 +02:00
Rolf Bjarne Kvinge e2cd13bc35 [xcode16.1] Merge main into xcode16.1. 2024-10-21 10:33:20 +02:00
Rolf Bjarne Kvinge d1845ee8fe
[dotnet] Use the default .NET scheme for the default TargetPlatformVersion for library projects. (#21343)
We must define the default platform version if it's not specified in the TFM, and according to the spec the default should not change for a given .NET version:

* We release support for iOS 18.0 with .NET 9
* Apple releases iOS 18.1, we're still using .NET 9. This default continues to be iOS 18.0
* .NET 10 is shipped, and at this point we bump the default to iOS 19.0

Basically: this should be the last OS version of the platform in question when the current major .NET version is first released to stable.

Ref: 8e6394406d/accepted/2020/net5/net5.md (os-versions)

However, this doesn't work well for Apple platforms: Whenever Apple releases new Xcode versions, our existing workloads might not be compatible with the new Xcode. We'll of course ship updateds workload with support for the new Xcode, but defaulting to an older target platform version would mean that developers wouldn't get the new workload, they'd get the old one. This is exacerbated by the fact that Apple aggressively auto-updates Xcode on developers' machines: they might wake up one day to a broken build - the obvious fix ("dotnet workload update") doesn't fix anything - even if we've shipped updated workloads - because the default is to use the old one. They'd have to manually specify the target platform version in the target platform to get the updated workload ("net8.0-ios17.2" to use the iOS 17.2 workload instead of "net8.0-ios", which would use the default (old/initial/17.0) .NET 8 workload) - and then update _again_ when the next Xcode comes around. At this point the point of having a sane default value is totally out the window, because everybody would have to specify (and continuously update) a platform version in their project files to keep their projects building.

So we've made the decision that the default target platform version is always the latest supported target platform version.

Given the previous example: once we've implemented and released support for iOS 18.1, the updated iOS workload will use 18.1 as the default TPV for iOS.

On the other hand, this turns out to be somewhat of a complication for library developers, because they typically don't need Xcode to build their projects, and if we auto-update their TargetPlatformVersion to the latest, then all their customers have to also update their workloads, which for some people end up being a rather nasty surprise (because with the above algorithm it happens without developer action). Thus we follow .NET's default platform version scheme for library projects: it won't change in minor .NET releases.

Related design/docs PRs:

* https://github.com/dotnet/docs/pull/43089
* https://github.com/dotnet/designs/pull/324
2024-10-21 10:30:50 +02:00
Rolf Bjarne Kvinge 907c0af6f4 [xcode16.1] Merge main into xcode16.1. 2024-10-17 09:29:47 +02:00