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

917 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge d5b91781dd [msbuild] Don't pass a reference to mscorlib.dll to bgen.
In .NET there's no mscorlib.dll next to the platform assembly. bgen will find it
anyway when needed if it's not passed explicitly, so just don't pass it.
2020-08-10 16:12:41 +02:00
Rolf Bjarne Kvinge d96827cd89
[msbuild] Share the _CompileEntitlements target. (#9323)
Use two separate output variables (EntitlementsInExecutable/EntitlementsInSignature)
instead of using the same output variable for two different purposes. This makes
the code more self-explanatory.

Also move the simulator check to the C# code, that way it's easier to re-use elsewhere.

* [msbuild] Share the _CompileEntitlements task.

* [msbuild] Create the same class hierarchy for Xamarin.Mac and Xamarin.iOS for the CompileEntitlements task.

    CompileEntitlementsTaskBase
    └─── iOS/CompileEntitlementsTaskCore
    │    └─── iOS/CompileEntitlements
    └─── Mac/CompileEntitlementsTaskCore
         └─── Mac/CompileEntitlements

This also means we can remove a known failure in the list of MSBuild tasks that don't
conform to our 'no code in final task implementation' requirements.
2020-08-10 13:55:54 +02:00
monojenkins 9732d10b3b
Make sure to Uri escape paths (#9311)
If the path to the project or compiled app has spaces, then the URI
that is generated for the on-demand resources in the
AssetPackManifestTemplate.plist file is invalid

Fixes https://github.com/xamarin/xamarin-macios/issues/8452

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
2020-08-07 14:50:03 -04:00
Rolf Bjarne Kvinge 06fec85900
[msbuild] Move Xamarin.iOS' implementation of the PrepareResourceRules task to Xamarin.MacDev.Tasks. (#9318) 2020-08-07 14:54:38 +02:00
Rolf Bjarne Kvinge 4f8afa575d
[msbuild] Create a few '_*DependsOn' variables that specifies depend targets. (#9305)
The .NET logic will inject an additional dependencies in these variables.
2020-08-07 14:53:49 +02:00
Rolf Bjarne Kvinge 9be9a9a4b6
[msbuild] Compute variables for where the platform assembly is, and the platform assembly name. (#9304)
This will be more useful later, because these variables will be used in more places
in the .NET code.
2020-08-07 14:53:30 +02:00
Rolf Bjarne Kvinge fd5d82da6b
[msbuild] Pass the full path to the output file to the native linker. (#9295)
This makes it easier to copy-paste commands to debug them.
2020-08-07 14:53:15 +02:00
Rolf Bjarne Kvinge be095c5a26
[msbuild] Make sure to restore the binding project before trying to build it. (#9288)
Fixes numerous build failures like this:

    The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)
    The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)
    The type or namespace name 'NUnit' could not be found (are you missing a using directive or an assembly reference?)
    The type or namespace name 'TestFixtureAttribute' could not be found (are you missing a using directive or an assembly reference?)
    The type or namespace name 'TestFixtureAttribute' could not be found (are you missing a using directive or an assembly reference?)
2020-08-06 16:02:12 +02:00
Rolf Bjarne Kvinge 58e10cbf39
[msbuild] Fix arguments to error logging for GetMinimumOSVersionTask. (#9248)
The filename arguments to the error logging must be strings, otherwise the
wrong logging overload is picked, and the resulting error message makes no
sense.
2020-07-31 15:21:13 +02:00
Rolf Bjarne Kvinge d9295b12ef
[msbuild] Default 'BundlerDebug' to 'true' if no other option is set and we're building for a 'Debug' configuration. (#9247)
It's somewhat of a breaking change, since previously Xamarin.Mac would default
to 'false' if no value was set. It should be exceedingly rare though, since
it's set in all the template projects.

It makes the behavior a bit more intuitive for .NET projects, since then the
values might not be set because of the simplified project files.
2020-07-31 15:21:02 +02:00
monojenkins 6f5adef8ef
Make sure to Uri escape paths (#9212)
If the path to the project or compiled app has spaces, then the URI
that is generated for the on-demand resources in the
AssetPackManifestTemplate.plist file is invalid

Fixes https://github.com/xamarin/xamarin-macios/issues/8452

Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
2020-07-29 08:07:50 +02:00
Matthew Leibowitz 6416d06407
Make sure to Uri escape paths (#9198)
If the path to the project or compiled app has spaces, then the URI
that is generated for the on-demand resources in the
AssetPackManifestTemplate.plist file is invalid

Fixes https://github.com/xamarin/xamarin-macios/issues/8452
2020-07-29 08:07:37 +02:00
Rolf Bjarne Kvinge f6aaa6622e
[xharness] Only have a single project per directory (#9149)
We're starting to use NuGet (packages) more and more, and NuGet stores
information about any package references in the bin/obj directories. This
means that if a directory has multiple project files, NuGet will get quite
confused because it will use the wrong package information half the time.

There are steps that can be taken to make NuGet write its package information
in different directories, but this becomes quite cumbersome to keep
up-to-date, and it's confusing when it breaks. It's much easier to just have a
blanket rule that there shouldn't be more than one project per directory.

However, it did require quite a few changes to xharness to fix assumptions
about where files are located.
2020-07-28 17:31:56 +02:00
Rolf Bjarne Kvinge 84a6b63ffe
[msbuild] Fix automatic stripping of release builds by using the correct variable. (#9202) 2020-07-28 09:12:37 +02:00
Chris Hamons b101d7e8b9
Add support for arbitrary extensions to be bundled in XI/XM apps (#9048) (#9107)
- This commit adds a hook, "AdditionalAppExtensions", to the msbuild to allow
extensions written in other languages, such as Swift, to be embedded and signed in an
Xamarin App bundle easily.
- Example:
<AdditionalAppExtensions Include="$(MSBuildProjectDirectory)/../../native">
	<Name>NativeTodayExtension</Name>
	<BuildOutput Condition="'$(Platform)' == 'iPhone'">build/Debug-iphoneos</BuildOutput>
	<BuildOutput Condition="'$(Platform)' == 'iPhoneSimulator'">build/Debug-iphonesimulator</BuildOutput>
</AdditionalAppExtensions>
2020-07-27 09:27:19 -05:00
Rolf Bjarne Kvinge b5a1251592 Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project 2020-07-27 11:20:16 +02:00
monojenkins 25b8cbe22b
[msbuild] Makes the xcarchive folder name culture independent (#9175)
Fixes https://developercommunity.visualstudio.com/content/problem/934833/xamarinforms-cant-create-archive-for-ios.html

Depending on the default language of the running OS this could cause translating AM/PM to symbols that are not supported on folder names on Windows.

For instance, the value of `timestamp` without this change for an user that sets Chinese as it's main language would be `8-18-15 1.31 下午`, where `下午` represent PM.

Co-authored-by: emaf <ema@xamarin.com>
2020-07-24 09:15:47 +02:00
Emanuel Fernandez Dell'Oca 62ab588d04
[msbuild] Makes the xcarchive folder name culture independent (#9174)
Fixes https://developercommunity.visualstudio.com/content/problem/934833/xamarinforms-cant-create-archive-for-ios.html

Depending on the default language of the running OS this could cause translating AM/PM to symbols that are not supported on folder names on Windows.

For instance, the value of `timestamp` without this change for an user that sets Chinese as it's main language would be `8-18-15 1.31 下午`, where `下午` represent PM.
2020-07-24 09:15:17 +02:00
Rolf Bjarne Kvinge 8b9bfe2877
[dotnet] Add Verbosity to the linker configuration. (#9169) 2020-07-23 18:07:05 +02:00
Rolf Bjarne Kvinge 4a2236f7e0 Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project 2020-07-23 15:37:06 +02:00
Rolf Bjarne Kvinge 8ecc47d088
[msbuild] Share the logic to implicitly include netstandard.dll in the build. (#9146)
In addition to the obvious benefit of reducing code duplication, this also
means that implicit inclusion of netstandard.dll works for binding projects as
well.

The existing implementations were slightly different between Xamarin.iOS and
Xamarin.Mac, so I tried to figure out the best merging strategy based on git
history and looking at the original implementation of this code in MSBuild. I
tried to keep close to the original implementation whenever I couldn't find a
good reason to do otherwise.
2020-07-22 14:57:35 +02:00
Rolf Bjarne Kvinge bdada6e21b Merge remote-tracking branch 'origin/main' into xharness-a-directory-per-project 2020-07-22 10:36:23 +02:00
Rolf Bjarne Kvinge 92a9aacbd3 [msbuild][tests] Adjust the BindingProject test according to the relocation of bindings-test.csproj.
Also remove the BindingProject.FrameworkTest, it's 100% identical to
BindingProject.BuildTest, and thus redundant.
2020-07-22 09:07:22 +02:00
monojenkins ffa84c9a1f
[msbuild] Avoids running GetMinimumOSVersion if no Mac is connected (#9144)
`GetMinimumOSVersion` should not be run if there's no Mac available because it depends on `_DetectSdkLocations` to calculate the value of `_SdkVersion`, and this will only happen if there's a Mac connected. This change fixes offline builds (plain IL builds) and Hot Restart builds on Windows.

Co-authored-by: emaf <ema@xamarin.com>
2020-07-22 08:27:14 +02:00
emaf 72b8de060b [msbuild] Avoids running GetMinimumOSVersion if no Mac is connected
`GetMinimumOSVersion` should not be run if there's no Mac available because it depends on `_DetectSdkLocations` to calculate the value of `_SdkVersion`, and this will only happen if there's a Mac connected. This change fixes offline builds (plain IL builds) and Hot Restart builds on Windows.
2020-07-21 17:03:06 -03:00
monojenkins 6bbcfd4c78
[main][msbuild] Changes GetMinimumOSVersionTaskBase to use ITaskItem for inputs (#9135)
* [msbuild] Changes GetMinimumOSVersionTaskBase to use ITaskItem for inputs

From Visual Studio we need the input files to be  instead of plain strings to identify the files that need to be copied to the Mac

* Adds null check for AppManifest in GetMinimumOSVersionTaskBase

Co-authored-by: emaf <ema@xamarin.com>
2020-07-21 08:31:28 +02:00
Emanuel Fernandez Dell'Oca 914cdaa26a
[d16-8][msbuild] Changes GetMinimumOSVersionTaskBase to use ITaskItem for inputs (#9134)
* [msbuild] Changes GetMinimumOSVersionTaskBase to use ITaskItem for inputs

From Visual Studio we need the input files to be  instead of plain strings to identify the files that need to be copied to the Mac

* Adds null check for AppManifest in GetMinimumOSVersionTaskBase
2020-07-21 08:29:59 +02:00
Chris Hamons 5657a63539
Add support for arbitrary extensions to be bundled in XI/XM apps (#9048)
- This commit adds a hook, "AdditionalAppExtensions", to the msbuild to allow
extensions written in other languages, such as Swift, to be embedded and signed in an
Xamarin App bundle easily.
- Example:
<AdditionalAppExtensions Include="$(MSBuildProjectDirectory)/../../native">
	<Name>NativeTodayExtension</Name>
	<BuildOutput Condition="'$(Platform)' == 'iPhone'">build/Debug-iphoneos</BuildOutput>
	<BuildOutput Condition="'$(Platform)' == 'iPhoneSimulator'">build/Debug-iphonesimulator</BuildOutput>
</AdditionalAppExtensions>
2020-07-16 10:13:15 -05:00
monojenkins 22ff73b52c
[msbuild] Allow overriding CompileAppManifestTaskBase Execute method (#9090)
If the Execute method of a task is sealed the Windows side tasks won't be able to "inject" the code that executes the tasks remotely.

Co-authored-by: emaf <ema@xamarin.com>
2020-07-15 16:50:48 +02:00
Rolf Bjarne Kvinge 0bf816ab47
Add AutoFill CredentialProvider NSExtensionPoint support (#9079)
* Fix unrecognized extension build warning for credential providers

* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@af50d97 Add AutoFill CredentialProvider NSExtensionPoint support (#75) (#77)

Diff: 7e9075cab0..af50d97218

* Add IDE deployment target for credential provider

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

Co-authored-by: kiddailey <kiddailey@users.noreply.github.com>
2020-07-15 09:00:16 +02:00
Rolf Bjarne Kvinge fb0615d065
Add AutoFill CredentialProvider NSExtensionPoint support (#9078)
* Fix unrecognized extension build warning for credential providers

* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@8208733 Add AutoFill CredentialProvider NSExtensionPoint support (#75) (#76)

Diff: a1bc6f39b3..8208733cd6

* Add IDE deployment target for credential provider

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

Co-authored-by: kiddailey <kiddailey@users.noreply.github.com>
2020-07-15 08:59:59 +02:00
Emanuel Fernandez Dell'Oca f6391e7522
[msbuild] Allow overriding CompileAppManifestTaskBase Execute method (#9088)
If the Execute method of a task is sealed the Windows side tasks won't be able to "inject" the code that executes the tasks remotely.
2020-07-15 07:56:05 +02:00
Matthew Leibowitz b70d25d011
Include assembly refs in _CompileToNative Inputs (#9071)
* Include assembly refs in _CompileToNative Inputs

Fixes #9014

* Unify with iOS

Sort of match this: 64c63279b3/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets (L573-L595)

* Update Xamarin.Mac.Common.targets
2020-07-14 14:54:26 +02:00
Rolf Bjarne Kvinge b46aae7fd6
[msbuild] Make the ParseExtraMtouchArgs task platform-agnostic, and share it between Xamarin.iOS and Xamarin.Mac. (#9061)
* Change the parsing code slightly, to make it easier to parse other arguments
  (coming soon).
* Add the parsing task to Xamarin.Mac projects, and use it there as well. The
  parsed result isn't used yet, but it will be soon.
* Unify a few related MSBuild properties (MtouchNoSymbolStrip and
  MtouchNoDSymUtil).
2020-07-13 14:56:34 +02:00
kiddailey 97d09a7b24
Add AutoFill CredentialProvider NSExtensionPoint support (#9030)
* Fix unrecognized extension build warning for credential providers

* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@5e08f5f Add AutoFill CredentialProvider NSExtensionPoint support (#75)

Diff: a1bc6f39b3..5e08f5f2fd

* Add IDE deployment target for credential provider

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-07-13 14:50:23 +02:00
Rolf Bjarne Kvinge e193ed7316
[msbuild] Unify all the UsingTask statements. (#8998)
Some of these have been duplicated across various targets files, and when
adding a new task it's annoying to forget to add it somewhere.

So just have them all in the same place, so that they're loaded in every file.

There are still duplicates between the iOS and Mac tasks, but those will be
unified in a later PR.
2020-07-07 15:52:06 +02:00
Rolf Bjarne Kvinge ac36305a2d
[msbuild] Unify the _GenerateBindings target and a few properties related to binding projects. (#8997) 2020-07-07 15:46:23 +02:00
Rolf Bjarne Kvinge 4e2d612dae
[msbuild] Unify XamarinMacFrameworkRoot and MonoTouchSdkRoot into _XamarinSdkRoot. (#8995) 2020-07-07 15:45:42 +02:00
Rolf Bjarne Kvinge 6f6b8e281b Merge remote-tracking branch 'origin/main' into dotnet-xharness-introspection 2020-07-03 11:12:50 +02:00
Rolf Bjarne Kvinge 8d7cd46652
[msbuild] Share a few binding variables: BaseLibDllPath, BTouchToolPath and BTouchToolExe. (#8988)
Also switch to invoking bgen instead of the btouch-native/btv/bwatch wrapper
scripts, since the wrapper scripts just call bgen with an additional
--target-framework argument, which our BTouch task already does anyway, which
means it's not necessary to call the wrapper scripts anymore.

This also required:

* Moving the code to detect which Xamarin.Mac profile we're building for into
  Xamarin.Shared.props, since the binding variable logic need to know which
  Xamarin.Mac profile we're building for.

* Setting IsBindingProject property earlier in the build process, to make sure
  it's set before importing Xamarin.Shared.props.
2020-07-03 11:01:01 +02:00
Rolf Bjarne Kvinge 4eff2c3700
[msbuild] Unify the logic to copy bundle resources to the app. (#8987)
* For Xamarin.Mac, this means using the _ComputeBundleResourceOutputPaths and
  _CopyResourcesToBundle targets from Xamarin.iOS instead of the
  _CopyContentToBundle target (which is now unused and thus removed).

* Adapt the Xamarin.iOS logic (now shared) to handle the fact that the
  resources shouldn't always go into the root appbundle directory (since they
  go into Contents/Resources/ for macOS apps), by using the
  '_AppResourcesPath' variable to specify just this.

Once upon a time the Xamarin.iOS logic was identical to the Xamarin.Mac logic,
but then we implemented support for asset packs
(a98693f07e)
and the code diverged. This means that unifying the logic again is a step
towards making asset packs work for Xamarin.Mac apps.
2020-07-03 11:00:36 +02:00
Rolf Bjarne Kvinge 4ed68336d7
[msbuild] Share the MSBuild logic for CollectBundleResources and a few related properties. (#8983)
* [msbuild] Share the MSBuild logic for CollectBundleResources and a few related properties.

* [msbuild] Fix/unify more resource collection code.

* Remove the _CollectBundleResources target for Xamarin.iOS binding projects,
  we now have a single one for all project types.
* Add an IsBindingProject property to distinguish binding projects from other
  projects.
* Use the IsBindingProject to only depend on the other _Compile<ResourceType>
  targets when we're not building a binding project (which seems to be the
  reason why the _CollectBundleResources target was duplicated between normal
  projects and binding projects for both Xamarin.iOS and Xamarin.Mac: the
  binding project version didn't have any dependencies).
2020-07-01 20:13:05 +02:00
Rolf Bjarne Kvinge 7e4813b8c6 [dotnet] Use the same MSBuild items to specify both weakly and normally linked frameworks.
This is a slight performance improvements when loading the list of frameworks
the managed linker produces, because the MSBuild logic can only load one item
group per file, and if we use two differently named item groups, we'd have to
store weakly and normally linked frameworks in different files.

This way we can store both types of frameworks in a single file.
2020-06-30 19:01:07 +02:00
Sebastien Pouliot f427b5e91d
[xcode12] Bump for beta 1 (#8935)
Known issues https://github.com/xamarin/xamarin-macios/issues/8943
2020-06-26 14:02:44 -04:00
monojenkins b18b4dcdca
[msbuild] Dispose the AssemblyBuilder in the UnpackLibraryResource when done with it. (#8949)
This will ensure the file isn't kept open until the GC runs, and then
sometimes it can prevent other tasks or targets from opening it if the GC
hasn't run.

Fixes this problem:

    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 1 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 2 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 3 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 4 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 5 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 6 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 7 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 8 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 9 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 10 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): error MSB3027: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Exceeded retry count of 10. Failed.
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): error MSB3021: Unable to copy file "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll

Fixes https://github.com/xamarin/maccore/issues/2137.
Fixes https://github.com/xamarin/xamarin-macios/issues/8940.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-06-25 20:58:11 -04:00
Rolf Bjarne Kvinge e775850489
[msbuild] Dispose the AssemblyBuilder in the UnpackLibraryResource when done with it. (#8941)
This will ensure the file isn't kept open until the GC runs, and then
sometimes it can prevent other tasks or targets from opening it if the GC
hasn't run.

Fixes this problem:

    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 1 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 2 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 3 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 4 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 5 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 6 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 7 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 8 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 9 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): warning MSB3026: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Beginning retry 10 in 1000ms. Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): error MSB3027: Could not copy "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Exceeded retry count of 10. Failed.
    /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/Microsoft.Common.CurrentVersion.targets(4203,5): error MSB3021: Unable to copy file "obj/Debug/Fantas.dll" to "../../../lib/Debug/MonoGame/xamarinios/Fantas.dll". Sharing violation on path [...]/lib/Debug/MonoGame/xamarinios/Fantas.dll

Fixes https://github.com/xamarin/maccore/issues/2137.
Fixes https://github.com/xamarin/xamarin-macios/issues/8940.
2020-06-25 15:23:10 +02:00
Rolf Bjarne Kvinge 085a74286b [dotnet] Add an @executable_path rpath for the main executable. 2020-06-19 18:07:00 +02:00
Rolf Bjarne Kvinge 8a65236c4d [dotnet] Link the executable with libxamarin. 2020-06-19 18:06:59 +02:00
Rolf Bjarne Kvinge c53e96f48d [dotnet] Figure out where the xamarin include directory is, and pass it as an include directory when compiling the main code. 2020-06-19 18:06:59 +02:00
Rolf Bjarne Kvinge 53c285c097
Merge pull request #8887 from rolfbjarne/dotnet-linker-generate-main
[dotnet] Generate a main function, and use it to compile the main executable.
2020-06-19 17:45:05 +02:00
Rolf Bjarne Kvinge b39bd0e420
[msbuild] Make sure all the Base/Core tasks are abstract. (#8888)
Also add a cecil test ensure our leaf MSBuild tasks don't have code.
2020-06-19 17:40:18 +02:00
Rolf Bjarne Kvinge a6d9678260 [dotnet] Add a LinkNativeCode task and link the output from the CompileNativeCode task into a main executable. 2020-06-18 15:57:02 +02:00
Rolf Bjarne Kvinge 8594af3b2c [dotnet] Add a CompileNativeCode task and compile the generated main code into object files. 2020-06-18 15:57:01 +02:00
Rolf Bjarne Kvinge 6bc03419fa
[msbuild] Unify the CompileAppManifest target. (#8875)
Also rework the class hierarchy a little bit, so that Xamarin.iOS and
Xamarin.Mac are identical:

    CompileAppManifestTaskBase
    └─── iOS/CompileAppManifestTaskCore
    │    └─── iOS/CompileAppManifest
    └─── Mac/CompileAppManifestTaskCore
        │    └─── Mac/CompileAppManifest
2020-06-18 15:46:45 +02:00
Rolf Bjarne Kvinge d8cd95d4e1
[msbuild] Split out min version argument calculation from MetalTask. (#8876) 2020-06-18 15:17:33 +02:00
Rolf Bjarne Kvinge c3bcfac582
Unify code for executing processes. (#8848)
* Create a simple Xamarin.Utils.Execution class that can handle all our
  process execution needs:
    * Captures or streams stdout/stderr (in UTF8).
    * Supports async
    * Supports a timeout
    * Does not depend on any other source file we have, only uses BCL API.
* Have the execution helper classes from mtouch/mmp
  (Xamarin.BundlerDriver.RunCommand) and the tests
  (Xamarin.Tests.ExecutionHelper) use this new class.
* Some simplifications were made:
    * All API that took a string array for the environment now takes a
      Dictionary<string, string>.
    * The Driver.RunCommand methods were split out to a separate file. This
      file also contains a Verbosity field, which is conditioned on not being
      in mtouch nor mmp, which makes including this file from other projects
      simpler (such as bgen - in particular bgen was modified to use this
      Verbosity field instead of its own).
2020-06-18 12:34:07 +02:00
Rolf Bjarne Kvinge 6ced972a68
[msbuild] Add a GetMinimumOSVersion target that reads the app manifest and outputs the MinimumOSVersion. (#8858)
This makes it possible for several other tasks to take the MinimumOSVersion as
direct input, instead of the app manifest's path. Previously the app manifest
(Info.plist) was loaded and parsed in each task, slightly differently in each
place, and in addition there are differences between macOS and other
platforms, which made it even worse. This code refactoring also made it
possible to remove an error code which wasn't necessary anymore.

This task also computes the default MinimumOSVersion if none is specified in
the app manifest.

There is one breaking change: a library project could previously specify an
inexistent Info.plist, and it would build fine. This will now result in a
"Error loading 'Info.plist': File not found" error. This is trivial to fix:
just remove the Info.plist from the project file (or an alternative solution
could be to condition the inclusion of the Info.plist in the project file on
the existence of the Info.plist).

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@a1bc6f3 [Xamarin.MacDev] Split IAppleSdkVersion.TryParse in two methods. (#73)

Diff: 45c5a680e2..a1bc6f39b3
2020-06-16 17:40:04 +02:00
Rolf Bjarne Kvinge fbdd1b8e3f
[msbuild] Share the DeviceSpecificIntermediateOutputPath property. (#8854)
* [msbuild] Share the DeviceSpecificIntermediateOutputPath property.

We don't technically need this value for Xamarin.Mac, but many of the targets
that can be shared need to use this for Xamarin.iOS, so set this value for
Xamarin.Mac as well. It will always be the default IntermediateOutputPath for
Xamarin.Mac, while for Xamarin.iOS it might be changed in
_ComputeTargetArchitectures.

* [msbuild] Remove usage in Xamarin.Mac of a variable that was always empty in the past.
2020-06-16 17:39:47 +02:00
Rolf Bjarne Kvinge 8cbf44f55c
[msbuild] Unify MtouchDebug and MmpDebug into _Debug. (#8832)
* [msbuild] Unify MtouchDebug and MmpDebug into _Debug.

* [msbuild] Use _BundlerDebug instead of _Debug.

_Debug is too generic, and more likely to clash with someone else.
2020-06-15 09:17:17 +02:00
Rolf Bjarne Kvinge 75341a9f20
[msbuild/tests] Set MSBUILD_EXE_PATH when running unit tests from within VS. Fixes #5042. (#8846)
Also fix several tests to work when executed from within VS due to some difference

There's also a change to the MtouchTask: lookup of framework assemblies won't
succeed anymore if the path to the assembly is just an unrooted filename
(which may happen to be a file in the current directory (as a test proved
accidentally) - in which case it will never be a framework assembly).

Unfortunately this won't make all tests pass, around 20 tests will still fail with:

     #RunTarget-ErrorCount
    	The "GetReferenceNearestTargetFrameworkTask" task could not be instantiated from the assembly "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/NuGet.Build.Tasks.dll". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Specified cast is not valid.
    	The "GetReferenceNearestTargetFrameworkTask" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.
      Expected: 0
      But was:  2

but I couldn't figure out how to fix these errors.

Fixes https://github.com/xamarin/xamarin-macios/issues/5042.
2020-06-15 09:16:39 +02:00
monojenkins a34eba7e61
[d16-7] [src] Remove the remaining Classic code. (#8820)
* [src] Remove Classic code from System.Net.Http.

* [src] Remove Classic code from the ObjCRuntime namespace.

* [src] Remove Classic code from the native types.

* [src] Remove the Classic defines from the makefiles.

* [src] Remove Classic code from the Constants class.

* [src] Update project files to remove XAMCORE_2_0 and __UNIFIED__.

* [src] Remove Classic code from the MonoNativeFunctionWrapper and MonoPInvokeCallback attributes.

* [src] Update README to remove outdated docs about XAMCORE_2_0.

* [d16-7] [registrar] Remove Classic Code.

* Bump Touch.Unit.

New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@358b283 Remove code to be compatible with MonoTouch (Classic Xamarin.iOS). (#59)

Diff: 9db795d50d..358b283b64

* [src] NUnitLite still needs the XAMCORE_2_0 and __UNIFIED__ defines.

They still have conditional code with those defines:
a977ca5757/NUnitLite-1.0.0/src/framework/Constraints/Numerics.cs (L57)

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-06-11 19:25:18 +02:00
Rolf Bjarne Kvinge 0a870c0a1e
[msbuild] Rename a few CodeSign* variables to Codesign* variables to make Xamarin.iOS and Xamarin.Mac code identical. (#8831)
This is just a case difference in the variable name, and MSBuild properties
are case-insensitive, so this has no functional effect.
2020-06-11 16:34:57 +02:00
Rolf Bjarne Kvinge 5cd7044040
[msbuild] Remove version comparisons that will always have the same result by now. (#8833)
* We require Xcode 6+,, so remove checks for older Xcode versions.
* We require iOS 6+, so remove checks for older iOS versions.
* We don't need to check the Xamarin.iOS version, since we're shipping
  together (code checking Xamarin.iOS version is leftover from when the
  MSBuild tasks were shipped with Xamarin Studio).

This also allowed us to remove an error (and the corresponding message).
2020-06-11 16:00:44 +02:00
Rolf Bjarne Kvinge f0581a4ab0
[src] Remove the remaining Classic code. (#8819)
* [src] Update project files to remove XAMCORE_2_0 and __UNIFIED__.

* [src] Update README to remove outdated docs about XAMCORE_2_0.

* [src] Remove Classic code from System.Net.Http.

* [src] Remove Classic code from the ObjCRuntime namespace.

* [src] Remove Classic code from the native types.

* [src] Remove the Classic defines from the makefiles.

* [src] Remove Classic code from the Constants class.

* [src] Remove Classic code from the MonoNativeFunctionWrapper and MonoPInvokeCallback attributes.

* [src] NUnitLite still needs the XAMCORE_2_0 and __UNIFIED__ defines.

They still have conditional code with those defines:
a977ca5757/NUnitLite-1.0.0/src/framework/Constraints/Numerics.cs (L57)
2020-06-10 19:12:37 +02:00
Rolf Bjarne Kvinge 767169e61a
[msbuild] Move the TargetArchitecture to Xamarin.MacDev.Tasks so that it can be used everywhere. (#8821) 2020-06-10 15:40:43 +02:00
Rolf Bjarne Kvinge 9492308820
[msbuild] Remove duplicate NativeReferenceKind enum. (#8812) 2020-06-10 09:09:53 +02:00
Rolf Bjarne Kvinge 462bc41173
[msbuild] We have a top-level editor config now, so use that. (#8811) 2020-06-10 09:09:43 +02:00
Rolf Bjarne Kvinge b3d166edb5
[msbuild] Remove the support for faking the watchOS 4.3 SDK. (#8813)
It's not needed, this was a workaround for an issue with the App Store to get
around an ARM64_32 requirement if building with the watchOS 4.3 SDK. The App
Store does not allow shipping apps built with the watchOS 4.3 SDK anymore, so
this workaround is not useful now.
2020-06-09 15:48:58 +02:00
Rolf Bjarne Kvinge 801a37f637
[msbuild] Unify MtouchArch and XamMacArch into TargetArchitectures. (#8797)
* [msbuild] Unify MtouchArch and XamMacArch into TargetArchitectures.

* [msbuild] Use $(ComputedPlatform) instead of $(_Platform).

They're identical, and this avoids using $(_Platform) before it's defined.
2020-06-09 14:28:36 +02:00
Rolf Bjarne Kvinge bc2db4c60a
[msbuild] Share the _DetectSigningIdentity target. (#8785)
Also rework the class hierarchy a little bit, so that Xamarin.iOS and
Xamarin.Mac are identical:

	DetectSigningIdentityTaskBase
	└─── iOS/DetectSigningIdentityTaskCore
	│    └─── iOS/DetectSigningIdentity
	└─── Mac/DetectSigningIdentityTaskCore
	│    └─── Mac/DetectSigningIdentity
2020-06-08 08:58:59 +02:00
Rolf Bjarne Kvinge f80bacf042
[msbuild] Share the _DetectSdkLocations target. (#8755) 2020-06-05 17:08:02 +02:00
Rolf Bjarne Kvinge 3c873f944e
[msbuild] Unify CodesignKey and CodeSigningKey into _SpecifiedCodesignKey. (#8758) 2020-06-05 17:07:25 +02:00
Rolf Bjarne Kvinge d8ae295901
[msbuild] Unify MtouchLink and LinkMode info _LinkMode. (#8764) 2020-06-05 17:07:16 +02:00
Rolf Bjarne Kvinge 7369b5edfb
[msbuild] Unify _RequireCodeSigning and EnableCodeSigning into _RequireCodeSigning. (#8743) 2020-06-04 15:17:32 +02:00
Rolf Bjarne Kvinge f7e95a0fd5
[msbuild] Share _ComputeTargetArchitectures and use the output variables for both Xamarin.iOS and Xamarin.Mac. (#8751) 2020-06-04 15:00:28 +02:00
Rolf Bjarne Kvinge 7c1e51b5eb
[msbuild] Unify the _DetectAppManifest target. (#8745)
There's one difference for Xamarin.Mac library projects: they'll now have the
ability to use an Info.plist to specify a minimum OS version that will be used
when compiling storyboards and other compilable files.

This is the way it's worked for Xamarin.iOS projects for a long time.
2020-06-04 09:14:58 +02:00
Rolf Bjarne Kvinge dbe9d43c7c
[msbuild] Unify MtouchSdkVersion and MacOSXSdkVersion into _SdkVersion. (#8734) 2020-06-03 19:24:36 +02:00
Rolf Bjarne Kvinge 3f44925f23
[msbuild] Share the _ComputeTargetFrameworkMoniker target. (#8739) 2020-06-03 19:24:09 +02:00
Jonathan Peppers 4e37ecf65c
[msbuild] missing localization comments - part 3 (#8721)
Fixes: https://github.com/xamarin/xamarin-macios/issues/8468

Added missing `<comment/>` fields for:

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

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

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

This also removed an argument passed into `string.Format`.
2020-06-02 13:57:11 -05:00
Rolf Bjarne Kvinge 375118331a
[msbuild] Unify XamMacResourcePrefix and IPhoneResourcePrefix into _ResourcePrefix. (#8726) 2020-06-02 16:41:44 +02:00
Rolf Bjarne Kvinge bf34d86323
[msbuild] Add a Xamarin.Shared.props. (#8711)
It's empty for now, but soon enough it will start getting shared
Xamarin.iOS/Xamarin.Mac code.
2020-06-02 14:26:25 +02:00
Rolf Bjarne Kvinge 2fdd7451b9
[dotnet] Inject logic into the Build target to put resolved assemblies and dylibs into the .app. (#8715)
Inject logic into the Build target to start creating the app bundle:

* Make sure the pre-existing list of targets (CreateAppBundleDependsOn) to
  create an app bundle is not evaluated.
* Create a new CreateAppBundleDependsOn variable that contains the new targets
  we want to run to create the app bundle for net5.
* Call the built-in publishing targets to copy files to the publish directory
  (ComputeFilesToPublish / CopyFilesToPublishDirectory).
* Add a target that rewrites the publish directory for assemblies and dylibs
  to put them in the app bundle instead.
2020-06-01 17:52:19 +02:00
Rolf Bjarne Kvinge c9d6d4ca13
[msbuild] Share some of the code signing targets between Xamarin.Mac and Xamarin.iOS. (#8710) 2020-06-01 10:23:17 +02:00
Rolf Bjarne Kvinge aec9c93bee
[dotnet] Add tests for our various platforms. (#8708)
* [tests] Add a unit test project to test our net5 support.

* [tests] Fix clearing environment variables when launching processes.

* [tests] Add net5 macOS test app.

* [tests] Add net5 tvOS test app.

* [tests] Add net5 watchOS test app.

* [msbuild] Exclude CreateAppBundleDependsOn from net5 builds as well.

* [msbuild] We're not required to know the signing identity to figure out the app extension bundle name.
2020-05-29 17:58:34 +02:00
Rolf Bjarne Kvinge bebbeb18a3
[msbuild] Improve xharness and makefiles make it easier to run both iOS and Mac MSBuild tests. (#8709)
It even looks like running the Xamarin.Mac MSBuild tests from the command line
has never worked... so fix that as well.
2020-05-29 17:50:46 +02:00
Rolf Bjarne Kvinge 2ffe11cb9e
[msbuild] Share the _CreateAppBundle task between Xamarin.Mac and Xamarin.iOS. (#8694)
There is a difference for Xamarin.Mac: the task will not be executed anymore
if IsAppDistribution is set to true. Given that IsAppDistribution is not used
in Xamarin.Mac projects, this is likely a rather uncommon case, and the
potential for breaking behavior is outweighed by the advantage of having the
same behavior for Xamarin.iOS and Xamarin.Mac.
2020-05-28 08:34:11 +02:00
Rolf Bjarne Kvinge 9fcda89ead [msbuild] Fix typo in the watchOS logic. 2020-05-27 10:23:52 +02:00
Rolf Bjarne Kvinge 4f2d580426 [msbuild] Don't touch AssemblySearchPaths when building with net5.
We're supposed to resolve assemblies the standard/system way.
2020-05-26 14:49:31 +02:00
Rolf Bjarne Kvinge 91aa4e733a [msbuild] Don't include System.Drawing.Common.dll when building using net5.
There's no System.Drawing.Common.dll in net5.
2020-05-26 14:49:31 +02:00
Rolf Bjarne Kvinge 6e48c5a83a [msbuild] Don't import Microsoft.CSharp.targets if we're building using net5.
It's already imported.
2020-05-26 14:49:31 +02:00
Rolf Bjarne Kvinge cf1f8af55a [msbuild] Don't inject our existing build logic into the *DependsOn variables when building using net5. 2020-05-26 14:49:31 +02:00
Rolf Bjarne Kvinge 6920817232 [dotnet/msbuild] Add existing targets files to the net5 NuGets. 2020-05-26 14:49:31 +02:00
Rolf Bjarne Kvinge 7c61734bd8
[msbuild] Fix pdb generation, ship the pdb and improve build logic. (#8672)
* The ILRepack package uses a 4-year old version of Mono.Cecil, which does not
  support portable pdbs. Work is in progress to use a newer version of
  Mono.Cecil (https://github.com/gluck/il-repack/pull/236), but this is taking
  some time (the PR is over a year old). In the meantime, switch to the
  ILRepack.MSBuild.Task package, which ships a forked and updated ILRepack.exe
  executable. This means the assembly merging process will produce a working
  pdb for the merged assembly, which in turn means we'll get stack traces with
  source code location.
* Update the makefile to ship the pdbs we produce. Also don't copy files into
  a temporary build/ directory, since it's not needed. This avoids an
  intermediate file copy.
2020-05-26 14:49:21 +02:00
Jonathan Peppers 2c43f9c62a
[msbuild] missing localization comments - part 2 (#8631)
Fixes: https://github.com/xamarin/xamarin-macios/issues/8494

Added a missing `<comment/>` field for `E0085`.
2020-05-21 08:11:46 -05:00
Rolf Bjarne Kvinge d5c17c8425
[msbuild] Simplify Makefile logic a little bit. (#8642)
* [msbuild] Remove unusued variable in Makefile.

* [msbuild] Simplify localization a little bit in the Makefile.
2020-05-21 15:09:10 +02:00
Rolf Bjarne Kvinge 1b570ebb20
[msbuild] Update to NUnit 3.12 and NUnit.ConsoleRunner 3.11.1. (#8613) 2020-05-20 09:26:05 +02:00
Rolf Bjarne Kvinge 392200d930
[mtouch/mmp] Share numerous command-line arguments. (#8599)
* [mtouch/mmp] Share Application.IsDualBuild, Is32Build and Is64Build.

* [mtouch/mmp] Share --tls-provider and --http-message-handler.

* [mtouch/mmp] Share --force.

* [mtouch/mmp] Share --cache.

* [mtouch/mmp] Share --nolink, --linksdkonly, --linkplatform and --linkskip.

* [mtouch/mmp] Share --i18n.

* [mtouch/mmp] Share --xml.

* [mtouch/mmp] Share --registrar and --runregistrar.

* [mtouch/mmp] Share --warn-on-type-ref.

* [mtouch/mmp] Share --sdk.

* [mtouch/mmp] Share --debug.

* [mtouch/mmp] Share --reference, and deprecate -r|--ref and -a|--assembly.

* [mtouch/mmp] Share --targetver, and deprecate mmp's --minos.

* [msbuild] Adjust tests after switching to use --reference instead of -r.

* Update according to review.

* [mmp] Remove --registrar:il.

The IL generator was what MonoMac had before the dynamic/static registrar code
got shared between MonoTouch and MonoMac. The IL registrar been gone for
years, and as far as I know nobody ever used --registrar:il, even though it
was provided as a compatibility option in the beginning (we still had the IL
registrar around for a while after adding the static+dynamic registrars, until
it was completely replaced by the dynamic registrar).

So just remove this option, if anyone ever used it they can replace it with
--registrar:dynamic.

* [mtouch/mmp] Keep bundler-specific code in its corresponding file.
2020-05-19 15:30:38 +02:00
Jonathan Peppers 89d621e373
[msbuild] add missing localization comments (#8602)
Fixes: https://github.com/xamarin/xamarin-macios/issues/8211
Context: https://github.com/xamarin/xamarin-android/blob/master/Documentation/workflow/Localization.md

A list of MSBuild error codes came back from the translators. These
had no `<comment/>` fields filled out at all. I added these, so it
should be much clearer what the messages actually mean.

* E0044
* E0094
* E0098
* E0124
* E0128
* E0130
* E0131
* E0133
* E0140
* E0156
* E7022_A
* E7057
* M0119
* W0020
* W0022

Error codes that did not appear to be used anymore:

* E0096

I also added a short `README.md` so others can more easily pick this
up.
2020-05-15 15:01:58 -05:00
Rolf Bjarne Kvinge 3549ccf3dd
[msbuild] Inherit from Xamarin[Tool]Task instead of [Tool]Task in a most tasks. (#8582)
This makes it possible to remove a lot of duplicated code.
2020-05-13 15:44:59 +02:00
Rolf Bjarne Kvinge abfb9f2179
[msbuild] Make the DeleteBase task inherit from the Delete task. (#8577)
Once upon a time the Delete task was sealed [1], so we couldn't subclass it as
we wanted. That time is long in the past, so we can now do what we wanted back
then.

[1]: 5c49171303
2020-05-12 17:47:17 +02:00
Jonathan Peppers 666059f289
[msbuild] add System.Drawing.Common ref for bindings (#8528)
Fixes: https://github.com/xamarin/xamarin-macios/issues/8265

Usage of `System.Drawing` types in iOS binding projects are failing with:

    error CS1069: The type name 'Color' could not be found in the namespace 'System.Drawing'.
    This type has been forwarded to assembly 'System.Drawing.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
    Consider adding a reference to that assembly.

In 3a7bdc0, an `_AddExtraReferences` MSBuild target was added for iOS
and Mac projects, but mistakenly missing from binding projects.

I moved the `_AddExtraReferences` target to `Xamarin.Shared.targets`,
so it will be used for all project types.

I also updated a test, I could merely use `System.Drawing.Color` in
`StructsAndEnums.cs` to reproduce the failure.
2020-05-07 15:27:06 -05:00
Rolf Bjarne Kvinge 019c92338b
[msbuild] Fix format arguments in error string. (#8497) 2020-05-04 18:32:10 +02:00
Rolf Bjarne Kvinge 24201084d9
[msbuild] Improve symlinks for Xamarin.Mac. (#8484)
Instead of having multiple symlinks in the /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac directory
pointing to files in /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/msbuild, have the
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac directory point to the
/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/msbuild directory. This way we
don't have to update the symlinks whenever there are new files somewhere.
2020-05-04 10:51:29 +02:00
Rolf Bjarne Kvinge 95d71c8ee1
[msbuild] Unify most of the DetectSdkLocations task between Xamarin.Mac and Xamarin.iOS. (#8462)
New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@45c5a68 [Xamarin.MacDev] Add interfaces to bridge Xamarin.iOS- and Xamarin.Mac-specific classes. (#72)

Diff: a0a11aff27..45c5a680e2
2020-04-28 14:55:35 +02:00
Rolf Bjarne Kvinge cb234697f5
[msbuild] Remove the net461 version of the msbuild task assemblies. (#8419)
The netstandard2.0 version has been the default for a few weeks now, and no
problems have been found, so just delete the net461 version.

This speeds up testing a bit, since we won't be testing the net461 version
anymore.
2020-04-20 09:59:22 +02:00
Rolf Bjarne Kvinge 28eddda439
Extract the ApplePlatform and LinkMode enums into their own files. (#8411) 2020-04-17 09:45:18 +02:00
monojenkins 5673bb0dba
[msbuild] Build bindings with the latest (stable) version of C# (#8401)
We now require C# 8 for nullability support. However we allow custom code
to be included inside binding projects and we should not support anything
(stable) that the C# compiler (installed separately) allow, so `latest`
it is.
2020-04-15 20:31:18 -04:00
Sebastien Pouliot 9f28bce6b8
[msbuild] Build bindings with the latest (stable) version of C# (#8387)
We now require C# 8 for nullability support. However we allow custom code
to be included inside binding projects and we should not support anything
(stable) that the C# compiler (installed separately) allow, so `latest`
it is.
2020-04-15 15:41:32 -04:00
Emanuel Fernandez Dell'Oca bdcd7d35a4
[d16-7] Fixes msbuild.zip (#8368)
* [msbuild] Conditionally include MSBuild assets

Updates the Microsoft.Build* references to use PackageReference to match Xamarin.iOS.Tasks.Core.csproj, and conditionally includes the MSBuild assets so these can be copied to the output directory if needed. If `IncludeMSBuildAssets` is not set, the behavior will remain the same, the MSBuild assemblies won't be copied to the output dir.

* Fix whitespace.

* Bump maccore

New commits in xamarin/maccore:

* xamarin/maccore@92a06f7303 [d16-7] Fixes msbuild.zip (#2200)

Diff: a14f74b40a..92a06f7303

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-04-14 08:19:08 +02:00
Sebastien Pouliot 15938de198
[generator] Add C#8 nullability into generated code (#7570) (#8333)
Goals
* Reflect Apple nullability annotations in our bindings using C#8
* No warnings when building bindings

Non-Goals
* Update (add or fix) `[NullAllowed]` to match Apple headers (next phase)
* Make the generator or internal code fully nullable aware (`nowarn` is used)

Notes
* Apple's own annotations are not 100% accurate :(
* Where known issue exists we have _fixed_ our attributes to match reality :)
* We also do additional null-checks internally that might seems not required (better safe than sorry).
2020-04-10 12:38:14 -04:00
Sebastien Pouliot a5ac0ea102
[generator] Add C#8 nullability into generated code (#7570)
Goals
* Reflect Apple nullability annotations in our bindings using C#8
* No warnings when building bindings

Non-Goals
* Update (add or fix) `[NullAllowed]` to match Apple headers (next phase)
* Make the generator or internal code fully nullable aware (`nowarn` is used)

Notes
* Apple's own annotations are not 100% accurate :(
* Where known issue exists we have _fixed_ our attributes to match reality :)
* We also do additional null-checks internally that might seems not required (better safe than sorry).
2020-04-09 09:29:28 -04:00
Rolf Bjarne Kvinge c5ade80b2e Fix whitespace. 2020-04-07 14:01:52 -03:00
emaf df8afe584b [msbuild] Conditionally include MSBuild assets
Updates the Microsoft.Build* references to use PackageReference to match Xamarin.iOS.Tasks.Core.csproj, and conditionally includes the MSBuild assets so these can be copied to the output directory if needed. If `IncludeMSBuildAssets` is not set, the behavior will remain the same, the MSBuild assemblies won't be copied to the output dir.
2020-04-07 14:01:52 -03:00
Rolf Bjarne Kvinge 2ae55ac1f4
[msbuild] Compute the ComputedFrameworkMoniker later in the build. Fixes #8277. (#8279)
It might only be necessary for Xamarin.iOS builds, but modify both XI and XM
so that the logic is identical.

Fixes https://github.com/xamarin/xamarin-macios/issues/8277.
2020-04-06 12:47:01 +02:00
Rolf Bjarne Kvinge 5aff10b3c0
[msbuild] No need to pass --gsharedvt to mtouch anymore, mtouch ignores --gsharedvt since it must always be enabled. (#8270) 2020-04-02 17:22:17 +02:00
Alex Soto 3ff3e07ebe Merge remote-tracking branch 'xamarin/d16-5-xcode11.4' 2020-03-26 19:59:14 -04:00
Waleed Chaudhry 09d0061317
[msbuild] Remove comment tags to fix translations out of sync issue (#8157) 2020-03-20 17:33:40 -04:00
Manuel de la Pena 820d7de89a
[Msbuild] Do not error if the localizations are out of sync. (#8139)
The translations code is quite fragile at the moment. When building a
package it is throwing errors but does not do the same when building
xamarin-macios. This has happened several times with the mono-2020-02
integration branch:

* https://jenkins.internalx.com/job/macios/job/PR-7795/24/display/redirect
* https://jenkins.internalx.com/job/macios/job/PR-7795/25/display/redirect

This change makes sure that we do not raise an error, unblocks mono
2020-02 and an issue will be added to make sure that we re-enable the
feature once the code is more stable.
2020-03-18 15:14:52 -04:00
Rolf Bjarne Kvinge b26ec6bf34
[msbuild] The Mmp/Mtouch tasks are passed the expected TargetFrameworkMoniker, so no need to have any custom logic here. (#8118)
We can even move it all to the shared base class, and remove an unused variable (UseXamMacFullFramework).
2020-03-16 15:01:57 +01:00
Waleed Chaudhry bcbfe4d5e4
[Localization] MSBuild 2020-03-13 17:46:28 -04:00
Rolf Bjarne Kvinge fe5fd8d11d
[msbuild] Simplify the BTouch task implementation. (#8096)
* Don't validate the TargetFrameworkIdentifier, instead pass it along to bgen
  (which will validate it). This means less validation updates when something
  changes.
* For Xamarin.Mac's GenerateCommandLineCommands' implementation:
    * We'll always have a bgen.exe, so the code for what to do if bgen isn't
      there can be removed.
    * There's no need to compute the 'isMobile' value, because now it's not used
      anymore. So we can remove the first if block in the method completely.
    * There's no need to add the -stdlib flag, because the base implementation
      in BTouchTaskBase already adds it.
    * Now there's nothing left in the method but calling base, so the entire
      override can be removed.
    * This also removes the need for the FrameworkRoot parameter to the task,
      so remove that too.
* For Xamarin.Mac's GetTargetFrameworkArgument's implementation:
    * Move the TargetFramework logic to detect the different Xamarin.Mac
      variations to the targets file, so that it can be reused by other tasks
      and targets.
    * This means we don't need an overridable function to get the target
      framework argument, so just remove inline the entire virtual method.
2020-03-13 18:04:50 +01:00
Rolf Bjarne Kvinge 7c15428fc2
[msbuild] Create common base class for MmpTaskBase and MtouchTaskBase. (#8080)
Create a common base class for MmpTaskBase and MtouchTaskBase, and move logic
that is common between mtouch and mmp there. Some input variables were renamed
for the MmpTaskBase task, when the resulting code would be identical in
MtouchTaskBase, and thus sharable.

There is still a bit more code that could be shared, but that require a bit
more effort and can always be done later.
2020-03-11 19:02:43 +01:00
Rolf Bjarne Kvinge c68700ad4f
Bump Xamarin.MacDev. (#8059)
* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@a0a11af Adjust SDK validation to allow tools/bin and not allow usr/bin. (#71)
* xamarin/Xamarin.MacDev@e21e1aa Accept 'tools/buildinfo' as an alternative path to 'buildinfo' due to an nuget bug. (#70)
* xamarin/Xamarin.MacDev@ce24236 Don't look in /Developer/MonoTouch anymore, there's nothing there. (#69)

Diff: 210c664e56..a0a11aff27

* [msbuild] Teach tests that mock MonoTouchSdk to mock better.

MonoTouchSdk ends up a bit confused when giving it an Sdk directory that isn't
a real Sdk directory, and then assuming that properties that return Sdk paths
won't throw exceptions.

Fix this by giving MonoTouchSdk a better fake Sdk directory (which
MonoTouchSdk detects as a real Sdk directory), and thus those previously
mentioned properties will return true fake values instead of throwing
exceptions.
2020-03-09 09:12:11 +01:00
Alex Soto f5b3a6f1c4
Merge remote-tracking branch 'xamarin/xcode11.4' into d16-5-xcode11.4 2020-03-08 13:16:04 -04:00
Rolf Bjarne Kvinge 26ad52257e
[msbuild] Pass the entire TargetFrameworkMoniker to tasks instead of just TargetFrameworkIdentifier/TargetFrameworkVersion. (#8048)
When .NET 5 comes, the TargetFrameworkMoniker will change, and we need the
entire moniker to distinguish between various platforms.

So change our msbuild code to consume the entire TargetFrameworkMoniker, so
that we have all the information we need when we need it.

Also redirect everything through an intermediate
_ComputedTargetFrameworkMoniker property, so that the target framework can be
overridden without affecting any other code. This becomes necessary during the
initial implementation phase, because we don't have a .NET version to test
with yet that can give us the new target frameworks. Eventually it should be
possible to remove this intermediate variable
2020-03-06 18:28:58 +01:00
Rolf Bjarne Kvinge 3fcaa41419
[msbuild] Re-use tools/common/TargetFramework.cs. (#8044)
This allows us to replace Xamarin.MacDev.Tasks.PlatformFramework with
Xamarin.Utils.ApplePlatform.

It also allow for more complex target framework handling/parsing in the
future, using the TargetFramework class.
2020-03-05 15:21:35 +01:00
Sebastien Pouliot 0129618de8
[mtouch] Add `force-rejected-types-removal` optimization (#8009) (#8042)
This optimization can be enabled when it's not possible to use the
managed linker (e.g. **Don't link**) or when the managed linker cannot
remove references to deprecated types that would cause an application
to be rejected by Apple.

References to the existing types will be renamed, e.g. `UIWebView` to
`DeprecatedWebView`, in every assemblies.

The type definition is also renamed (for validity) and all custom
attributes on the types and their members will be removed.
Code inside the members will be replaced with a
`throw new NotSupportedException ();`.

The msbuild test app `MyReleaseBuild` has been updated to test that the
optimization is working as expected (device builds are slow so reusing
this test has little impact in test time).

Basically the test ensure that `UIWebView` is used and cannot be removed
by the compiler (optimization) or the managed linker (since it's
referenced). Since the optimization is enabled then we can `grep` then
final `.app` directory to ensure there's no mention of `UIWebView` inside
any of the files that would be submitted.

The application can be run, by itself, and will turn green if OK, red if
`DeprecatedWebView` can't be found (skeleton replacement for `UIWebView`)
or orange if a `NotSupportedException` is thrown.

Finally introspection tests have been updated to skip over the deprecated
(and renamed) types. It should not be an issue right now, since this
optimization is not enabled by default, but it made testing easier.
2020-03-04 21:21:41 -05:00
Alex Soto 709a90599e Merge remote-tracking branch 'xamarin/xcode11.4' into d16-5-xcode11.4-merge 2020-03-03 10:57:24 -05:00
Sebastien Pouliot 54f2dae935
[mtouch] Add `force-rejected-types-removal` optimization (#8009)
This optimization can be enabled when it's not possible to use the
managed linker (e.g. **Don't link**) or when the managed linker cannot
remove references to deprecated types that would cause an application
to be rejected by Apple.

References to the existing types will be renamed, e.g. `UIWebView` to
`DeprecatedWebView`, in every assemblies.

The type definition is also renamed (for validity) and all custom
attributes on the types and their members will be removed.
Code inside the members will be replaced with a
`throw new NotSupportedException ();`.

The msbuild test app `MyReleaseBuild` has been updated to test that the
optimization is working as expected (device builds are slow so reusing
this test has little impact in test time).

Basically the test ensure that `UIWebView` is used and cannot be removed
by the compiler (optimization) or the managed linker (since it's
referenced). Since the optimization is enabled then we can `grep` then
final `.app` directory to ensure there's no mention of `UIWebView` inside
any of the files that would be submitted.

The application can be run, by itself, and will turn green if OK, red if
`DeprecatedWebView` can't be found (skeleton replacement for `UIWebView`)
or orange if a `NotSupportedException` is thrown.

Finally introspection tests have been updated to skip over the deprecated
(and renamed) types. It should not be an issue right now, since this
optimization is not enabled by default, but it made testing easier.
2020-03-02 09:20:29 -05:00
Rolf Bjarne Kvinge ad15106af4
[msbuild] Add support for Metal in the simulator. Fixes #7392. (#7983) (#7991)
* [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.

* [msbuild] Add support for Metal in the simulator. Fixes #7392. (#7983)
2020-02-28 19:59:03 +01:00
Sebastien Pouliot a40f6e8804
[msbuild][tests] Re-enable test case (issue fixed a while ago) (#8001) 2020-02-27 17:23:55 -05:00
Rolf Bjarne Kvinge df51d134c0
[msbuild] Add support for Metal in the simulator. Fixes #7392. (#7983) 2020-02-26 18:26:21 +01:00
Waleed Chaudhry bc878256f4
[msbuild] Update test engine to implement IBuildEngine4 (#7905) 2020-02-18 10:56:29 -05:00
Alex Soto ec973295b5
Replace removed dsymutil `-t` switch with `-num-threads` (#7898) 2020-02-14 15:44:19 -05:00
Alex Soto d716663061
Replace removed dsymutil `-t` switch with `-num-threads` (#7900) 2020-02-14 15:36:47 -05:00
Rolf Bjarne Kvinge de61d3d705
[msbuild] Deduplicate the code for generating the app bundle name/path between our various platforms. (#7841)
Also move the app bundle name/path generation code together for all platforms
to avoid it drifting apart in the future.
2020-02-14 14:26:48 +01:00
Rolf Bjarne Kvinge d98a8f1792
[msbuild] Tweak the tests. (#7877)
This is a series of commits that tweaks the msbuild tests a little bit.

* [msbuild] Match configuration between MyWatchKit2Extension and MyWatchKit2IntentsExtension.

Fixes this warning:

>  MTOUCH : warning MT0113: Native code sharing has been disabled for the extension 'MyWatchKit2IntentsExtension' because the --assembly-build-target options are different between the container app () and the extension (--assembly-build-target:@all=dynamiclibrary). [MyWatchKit2Extension/MyWatchKit2Extension.csproj]

* [msbuild] Add the extra argument for the AppWithExtraArgumentThatOverrides test project to all configurations.

That way the test can be built in all configurations (and still test what it's
supposed to test).

* [msbuild] Clean up project files a bit.

* Removed default 'CodesignKey' values from simulator configurations.
* Removed 'MtouchFastDev' values from simulator configurations.
* Removed 'IOSDebuggerPort' values, not needed for these projects.

* [msbuild] Update test projects to use 64-bit architectures.

Also enable bitcode (+llvm) for release device builds for tvOS and watchOS.

* [msbuild] Simplify test project configuration a bit.

* [msbuild] Unify output path.

Using 'TV' and 'TVSimulator' in the OutputPath works fine, but it makes some
of the tests a bit more complex because they need to special-case this test to
find the path to the resulting .app.

* [msbuild] Fix the MyiOSFrameworkBinding test project to have the same assembly name as the project itself.

This simplifies upcoming testing code a bit.
2020-02-14 14:12:25 +01:00
Alex Soto cee4b5e5a1
[xcode11.4] Add xcode 11.4 b1 initial support (#7805)
* [xcode11.4] Add xcode 11.4 b1 initial support

* [xtro] re-enable PDFKit

* Disable watchOS and fix xtro

Unfortunately watchOS simulator hangs when we try to deploy to it
and it keeps our tests timing out. Disabling for now until we
can investigate more.

Disables PDFKit on xtro in macOS

* [jenkins] Switch to use the catalina bot group (#7819)

* Bump maccore to get fix for launching the simulator for watch apps.

New commits in xamarin/maccore:

* xamarin/maccore@546270c8f9 [Xamarin.Hosting] Fix the name of the notification we get when the simulator has launched. (#2145)

Diff: 55957e908d..546270c8f9

* [tests] Diable watch due to time out, enable 10,15,4 in intro, fix min version

* Bump macios-binaries to get updated binary mlaunch as well.

New commits in xamarin/macios-binaries:

* xamarin/macios-binaries@f8c6e63 Bump mlaunch to xamarin/maccore@546270c8f9

Diff: eb6980e8b6..f8c6e63228

* [msbuild] Reflect ibtool changes in our tests

Looks like Apple reverted some changes introduces in Xcode 11
in ibtool, for more context see xamarin/xamarin-macios#6970

* [mtouch] Workaround strange behavior of realpath.

Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-02-11 20:25:43 -05:00
Rolf Bjarne Kvinge adaf221471
[msbuild] Fix warning about CFBundleVersion in the MyWatchApp2 test project. (#7843)
Fixes:

> /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1726,3): warning : The Watch App 'MyWatchApp2' has a CFBundleVersion (1.33) that does not match the main app bundle's CFBundleVersion (1.0) [MyWatch2Container/MyWatch2Container.csproj]
> /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(1726,3): warning : The Watch Extension 'MyWatchKit2Extension' has a CFBundleVersion (1.0) that does not match the main app bundle's CFBundleVersion (1.33) [MyWatch2Container/MyWatch2Container.csproj]
2020-02-11 15:27:29 +01:00
Rolf Bjarne Kvinge b0242cfe48
[msbuild] Fix MT4174 warning for the MyWatchKit2IntentsExtension test project. (#7842)
Fixes:

> MyWatchKit2IntentsExtension/IntentHandler.cs(36): warning MT4174: Unable to locate the block to delegate conversion method for the method MyWatchKit2IntentsExtension.IntentHandler.ResolveRecipients's parameter #2. [MyWatchKit2Extension/MyWatchKit2Extension.csproj]

The method signature probably changed from a beta release to the corresponding
stable release, and this method was never updated.
2020-02-11 15:27:08 +01:00
Rolf Bjarne Kvinge 29b9e75db9
Remove code that refers to /Developer/MonoTouch. (#7840)
It's about time.
2020-02-11 15:26:15 +01:00
Rolf Bjarne Kvinge 4c496a87ed
[msbuild] Make sure DeviceSpecificOutputPath is a relative path. (#7832)
It might be absolute at least sometimes when building with dotnet, and making
sure it's always a relative path simplifies the code.
2020-02-10 22:31:18 +01:00
Jonathan Peppers bba8fe731f
[msbuild] remove {GAC} from $(AssemblySearchPaths) (#7815)
Fixes: https://developercommunity.visualstudio.com/content/problem/788505/xamarin-found-conflicts-between-different-versions.html
Fixes: http://work.azdo.io/1008385
Context: 73b93c2dc9/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets (L337-L341)

On Windows only, Xamarin.Forms projects hit the build warning:

    Microsoft.Common.CurrentVersion.targets(2106,5): warning MSB3277: Found conflicts between different versions of "System.Numerics" that could not be resolved.
    These reference conflicts are listed in the build log when log verbosity is set to detailed.

The difference appears to be the `{GAC}` search path is used on
Windows, but not Mac.

In fact, the output of `<ResolveAssemblyReference/>` on Mac reports:

    Unused locations
        {CandidateAssemblyFiles}
        {HintPathFromItem}
        {Registry:Software/Microsoft/Xamarin.iOS,v1.0,AssemblyFoldersEx}
        {AssemblyFolders}
        {GAC}
        bin/iPhoneSimulator/Debug/
    Used locations
        {TargetFrameworkDirectory}
        {RawFileName}

Compared to Windows:

    Used locations
        {TargetFrameworkDirectory}
        {GAC}
        {RawFileName}

For now, we should just remove `{GAC}` from the list as the safest fix.

Xamarin.Mac is already doing this:

f85556c1e5/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.props (L121-L125)

Down the road, we could specify only the paths needed for performance
reasons. We have done this recently in Xamarin.Android:

5945e9a779/src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.targets (L382-L386)

* Added a test assertion for this as well.
2020-02-07 08:54:29 -06:00
Rolf Bjarne Kvinge 5cac2eafd3
[msbuild] Don't add newlines to command line arguments to mmp. (#7806)
Don't separate command-line arguments to mmp with newlines, in dotnet those
newlines are passed to mmp instead of being treated as whitespace, and that
confuses mmp.

Also remove additional and unneeded whitespace in the command line arguments,
the CommandLineArgumentBuilder class already adds whitespace when needed.
2020-02-06 15:34:21 +01:00
Rolf Bjarne Kvinge 9960ee43de
[msbuild] Fix several issues in the MyWatchApp2 test project. (#7804)
* [msbuild] Fix the MyWatchApp2 test project to include resources already present.

Fixes several warnings:

> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The file "Icon-27.5x27.5@2x.png" for the image set "AppIcons" does not exist. [MyWatchApp2/MyWatchApp2.csproj]
> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The file "Icon-86x86@2x.png" for the image set "AppIcons" does not exist. [MyWatchApp2/MyWatchApp2.csproj]
> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The file "Icon-40x40@2x.png" for the image set "AppIcons" does not exist. [MyWatchApp2/MyWatchApp2.csproj]
> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The file "Icon-44x44@2x.png" for the image set "AppIcons" does not exist. [MyWatchApp2/MyWatchApp2.csproj]
> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The file "Icon-24x24@2x.png" for the image set "AppIcons" does not exist. [MyWatchApp2/MyWatchApp2.csproj]
> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The file "Icon-98x98@2x.png" for the image set "AppIcons" does not exist. [MyWatchApp2/MyWatchApp2.csproj]
> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The file "Icon-29x29@2x.png" for the image set "AppIcons" does not exist. [MyWatchApp2/MyWatchApp2.csproj]
> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The file "Icon-29x29@3x.png" for the image set "AppIcons" does not exist. [MyWatchApp2/MyWatchApp2.csproj]

* [msbuild] Add a 1024x1024 icon to the MyWatchApp2 test project.

Fixes this warning:

> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : A 1024x1024 app store icon is required for watchOS apps [MyWatchApp2/MyWatchApp2.csproj]

* [msbuild] Remove the longLook icon entry for MyWatchApp2.

It doesn't seem to be a valid entry, there's no such entry when creating a
watchOS app in Xcode. Additionally it fixes this warning:

> MyWatchApp2/obj/iPhoneSimulator/Debug/actool/cloned-assets/Resources/Images.xcassets : actool warning : The app icon set "AppIcons" has an unassigned child. [MyWatchApp2/MyWatchApp2.csproj]
2020-02-06 07:26:20 +01:00
Rolf Bjarne Kvinge 346e29397d
[msbuild] Remove unused files. (#7801) 2020-02-05 23:55:11 +01:00
Rolf Bjarne Kvinge 0557f16e6a
[msbuild] Make code a bit more future-proof. (#7790)
According to review of #7706.
2020-02-05 07:29:29 +01:00
Rolf Bjarne Kvinge 7bdb167ffe
[msbuild] Remove outdated AppStore and Ad-Hoc configurations from test projects. (#7777) 2020-02-03 13:56:49 +01:00
Rolf Bjarne Kvinge b5b74ff1c4
[msbuild] Remove unused csproj variable. (#7778) 2020-02-03 13:56:36 +01:00
Waleed Chaudhry 00985a55e2
[Localization] mtouch/mmp C# (#7710) 2020-01-31 15:02:52 -05:00
Rolf Bjarne Kvinge 23275441af
[msbuild] Copy tests before making changes to them. (#7753)
Copy test projects to a temporary directory before using them for tests. This
makes sure tests don't leave a dirty working tree (because some tests modify
the on-disk test code).

We'll also start running tests using SDK-style project files, and this way
it's much easier to run tests twice, once using the old format and once using
the new format, and then compare the results.

Most of the changes are related to making the test projects and code
relocatable.
2020-01-24 16:15:34 +01:00
Rolf Bjarne Kvinge eb29f4375e
[msbuild] Remove unused conditional compilation directive. (#7747) 2020-01-24 08:59:55 +01:00
Rolf Bjarne Kvinge 197557078f
[msbuild] Don't manually quote, instead rely on CommandLineArgumentBuilder's logic. (#7749)
This fixes an issue related to single quotes and that the fact that mono's behavior
regarding quoting them has changed (by not using single quotes).

This becomes an issue when running with dotnet.
2020-01-24 08:53:13 +01:00
Rolf Bjarne Kvinge 3bad419de3
[msbuild] Remove dependency on Mono.Posix. (#7748)
Mono.Posix comes with a native library, and that makes IL merging much more
complicated, especially when Mono.Posix comes from a nuget. So remove the
Mono.Posix dependency, and instead write the 2 P/Invokes we need manually.
2020-01-24 08:52:22 +01:00
Bruno Garcia 455ed695bf fix: Template typos execution, transition (#7723)
* fix: Execution typo

* fix: transiton -> transition
2020-01-20 15:29:23 +01:00
Rolf Bjarne Kvinge 54b07b2f2d
[msbuild] Build the MSBuild task assemblies for netstandard2.0. (#7706)
* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@210c664 Adds net451 to Xamarin.MacDev.csproj
* xamarin/Xamarin.MacDev@64db365 [winios] Changes provisioning profiles default path
* xamarin/Xamarin.MacDev@d34430a Switch to short-form projects and build for both net461 and netstandard2.0. (#68)

Diff: 0f578f51e6..210c664e56

* [msbuild] Update to latest Mono.Cecil.

The older version doesn't support netstandard2.0.

No code changes were required.

* [msbuild] Remove unused usings.

* [msbuild] Make ILMerge work when building for netstandard2.0.

Also unify/deduplicate the ILMerge logic between Xamarin.iOS and Xamarin.Mac.

* [msbuild] Build for netstandard2.0 in addition to net461.

* [msbuild] Use custom project configurations to support running the tests for both netstandard2.0 and net461.

Use custom project configurations to support running the tests for when the
tasks assembly is built for netstandard2.0 and net461.

* [tests] Make command-line based 'make test-ios-tasks' run tests for both netstandard2.0 and net461.

* [xharness] Add test configuration to run iOS MSBuild tests using either netstandard2.0 or net461.

* [msbuild] Make the netstandard2.0-buils task assemblies the default.

* [msbuild] ILRepack lib assemblies, not ref assemblies.

Ask MSBuild to copy lib assemblies to the output folder when building for
netstandard2.0, this way we can easily find the actual implementation
libraries to pass to ILRepack.

* [msbuild] Merge System.Text.Encodings.Web.dll as well.

* [xharness] Fix build of MSBuild tests for iOS.
2020-01-16 18:22:48 +01:00
Rolf Bjarne Kvinge c4e15ed6b6
[msbuild] Convert project files to sdk-style project files. (#7698)
* [msbuild] Convert to short-form csproj.

* [msbuild] Make asserts more useful.

* [msbuild] Make tests ignore the actual location of the test assembly.

* [msbuild] Short-style projects default to deterministic builds, which is not compatible with wildcard versions.

* [msbuild] Adjust test.

* Update .gitignore.

* Bump NUnit.ConsoleRunner version.

* [msbuild] Fix indentation.

* [msbuild] Simplify csproj.
2020-01-14 08:16:02 +01:00
Rolf Bjarne Kvinge 087e00e305
[msbuild] Adjust test to work locally by being less demanding. (#7694)
These tests were checking if mtouch is called (or not) by checking for the
full installed path to mtouch. When running the tests locally, we're using the
locally built mtouch, and thus the path is different and the tests failed.

Instead check for a smaller substring that is present in both cases.
2020-01-10 18:41:11 +01:00
Chris Hamons bcb8f01a7a
[msbuild] Stub out GenerateManifests to prevent Windows ClickOnce target collisions (#7668)
- https://devdiv.visualstudio.com/DevDiv/_queries/edit/1041456/
- On Windows the GenerateManifests target will sometimes run and do the wrong thing
as we overload their usages of @(NativeReference). Stub it as a no-op
- Also stub out targets XVS were stubbing.
2020-01-08 09:20:42 -06:00
monojenkins fd91cf731d [d16-5] [msbuild] Add verbosity options on separate lines for mtouch parsing (#7673)
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


Co-authored-by: Sebastien Pouliot <sebastien.pouliot@gmail.com>
2020-01-06 16:52:36 -05:00
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
monojenkins fa7e04052c [d16-5] [vsts-1029041] Add FileType to the list of parameters for altool (#7563)
* [vsts-1029041] Add FileType to the list of parameters for altool

* ValidateAppStoreBundle
* UploadAppStoreBundle

* [vsts-1029041] Pass TargetFrameworkIdentifier to identify target platform
2019-12-12 07:23:34 +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 0fc20af16a [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 18:21:26 -03: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
monojenkins 08acbf3dcc Fix version numbers in FrameworkList.xml files (#7162)
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-15 17:50:59 -04: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
Oleg Demchenko 0fa3511948 [vsts-938452] Revert changes in Xamarin.MacDev.Tasks.Core.csproj 2019-08-07 16:10:21 -04:00
Oleg Demchenko 0b3ab2b777 [vsts-938452] Apply suggestion from Rolf 2019-08-07 16:10:09 -04:00
Oleg Demchenko be654adc70 [vsts-938452] Clean up file names and indentations 2019-08-07 16:09:58 -04:00
Oleg Demchenko 1cc7e073e6 [vsts-938452] Add UploadAppStoreBundle target 2019-08-07 16:09:45 -04:00
Oleg Demchenko b5ea7813a0 [vsts-938452] Add SesssionId to ALToolTaskBase 2019-08-07 16:09:32 -04:00
Oleg Demchenko 112247efb0 [vsts-938452] Change inheritance order of altool-task classes 2019-08-07 16:09:20 -04:00
Oleg Demchenko ffebb9ef5d [vsts-938452] Add altool tasks to Xamarin.iOS.Common.targets 2019-08-07 16:08:52 -04:00
Oleg Demchenko 46dfc93ed9 [vsts-938452] Refactor altool upload and verify tasks to actually work 2019-08-07 16:08:39 -04:00
Oleg Demchenko a610df25ab [vsts-938452] Output altool logs in xml format 2019-08-07 16:08:25 -04:00
Oleg Demchenko 751f171c2c [vsts-938452] Add altool upload and verify draft implementations 2019-08-07 16:08:12 -04:00
Jonathan Peppers 7c2cf9aa52 [msbuild] $(ProduceReferenceAssembly) support (#6458)
Context: http://feedback.devdiv.io/600039
Context: 6321934237/Documentation/guides/MSBuildReferenceAssemblies.md
Context: https://github.com/dotnet/roslyn/blob/master/docs/features/refout.md#msbuild

For Xamarin.Android, we have been doing a bit of work to enable a new
MSBuild/Roslyn feature called "reference assemblies". You can opt into
this by setting $(ProduceReferenceAssembly)=true in a netstandard
project.

The benefit being that if the public API doesn't change in the
netstandard library, the head projects don't need to run `CoreCompile`
or `<Csc/>` during an incremental build.

Unfortunately, this seems to have uncovered a problem in the
Xamarin.iOS MSBuild targets. If you do a build with a XAML-only change,
you get:

    Target "_CompileToNative" in file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets":
    Skipping target "_CompileToNative" because all output files are up-to-date with respect to the input files.
    Input files: /Users/jonathanpeppers/Projects/HelloForms/HelloForms.iOS/bin/iPhoneSimulator/Debug/HelloForms.iOS.exe
    Output files: bin/iPhoneSimulator/Debug/device-builds/iphone11.8-12.2/HelloForms.iOS.app/HelloForms.iOS;bin/iPhoneSimulator/Debug/device-builds/iphone11.8-12.2/mtouch.stamp

Because we are using `$(ProduceReferenceAssembly)` the
`HelloForms.iOS.exe` assembly will have no changes. Only
`HelloForms.dll`, the netstandard project, has changes. We were able
to skip `CoreCompile` in the iOS head project. Faster builds, yeah!

However, we actually need `_CompileToNative` to run, or we won't see
any changes on the device or simulator... It only runs if
`$(TargetPath)` changes.

The fix here is to add new `Inputs`, so `_CompileToNative` runs when
any referenced assemblies change:

    <_CompileToNativeInput Include="$(TargetDir)$(TargetFileName);@(ReferencePath);@(MTouchReferencePath)" />

This fixes incremental builds (or changes) for:

* Any `<ProjectReference/>` that has `$(ProduceReferenceAssembly)`
* Any NuGet package that ships a reference assembly alongside its
"regular" assembly

I also moved the `<ItemGroup>`'s, just so the code made sense --
so we have all the important `<ItemGroup>`'s in one place.

I also updated the `XamarinForms` test to verify things are working.

I added a couple helpers to assist in writing MSBuild tests:

* `IsTargetSkipped` to check if a specific MSBuild target ran
* `Logger.Clear` to clear past MSBuild events within a single test
2019-07-12 21:34:06 +02:00
Jonathan Peppers a51e9f8e88
[xibuild] support for SDK-style projects & Xamarin.Forms test (#6461)
Context: 4ecedac733/src/Shared/BuildEnvironmentHelper.cs (L567-L586)
Context: 1d71d99837/tools/xabuild

When using `xibuild` to build an SDK-style project:

    tools/xibuild/xibuild -- msbuild/tests/MyXamarinFormsApp/MyXamarinFormsAppNS/MyXamarinFormsAppNS.csproj /restore

It was failing with:

    Resolving SDK 'Microsoft.NET.Sdk'...
    Project "msbuild/tests/MyXamarinFormsApp/MyXamarinFormsApp.csproj" is building "msbuild/tests/MyXamarinFormsApp/MyXamarinFormsAppNS/MyXamarinFormsAppNS.csproj" (GetTargetFrameworks target(s)):
    Building with tools version "Current".
    msbuild/tests/MyXamarinFormsApp/MyXamarinFormsAppNS/MyXamarinFormsAppNS.csproj : error MSB4236: The SDK 'Microsoft.NET.Sdk' specified could not be found.

Looking at this code, it looks pretty familiar -- it came from xabuild!

xibuild was currently setting `MSBuildSDKsPath` via a config file:

    <msbuildToolsets default="Current">
      <toolset toolsVersion="Current">
        <property name="MSBuildSDKsPath" value="/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/Current/bin/Sdks" />

Reviewing the source code for MSBuild, they don't even look for this
value via MSBuild properties... They just look for Visual Studio
directories and a `MSBuildSDKsPath` environment variable. We don't have
to use this in Xamarin.Android, because we do things a different way.
There was craziness involved to get both Windows & Mac working.

For this to work on Mac, we can just set `MSBuildSDKsPath` when
starting the new MSBuild process.

I cleaned up how `MSBUILD_EXE_PATH` is set so both of these variables
are just set via `ProcessStartInfo.EnvironmentVariables`.

Now I can fully build a Xamarin.Forms project that references a
netstandard library with `xibuild`:

    $ tools/xibuild/xibuild -- msbuild/tests/MyXamarinFormsApp/MyXamarinFormsApp.csproj /restore
    ...
    Build succeeded.
        0 Warning(s)
        0 Error(s)
    Time Elapsed 00:00:15.83

~~ New Tests ~~

I went ahead and added a new Xamarin.Forms project to test and verify
that it builds. It is the Blank Forms app template from latest VS4Mac.

With the changes to `xibuild`, I was able to build with the in-process
MSBuild APIs.
2019-07-01 12:20:32 -05:00
Rolf Bjarne Kvinge 523349bf69 Merge remote-tracking branch 'origin/d16-2' into xcode11-bump-mono-d16-2 2019-06-20 10:27:04 +02:00
Rolf Bjarne Kvinge 14cac96c90
[d16-2] Bump VSMac to 8.1.0.2742 to fix msbuild issues (#6279) (#6361)
* Bump VSMac to 8.1.0.2742 to fix msbuild issues (#6279)

* Bump VSMac to 8.1.0.2742 to fix msbuild issues

This is required to get the support for the msbuild `ToolsVersion`
change from `15.0` to `Current`.

* [tests][msbuild] Fix Binding resources test with updated msbuild

Test failure with updated msbuild and vsmac 8.1:

```
Xamarin.iOS.Tasks.NativeReferencesNoEmbedding("iPhone").ShouldNotUnnecessarilyRebuildBindingProject(True)
     Binding project build did not create package?
  Expected: True
  But was:  False

at Xamarin.iOS.Tasks.NativeReferencesNoEmbedding.ShouldNotUnnecessarilyRebuildBindingProject (System.Boolean framework) [0x000a0] in <74b8f7d8a53e40109916d305bb4d7403>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo cul
ture) [0x0006a] in <0519fa732e8845b6a809ce9180f541db>:0
```

The test builds the project multiple times. Before the 3rd build, the project
file's timestamp is updated and expects that the binding package will be
rebuilt. But it is not, because the target `_CreateBindingResourcePackage`
doesn't depend on that project file. So, add that to the target inputs.

* [nuget] Use xibuild to run nuget

Fix errors seen during `nuget restore` for tests:

```
Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xammac_tests/xammac_tests.csproj(213,3): error MSB4024: The imported project file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.CSharp.targets" could not be loaded. Could not find file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.CSharp.targets"
```

* [xibuild] Fix incorrect mscorlib.dll being used (#6068)

* [xibuild] Fix incorrect mscorlib.dll being used

The `GuiUnit_NET_4_5` project, when built with `xibuild` uses the wrong `mscorlib.dll`.

From https://github.com/xamarin/xamarin-macios/issues/5760#issuecomment-472457202 :

```
- mscorlib.dll is being used from mono/4.5 and the other system assemblies are from mono/4.5-api
- GuiNet* project is built with xibuild

What is happening here is:

	xibuild sets[1] `SetToolsetProperty ("TargetFrameworkRootPath", FrameworksDirectory + Path.DirectorySeparatorChar);`
	which points to `/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks`.
	This causes $(FrameworkPathOverride) to be set[2] to `/Library/Frameworks/Mono.framework/Versions/Current/lib/mono/xbuild-frameworks/.NETFramework/v4.5`,
	but that doesn't have a mscorlib.dll, so it gets reset[3] to /Library/Frameworks/Mono.framework/Versions/5.22.0/lib/mono/4.5/.

	If we don't set TargetFrameworkRoothPath, then we get `FrameworkPathOverride = /Library/Frameworks/Mono.framework/Versions/5.22.0/lib/mono/4.5-api`,
	causing `_ExplicitReference=/Library/Frameworks/Mono.framework/Versions/5.22.0/lib/mono/4.5-api/mscorlib.dll`(correct one) to be used.
```

Fixes https://github.com/xamarin/xamarin-macios/issues/5760

1. https://github.com/xamarin/xamarin-macios/blob/master/tools/xibuild/Main.cs#L209
2. https://github.com/mono/msbuild/blob/xplat-master/src/Tasks/Microsoft.Common.CurrentVersion.targets#L79
3. https://github.com/mono/msbuild/blob/xplat-master/src/Tasks/Microsoft.Common.CurrentVersion.targets#L84

* Revert "Workaround https://github.com/xamarin/xamarin-macios/issues/5760 in generator csproj"

This reverts commit 9bd927bb7f.

The previous commit for xibuild removes the need for this.

* [xibuild] Handle "incorrectly" cased msbuild property names  (#6202)

msbuild property names are case insensitive. While generating the custom
app.config, in `SetToolsetProperty(..)` we try to update the property if
it already exists. But the name lookup was case sensitive, thus causing
the lookup to fail, resulting in two entries for the same property name
differing only in case. Eg. `MSBuildSDKsPath` vs `MSBuildSdksPath`.

Fixed to ignore case.

Fixes https://github.com/mono/mono/issues/14765 .
2019-06-19 17:28:01 +02:00
Rolf Bjarne Kvinge 626a859a46
[xcode11] Fix several issues to make the mtouch tests pass. Fixes #6259. (#6332)
* [tests] Minor refactor to get better Xcode version parsing.

* Rename Configuration.XcodeVersion to XcodeVersionString.
* Add Configuration.XcodeVersion a parsed Version instane of XcodeString.

* [tests] Ignore all 'MT0099: Not linking with WatchKit because Xcode 11 beta 1' warnings in tests.

* [tests] Adjust min OS version tests for Xcode 11b1.

* [tests] Adjust tests for changes in 'nm' output.

* [tests] Adjust tests for name changes in Clang.

* [tests] Adjust tests for changes in ld warning format.

* [msbuild] 'metal' and 'metallib' aren't in PATH anymore, so use xcrun to execute them.

* [msbuild] Fix DevicePlatformBinDir for the Metal and MetalLib targets on iOS.

Also set the SDKROOT variable, otherwise metal and metallib don't work
properly, and revert the previous attempt at a fix (use xcrun).

* [tests] Simplify version parsing code to not version parse anymore.

* [tests] Add FIXME for once Apple fixes the WatchKit disappearance.
2019-06-19 07:20:02 +02:00
Ankit Jain e271d5e18d Bump VSMac to 8.1.0.2742 to fix msbuild issues (#6279)
* Bump VSMac to 8.1.0.2742 to fix msbuild issues

This is required to get the support for the msbuild `ToolsVersion`
change from `15.0` to `Current`.

* [tests][msbuild] Fix Binding resources test with updated msbuild

Test failure with updated msbuild and vsmac 8.1:

```
Xamarin.iOS.Tasks.NativeReferencesNoEmbedding("iPhone").ShouldNotUnnecessarilyRebuildBindingProject(True)
     Binding project build did not create package?
  Expected: True
  But was:  False

at Xamarin.iOS.Tasks.NativeReferencesNoEmbedding.ShouldNotUnnecessarilyRebuildBindingProject (System.Boolean framework) [0x000a0] in <74b8f7d8a53e40109916d305bb4d7403>:0
at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo cul
ture) [0x0006a] in <0519fa732e8845b6a809ce9180f541db>:0
```

The test builds the project multiple times. Before the 3rd build, the project
file's timestamp is updated and expects that the binding package will be
rebuilt. But it is not, because the target `_CreateBindingResourcePackage`
doesn't depend on that project file. So, add that to the target inputs.

* [nuget] Use xibuild to run nuget

Fix errors seen during `nuget restore` for tests:

```
Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xammac_tests/xammac_tests.csproj(213,3): error MSB4024: The imported project file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.CSharp.targets" could not be loaded. Could not find file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.CSharp.targets"
```
2019-06-19 07:07:26 +02:00
Rolf Bjarne Kvinge 2f877cfe8b
[msbuild] [tests] Ignore PhotoEditingTests until Apple fixes the PhotosUI framework's header to compile. (#6333)
Partial fix for https://github.com/xamarin/xamarin-macios/issues/6325.
2019-06-17 19:13:40 +02:00
monojenkins 82d0a65400 [msbuild] Lock variables accessed in a Parallel.ForEach callback. (#6188)
Lock variables accessed in a Parallel.ForEach callback, since the callback
must be thread-safe because it's executed in parallel using multiple threads.
2019-06-03 13:16:50 +02:00
monojenkins 3cd018b55c [msbuild] Lock variables accessed in a Parallel.ForEach callback. (#6189)
Lock variables accessed in a Parallel.ForEach callback, since the callback
must be thread-safe because it's executed in parallel using multiple threads.
2019-06-03 12:59:59 +02:00
Ema 1d81c4c1fd [msbuild] Avoid running CollectBundleResources task if there's no Mac available
The IsMacEnabled condition was missing in this specific usage of the CollectBundleResources task. As with any other task that needs to run on a Mac, we should only run it if there's a Mac available or it will end up showing several warnings when building offline from Windows.
2019-05-31 11:47:41 -03:00
Rolf Bjarne Kvinge 64ae36659f
[msbuild] Lock variables accessed in a Parallel.ForEach callback. (#6173)
Lock variables accessed in a Parallel.ForEach callback, since the callback
must be thread-safe because it's executed in parallel using multiple threads.
2019-05-30 23:29:45 -07:00
Chris Hamons 733171280e
[msbuild] Add non-ui version of com.apple.AudioUnit-UI in lists (#6098)
- https://github.com/xamarin/xamarin-macios/issues/6087
- We have a list of supported extensions, we just didn't include the non-ui flavor
2019-05-22 08:14:51 -05:00
Rolf Bjarne Kvinge 8face92f47 [msbuild] Make using the fake watchOS 4.3 SDK disabled by default.
Since we now have support for ARM64_32.
2019-05-22 08:06:30 +02:00
Bernhard Urban d26208422c [mtouch] Add support for arm64_32 2019-05-22 08:04:50 +02:00
monojenkins daf5006281 [d16-2] [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6035)
* [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects.

Fixes https://github.com/mono/mono/issues/13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```

* [msbuild] Implement the same fix for XM projects as well.

* [msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         #1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >

* [tests] Adjust Xamarin.MMP.Tests.AssemblyReferencesTests.ShouldNotAllowReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.

* Remove workarounds for mono/mono#13483.

* [msbuild] Create a way out if automatically referencing System.Drawing.Common.dll causes problems.

* [msbuild] Adjust variable name and boolean logic according to review.
2019-05-10 16:16:01 +02:00
Rolf Bjarne Kvinge 9c3754b52f [msbuild] Make using the fake watchOS 4.3 SDK disabled by default.
Since we now have support for ARM64_32.
2019-05-10 08:28:43 +02:00
Bernhard Urban 9dd2340972 [mtouch] Add support for arm64_32 2019-05-10 08:28:43 +02:00
Ankit Jain 3a7bdc0a13 [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6011)
* [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects.

Fixes https://github.com/mono/mono/issues/13483 :

```
@akoeplinger: Since we moved types from Mono.Android.dll and
Xamarin.iOS/WatchOS/TVOS.dll to System.Drawing.Common.dll user projects
would fail to compile. We need to add some msbuild logic to add a
reference to the assembly automatically.
```

* [msbuild] Implement the same fix for XM projects as well.

* [msbuild] Update Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* tests.

We're including a new assembly, which means the
Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_* must be updated
accordingly.

Also modify these tests so that test assert that fails lists the actual
assembly that's missing, i.e. instead of this:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         #1
      Expected: 6
      But was:  7

we now print:

    1) Test Failure : Xamarin.iOS.Tasks.TargetTests.GetReferencedAssemblies_Executable
         References
      Expected: equivalent to < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Xml.dll", "Xamarin.iOS.dll" >
      But was:  < "mscorlib.dll", "MyLibrary.dll", "System.Core.dll", "System.dll", "System.Drawing.Common.dll", "System.Xml.dll", "Xamarin.iOS.dll" >

* [tests] Adjust Xamarin.MMP.Tests.AssemblyReferencesTests.ShouldNotAllowReference_ToSystemDrawing.

The test was verifying that referencing System.Drawing.dll and trying to use
System.Drawing.RectangleF would fail to compile (because System.Drawing.dll
shouldn't be resolved in this case).

The addition of System.Drawing.Common.dll breaks this assumption, because now
we ship System.Drawing.RectangleF, so the code that was supposed to fail to
compile works just fine instead.

So modify the test to verify that there's no System.Drawing.dll in the final
bundle.

* Remove workarounds for mono/mono#13483.

* [msbuild] Create a way out if automatically referencing System.Drawing.Common.dll causes problems.

* [msbuild] Adjust variable name and boolean logic according to review.
2019-05-10 01:20:52 +02:00
Rolf Bjarne Kvinge 19318368f0
[tests][msbuild] Remove deprecated values from csprojs. (#5995) 2019-05-06 14:40:48 +02:00
Sam 72afd997d6 Add more details to MSBuild errors for provisioning profiles (#5984) 2019-05-06 08:27:16 +02:00
monojenkins 5f6c7bb05e Add more details to MSBuild errors for provisioning profiles (#5987) 2019-05-06 07:28:54 +02:00
Rolf Bjarne Kvinge 8a33276ea8 [msbuild] Add CoreLocation to the frameworks needed in MyiOSFrameworkBinding. Fixes #5974. (#5982)
Fixes these test failures:

    1) Test Failure : Xamarin.iOS.Tasks.NativeReferencesNoEmbedding("iPhone").FrameworksEmbeddedProperly(True)
         #RunTarget-ErrorCount
    	linker command failed with exit code 1 (use -v to see invocation)
    	Native linking failed, undefined symbol: _CLLocationCoordinate2DMake. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
    	Native linking failed. Please review the build log.
      Expected: 0
      But was:  3

    2) Test Failure : Xamarin.iOS.Tasks.NativeReferencesNoEmbedding("iPhone").ShouldNotUnnecessarilyRebuildFinalProject(True)
         #RunTarget-ErrorCount
    	linker command failed with exit code 1 (use -v to see invocation)
    	Native linking failed, undefined symbol: _CLLocationCoordinate2DMake. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
    	Native linking failed. Please review the build log.
      Expected: 0
      But was:  3

Fixes https://github.com/xamarin/xamarin-macios/issues/5974.
2019-05-03 17:21:28 +02:00
Rolf Bjarne Kvinge 79f1186d8f
[msbuild] Add CoreLocation to the frameworks needed in MyiOSFrameworkBinding. Fixes #5974. (#5982)
Fixes these test failures:

    1) Test Failure : Xamarin.iOS.Tasks.NativeReferencesNoEmbedding("iPhone").FrameworksEmbeddedProperly(True)
         #RunTarget-ErrorCount
    	linker command failed with exit code 1 (use -v to see invocation)
    	Native linking failed, undefined symbol: _CLLocationCoordinate2DMake. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
    	Native linking failed. Please review the build log.
      Expected: 0
      But was:  3

    2) Test Failure : Xamarin.iOS.Tasks.NativeReferencesNoEmbedding("iPhone").ShouldNotUnnecessarilyRebuildFinalProject(True)
         #RunTarget-ErrorCount
    	linker command failed with exit code 1 (use -v to see invocation)
    	Native linking failed, undefined symbol: _CLLocationCoordinate2DMake. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in.
    	Native linking failed. Please review the build log.
      Expected: 0
      But was:  3

Fixes https://github.com/xamarin/xamarin-macios/issues/5974.
2019-05-03 17:20:07 +02:00
Alexander Köplinger 99ea097abf Merge remote-tracking branch 'upstream/master' into mono-2019-02 2019-04-24 23:28:00 +02:00
Chris Hamons ee09409baa
[msbuild][mac] Fix forcing provisioning profile when entitlements set (#5912)
- https://github.com/xamarin/xamarin-macios/issues/5061
2019-04-22 13:11:07 -05:00
Alexander Köplinger 0da0bcaaae Merge remote-tracking branch 'upstream/master' into mono-2019-02 2019-04-17 11:29:35 +02:00
William Kent dc8e07f678 Add macOS Xcode archive support (#5862)
* Initial commit of ArchiveTaskBase for macOS

* Fix namespace

* Add concrete Archive task

* Add Archive target to Xamarin.Mac.Common.targets

* Remove TODOs for non-applicable items

* Add more properties to archive Info.plist

* Add more parameters to Archive task

* Set the ArchiveDir output parameter

* Move ITunesSourceFiles parameter

* Add test

* Fix msbuild mistakes preventing archive from working

* Reorder ApplicationProperties to be at top like iOS

* Add note

* Improve error handling

* Fix archive to be loadable in Xcode

* 4 spaces to tabs

* More space -> tab
2019-04-15 15:20:18 -05:00