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

225 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 354beec69c
[msbuild] Share the app extensions targets between iOS and Mac. (#10039)
* Share the following targets:

    * _ResolveAppExtensionReferences
    * _SplitAppExtensionReferencesByExistent
    * _AssignAppExtensionConfiguration
    * _SeparateAppExtensionReferences
    * _CopyAppExtensionsToBundle

The first four were pretty much identical between iOS and Mac already, and
needed very few changes.

The latter, _CopyAppExtensionsToBundle, required a little bit of tweaking to
the targets to make sure it works for both iOS and Mac:

* Removed the conditions on the Ditto task to check if we have app extensions
  - this is unnecessary because Inputs/Outputs on the target itself (which
  weren't there when the Ditto task conditions were written).
* Added a '_PlaceAppExtensions' target that calculates where in the
  container's app bundle extensions should be placed (the '_AppExtensionRoot'
  property), and the name of the containing folder (the 'ContainerName'
  metadata).
2020-11-04 15:39:02 +01:00
Rolf Bjarne Kvinge 3db0a33b90
[dotnet] Implement AOT compilation for mobile platforms (#9962)
* Add an AOTCompile task that runs the AOT compiler for a given set of input assemblies.
  This task will eventually be deprecated by an equivalent task provided by Mono,
  but this works for now.

* Add an _AOTCompile target that takes care of running the AOT compiler and compile
  the result into object files.
2020-10-27 15:16:34 +01:00
Wojciech Kulik d91932dcd0
Fixed issue with code signing when using multiple AdditionalAppExtensions (#9846) 2020-10-21 09:27:45 -05:00
Rolf Bjarne Kvinge 1ce9fd62a4
[msbuild] Make the default value for IsMacEnabled property dependent upon the OS. (#9892)
* [msbuild] Make the default value for IsMacEnabled property dependent upon the OS.

Also make it overridable by only setting it if it's not already set.

* Use $([MSBuild]::IsOSPlatform('windows')) instead of $(OS)

The $(OS) value isn't standardized, so there's no sane check we can do against
it.
2020-10-19 08:23:17 +02:00
Rolf Bjarne Kvinge eb5733ab93
[msbuild] Remove some watchOS 1 code. (#9797) 2020-10-09 14:11:04 +02:00
Rolf Bjarne Kvinge 3d906e7000
[dotnet] Add support for 'dotnet build -t:run'. (#9823)
* Ship mlaunch in the iOS, tvOS and watchOS NuGets. It should probably go into
  a separate NuGet (to avoid shipping the same mlaunch executable in three different
  packages), but that can be done at a later stage.

* Add a GetMlaunchArguments task that computes the mlaunch arguments to install
  or launch an app in either the simulator or on device.

* Implement the MSBuild logic to make the Run target (provided by .NET) launch
  mlaunch (for iOS, tvOS and watchOS) or the built app (for macOS). This is done
  by setting the RunCommand and RunArguments properties (which the Run target uses)
  to the correct values.

Ideally I'd would make 'dotnet run' work too, but that runs into a different problem which
I haven't figured out yet:

    A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/'.
    Failed to run as a self-contained app.
      - The application was run as a self-contained app because '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json' did not specify a framework.
      - If this should be a framework-dependent app, specify the appropriate framework in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json'.

That's for a different pull request though.

Ref: https://github.com/xamarin/net6-samples/issues/35.
2020-10-09 13:01:13 +02:00
Rolf Bjarne Kvinge dd97579e3a
[msbuild] Share the *CompileCoreMLModels targets between Xamarin.iOS and Xamarin.Mac. (#9792)
Xamarin.Mac didn't have support for CoreML models before, so this effectively adds
support for CoreML models to Xamarin.Mac.

Also add a test to make sure it actually works.
2020-10-07 08:42:17 +02:00
Rolf Bjarne Kvinge 4cf26937ce
[msbuild] Share the CodesignNativeLibraries target between Xamarin.iOS and Xamarin.Mac. (#9775) 2020-10-06 14:18:31 +02:00
Rolf Bjarne Kvinge 95b76d6ee8
[msbuild] Share the _*Metal tasks between Xamarin.iOS and Xamarin.Mac. (#9786)
* This fixes a bug in the Xamarin.Mac version, where the _ForgeMetal's Outputs
  value didn't match the actual output path (this was fixed in the iOS version).
* Also update the definition of the _ForgedMetal itemgroup to use a nested ItemGroup
  instead of the CreateItem task.
2020-10-06 14:17:56 +02:00
Rolf Bjarne Kvinge ac129fd082
[msbuild] Share the _CreatePkgInfo target between Xamarin.iOS and Xamarin.Mac. (#9770)
The Xamarin.Mac version of _CreatePkgInfo had a 'Ditto' call that seemed like
a copy-paste error (the target below has the exac same call to 'Ditto'), and
there's no reason to call 'Ditto' when creating the PkgInfo file, so I just
removed it.

The 'Ditto' call was added here: ca028ea150 (diff-ccded350e40e767d69171655acb86b01R586-R606)
2020-10-05 08:55:35 +02:00
Rolf Bjarne Kvinge 8876444586
[msbuild] Share the _*CompileSceneKitAssets targets between Xamarin.iOS and Xamarin.Mac. (#9735)
The Xamarin.iOS version is more updated, so that's the version now for both
Xamarin.iOS and Xamarin.Mac:

* The iOS version contains Inputs/Outputs (important for incremental builds).
* It doesn't use FileWrites (see e97d69b25c why
  this was removed for iOS)

Additionally define the _SceneKitCache variable for macOS as well, previously
it was only defined for iOS (I'm adding more variables than just
_SceneKitCache to macOS, most of the others will be used in in macOS in
upcoming pull requests, and this way turned out to be simplest).

And also add a new Xamarin.Mac test that exercises the CompileSceneKitAssets targets.
2020-10-01 08:37:52 +02:00
Rolf Bjarne Kvinge 94064cf3f8
[msbuild] Merge the CodesignNativeLibraries task into the Codesign task. (#9731)
Merge the CodesignNativeLibraries task into the Codesign task, since they're almost
identical (so this turns out to be a significant code reduction).

* Add a StampPath property to Codesign task, which, if set, specifies if and where
  a stamp file should be created for each signed file/directory. This replaces the
  IntermediateOutputPath property from the CodesignNativeLibraries task.
* Copy logic to detect if a file/directory needs to be resigned from the CodesignNativeLibraries
  task to the Codesign task, using any stamp files.
* Use the more descriptive error messages E0004/E0005 from the CodesignNativeLibraries
  task.
* The CodesignNativeLibraries task recursed into directories to find *.dylibs and
  *.metallib files to sign; replace this with MSBuild item group globbing.
2020-09-30 18:37:21 +02:00
Rolf Bjarne Kvinge ddde72ad2a
[msbuild] Use the ParseBundlerArguments task to parse mmp's --custom_bundle_name argument. (#9709) 2020-09-29 08:42:28 +02:00
Rolf Bjarne Kvinge 15efbe4a69
[msbuild] Share the _*CompileInterfaceDefinitions targets between Xamarin.iOS and Xamarin.Mac. (#9708)
The Xamarin.iOS version seemed more updated, so that's the version now for
both Xamarin.iOS and Xamarin.Mac.

A few differences in the Xamarin.iOS versions are:

* The _CoreCompileInterfaceDefinitions target contains Inputs/Outputs
  (important for incremental builds).
* EnableOnDemandResources is set to $(EnableOnDemandResources), not hardcoded
  to 'false' (there is no real difference right now, because
  $(EnableOnDemandResources) defaults to 'false' in Xamarin.Mac).
* It doesn't use FileWrites (see e97d69b25c why
  this was removed for iOS)
2020-09-28 09:17:50 +02:00
Rolf Bjarne Kvinge 2c3634dbcc
[msbuild] Parse the --xml extra bundler argument in ParseBundlerArgumentsTask. (#9639)
Also add some tests.
2020-09-16 09:42:21 +02:00
Rolf Bjarne Kvinge d1db57fa74
[msbuild] Parse the --registrar extra bundler argument in ParseBundlerArgumentsTask. (#9606)
Also add some tests.
2020-09-09 15:42:33 +02:00
Rolf Bjarne Kvinge f0f47b6a46
[dotnet] Make the linker always process debug symbols, and remove debugging support if we're building a release build. (#9594)
Unfortunately due to when things happen in the .NET build logic, we need to
define the DebuggerSupport property (which determines whether the app should
include debugging support or not) before importing the .NET build files. Since
we want to use the _BundlerDebug property (a.k.a. MtouchDebug/MmpDebug) to
determine if the app should include debugging support, we must figure out the
value of the _BundlerDebug property before we can define the DebuggerSupport
property. This turned out complicated, because we're currently defining
_BundlerDebug in our old-style MSBuild logic, which is imported after we
import the .NET build logic.

The end result is that we can either shuffle around a lot of MSBuild code, or
copy a few lines to set the _BundlerDebug property. Neither option makes me
very happy, but copying a few lines of code seemed the better option, so
that's what I did.

Fixes these linkall test failures in Release mode:

    LinkAll.Attributes.AttributeTest
        [FAIL] DebugAssemblyAttributes :   DebuggableAttribute
            Expected: False
            But was:  True
                at LinkAll.Attributes.AttributeTest.DebugAssemblyAttributes()

        [FAIL] DebugConstructorAttributes :   No debug attribute in release mode
            Expected: 0
            But was:  2
                at LinkAll.Attributes.AttributeTest.DebugConstructorAttributes()

        [FAIL] DebugPropertyAttributes :   DebuggerBrowsable
            Expected: False
            But was:  True
                at LinkAll.Attributes.AttributeTest.DebugPropertyAttributes()

        [FAIL] DebugTypeAttributes :   no debug attribute in release mode
            Expected: 0
            But was:  5
                at LinkAll.Attributes.AttributeTest.DebugTypeAttributes()

        [FAIL] DebuggerTypeProxy_24203 :   proxy
            Expected: null
            But was:  <System.Collections.Generic.IDictionaryDebugView`2[K,V]>
                at LinkAll.Attributes.AttributeTest.DebuggerTypeProxy_24203()
2020-09-08 14:55:34 +02:00
Rolf Bjarne Kvinge 0a1a68ab9f
[msbuild] Parse the --optimize extra bundler arguments in ParseBundlerArgumentsTask. (#9572)
Also add some tests.
2020-09-02 15:05:31 +02:00
Rolf Bjarne Kvinge 3148d28b3e
[msbuild] Unify the code to define our platform-specific conditional compilation symbols. (#9524) 2020-08-27 17:47:31 +02:00
Rolf Bjarne Kvinge 62cd5311bc
[msbuild] Emit binding resources to the EmbeddedResource item group instead of ManifestResourceWithNoCulture. Fixes #3876. (#9525)
Fixes this warning:

    warning MSB9004: ManifestResourceWithNoCulture item type is deprecated. Emit EmbeddedResource items instead, with metadata WithCulture='false', Type='Resx', and optional LogicalName.

There is a slight difference with regards to the warning message: the Type
metadata is set to 'Non-Resx' instead of 'Resx' (because these resources
aren't resx files).

Fixes https://github.com/xamarin/xamarin-macios/issues/3876.
2020-08-27 17:47:21 +02:00
Rolf Bjarne Kvinge 3a0580750d
[msbuild] Share the _CollectGeneratedSources target between Xamarin.iOS and Xamarin.Mac. (#9516) 2020-08-27 08:08:03 +02:00
Rolf Bjarne Kvinge f613eacd9b
[msbuild] Parse --marshal-managed-exceptions and --marshal-objectivec-exceptions in ParseBundlerArgumentsTask. (#9493)
Also add some tests.
2020-08-26 19:03:45 +02:00
Rolf Bjarne Kvinge 020f8e2fab
[msbuild] Re-use existing logic to compress frameworks for the ObjCBindingNativeFramework items. (#9504) 2020-08-26 19:03:18 +02:00
monojenkins 3fe21bed66
[msbuild] Fix AdditionalAppExtensions entitlement logic (#9494)
- Fixes https://github.com/xamarin/xamarin-macios/issues/9458
- Defining the variable over multiple lines changes output to include incorrect newline
- Auto tests did not catch, as they don't sign on bots due to infrastructure issues.
- Was refactored _after_ manual tests and not retested

Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2020-08-25 14:40:00 -05:00
Rolf Bjarne Kvinge 26ad21c1ad
[msbuild] Rework how we compute the input when compressing frameworks for binding projects. (#9486)
* Use ItemGroup inside a target, since using CreateItem is deprecated.
* Use target batching to make sure the _CompressNativeFrameworkResources
  target is called once per framework.
* Also add a comment for my future self describing the whole process, because
  I'll forget this by next week.

The end result is that we will now only re-compress a framework if any file in
that particular framework changed (as opposed to re-compressing all frameworks
in a binding project when any of them changed).
2020-08-25 19:25:13 +02:00
Rolf Bjarne Kvinge 18ca278e88
[msbuild] Share the Pack/UnpackLibraryResources targets between Xamarin.iOS and Xamarin.Mac. (#9471)
There were 2 differences that had to be reconciled:

* The Xamarin.Mac version took 'IntermediateOutputPath' as the intermediate
  output path, while the Xamarin.iOS version used
  'DeviceSpecificIntermediateOutputPath'.
  'DeviceSpecificIntermediateOutputPath' is defined to be
  'IntermediateOutputPath' for Xamarin.Mac, so make the shared version use
  'DeviceSpecificIntermediateOutputPath', since that works in both cases.

* The Xamarin.Mac version was writing the output of PackLibraryResources to
  the FileWrites item group. This was removed on purpose from the Xamarin.iOS
  version in e97d69b25c, so it seemed best to
  leave it out in the shared version as well.

Also re-use the _EmbeddedResourcePrefix variable to determine the resource prefix.
2020-08-25 10:42:33 +02:00
Rolf Bjarne Kvinge 622656acc3
[msbuild] Share the _CompressNativeFrameworkResources/_CompressFrameworks target between Xamarin.iOS and Xamarin.Mac. (#9461) 2020-08-25 10:41:50 +02:00
Rolf Bjarne Kvinge d3ea2c3a81
[msbuild] Share the _CollectNativeFrameworkResources target between Xamarin.iOS and Xamarin.Mac. (#9450) 2020-08-24 08:21:46 +02:00
Rolf Bjarne Kvinge 49511491c9
[msbuild] Set ResolveAssemblyConflicts once. (#9441)
No need to set it in every file, when we have one file that rules them all.
2020-08-21 18:38:57 +02:00
Rolf Bjarne Kvinge 587ec0dd63
[msbuild] Share the _PrepareNativeReferences target between Xamarin.iOS and Xamarin.Mac. (#9442) 2020-08-21 18:24:39 +02:00
Rolf Bjarne Kvinge f3048eece5
[msbuild] Share three stub targets for Windows between Xamarin.iOS and Xamarin.Mac. (#9443)
These only apply to Xamarin.iOS right now, since they're Windows-specific (and
we don't support Xamarin.Mac binding projects on Windows), but if we ever do
end up supporting binding projects for Xamarin.Mac on Windows, we'll need
these targets there, so just make them shared code.
2020-08-21 18:10:32 +02:00
Rolf Bjarne Kvinge 86003f37c9
[msbuild] Share the IsMacEnabled and MtouchTargetsEnabled definitions between Xamarin.iOS and Xamarin.Mac. (#9439) 2020-08-21 15:01:30 +02:00
Rolf Bjarne Kvinge 7d9666c96e
[msbuild] Add a Xamarin.Shared.ObjCBinding.targets file for shared binding code between Xamarin.iOS and Xamarin.Mac. (#9437)
Add a Xamarin.Shared.ObjCBinding.targets file for shared binding code between
Xamarin.iOS and Xamarin.Mac and start sharing some of the binding code.
2020-08-21 14:55:00 +02:00
Rolf Bjarne Kvinge 9e6ecc8e1a
[msbuild] Share the AllowedReferenceRelatedFileExtensions property override. (#9417) 2020-08-21 10:13:26 +02:00
Rolf Bjarne Kvinge 9a4f5cf388
[dotnet] Turn the linker off by default for simulator builds. (#9403)
This becomes a bit complicated because we have to wait to determine the default value
for the linker until we know if we're building for the simulator or not (which happens
in the _DetectSdkLocations target).
2020-08-20 14:26:43 +02:00
Rolf Bjarne Kvinge 4e1b571ab6 [msbuild] Pass the path to the binding attribute assembly to bgen. 2020-08-10 16:12:41 +02:00
Rolf Bjarne Kvinge df69755fb0 [msbuild] Create the output directory for generated binding sources. 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
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 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
Rolf Bjarne Kvinge 8b9bfe2877
[dotnet] Add Verbosity to the linker configuration. (#9169) 2020-07-23 18:07:05 +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
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
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
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
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 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 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 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 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
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 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 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 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
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
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
Chris Hamons d7c2a45ca9
Add 'NoBindingEmbedding' style binding project support (#5167)
- Existing binding projects embed the native libraries within the assembly as managed resource
- This does not scale well and has performance implications
- This PR creates a new property, NoBindingEmbedding which when true processes the building and consumption of binding projects differently.
- Existing binding projects are not affected, they will continue as is
- I've written a full XM test suite and ported a subset to iOS. Since iOS only supports checked in projects, and I didn't want to make the existing situation worse by adding more, I only wrote tests that could use the existing test projects.
    -When we complete some form of msbuild testing reform, we'll revisit these tests.
- Remove two files in MyiOSFrameworkBinding that are not used (we use copies elsewhere)
- Remove unnecessary sleep and fix broken touch command
- Output failing test log to console instead of test output
    - VSfM does not handle thousands of lines of test failure message well
- Add ability to generate binding projects with LinkWith
2018-12-12 09:55:57 -05:00