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

710 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 916a29accd [mtouch] Copy libprofiler-log.dylib to watch extensions.
Currently we don't put anything in the container watch app, which means we
need to put libprofiler-log.dylib in the watch extension itself.
2017-02-13 17:20:14 +01:00
Rolf Bjarne Kvinge 75c038fcd3 [mtouch] Disallow code sharing if bitcode options are different. 2017-02-13 15:51:10 +01:00
Zoltan Varga 884c86befd [mmp] Apply the changes in dea2dde259 to the mscorlib.xml descriptor in mmp as well. Fixes #52186. (#1685) 2017-02-13 10:16:42 +01:00
Rolf Bjarne Kvinge 816a62a64b [mtouch] A fat container app with a non-fat appex is allowed and not a problem. 2017-02-10 16:39:32 +01:00
Rolf Bjarne Kvinge fd8c09ecb8 [mtouch] Remove the Application.FastDev property, it's never set anymore. 2017-02-10 16:39:32 +01:00
Rolf Bjarne Kvinge 2eb2b7bd42 [mtouch] Remove fixed FIXME. 2017-02-10 16:39:27 +01:00
Rolf Bjarne Kvinge fd1e65d318 [mtouch] Validate a few assumptions about the linker output. 2017-02-10 16:39:27 +01:00
Rolf Bjarne Kvinge 8c4d56e898 [mtouch] Fix loading cached linked assemblies.
The cached linker results can have multiple identical input assemblies (for
assemblies that show up in both the app and any app extensions), so make sure
we don't load those more than once.
2017-02-10 16:39:26 +01:00
Rolf Bjarne Kvinge cd0c9c1163 [mtouch] Only files the linker copies when ensuring the linker output has up-to-date timestamps. 2017-02-10 16:39:26 +01:00
Rolf Bjarne Kvinge 10126f1839 [mtouch] Invalidated cached linked assemblies if a .config file changes.
Config files can modify the AOT-compiled code, so they must be taken into
account when doing cache validation for linked assemblies.
2017-02-10 16:39:26 +01:00
Rolf Bjarne Kvinge 8f91bb163e [mtouch] Re-AOT an assembly if its .mdb or .config files changed. 2017-02-10 16:39:25 +01:00
Rolf Bjarne Kvinge 6f4f54a790 [mtouch] Extensions don't need a NOTICE file, since it's already in the container app. 2017-02-10 16:39:25 +01:00
Rolf Bjarne Kvinge fb0749450c [mtouch] Make sure SDK assemblies in appex'es are included in the container app when code sharing. 2017-02-10 16:39:24 +01:00
Rolf Bjarne Kvinge c814e71fac [mtouch] Required symbols found by the linker must be filtered to the app we're building.
Since the linker can process multiple apps/appex'es at the same time, it also
means it will put together all the required symbols found in _all_ assemblies.

This means that we need to filter out required symbols for other
apps/appex'es.
2017-02-10 16:39:24 +01:00
Rolf Bjarne Kvinge d3e246b193 [mtouch] Don't do code sharing unless the container app's deployment target is at least 8.0.
Frameworks don't work on earlier iOS versions, so we can't (easily) share
native code in this scenario.
2017-02-10 16:39:24 +01:00
Rolf Bjarne Kvinge b1199d2b5a [mtouch] Remove dead code. 2017-02-10 16:39:23 +01:00
Rolf Bjarne Kvinge d0ea10de1a [mtouch] Build SDK assemblies by default to a framework whenever it makes sense.
Change the default to build SDK assemblies to a framework
(Xamarin.Sdk.framework) whenever an app has extensions.
2017-02-10 16:39:23 +01:00
Rolf Bjarne Kvinge 8a264c4602 [mtouch] Improve logging. 2017-02-10 16:39:23 +01:00
Rolf Bjarne Kvinge b547454e98 [mtouch] Fix cache invalidation with app extensions.
Change cache invalidation so that if any app extension's cache is invalid,
then invalidate the cache for the container app and all other app extensions.

This is the safest option when we're sharing code.
2017-02-10 16:39:23 +01:00
Rolf Bjarne Kvinge 95dfdd3a00 [cache] Remove dead code. 2017-02-10 16:39:22 +01:00
Rolf Bjarne Kvinge e7ae947189 [cache] Don't use the global command line arguments to determine input.
Don't use the global command line arguments to determine input, because that's
not the input we use for app extensions anymore.

Instead explicitly pass the input arguments when creating the cache.
2017-02-10 16:39:21 +01:00
Rolf Bjarne Kvinge 02b81e3332 [cache] Fix mmp/mtouch change detection.
Since neither mtouch nor mmmp is mkbundled anymore, the installed binary is in
fact a shell script.

This means that it's quite useless to check if the shell script has been
modified; instead check if the executing assembly has been modified (which
works now that we're not mkbundled anymore).
2017-02-10 16:39:20 +01:00
Rolf Bjarne Kvinge 27289efb1a [mtouch] Fix bundling frameworks from extensions.
We must build each appex bundle before the container bundle, so that we can
compute the frameworks each appex the needs before bundling the container app.

Also there's no need to store the list of frameworks appex's need in a file,
since everything is now done in the same mtouch process.
2017-02-10 16:39:17 +01:00
Rolf Bjarne Kvinge 7e28df59c4 [mtouch] Implement support for sharing code between app extensions and container apps.
Implement support for sharing both code and resources between app extensions
and their container app:

* AOT-compiled code. Each shared assembly is only AOT-compiled once, and if
  the assembly is built to a framework or dynamic library, it will also only
  be included once in the final app (as a framework or dynamic library in the
  container app, referenced directly by the app extension). If the assemblies
  are built to static objects there won't be any size improvements in the app,
  but the build will be much faster, because the assemblies will only be AOT-
  compiled once.
* Any resources related to managed assemblies (debug files, config files,
  satellite assemblies) will be put in the container app only.

Since these improvements are significant, code sharing will be enabled by
default.

Test results
============

For an extreme test project with 7 extensions (embedded-frameworks)[1]:

             with code sharing     cycle 9     difference
build time      1m 47s               3m 33s        -1m 46s = ~50% faster
app size         26 MB               131 MB       -105 MB  = ~80% smaller

For a more normal test project (MyTabbedApplication)[2] - this is a simple application with 1 extension:

             with code sharing     cycle 9     difference
build time      0m 44s               0m 48s        -4s    = ~ 8% faster
app size         23 MB                37 MB        -15 MB = ~40% smaller

Another tvOS app with one extension also show similar gains (MyTVApp)[3]:

             with code sharing     cycle 9     difference
build time      0m 22s               0m 48s        -26s    = ~54% faster
app size         22 MB                62 MB        -40 MB  = ~65% smaller

[1]: https://github.com/rolfbjarne/embedded-frameworks
[2]: https://github.com/xamarin/xamarin-macios/tree/cycle9/msbuild/tests/MyTabbedApplication
[3]: https://github.com/xamarin/xamarin-macios/tree/cycle9/msbuild/tests/MyTVApp
2017-02-10 16:39:15 +01:00
Rolf Bjarne Kvinge 85f28fbd59 [mtouch] Warn if mtouch loads an assembly from a different location than requested.
Warn if mtouch loads an assembly from a different location than requested
(which might be because there are multiple assemblies with the same name).

Also rework the MT0023 check a bit by explicitly loading the root assembly
first, and then detecting if any loaded assemblies matches the root assembly.
This results in code that's a bit more obvious, and it also works correctly
with extensions (previously the entire MT0023 check was skipped for
extensions).
2017-02-10 16:39:15 +01:00
Rolf Bjarne Kvinge a163cb2e14 [mtouch] Make the linker accept multiple root assemblies. 2017-02-10 16:39:14 +01:00
Rolf Bjarne Kvinge e4cf717b1d [mtouch] Simplify linker code slightly by passing fewer arguments around. 2017-02-10 16:39:14 +01:00
Rolf Bjarne Kvinge 8f80ba34af [mtouch] Refactor slightly how the profiler is linked in. 2017-02-10 16:39:14 +01:00
Rolf Bjarne Kvinge ffe3cfd39e [mtouch] Include the product assembly in the '@sdk' group for assembly build targets. 2017-02-10 16:39:13 +01:00
Rolf Bjarne Kvinge 7b5c1be2b7 [mtouch] Allow the assembly build target name for frameworks to end with '.framework'.
Allow the assembly build target name for frameworks to end with '.framework',
so that the following:

    --assembly-build-target=@sdk=framework=Xamarin.Sdk.framework

doesn't end up creating Xamarin.Sdk.framework.framework.
2017-02-10 16:39:13 +01:00
Rolf Bjarne Kvinge 18f220956a [mtouch] Simplify code a little bit. 2017-02-10 14:46:30 +01:00
Rolf Bjarne Kvinge f399d464da [mtouch] Add support for creating a dot file of the build tree. 2017-02-10 14:46:30 +01:00
Rolf Bjarne Kvinge 1be313490d [mtouch] Store each assembly's location in the generated main method.
Store the location of every assembly that can't be deduced at runtime (i.e.
all assemblies that are build to frameworks, since there can be multiple
assemblies in each framework, and the framework name can be customized).
2017-02-10 14:46:30 +01:00
Rolf Bjarne Kvinge 617362b738 [mtouch] Detect when assemblies have native dependencies between them and link properly. Fixes bug #43689.
Detect when assemblies have native dependencies between them (which can happen
when there are multiple binding projects, and the native libraries in those
binding projects have dependencies between them), and add the proper link
arguments (this is only required when building to dynamic libraries or
frameworks, since otherwise everything is linked to one big binary and there
are no dependency problems).

https://bugzilla.xamarin.com/show_bug.cgi?id=43689
2017-02-10 14:46:29 +01:00
Rolf Bjarne Kvinge 96637b5e13 [mtouch] Remove dead code. 2017-02-10 14:46:29 +01:00
Rolf Bjarne Kvinge f9e3cbdf57 [mtouch] Incremental builds (--fastdev) is the same as compiling all assemblies to dynamic libraries. 2017-02-10 14:46:29 +01:00
Rolf Bjarne Kvinge 473c6092b6 [mtouch] Add support for compiling the pinvoke wrappers to a framework. 2017-02-10 14:46:29 +01:00
Rolf Bjarne Kvinge e620caefe2 [mtouch] Implement support for creating frameworks from assemblies.
Implement support for linking the output from AOT compilation to frameworks,
and then bundling those frameworks.
2017-02-10 14:46:28 +01:00
Rolf Bjarne Kvinge 894ebebce0 [mtouch] Treat aot data as a file related to the assembly, and copy it at the same time. 2017-02-10 14:46:28 +01:00
Rolf Bjarne Kvinge 422c389ce1 [mtouch] Remove dead code. 2017-02-10 14:46:28 +01:00
Rolf Bjarne Kvinge d24a4e3b62 [mtouch] Rework how tasks are built.
The previous build system kept a forward-pointing single linked list of tasks
to execute: task X had a list of subsequent tasks to execute. If task X was
up-to-date, it was not created (and the next tasks were directly added to the
list of tasks to execute).

In this world it became complicated to merge output from tasks (for instance
if the output of task X and task Y should be a consumed by a single task
producing a single output, since the corresponding task would end up in both
X's and Y's list of subsequent tasks).

Example: creating a single framework from the aot-compiled output of multiple
assemblies.

So I've reversed the logic: now we keep track of the final output, and then
each task has a list of dependencies that must be built.

This makes it trivial to create merging tasks (for the previous example, there
could for instance be a CreateFrameworkTask, where its dependencies would be
all the corresponding AotTasks).

We also always create every task, and then each task decides when its executed
whether it should do anything or not. This makes it unnecessary to 'forward-
delete' files when creating tasks (say you have three tasks, A, B, C; B
depends on A, and C depends on B; if A's output isn't up-to-date, it has to
delete its own output if it exists, otherwise B would not detect that it would
have to re-execute, because at task *creation* time, B's input hadn't
changed).

Additionally make it based on async/await, since much of the work happens in
externel processes (and we don't need to spin up additional threads just to
run external processes). This makes us have less code run on background
threads, which makes any issues with thread-safety less likely.
2017-02-10 14:46:28 +01:00
Rolf Bjarne Kvinge 0ac6b4fc15 [mtouch] Refactor 'BuildApp' into multiple methods. 2017-02-10 14:46:28 +01:00
Rolf Bjarne Kvinge ee0de7de52 [mtouch] Use BuildTask's logic to check if the task needs to be updated. 2017-02-10 14:46:27 +01:00
Rolf Bjarne Kvinge da0a7ffdd3 [mtouch] Make sure output directory exists. 2017-02-10 14:46:27 +01:00
Rolf Bjarne Kvinge dc70a0e254 [mtouch] Rename parameter to be more descriptive. 2017-02-10 14:46:27 +01:00
Rolf Bjarne Kvinge c2ad1ac499 [mtouch] Don't pass '-read_only_relocs suppress' to the native linker when compiling to asm-only bitcode either.
It fails to link.
2017-02-10 14:46:27 +01:00
Rolf Bjarne Kvinge 6e2648e125 [mtouch] Make sure CompilerFlags always have a Target. 2017-02-10 14:46:27 +01:00
Rolf Bjarne Kvinge 2f380ae509 [mtouch] Remove unused field. 2017-02-10 14:46:26 +01:00
Rolf Bjarne Kvinge 038705eb25 [mtouch] Use BuildTask's logic to check if the task needs to be updated. 2017-02-10 14:46:26 +01:00
Rolf Bjarne Kvinge 04a6f585c5 [mtouch] Make the install_name logic a bit more flexible. 2017-02-10 14:46:26 +01:00
Rolf Bjarne Kvinge a52f18ec3b [mtouch] Give BuildTasks enough information to determine if the task is up-to-date or not. 2017-02-10 14:46:26 +01:00
Rolf Bjarne Kvinge 1f7ce2e445 [mtouch] Fix the error message for 'CompileTask'.
The AOT-compilation occurs in the AOT-task now, and then we compile the result
using CompileTask.

This means that the error message in CompileTask was slightly incorrect, so
rectify it.
2017-02-10 14:46:25 +01:00
Rolf Bjarne Kvinge fea1fc6447 [mtouch] Teach about source files to CompilerFlags. 2017-02-10 14:46:25 +01:00
Rolf Bjarne Kvinge 024d5a92ca [mtouch] Add target-specific error messages.
This removes a little bit of duplicated code, and gives us slightly better error messages.
2017-02-10 14:46:25 +01:00
Rolf Bjarne Kvinge 9e7cec490f [mtouch] Move native linking to a separate task. 2017-02-10 14:42:11 +01:00
Rolf Bjarne Kvinge 3a8d62008d [mtouch] Look for linker input in the linker flags when parsing linker warnings.
Look for libraries passed to the linker in the linker flags, which is the
canonical location for linker input.
2017-02-10 14:42:11 +01:00
Rolf Bjarne Kvinge 69ff0c4486 [mtouch] Move CompileRegistrarTask creation out of the task itself. 2017-02-10 14:42:10 +01:00
Rolf Bjarne Kvinge 3a5c493e85 [mtouch] Remove PInvokesTask creation out of the task itself. 2017-02-10 14:42:10 +01:00
Rolf Bjarne Kvinge ed1a1ae3b8 [mtouch] Rename BuildTask.Build to Run.
Some tasks are technically not 'building', another verb would fit better, so
use the more generic 'Run' instead of 'Build'.
2017-02-10 14:42:10 +01:00
Rolf Bjarne Kvinge 9c6bf21a18 [mtouch] Refactor Generate|CompileMainTasks to only know how to do their task. 2017-02-10 14:42:10 +01:00
Rolf Bjarne Kvinge 0a91d75b2c [mtouch] Create a 'RunRegistrarTask'. 2017-02-10 14:42:09 +01:00
Rolf Bjarne Kvinge e73d71cbe8 [mtouch] Build into arch-specific temporary directories, instead of having arch-specific filenames.
This makes dylibs automatically have the correct dylib id, which means no
fixups are required.

For instance: we'd build libpinvokes.armv7.dylib from libpinvokes.armv7.m,
which by default ends up with a dylib id of "libpinvokes.armv7.dylib". With
this fix no change is required, since we now build armv7/libpinvokes.dylib
from armv7/libpinvokes.m.
2017-02-10 14:42:09 +01:00
Rolf Bjarne Kvinge dcd37c9df2 [mtouch] Compute the dependency map for assemblies earlier and store the results.
Compute the dependency map for assemblies earlier, and store the results.

In a later commit we'll need to know if a dependency map was successfully
computed when determining if a task is up-to-date or not.
2017-02-10 14:42:09 +01:00
Rolf Bjarne Kvinge eaf13f2fcc [mtouch] Link with the correct version of libxamarin/libmono according to other build options. 2017-02-10 14:39:49 +01:00
Rolf Bjarne Kvinge 03614fc775 [mtouch] Strip while copying assemblies.
Rework the code that copies assemblies and their related files to the app
bundle to take into account that we might be building to frameworks now.

Also strip the assemblies when they're copied (if they must be stripped),
which removes the need for custom logic to copy files related to stripped
assemblies.

Additionally change how we handle duplicated assemblies by checking for
duplication before copying them to the app bundle. This allows us to copy
assemblies to the root directory (not the .monotouch-[32|64] subdirectory) if
the 32-bit and 64-bit versions are identical, which also means we won't need
symlinks anymore.
2017-02-10 14:39:48 +01:00
Rolf Bjarne Kvinge d58dcb8141 [mtouch] Remove dead code. 2017-02-10 14:35:20 +01:00
Rolf Bjarne Kvinge f1397b561e [mtouch] No need to pass the input file around if all we want to know is the source code type.
This makes the code a little bit more self-descriptive.
2017-02-10 14:35:20 +01:00
Rolf Bjarne Kvinge 5787bc0ef2 [mtouch] Validate the assembly build targets. 2017-02-10 14:29:11 +01:00
Rolf Bjarne Kvinge a590612751 [mtouch] Add an --assembly-build-target option. 2017-02-10 14:29:11 +01:00
Rolf Bjarne Kvinge ffad69e186 [mtouch] Call linker flags 'linker_flags' and not 'compiler_flags'. 2017-02-10 14:29:11 +01:00
Rolf Bjarne Kvinge e83c2b507f [mtouch] Show output in ProcessTask if the process returns a non-zero exit code. 2017-02-10 14:29:10 +01:00
Rolf Bjarne Kvinge 815fbef3fc [mtouch] Split 'MainTask' into 'GenerateMainTask' and 'CompileMainTask'. 2017-02-10 14:29:10 +01:00
Rolf Bjarne Kvinge 876dc938c8 [mtouch] Rename 'RegistrarTask' to 'CompileRegistrarTask' to be more descriptive. 2017-02-10 14:29:10 +01:00
Rolf Bjarne Kvinge 267c28b552 [mtouch] Remove redundant 'internal' class modifier. 2017-02-10 14:29:10 +01:00
Rolf Bjarne Kvinge 6b9bb63e24 [mtouch] Rename Bitcodeify to BitcodeifyTask to match other similar classes. 2017-02-10 14:29:10 +01:00
Rolf Bjarne Kvinge ee5b915cdc [mtouch] Upgrade mtouch to .NET 4.6. 2017-02-10 14:29:10 +01:00
Rolf Bjarne Kvinge ddedfc2798 [mtouch] Make the architecture a suffix instead of infix for aotdata filenames.
Make the architecture a suffix instead of infix for aotdata filenames so that
it's easier to compute the filename from the assembly name without passing
printf-style format strings around.
2017-02-10 14:29:09 +01:00
Rolf Bjarne Kvinge 5da8fd6ad0 [mtouch] Fix WriteIfDifferent to create target directory if needed. 2017-02-10 14:29:09 +01:00
Rolf Bjarne Kvinge 1385b91202 [mtouch] Simplify the code to update the list of assemblies after linking.
Also move it to a separate method, since we'll be soon needing the logic in
multiple locations.
2017-02-10 14:29:09 +01:00
Rolf Bjarne Kvinge a07085aafa [mtouch] Create a custom AssemblyCollection class.
Create a custom AssemblyCollection class that contains a dictionary with
assembly identity (name) -> Assembly mapping.

This also means that we can detect if we end up loading multiple assemblies
with the same identity, and show an error in that case (even if that case
should never happen since we cache assemblies based on the identity, it's nice
to have code that ensures it).
2017-02-10 14:15:35 +01:00
Rolf Bjarne Kvinge a4dbb289b6 [mtouch] Make the linker output a list of AssemblyDefinition instead of paths.
Have the linker return the paths for AssemblyDefinitions is just redundant if
we immediately use those paths to re-load the AssemblyDefinitions.
2017-02-10 14:12:02 +01:00
Rolf Bjarne Kvinge 5fb09b1b84 [linker] Remove static state, and put the state inside DerivedLinkContext instead. (#1657)
Remove the usage of static variables in the linker so that one day we can run
the linker in parallel over multiple assembly sets.
2017-02-10 07:45:42 +01:00
Sebastien Pouliot eed503e422 [mtouch] Reload symbols before saving an assembly again (when needed). Fixes #51667 (#1651) (#1653)
Cecil cannot save an assembly more than once without reloading its
debugging symbols. There was code for this, in the special case where
an assembly could be saved more than once. However the order of the
operations changed and the code to reload symbols was now located too
late.

https://bugzilla.xamarin.com/show_bug.cgi?id=51667
2017-02-08 20:50:29 -05:00
Chris Hamons 2c835c5294 [XM] Add hybrid/standard AOT option and improve AOT code (#1650)
* [XM] Seperate parsing from compilation in AOT code

- Parsing command line options was too entangled with actually compiling
- Refactor test code to centralize Compile, reducing some complexity of tests
- Groundwork for hybrid vs non-hybrid AOT work

* Add hybrid/standard AOT support

* Add xammac_tests to makefile/jenkins

* Add flag to force AOT

* Disable MonoTouchFixtures.Contacts.ContactStoreTest.GetUnifiedContacts on XM due to prompts on Jenkins
2017-02-08 13:40:48 -06:00
Rolf Bjarne Kvinge 84953af5de [mtouch/mmp] Fix cecil dependencies. (#1656)
Make sure mtouch/mmp rebuild cecil when anything changes in cecil.
2017-02-08 14:57:37 +01:00
Rolf Bjarne Kvinge be12544444 [mtouch] Remove unused file from the build. (#1655) 2017-02-08 13:45:57 +01:00
Chris Hamons f6918bdc43 Update xm apidiff to cycle8 (#1624) 2017-02-06 08:40:43 -06:00
Sebastien Pouliot a94e4dc423 Revert c633bd378f and fix #51805 with a new Cecil API (#1640)
* Revert "[mtouch][linker] Remove type forwarders. Fixes #51805 (#1589) (#1600)"

This reverts commit c633bd378f.

* [mono] Bump mono to get latest cecil (cycle9) and fix linker's ExternalType.Scope. Fixes #52187 and #51805

Original fix for bug #51805 was reverted since it caused a regression [2]
when type forwarders are used thru reflection, which happens when
serializing some types.

[1] https://bugzilla.xamarin.com/show_bug.cgi?id=51805
[2] https://bugzilla.xamarin.com/show_bug.cgi?id=52187
2017-02-03 16:12:28 -05:00
Alex Soto 3b0f1baf69 [mmp/btouch] Better error when bad xml linker input is given to mmp/mtouch (#1614)
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=52238

If you give mtouch/mmp a linker xml file with bad input for
example a Xamarin.iOS app and the linker.xml has a reference
to Xamarin.Mac instead of X.I.dll i.e.

<?xml version="1.0" encoding="UTF-8" ?>
<linker>
	<assembly fullname="Xamarin.Mac">
    	<type fullname="ObjCRuntime.Constants"/>
	</assembly>
</linker>

You will get a not so helpful generic error

MT2001 Could not link assemblies. Reason: Failed to process XML description: <unspecified>

It seems that when you use a xml file for linker you get a
`XmlResolutionException` from cecil when it fails to resolve
and the better error comes from the inner exception so we use
that instead.

New error output for XmlResolutionException:

MT2017: Could not process XML description: Failed to resolve assembly: 'Xamarin.Mac, Culture=neutral, PublicKeyToken=null'
2017-02-03 14:04:06 -06:00
Rolf Bjarne Kvinge d9c23c2ba8 [mtouch] Automatically enable bitcode if LLVM is enabled. Fixes #52241. (#1620)
Currently we can't build watchOS projects if LLVM is enabled, but bitcode is
not (see bug #51634).

Additionally the IDEs do not have UI to select if bitcode is enabled or not,
so automatically enable it if LLVM is enabled (since most likely people will
be building for the App Store if LLVM is enabled).

https://bugzilla.xamarin.com/show_bug.cgi?id=51634
https://bugzilla.xamarin.com/show_bug.cgi?id=52241
2017-02-03 07:16:17 +01:00
Rolf Bjarne Kvinge 68415e88c5 [mtouch] Fix build error with fastdev & libpinvokes & paths with spaces. (#1618) 2017-02-02 18:09:42 +01:00
Timothy Risi 48682b27aa Resource files for mac should be copied to the app bundle (#1500)
Resource files for mac should be copied to the app bundle
* Move the Satellite code used by mac to tools/common/Assembly.cs
* Add EmbeddedResources test to xammac_tests
2017-01-31 15:59:08 -09:00
Sebastien Pouliot c633bd378f [mtouch][linker] Remove type forwarders. Fixes #51805 (#1589) (#1600)
a. System.Net.Http.Primitives.dll is user code *and* contains type
forwarders (it's like a facade) to another facade assembly,
System.Net.Primitives.dll, that ships with the SDK;

b. The former, System.Net.Http.Primitives.dll, is not processed by
the linker, e.g. no code is removed and the assembly cannot be deleted.
However we save back (as much as we can [1]) the result of any type
being resolved;

c. It also means the later, System.Net.Primitives.dll, is fully linked
and (in many cases) can be removed from the final application (as it's
mostly forwarders).

d. This means the final, re-saved, System.Net.Http.Primitives.dll binary
could point to non-existing metadata, i.e. the removed
System.Net.Primitives.dll, because of [1].

Because we resolve (and save) the forwarders *and* because we do not
allow code downloads or generation (Apple restriction) it is possible to
remove the forwarders, which will fix the issue for XI.

[1] The scope of exported types cannot be updated
abb4e902da/Mono.Cecil/ExportedType.cs (L41)

There is also a enhancement bug, #11165, about this but it predated our
PCL support and the resolve-n-save that we now do for forwarders. This
is now _fully_ fixed.

References:
* https://bugzilla.xamarin.com/show_bug.cgi?id=11165 (enhancement)
* https://bugzilla.xamarin.com/show_bug.cgi?id=51805
2017-01-31 16:22:34 -05:00
Rolf Bjarne Kvinge bac0253848 [mtouch] Automatically disable incremental builds if building to bitcode and any third-party bindings were found. Works around bug #51710. (#1592)
Most projects building to bitcode (any kind of bitcode, this includes the
marker-only version as well), will fail to link when linking with third-party
libraries and incremental builds are enabled.

So automatically disable incremental builds when we detect this scenario.

This is only a workaround until we can make this scenario build correctly.

https://bugzilla.xamarin.com/show_bug.cgi?id=51710
2017-01-31 14:55:54 +01:00
Rolf Bjarne Kvinge f24c8f7331 [docs] Update text about MT4134 to not mention the legacy registrar anymore. (#1558)
Since the legacy registrar is not available anymore.
2017-01-26 15:31:26 +01:00
Rolf Bjarne Kvinge 3dac0bae81 Use @rpath instead of @executable_path in dylibs. (#1552)
Use @rpath instead of @executable_path in dylibs, since it allows us to be
more flexible when placing dylibs in the app.

In particular with this change it's trivial to put libmonosgen-2.0.dylib in
the container app, and reference it from extensions.
2017-01-24 20:24:32 +01:00
Rolf Bjarne Kvinge 30082029cb [mtouch] Fix compiler warning in generated main code. (#1550) 2017-01-24 13:43:38 +01:00
Rolf Bjarne Kvinge a42419ab2d [mtouch] Remove dead code. (#1549) 2017-01-24 13:43:01 +01:00
Rolf Bjarne Kvinge 62faa06f4b [mtouch] Don't parse appex executables for architecture(s). (#1551)
Don't parse appex executables for the architecture(s) when we have the exact
same information already in the process.
2017-01-24 13:42:49 +01:00
Rolf Bjarne Kvinge 29dbb38ad4 [mtouch] It's no longer necessary to set MONO_GC_PARAMS during AOT-compilation. (#1548)
According to Vlad it's not necessary to set MONO_GC_PARAMS during AOT-
compilation, since all MONO_GC_PARAMS options can be changed at runtime:

Rolf Kvinge [16:35] @vlad.brezae is this true for all the different options MONO_GC_PARAMS take: https://github.com/xamarin/xamarin-macios/pull/1546#discussion_r97318092?
Rolf Kvinge [16:36] I remember this: https://bugzilla.xamarin.com/show_bug.cgi?id=35414#c14
Rofl Kvinge [16:36] which apparently you changed here, so that it can be changed at runtime: https://bugzilla.xamarin.com/show_bug.cgi?id=35414#c27
Rolf Kvinge [16:36] but I don't know if this is true for all the options you can pass using MONO_GC_PARAMS
Vlad Brezae [16:41] yes, it should be true for all of them, that was a bug
Rolf Kvinge [16:41] ok, that's great news 😄
2017-01-24 10:07:42 +01:00
Vlad Brezae cd9292ffdd Enable selecting the sgen major mode (#1546)
* [mmp/mtouch] Add option for concurrent sgen

* [msbuild] Add support for concurrent sgen properties

* [mmp] Test for concurrent sgen option
2017-01-24 07:28:15 +01:00
Rolf Bjarne Kvinge 1a7a4ab463 [mtouch] Add support for specifying how to optimize LLVM output. (#1532)
Performance tests
-----------------

This is for a new watchOS extension project, built for release.

* The default (currently -O2) optimizations:      41s (  baseline )  30.027.060 bytes (     baseline    )
* All optimizations disabled (`--llvm-opt=all=`): 17s (-24s = -59%)  32.978.312 bytes (+2.951.252 = +10%)
* Optimized for size (`--llvm-opt=all=-Os`):      36s ( -5s = -12%)  28.617.408 bytes (-1.409.652 =  -5%)
* Optimized for more size (`--llvm-opt=all=-Oz`): 35s ( -6s = -15%)  28.601.016 bytes (-1.426.044 =  -5%)
* Optimized slightly (`--llvm-opt=all=-O1`):      35s ( -6s = -15%)  28.666.556 bytes (-1.360.504 =  -5%)
* Optimized a lot (`--llvm-opt=all=-O3`):         41s (  0s =   0%)  30.403.996 bytes (+  376.936 =  +1%)

Conclusions
-----------

* The fastest build by far (less than twice as fast) is if optimizations are
  disabled, but this adds a 10% size penalty (~3 MB in this test case),
  compared to the baseline, and 15% size penalty (4.3 MB) compared to -Oz.
* -Oz seems to have the best overall results: at least as fast as any other
  optimized build, and the smallest app as well.

Caveats
-------

Some optimizations might not work the AOT compiled code. The resulting
binaries have not been tested.
2017-01-20 16:11:48 +01:00
Rolf Bjarne Kvinge 786ae13f80 [mtouch] Fix an unnecessary re-link when the linker copies assemblies without processing them. (#1534)
Event sequence:

* mtouch is executed with the linker disabled.
* The linker pipeline copies all input assemblies (since the linker is
  disabled the assemblies don't change) into the PreBuild directory. This will
  keep the original timestamps of the input assemblies.
* mtouch is executed again, when none of the input assemblies changed.
* The linker pipeline will re-execute, because it will see that at least one
  of the input assemblies (at least the .exe) is newer than at least one of
  the assemblies in the PreBuild directory (usually a framework assembly,
  because those have the original timestamp from their install location).

Fix:

Touch all the assemblies in the PreBuild directory after the linker pipeline
executes the first time. This way the second time mtouch is executed, it will
find that all assemblies in the PreBuild directory have timestamps later than
all the input assemblies, so it will load the cached linked assemblies,
instead of re-executing the linker pipeline.
2017-01-20 10:45:08 +01:00
Sebastien Pouliot e72b654890 [linker] Inline BinaryCompatibility.TargetsAtLeast_Desktop_V4_5[_1] (#1518)
This is a more interesting case since the inlining of 2 property getters
has a deeper impact and removes other types/methods from the final app.

Here we don't care what's inside the code we replace - only that it
always return a constant boolean after evaluation. That _constant_ is
something we can add tests to ensure we continue to behave identically.

```
--- before	2017-01-16 14:58:12.000000000 -0500
+++ after	2017-01-16 14:58:09.000000000 -0500
@@ -1580,7 +1580,6 @@
 System.String System.AppDomain::get_BaseDirectory()
 System.String System.AppDomain::get_FriendlyName()
 System.String System.AppDomain::getFriendlyName()
-System.String System.AppDomain::GetTargetFrameworkName()
 System.String System.AppDomain::ToString()
 System.UnhandledExceptionEventHandler System.AppDomain::UnhandledException
 System.UnhandledExceptionEventHandler System.AppDomain::UnhandledException
@@ -11949,54 +11948,12 @@
 System.Reflection.FieldInfo System.Runtime.Serialization.ValueTypeFixupInfo::ParentField()
 System.Runtime.Serialization.ValueTypeFixupInfo
 System.Void System.Runtime.Serialization.ValueTypeFixupInfo::.ctor(System.Int64,System.Reflection.FieldInfo,System.Int32[])
-System.Runtime.Versioning.BinaryCompatibility
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Desktop_V4_5
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Desktop_V4_5_1
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Desktop_V4_5_2
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Desktop_V4_5_3
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Desktop_V4_5_4
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Desktop_V5_0
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Phone_V7_1
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Phone_V8_0
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Silverlight_V4
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Silverlight_V5
-System.Boolean System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::TargetsAtLeast_Silverlight_V6
-System.Boolean System.Runtime.Versioning.BinaryCompatibility::get_TargetsAtLeast_Desktop_V4_5()
-System.Boolean System.Runtime.Versioning.BinaryCompatibility::get_TargetsAtLeast_Desktop_V4_5_1()
-System.Boolean System.Runtime.Versioning.BinaryCompatibility::ParseTargetFrameworkMonikerIntoEnum(System.String,System.Runtime.Versioning.TargetFrameworkId&,System.Int32&)
-System.Boolean System.Runtime.Versioning.BinaryCompatibility::TargetsAtLeast_Desktop_V4_5()
-System.Boolean System.Runtime.Versioning.BinaryCompatibility::TargetsAtLeast_Desktop_V4_5_1()
-System.Int32 System.Runtime.Versioning.BinaryCompatibility::AppWasBuiltForVersion()
-System.Int32 System.Runtime.Versioning.BinaryCompatibility::get_AppWasBuiltForVersion()
-System.Int32 System.Runtime.Versioning.BinaryCompatibility::s_AppWasBuiltForVersion
-System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap
-System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap System.Runtime.Versioning.BinaryCompatibility::s_map
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.BinaryCompatibility::AppWasBuiltForFramework()
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.BinaryCompatibility::get_AppWasBuiltForFramework()
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.BinaryCompatibility::s_AppWasBuiltForFramework
-System.Void System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::.ctor()
-System.Void System.Runtime.Versioning.BinaryCompatibility/BinaryCompatibilityMap::AddQuirksForFramework(System.Runtime.Versioning.TargetFrameworkId,System.Int32)
-System.Void System.Runtime.Versioning.BinaryCompatibility::.cctor()
-System.Void System.Runtime.Versioning.BinaryCompatibility::ParseFrameworkName(System.String,System.String&,System.Int32&,System.String&)
-System.Void System.Runtime.Versioning.BinaryCompatibility::ReadTargetFrameworkId()
-System.Runtime.Versioning.CompatibilitySwitch
-System.String System.Runtime.Versioning.CompatibilitySwitch::GetValueInternal(System.String)
 System.Runtime.Versioning.TargetFrameworkAttribute
 System.String System.Runtime.Versioning.TargetFrameworkAttribute::_frameworkDisplayName
 System.String System.Runtime.Versioning.TargetFrameworkAttribute::_frameworkName
 System.String System.Runtime.Versioning.TargetFrameworkAttribute::FrameworkDisplayName()
 System.Void System.Runtime.Versioning.TargetFrameworkAttribute::.ctor(System.String)
 System.Void System.Runtime.Versioning.TargetFrameworkAttribute::set_FrameworkDisplayName(System.String)
-System.Int32 System.Runtime.Versioning.TargetFrameworkId::value__
-System.Runtime.Versioning.TargetFrameworkId
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.TargetFrameworkId::NetCore
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.TargetFrameworkId::NetFramework
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.TargetFrameworkId::NotYetChecked
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.TargetFrameworkId::Phone
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.TargetFrameworkId::Portable
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.TargetFrameworkId::Silverlight
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.TargetFrameworkId::Unrecognized
-System.Runtime.Versioning.TargetFrameworkId System.Runtime.Versioning.TargetFrameworkId::Unspecified
 System.IntPtr System.RuntimeArgumentHandle::args
 System.RuntimeArgumentHandle
 System.Boolean System.RuntimeFieldHandle::Equals(System.Object)
```

```
Statistics

Native subtotal           35,729,800   35,728,760       -1,040       0.00 %
    Executable            29,270,272   29,270,240          -32       0.00 %
    AOT data *.aotdata     6,459,528    6,458,520       -1,008      -0.02 %

Managed *.dll/exe          4,537,344    4,532,736       -4,608      -0.10 %

TOTAL                     40,581,685   40,576,037       -5,648      -0.01 %
```
2017-01-19 08:45:19 -05:00
Rolf Bjarne Kvinge d3d542aba6 [mtouch] Move the BuildTask classes into their own files. (#1521)
This is just a pure code move, no functional code changes.
2017-01-19 12:42:27 +01:00
Rolf Bjarne Kvinge 3b310b71eb [mtouch] Speed up marking types referenced in attributes. Fixes #49087. (#1531)
Switch to a new API introduced in Cecil added new API to get all the
attributes in an assembly, without having to traverse (and load) every type
and member.

This makes mtouch significantly faster when computing the list of referenced
assemblies, which is noticable when mtouch later determines nothing else needs
to be done (because nothing changed).

A few tests show that mtouch is now approximately twice as fast:

* A customer test project goes from 2s to 1s.
* A simple test app goes from 1.3s to 0.6.

https://bugzilla.xamarin.com/show_bug.cgi?id=49087
2017-01-19 10:24:00 +01:00
Rolf Bjarne Kvinge 2d104f32d9 [mtouch] Make sure native symbols from third-party libraries are preserved in dylibs. Fixes #51548.
The native linker treats object files (.o) and static libraries (.a files,
which are archives of .o files) differently.

The native linker will always include object files into the executable:

	$ echo "void xxx () {}" > foo.m
	$ clang -c foo.m -o foo.o -arch x86_64
	$ ld foo.o -dylib -o foo.dylib -macosx_version_min 10.12 -arch x86_64
	$ nm foo.dylib
	0000000000000fe0 T _xxx

However, if the object file is inside a static library:

	$ echo "void xxx () {}" > foo.m
	$ clang -c foo.m -o foo.o -arch x86_64
	$ ar cru foo.a foo.o
	$ ld foo.a -dylib -o foo.dylib -macosx_version_min 10.12 -arch x86_64
	$ nm foo.dylib
	<no output>

This means that our testing library (libtest.a) which is a fat library of
_object files_, do not show the problems reported in bug #51548.

So:

a) I've fixed the creation of libtest.a to be a fat library of _static
   libraries_. This causes the `FastDev_LinkWithTest` test to fail exactly
   like in bug #51548.

b) I've made mtouch pass `-u <native symbol>` to the native linker, for every
   native symbol referenced in a managed assembly, when creating a dylib.
   Amazingly this seems to work fine even with symbols to Objective-C classes
   (`_OBJC_CLASS_$_<class name>`).

c) This also required adding support for collecting the Objective-C names of
   all managed types registered with Objective-C to the linker. The
   information is already available in the static registrar, but that would
   require us to make sure the static registrar is executed before compiling
   dylibs, which means those two tasks won't be able to run in parallel (also
   there's no guarantee we'll even run the static registrar).

https://bugzilla.xamarin.com/show_bug.cgi?id=51548
2017-01-18 12:33:06 +01:00
Rolf Bjarne Kvinge dae1d79aed [mtouch] Quote symbols passed to the native linker.
Also quote any arguments with a '$' character.
2017-01-18 10:48:11 +01:00
Rolf Bjarne Kvinge a09c1e8cc5 [mtouch] Store a list of members for each native symbol.
There might be more than one member for each P/Invoke symbol, so make sure to
keep track of every one of them.
2017-01-18 10:48:11 +01:00
Rolf Bjarne Kvinge b4cc60572b [mtouch/mmp] Share code between link contexts. 2017-01-18 10:48:11 +01:00
Sebastien Pouliot 00b1c09acb [linker] Add an well known candidate inliner substep along with tests (#1513)
TL&DR: This is *how* it should be done and tested, it's not complete
(single, simple case) nor the most interesting case ;-)

The trick is to make sure each case is covered by tests so a mono
_bump_ won't give us a BCL that does not conform to what the linker
expect.

What's the impact ?

1. There is the expected reduction of metadata in mscorlib. Since both
   methods don't call other API there's no indirect effect (removal).

--- before	2017-01-15 11:12:44.000000000 -0500
+++ after	2017-01-15 11:12:56.000000000 -0500
@@ -13166,9 +13166,6 @@
 System.Void System.Security.SecurityException::.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)
 System.Void System.Security.SecurityException::.ctor(System.String)
 System.Void System.Security.SecurityException::GetObjectData(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)
-System.Boolean System.Security.SecurityManager::CheckElevatedPermissions()
-System.Security.SecurityManager
-System.Void System.Security.SecurityManager::EnsureElevatedPermissions()
 System.Security.SecurityRulesAttribute
 System.Security.SecurityRuleSet System.Security.SecurityRulesAttribute::m_ruleSet
 System.Void System.Security.SecurityRulesAttribute::.ctor(System.Security.SecurityRuleSet)

2. There is no visible size change (even with #1) in mscorlib.dll due to
   padding (compiler /filealign)

   mscorlib.dll                793,600      793,600            0       0.00 %

3. there's a *very* small reduction of mscorlib.*.aotdata size

   mscorlib.armv7.aotdata      717,264      717,216          -48      -0.01 %
   mscorlib.arm64.aotdata      712,840      712,704         -136      -0.02 %

   AOT data *.aotdata        6,460,064    6,459,880         -184       0.00 %

4. there's no change in executable size - normal as the AOT compiler has
   _likely_ already doing the same optimization (before this commit)

   Executable               29,270,272   29,270,272            0       0.00 %

Full comparison: https://gist.github.com/spouliot/0464c8fa3a92b6486dfd90595d9eb718
2017-01-17 21:49:44 -05:00
Sebastien Pouliot 0a25188751 [mtouch] Remove RemoveSelector step for XI (#1512)
We're not storing selectors in fields anymore so this step does nothing
expect iterating over the code.

The step is still needed for `mmp` (for Xamarin.Mac.dll)
2017-01-16 14:00:55 -05:00
Rolf Bjarne Kvinge 4cbfc537f7 [mtouch] Add the mtouch test project to the Xamarin.iOS solution. (#1510)
Add the mtouch test project to the Xamarin.iOS solution, and also create a new
mtouch solution that only contains projects directly related to mtouch.
2017-01-16 18:46:15 +01:00
Rolf Bjarne Kvinge d6c2422fcf [mtouch] Simplify code a bit. (#1508)
Simplify code a bit to avoid constant null checking and also take advantage of
the fact that HashSet.Add returns if the value was added or not (to avoid a
Contains check).
2017-01-16 18:35:28 +01:00
Rolf Bjarne Kvinge 3a480b53bf Merge pull request #1506 from rolfbjarne/mtouch-single-invocation
[mtouch] Build extensions and the container app in the same mtouch process.
2017-01-16 18:33:42 +01:00
Sebastien Pouliot a563a66c34 [linker] Update BaseSubStep subclasses to use ExceptionalSubStep (#1507)
This allows mtouch to give better error message when something unexpected
occurs in the linker pipeline (at least for the sub-steps).

Practically it means fewer, contextless MT2001 errors. The replacements
error code are more precise, e.g.
* what was being done;
* what was being processed

and helps both diagnosing and, possibly, gives clues for workarounds
2017-01-16 11:42:41 -05:00
Rolf Bjarne Kvinge f19d2707e3 [mtouch] MT0066 is an error. (#1505) 2017-01-16 16:22:08 +01:00
Rolf Bjarne Kvinge 5aaea3ee49 [mtouch] Build extensions and the container app in the same mtouch process.
Build extensions and the container app in the same mtouch process, by storing
all the mtouch arguments when called to build extensions in a text file, and
then reloading those arguments when called to build the main app.

This is required if we want to share code between extensions and the
container.
2017-01-16 13:52:37 +01:00
Rolf Bjarne Kvinge 53fc697aad [mtouch] Refactor command-line parsing to be reusable.
Also add a few tests to verify how we treat the root assembly (or lack
thereof).
2017-01-16 13:52:37 +01:00
Rolf Bjarne Kvinge d2498370d9 [mtouch] Make the 'action' a local variable instead of a global one.
Make the 'action' a local variable instead of a global one so that argument
parsing can be done multiple times.
2017-01-16 12:45:03 +01:00
Rolf Bjarne Kvinge 052c2e9753 [mtouch] Refactor input validation a bit.
Move some input validation from the Main method to the App instance,
since it depends on the App instance.
2017-01-16 12:42:46 +01:00
Rolf Bjarne Kvinge 0a07b6ba8e Remove unnecessary bitcode from dylibs. Fixes #51352 (#1469)
This is a series of fixes to the dynamic libraries we build / create to remove
any unnecessary bloat (unused architectures, bitcode).

A brand new watchOS app with no changes goes from 35MB to 11MB with these
fixes (with incremental builds disabled, the app size is 10MB).

--------------------------------------------------------------------------------

* [runtime] Split list of architectures into simulator and device-specific lists.

* [runtime] Build separate dylibs for device and simulator.

Build separate dylibs for device and simulator, since we already install these
into different locations.

This makes both the simulator and device builds slightly faster (since the
respective dylibs are smaller, and less data to copy around).

For watchOS apps, this saves ~430kb.

* [runtime] Strip bitcode from dylibs. Fixes #51352.

We know that dylibs will never be shipped to the App Store, so we'll never
need them to have bitcode.

So just strip the bitcode from all our dylibs, since this makes apps with
fastdev significantly smaller (and thus much faster to upload to watch
devices).

For watchOS apps this is a very significant improvement: a branch new watchOS
app without any changes goes from 35MB to 17MB.

https://bugzilla.xamarin.com/show_bug.cgi?id=51352

* [mtouch] Fix dylib compilation to not embed full bitcode.

Facts
=====

a. The output from the AOT compiler is an assembly (.s) file.
b. Clang's assembler does not support -fembed-bitcode-marker (only -fembed-
   bitcode), so when we ask clang to -fembed-bitcode-marker, the assembler
   receives a -fembed-bitcode argument.
c. This means that the assembled object file does not contain the
   __LLVM/__bitcode and __LLVM/__cmdline sections (it does however contain an
   __LLVM/__asm section).
d. The native linker will create a bitcode assembly section if none of the
   object files passed to the linker contain a __LLVM/__bitcode section and
   there's an __LLVM/__asm section present.
e. The end result is that when we build to a dylib, we end up (unexpectedly,
   because we ask Clang to -fembed-bitcode-marker) including both armv7k and
   bitcode in the dylib, thus bloating the dylib size significantly.

Solution
========

We manually add the __LLVM/__bitcode and __LLVM/__cmdline sections to the .s
file Mono's AOT compiler generated. This way the .o file will have the magic
sections, and the linker will not include bitcode (only the bitcode marker) in
the final library.

An empty watchOS extension with incremental builds is now 6MB smaller (down
to 11MB from 17MB).
2017-01-16 12:32:06 +01:00
Rolf Bjarne Kvinge 6f84d37d56 [mmp] Make sure Cecil is next to mmp.exe, so we doesn't load the system one. 2017-01-12 17:38:10 +01:00
Marek Safar c210332a93 Cecil breaking change update 2017-01-12 10:26:24 -05:00
Sebastien Pouliot b1281b259f [cecil] Bump mono to get the latest Cecil's revision. Fixes #51336 (#1478)
This includes [1] which fix the parsing of broken .mdb as seen in [2]

Also fix mtouch's resolver and the static registrar to match some Cecil
API changes.

references:
[1] 045b0f9729
[2] https://bugzilla.xamarin.com/show_bug.cgi?id=51336
2017-01-12 08:47:06 -05:00
Chris Hamons ffe142d0b5 [XM] AOT support in Xamarin.Mac (#1340) 2017-01-11 14:10:39 -06:00
Rolf Bjarne Kvinge c2e2e3d824 [mtouch] Include extracted frameworks from binding assemblies when listing the frameworks an extension needs. Fixes #45800. (#1461)
Include extracted frameworks from binding assemblies when listing the
frameworks an extension needs.

Fixes #45800 - comments 8-13.

https://bugzilla.xamarin.com/show_bug.cgi?id=45800
2017-01-11 16:50:07 +01:00
Vincent Dondain ded6d2f129 [mtouch] Update MT0091 message (#1453)
Fixes bug #40835: Improve enable managed linker error message
(https://bugzilla.xamarin.com/show_bug.cgi?id=40835)
2017-01-09 16:34:58 +01:00
Rolf Bjarne Kvinge b3d2b50dca [mtouch] Auto-install locally after building in the IDE. (#1432)
Auto-install locally after building in the IDE, so that running mtouch tests
after running the mtouch project doesn't require switching to the command
line.
2017-01-03 16:34:33 -05:00
Sebastien Pouliot dea2dde259 [linker] Update mscorlib.xml to preserve generic collection interfaces. Fixes #50290 (#1384) (#1427)
The `generic_icollection_class` condition (in class.c) does not match the mscorlib.xml descriptor file.

+ IEnumerator`1
+ IReadOnlyList`1
+ IReadOnlyCollection`1

reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=50290
2017-01-03 13:03:29 -05:00
Rolf Bjarne Kvinge d7ecfc3a14 [mtouch/mmp] Make Cache a non-static class. (#1425)
So that there can be multiple caches in the same process (which we'll have
once mtouch can compile extensions and the container app in the same process).
2017-01-03 15:14:47 +01:00
Rolf Bjarne Kvinge 3d4ad53253 [mtouch] Fix infinite recursion after d1102c80. (#1420)
Fixes this test failure:

    Xamarin.Registrar.MT4161 : Unexpected error/warning with --registrar:static:
	    error MT0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
2017-01-02 11:05:01 +01:00
Rolf Bjarne Kvinge ab21da1b85 [xharness] Add support for uninstalling apps from device. (#1413)
The new error message / number is used in mlaunch.
2017-01-02 08:58:46 +01:00
Chris Hamons cdf3915704 Fix EveryFrameworkSmokeTests test with MediaPlayerLibrary (#1418) 2016-12-28 08:46:46 -06:00
Rolf Bjarne Kvinge ab2548a115 [mtouch] Automatically create the output directory if it doesn't exist. (#1414) 2016-12-24 10:57:08 -05:00
Sebastien Pouliot a562ac513a [apidiff] Update XML references to match C8SR2 (10.3.1) (#1411) 2016-12-23 13:13:24 -05:00
Rolf Bjarne Kvinge d1102c800e [mtouch] Remove most static state and put it on an instance. (#1398)
* [mtouch] Remove most static state and put it on an instance.

Remove most static state, and put it on an instance (of Application) instead.

Soon we'll build multiple apps (app extensions) in the same process, and we
need to make sure we're not inadvertedly (and incorrectly) sharing state
between apps, so remove as much static state as possible to avoid any
problems.

* [mtouch] Rename GetIsUsingClang -> IsUsingClang.
2016-12-23 18:50:35 +01:00
Rolf Bjarne Kvinge 3ec3f39089 [mtouch] Always require a SDK version when building. (#1407)
* [mtouch] Always require a SDK version when building.

Technically it was required before too, but the error messages were non-optimal:
it could for instance complain that the user is using an iOS framework that
was introduced in iOS 2.0.

* [mtouch tests] Rewrite MT0060 and MT0061 tests to use MTouchTool.

This makes sure we pass --sdk to mtouch (which MTouchTool does by default), so
that we don't run into MT0025 before the errors we're testing for.
2016-12-23 17:09:39 +01:00
Rolf Bjarne Kvinge ee5b450174 [mtouch] Remove deprecated comment. (#1402) 2016-12-23 07:35:36 +01:00
Rolf Bjarne Kvinge 3f9599d3f4 [mtouch/mmp] Add better help for the --marshal-[managed|objectivec]-exceptions arguments. (#1403) 2016-12-22 20:11:50 +01:00
Rolf Bjarne Kvinge db4c28df61 [mtouch] Remove Classic-only file. (#1400) 2016-12-22 18:53:22 +01:00
Rolf Bjarne Kvinge 7dad48a59c [mtouch] Remove dead code. (#1397)
The (ugly) manual exit logic was only needed when interacting with the
simulator, which mtouch doesn't do anymore.
2016-12-22 17:39:10 +01:00
Rolf Bjarne Kvinge ffe3184345 [generator] Use --target-framework to specify which XM profile to target. (#1339) 2016-12-20 11:33:56 +01:00
Chris Hamons 378827c6ee Remove unnecessary allocations of Version in Static Registrar (#1371) 2016-12-16 15:59:12 -06:00
Chris Hamons 10bb6b1f1b [XM] Fix isysroot with new fixed SDKVersion 2016-12-13 15:12:50 -06:00
Chris Hamons 5a6c205739 Fix d02c112176 to work when no sdk passed in 2016-12-13 13:47:24 -06:00
Chris Hamons d02c112176 [XM] Fix static registrar to handle frameworks added in point releases
- Move hack from StaticRegistrar to mmp driver so we set SDKVersion correctly for point releases
- Clean up a bit of duplicate while we are there
2016-12-13 12:20:47 -06:00
Chris Hamons 5cb1b1eee8 [XM] Fix static registrar with Xcode 8.2
- Another brick in the wall of GetSDKVersion hacks
2016-12-13 08:44:54 -06:00
Sebastien Pouliot b5632f9c2f merge xcode8.2 into master 2016-12-12 21:26:23 -05:00
Rolf Bjarne Kvinge 318a7dfbe1 TargetFramework: add support for profile. (#1337)
Add support for specifying the profile with the target framework,
and support using "Version=" before the version:

    Xamarin.Mac,Version=v2.0,Profile=Mobile.
2016-12-12 17:01:10 +01:00
Rolf Bjarne Kvinge 6f42a71d4b [mtouch] Don't quote paths until they're passed to external commands. Fixes #49255. (#1334)
https://bugzilla.xamarin.com/show_bug.cgi?id=49255
2016-12-12 14:03:45 +01:00
Vincent Dondain 887a410fe2 [msbuild] Add error codes for PropertyListEditorTaskBase (#1325)
* [msbuild] Add error codes for PropertyListEditorTaskBase

* [msbuild] Add task names in all errors' descriptions
2016-12-12 10:30:42 +01:00
Rolf Bjarne Kvinge 0b6e73581f TargetFramework: be case-insensitive for the identifier when computing the hash code. (#1323)
Be case-insensitive for the identifier when computing the hash code,
since we compare the identifier case-insensitively in Equals.
2016-12-09 09:16:26 -05:00
Rolf Bjarne Kvinge 7842a0b506 [mtouch] Remove deprecated Classic commmand-line arguments. (#1319)
* [mtouch] Remove deprecated Classic commmand-line arguments.

* [mtouch docs] Document MT0022's death.
2016-12-08 18:59:04 +01:00
Vincent Dondain 901b94d6e1 Merge pull request #1237 from VincentDondain/msbuild-mt-errors
[msbuild] Add msbuild error code logic
2016-12-08 12:50:58 -05:00
Rolf Bjarne Kvinge d99212a712 Pass StringComparison to string.StartsWith / EndsWith. (#1316) 2016-12-08 16:54:10 +01:00
Rolf Bjarne Kvinge 30bac18e10 [mtouch] Fix BundleId. (#1315)
The BundleId property is used by the code that generates the mSYM directory,
but its value was always the default value 'com.yourcompany.sample' instead of
looked up in the app's Info.plist.

So fix the BundleId property to do the expected.

Also fix the mSYM test (SymbolicationData) to actually test mSYM stuff (it was
partially disabled when we disabled automatic mSYM generation for C8, and
never re-enabled), and port it to the new and better test syntax, and add a
few more asserts to check the manifest.xml generation.
2016-12-08 16:05:47 +01:00
Rolf Bjarne Kvinge 8de0d43799 [mtouch] -lsqlite3 is a linker flag, not a file to be linked with, so treat it accordingly. Fixes #49220. (#1313)
-lsqlite3 is a linker flag, not a file to be linked with, so when
automatically determining that we need to pass -lsqlite3 we need to put it in
the right list of linker information.

Otherwise we may end up passing `-force_load -lsqlite3` to the linker (if the
assembly's ForceLoad flag is set), which won't compile.

https://bugzilla.xamarin.com/show_bug.cgi?id=49220
2016-12-08 15:42:30 +01:00
Chris Hamons 1c7429e864 [XM] Add disable switch to partial static registrar in mmp (#1303)
- Rework with state now RegistrarMode.PartialStatic
- Don't default RegistrarMode.PartialStatic if system mono (fixes mmp regression test on wrench)
2016-12-05 14:16:03 -06:00
Rolf Bjarne Kvinge 8dc6b88bbf [mtouch] Only check for iOS min deployment target when building for iOS. (#1302) 2016-12-05 18:34:41 +01:00
Rolf Bjarne Kvinge 33b677b763 [mtouch] Exec the binary in the script. (#1295)
This way the mtouch process is killed if the parent process kills the process
it spawned.
2016-12-02 17:41:38 +01:00
Chris Hamons c67bd9096c [XM] Add partial static registrar support (#1191) 2016-12-01 10:18:30 -06:00
Chris Hamons cc99d21ff6 [XM] Change mmp defaults to static registrar and disable lldb attach … (#1256)
* [XM] Change mmp defaults to static registrar and disable lldb attach in release mode

- Static registrar is now proven and can be flipped on for default on release
- LLDB attach isn't very helpful in release mode and pops up the install xcode dialog
- Relax Unified_HelloWorld_ShouldHaveNoWarnings to exclude static registrar warnings due to https://bugzilla.xamarin.com/show_bug.cgi?id=48311
2016-11-29 12:44:05 -06:00
Chris Hamons 24e041068f Merge pull request #1232 from xamarin/xm_mmp_native_lib_crash
[XM] Fix crash in mmp when native reference path matches dllimport found
2016-11-28 08:54:30 -06:00
Vincent Dondain 8ea1509dec [msbuild] Add msbuild error code logic
- `LoggingExtensions` has a new `MTError` extension method that helps generate
  an msbuild error with the proper MTxxx format.
- Added error codes for 44 msbuild errors.
- Updated `docs/website/mtouch-errors.md` and `tools/mtouch/error.cs` accordingly.
- MT7001 contains some extra documentation (troubleshooting steps).
2016-11-24 15:24:30 +01:00
Chris Hamons ce464cacc3 [XM] Fix crash in mmp when native reference path matches dllimport found
- When native_libs.Add (nr, null) was hit above and then we later matched
 we would call methods.AddRange (kvp.Value) on an empty methods
2016-11-23 14:00:01 -06:00
Zoltan Varga 4c8898f3ee [mtouch] Convert .file directives containing backslashes correctly. Fixes #44733. (#1211) 2016-11-18 07:02:41 +01:00
Chris Hamons 441ae8c4ec Merge pull request #1178 from xamarin/xm_fix_touchbar_mess
Re-add touchbar APIs to master, this time with the correct StaticRegistar fix...
2016-11-14 10:59:51 -06:00
Rolf Bjarne Kvinge 9979cb1b82 [mtouch] Don't copy mdb files if they haven't changed. (#1182)
This fixes an mtouch test:

```
1) Failed : Xamarin.MTouch.RebuildTest("debug","-sdkroot {2} -v -v -v -v --dev {0} -sdk {3} --targetver 6.0 {1} -r:{4} --cache={5}/cache --debug")
  debug-rebuilt
/var/folders/9t/bhhqghxd4131b5k43v0yk7yc0000gn/T/tmp3fef2cc4.tmp/testApp.app/.monotouch-32/System.dll.mdb is modified, timestamp: 11/12/2016 1:17:59 AM
/var/folders/9t/bhhqghxd4131b5k43v0yk7yc0000gn/T/tmp3fef2cc4.tmp/testApp.app/.monotouch-32/Xamarin.iOS.dll.mdb is modified, timestamp: 11/12/2016 1:17:59 AM
/var/folders/9t/bhhqghxd4131b5k43v0yk7yc0000gn/T/tmp3fef2cc4.tmp/testApp.app/.monotouch-32/mscorlib.dll.mdb is modified, timestamp: 11/12/2016 1:17:59 AM
```
2016-11-14 14:50:08 +01:00
Rolf Bjarne Kvinge 1f8149ad44 [mtouch] Fix typo in PreBuild directory name. 2016-11-14 13:34:56 +01:00
Chris Hamons cc9a99f996 [XM] 10.12.1 APIs are in Xcode 8.1 not 8.2 2016-11-11 14:02:55 -06:00
Chris Hamons 6422000c27 [XM] Fix static registrar under Xcode 8.2 with another hack (#1164)
- Generalized the hack a bit. If we continue to need them
we can make it more data driven
2016-11-11 13:19:26 -06:00
Rolf Bjarne Kvinge 7c6d04f1c5 [mtouch] Simplify code a bit by reusing existing logic. (#1148) 2016-11-09 12:49:19 -05:00
Rolf Bjarne Kvinge e563d96083 [mtouch] Fix parsing --mono argument. (#1145) 2016-11-09 16:16:00 +01:00
Sebastien Pouliot eec681a711 [mtouch] Bring back PreBuildDirectory (#1142)
* [mtouch] Bring back PreBuildDirectory

Some mtouch unit tests failed because of timestamp checks. It's not clear
it's always a win (it's not in my original test case) not to copy (to
target) as it means we have to copy earlier (PreBuild + Build).

More investigation needed, there's probably a better way to achieve both.
In the mean time this should fix the failing tests cases.

* Fix up / simplify logic and avoid duplicate calls to IsUpdate
2016-11-09 12:05:59 +01:00
Sebastien Pouliot c92934eb6d [mtouch][mmp] Only allow `appletls` for the TLS provider (#1132)
The old `legacy` option will now be reported as a warning. 

That's by design an warning would require manually editing the .csproj
file (when the UI gets removed, as planned, from the IDE). 

This is part of
https://trello.com/c/SrgU38DN/647-only-ship-support-appletls

Note: The BCL changes will happen in later stages.
2016-11-08 14:42:40 -05:00
Rolf Bjarne Kvinge d42a9f4909 [mtouch] Make MT2015 (invalid HttpMessageHandler) a warning for known http message handlers on watchOS. Fixes #46552. (#1134)
Earlier versions of Xamarin Studio stored an invalid http message handler in
watchOS project files, which would cause a build error. In addition Xamarin
Studio removed the UI to set the http message handler (since only one value is
valid), which meant that the user had to edit the project file by hand to get
around this build error.

So make it a warning instead (and document what the user has to do to fix the
warning).

https://bugzilla.xamarin.com/show_bug.cgi?id=46552
2016-11-08 11:13:53 -05:00
Rolf Bjarne Kvinge a2a67377df [mtouch] Update the timestamp for the simlauncher when copying it into the app. (#1094)
This makes sure that the final executable has a timestamp after the .exe,
which makes the MSBuild tasks able to avoid unnecessary rebuilds.
2016-11-03 14:35:46 +01:00
Rolf Bjarne Kvinge 7728c4cd19 [registrar] Use metadata tokens instead of strings to find types and methods. (#1085)
Use metadata tokens instead of strings to find types and methods.

This makes the code to find methods more compact (a lot less strings in the
executable, and additionally in most cases a compact representation (32-bit
integer) of the corresponding metadata token and additional information can be
used, which results in less executable code (fewer parameters to methods,
etc)), resulting in smaller executables.

Size savings are around 200kb for dont link apps, and 20-60kb for linked apps
(this obviously varies a lot depending on how much has to registered by the
registrar).

|                |    Before     |     After     |       Diff        |
|----------------|--------------:|--------------:|------------------:|
| dontlink/32bit |  102.810.144  |  102.609.456  | -200.688 = -0,20% |
| dontlink/64bit |  107.420.576  |  107.221.792  | -198.784 = -0,19% |
| linksdk/32bit  |   40.957.296  |   40.936.864  |  -20.432 = -0,05% |
| linksdk/64bit  |   43.113.136  |   43.093.936  |  -19.200 = -0,04% |
| linkall/32bit  |   38.410.032  |   38.348.288  |  -61.744 = -0,16% |
| linkall/64bit  |   40.315.200  |   40.267.344  |  -47.856 = -0,12% |

Additionally I've removed the `lazy_map` dictionary, which we populated at
startup and was used to map between Class instances and the corresponding
managed type's FullName, and instead iterate over a native array of Class ->
metadata token mappings whenever we need to look up the managed type for a
certain Class instance.

This is slightly slower for each type we need to look up (for a non-linked app
there might be a 2000-3000 entries in the native array, which would be
iterated instead of using a hashtable lookup), but it's only done once per
type and there's a significant startup memory improvement.

For a non-linked test app I get the following using the Xamarin profiler:

|                   |  Before |  After  |       Diff      |
|-------------------|--------:|--------:|----------------:|
| Memory allocated  |  2,8 MB |  2,4 MB | -0,4 MB = -14 % |
| Objects allocated |   43678 |   38463 |   -5215 = -12 % |
| Private bytes     | 26,6 MB | 24,4 MB | -2,2 MB = -8,3% |
| Working set       | 26,6 MB | 24,4 MB | -2,2 MB = -8,3% |
2016-11-01 14:34:56 -04:00
Sebastien Pouliot 7b38187479 [mtouch][mmp] Unify user resources removal as a link step (#1026)
Right now the logic exists in a few places, both in and outside the
linker. We recently began to use part of the linker pipeline in normal /
all builds so it's easier to share (and unify) the code now.

The real gain is to avoid copying assemblies, in particular large ones,
more than strictly needed while building.

E.g. a build including a very large 1.3GB assembly, with several
native libraries embedded, save a lot of time avoiding the rewrites

mtouch (before)
		Total time: 64202 ms

mtouch (after)
		Total time: 34840 ms

* Add XM support for RemoveUserResourcesSubStep

* Tests supplied by @chamons
2016-11-01 13:11:25 -04:00
Rolf Bjarne Kvinge ac98469ddd [mtouch] Run the partial static registrar separately for 32-bit and 64-bit. (#1078)
Run the partial static registrar separately for 32-bit and 64-bit, since this
is required with the upcoming changes to embed metadata tokens inside the
generated output, because the metadata tokens are different between the 32-bit
and 64-bit versions of Xamarin.iOS.dll.

Also make sure to properly resolve the 32-bit and 64-bit assemblies correctly
(by setting the ArchDirectory on the assembly resolver), so that we don't pick
up the reference assembly (which does not have the right metadata tokens).

Additionally stop running the partial static registrar for MonoTouch.Dialog-1,
since with the upcoming changes to use metadata tokens in the generated
output, we won't support registering anything more than once. This shouldn't
make much of an impact, because MonoTouch.Dialog-1 is fairly small, and
doesn't take long to register in the dynamic registrar. For device builds (or
when the static registrar is selected) this has no effect, since in that case
we're registering everythinga anyway.
2016-11-01 16:41:41 +01:00
Rolf Bjarne Kvinge 3e19d604a1 [mtouch] Link the executable with LinkWith attributes' libraries in the simulator when doing incremental builds. (#1080)
Link the executable with LinkWith attributes' libraries in the simulator when
doing incremental builds, since we don't create dylibs there.

Fixes several mtouch test failures:

1) Test Failure : Xamarin.MTouch.FastDev_NoFastSim_LinkAll(Unified)
2) Test Failure : Xamarin.MTouch.FastDev_NoFastSim_LinkAll(TVOS)
3) Test Failure : Xamarin.MTouch.FastDev_NoFastSim_LinkSDK(Unified)
4) Test Failure : Xamarin.MTouch.FastDev_NoFastSim_LinkSDK(TVOS)
5) Test Failure : Xamarin.MTouch.FastDev_NoFastSim_NoLink(Unified)
6) Test Failure : Xamarin.MTouch.FastDev_NoFastSim_NoLink(TVOS)
7) Test Failure : Xamarin.MTouch.FastDev_Sim(Unified)
8) Test Failure : Xamarin.MTouch.FastDev_Sim(TVOS)
2016-11-01 16:31:10 +01:00
Rolf Bjarne Kvinge 23b693c5ff [mtouch] Update mdb files even if the corresponding assembly didn't change. Fixes #39535. (#1072)
Update mdb files even if the corresponding assembly didn't change, because the
mdb can change even if the assembly didn't (if whitespace was modified in the
source code, causing code lines to move).

https://bugzilla.xamarin.com/show_bug.cgi?id=39535
2016-11-01 15:37:37 +01:00
Sebastien Pouliot 11390f119c [mtouch] Don't set Force when the cache is invalid (as it will be deleted) (#1016)
If the cache is invalid we print a warning:

> A full rebuild will be performed because the cache is either incomplete or entirely missing.

and set `Driver.Force = true;` (in Application.cs).

This later means that extracting the native code is done on each target:

```
		public static bool IsUptodate (string source, string target)
		{
			if (Driver.Force)
				return false;
```

even if this is identical between 32 and 64 bits (targets). That's
inefficient and, for large binding libraries (e.g. > 1GB), has a
noticable impact on build time (see timestamps).

Considering that the cache is cleaned (when detected as invalid) then
this Force condition is not really needed.

E.g. in `IsUptodate`
* the first time (arch) it's called will have to extract the native library;
* if a 2nd arch is built (fat) then it will be found as present and will
  not be extracted again

Removing the `Driver.Force = true;` in this condition let the `-f` option
continue to extract it twice, which can be useful in debugging and testing.
As such the check is not removed from `IsUptodate`

Timestamps (before)

		Setup: 25 ms
		Resolve References: 1605 ms
		Extracted native link info: 10465 ms
		...

Timestamps (after)
		Setup: 24 ms
		Resolve References: 1560 ms
		Extracted native link info: 5473 ms
		...

Total build times (from XS) was around 90-100 seconds so 5 seconds is
about 10%. The actual savings will depend on how much native code needs
to be extracted, but it should help most release builds (almost always
fat builds).
2016-11-01 09:10:09 -04:00
Sebastien Pouliot 4bb5c6d255 [mtouch] Remove incorrect comment and extraneous call to LoadSymbols (#1013)
* Comment is wrong: the code is never executed in parallel

* If reached then RemoveResources will be called and already check for
  symbols (and load them when needed). Just a simplification (it won't
  really save time as it's not loaded twice)
2016-11-01 09:09:27 -04:00
Sebastien Pouliot 4a2648e38f [mtouch] Remove the code to reset the resolver as it does nothing (#1012)
IIRC this used to be needed with a (rather old) version of Cecil.
The current code does nothing as the Load will only hit the cache
and not other properties are changed (compared to the old commented
code)
2016-10-31 22:31:22 -04:00
Sebastien Pouliot f015a954ec [mtouch] Add missing HasParameters check inside linker and static registrar (#1010)
* [mtouch] Add missing HasParameters check inside linker and static registrar

Without the checks new, empty collections can be allocated and their
whole and only purpose will be to iterate up to 0 (nop).

The checks saves a small amount of memory (collections) and time.

* [registrar] Fix method comparison when they have no parameters
2016-10-31 22:31:07 -04:00
Sebastien Pouliot eb34a6a74f [mtouch] Reduce the number of file lookups inside AssemblyResolver (#1009)
The SDK does not ship any, non-tool, .exe files. In fact .exe _should_
never need to be resolved since the main .exe is always given as an input
to mtouch.

Still it's possible (if quite uncommon) to refer to other .exe assemblies
just like if they were .dll. However those can only come from the
RootDirectory (and not the other places that ship with the SDK).

This "fix" ensure lookups for *.exe is done only inside the RootDirectory
location, speeding up (a bit) resolving assemblies.
2016-10-31 22:30:32 -04:00
Rolf Bjarne Kvinge c521bfde62 [mtouch] Don't link native libraries into the main executable if we're doing an incremental build. Fixes #42473. (#1073)
Native libraries are already linked into the dylib for the binding assembly,
which means that if we also link it into the main executable, the native code
ends up twice in the app (which is bad for many reasons).

https://bugzilla.xamarin.com/show_bug.cgi?id=42473
2016-10-31 16:55:45 -04:00
Rolf Bjarne Kvinge 1c81c8a5a8 [mtouch] Improve logging a bit. (#1071)
* Show log statements from assembly comparison.
2016-10-31 16:53:02 -04:00
Rolf Bjarne Kvinge e8789f2af6 [mtouch] Copy frameworks referenced by watch extensions to the bundle. (#1070)
Watch extensions do not have access to the containing app bundle on the phone,
so instead copy frameworks to the extension itself.
2016-10-31 17:02:37 +01:00
Rolf Bjarne Kvinge 0b3ab9cc15 [mtouch] Copy third-party frameworks from extensions to the main app's Frameworks directory. Fixes #45800. (#1069)
The container app may not reference the same third-party frameworks as
extensions, which means that we must make sure the extension's frameworks are
also included in the app bundle.

So when building extensions save a list of all third-party frameworks, and
then read that list and include those frameworks when building the main app.

https://bugzilla.xamarin.com/show_bug.cgi?id=45800
2016-10-31 12:36:06 +01:00
Rolf Bjarne Kvinge 0c43ddc615 Disable managed exception marshaling when the debugger is attached. Fixes #45116. (#1055)
Managed exception marshaling interferes with the debugger, because it adds
exception handlers to executing code, which makes the Mono runtime think an
exception is handled when logically it's not (although technically it is).

The consequence is that the IDEs will only be notified when we re-throw the
exception after catching it, making it impossible for the IDEs to stop when
the exception is thrown (they will instead stop when we re-throw the
exception).

So disable managed exception marshaling (unless the user changed the default
behavior) when a debugger is attached.

This is the same behavior as Xamarin.Android.

https://bugzilla.xamarin.com/show_bug.cgi?id=45116
2016-10-28 19:07:01 +02:00
Rolf Bjarne Kvinge 4371ea4540 [static registrar] Fix registration of generic types. Fixes #44926. (#1063)
https://bugzilla.xamarin.com/show_bug.cgi?id=44926
2016-10-28 18:42:45 +02:00
Rolf Bjarne Kvinge dde242c32a Allow using LinkWith attribute without a native library. (#997)
This makes it possible to set linker flags per assembly:

    [assembly: LinkWith (LinkerFlags = "-lsqlite3")]

Which is required when incremental builds is enabled and a particular assembly
needs special linker flags (because we don't propagate the global -gcc_flags
to each dylib we build when doing incremental builds).

Also add an option to set the dlsym mode for an assembly (using the LinkWith
attribute).
2016-10-28 10:50:42 -04:00
Rolf Bjarne Kvinge 6104a514fc [registrar] Cache the System.Void type. (#1024)
Duration before: 1,60s
Duration after:  1,54s
Difference:     -0,06s = -3,8%

Memory usage hardly changed (-21 kb of 540 MB), but the number of method calls
shrunk significantly.

Method calls before: 86.720.379
Method calls after:  74.390.061
Difference:         -12.330.318 = -14,2%

The call to `GetSystemVoidType` was #2 on the list of method calls (whens
sorted by 'self'), called 1072 times taking 1429 ms each time. After this
change it's only called once (and obviously pushed way down the list).
2016-10-28 09:52:58 -04:00
Rolf Bjarne Kvinge ea1a08785d [mtouch] Verify the correct SDK version when referencing frameworks from watchOS projects. (#1058) 2016-10-28 09:16:35 -04:00
Rolf Bjarne Kvinge a1644f6e13 [registrar] Improve an error message. (#1047) 2016-10-28 08:38:38 -04:00
Rolf Bjarne Kvinge 23a0186a99 [registrar] Fix compiler warning. (#1054) 2016-10-28 08:33:18 -04:00
Chris Hamons b5edf16711 [XM] Teach XM resolver to load all of assemblies into memory (#1034)
- Profiling suggesting that loading all of sub-100 MB assemblies into
 memory is a performance win, and mtouch already does it.
2016-10-28 08:28:43 -04:00
Rolf Bjarne Kvinge c6d7a3adec [linker] Use ordinal instead of invariant comparison. (#1025)
Profiled when running the partial static registrar on Xamarin.iOS.dll

Duration before: 1,60s
Duration after:  1,41s
Difference:     -0,19s = -11,9%

Memory usage before: 541.887.736 bytes
Memory usage after:  509.111.944 bytes
Difference:          -32.775.792 bytes = -6,0%

Method calls before: 86.720.379
Method calls after:  63.073.602
Difference:         -23.646.777 = -27,3%
2016-10-28 08:28:02 -04:00
Sebastien Pouliot 81c94cd683 Update XML definition for XM C8SR1 (from cycle8 branch) 2016-10-27 18:37:25 -04:00
Sebastien Pouliot 405bf0e979 [mtouch] Fix MT1009 to report the inner exception (#1008)
Found out it was missing by breaking (locally) something else :)
2016-10-27 17:45:33 -04:00
Rolf Bjarne Kvinge 89eb5dd430 [registrar] Mark our generated code as 'extern C'. (#1049)
This makes the function names smaller, saving a tiny bit of space (about 700
bytes for the dont link test app).

It also looks nicer in crash reports.
2016-10-27 16:12:16 -04:00
Rolf Bjarne Kvinge 71a578ee38 [runtime] Remove deprecated and ignored mono option. (#1019)
Setting this option prints this to stdout:

> Mono Warning: option gen-compact-seq-points is deprecated.

and it's ignored, so just don't set this option.
2016-10-27 16:04:19 -04:00
Sebastien Pouliot bbcc872f7a Update XML references from XI C8SR1 2016-10-27 11:55:32 -04:00
Sebastien Pouliot 8c93e7758d Merge branch 'xcode8.1' 2016-10-26 15:56:34 -04:00
Rolf Bjarne Kvinge e9f125fbcb [mmp] Don't process SDK assemblies for external symbols unless we're embedding mono. Fixes #45902. (#1036)
SDK assemblies might contain P/Invokes to libmono, but unless we link with
mono (which we don't do if we're not embedding mono), the native linker will
complain if we ask it to keep those symbols (using `-u symbol`).

So don't look for __Internal P/Invokes in SDK assemblies in that case.

https://bugzilla.xamarin.com/show_bug.cgi?id=45902
2016-10-26 12:57:11 +02:00
Chris Hamons 448b78c47d [XM] Add StringComparison.Ordinal tweak just like c533db66bf (#1006) 2016-10-20 08:34:26 -05:00
Rolf Bjarne Kvinge 0dd27141d6 [mtouch/mmp] Fix check if an assembly is a framework assembly. Fixes #36109. (#1000)
Fix check if an assembly is a framework assembly to take into account symlinks.

https://bugzilla.xamarin.com/show_bug.cgi?id=36109
2016-10-14 14:14:27 -04:00
Rolf Bjarne Kvinge cf0be91860 [mtouch] CoreAudioKit didn't exist in the simulator until iOS 9. Fixes #44996. (#998)
https://bugzilla.xamarin.com/show_bug.cgi?id=44996
2016-10-14 18:56:08 +02:00
Rolf Bjarne Kvinge 2c950a84ea [mtouch] Treat P/Invokes to 'sqlite3' as equal to 'libsqlite3'. Fixes #42372. (#996)
https://bugzilla.xamarin.com/show_bug.cgi?id=42372
2016-10-14 12:34:51 +02:00
Rolf Bjarne Kvinge c533db66bf [mtouch] Always use ordinal string comparisons. (#995) 2016-10-14 12:34:35 +02:00
Rolf Bjarne Kvinge 2a9f5a8238 Merge pull request #988 from rolfbjarne/bug44709d
Unify stret detection between the generator and platform assemblies, and fix stret detection on watchOS. Fixes #44709.
2016-10-13 19:44:02 +02:00
Chris Hamons 17bb354dca [XM] Fix 44707 by fixing launcher and mmp (#971)
- https://bugzilla.xamarin.com/show_bug.cgi?id=44707
- Sets MONO_CFG_DIR to work around embedding API bug: https://bugzilla.xamarin.com/show_bug.cgi?id=45279
- Added ability to run single XM test by setting XM_TEST_NAME to full test name.
2016-10-13 10:42:05 -05:00
Rolf Bjarne Kvinge 9d85ca79ab Unify stret detection between the generator and platform assemblies, and fix stret detection on watchOS. Fixes #44709.
Unify the code to determine whether a particular return type requires a stret
signature or not between the generator and platform assemblies.

Also fix the stret detection for armv7k, whose calling convention is not
identical to armv7(s): there's the concept of homogeneous structures, which
contains multiple elements of only one type, and which is sometimes passed in
registers on armv7k.

https://bugzilla.xamarin.com/show_bug.cgi?id=44709
2016-10-13 17:35:51 +02:00
Rolf Bjarne Kvinge 084e691be2 [src] Make sure to always set all variants of our conditional compilation symbols. (#986)
For Unified, set XAMCORE_2_0, UNIFIED and __UNIFIED__.

For Xamarin.iOS/tvOS/watchOS set both the normal and underscored versions
(IOS and __IOS__, TVOS and __TVOS__, and WATCHOS and __WATCHOS__).

The underscored versions are the public symbols we're setting in the
corresponding projects, so we should use those everywhere to simplify our
code, but due to historical reasons we're still using the other variants in
existing code.

Making sure all the possible variants are set for all projects, makes it
possible to only use the underscored versions in new code.

Also define `GENERATOR` for the generator, so that we can easily share
files between the generator and platform assemblies.
2016-10-13 15:10:24 +02:00
Rolf Bjarne Kvinge 2f60dd2220 [mtouch] Fix NullReferenceException in PInvoke wrapper generation. Fixes #44763. (#956)
Fix NullReferenceException in PInvoke wrapper generation when incremental
builds are enabled and the linker didn't run because cached results were
found.

https://bugzilla.xamarin.com/show_bug.cgi?id=44763
2016-10-06 16:13:01 +02:00
Rolf Bjarne Kvinge b2634bce56 [mtouch] Set install_name for libpinvokes.dylib. Fixes #44775. (#955)
https://bugzilla.xamarin.com/show_bug.cgi?id=44775
2016-10-06 15:17:40 +02:00
Rolf Bjarne Kvinge 7e1d9820b3 [mtouch] Bundle libpinvokes.dylib in the app. (#954)
Building a dylib is somewhat useless unless it ends up in the app bundle.
2016-10-06 14:16:55 +02:00
Rolf Bjarne Kvinge 6f60992290 [mtouch] Build with -debug so that we get debug information and thus source code location in stack traces. (#953) 2016-10-06 10:24:09 +02:00
Chris Hamons 4bb4e2629d [XM] Teach mmp to set xamarin_debug_mode so mono will read mdb files (#951) 2016-10-06 07:05:12 +02:00
Rolf Bjarne Kvinge d1361d963e Merge pull request #933 from rolfbjarne/watchos-network-api
Bump [watch-]mono to get more API removal for watchOS.
2016-10-04 19:47:10 +02:00
Rolf Bjarne Kvinge 1fdd17e611 [mtouch] Add (another) workaround for file descriptor leak in System.Diagnostics.Process. (#934) 2016-10-03 20:02:28 +02:00
Rolf Bjarne Kvinge a3939b100f [mtouch] Tell Cecil to load assemblies in memory unless they're big assemblies. (#935)
In the recent Cecil update Cecil changed from loading assemblies in memory to
keep a FileStream around and read whenever necessary [1].

This is problematic for us, because we need all the AssemblyDefinitions in
memory at once, and if there are many assemblies, then we'll run into problems
due to the number of file descriptors in use.

So revert to the behavior for the old Cecil: loading assemblies in memory,
unless the assemblies are big, since in that case we might run out of memory
otherwise.

http://cecil.pe/post/149243207656/mono-cecil-010-beta-1
2016-10-03 13:44:51 -04:00
Rolf Bjarne Kvinge c4f4056b22 Bump [watch-]mono to get more API removal for watchOS. 2016-10-03 18:31:04 +02:00
Rolf Bjarne Kvinge 0fa4235097 [mtouch] Don't do any TLS processing in the linker for watchOS.
Don't do any TLS processing in the linker for watchOS, because on watchOS we
don't have (managed) TLS.
2016-10-03 18:31:04 +02:00
Rolf Bjarne Kvinge 0863e412b4 Remove XI/Classic support (#926)
* [tests] Remove Classic SDK tests.

* Remove XI/Classic support.

This also means we can remove support for the legacy registrars.

* [monotouch-test] Remove legacy registrar tests.

* [tests/mtouch] Remove Classic tests (and legacy registrar logic).

* [tests/scripted] Fix tests to reference Xamarin.iOS.dll.
2016-09-30 15:02:17 -04:00
Rolf Bjarne Kvinge 4d06d05cc0 [mtouch] Add workaround for file descriptor leak in System.Diagnostics.Process. (#917) 2016-09-29 17:45:23 +02:00
Rolf Bjarne Kvinge b58b36178b Update list of Facade assemblies. (#916)
These assemblies were added here: 919b89954a
2016-09-29 16:12:31 +02:00
Sebastien Pouliot 9fda816230 [mtouch][linker] Use correct error code for CoreOptimizeGeneratedCode (#915)
Previous PR [1] has the right documentation but the wrong source code.

[1] https://github.com/xamarin/xamarin-macios/pull/903
2016-09-28 23:16:03 -04:00
Sebastien Pouliot 5b80e7f85c [mtouch][linker] Provide a more specific error code when OptimizeGeneratedCodeSubStep fails (#903)
The MT2001 error is a general, something went bad, in the linker code
base. The stack trace is often enough to track down issues but in some
cases it would be easier to ask customers for a specific assembly
(rather than their complete project) to investigate an issue.

Example:

error MT2103: Binding Optimizer failed processing `System.Void GoogleConversionTracking.Unified.GoogleConversionPing::.ctor()`.
--- inner exception
System.NullReferenceException: Object reference not set to an instance of an object
  at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessIsDirectBinding (Mono.Cecil.MethodDefinition caller, Mono.Cecil.Cil.Instruction ins) [0x00026] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:264
  at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessCalls (Mono.Cecil.MethodDefinition caller, Int32 i) [0x00337] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:197
  at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.Process (Mono.Cecil.MethodDefinition method) [0x0007b] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:81
  at Xamarin.Linker.StateSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00004] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreOptimizeGeneratedCode.cs:48
---
  at Xamarin.Linker.StateSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00014] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreOptimizeGeneratedCode.cs:50
  at Mono.Tuner.SubStepDispatcher.DispatchMethod (Mono.Cecil.MethodDefinition method) [0x0001d] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:215
  at Mono.Tuner.SubStepDispatcher.BrowseMethods (ICollection methods) [0x0001c] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:167
  at Mono.Tuner.SubStepDispatcher.BrowseTypes (ICollection types) [0x0006b] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:145
  at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (IEnumerable`1 assemblies) [0x00050] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:123
  at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000f] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:104
  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00027] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/linker/Mono.Linker/Pipeline.cs:118
  at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1& assemblies) [0x000ac] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Tuning.cs:79

Right now the MT2001 would only include the inner exception, which does
not include any clue to which assembly caused the exception.

Note: The same pattern to be applied to other BaseSubStep subclasses in
separate commits.

Related to (but not the fix for) https://bugzilla.xamarin.com/show_bug.cgi?id=44701
2016-09-28 11:46:14 -04:00
Sebastien Pouliot da60263a0a [mtouch] Fix NRE when optimizing bindings. Fixes #44701 (#900)
Some binding assemblies contains extra, unneeded code, generated by the C# compiler, e.g.

IL_002f: stloc.0
IL_0030: ldloc.0

which the binding optimizer did not expect.

https://bugzilla.xamarin.com/show_bug.cgi?id=44701
2016-09-27 16:09:42 -04:00
Sebastien Pouliot 4ab6730dd2 [mtouch] Update script to use mono64. Fixes #44122 and others (#887)
Our move to open source and the mtouch/mlaunch split changed mtouch from
a 64bits to a 32bits application (because mono is, by default, still
32bits on OSX).

That's the cause for several recent bugs

* https://bugzilla.xamarin.com/show_bug.cgi?id=44122
* https://bugzilla.xamarin.com/show_bug.cgi?id=44521
* https://bugzilla.xamarin.com/show_bug.cgi?id=44518
* https://bugzilla.xamarin.com/show_bug.cgi?id=44516
2016-09-26 14:47:30 -04:00
Rolf Bjarne Kvinge 86e1e0e882 [mtouch] Show more information about LinkWith attributes. (#895)
* [mtouch] Fix source analysis warning about culture-aware string comparison.

* [mtouch] Show more information about LinkWith attributes.
2016-09-26 16:23:28 +02:00
Rolf Bjarne Kvinge 85cead2337 [mtouch] Don't use nested Parallel.ForEach loops. (#888)
The nested Parallel.ForEach loops don't take into account the outer
MaxDegreeOfParallelism value, causing us to spawn more concurrent tasks than
we want to.

So refactor the code to have one static list of tasks, which each subtask adds
to.
2016-09-23 16:03:23 -04:00
Sebastien Pouliot eb91e692a6 [mtouch] Update script to use mono64. Fixes #44122 and others (#887)
Our move to open source and the mtouch/mlaunch split changed mtouch from
a 64bits to a 32bits application (because mono is, by default, still
32bits on OSX).

That's the cause for several recent bugs

* https://bugzilla.xamarin.com/show_bug.cgi?id=44122
* https://bugzilla.xamarin.com/show_bug.cgi?id=44521
* https://bugzilla.xamarin.com/show_bug.cgi?id=44518
* https://bugzilla.xamarin.com/show_bug.cgi?id=44516
2016-09-23 12:55:11 -04:00
Rolf Bjarne Kvinge 7656a92756 Revert "[mtouch] Don't use nested Parallel.ForEach loops." (#886) 2016-09-23 14:35:43 +02:00
Rolf Bjarne Kvinge fc55e4306f [mtouch] Don't use nested Parallel.ForEach loops. (#881)
The nested Parallel.ForEach loops don't take into account the outer
MaxDegreeOfParallelism value, causing us to spawn more concurrent tasks than
we want to.

So refactor the code to have one static list of tasks, which each subtask adds
to.
2016-09-23 07:02:11 +02:00
Rolf Bjarne Kvinge 88a9b809d2 CFNetworkHandler is not a valid http message handler for watchOS, so show a helpful message if someone tries. (#879) 2016-09-22 18:08:16 +02:00
Rolf Bjarne Kvinge 0db1fe1ff2 [mtouch] Add support for -j X to specify concurrency. (#876) 2016-09-22 09:21:20 -04:00
Rolf Bjarne Kvinge d4edc453a6 Fix default http message handler for watchOS. (#873)
* Fix default http message handler for watchOS.

Fix default http message handler for watchOS to be NSUrlSessionHandler (the
previous attempt at eb7c2fd was quite incomplete), and make sure
HttpClientHandler is never used (show errors if someone tries).

* [tests] Remove explicit http client handler from project files.

Just use the default instead, since the set of valid http client handlers varies between platforms.
2016-09-22 14:29:18 +02:00
Rolf Bjarne Kvinge 1412b5bbed Remove any code related to the IL registrar. (#874)
We've used the dynamic registrar for years now when selecting the IL registrar
(and I've never heard about anybody doing it), so just remove all the related
(and in fact dead) code.
2016-09-22 14:27:54 +02:00
Martin Baulig f3501d99af Remove Mono.Security.Providers.*.dll in preparation of their upcoming removal from the BCL. 2016-09-22 07:23:40 +02:00
Rolf Bjarne Kvinge 821fe4c563 [apidiff] Remove XI/Classic api diff. (#867) 2016-09-21 11:48:28 -04:00
Sebastien Pouliot 702682a1c1 Bump version for SR1 and update the XML for apidiff 2016-09-16 11:07:16 -04:00
Sebastien Pouliot e5a0cef8c8 [apidiff] Update references files to match XI 10.0 (C8) (#813) 2016-09-12 10:49:29 -04:00
Sebastien Pouliot 38148c718a Merge branch 'xcode8' 2016-09-09 15:29:37 -04:00
Rolf Bjarne Kvinge b789deaf8e [mtouch] Require deployment target to be 8+ for incremental builds. (#805)
This is something that changed with 70f1346b: our libxamarin.dylib now
requires iOS 8+, which means the app itself must require iOS 8+ when using
libxamarin.dylib.

This fixes an msbuild failure (Xamarin.iOS.Tasks.IBToolLinking("iPhone").BuildTest):

    Process exited with code 1, command:
    /Applications/Xcode73.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang  -framework Foundation -framework UIKit /Users/builder/data/lanes/1381/5f73edaa/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libmonosgen-2.0.dylib /Users/builder/data/lanes/1381/5f73edaa/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libxamarin-debug.dylib -lz -isysroot /Applications/Xcode73.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk -Qunused-arguments -miphoneos-version-min=7.0 -arch armv7 -shared -read_only_relocs suppress -install_name @executable_path/libXamarin.iOS.dll.dylib -fapplication-extension -o /Users/builder/data/lanes/1381/5f73edaa/source/xamarin-macios/msbuild/tests/MyIBToolLinkTest/obj/iPhone/Debug/mtouch-cache/Xamarin.iOS.dll.armv7.dylib -x assembler /Users/builder/data/lanes/1381/5f73edaa/source/xamarin-macios/msbuild/tests/MyIBToolLinkTest/obj/iPhone/Debug/mtouch-cache/Xamarin.iOS.dll.armv7.s -DDEBUG
    ld: warning: embedded dylibs/frameworks only run on iOS 8 or later
    ld: embedded dylibs/frameworks are only supported on iOS 8.0 and later (@executable_path/libxamarin-debug.dylib) for architecture armv7
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
2016-09-08 15:01:48 +02:00
Rolf Bjarne Kvinge b54a6ed3e6 [mtouch] Fix compiler warning (unused variable). (#789) 2016-09-07 21:28:13 +02:00
Rolf Bjarne Kvinge 7a34f5e9bf [mtouch] Fix incremental builds when generating P/Invoke wrappers. Fixes #44048. (#788)
We need to compile the generated P/Invoke wrappers to a dylib, and link the
dylib for the product assembly (Xamarin.WatchOS.dll) with the generated
P/Invoke wrappers.

Since there might be P/Invokes in any assembly, just link in the P/Invoke
wrapper dylib for every assembly.

https://bugzilla.xamarin.com/show_bug.cgi?id=44048
2016-09-07 17:22:34 +02:00
Manuel de la Pena 546a2fd907 [mtouch] Fix case of the final target directory. 2016-09-06 18:19:27 +02:00
Manuel de la Pena 46e6f06919 [mtouch] MVID for symblication ought to be lower case and with no `-` (#749) 2016-09-02 16:25:12 -04:00
Alexander Köplinger 5eba5f78ce Remove wrong System.Private.* facades from Sdk check (#745)
They are no longer shipped since c8c09310f9 and c75dcf579f.
2016-09-02 12:01:55 +02:00
Rolf Bjarne Kvinge 2eb6ba12c7 [mtouch/mmp] Fix build after breaking cecil update in mono.
Also use mono's cecil instead of our own cecil submodule for mtouch.
2016-09-01 18:28:35 +02:00
Manuel de la Pena 4de097effa [mtouch] Better error handling when copying the aot files. (#720) 2016-08-31 08:18:41 -04:00
Rolf Bjarne Kvinge 875afb4260 [mtouch] Do not use the process task to execute the copy of aot files. Use a normal child process that blocks. Adds very little overhead since it is similar to the copy we had in c#. (#718) 2016-08-31 11:14:30 +02:00
Manuel de la Pena dd24c96ae2 [mtouch] Do not use the process task to execute the copy of aot files. Use a normal child process that blocks. Adds very little overhead since it is similar to the copy we had in c#. 2016-08-31 10:01:18 +02:00
Sebastien Pouliot 974ea0b792 Merge branch 'cycle8' into xcode8 2016-08-30 15:40:58 -04:00
Chris Hamons a43115a85e [XM] Fix native dependency processing by mmp when linker is disabled (#613)
* [XM] Fix native dependency processing by mmp when linker is disabled

- https://bugzilla.xamarin.com/show_bug.cgi?id=43364
- Fixed via a hack for now. Fixed https://bugzilla.xamarin.com/show_bug.cgi?id=43419 to clean up later
- Added null check in ProcessDLLImports due to facades
2016-08-30 08:45:03 -04:00
Sebastien Pouliot 1d5bbedc61 Bump maccore to remove classic (monotouch.dll and friends) support from XI (#704)
Also stop processing the API diff for classic assemblies
2016-08-30 08:14:29 -04:00
Rolf Bjarne Kvinge e5bdbdd1ac Allow profiling + incremental builds on bitcode-capable targets again. (#706)
Mono bug [#41428](https://bugzilla.xamarin.com/show_bug.cgi?id=41428) has been fixed now,
which means we have profiler dylibs again, so we can enable profiling + incremental builds again.
2016-08-30 11:39:29 +02:00
Sebastien Pouliot 7149661251 [mtouch|mmp] Add missing frameworks with platform versions (#703)
note: AVFoundation is commented on watchOS 3 as this breaks the static
registrar .a helper built for watchOS.

AVFoundation does a file check to enable some types - but the watchSimulator
include that file, leading to compilation errors later (missing CMTime.h)

	#if TARGET_OS_WATCH
	#if ! __has_include(<AVFoundation/AVAnimation.h>)
	#define AVF_IS_WATCHOS_SDK 1
	#endif
	#endif
2016-08-29 19:22:34 -04:00
Manuel de la Pena 30bd2ad5b3 [mtouch] Fix NRE when we try to copy aot files. (#701) 2016-08-29 13:38:59 -04:00
Rolf Bjarne Kvinge 80c88e9ce4 [linker] Add temporary workaround for bug #43658. (#697)
The real fix for bug #43658 is in mono master, but the current
version of mono master doesn't build for us, so implement this
workaround instead.

The problem is that the linker doesn't preserve fields of nested types marked
in xml descriptions unless the declaring type is marked. So the workaround
(until we can bump mono) is to mark the declaring type.

https://bugzilla.xamarin.com/show_bug.cgi?id=43658
2016-08-29 08:17:57 -04:00
Sebastien Pouliot 6d5beb61cb Merge branch 'cycle8' into xcode8 2016-08-26 08:19:33 -04:00
Sebastien Pouliot 2bcd40054f [linker] Ensure we do not devirtualize methods that needs to be called from a base class to satisfy an interface. Fixes #34308 (#675)
Update unit tests to catch this case and be more precise in others.

reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=43408
2016-08-26 08:17:01 -04:00
Sebastien Pouliot 0bea77b781 [linker] Ensure we do not devirtualize methods that needs to be called from a base class to satisfy an interface. Fixes #34308 (#675)
Update unit tests to catch this case and be more precise in others.

reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=43408
2016-08-26 09:24:51 +02:00
Chris Hamons 1c6e1959b7 [XM] Add support for disabling lldb attach on crash (#670)
- https://bugzilla.xamarin.com/show_bug.cgi?id=23482
2016-08-25 13:06:38 -05:00
Chris Hamons 3ad2491006 Fixup C8 static registrar to work w\ Xcode 8 (#647)
* Fix static registrar on 10.12 by teaching it that QTKit is dead (#472)
* Rip out all 64-bit registration in 32-bit XM.
2016-08-25 14:03:43 -04:00
Rolf Bjarne Kvinge e291f1717d Revert "Bump [watch-]mono to master to get fix for #43658." (#665) 2016-08-25 14:44:53 +02:00
Rolf Bjarne Kvinge f6b1ccd748 Bump [watch-]mono to master to get fix for #43658. (#653)
* Bump [watch-]mono to master to get fix for #43658.

https://bugzilla.xamarin.com/show_bug.cgi?id=43658

* [mtouch/mmp] Fix build after breaking cecil update in mono.

Also use mono's cecil instead of our own cecil submodule for mtouch.

* Bump [watch-]mono to get compilation fixes after cecil bump in mono.

* Remove cecil submodule, we only use the one in mono now.
2016-08-25 13:10:14 +02:00
Rolf Bjarne Kvinge bbb081212c [apidiff] Run mono-api-info and mono-api-html from their output directories. (#660)
This way we use the right version of any dependent dlls.

Otherwise we'd build with the cecil version from the mono repository,
and run with the system's cecil.
2016-08-25 11:31:56 +02:00
Rolf Bjarne Kvinge e0b1ac4f75 [mtouch/mmp] Fix debug spew to compile. (#654) 2016-08-24 14:26:56 -04:00
Manuel de la Pena bb528f90dc [Mtouch] Use the mono tools to copy over the msym files. (#622)
* [Mtouch] Use the mono tools to copy over the msym files.

* As per review:

* Do not create a DirectoryInfo when it is not needed.
* Do not throw exceptions for values that can be null, should never
happen.
* Remove unused import.

* Undo a wrong using removal and do the right thing.

* Fix build issues.
2016-08-23 10:29:42 +02:00
Manuel de la Pena a916c9ee06 [mtouch] Remove warning from aot compilation. (#639)
The option was removed because it is default in mono.
2016-08-22 11:26:42 -04:00
Sebastien Pouliot 7619702459 [registrar] Remove tvOS/simulator hack for ExternalAccessory (#619)
Apple now ships the required ExternalAccessory header files

references:
* commit 1190aac04c
  Author: Sebastien Pouliot <sebastien.pouliot@gmail.com>
  Date:   Sun Jul 24 10:44:19 2016 -0400
* rdar#27476259 https://trello.com/c/Okdw58IO
2016-08-16 20:49:22 -04:00
Aleksey Kliger (λgeek) e5132633e5 [linker] Update mscorlib.xml to include Mono.RuntimeStructs (#616) 2016-08-16 17:08:11 -04:00
Sebastien Pouliot 9eca87665a Merge branch 'cycle8' into xcode8 2016-08-16 16:33:25 -04:00
Chris Hamons 1d09e9040b [XM] Fix native dependency processing by mmp when linker is disabled (#613)
* [XM] Fix native dependency processing by mmp when linker is disabled

- https://bugzilla.xamarin.com/show_bug.cgi?id=43364
- Fixed via a hack for now. Fixed https://bugzilla.xamarin.com/show_bug.cgi?id=43419 to clean up later
- Added null check in ProcessDLLImports due to facades
2016-08-16 15:24:01 -05:00
Alexander Köplinger 59125e6f9c [C8] Bump to latest Mono 4.6.0 commit (#602)
* [C8] Bump to latest Mono 4.6.0 commit

Brings in the netstandard updates from https://github.com/mono/mono/pull/3394
We also had to add a new assembly System.IdentityModel.dll to the mobile profiles while doing that work.

* Add System.IdentityModel to Sdk assemblies

Fixes the following mtouch test failure:

```
Xamarin.Linker.SdkTest.iOS_Classic :   BCL
  Expected:
  But was:  < "System.IdentityModel" >

at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x47bec88 + 0x00047> in :0
at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x47bec58 + 0x0001f> in :0
at Xamarin.Linker.SdkTest.BCL (System.String path) <0x47bccf0 + 0x003f3> in :0
at Xamarin.Linker.SdkTest.iOS_Classic () <0x47bcc50 + 0x0001b> in :0
```
2016-08-16 15:09:59 -04:00
Alexander Köplinger e04f2abb19 Add System.IdentityModel to Sdk assemblies (#612)
Fixes the following mtouch test failure:

```
Xamarin.Linker.SdkTest.iOS_Classic :   BCL
  Expected:
  But was:  < "System.IdentityModel" >

at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x47bec88 + 0x00047> in :0
at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x47bec58 + 0x0001f> in :0
at Xamarin.Linker.SdkTest.BCL (System.String path) <0x47bccf0 + 0x003f3> in :0
at Xamarin.Linker.SdkTest.iOS_Classic () <0x47bcc50 + 0x0001b> in :0
```
2016-08-16 11:41:51 -04:00
Chris Hamons e482017fba [XM] Teach XM to add fobjc-runtime=macosx to clang 64-bit builds (#585)
- As requested by Rolf here https://bugzilla.xamarin.com/show_bug.cgi?id=42889
2016-08-15 14:34:35 -05:00
Chris Hamons 0fe8a18229 [XM] Ignore linking requests for extension projects (#575)
- Linking breaks extensions for as long as we have the "extensions must be use static registrar" hack.
- So let's ignore it with a warning. Better that random brokeness.
- https://bugzilla.xamarin.com/show_bug.cgi?id=43197
2016-08-15 14:34:24 -05:00
Chris Hamons a88ab8afc5 [XM] Teach XM to add fobjc-runtime=macosx to clang 64-bit builds (#585)
- As requested by Rolf here https://bugzilla.xamarin.com/show_bug.cgi?id=42889
2016-08-10 15:03:26 -04:00
Sebastien Pouliot 89ffd0c7a8 [tvos][photos[ui]] Enable both Photos[UI] frameworks in mtouch for tvOS (#581) 2016-08-09 15:39:15 -04:00
Chris Hamons 3dd8f846d7 [XM] Ignore linking requests for extension projects (#575)
- Linking breaks extensions for as long as we have the "extensions must be use static registrar" hack.
- So let's ignore it with a warning. Better that random brokeness.
- https://bugzilla.xamarin.com/show_bug.cgi?id=43197
2016-08-09 10:14:27 -05:00
Sebastien Pouliot ff77f85a4c Merge branch 'cycle8' into xcode8 2016-08-08 15:29:36 -04:00
Sebastien Pouliot 921b254adc [watchos][scenekit] Enable SceneKit on watchOS (#563)
* Enable some SceneKit-related WatchKit API
* Enable some SceneKit-related SpriteKit API
* Enable some SceneKit-related Foundation API
* Fix generator to include `using SceneKit;` on watchOS
* Adjust xtro tests since watchOS headers include some stuff that's not available in reality
* Lots of [Watch (3,0)] attributes
2016-08-06 10:59:16 -04:00
Rolf Bjarne Kvinge 44b30892e9 [registrar] Skip any assemblies with the DelayedRegistrationAttribute in the static registrar. (#557) 2016-08-05 18:43:22 +02:00
Sebastien Pouliot 937eb70686 Merge branch 'cycle8' into xcode8 2016-08-04 13:26:08 -04:00
Sebastien Pouliot 2037c5f581 [apidiff] Update definitions to C7SR1 (current stable) (#550)
Also enable tvOS when updating references (Makefile)
2016-08-04 13:23:06 -04:00
Sebastien Pouliot bc72c950b7 [apidiff] Update definitions to C7SR1 (current stable) (#550)
Also enable tvOS when updating references (Makefile)
2016-08-04 13:14:13 -04:00
Chris Hamons 52a8642d2c [XM] Teach mmp to set rpath we we copy frameworks into bundle Framework dir (#506)
- https://bugzilla.xamarin.com/show_bug.cgi?id=42846
2016-08-04 08:35:23 -05:00
Chris Hamons 6f4be16d3a [XM] Fix static registrar.
Rip out all 64-bit registration in 32-bit XM.
2016-08-04 11:54:59 +02:00
Chris Hamons a3b31d154b [XM] Fix static registrar on 10.12 by teaching it that QTKit is dead (#472) 2016-08-04 11:54:59 +02:00
Rolf Bjarne Kvinge c66a44bc12 Teach the static registrar about the lack of ExternalAccessory headers in the tvOS simulator.
This is only applicable to tvOS 10 (i.e. the xcode8 branch),
but applying the patch already helps avoiding merge failures
for other fixes in the same area.
2016-08-04 11:54:58 +02:00
Chris Hamons 798aca0767 [XM] Fix static registrar.
Rip out all 64-bit registration in 32-bit XM.
2016-08-02 17:44:10 +02:00
Rolf Bjarne Kvinge e7a1675436 [registrar] Skip any assemblies with the DelayedRegistrationAttribute in the static registrar. (#507) 2016-07-29 11:33:18 +02:00
Chris Hamons 08ba6a7af7 [XM] Teach mmp to set rpath we we copy frameworks into bundle Framework dir (#506)
- https://bugzilla.xamarin.com/show_bug.cgi?id=42846
2016-07-28 07:49:21 -05:00
Manuel de la Pena c1d2b5c2dc [mtouch] Remove warning when building mtouch. (#491) 2016-07-27 10:58:23 +02:00
Aleksey Kliger (λgeek) 0364c047e6 [mmp] Preserve TransparentProxy::StoreRemoteField (#497)
* Bump mono and watch-mono

* [mmp] Preserve TransparentProxy::StoreRemoteField

This is needed to prevent a mono assert when xamarin-macios is built
with mono master after mono/mono@6b8e96c
2016-07-26 21:09:07 -04:00
Sebastien Pouliot c37f450a09 Merge branch 'cycle8' into xcode8 2016-07-26 11:41:45 -04:00
Rolf Bjarne Kvinge abd5d1ba46 Use dlsym for user assemblies on iOS. (#492)
We tried disabling dlsym for all assemblies on iOS, but it turned
out to break a significant amount of customer code [1].

So re-enable it, but only for user assemblies (since we control
all assemblies we ship and can thus make sure those work with
dlsym disabled).

https://trello.com/c/guig1MF2/623-re-enable-dlsym-for-ios
2016-07-26 11:39:18 -04:00
Rolf Bjarne Kvinge 130d981b5b Use dlsym for user assemblies on iOS. (#488)
We tried disabling dlsym for all assemblies on iOS, but it turned
out to break a significant amount of customer code [1].

So re-enable it, but only for user assemblies (since we control
all assemblies we ship and can thus make sure those work with
dlsym disabled).

https://trello.com/c/guig1MF2/623-re-enable-dlsym-for-ios
2016-07-26 08:12:40 -04:00
Chris Hamons 88d83532ef [XM] Fix static registrar on 10.12 by teaching it that QTKit is dead (#472) 2016-07-25 11:58:28 -05:00
Rolf Bjarne Kvinge 1003b14a8e Add multiple new assemblies to the list of known SDK assemblies. (#476)
Fixes the Sdk test:

    Errors and Failures:
    1) Test Failure : Xamarin.Linker.SdkTest.iOS_Classic
         BCL
      Expected: <empty>
      But was:  < "System.Net.Http.WinHttpHandler", "System.Numerics.Vectors", "System.Reflection.Context", "System.Reflection.DispatchProxy", "System.Runtime.InteropServices.RuntimeInformation", "System.Security", "System.Xml.XPath.XmlDocument" >

    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x39ec5e0 + 0x00047> in <filename unknown>:0
    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x39ec5b0 + 0x0001f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.BCL (System.String path) <0x39ea8a8 + 0x003f3> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.iOS_Classic () <0x39ea808 + 0x0001b> in <filename unknown>:0

    2) Test Failure : Xamarin.Linker.SdkTest.iOS_Unified
         BCL
      Expected: <empty>
      But was:  < "System.Net.Http.WinHttpHandler", "System.Numerics.Vectors", "System.Reflection.Context", "System.Reflection.DispatchProxy", "System.Runtime.InteropServices.RuntimeInformation", "System.Security", "System.Xml.XPath.XmlDocument" >

    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x39ec5e0 + 0x00047> in <filename unknown>:0
    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x39ec5b0 + 0x0001f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.BCL (System.String path) <0x39ea8a8 + 0x003f3> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.iOS_Unified () <0x39ede58 + 0x0001b> in <filename unknown>:0

    3) Test Failure : Xamarin.Linker.SdkTest.tvOS
         BCL
      Expected: <empty>
      But was:  < "System.Net.Http.WinHttpHandler", "System.Numerics.Vectors", "System.Reflection.Context", "System.Reflection.DispatchProxy", "System.Runtime.InteropServices.RuntimeInformation", "System.Security", "System.Xml.XPath.XmlDocument" >

    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x39ec5e0 + 0x00047> in <filename unknown>:0
    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x39ec5b0 + 0x0001f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.BCL (System.String path) <0x39ea8a8 + 0x003f3> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.tvOS () <0x39eded8 + 0x0001b> in <filename unknown>:0

    4) Test Failure : Xamarin.Linker.SdkTest.watchOS
         BCL
      Expected: <empty>
      But was:  < "System.Net.Http.WinHttpHandler", "System.Numerics.Vectors", "System.Reflection.Context", "System.Reflection.DispatchProxy", "System.Runtime.InteropServices.RuntimeInformation", "System.Security", "System.Xml.XPath.XmlDocument" >

    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x39ec5e0 + 0x00047> in <filename unknown>:0
    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x39ec5b0 + 0x0001f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.BCL (System.String path) <0x39ea8a8 + 0x003f3> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.watchOS () <0x39edf58 + 0x0001b> in <filename unknown>:0
2016-07-25 14:50:33 +02:00
Sebastien Pouliot cb38c14bf8 Merge branch 'cycle8' into xcode8 2016-07-25 08:28:26 -04:00
Rolf Bjarne Kvinge 45001cda7d Add multiple new assemblies to the list of known SDK assemblies. (#475)
Fixes the Sdk test:

    Errors and Failures:
    1) Test Failure : Xamarin.Linker.SdkTest.iOS_Classic
         BCL
      Expected: <empty>
      But was:  < "System.Net.Http.WinHttpHandler", "System.Numerics.Vectors", "System.Reflection.Context", "System.Reflection.DispatchProxy", "System.Runtime.InteropServices.RuntimeInformation", "System.Security", "System.Xml.XPath.XmlDocument" >

    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x39ec5e0 + 0x00047> in <filename unknown>:0
    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x39ec5b0 + 0x0001f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.BCL (System.String path) <0x39ea8a8 + 0x003f3> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.iOS_Classic () <0x39ea808 + 0x0001b> in <filename unknown>:0

    2) Test Failure : Xamarin.Linker.SdkTest.iOS_Unified
         BCL
      Expected: <empty>
      But was:  < "System.Net.Http.WinHttpHandler", "System.Numerics.Vectors", "System.Reflection.Context", "System.Reflection.DispatchProxy", "System.Runtime.InteropServices.RuntimeInformation", "System.Security", "System.Xml.XPath.XmlDocument" >

    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x39ec5e0 + 0x00047> in <filename unknown>:0
    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x39ec5b0 + 0x0001f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.BCL (System.String path) <0x39ea8a8 + 0x003f3> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.iOS_Unified () <0x39ede58 + 0x0001b> in <filename unknown>:0

    3) Test Failure : Xamarin.Linker.SdkTest.tvOS
         BCL
      Expected: <empty>
      But was:  < "System.Net.Http.WinHttpHandler", "System.Numerics.Vectors", "System.Reflection.Context", "System.Reflection.DispatchProxy", "System.Runtime.InteropServices.RuntimeInformation", "System.Security", "System.Xml.XPath.XmlDocument" >

    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x39ec5e0 + 0x00047> in <filename unknown>:0
    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x39ec5b0 + 0x0001f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.BCL (System.String path) <0x39ea8a8 + 0x003f3> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.tvOS () <0x39eded8 + 0x0001b> in <filename unknown>:0

    4) Test Failure : Xamarin.Linker.SdkTest.watchOS
         BCL
      Expected: <empty>
      But was:  < "System.Net.Http.WinHttpHandler", "System.Numerics.Vectors", "System.Reflection.Context", "System.Reflection.DispatchProxy", "System.Runtime.InteropServices.RuntimeInformation", "System.Security", "System.Xml.XPath.XmlDocument" >

    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message, System.Object[] args) <0x39ec5e0 + 0x00047> in <filename unknown>:0
    at NUnit.Framework.CollectionAssert.IsEmpty (IEnumerable collection, System.String message) <0x39ec5b0 + 0x0001f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.BCL (System.String path) <0x39ea8a8 + 0x003f3> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.watchOS () <0x39edf58 + 0x0001b> in <filename unknown>:0
2016-07-25 08:19:58 -04:00
Sebastien Pouliot 1190aac04c [tvos][externalaccessory] Enable framework on platform (#470)
* Enable ExternalAccessory for tvOS and teach the static registrar about the lack of simulator headers.
2016-07-24 10:44:19 -04:00
Sebastien Pouliot 5a9d8240c2 [watchos][gamekit] Enable GameKit on watchOS (#452)
Apple does not (yet?) ship the headers for GameKit on the watch simulator (radar [1]). The static registrar was tweaked to skip this on the simulator.

[1] https://trello.com/c/Okdw58IO/51-27476259-gamekit-header-files-are-missing-for-watchsimulator
2016-07-22 13:35:59 -04:00
Rolf Bjarne Kvinge 7144ffc53d [registrar] Make sure we include the headers for NS[U]Integer / CGFloat to compile. Fixes #42673. (#464)
https://bugzilla.xamarin.com/show_bug.cgi?id=42673
2016-07-22 19:11:15 +02:00
Rolf Bjarne Kvinge 59aae5425f [registrar] Make sure we include the headers for NS[U]Integer / CGFloat to compile. Fixes #42673. (#465)
https://bugzilla.xamarin.com/show_bug.cgi?id=42673
2016-07-22 19:11:09 +02:00
Rolf Bjarne Kvinge 9b3c97042d Add System.Security.Cryptography.[Algorithms|Primitives] to the list of known SDK assemblies. (#445) (#462)
Fixes the Sdk test:

    Errors and Failures:
    1) Test Failure : Xamarin.Linker.SdkTest.iOS_Classic
         System.Security.Cryptography.Algorithms
      Expected: True
      But was:  False

    at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.iOS_Classic () <0x30d2808 + 0x0004b> in <filename unknown>:0

    2) Test Failure : Xamarin.Linker.SdkTest.iOS_Unified
         System.Security.Cryptography.Algorithms
      Expected: True
      But was:  False

    at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.iOS_Unified () <0x30d5558 + 0x0004b> in <filename unknown>:0

    3) Test Failure : Xamarin.Linker.SdkTest.tvOS
         System.Security.Cryptography.Algorithms
      Expected: True
      But was:  False

    at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.tvOS () <0x30d55d8 + 0x0004b> in <filename unknown>:0

    4) Test Failure : Xamarin.Linker.SdkTest.watchOS
         System.Security.Cryptography.Algorithms
      Expected: True
      But was:  False

    at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.watchOS () <0x30d5658 + 0x0004b> in <filename unknown>:0
2016-07-22 08:04:58 -04:00
Chris Hamons 9530bdf608 [XM] Fix linker ability to deadstrip library loads from NSObject.mac.… (#448)
* [XM] Fix linker ability to deadstrip library loads from NSObject.mac.cd for new libraries

- Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=42177 in Release / Mobile since we can rip out GameController if not used
2016-07-21 12:58:54 -05:00
Rolf Bjarne Kvinge c13e733b8a Add System.Security.Cryptography.[Algorithms|Primitives] to the list of known SDK assemblies. (#445)
Fixes the Sdk test:

    Errors and Failures:
    1) Test Failure : Xamarin.Linker.SdkTest.iOS_Classic
         System.Security.Cryptography.Algorithms
      Expected: True
      But was:  False

    at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.iOS_Classic () <0x30d2808 + 0x0004b> in <filename unknown>:0

    2) Test Failure : Xamarin.Linker.SdkTest.iOS_Unified
         System.Security.Cryptography.Algorithms
      Expected: True
      But was:  False

    at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.iOS_Unified () <0x30d5558 + 0x0004b> in <filename unknown>:0

    3) Test Failure : Xamarin.Linker.SdkTest.tvOS
         System.Security.Cryptography.Algorithms
      Expected: True
      But was:  False

    at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.tvOS () <0x30d55d8 + 0x0004b> in <filename unknown>:0

    4) Test Failure : Xamarin.Linker.SdkTest.watchOS
         System.Security.Cryptography.Algorithms
      Expected: True
      But was:  False

    at Xamarin.Linker.SdkTest.Facades (System.String path) <0x30d4640 + 0x0006f> in <filename unknown>:0
    at Xamarin.Linker.SdkTest.watchOS () <0x30d5658 + 0x0004b> in <filename unknown>:0
2016-07-20 12:12:47 +02:00
Sebastien Pouliot 52ffb2b251 Merge branch 'cycle8' into xcode8 2016-07-18 14:34:12 -04:00
Manuel de la Pena 53e2129230 [Fix] Ensure that symbolication contains the aotid subdirs that will contain the msym files. 2016-07-18 18:19:25 +02:00
Manuel de la Pena 30ae7cf5a3 [Fix] Ensure that symbolication contains the aotid subdirs that will contain the msym files. 2016-07-18 16:42:00 +02:00
Sebastien Pouliot d29eb7a436 Workaround for #42549 until correct support for symbolification is available in C8 (#410) 2016-07-15 14:01:32 -04:00
Alex Soto af8289880e [IntentsUI] Add IntentsUI framework from Xcode 8 b2 (#400) 2016-07-14 20:42:48 -04:00
Rolf Bjarne Kvinge 63811c85e5 [registrar] Use the correct parameters when generating category methods. Fixes #42489. (#385)
Category methods are exposed like extension methods, and the first parameter
specifies the class, which means we need to skip the first type when generating
the ObjC signature.

https://bugzilla.xamarin.com/show_bug.cgi?id=42489
2016-07-14 15:33:21 -04:00
Rolf Bjarne Kvinge 724308cb0d [registrar] Forward-declare ObjC classes. Fixes #42454. (#395)
There can be circular dependencies between Objective-C classes,
so make sure we don't fail compilation when that occurs by
forward declaring any Objective-C classes/protocols.

The test case in question does not contain a circular dependency,
but the same issue occurs due to types not being generated in the
correct order (a correct order could be constructed for the test
case, but there's no general solution since circular dependencies
can exist).

https://bugzilla.xamarin.com/show_bug.cgi?id=42454
2016-07-14 15:28:57 -04:00
Rolf Bjarne Kvinge ddfad1bc88 [registrar] Use the correct parameters when generating category methods. Fixes #42489. (#396)
Category methods are exposed like extension methods, and the first parameter
specifies the class, which means we need to skip the first type when generating
the ObjC signature.

https://bugzilla.xamarin.com/show_bug.cgi?id=42489
2016-07-14 18:42:30 +02:00
Alex Soto aef1775532 [Intents] Add Intents bindings from Xcode 8 b2 2016-07-14 04:02:12 -05:00
Sebastien Pouliot cf27c2e7a8 Merge branch 'cycle8' into xcode8 2016-07-13 16:43:00 -04:00
Rolf Bjarne Kvinge a7a0bb4f05 [registrar] Forward-declare ObjC classes. Fixes #42454. (#387)
There can be circular dependencies between Objective-C classes,
so make sure we don't fail compilation when that occurs by
forward declaring any Objective-C classes/protocols.

The test case in question does not contain a circular dependency,
but the same issue occurs due to types not being generated in the
correct order (a correct order could be constructed for the test
case, but there's no general solution since circular dependencies
can exist).

https://bugzilla.xamarin.com/show_bug.cgi?id=42454
2016-07-12 20:34:18 -04:00
Rolf Bjarne Kvinge 5e7f53ff38 [mtouch] Reword MT0094 to make it clearer it's an informational message, and no action is required on the user side. (#381) 2016-07-12 20:21:03 -04:00
Sebastien Pouliot b16a95b0d1 [tvos] Enable MultipeerConnectivity and ReplayKit frameworks, existing in iOS but just added in tvOS 10 (#361)
* Xcode 8 beta 2 tvOS SDK does not ship ExternalAccessory headers for the simulator (but the framework itself is present) so it's not yet enabled (causing registrar build issues)

https://trello.com/c/2e2VdbGR/49-27266975-externalaccessory-header-files-are-missing-for-appletvsimulator

* MapKit was not added for 9.2 - it's added now (and will be fixed in master/cycle8 later)
2016-07-10 11:15:45 -04:00
Alex Soto 074c4f6530 [UserNotificationsUI] Add UserNotificationsUI framework from xcode 8 beta 1 2016-07-04 14:41:22 -05:00
Alex Soto 046a3fad30 [UserNotifications] Add UserNotifications framework xcode 8 beta 1 2016-07-04 14:39:45 -05:00
Rolf Bjarne Kvinge 01775dfd2e [mtouch] Make sure to reference mono_profiler_startup_log so that the native linker doesn't remove the symbol. Fixes #41666. (#340)
https://bugzilla.xamarin.com/show_bug.cgi?id=41666
2016-07-04 13:26:12 -04:00
Rolf Bjarne Kvinge b6189e9165 [mtouch] Make sure to reference mono_profiler_startup_log so that the native linker doesn't remove the symbol. Fixes #41666. (#340)
https://bugzilla.xamarin.com/show_bug.cgi?id=41666
2016-07-04 13:25:34 -04:00
Aleksey Kliger (λgeek) fad331ff76 [mmp] Preserve TransparentProxy::LoadRemoteFieldNew (#339)
This fixes an assert that `tp_load != NULL` on osx when xamarin-macios is built
with mono master after mono/mono@787e34ae2d
2016-07-01 09:57:25 -04:00
Vincent Dondain 5be3587db5 [homekit] Update for iOS 10 beta 1 (#324) 2016-06-30 08:31:40 -04:00
Rolf Bjarne Kvinge e2cd699b27 [registrar] Don't return from trampolines without going through proper state handling code. (#322)
Fixes a COOP crash due to invalid state.
2016-06-29 15:10:24 -04:00
Rolf Bjarne Kvinge 7e773080a9 Merge remote-tracking branch 'origin/master' into xcode8 2016-06-29 10:23:03 +02:00
Manuel de la Pena 19cceab4d5 [mtouch] Reenable the symbolication to allow debugging and update its implementation. (#284) 2016-06-28 14:35:05 -04:00
Sebastien Pouliot 67470d439c [mtouch] Quote the .dylib used for incremental builds. Fixes #42006 (#303)
Fix MT3001 AOT errors due to incorrect paths.

https://bugzilla.xamarin.com/show_bug.cgi?id=42006
2016-06-28 12:51:05 -04:00
Timothy Risi c94d0e7b70 Merge branch 'master' into xcode8 2016-06-23 10:45:09 -08:00
Rolf Bjarne Kvinge f3e08d0502 [mtouch] Set the soft heap limit to 8m on watchOS. (#258) 2016-06-22 06:11:40 -07:00
Rolf Bjarne Kvinge c560fee268 [registrar] Managed characters are equivalent to shorts in native code. (#259)
Fixes NSCharacterSetTest.NSMutableCharacterSet_TestStaticSets when
running with the P/Invoke wrapper (for exceptions) enabled (i.e.
watchOS), since otherwise the wrapper would truncate char parameters
to byte.
2016-06-22 05:47:13 -07:00
Vincent Dondain aae5a73543 [messages] New framework in iOS 10.0 beta1 (#190) 2016-06-21 08:56:38 -04:00
Sebastien Pouliot 1659e121f0 Merge branch 'master' into xcode8 2016-06-20 20:48:14 -04:00
Alex Soto 5225450521 [VideoSubscriberAccount] Add VideoSubscriberAccount from xcode8 beta1
* Added VideoSubscriberAccount binding
* Ensured we link against VideoSubscriberAccount
* Ensured introspection tests pass
2016-06-18 14:38:02 -05:00
Alex Soto 29b47a8c7d [Speech] Add Speech Framework from Xcode 8 Beta 1
* Added Speech Framework bindings
* Ensured introspection test pass
* Ensured we link against Speech framework
* FIXME: SFSpeechRecordingRecognitionRequest is not in the public api
  filled radar://26799291 https://trello.com/c/s6s6YKua
2016-06-18 14:22:06 -05:00
Alex Soto 7c66cbf736 [CallKit] Add CallKit framework binding from xcode 10 beta1 (#189)
* Added CallKit Bindings
* Ensure CallKit.framework is linked
* Ensure CallKit passes introspection tests
* FIXME: https://trello.com/c/afWXDZ3A
  Headers says CallKit is available on macOS 10.12
  but uses AVAudioSession and it is iOS only
  Opened Radar awaiting response.
2016-06-18 06:20:38 -07:00
Aleksey Kliger (λgeek) a46d86948c [linker] Adjust RemoveCode.cs not to remove MonoMethodMessage (#226)
Fixes Bug5354 in linker-ios/dont link/AotBugs.cs when compiled with Mono master.
2016-06-17 15:51:19 -07:00
Aleksey Kliger (λgeek) 8474a21176 [runtime] Add MonoMethodMessage::InitMessage to linker descriptors (#172)
It's called from the runtime mono_message_init method since
 Mono commit 83f37161192b7735ffd04a4235253d790eefff99
2016-06-10 13:21:19 -04:00
Rolf Bjarne Kvinge 386c15c503 Merge pull request #153 from rolfbjarne/more-exceptions
Handle any exceptions when returning from managed code back to our native runtime.
2016-06-09 18:13:23 +02:00