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

780 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Rolf Bjarne Kvinge 104ab12bdd
[dotnet/msbuild] Fix publishing user frameworks and dynamic libraries from binding projects. (#12396)
We extract frameworks from third-party libraries when running the linker, and
we need to store this information on disk and the reload it after the linker
has executed, and add it to the existing MSBuild variables that keep track of
the user frameworks and dynamic libraries that have to be copied to the app
bundle.

Fixes the framework-test tests.
2021-08-11 09:58:00 +02:00
Manuel de la Pena 0d5d94da41
[OSLog] Add support for xcode13 beta4. (#12392) 2021-08-10 23:12:16 -04:00
VS MobileTools Engineering Service 2 7dc6c9cffd
Localized file check-in by OneLocBuild Task (#12380) 2021-08-09 23:23:55 -04:00
Rolf Bjarne Kvinge 4371133cf7
[dotnet] Remove workaround for private symbols for AOT. (#12334)
* [dotnet] Remove workaround for private symbols for AOT.

* [tools] Make Application.AotArguments a list of string.

This is just a simple refactoring to make Application.AotArguments a list of
strings instead of a comma-separated list of values.

* [tools] Only use direct-icalls when linking mono statically.

Ref: https://github.com/dotnet/runtime/issues/55000

* [mtouch] Fix aot arguments comparison.

* [tests] Adjust mtouch test according to mtouch changes.

* [tests] Add minimum OS version to the Mac Catalyst variation of the MySimpleApp test case.
2021-08-09 09:45:58 +02:00
VS MobileTools Engineering Service 2 63cb431a7b
Localized file check-in by OneLocBuild Task (#12315) 2021-08-02 15:53:17 -04:00
Rolf Bjarne Kvinge f148de46fd
[tools] Remove dead code. (#12285) 2021-07-30 09:47:32 +02:00
VS MobileTools Engineering Service 2 c5e60a1462
[Localization] Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 5018259 (#12220) 2021-07-28 09:57:35 -05:00
VS MobileTools Engineering Service 2 042cd714fe
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 4945304 (#12079)
First group of translated resx files coming from OneLocBuild!
2021-07-21 17:34:51 -05:00
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
Rolf Bjarne Kvinge 70d0f86099 Merge remote-tracking branch 'origin/main' into HEAD 2021-06-23 18:38:43 +02: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 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 7aec86fa04 ools] Create a PathUtils class and move some shareable code there. 2021-06-18 10:24:28 +02: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
TJ Lambert 640467a03f
Updating Localization READMEs (#11738)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-06-01 09:51:38 -05: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
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
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
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
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
Sebastien Pouliot ccd769bd9d
[linker] Split CoreTypeMapStep into two parts (#11474)
The newly extracted `RegistrarRemovalTrackingStep` can be used inside
`dotnet-linker` to remove the dynamic registrar (if not required by some
other code).
2021-05-07 08:20:23 -04:00
TJ Lambert a154f30e03
[Localization] Localization changes for OneLocBuild (#11395)
Enabling MSBuild, Mtouch, and all their localization dependencies to use the new resx files provided from OneLocBuild.
2021-05-06 19:42:53 -05:00
Rolf Bjarne Kvinge c51cba525a
[runtime] Implement mono_runtime_invoke for CoreCLR. (#11439)
* [runtime] Implement mono_runtime_invoke for CoreCLR.

* [runtime] We always need a native xamarin_mono_object_retain function.
2021-05-06 07:25:43 +02:00
Rolf Bjarne Kvinge 14e76c0139
[runtime] Return the exception from wrapper methods for exception marshalling. (#11382)
There's no general way to set a pending managed exception in CoreCLR (the
current plan is to support setting a pending managed exception for the
objc_msgSend family of functions). This means that the way we've implemented
custom wrappers that can handle Objective-C exceptions won't work, because
those wrappers currently tries to set a pending managed exception (which Mono
throws upon returning from the corresponding native wrapper function).

So rewrite this a bit: these custom wrappers now return a GCHandle with the
managed exception as an out parameter, and the calling managed code throws
that exception instead.

This also required adjusting a few API definitions to match how their wrapper
functions are defined.
2021-05-04 08:25:38 +02:00
Rolf Bjarne Kvinge 5d42c933f1
[runtime] Move xamarin_create_managed_ref internal call to managed code. (#11271)
Move the xamarin_create_managed_ref internal call to managed code, to ease things
with CoreCLR.

In order to preserve performance, this wasn't a straight forward port.

* monotouch_create_managed_ref used to detect if there already was a GCHandle for
  a native object. To avoid a managed->native transition, this logic has now been
  moved into the code that sets the GCHandle (the xamarinSetGCHandle🎏 / xamarin_set_gchandle_trampoline
  code), and these methods return a value saying whether the GCHandle was set or
  not.

* xamarin_create_gchandle will check the retain count to determine whether to create
  a weak or a strong GCHandle for the managed object. In this particular case we
  should never need to create a strong GCHandle, which means that we don't need to
  check the retain count (saving a managed->native transition).

Using the new perftest (#11298), I get very similar numbers for both old code and new code: https://gist.github.com/rolfbjarne/e0fc2ae0f21da15062b4f051138679af (multiple runs). Sometimes the old code is faster, sometimes the new code is faster (although the old code tends to be the one who wins).

In any case there aren't any significant performance hits due to this change, so it should be good to go.
2021-04-23 18:42:11 +02:00
Rolf Bjarne Kvinge a3613a187f
[tools] Fix a typo in the error message for MX2301 that caused a format exception. (#11291)
Makes this error show properly:

> error MM2301: The linker step 'Setup' failed during processing: This version of {0} requires the {1} {2} SDK (shipped with Xcode {3}). Either upgrade Xcode to get the required header files or use the dynamic registrar or set the managed linker behaviour to Link Platform or Link Framework SDKs Only in your project's Mac Build Options > Linker Behavior} (to try to avoid the new APIs).. String.Format failed! Arguments were: "Microsoft.macOS" "macOS" "11.3" "12.5". Please file an issue to report this incorrect error handling.
2021-04-22 20:51:58 +02:00
Rolf Bjarne Kvinge 405441f544
[mtouch] It seems watchOS simulators can automatically choose the right architecture from fat apps. (#11241)
* [mtouch] It seems watchOS simulators can automatically choose the right architecture from fat apps.

So we can build a fat simulator app, and not depend on mlaunch copying in the
specific architecture at launch time.

A partial fix for https://github.com/xamarin/maccore/issues/2411.

* Bump maccore.

New commits in xamarin/maccore:

* xamarin/maccore@d11721f55e [Xamarin.Hosting] Xcode seems to have changed some logic with regards to getting the primary instruments server. (#2416)
* xamarin/maccore@d27297a098 [Xamarin.Hosting] Don't copy single-arch executable over a fat executable. (#2417)
* xamarin/maccore@6c305d4aa7 [Xamarin.Hosting] Launching may succeed even if the launch request fails. Don't fail in that case. (#2415)
* xamarin/maccore@bccc91d6a0 Support ARM64 and ARM64e simulators (#2418)

Diff: c89fd6a694..d11721f55e
2021-04-21 08:00:02 +02:00
Sebastien Pouliot 3511995fd7
[linker] Obsolete 'LinkerSafeAttribute' in favor of `AssemblyMetadata` (#11229)
In this case we can obsolete the attribute on both legacy and dotnet
since the replacement attribute is available on both. However this does
require a small update to the legacy linker (and is part of the PR).

Fix https://github.com/xamarin/xamarin-macios/issues/10674
2021-04-16 15:06:49 -04:00
Peter Collins 5c12fdfac9
[build] Use arcade dependency management tooling (#10890)
* [build] Use arcade dependency management tooling

* Apply feedback

* Apply second round of feedback

* Always make dotnet.config before trying to read it

* Debugging

* Update dependencies, trim tabs and spaces

* [dotnet] Remove the existing workload shipped with .NET and install our locally built ones.

The new version of .NET ships with our workloads, but those aren't
the workloads we want to use, so replace them with our own.

* Update .gitignores.

* Bump to 6.0.100-preview.3.21181.5

That required renaming simulator runtime packs...

* More rename for simulator packages

* moar (hopefully all)

* Bump to 6.0.100-preview.3.21201.11

This fix the issue with `Wait` that failed several tests in monotouch-tests

However it does not include the fix for AppConext.GetData on device (AOT)

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-authored-by: Sebastien Pouliot <sebastien@xamarin.com>
2021-04-02 00:02:27 -04:00
Alex Soto c77db16b76 Revert "Localized file check-in by OneLocBuild Task"
This reverts commit 92e847b68e.
2021-03-25 19:43:47 -04:00
VS MobileTools Engineering Service 2 92e847b68e Localized file check-in by OneLocBuild Task 2021-03-25 12:25:59 -07:00
Rolf Bjarne Kvinge 32e4d05195
[dotnet] Add support for specifying the VM with the _XamarinRuntime property. (#10881)
Use a private property (prefixed with underscore) for now, until we can decide
on a better/general name.

Also add a variation to xharness to build monotouch-test with CoreCLR
(building works fine, but it crashes at startup, which is expected at this
point).
2021-03-16 18:32:04 +01:00
Rolf Bjarne Kvinge bf7c3268bc
[dotnet] Use the reference assemblies from the .NET 6 version we're referencing. (#10813) 2021-03-09 14:57:56 +01:00
Rolf Bjarne Kvinge 80ed9d81bc
Add configure option to disable building for legacy Xamarin. (#10773)
* Add configure option to disable building for legacy Xamarin.

This can greatly speed up the debug-edit-build cycle when doing .NET
development, since it cuts down the build time in half more or less.

* Bump maccore.

New commits in xamarin/maccore:

* xamarin/maccore@548fa45432 [mlaunch] Disable building mlaunch when not including the legacy Xamarin build. (#2403)

Diff: 0562e08b12..548fa45432
2021-03-04 09:07:44 +01:00
Rolf Bjarne Kvinge 871e7b1cd0
[runtime] Build our runtime for Mac Catalyst/ARM64 for .NET. (#10739)
* [runtime] Build our runtime for Mac Catalyst/ARM64 for .NET.

* [ObjCRuntime] There's no need for the StartWWAN implementation on Mac Catalyst.

This also fixes a build error:

    error MT5214: Native linking failed, undefined symbol: _xamarin_start_wwan. This symbol was referenced by the managed member ObjCRuntime.Runtime.xamarin_start_wwan.

* Only exclude xamarin_start_wwan in the .NET version of Mac Catalyst.

* [tests] Update to not run the StartWWAN test on Mac Catalyst.

* Update conditional logic.

* Fix build with newer make versions.
2021-03-03 07:48:07 +01:00
Rolf Bjarne Kvinge 7c6c8e02e3
[msbuild] Use the macOS SDK to build Mac Catalyst apps instead of the iOS SDK (#10644)
* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@1e738e9 [Xamarin.MacDev] Extract the code to convert between Mac Catalyst versions to a separate file. (#89)
* xamarin/Xamarin.MacDev@a3bb12c [Xamarin.MacDev] Add methods to map between iOS and macOS versions for Mac Catalyst. (#88)

Diff: 02d6d05be3..1e738e9f7f

* [msbuild] Use the macOS SDK to build Mac Catalyst apps instead of the iOS SDK

From a native compilation perspective, compilating a Mac Catalyst is the macOS SDK
+ a dash of iOS, so use the native macOS SDK to compile, and then do the corresponding
adjustments elsewhere.

At the same time document which version we want for the sdk version and the deployment
target in mtouch, and adjust the code accordingly (sdk version: macOS version; deployment
target: iOS version).

* Update resource files

* Add new entry to canary test for string localization.
2021-02-17 17:25:36 +01:00
Rolf Bjarne Kvinge 73d3f9894e
[tools] Move logic to validate/initialize DeploymentTarget to shared code. (#10616)
So that it's executed for .NET as well.
2021-02-12 21:46:13 +01:00
Rolf Bjarne Kvinge 9f710fc9e5
[tools] Stop hardcoding the product name for error messages. (#10615) 2021-02-11 20:17:44 +01:00
Rolf Bjarne Kvinge 8f36d37659 [tools] Move Driver.GetAotArguments to shared code. 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 96a2d84403 [tools] Move Application.EnableMSym from mtouch to shared code. 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge abffb528d1 [tools] Move the various Dlsym options/logic from mtouch to shared code 2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge 32b13d4598 [tools] Move the DlsymOptions enum to its own file.
Also add it to mmp.
2021-01-28 08:09:59 +01:00
Rolf Bjarne Kvinge c80eed5d62 [tools] Pass and parse the MtouchInterpreter value. 2021-01-28 08:09:59 +01:00
Sebastien Pouliot 77c154df35
[mtouch][mmp] Exclude extraneous framework files from being copied into apps (#10441)
Today both `mtouch` and `mmp` are copying the entire `.framework`
directories inside the `.app\[Contents\]Frameworks\` directory.

However not everything in a framework is required at runtime. The most
common unrequired files would be headers (`Headers/*.h`) and modules
(`Modules/*`).

Looking at Xcode build output we can see something like:

```
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -exclude Headers -exclude PrivateHeaders -exclude Modules -exclude \*.tbd -bitcode-strip replace-with-marker -bitcode-strip-tool
```

which excludes a few more, less common, files.

This _builtin_ command is not available externally (for us to re-use)
but it hints that Xcode is likely using `rsync` to avoid copying part of
the files.

Note: the builtin command also _likely_ calls `bitcode_strip` too (or has
similar code embedded) and `mtouch` already does so too

There's a cost to spawning an external process, like `rsync`, which we
avoid by having our own file copier, which clones files (almost zero
cost). That does not support excluding files, but deleting files is also
very cheap. Testing shows copying a framework to be less than 1 ms, even
with with extra deletion step.

* Tweak `GetRealPath` to optionally not to warn if the path does not exists

since, in this case, it's a check we want to do after resolving the path

This fixes several (5) MTouch tests looking for specific (and no extra)
warnings

```
Unable to canonicalize the path '/Users/builder/azdo/_work/2/s/xamarin-macios/tests/mtouch/bin/Debug/tmp-test-dir/Xamarin.Tests.BundlerTool.CreateTemporaryDirectory195/testApp.app/Frameworks/Mono.framework/CVS': No such file or directory (2).
```
2021-01-19 08:48:10 -05:00
Sebastien Pouliot 56d073317a
[tools] Do not check the existing of a file before deleting it (#10443)
because:

> If the file to be deleted does not exist, no exception is thrown.

https://docs.microsoft.com/en-us/dotnet/api/system.io.file.delete?view=net-5.0

and yes this is different from `Directory.Delete` and PR https://github.com/xamarin/xamarin-macios/pull/10441

* Fix MT0015 test failure

The MT0015 test creates a directory where a file is expected.

That's fine except the code for handling this was a bit weird. It
worked because of a `TryDelete` on the path, which avoided the
`UnauthorizedAccessException` when `File.Delete` is used on a path.
Then later there's a `Directory.Exists` check that would throw...

The code now does the `Directory.Exists` first and only call
`File.Delete` if it returns false. The throwing of the exception
is kept since the code (and test) are already present (and this
minimize changes and chance of other surprises)
2021-01-19 08:29:11 -05:00
Sebastien Pouliot d9b0097c3b
[mtouch] Fix embedding Mono (and Xamarin) as frameworks. Fixes #10382 (#10400)
This broke with 1582bf47cc and cause the
frameworks to be nested under another `Frameworks` directory.

See https://github.com/xamarin/xamarin-macios/issues/10382
2021-01-13 08:22:55 -05:00
Rolf Bjarne Kvinge 61bd40e39c
[mtouch] Allow referencing Xamarin.iOS.dll in a Mac Catalyst app. (#10318) 2020-12-18 16:47:08 +01:00
Alex Soto 04461cd5c8
Merge pull request #10306 from dalexsoto/main-xcode12.3
[main] Merge xcode12.3 into main
2020-12-17 15:20:24 -05:00
Rolf Bjarne Kvinge 1582bf47cc
Add support for binding projects in Mac Catalyst. Fixes #10286. (#10295)
* [tests] Build test-libraries for Mac Catalyst.

* [msbuild] Add support for Mac Catalyst binding projects.

* [mtouch] Allow frameworks for Mac Catalyst apps.

* [mtouch] Put frameworks in the expected location for Mac Catalyst apps.

* [msbuild] Create the Resources directory before trying to put files in it.
2020-12-17 18:53:16 +01:00