* [mtouch/mmp] Only use stdout from xcrun as the path of the file that was found. Fixes#8147.
xcrun can print stuff to stderr even if it succeeds and prints what it found
to stdout, which means we have to separate stdout and stderr when capturing
xcrun's output.
This also means that we need a few changes to our RunCommand API:
* Add support for capturing stdout and stderr separately by providing
different callbacks/StringBuilder instances.
* Use overloads instead of default arguments, because with default arguments
we end up with ambiguous matches in a lot of places with the new overloads.
Fixes https://github.com/xamarin/xamarin-macios/issues/8147.
* [tests] Fix mmptest build.
* [mtouch/mmp] Fix process log output.
Bump mono to 2020-02 head to be in sync with Android.
Co-authored-by: Imran Hameed <imhameed@microsoft.com>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@microsoft.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
* 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.
Teach the linker about more opcodes it can't compute a constant value for.
This way a debug version of mmp/mtouch doesn't print out these opcodes for
someone to check.
This code is only executed when debugging mtouch/mmp in the IDE, so no change
to released bits.
* Make everything in src/ build into a directory dependent upon BUILD_DIR.
That way the API comparison can successfully build into a different
directory.
* Use an absolute path as the temporary build directory. This works better
when the path is used in directories with different depth from the root.
Fixes https://github.com/xamarin/maccore/issues/2176.
* Extra whitespace in step name. Found by Whitney reviewing a backport;
* Two errors not using (localizable) resources strings. I likely forgot to add the file to the original PR.
It seems we only want to provision a few specific things, so modify the
selection logic to first ignore everything, then enable what we want.
This way we don't have to add new ignore flags here every time we add
something new to the provisioning script.
We also don't need to check if 7z and python3 provisioning is possible, since
we already know that (by manually checking the system-dependencies.sh script
for the current hash).
* [mtouch][mmp] Share error.cs and make it safer against FormatException
Beside the obvious code sharing [1] this makes the error reporting code
safer against `FormatException`.
Even with code review this happened a few times in the past - we get
a string that can't format correctly in some error handling code. This
means the `FormatException` must be fixed before we can see the
underlying root issue (delaying bug fixes and support).
Recent changes made for localization makes it harder to review the
original strings (and even harder for translated strings) for
correctness. This means we can end up with something like
```
String.Format ("{0} {1}", "foo");
``
and easily miss it (since they split between different files) if there
are several changes inside a PR.
Finally sprinkle some unit tests :)
[1] we should move everything to use `ProductException` but that will be
for another PR...
This optimization can be enabled when it's not possible to use the
managed linker (e.g. **Don't link**) or when the managed linker cannot
remove references to deprecated types that would cause an application
to be rejected by Apple.
References to the existing types will be renamed, e.g. `UIWebView` to
`DeprecatedWebView`, in every assemblies.
The type definition is also renamed (for validity) and all custom
attributes on the types and their members will be removed.
Code inside the members will be replaced with a
`throw new NotSupportedException ();`.
The msbuild test app `MyReleaseBuild` has been updated to test that the
optimization is working as expected (device builds are slow so reusing
this test has little impact in test time).
Basically the test ensure that `UIWebView` is used and cannot be removed
by the compiler (optimization) or the managed linker (since it's
referenced). Since the optimization is enabled then we can `grep` then
final `.app` directory to ensure there's no mention of `UIWebView` inside
any of the files that would be submitted.
The application can be run, by itself, and will turn green if OK, red if
`DeprecatedWebView` can't be found (skeleton replacement for `UIWebView`)
or orange if a `NotSupportedException` is thrown.
Finally introspection tests have been updated to skip over the deprecated
(and renamed) types. It should not be an issue right now, since this
optimization is not enabled by default, but it made testing easier.
We initially added a cmd to do the bcl test import generation that has
never been used.
We are moving the bcl test importer code to xharness and creating a
NUnit test project to run the tests that we already added. Unit tests
pass.
* [mmp] Set 'disable_omit_fp' by default to provide better native stack traces in certain cases.
This may produce better stack traces when crashes occur, which could be
helpful for tracking down issues like
https://github.com/xamarin/maccore/issues/643.
Also add an mmp option to override the default behavior.
This is unlikely to cause any problems, because Visual Studio for Mac sets
MONO_DEBUG=disable_omit_fp at launch, which means that all processes launched
by VSMac will also have this variable set already.
* Fix lldb attach disabling.
* [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.
* [mmp] Use relative path in mmp script.
Makes relocating mmp easier.
* [mmp] Resolve the right directory.
mmp might be in two locations (the second one works because the Commands
directory is a symlink to the actual bin directory):
* /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin/mmp
* /Library/Frameworks/Xamarin.Mac.framework/Commands/mmp
The mmp script didn't work properly in the latter case, because it would
calculate where to find the mmp.exe assembly based on real location the parent
directory (which would be /Library/Frameworks/Xamarin.Mac.framework), instead
of the real location of the directory where mmp is
(/Library/Frameworks/Xamarin.Mac.framework/Commands, which would resolve to
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/bin).
The fix is to just get the real path of the Commands directory, and compute
the location of the mmp.exe from there.
bmac-mobile-mono is an old name (when we needed a specific executable to
execute bmac) that has nothing to do with its current usage (AOT code for
Xamarin.Mac apps).
So rename the executable to reflect current usage.
This makes looking at the installed files a bit less confusing.
This makes the `--time` options more useful to see inside the linker's
pipeline steps.
This was used only in `mtouch` before (and missed some steps [1]).
Now it's shared between both tools.
[1] not sure why... merge issue/backport maybe ?
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)
We can end up with a format that has `{x}` inside it and no argument. If
this is logged (which depends on verbosity level) then we end up with an
uncaught exceptions and either `MT0000` or `MM0000` errors.
This happens in #7904 due to other, unrelated, issues (a variable is not
expanded) but this can happen in other circumstances, e.g. a file could
be named `{x}.cs`.
The easy fix is to use the right `Console.WriteLine` overload if there
are no arguments provided. This is always good since it avoid an non
required call to `String.Format`.
Fixes https://github.com/xamarin/xamarin-macios/issues/7904
If the pipeline is set on debug, to be able to see any issues, propagate
that to the make calls so that we can also get the information there,
else debugging issues with the pipelines + make is really hard.
Some of the bots fail to do the checkout (miss configuration). The clean
up step is always executed and assumes the pressence of a script, which
will fail since the script is not there.
The script is small, there is no need to add the rm in an extra file
that needs to be checkout.
This removes an extra warning that is set in the pipeline which is noise
when monitoring.
If the bot could no get the provisioning profiles installed, there is no
reason for certain tasks to run since they are all going to fail. This
adds A LOT of noise in the pipeline for the monitoring person to check
when there is no reason.
Move to use a template for the DDFun pipeline. Copy the current pipeline
to a template, set some parameters and recreate the pipeline importing
the template.
* [master] Bump mono to pickup needed nunitlite changes.
Commits are:
* [interp] context can be uninitialized for get_resume_state callback (#18535) mono/mono@455cf7d
* [2019-12] [debugger] Native thread not executing managed code considered as terminated (#18504) mono/mono@a979811
* [jit] Compute has_references correctly for gshared types whose constraint is a generic valuetype. Also emit write barriers correctly for these types. (#18562) mono/mono@f9e5a6d
* [2019-12] Bump msbuild to track mono-2019-10 (#18577) mono/mono@01be275
* [runtime] Disable lldb backtrace display on osx, it hangs on attaching in lldb. (#18591) mono/mono@ef8188a
* configure.ac: remove AC_SEARCH_LIBS for libintl (#18595) mono/mono@e55302c
* Bump bockbuild for Pango patch 1e2d68b
* [corlib] Split corlib xunit tests even more for iOS (#18620) mono/mono@8b72dbb
* [2019-12] [merp] MONO_DEBUG=no-gdb-stacktrace shouldn't disable MERP (#18611) mono/mono@4c93e38
* [aot] Avoid inflating gparams with byreflike types during generic sharing. (#18682) mono/mono@0011444
* Update deprecated query parameter to header (#18705) mono/mono@e65846b
* [NUnitLite] Bump nunitlite submodule. (#18733) mono/mono@36073a0
Diff: 2edccc52a7...36073a0c74
Other commits need for this to land"
* Add a MONO define so that we get the extensions written for mono.
* Update the sources on iphone to remove the TextUI which is not used.
* BONUS: Remove an annoying warning when compiling NUnitLite
* Update the templates too which are use by xharness.
```
warning CS0659: 'ResultState' overrides Object.Equals(object o) but does not override Object.GetHashCode()
```