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

554 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot 229edf7f85 [msbuild] Add verbosity options on separate lines for mtouch parsing (#7649)
This is more strict than the response-file spec [0] (and filed as a
separate issue [1]) but `mtouch` currently requires one option-per-line
(for filtering some options) for the cache to work properly (i.e. so it
can ignore the `-v` and the `-q` and re-use the existing, cached,
binaries). E.g. from:

```
...
-v -v -v -v
```

to

```
...
-v
-v
-v
-v
```

This is an optimization fix (since cached output helps build times) and
it's also part of a bug fix [2] (part of another commit [3], that was
reverted [4] due to other issues, like this one).

This needs another fix [5] to work properly (like `mtouch` requires)
but both can be applied separately (so different PR for different
changes).

[0] https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/response-file-compiler-option
[1] https://github.com/xamarin/xamarin-macios/issues/7644
[2] https://github.com/xamarin/xamarin-macios/issues/7514
[3] https://github.com/xamarin/xamarin-macios/pull/7544
[4] https://github.com/xamarin/xamarin-macios/pull/7589
[5] https://github.com/xamarin/xamarin-macios/pull/7647
2020-01-02 15:02:28 -05:00
Sebastien Pouliot 9eac081031
[msbuild] Avoid lines starting with a whitespace inside generated response files. Fix #7645 (#7647)
Since the "quote" refactoring there's no real difference between `Add*`
and `Add*Line` methods, everything is now line-oriented.

However `Add` and `AddQuoted` behaved differently, which meant that `Add`
would add a whitespace before a new argument in the `StringBuilder` was
not empty (as a separator needed _when_ different lines were not used).

That resulted in response files that had some lines starting with a white
space. That was not an issue (spec [1] wise) but it broke some (not so
correct) assumptions in `mtouch` and could also break anything that added
comments (which must start with `#`) in the future.

This brings consistency in the output whether quoted/non-quoted arguments
are used.

Reference:
[0] https://github.com/xamarin/xamarin-macios/issues/7645
[1] https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/response-file-compiler-option
2019-12-27 09:15:52 -05:00
Rolf Bjarne Kvinge 5c7b669b5b [msbuild] Don't leave changes behind if a test fails. (#7636) 2019-12-23 13:30:12 -05:00
Rolf Bjarne Kvinge b107841f13 [msbuild] Don't use events and methods that are obsolete and do nothing. (#7637)
Fixes these warnings:

    IPhoneSdks.cs(22,4): warning CS0618: 'AppleSdkSettings.Changed' is obsolete: 'This event is never raised' [/work/maccore/onedotnet/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Tasks.Core.csproj]
    IPhoneSdks.cs(31,4): warning CS0618: 'AppleSdkSettings.CheckChanged()' is obsolete: 'This method does nothing' [/work/maccore/onedotnet/xamarin-macios/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Tasks.Core.csproj]
    MacOSXSdks.cs(18,4): warning CS0618: 'AppleSdkSettings.Changed' is obsolete: 'This event is never raised' [/work/maccore/onedotnet/xamarin-macios/msbuild/Xamarin.Mac.Tasks.Core/Xamarin.Mac.Tasks.Core.csproj]
    MacOSXSdks.cs(25,4): warning CS0618: 'AppleSdkSettings.CheckChanged()' is obsolete: 'This method does nothing' [/work/maccore/onedotnet/xamarin-macios/msbuild/Xamarin.Mac.Tasks.Core/Xamarin.Mac.Tasks.Core.csproj]

Also bump Xamarin.MacDev to pick up updated Xamarin.MacDev:

* xamarin/Xamarin.MacDev@0f578f5 [tests] Upgrade to NUnit 3.12 and use package references. (#65)
* xamarin/Xamarin.MacDev@55a30e2 [tests] Adjust tests to not expect the provisioning profiles in the index in any particular order. (#63)
* xamarin/Xamarin.MacDev@dc270f6 Make methods that do nothing obsolete and fix a compiler warning. (#67)
* xamarin/Xamarin.MacDev@681aef6 Remove unused csproj. (#66)
* xamarin/Xamarin.MacDev@d78a92f Update gitignore (#55)

Diff: ca221c8fd6..0f578f51e6
2019-12-23 13:29:34 -05:00
Rolf Bjarne Kvinge a0beca28f9
[msbuild] Use package references. (#7621)
One of many steps towards building for netstandard 2.0.
2019-12-20 17:23:09 +01:00
Rolf Bjarne Kvinge cf97aaf971
[msbuild] Don't use gdk-sharp, use native functions instead. (#7623)
* [msbuild] Don't use gdk-sharp, use native functions instead.

There's no netstandard version of gdk-sharp.

* Don't require the source checkout to be named 'xamarin-macios'.
2019-12-19 15:21:09 +01:00
Rolf Bjarne Kvinge 6ceb45c9fc
Merge pull request #7611 from rolfbjarne/msbuild-use-system-text-json
[msbuild] Use System.Text.Json instead of System.Json, since only the former is available in .netcore.
2019-12-19 00:35:04 +01:00
Rolf Bjarne Kvinge 3d465f4149
[msbuild] Use mono's coding style. (#7622) 2019-12-18 19:20:16 +01:00
Rolf Bjarne Kvinge 8c589c0093
[msbuild] Remove unused file. (#7610) 2019-12-18 07:15:49 +01:00
Rolf Bjarne Kvinge 015cbf1efc [msbuild] Use faster string comparison (OrdinalIgnoreCase). 2019-12-17 18:55:16 +01:00
Rolf Bjarne Kvinge ca88b95c0e [msbuild] Tell ILRepack where netstandard.dll can be found.
System.Text.Json references netstandard.dll, and ILRepack needs to be able to find it.
2019-12-17 11:34:27 +01:00
Rolf Bjarne Kvinge 0d299e0eb8 [msbuild] Calculate assemblies to be IL merged differently.
We now need to merge System.Text.Json into the final assembly, which means all
the System.Text.Json dependencies as well (there are quite a few), so adjust
the logic to figure out which assemblies to be merged to include every
library, except:

* MSBuild assemblies
* Resource assemblies
* System assemblies.
2019-12-17 11:34:24 +01:00
Rolf Bjarne Kvinge b7a50608f6 [msbuild] Adjust the Bug60536 test so that it continues to fail as expected after switching json parser.
The Bug60536 is about showing a good error message if the json in an asset
pack is invalid. It turns out that System.Text.Json is a bit more permissive
than System.Json, so the json that was previously failing to parse is now
parsing fine [1]. So introduce something that is certainly invalid json
everywhere, and update the test itself as well to cope with different error
message and error location.

Also remove workaround for xbuild in this test, since xbuild isn't used anymore.

[1]: Technically the json is still invalid, because according to the json spec
it's not valid to end a list of array elements with a trailing comma. The
problem is that System.Json would in some cases allow trailing commas for
lists of array elements, and sometimes not, which means that we have to ask
System.Text.Json to allow trailing commas as well. And when System.Text.Json
is asked to allow trailing commas, it also successfully parses a case of
trailing comma where System.Json didn't, thus the need for coming up with
something even more invalid.
2019-12-17 11:28:42 +01:00
Rolf Bjarne Kvinge a1acbd7d0d [msbuild] Use System.Text.Json instead of System.Json, since only the former is available in .netcore. 2019-12-17 11:28:11 +01:00
Rolf Bjarne Kvinge 32cd69d274 [msbuild] Split long exec command over multiple lines.
Makes it easier to understand what's happening when new arguments are added
(and easier to add comments to specific arguments).
2019-12-17 11:17:01 +01:00
Rolf Bjarne Kvinge c422869c4b
[msbuild] Update tests to NUnit 3.12. (#7597)
Updating the msbuild tasks to use netstandard2.0 requires us to bump NUnit to 3+.

This requires:

* A few code changes due to breaking API changes in NUnit.
* Changes in xharness and a makefile to cope with the new location for the
  NUnit console runner (I added a helper script to make things slightly
  easier).
2019-12-16 23:55:59 +01:00
Rolf Bjarne Kvinge d5135cce25
[msbuild] Update to latest ILRepack. (#7594)
The latest ILRepack has fixes for netstandard we'll need.

Also use package references.
2019-12-16 19:06:25 +01:00
Rolf Bjarne Kvinge 3f84883ebf
[msbuild] Remove xbuild-specific code since we don't support building with xbuild anymore. (#7601) 2019-12-16 19:05:40 +01:00
Rolf Bjarne Kvinge 0ea29935b4
[msbuild] Remove unused files. (#7599) 2019-12-16 19:04:41 +01:00
Oleg Demchenko 7cfbe40bcb
Merge pull request #7533 from xamarin/olegoid/vsts-1029041
[vsts-1029041] Add FileType to the list of parameters for altool
2019-12-10 11:56:44 -05:00
Oleg Demchenko 6aabc75583 [vsts-1029041] Pass TargetFrameworkIdentifier to identify target platform 2019-12-03 18:15:09 -05:00
Oleg Demchenko 0fe60500f0 [vsts-1029041] Add FileType to the list of parameters for altool
* ValidateAppStoreBundle
* UploadAppStoreBundle
2019-12-02 16:46:08 -05:00
Sebastien Pouliot 0ee2b271b1
[msbuild] Ensure files we copy are world-readable. Fix #7395 (#7515)
Only execute the extra logic when not running on Windows

ref: https://github.com/xamarin/xamarin-macios/issues/7395
2019-12-02 14:16:49 -05:00
Ema 68f886caef [msbuild] Makes DSymUtil task report the Executable as output
The DSymUtil tool not only generates the debug symbol files but also modifies the executable file. Marking that property as Output (and changing it to ITaskItem type) makes Visual Studio on Windows aware of that change. Under certain scenarios this was making the build on VS produce an app bundle that was not fully signed on incremental builds. For instance, the DSymUtil task was run for a framework on an incremental build, but as the executable file of that framework was not modified on Windows the inputs/outputs check for CodesignFrameworks did not fail so that target was skipped. This led to a failure on the CodesignVerify target.

Partial fix for https://developercommunity.visualstudio.com/content/problem/729766/codedesign-exited-with-code-1.html
2019-10-30 15:21:19 -03:00
Sebastien Pouliot 9fd03625b4
[msbuild] Ensure the output of `mtouch` (and friends) are included in binary logs. Fix #7035 (#7288)
and by friends I mean `mmp` and `btouch`

What does this do ?

1. Assume that output of `mtouch` (and other similar tools) is **always** of high importance. Why ?

- If not then it's not saved in the binary log (even if visible on the console/text logs).
- The logging of `mtouch` (and friends) is dynamic, based on a supplied verbosity level.
- If a verbosity level _anywhere_ then it's a clear sign that the developer wants that extra output (and that includes binary logs).

2. Assume the _global_ verbosity of `msbuild` from the console is just as valid/useful than the one from VSfM.

- CI/bots produce logs and they should be useful to diagnose build issues.
- Setting verbosity in several places is error-prone, which delay investigations and results.
- Running the same project, with the same `msbuild` verbosity, should be identical between IDE and console.

What does that mean ?

Using `msbuild /v:diag /bl:out.binlog` you get a small(er) binary log that has everything[1] you need to diagnose a Xamarin.iOS (or Mac) build. It's also identical to the output what VSfM produce (for the same `msbuild` verbosity level).

[1] we might need to review what we log if we're missing interesting stuff

References:
https://github.com/xamarin/xamarin-macios/issues/7035
2019-10-25 17:44:35 -04:00
William Kent 8425129eeb Add bindings for NSXpcConnection and related types (#7001)
* Add bindings for NSXpcConnection and related types

* Re-add accidentally deleted file

* Typo fix

* Add NSXpcInterface.CreateForType()

* Add MethodInfo-taking overloads to NSXpcInterface

* Add null check

* Mark methods with wrappers as internal

Also fixed a formatting bug that I didn't catch earlier.

* Change NSXPCProxyCreating methods to be strongly typed

I got rid of the NSXpcProxyCreating interface in this change,
because its only user was NSXpcConnection, and I needed to
inline the protocol methods into the class definition so I
could mark them as [Internal].

* Add missing casts

* Add NSXpcConnectionOptions enum

* Convert NSXpcConnection constructor to use new enum

* Remove now-unneeded manual constructor

* Fix bgen warning

* Typo fix

* Fix selector

* Remove incorrect use of BindAsAttribute

Per the docs, this only works for enums backed
by NSNumber and NSValue, not for enums
passed directly as integers.

* Fix duplicated selector errors

* Throw ArgumentException instead of InvalidOperationException

* Extend AppExtension targets to produce XPC services

Rather than create an entirely new set of targets
(that would require VS and VSMac updates to properly
consume), I have decided to use the existing AppExtension
build targets to produce XPC services as well. All the
user must do is set the $(IsXPCService) property to true in
their project file, and the targets will do The Right Thing™.

Note that this support is Mac-only for now; I may need a bit
of help adjusting them to work on for iOS/watchOS/tvOS, as I
am not as familiar with those platforms.

* Copy XPC service bundles into the correct location

* Move IsXPCService property definition to props file

* Don't pass /extension to mmp for XPC service targets

This would cause the XPC service binary to
be linked incorrectly.

* Add NSXpcConnection/NSXpcInterface.cs files to the build

* Fix build

* Fix build

* Add required type parameter requirements

* Fix type parameter requirements

* Fix return type

* Fix return type of NSXpcInterface.CreateForProtocol ()

* Take ownership of the returned object types

* Adjust XPC service mmp invocation

I need to link the XPC service bundle as if it is an app extension, but
I must not use xamarin_mac_extension_main. I added a new flag to make
this possible.

* Change mmp to correctly construct XPC service bundle

* Set the MonoBundleExecutable Info.plist key for XPC services

* Use the runtime to get the protocol

* Make NSXpcInterface.CreateForProtocol() public

The static registrar must be used for Cocoa to accept the protocol
as a valid XPC interface, but that then seems to break resolving
the protocol from the type. I must therefore hard-code the protocol
name in my code, and that requires I make this constructor public.

* Add XpcInterfaceAttribute

See the doc comment in XpcInterfaceAttribute.cs for why
this type is required. The referenced mmp optimizations
will be added in future commits.

* Add XpcInterfaceAttribute to generator build

* Add support for XpcInterfaceAttribute to the generator

* Force static generation of protocols decorated with XpcInterfaceAttribute

* Change how static registrar translates block parameters

Previously, they would always be marshalled as "id".
This would throw off the XPC subsystem, which parses
the block signature to determine the communication
protocol.

* Undo whitespace noise

* Remove unneeded casts

* Add trailing comma

* Use HasAttribute instead of GetCustomAttribute

* Fix style issues

* Bind NSXpcConnection.auditSessionIdentifier

* Address naming feedback

* Make Get/SetAllowedClasses public

IMHO, passing the selector as a string is just as
usable as passing a MethodInfo, and is also less
verbose if you copy/paste the selector string
from the ExportAttribute. There is no reason why
we cannot have both overloads be public.

* Update overload names to match

* Update more overload names to match

* Make mmp --xpc imply --extension

* Reformat if statement

* Fix build

* Conditionalize creation of PlugIns and XPCServices directories

* Add AutoGeneratedName

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Get rid of ProtocolizeAttribute

* Update availability attributes to please xharness

I actually think xharness is wrong here, since the
NSXPCConnection header lists these types as being
available starting in macOS 10.8.

* Update sharpie ignore files to reflect changes

This should fix the xtro-sharpie test failures CI has been reporting.

* Fix MM4105 error generation

* Adjust error message in test to match mmp

I had to change the error text slightly, because the type of the parameter
cannot be determined where the error is thrown anymore. However, the newer
exception message IMO is just as clear.

* Make exception message match test exactly

* Remove outdated copyright header text

* Remove more outdated copyright header text

* Revert changes to MM4105 error generation

I have a more elegant way of fixing this test now.

* Return "id" if Invoke method cannot be found

This fixes the MM4105 error unit test,
without requiring modification to that test.

* Remove redundant availability attributes

* Add DesignatedInitializerAttribute

* Re-add required code to macOS-Foundation.ignore

* Put DesignatedInitializer on the right constructor

* Update xtro-sharpie ignore files
2019-10-22 15:38:01 +02:00
Rolf Bjarne Kvinge bdc8e693f9
[msbuild] Provide the correct value for the operating system for tvOS and watchOS to a few tasks. Fixes #6200. (#7226)
The problem with #6200 was that we'd pass -mios-version-min=x.y to the metal
tool even for tvOS apps. This fixes it so that now pass -mtvos-version-min.

Fixes https://github.com/xamarin/xamarin-macios/issues/6200.
2019-10-16 22:14:11 +02:00
Vincent Dondain 61d0e1809f Merge remote-tracking branch 'origin/master' into master-merge-d16-4 2019-10-14 18:17:35 -04:00
Vincent Dondain a71292165e Merge branch 'd16-4' into master-merge-d16-4 2019-10-14 18:06:42 -04:00
Rolf Bjarne Kvinge a8fdf6db6e
Implement a different escaping/quoting algorithm for arguments to System.Diagnostics.Process. (#7177)
* Implement a different escaping/quoting algorithm for arguments to System.Diagnostics.Process.

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

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

This solves problems like this:

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

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

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

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

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

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

* Parse linker flags from LinkWith attributes.

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

* Fix typo.

* Rename GetVerbosity -> AddVerbosity.

* Remove unnecessary string interpolation.

* Remove unused variable.

* [mtouch] Simplify code a bit.

* Use implicitly typed arrays.
2019-10-14 16:18:46 +02:00
Vincent Dondain a3076f29a3 Merge branch 'xcode11.1' into d16-4 2019-10-07 21:46:13 -04:00
Alexander Köplinger 12831b3c36 Fix version numbers in FrameworkList.xml files (#7161)
The existing test only checked that an assembly was mentioned in the file, but not that its version etc matches.
Updated the test and fixed the differences.
2019-10-04 14:26:28 -04:00
Rolf Bjarne Kvinge 8128976084
[runtime] Split the build differently: build libraries for simulator and device separately. (#7143)
This has a couple of advantages:

* It makes it easier to add a catalyst version of these libraries (because it
  becomes cumbersome to build for catalyst when the build rules assumes we're
  building for both simulator and device).
* It makes it easier to create an xcframework of our libraries, because the
  contents in an xcframework is split like this.
2019-10-03 16:38:44 +02:00
monojenkins d45ad36c66 Bump mono to 2019-08@528103728fc2aedb7b6062e11255d39a0ed3f31c to add missing NS2.1 APIs (#7150)
See https://github.com/mono/mono/issues/17064.

The 2019-08 version of the fix adds a new assembly with NS2.1 APIs that we stubbed out in 2019-06: System.Data.DataSetExtensions.dll
2019-10-02 08:08:41 -04:00
Alexander Köplinger fb1f73ef57 Bump mono to 2019-08@528103728fc2aedb7b6062e11255d39a0ed3f31c to add missing NS2.1 APIs (#7147)
See https://github.com/mono/mono/issues/17064.

The 2019-08 version of the fix adds a new assembly with NS2.1 APIs that we stubbed out in 2019-06: System.Data.DataSetExtensions.dll
2019-10-02 07:59:39 -04:00
Rolf Bjarne Kvinge 7d4b09e3d0
[msbuild] Update a few msbuild tests to Xcode 11 behavior. Fixes #6970. (#7031)
Fixes https://github.com/xamarin/xamarin-macios/issues/6970.
2019-09-19 15:29:44 +02:00
Rolf Bjarne Kvinge 303aa0a649 Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Rolf Bjarne Kvinge f6e0531197 Merge xcode11 into d16-3. 2019-09-12 08:29:02 +02:00
monojenkins 684642a926 [xcode11] [msbuild][xm][xi] Fix building with netstandard libraries (#6959)
* [msbuild] Use task assembly path via a property

Xamarin.Mac.Common.ImplicitFacade.msbuild.targets: $(_NETBuildExtensionsTaskAssembly)

* [msbuild] Fix path to NET.Build.Extensions task assembly

.. which is no longer available for `net46`. Instead use the latest
`net472` path.

The incorrect path effectively disabled the `GetDependsOnNETStandard`
task, causing the issue.

Partially fixes https://github.com/xamarin/xamarin-macios/issues/6552 .

* [msbuild] Fix XM builds which use netstandard libraries.

`Xamarin.Mac.Common.ImplicitFacade.msbuild.targets`:

`ImplicitlyExpandDesignTimeFacades` adds a reference to `netstandard.dll`
by expanding the facades, if any of the references depend on it. Usually,
this gets handled by msbuild SDKs but in case of XM, this doesn't happen
in all cases. So, we need to scan the references for a `netstandard`
dependency.

The `ResolveAssemblyReference` task does this for us and populates
`$(_DependsOnNETStandard)` property. If it does not, then we use
`GetDependsOnNETStandard` task to get the same information.

Issue:
- the target incorrectly uses `$(DependsOnNETStandard)` instead of
  `($_DependsOnNETStandard)`.
- Fixing that means that condition `$(_DependsOnNETStandard) == ''` fails
  whenever `ResolveAssemblyReference` task runs (setting the property
  to `true` or `false`), causing `$(XM_DependsOnNETStandard)` to be unset.
    - thus failing the following logic to expand the facades when `$(_DependsOnNETStandard) == true`

So, we use the `$(_DependsOnNETStandard)` as the default value for
`$(XM_DependsOnNETStandard)`, so that it is correctly set to `true`,
irrespective of how we got that information, allowing us to correctly
expand facades when required.

Partially fixes https://github.com/xamarin/xamarin-macios/issues/6552 .

* [msbuild] Fix XI builds which use netstandard libraries.

`Xamarin.iOS.Common.targets`:

Issue:
- the target incorrectly uses `$(DependsOnNETStandard)` instead of
`($_DependsOnNETStandard)`.
- Fixing that means that condition `$(_DependsOnNETStandard) == ''` fails
whenever `ResolveAssemblyReference` task runs (setting the property
to `true` or `false`), causing `$(XI_DependsOnNETStandard)` to be unset.
- thus failing the following logic to expand the facades when `$(_DependsOnNETStandard) == true`

So, we use the `$(_DependsOnNETStandard)` as the default value for
`$(XI_DependsOnNETStandard)`, so that it is correctly set to `true`,
irrespective of how we got that information, allowing us to correctly
expand facades when required.

Prompted by: https://github.com/xamarin/xamarin-macios/issues/6552
2019-09-10 22:58:24 -07:00
Chris Hamons 34134263cc [msbuild] Disable broken iOS msbuild tests (#6971)
- These tests depend on nib format that Xcode 11 GM broke
- https://github.com/xamarin/xamarin-macios/issues/6970
2019-09-11 01:03:11 -04:00
Ankit Jain 14559e35bd [msbuild][xm][xi] Fix building with netstandard libraries (#6667)
* [msbuild] Use task assembly path via a property

Xamarin.Mac.Common.ImplicitFacade.msbuild.targets: $(_NETBuildExtensionsTaskAssembly)

* [msbuild] Fix path to NET.Build.Extensions task assembly

.. which is no longer available for `net46`. Instead use the latest
`net472` path.

The incorrect path effectively disabled the `GetDependsOnNETStandard`
task, causing the issue.

Partially fixes https://github.com/xamarin/xamarin-macios/issues/6552 .

* [msbuild] Fix XM builds which use netstandard libraries.

`Xamarin.Mac.Common.ImplicitFacade.msbuild.targets`:

`ImplicitlyExpandDesignTimeFacades` adds a reference to `netstandard.dll`
by expanding the facades, if any of the references depend on it. Usually,
this gets handled by msbuild SDKs but in case of XM, this doesn't happen
in all cases. So, we need to scan the references for a `netstandard`
dependency.

The `ResolveAssemblyReference` task does this for us and populates
`$(_DependsOnNETStandard)` property. If it does not, then we use
`GetDependsOnNETStandard` task to get the same information.

Issue:
- the target incorrectly uses `$(DependsOnNETStandard)` instead of
  `($_DependsOnNETStandard)`.
- Fixing that means that condition `$(_DependsOnNETStandard) == ''` fails
  whenever `ResolveAssemblyReference` task runs (setting the property
  to `true` or `false`), causing `$(XM_DependsOnNETStandard)` to be unset.
    - thus failing the following logic to expand the facades when `$(_DependsOnNETStandard) == true`

So, we use the `$(_DependsOnNETStandard)` as the default value for
`$(XM_DependsOnNETStandard)`, so that it is correctly set to `true`,
irrespective of how we got that information, allowing us to correctly
expand facades when required.

Partially fixes https://github.com/xamarin/xamarin-macios/issues/6552 .

* [msbuild] Fix XI builds which use netstandard libraries.

`Xamarin.iOS.Common.targets`:

Issue:
- the target incorrectly uses `$(DependsOnNETStandard)` instead of
`($_DependsOnNETStandard)`.
- Fixing that means that condition `$(_DependsOnNETStandard) == ''` fails
whenever `ResolveAssemblyReference` task runs (setting the property
to `true` or `false`), causing `$(XI_DependsOnNETStandard)` to be unset.
- thus failing the following logic to expand the facades when `$(_DependsOnNETStandard) == true`

So, we use the `$(_DependsOnNETStandard)` as the default value for
`$(XI_DependsOnNETStandard)`, so that it is correctly set to `true`,
irrespective of how we got that information, allowing us to correctly
expand facades when required.

Prompted by: https://github.com/xamarin/xamarin-macios/issues/6552
2019-09-10 00:02:55 -07:00
Rolf Bjarne Kvinge ec09193daf
Build native code with -std=c++14. (#6864)
* Build native code with -std=c++14.

Apple's headers now require -std=c++14 to compile their headers in C++ mode.

This fixes a compile error that would occur with the PhotosUI framework when
compiling code for C++.

* [mmp] Use -std=c++14 when compiling.

* Fix command line output.

* [mmp] Add all source files at the end, so they all get the -x clang argument applied.

* Limit when using c++14 in mtouch according to language.
2019-08-29 08:49:06 -07:00
William Kent 3f3c8bce26 Add support for Apple Development certificates to Xamarin.Mac MSBuild (#6797)
Add Apple Development certificates to Mac DetectSigningIdentity task
2019-08-28 11:30:36 -04:00
Emanuel Fernandez Dell'Oca 616d6544ad [msbuild] Improve altool task by logging execution errors (#6815)
* [msbuild] Improve altool task by logging execution errors
The altool task was just logging the XML output produced by the tool execution but was not logging any build error neither failing in that case.

* [msbuild] Log the altool output when failing to parse it
2019-08-23 08:38:08 -07:00
Emanuel Fernandez Dell'Oca d859ceac6c [msbuild] Fixes publishing targets (#6824)
* [msbuild] Adds missing SessionId property to altool targets
Sets the missing SessionId property on the altool targets to enable running those from Visual Studio.

* [msbuild] Ensure Entitlements are compiled before creating an IPA

When creating an IPA from an archive the `CreateAppBundle` target will be skipped because we already have a bundle and the same will happen with the Entitlements compilation, but we need to re-compile those with the new certificate and profile. Adding `_CompileEntitlements` as a `CreateIpa` dependency will ensure it's run when creating an IPA file from an archive. Nothing changes when creating IPAs from a regular build since at the point the of creating the IPA the `_CompileEntitlements` target was already run, so it will be skipped.
2019-08-23 11:08:22 -04:00
Emanuel Fernandez Dell'Oca c391c6dbdd [xcode11][publishing] Added conditional behavior to CreateIpa and its dependencies (#6753)
* [publishing] Added conditional behavior to CreateIpa and its dependencies

The targets execution needs to change based on the 'IsAppDistribution' property value, which will be set from the IDE.
According to the value of this property, some dependencies should be run or should be skipped.
The strategy adopted is to use the BeforeTargets value because doing this way we will force the conditionals over '$(IsAppDistribution)' to be evaluated each time a target is attempted to be run.
The most intuitive way of doing it is by directly add DependsOnTargets and conditions on the PropertyGroup items, but doing this will not work because the IDE usually runs the targets when the MSBuild project is already loaded, which means that the properties have already been evaluated so they will not be evaluated again, which causes conditional values to be out of date.
The only way of making it work in these cases is by forcing the conditional evaluations of each target execution attempt, and that is accomplished by adding the conditions directly on the Target 'Condition' property.

* [publishing] Simplified targets by using DependsOn + conditions in existent targets

- Using BeforeTargets on `_BeforeCreateIpaForDistribution` made that target run even if `CreateIpa` was skipped because its condition was false, which is wrong. Instead of including that condition into `_BeforeCreateIpaForDistribution` it seems more reasonable to move it to the `CreateIpa` DependsOnTargets property group to avoid maintaining the same condition on both targets in future changes that could lead to errors.
- Removed `_BeforeCreateIpaForBuild` since it was an unnecessary extensibility point and made the `CreateIpa` dependencies more complicated.
- We still need `_BeforeCreateIpaForDistribution` and `_BeforeCreateIpaForDistributionDependsOn` as extensibility point for the publishing workflow on VS.
- Simplified the previous approach by removing unnecessary targets and dependencies when the only thing needed was just the following condition on existent targets: `'$(IsAppDistribution)' != 'true'`. For instance, removed `_BeforeCodeSignForBuild` and included the mentioned condition into `_CreateAppBundle`. The purpose of `_BeforeCodeSignForBuild` was just skipping `_CreateAppBundle` for distribution builds, but it made the targets more complicated to understand and maintain.
- Same thing applies to `_BeforeCollectFrameworksForBuild` and `_BeforeCodesignNativeLibrariesForBuildDependsOn` which were just skipping the `_CompileToNative` target for distribution builds.
2019-08-16 11:00:20 +02:00
Rolf Bjarne Kvinge 1e15472b49
[tests][msbuild] Tweak NativeReferencesNoEmbedding test to work with a locally built mtouch. (#6660)
When building mtouch locally, this will be the mtouch path:

    /path/to/somewhere/xamarin-macios/_ios-build//Library/Frameworks/Xamarin.iOS.framework/Versions/git/bin/mtouch
2019-08-14 13:21:52 +02:00
Timothé Larivière 286f0cb271 Add correct casing for Microsoft.FSharp.targets (#6722)
* Add correct casing for Microsoft.FSharp.targets

* Correct fix
2019-08-14 13:20:32 +02:00
Oleg Demchenko 4d905a8914
Update msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
Co-Authored-By: Vincent Dondain <vidondai@microsoft.com>
2019-08-07 17:29:12 -04:00
Oleg Demchenko 3b293f5afe [vsts-938452] Add ALToolTaskBase.cs to Xamarin.MacDev.Tasks.Core.csproj 2019-08-07 16:10:32 -04:00