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

160 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 95e42b9266
Rename master to main. (#8851)
* Fix links that point to master to point to main instead.
* Implement support in the sample tester for specifying the default branch for
  each sample repo.
* Fix various text / documentation to say 'main' instead of 'master.'
* Push to 'main' instead of 'master' in xamarin-macios-data.
* Fix xharness to make 'main' the special branch with regards to documentation tests as opposed to 'master'.
* Fix various CI to use 'main' instead of 'master'.
* Bump maccore

    New commits in xamarin/maccore:

    * xamarin/maccore@ed6d146822 Rename 'master' to 'main'. (#2233)

    Diff: 424fa26148..ed6d146822
2020-06-16 15:51:44 +02:00
Chris Hamons 78dcb51fe3
Remove notice from generated iOS Apps (#8857)
- The notice points to an out of date page, currently dead (will be redirected soon)
- https://github.com/xamarin/xamarin-macios/issues/8849 is the new home
2020-06-15 15:52:08 -05:00
Rolf Bjarne Kvinge 2f4dae9e00
[mmp] Don't ignore failures to execute pkg-config and simplify/improve logic. (#7969)
* [mmp] Don't ignore failures to execute pkg-config and simplify/improve logic.

* Show proper errors if pkg-config fails to execute.
* Extract logic to verify system mono version into its own function.
* Extract logic to execute pkg-config into its own function.

* Simplify code slightly.

* [mmp] Remove the MM5301 error message.

It's never used in mmp, and the same error code is already used in mtouch.
2020-02-26 00:38:20 +01:00
Sebastien Pouliot d83e13edf1
[mtouch][mmp] Add a `--warn-on-type-ref=X` option (#7949)
Using this option it's possible to test for the presence of a type
reference in both pre-linked and post-linked assemblies.

This makes it possible to detect if
* a 3rd party assemblies are using some specific type you would like to avoid;
* a type reference has been removed during the build (e.g. linker)

Notes:
* Custom attributes are encoded differently and not included in the assembly type references metadata.
* Assembly that define a type `X` do not have a reference (but the definition) of the type (and won't be reported).

If either the pre or post-linked warnings are not useful then it's possible
 to add `-nowarn:150x` to exclude the results.

E.g.
* `-nowarn:1502` would not report references in pre-linked assemblies;
* `-nowarn:1503` would not report references in post-linked assemblies;

Finally `-warnaserror:150x` can be used to stop a build that would not
satisfy either the pre or post-linked condition.

* `-warnaserror:1502` would not report references in pre-linked assemblies;
* `-warnaserror:1503` would not report references in post-linked assemblies;

_side note_ same as https://github.com/xamarin/xamarin-macios/pull/7925
except that this one uses the localized mtouch/mmp errors only in master (so far)
2020-02-20 22:25:23 -05:00
Rolf Bjarne Kvinge 884c13775a [docs] Add links to explain what native code sharing is. (#3009) 2019-11-22 15:06:06 -05:00
michizhou 00f7069b23 [mmp] [mtouch] Expand error message for MM4162 and MT4162. Fixes #4286 (#7313) 2019-11-04 11:09:28 -05:00
Vincent Dondain 61d0e1809f Merge remote-tracking branch 'origin/master' into master-merge-d16-4 2019-10-14 18:17:35 -04:00
Rolf Bjarne Kvinge a8fdf6db6e
Implement a different escaping/quoting algorithm for arguments to System.Diagnostics.Process. (#7177)
* Implement a different escaping/quoting algorithm for arguments to System.Diagnostics.Process.

mono changed how quotes should be escaped when passed to
System.Diagnostic.Process, so we need to change accordingly.

The main difference is that single quotes don't have to be escaped anymore.

This solves problems like this:

    System.ComponentModel.Win32Exception : ApplicationName='nuget', CommandLine='restore '/Users/vsts/agent/2.158.0/work/1/s/tests/sampletester/bin/Debug/repositories/ios-samples/WorkingWithTables/Part 3 - Customizing a Table\'s appearance/3 - CellCustomTable/CellCustomTable.sln' -Verbosity detailed -SolutionDir '/Users/vsts/agent/2.158.0/work/1/s/tests/sampletester/bin/Debug/repositories/ios-samples/WorkingWithTables/Part 3 - Customizing a Table\'s appearance/3 - CellCustomTable'', CurrentDirectory='/Users/vsts/agent/2.158.0/work/1/s/tests/sampletester/bin/Debug/repositories', Native error= Cannot find the specified file
      at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x0029f] in /Users/builder/jenkins/workspace/build-package-osx-mono/2019-08/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:778

ref: https://github.com/mono/mono/pull/15047

* Rework process arguments to pass arrays/lists around instead of quoted strings.

And then only convert to a string at the very end when we create the Process
instance.

In the future there will be a ProcessStartInfo.ArgumentList property we can
use to give the original array/list of arguments directly to the BCL so that
we can avoid quoting at all. These changes gets us almost all the way there
already (except that the ArgumentList property isn't available quite yet).

We also have to bump to target framework version v4.7.2 from v4.5 in several
places because of 'Array.Empty<T> ()' which is now used in more places.

* Parse linker flags from LinkWith attributes.

* [sampletester] Bump to v4.7.2 for Array.Empty<T> ().

* Fix typo.

* Rename GetVerbosity -> AddVerbosity.

* Remove unnecessary string interpolation.

* Remove unused variable.

* [mtouch] Simplify code a bit.

* Use implicitly typed arrays.
2019-10-14 16:18:46 +02:00
Vincent Dondain a3076f29a3 Merge branch 'xcode11.1' into d16-4 2019-10-07 21:46:13 -04:00
Rolf Bjarne Kvinge 1e92a732ef
[mtouch] Tweak watchOS architecture test to build for bitcode when building with llvm. Fixes xamarin/maccore#1994. (#7097)
Tweak the watchOS architecture test to build for bitcode when building with
llvm, since that's what's usually done.

Also tweak the MT0145 error message a bit.

Fixes https://github.com/xamarin/maccore/issues/1994.
2019-09-25 17:06:27 +02:00
Bernhard Urban 26ec2826aa ARM64_32 Debug Mode (#7012)
* [builds] add arm64_32 cross compiler

* [mtouch] force --interpreter on arm64_32 debug mode build

* [mtouch] include debug check for arm64_32 and reflect error codes in documentation
2019-09-24 17:24:49 +02:00
Rolf Bjarne Kvinge 382083c992
[mmp] Don't ignore failures to execute pkg-config. (#7066)
Also bump system mono to a version whose pkg-config executable actually works
on Catalina.
2019-09-23 16:59:14 +02:00
Rolf Bjarne Kvinge 303aa0a649 Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Rolf Bjarne Kvinge f7363ecfbf Renumber an error so that it doesn't clash with another error. 2019-09-12 08:35:21 +02:00
Rolf Bjarne Kvinge be129e8120 Fix leftover merge marker. 2019-09-12 08:33:32 +02:00
Rolf Bjarne Kvinge f6e0531197 Merge xcode11 into d16-3. 2019-09-12 08:29:02 +02:00
Rolf Bjarne Kvinge 15f0af7a1a
[registrar] Report a warning when the registrar export an abstract INativeObject type to Objective-C. (#6659)
* [registrar] Report a warning when the registrar export an abstract INativeObject type to Objective-C.

Exporting abstract types to Objective-C can lead to problems when at runtime
we're asked to create an instance of such a type (which we can't), so warn
when this happens.

This would have caught #6655, and the problems explained in #4969 as well.

Since this may trigger for code that's currently working fine, I'm making it a
warning instead of an error (which means adding some extra code to be able to
easily report warnings from the generator code).

* Don't assume a TypeReference can be successfully resolved every time.
2019-09-10 04:35:59 -07:00
Rolf Bjarne Kvinge b8e9c83ce0
[mtouch] Detect when we run into the 32-bit arm size limitation, and report a better error. Fixes #6526. (#6855)
Also limit the output from the native compiler, so that we don't overload the
IDEs with output if the native compiler produces tens of thousands of errors.

Fixes https://github.com/xamarin/xamarin-macios/issues/6526.
2019-08-28 04:54:26 -07:00
Rolf Bjarne Kvinge d4192a59f0
[xcode11] Remove the WatchKit framework from iOS while keeping API stability. Fixes #6492. (#6503)
* [WatchKit] Remove this framework for iOS while keeping backwards compatibility. Fixes #6492.

* Copy all generated sources and modify them to throw PlatformNotSupported exceptions.
* Adjust some existing source code to also throw PlatformNotSupported exceptions.
* Sprinkle Obsolete attributes generously.
* Stop generating code for the WatchKit framework for iOS.

Fixes https://github.com/xamarin/xamarin-macios/issues/6492.

* [introspection] Adjust test.

* [mtouch] Don't link with WatchKit, and show a warning if we detect code that want to use WatchKit.

* [xtro] Remove WatchKit for iOS.

* [introspection] Don't check obsoleted NSString fields for null.

There's probably a reason the field was obsoleted.

* [introspection] Add exception for the WatchKit framework.

* [xtro] Ignore obsolete enums.

There's probably a reason they're obsoleted.

In particular it solves a confusion between WKWebKit.WKErrorCode and
WatchKit.WKErrorCode: for iOS, the latter is obsoleted, and this way we always
process the former instead.

* [mtouch] Adjust wording for MT4178 to be more accurate.

* [WatchKit] Make more API obsolete/hidden.

Two classes managed to slip past the first time.

* [tests] Adjust test after WatchKit removal.
2019-08-14 17:46:55 +02:00
Rolf Bjarne Kvinge a495077533
[xcode11] Stop building/shipping 32-bit Xamarin.Mac bits. Partial fix for #6300. (#6393)
This includes:

* 32-bit version of Xamarin.Mac.dll and OpenTK.dll
* XamMac.dll and XamMac.CFNetwork.dll
* 32-bit versions of the runtime libraries (libxammac.a and friends).
* 32-bit version of the partial static library for Xamarin.Mac.
* Classic support in the generator.

We still ship a few Classic files so that Visual Studio for Mac continue to detect that Xamarin.Mac is installed (otherwise VSfM won't open Classic projects, which makes it impossible to use the migration wizard).

This makes our build slightly faster.

Partial fix for #6300.
2019-07-15 10:19:24 -07:00
Sebastien Pouliot fc5b9e24d4
[mmp] Ignore, by default, frameworks that cause rejection from App Store. Fix #6039 (#6107)
So far this only applies to `QTKit`...

XM will now, by default, avoid natively link with QTKit unless it's
instructed to so explicitly using `--link-prohibited-frameworks`

ref: https://github.com/xamarin/xamarin-macios/issues/6039
2019-05-23 15:59:40 -05:00
Rolf Bjarne Kvinge 045945817b [registrar] Extract code to create a managed array from an NSArray to a separate method. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 2cb20de784 [registrar] Extract code to create an NSArray from a managed array to a separate method. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge d9c0d5e93a [runtime] Report which element failed to convert when marshalling an array between Objective-C and managed code. 2019-04-30 14:29:24 +00:00
Rolf Bjarne Kvinge 7a9cb8372a [registrar] Extract code to create a managed array from an NSArray to a separate method. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge 4f3b6115fc [registrar] Extract code to create an NSArray from a managed array to a separate method. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge f83df952de [runtime] Report which element failed to convert when marshalling an array between Objective-C and managed code. 2019-04-26 11:20:15 +02:00
Rolf Bjarne Kvinge c8ed014af7
[runtime] Improve exception creation. (#5944)
* [runtime] Add an inner exception parameter to Runtime.CreateProductException.

This allows us to simplify code by using inner (and outer) exceptions as
a means to provide information instead of passing extra information
around in order to create decent exceptions.

One example is how we pass the selector and method name to the method
that converts from a native id to a managed NSObject instance: passing
this information is not necessary anymore if we can use two exceptions,
one for the failure to convert from an id to a NSObject instance,
wrapped in a second that tells which method/selector call ran into this
conversion problem.

* [runtime] Throw better exceptions when the dynamic registrar can't marshal something.

* [runtime] Throw a better exception when something goes wrong when trying to marshal a return value.

* [runtime] Use inner exceptions to convey failure information instead of trying to create a single exception with all we know.

* Fix merge problem.
2019-04-26 11:16:23 +02:00
Rolf Bjarne Kvinge c8ff37a3f2
[docs] Fix issues that look like merge problems in the mtouch/mmp docs. (#5933)
* Fix formatting for a few errors.
* Add a few missing mtouch errors.

It looks like all of this is due to incorrect merges.
2019-04-23 13:59:39 +01:00
Vincent Dondain 86d1b42ad2 Merge branch 'xcode10.2' into master-merge-xcode10.2 2019-04-03 13:57:31 -04:00
Sebastien Pouliot 5c321ac89d
[mtouch] Update validations around --interpreter (#5772)
This also centralize other interpreter checks and options in the same
location (making it easier to read / update).

* Warn and switch the REPL if the interpreter is enabled on simulator

Why ? It's confusing to build the same code using different options for
simulator and devices. This is what happens if you try to use features
like `dynamic` or `System.Reflection.Emit`.

So instead of an error, we warn that the interpreter is not supported
and switch to the existing REPL mode.

The JIT remains the only option for the simulator but it allows testing
features without a device.

* Fail early if the interpreter is used on 32bits [1]

The current interpreter only works on 64 bits (so ARM64). However the
error won't be reported, back to the developer, until deployment time.

This temporary [1] fix spot the condition very early and report an error

```
error MT0099 : Internal error : The interpreter is currently only available for 64 bits.
```

instead of the current one at deploy time

```
IncorrectArchitecture: Failed to find matching arch for 32-bit Mach-O input file /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.tNKDlx/extracted/X.app/X
error MT1006: Could not install the application 'X.app' on the device 'Mercure': AMDeviceSecureInstallApplicationBundle returned: 0xe8000087 (kAMDIncorrectArchitectureError).

Application could not be uploaded to the device.
```

[1] https://github.com/mono/mono/issues/9871

* [tests] Fix/renumbered MT0138

The test was using simulator + interpreter which is not _really_
possible, we use REPL in that case - so we're now checking if
assemblies were specified with `--interpreter` to cover both cases.

Also 0138 was already used by `mmp` and the warning was **not**
registered or documented in the errors documents. To avoid
confusion it has been renumbered to 0142 and documented.
2019-03-19 08:22:39 -05:00
Rolf Bjarne Kvinge 590524243c
Improve MachO support to read LC_BUILD_VERSION and static libraries. (#5685)
* MachO.cs: Support reading LC_BUILD_VERSION

Newer SDKs set this instead of LC_VERSION_MIN_*

* MachO.cs: Add support for reading Mach-O files inside ar archives.

* [tests] Augment ProductTests.MinOSVersion to test static libraries as well.

* Adjust enum field names to match our naming scheme.
2019-03-01 08:00:53 +01:00
Rolf Bjarne Kvinge ffda8b93ba
[mtouch] Remove MT0028, since it's only applicable if iOS deployment target is < 4.2. (#5625) 2019-02-20 06:29:52 +01:00
Rolf Bjarne Kvinge 135507957f
[linker] Remove non-bitcode compatible code, and show a warning. (#5551)
* [linker] Remove non-bitcode compatible code, and show a warning.

Remove code not currently compatible with bitcode and replace it with an
exception instead (otherwise we'll assert at runtime).

Also show a warning when we detect this.

This is quite helpful when looking at watch device test runs to filter out
failures we already know about.

This fixes point #2 in #4763.

* Improve documentation.

* Simplify linker code by using a substep.

* Fix whitespace issues.

* Improve reporting.

* Add support for reporting more than one MT2105 at the same time when making
  the errors instead of warnings.
* Only report MT2105 for methods that haven't been linked away.
* Format the error message nicer for properties.

* Tweak a bit for warning tests to pass.

* Use ExceptionalSubStep to provide better error information.

* Adjust where linker warnings/errors are reported from to avoid a NullReferenceException.
2019-02-07 07:57:01 +01:00
Rolf Bjarne Kvinge 22c8ca5090
[docs] Make PreserveSmartEnumConversionsSubStep use unique error codes and improve ExceptionalSubStep error documentation. (#5555)
* Make PreserveSmartEnumConversionsSubStep use error codes that are not
  already used elsewhere: this isn't obvious at first, but all
  ExceptionalSubStep errors use a range of error numbers (10 numbers from NNN0
  to NNN9), so we need to reserve that entire range. In this case there were
  other errors using some of the numbers of the range for PreserveSmartEnumConversionsSubStep.
* Make sure there are anchor links for all the variations of each ExceptionalSubStep error.
2019-02-06 15:31:49 +01:00
Sebastien Pouliot 974617d144
[mtouch] Provide a better (and single) error message when the interpreter is enabled in simulator builds. (#5376)
Before

```
clang : error : no such file or directory: '/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmono-ee-interp.a'
clang : error : no such file or directory: '/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmono-icall-table.a'
clang : error : no such file or directory: '/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmono-ilgen.a'
error MT5209 : Native linking error : clang: error: no such file or directory: '/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmono-ee-interp.a'
error MT5209 : Native linking error : clang: error: no such file or directory: '/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmono-icall-table.a'
error MT5209 : Native linking error : clang: error: no such file or directory: '/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libmono-ilgen.a'
MTOUCH : error MT5202: Native linking failed. Please review the build log.
    0 Warning(s)
    7 Error(s)
```

After

```
MTOUCH : error MT0141: The interpreter is not supported in the simulator. Do not pass --interpreter when building for the simulator.
    0 Warning(s)
    1 Error(s)
```
2019-01-11 11:38:22 -05:00
Alex Soto 8bb5ab52b1
[registrar] Validate input to Adopts attribute (#5191)
Fixes xamarin/xamarin-macios#4107

We currently generate invalid registrar code when we get invalid input
in 'Adopts' attribute, this can happen because 'Adopts' can take a
plain string. We now generate a better error MT4177 instead of
generating invalid registrar.m/h code.
2018-11-28 10:06:36 -05:00
Sebastien Pouliot d2a9a57bb9
[mtouch] Display a specific error is a .framework binary is invalid. Fixes #5028 (#5031)
Instead of a generic `MT0000` caused by an exception reading the magic
numbers of the binary framework file.

This was caused be uncompressing an archive, with a symlink, into a
file system that does not support symlinks (on Windows).

ref: https://github.com/xamarin/xamarin-macios/issues/5028
2018-10-23 14:15:58 -04:00
Jeffrey Stedfast 0cbf9609a1
Update mtouch-errors.md 2018-10-22 10:22:52 -04:00
Jeffrey Stedfast 502d811c43
Update mtouch-errors.md 2018-10-22 10:20:57 -04:00
Rolf Bjarne Kvinge 45d2ade35e
[docs] Improve documentation for MT5216. Fixes #4445. (#4956)
Fixes https://github.com/xamarin/xamarin-macios/issues/4445.
2018-10-10 08:52:05 +02:00
Chris Hamons 3119129ab7 Remove references to bugzilla and replace with github (#4920)
https://github.com/xamarin/xamarin-macios/issues/3647
2018-10-04 09:43:55 -04:00
Rolf Bjarne Kvinge 11d9fe68db
[mtouch/mmp/docs] Improve MT0091 to include how to enable the linker. Fixes #4549. (#4852)
Fixes https://github.com/xamarin/xamarin-macios/issues/4549.
2018-09-21 16:51:23 +02:00
Vincent Dondain dbb151c63e [docs] Fix errors after broken merge 2018-09-19 11:03:56 -04:00
Vincent Dondain 2174ec41a2 Merge branch 'xcode10' 2018-09-18 14:12:39 -04:00
Vincent Dondain 436c933584 Fix d15-9 merge issues 2018-09-17 09:22:02 -04:00
Vincent Dondain 91a52a17f5 Merge branch 'xcode10' into d15-9-merge-xcode10 2018-09-14 12:53:17 -04:00
Rolf Bjarne Kvinge 385592b128
[runtime] Throw a managed exception instead of trying to call a null function pointer if the runtime tries to call a function that has been linked away. (#4770)
* [runtime] Throw a managed exception instead of trying to call a null function pointer if the runtime tries to call a function that has been linked away.

* [tests] Add new file for Xamarin.Mac tests.

* Direct people to file issues in github.
2018-09-10 10:56:02 +02:00
Rolf Bjarne Kvinge bd32b74347
Add support for delegates as return values in protocol members. Fixes #4102. (#4758)
* Add support for delegates as return values in protocol members. Fixes #4102.

This required a few changes:

* The generator now emits the DelegateProxy attribute for property getters in
  protocol interfaces.
* The generator now emits the DelegateProxy attribute in ProtocolMember
  attributes (and the ProtocolMember attribute has been extended with
  additional properties for this purpose).
* The generator now emits the BlockProxy attribute for the parameter in
  property setters.
* The generator now emits the BlockProxy attribute in ProtocolMember
  attributes for property setters.
* The static registrar now emits the metadata token for the
  DelegateProxy.DelegateType property into the generated code so that the
  DelegateProxy attribute itself isn't needed at runtime. This is required
  when the dynamic registrar has been optimized away.

Fixes https://github.com/xamarin/xamarin-macios/issues/4102.

* [tests] Update MX4105 test to expect new warnings.
2018-09-06 16:20:23 +02:00
Rolf Bjarne Kvinge bc5400e861
[mmp] Show an error if trying to build a 32-bit app with Xcode 10. Fixes #4569. (#4684) (#4690)
Fixes https://github.com/xamarin/xamarin-macios/issues/4569.
2018-08-24 16:23:56 +02:00