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

1556 Коммитов

Автор SHA1 Сообщение Дата
Alex Soto 6b65ce9077 [AVFoundation] Low hanging fruits and xtro of AVFoundation (#980)
This commit brings all new 10.12 api + most of the unbound
AVFoundation API that is macOS specific and was left in the limbo
2016-11-07 09:32:56 -06:00
Rolf Bjarne Kvinge 503061f6ab [tests] Update to NUnit 3 in mtouch tests. (#1119) 2016-11-07 12:22:37 +01:00
Manuel de la Pena bf2ec89c5f [Foundation] Ensure that the auth header is not null in the HttpClient. (#1127)
The auth header is not guaranteed not to be null and therefore we need
to be careful or an uncachable exception will be thrown.
2016-11-07 12:04:52 +01:00
Ankit Jain 945c2043e3 [msbuild] Fix app extension builds with msbuild for XI and XM (#1124)
Some samples from the `ios-samples` repo failed with an error in running
`ditto`:

```
  Tool /usr/bin/ditto execution started with arguments: -rsrc /Users/ankit/dev/ios-samples/ios9/FilterDemoApp/FilterDemoAppExtension/bin/iPhoneSimulator/Debug/FilterDemoAppExtension.appex bin/iPhoneSimulator/Debug/FilterDemoApp.app/PlugIns/FilterDemoAppExtension.appex                                                  Environment variables being passed to the tool:
  ditto: can't get real path for source '/Users/ankit/dev/ios-samples/ios9/FilterDemoApp/FilterDemoAppExtension/bin/iPhoneSimulator/Debug/FilterDemoAppExtension.appex'                                                                                                                                                       Tool /usr/bin/ditto execution finished.
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets : error : Tool exited with code: 1. Output: ditto: can't get real path for source '/Users/ankit/dev/ios-samples/ios9/FilterDemoApp/FilterDemoAppExtension/bin/iPhoneSimulator/Debug/FilterDemoAppExtension.appex' [/Users/ankit/dev/ios-samples/ios9/FilterDemoApp/FilterDemoApp/FilterDemoApp.csproj]
```

The directory
`/Users/ankit/dev/ios-samples/ios9/FilterDemoApp/FilterDemoAppExtension/bin/iPhoneSimulator/Debug/FilterDemoAppExtension.appex`
did exist *after* the full build was over, but just before `ditto` ran,
it didn't[1].

But it should have been created as part of the `FilterDemoAppExtension`
build, before `ditto` was called as the `FilterDemoAppExtension` project
is referenced by `FilterDemoApp`. And this builds fine with xbuild.

Debugging+hair-pulling revealed:

a. `FilterDemoApp.csproj` has a `ProjectReference` pointing to
`FilterDemoAppExtension.csproj`

b. xbuild figures out the build order based on the .sln and the project
references and builds the individual projects in that order.

c. But msbuild doesn't do that anymore. It seems to build in "some"
order (probably the order in which the projects appear in the sln), and
depends on each project's `ResolveProjectReferences` target building
such referenced projects! So, msbuild starts with building
`FilterDemoApp` project and should have built the extension project, as
it is referenced, but that does not happen.

d. It does not happen because XI, in `_SeparateAppExtensionReferences`,
moves any `Extension` projects from `@(ProjectReferences)` to other
items to handle them itself in `Xamarin.iOS.Common.targets`. So, the
`ResolveProjectReferences` does not see the extension project at all.

e. But XI targets handle this in `_ResolveAppExtensionReferences`, just
like `ResolveProjectReferences` from x/msbuild targets. BUT.. they depend
on the xbuild's behavior, where if you are building a `.sln` file, then
any dependent projects have already been built, and thus it just skips
them!!
	- Since, msbuild no longer does this.. the extension project is
	not built and instead proceeds to creating the apple bundle.

So, the fix is effectively to remove the `$(BuildingSolutionFile) == true`
check from that target.

- The same change is required for Watch extensions target too.
- And the corresponding changes for XamMac

- This fixes ~7 demos in ios-samples.

---
1. The directory and the corresponding files existed *after* the full
build but not before the `ditto` execution because after `ditto`
caused the `FilterDemoApp` project to fail, msbuild continued to build
the remaining `FilterDemoAppExtension` project! too late :)
2016-11-06 19:15:30 -05:00
Vincent Dondain 1f056d6a3e [msbuild] Fix minor typos in DetectSdkLocationsTaskBase (#1121) 2016-11-04 10:53:32 -04:00
Rolf Bjarne Kvinge 5ef045d764 [xharness] Capture stdout/stderr from simulator apps. (#1116)
And if we have a tty, just show the output directly there. Otherwise capture
it, and store it in log files.
2016-11-04 12:13:20 +01:00
Rolf Bjarne Kvinge 3351e2a633 Add a 'repositorypath' to our NuGet.Config and update paths everywhere accordingly. (#1110)
This makes us only put packages in one directory (saves disk space and time),
and it also makes project files in multiple solutions work properly
(mtouch.csproj is in tests/tests.sln and tests/mtouch/mtouch.sln).
2016-11-04 09:13:33 +01:00
Sebastien Pouliot 738a33afca Merge pull request #1087 from xamarin/msbuild-use-latest-profile
[msbuild] Allow Provisioning Profile lookups by name and use only the…
2016-11-03 11:09:41 -04: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 43c06e0cbb [tests] Ignore mtouch tests that require device support if device support was not included in the build. (#1109) 2016-11-03 13:20:31 +01:00
Rolf Bjarne Kvinge 4c8867c1b2 [xharness] Give the mtouch tests 120 minutes to finish. (#1095)
Give the mtouch tests 120 minutes to finish, since that's what wrench
currently gives them.
2016-11-03 11:53:49 +01:00
Sebastien Pouliot ee046ee034 [generator] Copy [Obsolete] attributes on smart enums. Fixes #46292 (#1104)
Covers attributes on the type itself and on its members.

Reference:
* https://bugzilla.xamarin.com/show_bug.cgi?id=46292
2016-11-02 23:18:59 -04:00
Sebastien Pouliot aedf9cdc69 [watchos][watchkit] Small updates for Xcode 8.2 beta 1 (#1103)
Normally the removal of `HandleAction` would be a breaking change (and
require a stub). However Xamarin.WatchOS.dll is not final before C9 so
this fix will be backported to `master` and `cycle9` branches.
2016-11-02 22:16:21 -04:00
Sebastien Pouliot e55385637f [generator] Allow identical (numeric) values in smart enums. Fixes #46285 (#1102)
Considering the following binding code:

    public enum HMAccessoryCategoryType {
        [Field ("HMAccessoryCategoryTypeGarageDoorOpener")]
        DoorOpener,

        GarageDoorOpener = DoorOpener,
    }

We must

1. Ensure that `HMAccessoryCategoryType.DoorOpener.GetConstant () ==
	HMAccessoryCategoryType.GarageDoorOpener.GetConstant ()`;

This is done by using the numeric value of the enum member (instead of the name)

2. Ensure that `HMAccessoryCategoryTypeExtensions.GetValue ("HMAccessoryCategoryTypeGarageDoorOpener")`
   always return the same enum value, i.e. it can **not** change between
   XI versions (e.g. due to reflection ordering) as it could break
   comparison code;

This is done by only adding a map to the member that has a [Field] and
means that:

2.1. the _favorite_ enum member should be the one with the [Field]; and

2.2. a [Field] value can only be used once per enum (or else we report
     an BI1046 error). This also solve the duplicate code generation for
	 the constant loading code;

Reference:
* https://bugzilla.xamarin.com/show_bug.cgi?id=46285
2016-11-02 21:46:04 -04:00
Timothy Risi cc3c851c17 [Mac][45526] Add missing NSUserNotificationActivationType enum types (#1074) 2016-11-02 16:01:44 -05:00
Miguel de Icaza 3133f362b7 [PrintCore] Add first pass of bindings (#1067) 2016-11-02 13:52:47 -05:00
Rolf Bjarne Kvinge f1420510da [xharness] Add support to configure which tests to run on Jenkins by using labels on pull requests. (#1082) 2016-11-02 16:46:32 +01:00
Rolf Bjarne Kvinge b13bbe0dfb [xharness] Detect and report launch failures better. (#1079) 2016-11-02 15:43:55 +01:00
Rolf Bjarne Kvinge e6b0ed232d [mtouch tests] Remove unnecessary parameter from helper method. (#1093) 2016-11-02 14:44:37 +01:00
Jeffrey Stedfast 350f497e7a [msbuild] Validate that WatchOS2 App Extensions do not have watch-companion set (#1089) 2016-11-02 10:52:40 +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
Jeffrey Stedfast 6a44376aa6 bumped Xamarin.MacDev 2016-11-01 14:05:07 -04:00
Rolf Bjarne Kvinge dddd243dfd [xharness] Update to remove OpenTK-1.0 instead of OpenTK references after XI/Classic removal. (#1084) 2016-11-01 13:13:52 -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
Jeffrey Stedfast 146e7b3962 [msbuild] Allow Provisioning Profile lookups by name and use only the most recent version
Use the 'unique' argument to MobileProvisionIndex's lookup methods
to only get back the most recent versions of each provisioning
profile so that we don't accidentally pick an older version.
2016-11-01 12:27:18 -04:00
Sebastien Pouliot 953e189c85 Bump version to 10.5 to avoid confusion with cycle9 branch 2016-11-01 11:54:46 -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 70cea2e7a3 Add a MTOUCH_VERBOSITY make variable to toggle verbosity depending on the V variable. (#1081) 2016-11-01 16:38:43 +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
Rolf Bjarne Kvinge 5415c90092 [xharness] Add support for running the mtouch tests on Jenkins. (#1077) 2016-11-01 14:43: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
Rolf Bjarne Kvinge 4aea22ef15 [ObjCRuntime] Store a pointer to the initialization options in managed memory. (#1076)
This makes it possible to access the initialization options at a later point
(soon to be used by the registrar).
2016-11-01 12:40:51 +01: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
Chris Hamons 612f52bd80 Fix binding project LinkWithAttributes generation to prevent unnecess… (#1029)
* Fix binding project LinkWithAttributes generation to prevent unnecessary rebuilds

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

* Remove duplicate ToString call
2016-10-31 10:37:10 +01:00
Rolf Bjarne Kvinge f1af70998f [tests] Fix test compilation. (#1065) 2016-10-31 10:09:57 +01:00
Chris Hamons 0443d38028 [xm] Fix multiple NullAllowed issues in NSMenu (#1068)
- https://bugzilla.xamarin.com/show_bug.cgi?id=46162
2016-10-28 20:49:33 -04:00
Sebastien Pouliot e6b65f2a7e Bump Xcode 8.1 to the final version (#1062) 2016-10-28 20:48:29 -04:00
Rolf Bjarne Kvinge 1ca1c3a004 Bump mono requirement to fix mmp tests. (#1066)
This fixes the following mmptests:

1) Classic_NewRefCount_Warns (Xamarin.MMP.Tests.MMPTests.Classic_NewRefCount_Warns)
2) SystemMono_SmokeTest (Xamarin.MMP.Tests.MMPTests.SystemMono_SmokeTest)

That fails like this with earlier versions of Mono 4.8:

    Undefined symbols for architecture i386:
      "_mono_btls_x509_lookup_method_mono_init", referenced from:
         -u command line option
      "_mono_btls_x509_name_list_add", referenced from:
         -u command line option
      "_mono_btls_x509_name_list_free", referenced from:
         -u command line option
      "_mono_btls_x509_name_list_get_count", referenced from:
         -u command line option
      "_mono_btls_x509_name_list_get_item", referenced from:
         -u command line option
      "_mono_btls_x509_name_list_new", referenced from:
         -u command line option
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    error MM5109: Native linking failed with error code 1.  Check build log for details.
2016-10-28 14:22:58 -04: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
Manuel de la Pena 31a07e3bf1 [AVFoundation] Add new constructor for AVAssetExportSession. (#1037)
* [AVFoundation] Add new constructor for AVAssetExportSession.

Add a new constructor that takes an enum instead of a string to have
a strong typed version of the default constructor to reduce possible
errors when passing a random string.

Fixes bug https://bugzilla.xamarin.com/show_bug.cgi?id=44443

* Use smart enums as requested in the PR review.

* Set manually the enum int values.
2016-10-28 17:52:34 +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