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

2366 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge c17f905540
[Foundation] Improve error reporting when we fail to instantiate a type. Fixes #12112. (#12126)
Fixes https://github.com/xamarin/xamarin-macios/issues/12112.
2021-07-16 09:31:08 +02:00
TJ Lambert 3b6f059863
[CI] Reverting the Cron job (#12071)
* Changing Cron Job

* reverting the cron job

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-07-02 21:59:32 -04:00
Manuel de la Pena d99235db4e
[CHIP] Add support for Xcode13 beta2. (#12025)
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
Co-authored-by: Alex Soto <alex@alexsoto.me>
2021-06-30 20:18:41 -04:00
Rolf Bjarne Kvinge ebf6c13bd1
[dotnet] Add support for universal apps. (#11983)
Add support for universal / fat apps for iOS, macOS and Mac Catalyst.

We detect if we need to build a universal app by checking if `RuntimeIdentifiers` (plural) is set, and in that case we do a complete inner build for every `RuntimeIdentifier`, and then once those inner builds are done, we merge the resulting .app bundles together (using a new MSBuild task called `MergeAppBundles`).

When merging app bundles together, we'll run into files that exist in both apps. Depending on the file type, we do different things:

* MachO flies: lipo'ed together.
* Managed assemblies: we do a binary comparison, if the assemblies are different, we put them in a RID-specific subdirectory. At runtime we know to look for assemblies in this directory.
* runtimeconfig.bin, icudt.dat: put in a RID-specific subdirectory.
* Info.plist: computed in the outer (fat) build, the one from the inner build is ignored.
* Other files: for identical files we just copy one, otherwise we show an error.

If we run into files that are different between apps, but we should handle somehow, then we'll have to decide on a case-to-case basis what to do.

Some code shuffling was required to increase code sharing between the tools/ code, the msbuild/ code, and tests.

I've also added support for a default `RuntimeIdentifier`.

Fixes https://github.com/xamarin/xamarin-macios/issues/10294.
Fixes https://github.com/xamarin/xamarin-macios/issues/10861.
2021-06-29 11:38:04 +02:00
TJ Lambert 4fd6faf780
Changing Cron Job (#12032)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-06-28 17:51:42 -04:00
TJ Lambert a134a75f9e
[Localization] Change the Input value (#12029)
* changing the isCreatePrSelected input

* remove the variable representation

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-06-28 10:36:36 -05:00
Rolf Bjarne Kvinge df369da15f [MachO] Simplify code a bit according to review. 2021-06-24 11:40:26 +02:00
Rolf Bjarne Kvinge 4914136930
[tools/tests] Fix units in logging message. (#12005) 2021-06-24 08:39:22 +02:00
Rolf Bjarne Kvinge 608dfb37bc [dotnet] Make the globalization data file an architecture-specific file.
This was adapted from https://github.com/xamarin/xamarin-macios/pull/11320.
2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge 70d0f86099 Merge remote-tracking branch 'origin/main' into HEAD 2021-06-23 18:38:43 +02:00
Manuel de la Pena 6ce5f80cb7
[CI] Fix typo (#11995)
Lets make my 1000 commit a typos fix!
2021-06-21 17:24:43 -04:00
Manuel de la Pena c778e6be3b
[CoreLocationUI] Add new framework for Xcode13 beta1. (#11979) 2021-06-21 12:10:13 -04:00
Rolf Bjarne Kvinge 5c50a2faa3 [msbuild] Implement a MergeAppBundles task to merge two (or more) apps into a single universal/fat app. 2021-06-18 10:34:35 +02:00
Rolf Bjarne Kvinge f864ff3de7 [tools] Move another IsUptodate overload to the FileCopier file to increase code sharing 2021-06-18 10:24:29 +02:00
Rolf Bjarne Kvinge ba83560abb [tools] Move parts of the binary file comparison to a helper file to make it usable in more places 2021-06-18 10:24:28 +02:00
Rolf Bjarne Kvinge 0af6ec5d2b [MachO] Add a MachO.IsMachOFile method 2021-06-18 10:24:28 +02:00
Rolf Bjarne Kvinge 7aec86fa04 ools] Create a PathUtils class and move some shareable code there. 2021-06-18 10:24:28 +02:00
Rolf Bjarne Kvinge 0021c2b4d8 [MachO] Make StaticLibrary.IsStaticLibrary work with files shorter than 8 bytes 2021-06-18 10:24:28 +02:00
Rolf Bjarne Kvinge 5275220e71
[CI] Sign *.nupkg too. Fixes #11952. (#11976)
This required reordering operations a bit, so that we can sign before publishing.

Fixes https://github.com/xamarin/xamarin-macios/issues/11952.
2021-06-18 09:08:34 +02:00
Rolf Bjarne Kvinge 8766976b49
Remove the option of disabling the windows-specific part of the .NET build. (#11971)
* Having .NET enabled with the windows-specific parts disabled is not a
  scenario tested on CI (where we've always enabled both). This means it's
  prone to bitrotting.
* It's another configuration to keep track of and make work locally.
* It doesn't work right now anyway.

So just always enable the windows-specific parts of the .NET build, if the
.NET build is enabled.
2021-06-17 19:55:55 +02:00
Rolf Bjarne Kvinge 0c1c1a7bff
[tools] Fix quoting quotes in StringUtils.QuoteForProcess. (#11949)
* [tools] Fix quoting quotes in StringUtils.QuoteForProcess.

Previously quoting a string with a quote:

    a"b

would result in:

    "a\"""b"

There are way too many quotes there.

We'll now get:

    "a\"b"

which is correct.

* Add unit test.
2021-06-17 18:23:59 +02:00
Manuel de la Pena fc46335c32
[CI] Use the same status as the tests so that we do not have pending stauses. (#11969) 2021-06-17 10:59:56 -04:00
Rolf Bjarne Kvinge c8e854c151
[dotnet] Add support for generating a binary version of runtimeconfig.json. Fixes #11745. (#11887)
Use Mono's RuntimeConfigParserTask to parse the *.runtimeconfig.json file and
produce a binary version of it.

This also means implementing support for finding the on-disk location of the
file at runtime, and passing it to mono.

Ref: 01b7e73cd3/docs/design/mono/mobile-runtimeconfig-json.md

Fixes https://github.com/xamarin/xamarin-macios/issues/11745.
2021-06-16 15:22:02 +02:00
Rolf Bjarne Kvinge 539547ce49
[mmp] Set minimum Xcode to Xcode 12 to get a better error message. Fixes #11937. (#11938)
Developers will now get the helpful:

> error MM0051: Xamarin.Mac 7.99.0 requires Xcode 12.0 or later. The current Xcode version (found in /Applications/Xcode_11.7.app/Contents/Developer) is 11.7.

instead of:

> error MM5309: Failed to execute the tool 'clang', it failed with an error code '1'. Please check the build log for details.

(and no clue from the build log that they need to upgrade their Xcode).

Xamarin.iOS projects still build fine with at least Xcode 11.3.1, so I've only
updated the minimum Xcode version for Xamarin.Mac.

Fixes https://github.com/xamarin/xamarin-macios/issues/11937.
2021-06-16 10:19:02 +02:00
Sebastien Pouliot 565e1d6b55
[linker] Ignore `[AssemblyMetadata]` before net6 (#11940)
This was allowed to ease existing (3rd party) code migration into net6.

However the reverse can also happen: trying to use net6 code with the
legacy SDK. In such case it's possible other (newer) attributes are being
used to preserve members.

ref: https://github.com/dotnet/aspnetcore/issues/33269
2021-06-15 15:33:44 -04:00
Sven Boemer 045ccaf3a6
Fixes for .NET 6 linker (#11739)
* Pass custom steps separately from msbuild

* Remove reflection over linker pipeline

* Fix ListExportedSymbols ctor

* Add CoreTypeMapStep

* PR feedback

- Avoid unnecessary tracking of loaded assemblies
   (Use GetLoadedAssembly instead)
- Create extension method on LinkContext
   to avoid conditional code
- Rename dispatchers to reflect when they run

* Fix PreMarkDispatcher

* Fix DoneStep ordering

* Fix other order-dependent steps, test asserts

* Handle cyclic assembly references

* Simplify reference search

By using the already-loaded Assembly closure

* Fix warning number

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* PR feedback

- Undo whitespace changes
- Move comment to a more appropriate place

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-06-14 20:10:29 -04:00
Rolf Bjarne Kvinge b39ad16703
[CI] Fix BRANCH_NAME to be the entire branch name. (#11929)
The Build.SourceBranchName variable is documented to be the last segment of
the git ref. If the git ref is 'refs/heads/main', then Build.SourceBranchName
is 'main' (as expected). However, if the git ref is
'refs/heads/release/6.0.1xx-preview5', then Build.SourceName is
'6.0.1xx-preview5', and that's not what we want.

Instead use the Build.SourceBranch variable, which is the entire git ref, and
then we strip out the 'refs/heads/' part from the beginning. This way we get
the correct branch name.
2021-06-14 20:42:02 +02:00
Manuel de la Pena 552d15d5fe
[CI] - is not a valid car in a name... (#11902) 2021-06-11 12:21:51 -04:00
Manuel de la Pena 8ce9bada8b
[CI] Add a new stage that will run windows integration tests. (#11896) 2021-06-11 12:10:08 -04:00
Rolf Bjarne Kvinge 0921ae4e26
Bump to Xcode 13 beta 1. (#11861)
* Bump maccore.

New commits in xamarin/maccore:

* xamarin/maccore@9acbbed1f6 [mlaunch] Add support for Xcode 13 beta 1. (#2452)
* xamarin/maccore@e48f75c0b6 [Xamarin.Hosting] Fix the --stdout arg not being forwarded to DeviceLaunchConfig (#2435)
* xamarin/maccore@109c695b1b [Xamarin.Hosting] Fix help string for launchdev argument (#2429)

Diff: cddbd1915d..9acbbed1f6

* [xtro] Fix generation of .pch files
* [xtro] Fix deprecated check to handle (anonymous) declarations and enable latest C# syntax in project
* [xtro] Fix _sanity_ checks
* [xtro] Update todo for beta 1

* [Siminstaller] Force siminstaller to use the xcode 12.5 url

Related issue: https://github.com/xamarin/xamarin-macios/issues/11881

* Fix introspection failures (due to [breaking] changes)
* [tests][intro] Fix hang for tvOS

Creating an instance of `NSMetadataQuery` hangs the simulator.

Even after (xharness) timeout the simulator is not in a good state
to run further tests and every new (tvOS) test will also hang...

* [tests][intro] Same hang for watchOS

except that further test execution does not seem affected (like tvOS)

```
CoreSimulator 772.1 - Device: Apple Watch Series 3 - 38mm (watchOS 8.0) - created by XHarness (42262867-E060-40C0-803E-6DA676AF50CC) - Runtime: watchOS 8.0 (19R5266p) - DeviceType: Apple Watch Series 3 - 38mm

Thread 0 Crashed:: tid_103  Dispatch queue: com.apple.main-thread
0   com.apple.Foundation          	0x00007fff21470bd0 -[NSMetadataQuery dealloc] + 432
1   libobjc.A.dylib               	0x00007fff200d11f7 objc_object::sidetable_release(bool, bool) + 177
2   com.apple.Foundation          	0x00007fff21470a03 -[NSMetadataQuery init] + 64
3   com.xamarin.introspection_watch.watchkitapp.watchkitextension	0x0000000107efc139 xamarin_dyn_objc_msgSend + 217 (trampolines-x86_64-objc_msgSend.s:15)
4   ???                           	0x000000010c76d4f6 0 + 4504081654
5   com.xamarin.introspection_watch.watchkitapp.watchkitextension	0x0000000107cffc85 mono_jit_runtime_invoke + 1621 (mini-runtime.c:3197)
6   com.xamarin.introspection_watch.watchkitapp.watchkitextension	0x0000000107e177d8 do_runtime_invoke + 54 (object.c:3052) [inlined]
7   com.xamarin.introspection_watch.watchkitapp.watchkitextension	0x0000000107e177d8 mono_runtime_invoke_checked + 136 (object.c:3220)
8   com.xamarin.introspection_watch.watchkitapp.watchkitextension	0x0000000107e1e3c5 mono_runtime_try_invoke_array + 2101 (object.c:5601)
9   com.xamarin.introspection_watch.watchkitapp.watchkitextension	0x0000000107daf977 ves_icall_InternalInvoke + 871 (icall.c:3927)
10  com.xamarin.introspection_watch.watchkitapp.watchkitextension	0x0000000107dc0167 ves_icall_InternalInvoke_raw + 103 (icall-def.h:667)
11  ???                           	0x000000010a232799 0 + 4465043353
12  ???                           	0x000000010c76e08b 0 + 4504084619
```

* [tests][monotouch-test] Fix failures with xcode 13 beta 1
* [tests][mmptest] Use a FAT framework that's build with x86_64 and arm64

Co-authored-by: Alex Soto <alex@alexsoto.me>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2021-06-10 20:07:20 -04:00
Manuel de la Pena 2f12850718
[CI] Fix condition to start executing the device tests. (#11855) 2021-06-10 17:36:56 -04:00
Manuel de la Pena 046260ee36
[CI] Ensure that we do not have data downloaded from other builds. (#11890) 2021-06-10 16:45:03 -04:00
Přemek Vysoký 0a65331ca7
[devops] Publish mlaunch as .nupkg during main build (#11851)
Packages the mlaunch that was built during the pipeline previously as a .nupkg and publishes it into the [dotnet-eng feed](https://dev.azure.com/dnceng/public/_packaging?_a=feed&feed=dotnet-eng):
- Version contains the maccore commit SHA
- If this SHA is already published in the feed, packaging and publishing is skipped

Target package: https://dev.azure.com/dnceng/public/_packaging?_a=package&feed=dotnet-eng&package=Microsoft.DotNet.Mlaunch&protocolType=NuGet (will show up after main build completes)

https://github.com/dotnet/core-eng/issues/13150
2021-06-10 18:29:59 +02:00
Rolf Bjarne Kvinge fa3f866a29
[devops] Upload all the binlogs in xamarin-macios as artifacts after the build. (#11884)
This makes diagnosing build failures much, much easier.
2021-06-10 18:20:09 +02:00
Alex Soto cdae3c79b8 Update build-samples.yml for Azure Pipelines 2021-06-09 12:40:54 -04:00
Manuel de la Pena 31f7c0dc5a
[CI] Do not add links to static page if we never got results. (#11865) 2021-06-09 12:19:28 -04:00
Manuel de la Pena 7a0ceabaed
[CI] Unify the password across templates. (#11854) 2021-06-07 18:37:44 -04:00
TJ Lambert f35f261264
Fixing typo (#11849)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-06-07 09:35:34 -05:00
TJ Lambert c527784095
changing the merge to a replace (#11790)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-06-04 10:14:46 -05:00
Sebastien Pouliot 0de6274cb7
Remove internal `Xamarin.Utils.*` types from platform assemblies (#11811)
Only the `SanitizeObjectiveCName` method _can_ be needed, by the
registrar. However if marked then the `StringUtils:.cctor` will also be
marked, including the data (`static char[]`) which is not needed for apps

Moving `SanitizeObjectiveCName` to the `Registrar` type is simpler and
solve (removes) the extra cost (baggage) from the app.
2021-06-04 09:12:59 -04:00
TJ Lambert e06ee8e653
[Localization] Test to make sure the new resx files are compiled to Resources (Edited) (#11737)
* making sure new strings get added to designer and resources plus the test

* Next wave of changes to csproj to incorporate Rolf's changes

* fixing path

* Update tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/LocalizationStringTest.cs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Update tests/mtouch/LocalizationTests.cs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* forgot the include

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-06-02 11:11:15 -05:00
Manuel de la Pena 7d4c204382
[CI] Do override statuses due to VS Windows using hardcoded strings. (#11762) 2021-06-02 11:36:45 -04:00
Manuel de la Pena 24e5b7724b
[CI] Ignore readme files and github actions. (#11769)
We have to list each readme as per vsts docs:

```
Tips:
* Wild cards are not supported with path filters.
* Paths are always specified relative to the root of the repository.
* If you don't set path filters, then the root folder of the repo is implicitly included by default.
* If you exclude a path, you cannot also include it unless you qualify it to a deeper folder. For example if you exclude /tools then you could include /tools/trigger-runs-on-these
* The order of path filters doesn't matter.
* Paths in Git are case-sensitive. Be sure to use the same case as the real folders.
* You cannot use variables in paths, as variables are evaluated at runtime (after the trigger has fired).
```

src:  https://docs.microsoft.com/en-us/azure/devops/pipelines/repos/github?view=azure-devops&tabs=yaml#ci-triggers
2021-06-01 17:37:37 -04:00
Manuel de la Pena 78b22880d5
[CI] Use LFS for the static page checkout. (#11760)
PR https://github.com/xamarin/xamarin-macios/pull/11754 created a 50+MB
for the generator diff that resulted in a 250 mb index file. This is too
large and github rejects the push. USing LFS fixes the issue.

fixes: https://github.com/xamarin/maccore/issues/2449
2021-06-01 15:54:33 -04:00
TJ Lambert 640467a03f
Updating Localization READMEs (#11738)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-06-01 09:51:38 -05:00
Manuel de la Pena a57e31873d
[CI] Do not generate github static pages on CI. (#11720)
We added the github pages to make the life of the reviews easier, the
issue we found is that we have a limited amount of space. Due to that we
are removing the generation from the ci.

Triggers in pipleines are disable by default, removing it will stop it
from being executed. The PR are triggered via a release pipeline we
called macios.glue
2021-06-01 09:53:02 -04:00
Rolf Bjarne Kvinge 03685e70b8
[static registrar] Release the return value from xamarin_get_reflection_method_method in generated code. (#11748)
* If the return value from xamarin_get_reflection_method_method is cached in a
  static variable, we can only release at process exist.
* Otherwise just release at the end of the current method.

Before:

    There were 258096 MonoObjects created, 246948 MonoObjects freed, so 11148 were not freed. (dynamic registrar)
    There were 205834 MonoObjects created, 205214 MonoObjects freed, so 620 were not freed. (static registrar)

After:

    There were 258092 MonoObjects created, 246945 MonoObjects freed, so 11147 were not freed. (dynamic registrar)
    There were 205834 MonoObjects created, 205600 MonoObjects freed, so 234 were not freed. (static registrar)
2021-06-01 07:36:01 +02:00
Rolf Bjarne Kvinge dc30bdf220
[registrar] Make sure to release the return value from xamarin_get_parameter_type. (#11725)
Before:

    There were 258046 MonoObjects created, 235142 MonoObjects freed, so 22904 were not freed. (dynamic registrar)
    There were 205804 MonoObjects created, 204193 MonoObjects freed, so 1611 were not freed. (static registrar)

After:

    There were 258054 MonoObjects created, 235172 MonoObjects freed, so 22882 were not freed. (dynamic registrar)
    There were 205804 MonoObjects created, 205190 MonoObjects freed, so 614 were not freed. (static registrar)
2021-05-28 16:19:47 +02:00
Rolf Bjarne Kvinge e11ad011d9
[static registrar] Go straight to exception handling after invoking the managed method if an exception occurred. (#11714)
This fixes a memory corruption where we'd try to process out parameters when
an exception had occurred, and those out parameters weren't expected to be
processed.
2021-05-28 07:44:18 +02:00
Manuel de la Pena 7bc5a4c67f
[CI] Provide links to the GitHub pages that are generated per build. (#11703) 2021-05-27 12:09:26 -04:00
Manuel de la Pena 4097270665
[CI]Renove other files, better code. (#11713) 2021-05-27 12:06:44 -04:00
Rolf Bjarne Kvinge fa5bb58e6d
[static registrar] Add a missing call to xamarin_mono_object_release for return values from mono_value_box. (#11707)
Before:

    There were 258046 MonoObjects created, 235142 MonoObjects freed, so 22904 were not freed. (dynamic registrar)
    There were 205804 MonoObjects created, 204193 MonoObjects freed, so 1611 were not freed. (static registrar)

After:

    There were 258018 MonoObjects created, 235128 MonoObjects freed, so 22890 were not freed. (dynamic registrar)
    There were 205809 MonoObjects created, 204221 MonoObjects freed, so 1588 were not freed. (static registrar)
2021-05-27 13:54:09 +02:00
Manuel de la Pena bc3fdacebe
[CI] Remove xml files since they are in vsdrops and empty dirs. (#11704) 2021-05-27 06:06:06 -04:00
Rolf Bjarne Kvinge 2fed900225
[static registrar] Add a missing call to xamarin_mono_object_release for out parameters. (#11696)
This involves storing the out parameter in an additional variable, so that we
can still access it after the method call.

Before:

    There were 257927 MonoObjects created, 235060 MonoObjects freed, so 22867 were not freed. (dynamic registrar)
    There were 205700 MonoObjects created, 203983 MonoObjects freed, so 1717 were not freed. (static registrar)

After:

    There were 257935 MonoObjects created, 235064 MonoObjects freed, so 22871 were not freed. (dynamic registrar)
    There were 205700 MonoObjects created, 204006 MonoObjects freed, so 1694 were not freed. (static registrar)
2021-05-27 07:31:02 +02:00
Manuel de la Pena 97e34bc451
[CI] Fix build reason if and uses a better branch name. (#11690) 2021-05-26 23:34:29 -04:00
Manuel de la Pena 19bafa46e9
[CI] Expressions should be between $() (#11701) 2021-05-26 23:31:38 -04:00
Manuel de la Pena 37bbb91851
[CI] Override if present. (#11698)
This should not happen since we should not be getting same url.
2021-05-26 20:46:19 -04:00
Manuel de la Pena ff138b724e
[CI] Path returns errors becuase of missing ' use method. (#11697) 2021-05-26 15:47:51 -04:00
Rolf Bjarne Kvinge e4ce1a389d
[static registrar] Add a few missing calls to xamarin_mono_object_release for arrays. (#11685)
Before:

> There were 205700 MonoObjects created, 113865 MonoObjects freed, so 91835 were not freed. (static registrar)

After:

> There were 205700 MonoObjects created, 113982 MonoObjects freed, so 91718 were not freed. (static registrar)
2021-05-26 20:39:16 +02:00
Manuel de la Pena 8a2ed36ee3
[CI] Add debugging and fix some issue when detecting if it is a VM (#11598)
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-05-26 13:36:27 -04:00
Manuel de la Pena 9d97d43f74
[CI] Verify the notarized pkgs. (#11677) 2021-05-26 10:38:09 -04:00
Manuel de la Pena 90c9593bf2
[CI] Remove txt files and use a better path for the static content. (#11676) 2021-05-26 10:26:48 -04:00
Manuel de la Pena 2a208f2f16
[CI] Add files to git and push them to the static web. (#11666) 2021-05-25 15:41:25 -04:00
Rolf Bjarne Kvinge 7705a87833
[mlaunch] Fix conditional makefile logic. (#11668)
This makes us ship mlaunch in .NET again.
2021-05-25 21:31:47 +02:00
Manuel de la Pena f0496e8f84
[CI] Unzip downloaded data and remove logs for the static github page. (#11653) 2021-05-24 22:20:45 -04:00
Manuel de la Pena ebe19d7865
[CI] Download all artifacts and show files to be removed. (#11639)
Step fwd to get the stativ page. We download all the artifacts from the
cascade pipeline. The artifacts are inherited thanks to the trigger.

Download, extract, print files to be removed.
2021-05-21 10:15:54 -04:00
Rolf Bjarne Kvinge 3acfa092dd
[registrar] Fix whitespace and remove unnecessary semicolon (#11644) 2021-05-21 07:54:00 +02:00
Rolf Bjarne Kvinge aad913db86
[msbuild/dotnet] Add support for NativeReference items. Fixes #11061. (#11593)
* Pass any native references to the LinkNativeCode task so that they're linked
  with the main executable.
* Copy frameworks and dynamic libraries to the app bundle (also add support
  for MSBuild metadata - the CopyToAppBundle property - to avoid copying a
  framework / dynamic library to the app bundle).
* Refactor MTouchTaskBase a bit to make parts of it reusable from the
  LinkNativeCode task.
* Add tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/11061.
2021-05-21 07:49:24 +02:00
Rolf Bjarne Kvinge 9f3c97560f
[registrar] Fix indentation for cleanup code (#11630) 2021-05-20 16:25:11 +02:00
Rolf Bjarne Kvinge b4952521d3 Merge remote-tracking branch 'origin/main' into issue-11061 2021-05-20 16:22:50 +02:00
Manuel de la Pena e30179c819
[CI] Create branch in cascade pipeline for the html of a given build. (#11621)
The branch name will be:

* pr/branchname/branch_commit/buildid - for builds triggered by a pr
* ci/branchname/branch_commit/buildid - for all others.

Commit and build id have been added to ensure we have no collisions.
2021-05-20 09:42:03 -04:00
Rolf Bjarne Kvinge 1b655344df
[mmp] Don't define CORECLR_RUNTIME when compiling the partial static registrar code (#11618)
We already define it in the generated code, so the native compiler shows a warning:

    Microsoft.macOS.registrar.coreclr.x86_64.m:1:9: warning: 'CORECLR_RUNTIME' macro redefined [-Wmacro-redefined]
    #define CORECLR_RUNTIME
            ^
    <command line>:2:9: note: previous definition is here
    #define CORECLR_RUNTIME 1
            ^
2021-05-20 07:35:52 +02:00
TJ Lambert 72496111df
[Localization] Sync Localization branch with Main (#11603)
Add changes to sync main into Localization branch

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
Co-authored-by: Connor Adsit <cadsit@microsoft.com>
2021-05-19 15:36:41 -05:00
Manuel de la Pena cecc343301
[CI] Fix API diff uploads since they broke when we wanted to continue on failure. (#11609) 2021-05-19 13:32:03 -04:00
Rolf Bjarne Kvinge 2d412041cb Merge remote-tracking branch 'origin/main' into issue-11061 2021-05-19 17:40:30 +02:00
Manuel de la Pena e246a83b82
[CI] Update the config and parse it in the cascade pipeline. (#11587) 2021-05-19 08:22:38 -04:00
Rolf Bjarne Kvinge 022fa9c697
[runtime] Throw a runtime exception instead of execution engine exception. (#11599)
* One less Mono Embedding method used: good for CoreCLR.
* More consistent with the rest of our code / behavior.
2021-05-19 07:34:13 +02:00
Manuel de la Pena eaa91190a6
[CI] If api & generator fail also ignore in publish html. (#11570) 2021-05-18 11:44:07 -04:00
Rolf Bjarne Kvinge e8678d5f1e [msbuild/dotnet] Add support for NativeReference items. Fixes #11061.
* Pass any native references to the LinkNativeCode task so that they're linked
  with the main executable.
* Copy frameworks and dynamic libraries to the app bundle (also add support for
  MSBuild metadata - the CopyToAppBundle property - to avoid copying a framework
  / dynamic library to the app bundle).
* Add tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/11061.
2021-05-18 09:11:31 +02:00
Rolf Bjarne Kvinge 0e957d347f
[registrar] Define CORECLR_RUNTIME when in the generated registrar code for CoreCLR (#11584)
This makes sure that we build the right thing, our shipped headers behave
differently whether CORECLR_RUNTIME is defined or not.
2021-05-18 07:36:29 +02:00
Rolf Bjarne Kvinge adb355b757
[runtime] Add support for creating managed exceptions from native code for CoreCLR. (#11538) 2021-05-14 07:27:42 +02:00
Manuel de la Pena bdfa8ca344
[CI] If the api & generator is not built do not fail the build. (#11525)
If can happen that when we bump xcode we do not get an api & generator
diff. This results in a set of cascading events that make the build
fail.

We know track when the result is not 0, store it in a var and pass that
variable to all the tempaltes that need it. The pwsh script already has
an if to check if the file if present and if not, it shows a warning.
2021-05-13 17:18:32 -04:00
Rolf Bjarne Kvinge 427c5447db
[tools] Make exception marshalling the default for CoreCLR (and make it an error to choose otherwise). (#11535)
* Make 'throw Objective-C exception' the default for managed exception marshalling.
* Make 'throw managed exception' the default for Objective-C exception marshalling.
* Disallow the 'unwind through native frames' option: CoreCLR won't do it.
* Disallow the 'unwind through managed frames' option: it's the safeset
  option by far, and also matches the reverse case.
* Disallow the 'disable' option: this is also not safe, let's try to go the
  safe route with CoreCLR.
* Change the default in native code too.

Partial fix for #10940.
2021-05-13 20:59:18 +02:00
Rolf Bjarne Kvinge 64e19d2d34
[runtime] Implement mono_class_get_nullable_param for CoreCLR. (#11531) 2021-05-13 20:39:07 +02:00
TJ Lambert 4fb1707e11
initial changes to Change languageSet and Dependencies (#11512)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-05-13 08:35:08 -05:00
Manuel de la Pena d1904eccf1
[CI] Remove noise added when debugging at the start of the CI move. (#11526) 2021-05-13 08:43:06 -04:00
Sebastien Pouliot 6b94c43de6
[dotnet][linker] Fix the elimitation of calls for `UIApplication::EnsureUIThread` (#11523)
Lack of `MONOTOUCH` define in the dotnet csproj [1] made this look for
the AppKit (XM) version.

[1] defining `MONOTOUCH` would have required several more changes.
Simplicity won!

|    Size    | MySingleView.app |
| ----------:|------------------|
|  4,579,985 | legacy           |
| 10,787,541 | dotnet [before](https://gist.github.com/02e072567595088522f376e522e22899) |
| 10,786,829 | dotnet [after](https://gist.github.com/afa5b7d4f9bb281646f050257034be11) |

There are other ways to achieve this with ILLink [2] but again:
Simplicity (by re-using) won!

[2] https://github.com/xamarin/xamarin-macios/issues/11477

--- a.cs	2021-05-12 14:17:13.000000000 -0400
+++ b.cs	2021-05-12 14:17:17.000000000 -0400
@@ -3764,13 +3764,6 @@
 }
 namespace UIKit
 {
-	public class UIKitThreadAccessException : Exception
-	{
-		public UIKitThreadAccessException()
-			: base("UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread.")
-		{
-		}
-	}
 	[Register("UIApplication", true)]
 	public class UIApplication : UIResponder
 	{
@@ -3824,14 +3817,6 @@
 			UIApplicationMain(args.Length, args, principal, @delegate);
 		}

-		public static void EnsureUIThread()
-		{
-			if (CheckForIllegalCrossThreadCalls && mainThread != null && mainThread != Thread.CurrentThread)
-			{
-				throw new UIKitThreadAccessException();
-			}
-		}
-
 		protected internal UIApplication(IntPtr handle)
 			: base(handle)
 		{
@@ -3862,7 +3847,6 @@
 		public UIButton(CGRect frame)
 			: base(NSObjectFlag.Empty)
 		{
-			UIApplication.EnsureUIThread();
 			if (base.IsDirectBinding)
 			{
 				InitializeHandle(Messaging.IntPtr_objc_msgSend_CGRect(base.Handle, Selector.GetHandle("initWithFrame:"), frame), "initWithFrame:");
@@ -3876,7 +3860,6 @@
 		[Export("setTitle:forState:")]
 		public virtual void SetTitle(string title, UIControlState forState)
 		{
-			UIApplication.EnsureUIThread();
 			IntPtr arg = NSString.CreateNative(title);
 			if (base.IsDirectBinding)
 			{
@@ -3948,8 +3931,7 @@
 			[Export("bounds")]
 			get
 			{
-				//Discarded unreachable code: IL_002f
-				UIApplication.EnsureUIThread();
+				//Discarded unreachable code: IL_002b
 				if (base.IsDirectBinding)
 				{
 					_ = 8;
@@ -3965,7 +3947,6 @@
 			[Export("mainScreen")]
 			get
 			{
-				UIApplication.EnsureUIThread();
 				return Runtime.GetNSObject<UIScreen>(Messaging.IntPtr_objc_msgSend(class_ptr, Selector.GetHandle("mainScreen")));
 			}
 		}
@@ -4025,7 +4006,6 @@
 		[Export("addSubview:")]
 		public virtual void AddSubview(UIView view)
 		{
-			UIApplication.EnsureUIThread();
 			IntPtr nonNullHandle = NativeObjectExtensions.GetNonNullHandle(view, "view");
 			if (base.IsDirectBinding)
 			{
@@ -4065,7 +4045,6 @@
 			[Export("view", ArgumentSemantic.Retain)]
 			get
 			{
-				UIApplication.EnsureUIThread();
 				if (base.IsDirectBinding)
 				{
 					return Runtime.GetNSObject<UIView>(Messaging.IntPtr_objc_msgSend(base.Handle, Selector.GetHandle("view")));
@@ -4083,7 +4062,6 @@
 		public UIViewController()
 			: base(NSObjectFlag.Empty)
 		{
-			UIApplication.EnsureUIThread();
 			if (base.IsDirectBinding)
 			{
 				InitializeHandle(Messaging.IntPtr_objc_msgSend(base.Handle, Selector.GetHandle("init")), "init");
@@ -4124,7 +4102,6 @@
 			[Export("setRootViewController:", ArgumentSemantic.Retain)]
 			set
 			{
-				UIApplication.EnsureUIThread();
 				IntPtr arg = NativeObjectExtensions.GetHandle(value);
 				if (base.IsDirectBinding)
 				{
@@ -4146,7 +4123,6 @@
 		public UIWindow(CGRect frame)
 			: base(NSObjectFlag.Empty)
 		{
-			UIApplication.EnsureUIThread();
 			if (base.IsDirectBinding)
 			{
 				InitializeHandle(Messaging.IntPtr_objc_msgSend_CGRect(base.Handle, Selector.GetHandle("initWithFrame:"), frame), "initWithFrame:");
@@ -4160,7 +4136,6 @@
 		[Export("makeKeyAndVisible")]
 		public virtual void MakeKeyAndVisible()
 		{
-			UIApplication.EnsureUIThread();
 			if (base.IsDirectBinding)
 			{
 				Messaging.void_objc_msgSend(base.Handle, Selector.GetHandle("makeKeyAndVisible"));
@@ -4188,7 +4163,6 @@
 		public UIApplicationDelegate()
 			: base(NSObjectFlag.Empty)
 		{
-			UIApplication.EnsureUIThread();
 			base.IsDirectBinding = false;
 			InitializeHandle(Messaging.IntPtr_objc_msgSendSuper(base.SuperHandle, Selector.GetHandle("init")), "init");
 		}
```

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
2021-05-12 20:18:49 -04:00
Manuel de la Pena 05e2a460c7
[CI] Use stage names and clean the triggers. (#11461)
Add stage names to the templates to use them in triggers in the future.
Remove a yaml file that turned out not to be needed (via a hack around
vsts limitations).
2021-05-12 18:26:00 -04:00
TJ Lambert 6eb60b9f74
Adding changes to make sure tests are not run in scheduled builds (#11518)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-05-12 17:16:32 -05:00
Sven Boemer dc320a3606
Update to new linker custom steps API (#11374)
* Update to new linker custom steps API

* PR feedback

- Fix indentation
- Add Initialize(LinkContext) to ExceptionalMarkHandler
- Remove unnecessary ifdef
- Use IsSetter/IsGetter
- Use [0] instead of Single()
- Avoid allocating empty collections

* Note override issue

* Clean up comments

* Move `DynamicRegistrationSupported` change earlier, along with the
detection code.

This solve the issue that `ILLink` does a similar job _before_ we have
the chance to disable the dynamic registrar.

* ILLink does not support considering other attributes as `[Preserve]`

when it is itself preserved at the assembly-level.

This ignored test is checking that feature so it cannot be enabled
for `NET`

Added to known breaking changes https://github.com/xamarin/xamarin-macios/issues/8900

* Fix removal of the dynamic registrar on legacy

* Fix IntPtr size inlining

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
2021-05-12 12:26:54 -04:00
Rolf Bjarne Kvinge 6e9d9b483d
[runtime] Implement mono_array_new and mono_array_length for CoreCLR. (#11515)
* [runtime] Implement mono_array_new for CoreCLR.

* [runtime] Implement mono_array_length for CoreCLR.
2021-05-12 15:21:56 +02:00
Rolf Bjarne Kvinge a3932e8765
Improve support for ARM64 on macOS. (#11501)
* Implement our xamarin_dyn_objc_msgSend[Super] overrides for ARM64.
* Modify mmp to use those overrides.
* Fix an issue with the existing xamarin_arm64_common_trampoline that caused
  exceptions to not unwind correctly.
* Add an ARM64 variation of xammac tests in xharness.
* Various test fixes.
2021-05-12 07:35:10 +02:00
Rolf Bjarne Kvinge af41f128de
[runtime] Implement mono_class_get_element_class for CoreCLR. (#11500) 2021-05-12 07:31:26 +02:00
Manuel de la Pena ffbb1d16cd
[Translations] Fix error message format with an extra brace. (#11502)
Updated via:
```bash
git grep -rl "Behavior}" ./ | xargs sed -i '.back' 's/Behavior}/Behavior/g'
```
2021-05-11 22:27:54 -04:00
Rolf Bjarne Kvinge 71fbdb7d27 [registrar] Register bools correctly for macOS/ARM64 in the dynamic registrar. 2021-05-11 15:54:39 +02:00
Rolf Bjarne Kvinge 178d9ae2ea [runtime/tools] Use the newly implemented objc_msgSend overrides for ARM64. 2021-05-11 15:54:39 +02:00
Rolf Bjarne Kvinge 8fc51f7e8e
[runtime] Implement mono_type_get_object for CoreCLR. (#11484) 2021-05-10 15:38:13 +02:00
Peter Collins fc22a097a8
[build] Add installer dependency to linker packs (#11352)
Adds a coherent parent dependency to `Microsoft.NET.ILLink.Tasks`, which
ensures that it will not be updated past the version included in
`Microsoft.Dotnet.Sdk.Internal`.

These changes allow us to remove our mono/linker darc subscriptions, as
`Microsoft.Dotnet.Sdk.Internal` updates will also bring in the latest
`Microsoft.NET.ILLink.Tasks` that the SDK references.  This will reduce
the number of dependency update PRs created by maestro.

Since the `Microsoft.NET.ILLink.Tasks` and `Microsoft.NET.ILLink` NuGet
packages are created by the same build, we only need to track one of
these package IDs in eng/Version* files.

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-05-10 13:00:07 +02:00
TJ Lambert 6cf9d78298
[Localization] Enabling OneLocBuild for every build (#11472)
Enabling OneLocBuild to run every build we have on main because the Loc team will need the Loc artifacts to be published every time. By moving the conditional to the isPRSelected input, we will run the task every time but only create the PRs once a week!
2021-05-07 09:30:59 -05:00
Rolf Bjarne Kvinge 1a689d3b14
[runtime] Implement mono_class_from_mono_type for CoreCLR. (#11470) 2021-05-07 15:47:03 +02:00