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

27 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 8b2c3bdd6f [tools] Add an 'Unavailable' property to each framework and check it whenever needed.
Also emit a warning whenever we run into an unavailable framework.
2020-12-03 10:42:26 +01:00
Rolf Bjarne Kvinge 64edc26cb4
[dotnet] Improve context-ful linker errors by including the underlying exception message in the output. (#9991)
Because just this is kind of useless:

    error MT2301: The linker step 'Setup' failed during processing.

now it will say:

    error MT2301: The linker step 'Setup' failed during processing: <hopefully something useful here>
2020-10-29 09:02:39 +01:00
Rolf Bjarne Kvinge 1770af11b1
[dotnet-linker] Catch any exceptions from our custom steps and show them using our error reporting logic. (#9954)
* [dotnet-linker] Catch any exceptions from our custom steps and show them using our error reporting logic.

* Letting the linker handle the exceptions will not result in a particularly
  good experience, because the linker will crash.

* We can also show better information, since we have more knowledge about many
  of the exceptions we raise ourselves.

* [dotnet] Make ConfigurationAwareSubStep inherit from ExceptionalSubStep.

This required a minor modification to ExceptionalSubStep to allow for custom reporting.

* [dotnet] Implement ConfigurationAwareStep's exception handling like it's done in ExceptionalSubStep.
2020-10-26 20:16:03 +01:00
Rolf Bjarne Kvinge 98c2abc72d
[tools] Localize error messages from the ExceptionSubStep linker step. (#9959)
I also changed the error message slightly to hopefully make it a bit more
comprehensible when translated (since the step name won't be translated, we'll
end up with a message that mixes English with the translated string).
2020-10-26 16:28:49 +01:00
Manuel de la Pena c962651df7 [Localizations] Update Errors.cs with the new error. 2020-09-24 13:35:14 -04:00
Manuel de la Pena dcb0c93ab0 [Xcode12] Bring xcode 12 changes into main. 2020-09-23 16:05:22 -04:00
Manuel de la Pena eb9b690fe0 Merge xcode12 into d16-8. 2020-09-18 17:51:52 -04:00
Rolf Bjarne Kvinge 2071a13aa4
[mtouch] Refactor how we detect and avoid broken frameworks when building for the simulator. (#9647)
* Use the existing information we have in the Frameworks class to determine
  whether a particular framework works in the simulator or not.
* Show a warning (MX5223) when we run into such a framework, but only if
  the linker is enabled (otherwise we'll often get warnings for API the developer
  doesn't use).
2020-09-17 13:31:29 +02:00
Rolf Bjarne Kvinge f1e22e369d
[tools] Refactor the Optimizations class to have no conditionally compiled code. (#9596)
Refactor the Optimizations class to have no conditionally compiled code, which makes
it re-usable from our dotnet-linker code.

Also return any errors or warnings instead of showing/throwing them, which makes
the caller able to show them using whatever means is easiest for the caller.

One test needed an update to the list of valid optimizations, because we now have
a per-platform map of valid optimizations, instead of just a iOS/tvOS/watchOS vs
macOS split ('remove-unsupported-il-for-bitcode' is only valid for watchOS, and now
we say so, while we previously said it was a valid optimization for iOS and tvOS
as well, even though we'd warn about it and do nothing if you tried to set it).
2020-09-08 20:26:28 +02:00
Rolf Bjarne Kvinge d8665ddd63
[mtouch/mmp] Remove the Error91LinkerSuggestion and implement it using two different error codes. (#9319)
* It makes the error message localizable.
* It makes the implementation shared between mtouch and mmp.
2020-08-10 10:41:25 +02:00
Rolf Bjarne Kvinge 08bb01e3b5
[mtouch] Sort the errors in Errors.resx. (#9308)
Also add a make check to ensure the errors stay sorted.

This makes it much easier to find unused numbers for new errors.
2020-08-07 08:23:44 +02:00
Rolf Bjarne Kvinge 21ee5a7f74
[mtouch] Don't try to copy invalid symbol files. (#9262)
This solves a rebuild problem if an assembly has an invalid or unsupported symbol
file, where we'd detect that the symbol file exists, and expect it to be copied,
but then the linker would drop it, causing us to always rebuild the app (this is
not the same as when a symbol file is out of date).

This happens for NUnitLite 3.12.0's nunit.framework.dll, which ships with an old-style
pdb.

Also add a warning that is shown when we detect that there's a symbol file, but it
couldn't be loaded for some reason.
2020-08-04 08:08:44 +02:00
Rolf Bjarne Kvinge 6f0ed03515 [dotnet-linker] Make an Application instance available from the linker configuration, and add more properties to the compat Application type.
This way it's easier to reuse existing mtouch/mmp code that need an Application instance.
2020-06-30 19:01:07 +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
Jonathan Peppers 4e37ecf65c
[msbuild] missing localization comments - part 3 (#8721)
Fixes: https://github.com/xamarin/xamarin-macios/issues/8468

Added missing `<comment/>` fields for:

* BI1033
* BI1077
* MM2007
* MT0073
* MT0074
* MT0112_c
* MT0113_i
* MT4146
* MT4162

I had to split up the `MT4162` error message, introducing:

* `Errors.MT4162_BaseType` - a base type of
* `Errors.MT4162_Parameter` - a parameter in
* `Errors.MT4162_ReturnType` - a return type in
* `Errors.MT4162_PropertyType` - the property type of

This also removed an argument passed into `string.Format`.
2020-06-02 13:57:11 -05:00
Rolf Bjarne Kvinge a4910bb0fa
[mtouch/mmp] Share --package-debug-symbols. (#8574) 2020-05-13 08:40:07 +02:00
Rolf Bjarne Kvinge 6a407b7989
[linker] Make the corlib name dynamic. (#8499)
Use the correct corlib name depending on whether we're targeting .NET or Mono,
since there's no mscorlib.dll anymore in .NET.
2020-05-04 18:31:48 +02:00
Rolf Bjarne Kvinge 8feb3c29e6
[mtouch] Handle a failure to launch the native linker better by showing better error messages. (#8391)
* [mtouch] Handle a failure to launch the native linker better by showing better error messages.

dotnet will throw a Win32Exception if the command line is too long, so handle
that scenario. Also handle any other Win32Exceptions and show a better error
message.

* Make MT5217 an error to avoid multiple potentially confusing errors.
2020-04-16 14:18:43 +02:00
Rolf Bjarne Kvinge 511124f4b1
[mmp] Explicitly resolve assemblies from the GAC / system mono. (#8377)
Cecil has a fall-back mode where it looks in the GAC / system mono for
assemblies when failing to find them elsewhere. This is not the expected
behavior when using Xamarin.Mac in the Full/XM mode, because then we should
only resolve to assemblies shipped with Xamarin.Mac.

Unfortunately doing so will break apps (our own tests break), so instead
change our resolution to be explicit about where we find assemblies, and if we
find assemblies in the GAC / system mono when we're not supposed to, then show
a warning.

Also add a fall-back mechanism, where we use the old logic instead, in case
the new logic is not 100% compatible with the old one.

This showed up when I tried to port mmp to dotnet, because then Cecil stopped
looking in the GAC / system mono for assemblies (Cecil has a special case when
running on Mono to look in Mono's GAC), and tests started failing.
2020-04-14 16:32:42 +02:00
Rolf Bjarne Kvinge 794fd9983d
[mmp] Make the system mono location customizable. Fixes #7923. (#8369)
This also makes things a bit easier with regards to the .NET 5 work.

Fixes https://github.com/xamarin/xamarin-macios/issues/7923.
2020-04-14 09:09:55 +02:00
Rolf Bjarne Kvinge 3a30097d3a
[mtouch/mmp] Add better diagnostics if xcrun returns invalid data. (#8166) 2020-03-23 12:29:23 +01:00
Rolf Bjarne Kvinge 4d7186028e
[mtouch/mmp] Improve target framework code. (#8137)
* Unify target framework code between mtouch and mmp.
* Simplify the code in mmp: have three possible valid target frameworks for
  most of code, and add special code to handle setting any other valid target
  frameworks to redirect to one of those three valid target frameworks (and
  warn if given any of those valid, but not "main", target frameworks). Any
  other code can then depend on the target framework having exactly one of
  those specific values, which means we can make IsUnified* variables
  convenience properties instead.
* Unify a bit more of the argument parsing code between mtouch and mmp, since
  that made a few other things easier.
* Add TargetFramework.IsValidFramework to have one validation implementation.
* Move the implementation of TargetFramework.MonoFrameworkDirectory to mmp
  itself, it's not really related to the target framework.
* Remove Driver.IsUnified and IsClassic from mmp, they're not used anymore.
* Formally deprecate --xamarin-[full|system]-framework in mmp, they've really been deprecated for many years.
* Remove LinkerOptions.TargetFramework, it's not used anymore.
* Get rid of mmp's userTargetFramework fried, it's duplicated with the
  targetFramework field.
* Add a few tests, and tweak others a bit.

Breaking changes:

* Both mtouch and mmp require --target-framework now. The only direct
  consumers should be the MSBuild tasks, which already pass --target-framework
  all the time. This simplifies code, and removes assumptions.
2020-03-19 09:28:09 +01:00
Rolf Bjarne Kvinge 13a56ffb95
[mtouch/mmp] Rework how we find developer tools. Partial fix for #4634 and fixes #8005. (#8121)
Partial fix for https://github.com/xamarin/xamarin-macios/issues/4634.
Fixes https://github.com/xamarin/xamarin-macios/issues/8005.
2020-03-17 15:49:39 +01: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
Waleed Chaudhry f85556c1e5
[mtouch] Fix tests broken by localization (#7798) 2020-02-06 11:14:10 -05:00
Waleed Chaudhry 00985a55e2
[Localization] mtouch/mmp C# (#7710) 2020-01-31 15:02:52 -05:00