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

15793 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 0dfadd0c01
[tests] Try to make CoreServices.FSEventStreamTest behave better. (#18844)
Try to make CoreServices.FSEventStreamTest better by using shorter duration locks,
and re-checking success condition after timing out in case there’s a race condition.

Also improve exception reporting/logging a bit.

Ref: https://github.com/xamarin/maccore/issues/2630
2023-08-29 07:29:12 +02:00
Rolf Bjarne Kvinge ed4d4ff028
[dotnet] Always pass -lobjc to the native linker. (#18845)
In some cases ld will crash otherwise:

    0  0x102a1871c  __assert_rtn + 140
    1  0x102a21688  ld::tool::SymbolTableAtom<arm64>::classicOrdinalForProxy(ld::Atom const*) (.cold.3) + 0
    2  0x10291daf8  ld::tool::SymbolTableAtom<arm64>::classicOrdinalForProxy(ld::Atom const*) + 248
    3  0x10291d15c  ld::tool::SymbolTableAtom<arm64>::addImport(ld::Atom const*, ld::tool::StringPoolAtom*) + 204
    4  0x10291c824  ld::tool::SymbolTableAtom<arm64>::encode() + 416
    5  0x102907b6c  ___ZN2ld4tool10OutputFile20buildLINKEDITContentERNS_8InternalE_block_invoke.387 + 36
    6  0x185df2874  _dispatch_call_block_and_release + 32
    7  0x185df4400  _dispatch_client_callout + 20
    8  0x185e060c8  _dispatch_root_queue_drain + 956
    9  0x185e066c0  _dispatch_worker_thread2 + 164
    10  0x185fa0038  _pthread_wqthread + 228
    A linker snapshot was created at:
    	/tmp/tesrt-2023-08-28-143541.ld-snapshot
    ld: Assertion failed: (it != _dylibToOrdinal.end()), function dylibToOrdinal, file OutputFile.cpp, line 5133.
2023-08-29 07:28:47 +02:00
dotnet-maestro[bot] 67d92d46e9
[main] Update dependencies from dotnet/xharness (#18847)
This pull request updates the following dependencies

[marker]: <> (Begin:601bc5e1-1cae-44b5-cf5f-08db9342aa2f)
## From https://github.com/dotnet/xharness
- **Subscription**: 601bc5e1-1cae-44b5-cf5f-08db9342aa2f
- **Build**: 20230821.1
- **Date Produced**: August 21, 2023 12:57:41 PM UTC
- **Commit**: 1c09ef5b669c11e1aeca92089d0c1e4408169582
- **Branch**: refs/heads/main

[DependencyUpdate]: <> (Begin)

- **Updates**:
- **Microsoft.DotNet.XHarness.iOS.Shared**: [from
8.0.0-prerelease.23416.1 to 8.0.0-prerelease.23421.1][1]

[1]: 5a4c0c4662...1c09ef5b66

[DependencyUpdate]: <> (End)


[marker]: <> (End:601bc5e1-1cae-44b5-cf5f-08db9342aa2f)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2023-08-28 17:06:16 -04:00
dustin-wojciechowski 1b016fa072
[MacCatalyst] Added Default Entitlements for MacCatalyst projects (#18669)
Added default entitlements for MacCatalyst templates.
For Debug, the com.apple.security.get-task-allow entitlement that allows for using developer tools when developing MAUI Blazor apps.
For release, com.apple.security.app-sandbox is required to publish MacCatalyst apps to the Mac App Store.

Also added unit test to check for entitlements when project is created.

Fixes #18344

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2023-08-28 09:14:25 -07:00
Rolf Bjarne Kvinge 19b4beb9c3
[devops] Don't try to install workloads if .NET isn't enabled. (#18824) 2023-08-28 17:40:34 +02:00
Rolf Bjarne Kvinge d9405ff27c
[tests] Misc changes to make tests work/pass when .NET isn't enabled. (#18828) 2023-08-28 16:15:28 +02:00
Rolf Bjarne Kvinge e111b8701b
[tests] Add support for specifying whether build properties should be specified on the command line or in a file. (#18814)
Some time ago we added a workaround for an msbuild bug that has since
been fixed (since the initial .NET 7 release). This workaround involved
writing build properties to a file instead of passing them on the
command line.

We no longer need the workaround, but it turnes out we still need to be
able to pass build properties in a file (because we have a test that
needs this behavior). We'll also soon run into a scenario where we need
to be able to specify a build property on the command line
(`TargetFrameworks`) - the build won't work if specified in a file.

So add support for both, and make the test that needs to specify the
build property on the command line say so explicitly.
2023-08-28 14:43:35 +02:00
Rolf Bjarne Kvinge fd896d484d
[build] Don't add to DOTNET_PLATFORMS if .NET isn't enabled (#18827)
This makes it easier to skip .NET stuff if .NET isn’t enabled.
2023-08-28 12:11:15 +02:00
Rolf Bjarne Kvinge 6603e027ac
[devops] Don’t build any NuGets if .NET isn’t enabled. (#18823) 2023-08-28 12:09:13 +02:00
Rolf Bjarne Kvinge 65b6cca020
[devops] Only run the .NET tests on Windows if .NET is actually enabled. (#18825) 2023-08-28 12:07:19 +02:00
dotnet-maestro[bot] ffdbbbb698
[main] Update dependencies from dotnet/xharness (#18776)
This pull request updates the following dependencies

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

- **Subscription**: 601bc5e1-1cae-44b5-cf5f-08db9342aa2f
- **Build**: 20230816.1
- **Date Produced**: August 16, 2023 1:09:42 PM UTC
- **Commit**: 5a4c0c4662e26da63aa22d0bd239ea8576c1cda7
- **Branch**: refs/heads/main

- **Updates**:
  - **Microsoft.DotNet.XHarness.iOS.Shared**: [from 8.0.0-prerelease.23407.2 to 8.0.0-prerelease.23416.1][1]

[1]: 480b9159eb...5a4c0c4662
2023-08-25 08:08:48 +02:00
Rolf Bjarne Kvinge 2e7846d190
[registrar] Skip registering types removed in Xcode 15. (#18812)
Apple completely removed the NewsstandKit framework and the
PKDisbursementAuthorizationController[Delegate] types in Xode 15, so
let's not generate any corresponding code in the static registrar.

This effectively adds basic support for using Xcode 15 with .NET 7 (take
2).
2023-08-25 07:42:34 +02:00
Rolf Bjarne Kvinge f678a5feab
[tools] Use current .NET to build nnyeah (+ tests). (#18806) 2023-08-25 07:40:24 +02:00
Rolf Bjarne Kvinge 21b220680f
[msbuild] Limit the number of concurrent AOT compilers to the number of processors. (#18793)
This might fix #17825, but even if it doesn't, it's a good thing to do
to not overload machines.

Ref: https://github.com/xamarin/xamarin-macios/issues/17825
2023-08-25 07:33:32 +02:00
Manuel de la Pena 564acb83f9
[Maccore] Bump to the latest main. (#18799)
Bump maccore to bring the changes for governance and some others.

New commits in xamarin/maccore:

* xamarin/maccore@63fd14954c [Governance] Update the false positives
files based on the last runs.
* xamarin/maccore@b1c091dbb3 [certificates] Update la_dev_apple.p12,
la_distr_apple.p12 and la_mac_installer_distr.p12
* xamarin/maccore@cf71695c0b [mlaunch] Refactor project structure
* xamarin/maccore@3a0953b2a9 [XmlDocSync] Remove the XmlDocSync
reference from the project.
* xamarin/maccore@f243acfe79 [Submission] Add NotaryTool Task
* xamarin/maccore@ec9db0a40e Merge 'xcode15' into 'main'.
* xamarin/maccore@dc38700a6d [Governance] Update false positives take 2.

Diff:
fd15821e67...dc38700a6d

---------

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2023-08-24 11:41:19 -04:00
Rolf Bjarne Kvinge 9aecc28803
Bump api-tools. (#18794)
New commits in rolfbjarne/api-tools:

* rolfbjarne/api-tools@c7d5208 Use the current .NET version to build.
* rolfbjarne/api-tools@254f0e0 [mono-api-info] Add support for comparing
function pointers.
* rolfbjarne/api-tools@ebc175f Update the .editorconfig file

Diff:
373fc1b50a..c7d5208967
2023-08-24 15:31:59 +02:00
Šimon Rozsíval 2aff4b5f24
Avoid using Activator.CreateInstance (#18795)
Ref #18779

- We can get rid of Activator.CreateInstance in
`DictionaryContainer.GetStrongDictionary<T>` by passing a factory method
- For the cases where we need to use Activator.CreateInstance we need to
add `[DynamicallyAccessedMembers(...)]` to the type parameter
2023-08-23 18:19:46 +02:00
Rolf Bjarne Kvinge 5051c3e38f
Fix bash syntax. (#18764) 2023-08-23 17:36:02 +02:00
Filip Navara f410dd4d8a
Prefer generic overload of Marshal methods (#18775)
Non-generic overloads produce NativeAOT warnings.
2023-08-22 15:47:37 +02:00
Rolf Bjarne Kvinge 61493dd438
[msbuild] Store the command line to sign in the stamp file. Fixes #16124. (#18750)
When figuring out whether something needs to be (re)signed or not, we must
also take into account that the signing identity may have changed (for
instance a release build will often have a different signing identity than a
debug build).

Do this by storing the command line to sign for each item we need to sign in
the stamp file, and if the stored contents don't match the new command line
to sign, then we must resign the item.

This is rather obnoxious to write unit tests for (since we'd need to have two
different signing identities available on the bots), so I've only done local
testing.

Fixes https://github.com/xamarin/xamarin-macios/issues/16124.
2023-08-22 12:34:16 +02:00
Rolf Bjarne Kvinge 9937f17f99
[tests] Disable build parallelism when setting IntermediateOutputPath as a property for the build. (#18731)
* A property set on the command line is set for all projects that are built,
  including projects referenced by the main project.
* If the main project references more than one project, those referenced
  projects may be built in parallel.
* This means multiple projects might have the same IntermediateOutputPath if
  set on the command line, and thus accessing files in the directory
  simultaneously, which is a bad idea.

Fix this by manually disabling build parallelism in tests that set
IntermediateOutputPath.

Fixes https://github.com/xamarin/maccore/issues/2567.
2023-08-18 16:50:20 +02:00
Rolf Bjarne Kvinge 067e32a289
[dotnet] Update the Mac Catalyst VB template to match the C# template. (#18754) 2023-08-18 16:49:18 +02:00
Rolf Bjarne Kvinge d64f3d5e30
[dotnet] Fix typo when loading support for App Extensions on Mac Catalyst. (#18755)
Ref: https://github.com/xamarin/xamarin-macios/issues/17408
2023-08-18 16:48:51 +02:00
Rolf Bjarne Kvinge a03fbb70f9
Run the generator tests on Windows. (#18513)
We'll soon change the generator to execute locally on Windows, even for
remote builds. As a stepping stone towards that goal, this PR adds the
generator tests to the list of tests we run on Windows.
2023-08-18 16:04:59 +02:00
Rolf Bjarne Kvinge aa8d2a962e
[dotnet] Fix assembly stripping of resource assemblies. Fixes #17262. (#18749)
* Don't strip resource assemblies, there's no code in them to strip anyways.
* Use the relative path inside the app bundle when computing the intermediate
  location for stripped assemblies, so that if we were to find two identically
  named assemblies in different directories, they're handled correctly (by
  putting them in different intermediate locations, instead of overwriting
  eachother).

Fixes https://github.com/xamarin/xamarin-macios/issues/17262.
2023-08-17 07:34:14 +02:00
Rolf Bjarne Kvinge 5bf5bf6042
[src] Add generated file listing frameworks to git to simplify build on Windows. (#18737)
This makes it easier to run some tests on Windows, because the tests
reference this file and by having it checked in it doesn't need to be generated
(which we currently do using make, which isn't trivial on Windows).

Also adjust the generated output slightly to make it easier on the eyes.
2023-08-16 10:34:25 +02:00
Rolf Bjarne Kvinge 47b5601ffc
[tests/xharness] Add support for setting test configuration using environment variables. (#18738)
Setting test configuration variables using the environment is useful
when running tests on a Windows machine (easier than having to deal with
make).

Also refactor the code a bit to not use constants, and more consistent
naming.
2023-08-16 10:34:02 +02:00
Rolf Bjarne Kvinge 4d1156bbf9
[devops] 'simctl diagnose' tend to return an error code, so make sure it doesn't bubble up to the CI. (#18723)
This seems to happen fairly often:

    + xcrun simctl diagnose -b -X --output=/Users/builder/azdo/_work/1/s/diagnostic-sim-output/output
    Error creating archive at '/Users/builder/azdo/_work/1/s/diagnostic-sim-output/output.tar.gz'.
    Files are still in /Users/builder/azdo/_work/1/s/diagnostic-sim-output/output
    An error was encountered processing the command
    (domain=NSPOSIXErrorDomain, code=17):
       Unable to write or file already exists
       File exists

The output directory is empty (created in the line before), so I have no
idea what's going on.

An archive with the diagnostic info still seems to be created though, so
just ignore any failures from 'simctl diagnose' instead of bubbling them up
to Azure DevOps. This makes our test runs not show up with warnings.
2023-08-16 10:33:34 +02:00
Rolf Bjarne Kvinge 38e4e08d35
[tools] Improve logging/reporting when running into problems with binding projects / assemblies. (#18683) 2023-08-16 10:31:38 +02:00
Rolf Bjarne Kvinge d6c79bffb3
[tests] Add missing check for available runtime identifiers in a few tests. (#18739) 2023-08-16 10:29:42 +02:00
Rolf Bjarne Kvinge 587f722283
[msbuild] Pass a stream to XDocument.Load instead of a path. (#18722)
XDocument.Load(string) takes a URI, not a file path. This usually works if
there are no special characters in the file path, but for instance with a path
with a colon (say 'a:b/some/file'), we'll get an exception about invalid uri
scheme.

So instead use the XDocument.Load(Stream) overload, and create the stream
using the file path instead, in which case there's no problem with special
characters.
2023-08-15 18:22:34 +02:00
Rolf Bjarne Kvinge 9a4b5db22e
[tools] Minor code clean up in dotnet-linker. (#18730)
* Remove unusued code.
* Rename method to make it follow the common TryGet... pattern.
2023-08-15 18:03:26 +02:00
Rolf Bjarne Kvinge 637c6b6bcb
[tools] Store list of trampolines even if it's empty. Fixes #18570. (#18724)
This is a bit non-obvious, but we later use the presence of such a
stored list to determine if we need to generate the __Registrar__ type in the
assembly.

The problem is that we need to generate the __Registrar__ type even if
no trampolines were created, because we use it for numerous other purposes
as well (type lookup for instance).

Fixes https://github.com/xamarin/xamarin-macios/issues/18570.
2023-08-15 08:53:10 +02:00
Mauro Agnoletti b313a59fbe
[remote] Explicitly import .mobile.props file (#18718)
The .mobile.props file is a file created and written by the mobile VS
extension to store property values that needs to be read early enough in
the build chain, as in design time builds, and that can't be set by CPS
because of a limitation in the project system. See more information
here: https://github.com/xamarin/XamarinVS/pull/13606

Initially it was named .user.env file and then was renamed in another PR
as part of a feedback from the project system team. See more information
here: https://github.com/xamarin/XamarinVS/pull/13628

Because this file was saved in the intermediate output path, it was
meant to be imported automatically by MSBuild, however we recently
detected that this was not happening reliably. Because of this, some
things like C# Hot Reload for iOS stopped working because Roslyn was
reading incorrect values from the Design Time Builds.

For that reason and to avoid relying on the project system, I'm
importing this file explicitly (and removing old .user.env import), so
the values in the file are always available and the dependent properties
are calculated correctly and available for all the consumers (including
Roslyn).

This should fix the following bugs:

https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1822041
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1851677
2023-08-15 08:33:53 +02:00
Šimon Rozsíval 7f67aa0bae
[registrar] Create instances of NSObjects and INativeObjects without using reflection in the managed static registrar (#18519)
This PR adds lookup tables and factory methods for INativeObjects and
NSObjects. These generated methods allow us to create instances of these
objects without needing reflection.

Closes #18358.
2023-08-15 08:30:46 +02:00
dotnet-maestro[bot] 8afd2411b3
[main] Update dependencies from dotnet/xharness (#18720)
This pull request updates the following dependencies

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

- **Subscription**: 601bc5e1-1cae-44b5-cf5f-08db9342aa2f
- **Build**: 20230807.2
- **Date Produced**: August 7, 2023 7:46:54 PM UTC
- **Commit**: 480b9159eb7e69b182a87581d5a336e97e0b6dae
- **Branch**: refs/heads/main

- **Updates**:
  - **Microsoft.DotNet.XHarness.iOS.Shared**: [from 8.0.0-prerelease.23403.1 to 8.0.0-prerelease.23407.2][1]

[1]: 7e3f2975a8...480b9159eb
2023-08-15 08:21:52 +02:00
Rolf Bjarne Kvinge f24a016302
[registrar] Call INativeObject ctors directly in the managed static registrar. (#18706)
We can determine the exact constructor to call when creating
INativeObject instances in the generated code, so do exactly that.
This avoids a lot of slow reflection, and also makes the constructor
call visible for any linkers.
2023-08-14 12:07:16 +02:00
Rolf Bjarne Kvinge cb1ffa0da7
[monotouch-test] Fix BlocksTest to work on maccatalyst-arm64. (#18708)
We use the AOT compiler on ARM64 on Mac Catalyst, so these tests have to
be excluded on Mac Catalyst.
2023-08-14 12:05:03 +02:00
Rolf Bjarne Kvinge 72a7f88b94
[tests] Improve assertion when a .NET test fails executing 'dotnet'. (#18700)
Improve assertion when a .NET test fails executing 'dotnet' by including
more information (any errors in particular) in the assert message.
2023-08-14 11:57:21 +02:00
Rolf Bjarne Kvinge be08931941
[dotnet] Stop hardcoding the .NET version in a few more projects. (#18702)
Just use whatever .NET version we're using to build with.
2023-08-14 11:56:32 +02:00
Rolf Bjarne Kvinge b1e2d56d54
[SpriteKit] Fix breaking change in SKAction.FollowPath. (#18696)
Breaking change

	Modified methods:

		public SKAction FollowPath (CoreGraphics.CGPath path, bool offset, bool ~orient~ orientToPath, double sec)
		public SKAction FollowPath (CoreGraphics.CGPath path, bool offset, bool ~orient~ orientToPath, System.Runtime.InteropServices.NFloat speed)
2023-08-14 11:55:32 +02:00
Rolf Bjarne Kvinge 4c115b037b
[tools] Remove some dead code in the class redirector rewriter. (#18695)
This also fixes a compiler warnings:

> tools/common/Rewriter.cs(333,25): warning CS8604: Possible null
reference argument for parameter 'path1' in 'string Path.Combine(string
path1, string path2)'.

And make nullability warnings in dotnet-linker show up as errors to
prevent future introduction of nullability warnings.
2023-08-14 11:49:06 +02:00
Rolf Bjarne Kvinge 24895406b2
[dotnet] Link Mono and Xamarin statically in Mac Catalyst by default. Fixes #14686. (#18619)
It's possible to create a provisioning profile for Mac Catalyst that
doesn't allow dylibs in the app. It seems a significant number of people run
into this problem when publishing their apps, so avoid it by linking Mono and
Xamarin statically by default instead.

The downside is that build time might increase a little bit.

An upside however is that the app size might decrease somewhat.

Fixes https://github.com/xamarin/xamarin-macios/issues/14686.
2023-08-11 15:08:27 +02:00
Rolf Bjarne Kvinge 18a8b25a0f
[devops] Fix setting the INCLUDE_LEGACY* variables when legacy isn't enabled. (#18689)
This fixes an issue where we'd try to sign the legacy Xamarin packages
even if the legacy build was disabled.
2023-08-11 11:19:36 +02:00
Rolf Bjarne Kvinge ce402bac61
[ObjCRuntime] NativeHandle.Zero shouldn't be writeable, so disallow that in the future. (#18694) 2023-08-11 11:11:39 +02:00
Rolf Bjarne Kvinge 7b1e40432d
Bump API references to latest stable. (#18678) 2023-08-10 19:02:07 +02:00
Rolf Bjarne Kvinge cff87d1496
[actions] Add more variations to the single-platform variation testing. (#18680)
Add:

* Only .NET (no legacy) - but all platforms.
* Only legacy (no .NET) - both platforms.
* Xamarin.iOS only.
* Xamarin.Mac only.
2023-08-10 14:37:29 +02:00
Rolf Bjarne Kvinge 8732e1cedd
[xharness] Stop hardcoding the target framework in xharness. (#18682) 2023-08-10 13:14:34 +02:00
Rolf Bjarne Kvinge a64104cf76
[tests] Filter out any warnings about out-of-support workloads. (#18679)
Our test projects may be using an earlier version of .NET (in particular
Touch.Unit and MonoTouch.Dialog often are), so ignore any warnings about
out-of-support workloads.

Fixes test failures like:

    Xamarin.Tests.BundleStructureTest.Build(MacCatalyst,"maccatalyst-x64;maccatalyst-arm64",All,"Debug"): Warnings

        Expected is <System.Collections.Generic.List`1[System.String]> with 22 elements, actual is <System.String[28]>
        Values differ at index [22]
        Extra: < "The workload 'maccatalyst' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy.", "The workload 'maccatalyst' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy.", "The workload 'maccatalyst' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/maui-support-policy for more information about the support policy."... >
2023-08-10 10:28:34 +02:00
Rolf Bjarne Kvinge 2eddcf8eea
[tests] Parse configure.inc for build settings as well. (#18674)
Additionally parse files in reverse order, because any variables at the
end should take precedence (when parsing config files the first time
variable is found is the one we use).
2023-08-10 07:55:50 +02:00