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

67 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge ece70a6c6e
[msbuild] Copy binding resource files back to Windows. Fixes #13393. (#14702)
Fixes https://github.com/xamarin/xamarin-macios/issues/13393.
2022-04-27 08:31:42 +02:00
Rolf Bjarne Kvinge 6a43d470d9
[msbuild] Fix typo in warning message. (#14808) 2022-04-25 08:32:28 +02:00
Rolf Bjarne Kvinge a9a638553f
[msbuild/dotnet] Fix building binding projects on Windows in .NET (#14704)
When building a binding project, we need to execute bgen (and csc) on the mac. Figuring
out where these files are on the Mac is rather complicated from a remotely executed
task, so instead we execute a sub-build that computes these properties.

In legacy Xamarin this was accomplished by building the 'Xamarin.iOS.ObjCBinding.Common.props'
file using msbuild, and invoking a custom target that prints the property we're looking
for (the 'targetGetPropertyValue_*' targets).

For multiple reasons this approach doesn't work in .NET anymore (in particular it
seems that the 'Xamarin.iOS.ObjCBinding.Common.After.targets' file with the custom
'targetGetPropertyValue_*' targets is nowhere to be found, but logic has also moved
around in the .targets/.props files which makes just building the 'Xamarin.iOS.ObjCBinding.Common.props'
not work correctly since the properties we need wouldn't be set).

So I'm adding a new task that does a sub-build, using either msbuild or dotnet as
appropriate, to compute the properties we need. Instead of building the 'Xamarin.iOS.ObjCBinding.Common.props'
file, the task creates an actual binding project (an empty one), and executes the
new '_WriteRemoteGeneratorProperties' target in this binding project.

An additional advantage in this new task is that it will only execute one sub-build
where all the properties are computed (the previous approach executed one sub-msbuild
per property).

In order to keep code as similar as possible between legacy Xamarin and .NET, the
new task is being used for legacy Xamarin as well (and the old approach deleted).

This fixes building binding projects on Windows in .NET.
2022-04-22 16:17:03 +02:00
VS MobileTools Engineering Service 2 001920f754
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 6035860 (#14756) 2022-04-18 18:10:04 -04:00
Rolf Bjarne Kvinge 1b37c48ac5
[dotnet] Add support for Mac Catalyst apps optimized interface for macOS. Fixes #14621. (#14663)
This also required bumping Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@0717ac3 Add a new device type for Mac Catalyst.
* xamarin/Xamarin.MacDev@ed2a604 Remove net451 target framework from
Xamarin.MacDev.csproj

Diff: 9e6e29f2a4..0717ac3c24

Fixes https://github.com/xamarin/xamarin-macios/issues/14621.
2022-04-07 08:14:42 +02:00
Rolf Bjarne Kvinge 50192c9f96
[msbuild] Deduplicate items in ComputeCodesignItems. Fixes #14522. (#14525)
We may end up trying to codesign the same item multiple times when codesigning
universal .NET apps. Avoid this by deduplicating items to codesign.

Fixes https://github.com/xamarin/xamarin-macios/issues/14522.
2022-03-29 07:37:57 +02:00
Rolf Bjarne Kvinge b48958be8e
[msbuild] Rework code signing to sign everything at the end of the build. (#13956)
* Add support for specifying metadata on items that are to be codesigned to
  override any general codesign setting.

* Make the Codesign task able to sign files and directories that may depend on
  eachother.

  Implement support for ordering signing so that directories containing files
  that also must be signed are signed after those files.

  This is implemented by:

  1. Normalize all input (resolve symlinks, create full path, etc.)

  2. Sort by path length (longest to shortest paths). This way we're certain
     that if we find a directory, we'll know that we won't find any files
     later in the list from inside that directory.

  3. Group into an ordered list of buckets, where each bucket contains files
     and directories that don't depend on eachother (i.e. they can all be
     signed in parallel).

  This makes it possible to call Codesign once, listing both the app bundle
  itself, and all the individual files or directories inside that need
  signing, and the Codesign task will sign the items in an order that ensures
  parent directories are always signed after any files or directories inside.

* Finally rework code signing to sign everything with a single call to the
  Codesign task in the _CodesignAppBundle target for the executable project,
  instead of having multiple calls to the Codesign task from multiple targets
  (and projects). This makes it easier to reason about what's being signed,
  and it also makes it easier to add files to the signing process.

* Also make the Codesign task able to figure out if something needs to be
  signed, and change the _CodesignAppBundle target to not keep track of
  inputs/outputs, because it becomes quite complex (for directories, it needs
  to keep track of all the files inside that directory, and also if there's
  anything in the directory that's also being signed).
2022-02-08 10:41:51 +01:00
VS MobileTools Engineering Service 2 d925c246b1
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 5659994 (#13853) 2022-01-24 15:36:28 -06:00
Rolf Bjarne Kvinge 214064d430 Merge remote-tracking branch 'origin/main' into dotnet-resolvedfiletopublish 2022-01-11 17:32:26 +01:00
VS MobileTools Engineering Service 2 be4d23a63f
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 5607500 (#13663) 2022-01-10 08:35:06 -06:00
Rolf Bjarne Kvinge 19dc9ce0aa [msbuild] Add a ComputeBundleLocation task 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge ea0b64acc6 [msbuild] Add support for processing binding resource packages directly to the ResolveNativeReferences task. 2021-12-22 10:17:33 +01:00
VS MobileTools Engineering Service 2 a7eacd2eb5
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 5561912 (#13604) 2021-12-21 10:48:59 -06:00
Rolf Bjarne Kvinge 40905dd1f7
[msbuild/dotnet] Add a FilterStaticFramework task to filter out frameworks of static libraries from frameworks we copy to the app bundle. (#13551)
A later PR will include a test case for this.
2021-12-16 07:41:53 +01:00
Rolf Bjarne Kvinge b8e9c61409
[dotnet] Parse the -gcc_flags and -link_flags mtouch/mmp arguments and pass them to the native linker. (#13521) 2021-12-13 08:33:26 +01:00
VS MobileTools Engineering Service 2 9daff111e6
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 5419189 (#13301) 2021-11-08 14:22:09 -05:00
VS MobileTools Engineering Service 2 b1b4285109
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 5313177 (#12967) 2021-10-11 10:26:55 -05:00
VS MobileTools Engineering Service 2 c0032bee1a
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 5286115 (#12916) 2021-10-06 08:31:25 -05:00
Rolf Bjarne Kvinge 43d894da15
[msbuild/tools] Augment the CreateBindingResourcePackage to support creating a zipped binding resource package. (#12868)
Augment the CreateBindingResourcePackage to support creating a zipped binding
resource package (which is just a zipped version of the binding resource
package). This can either be manually chosen by the new 'Compressed' property,
or automatically detected (create a zipped version when there's a symlink in
the binding resource package).

The default is to not create a zipped version in legacy Xamarin, and
automatically detect for .NET.

The problem this is trying to solve is when creating a NuGet package - NuGet
doesn't handle symlinks correctly and it's not possible to create a NuGet with
symlinks. Instead we need to create a zipfile with all the binding resources.
The default has been chosen so that we automatically create a zip file when
it's required for .NET, while still maintaining old behavior with legacy
Xamarin.
2021-10-01 08:40:01 +02:00
Rolf Bjarne Kvinge 7a090e9dc8
[msbuild] Sign the localization assembly as well. (#12869)
Fixes this problem:

    error MSB4018: The "FindItemWithLogicalName" task failed unexpectedly.
    error MSB4018: System.IO.FileLoadException: Could not load file or assembly 'Xamarin.Localization.MSBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)
    error MSB4018: File name: 'Xamarin.Localization.MSBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
    error MSB4018: at Xamarin.MacDev.Tasks.FindItemWithLogicalNameTaskBase.Execute()
    error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
    error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
2021-09-30 07:32:06 +02:00
VS MobileTools Engineering Service 2 0ef3a43a08
Localized file check-in by OneLocBuild Task (#12836) 2021-09-27 08:10:31 -04:00
Rolf Bjarne Kvinge c4a67e585c
[msbuild/tools] Add a better error message for when we fail to convert between iOS and macOS versions for Mac Catalyst. (#12767)
New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@9e6e29f [Xamarin.MacDev] Return valid iOS/macOS versions when converting betweeen iOS and macOS versions for Mac Catalyst.

Diff: 41d91e0de0..9e6e29f2a4
2021-09-21 16:19:04 +02:00
VS MobileTools Engineering Service 2 66b4e4519c
Localized file check-in by OneLocBuild Task (#12773) 2021-09-20 16:51:36 -04:00
Rolf Bjarne Kvinge 04548c7da0
[msbuild/dotnet] Include font files by default in .NET apps, and implement a way to automatically register them. Fixes #12536. (#12752)
* Automatically include *.ttf, *.ttc and *.otf in .NET projects as BundleResource
  items (if these files are found within the Resources/ subdirectory).
* Add support for a 'RegisterFont' metadata on BundleResource items, where if set
  to 'true', we'll register the font file in the Info.plist as required by the target
  platform.
* Add tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/12536.
2021-09-17 10:18:09 +02:00
VS MobileTools Engineering Service 2 1bacc4e029
Localized file check-in by OneLocBuild Task (#12707) 2021-09-13 17:01:23 -04:00
Rolf Bjarne Kvinge aadd53249f
[msbuild] Improve E7082 error message. (#12689) 2021-09-10 22:02:30 +02:00
Rolf Bjarne Kvinge 24ea02759f
[dotnet] Support SupportedOSPlatformVersion. Fixes #12336. (#12638)
* Add support for the SupportedOSPlatformVersion MSBuild property, and write
  it to the Info.plist for the corresponding minimum OS version.
* If there are any minimum OS version in the Info.plist, we'll now show an
  error if it doesn't match SupportedOSPlatformVersion.

This unfortunately means that if there's any minimum OS version in any
Info.plist, then that will most likely have to be moved to the
SupportedOSPlatformVersion property (or removed entirely if that's the right
choice), since it's unlikely to match the default value for
SupportedOSPlatformVersion. However, this was deemed to be the best option for
the future (it's a one-time pain during migration).

Also add new tests, update existing tests, and update the templates.

Fixes https://github.com/xamarin/xamarin-macios/issues/12336.
2021-09-08 09:20:05 +02:00
VS MobileTools Engineering Service 2 57cf3c7e06
Localized file check-in by OneLocBuild Task (#12579) 2021-08-30 16:20:11 -04:00
Rolf Bjarne Kvinge 93b2b7f2b7
Merge branch 'main' into dotnet-compileappmanifest 2021-08-26 17:29:19 +02:00
Rolf Bjarne Kvinge 6fdec1259d [tests] Add tests for CompileAppManifest and ReadAppManifest. 2021-08-24 14:41:20 +02:00
VS MobileTools Engineering Service 2 917462e32a
Localized file check-in by OneLocBuild Task (#12506) 2021-08-23 14:39:11 -04:00
Rolf Bjarne Kvinge f00b288529
[msbuild] Add a task to compute the path to the AOT compiler. (#12474)
The MonoAotCrossCompiler item group is empty when executing remotely from
Windows, so in that case we evaluate a csproj on the Mac side to compute the
AOT compiler path instead of relying in the task input from Windows.

Ref: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1362367
2021-08-19 15:48:53 +02:00
VS MobileTools Engineering Service 2 c5e60a1462
[Localization] Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 5018259 (#12220) 2021-07-28 09:57:35 -05:00
VS MobileTools Engineering Service 2 042cd714fe
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 4945304 (#12079)
First group of translated resx files coming from OneLocBuild!
2021-07-21 17:34:51 -05:00
Rolf Bjarne Kvinge 5ecb7ae337 [msbuild] List all files causing errors. 2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge 5c50a2faa3 [msbuild] Implement a MergeAppBundles task to merge two (or more) apps into a single universal/fat app. 2021-06-18 10:34:35 +02:00
TJ Lambert e06ee8e653
[Localization] Test to make sure the new resx files are compiled to Resources (Edited) (#11737)
* making sure new strings get added to designer and resources plus the test

* Next wave of changes to csproj to incorporate Rolf's changes

* fixing path

* Update tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/LocalizationStringTest.cs

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

* Update tests/mtouch/LocalizationTests.cs

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

* forgot the include

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-06-02 11:11:15 -05:00
TJ Lambert 640467a03f
Updating Localization READMEs (#11738)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-06-01 09:51:38 -05:00
TJ Lambert 4fb1707e11
initial changes to Change languageSet and Dependencies (#11512)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-05-13 08:35:08 -05:00
tj_devel709 de63dd6891 changing the resx files TEMPORARILY 2021-05-07 10:49:38 -05:00
TJ Lambert a154f30e03
[Localization] Localization changes for OneLocBuild (#11395)
Enabling MSBuild, Mtouch, and all their localization dependencies to use the new resx files provided from OneLocBuild.
2021-05-06 19:42:53 -05:00
Alex Soto c77db16b76 Revert "Localized file check-in by OneLocBuild Task"
This reverts commit 92e847b68e.
2021-03-25 19:43:47 -04:00
VS MobileTools Engineering Service 2 92e847b68e Localized file check-in by OneLocBuild Task 2021-03-25 12:25:59 -07:00
mathieubourgeois a921ee2fb1
Xamarin.Mac native Apple Silicon targetting support (#10115)
* Add support for Xamarin.Mac arm64

* Add compile product definition task

Xamarin.Mac can be provided with a ProductDefinition file for the generated pkg. Normally, providing a product definition was optional. However, with Apple Silicon, we have an extra issue : `productbuild` needs to know what architectures your package target. If not provided with them, it will guess to the best of its abilities. However, on Catalina and lower, the guess is x86_64, even if you have an arm64 slice. To fix this, we add a new task to compile the product definition and use this file to create the pkg. If you provide your own Product Definition, we can check and warn if the architectures don't match what we expect. If the file doesn't exist or there is no architecture, we set it ourselves based on our target architectures.

* Don't reference dynamic objC_send on arm64

When building in debug, we currently try to link dynamic objC_send symbols when targeting a 64-bit architecture. However, this is actually only defined on Intel architectures, not on arm64, so we end up failing because we're referring symbols that don't exist. Rework the `GetRequiredSymbols` to take an abi, and tag those symbols to only be valid on i386/x86_64, so they don't get referred at all when building on arm64, but still get referred in x86_64.

* Fix improper delete/move with already existing directories

* Fix stret requirement for Xamarin.Mac in arm64.

The generator supposes that we're running in x64 mode, refactor to take into account the possibility of running in arm64.

* Implement OS version generation in Product.plist, based on MinimumSystemVersion of the app

* Re-generalize some mmp registrar rules

`Microsoft.macOS.registrar` was missed by the current rule set

* Fix mmp tests

* Set E7072 as not translated

Tests were failing otherwise

* Rename Xamarin.Mac lib/x86_64 folder to 64bits (currently all targeted archs are the same)

* Fix style issues

* Fix `ToLower` usage for invariant usage

* Fix xtro-sharpie test
2021-03-17 21:48:02 -04:00
Rolf Bjarne Kvinge 7c6c8e02e3
[msbuild] Use the macOS SDK to build Mac Catalyst apps instead of the iOS SDK (#10644)
* Bump Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@1e738e9 [Xamarin.MacDev] Extract the code to convert between Mac Catalyst versions to a separate file. (#89)
* xamarin/Xamarin.MacDev@a3bb12c [Xamarin.MacDev] Add methods to map between iOS and macOS versions for Mac Catalyst. (#88)

Diff: 02d6d05be3..1e738e9f7f

* [msbuild] Use the macOS SDK to build Mac Catalyst apps instead of the iOS SDK

From a native compilation perspective, compilating a Mac Catalyst is the macOS SDK
+ a dash of iOS, so use the native macOS SDK to compile, and then do the corresponding
adjustments elsewhere.

At the same time document which version we want for the sdk version and the deployment
target in mtouch, and adjust the code accordingly (sdk version: macOS version; deployment
target: iOS version).

* Update resource files

* Add new entry to canary test for string localization.
2021-02-17 17:25:36 +01:00
Emanuel Fernandez Dell'Oca d337f0deac
[dotnet] Initial support for .NET6 from Windows (#10590)
These changes add support for executing iOS and MacDev tasks remotely (on a Mac) when running a build from Windows, and creates a specific .NET6 pack for Windows that's only included in the MSI.

For now this only enables builds for the iOS Simulator, physical devices are not yet supported.

- Each task decides if it should run locally or remotely depending on the SessionId property, which will only have a value on Windows.
- The XMA Build agent is now part of this repo and will be included in the iOS .NET6 Windows pack.
- On this first version we're including some Windows specific tasks and references into the Xamarin.iOS.Tasks project for simplicity, but those will be moved to the Windows specific project.

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

* [msbuild] Adds support for executing Xamarin.iOS tasks from Windows

* [msbuild] Adds support for executing Xamarin.MacDev tasks from Windows

* Added XMA Build Agent to Xamarin.MacDev.Tasks.sln

* Fixes some MSBuild versioning problems

* Makes the XMA Build agent load Xamarin.iOS tasks

We need to load a type from the iOS tasks assembly so we can run the tasks requested by MSBuild from Windows. We only need to load Xamarin.iOS.Tasks.dll since MacDev.tasks is already embedded in that one.

There's a little trick on the csproj, we can't directly use the Xamarin.iOS.Tasks project ref assemblies because that includes both Xamarin.iOS.Tasks.dll and Xamarin.MacDev.Tasks.dll, so the MacDev tasks will collide. We use the project ref only for build dependency purposes but we add an assembly reference to Xamarin.iOS.Tasks.dll.

* Added Xamarin.iOS.Tasks.Windows project

* Removed unnecessary references on Xamarin.iOS.Tasks.Windows.csproj

* Adds Messaging assemblies when ILRepacking Xamarin Tasks

The Xamarin Task assemblies now depend on Messaging, so we need the Messaging assemblies to be packed into Xamarin.Mac.Tasks and Xamarin.iOS.Tasks. Also had to remove the direct Messaging dependencies from the build agent since those are already contained in Xamarin.iOS.Tasks

* Adds a reference to Messaging.Core targets to the Agent's project

* [msbuild] Adds Xamarin iOS Windows targets

* [msbuild] Adds missing dependencies to Xamarin.iOS.Tasks

This should fix build errors because of missing dependencies. Had to move System.Net.Mqtt.Server from the Build agent project to the tasks one to avoid conflicts with System.Diagnostics.Tracer.

* [dotnet] Creates iOS Windows pack

Creates a new pack for Windows specific (targets, build agent, etc.) files that shouldn't be installed on the Mac. We have a separate package for this to avoid increasing the core pack size with things that are not needed when using it from macOS.

* Fixes type in dotnet makefile

* [dotnet] Fixes the iOS Windows pack generation

- The windows pack should not include the Sdk and Targets folders
- For now we'll just create an iOS pack
- Fixes the path to the files to include on the Windows Sdk pack

* Added reference to the Windows iOS SDK from the Xamarin.iOS.Common.targets

Added a property to navigate to the Windows iOS SDK folder, based on a naming convention that assumes that both packs will always have the same version

* Added reference to the core iOS SDK from the Windows iOS SDK

Added a property to navigate to the core iOS SDK folder, based on a naming convention that assumes that both packs will always have the same version

* Updated Messaging version

* Override MessagingBuildClientAssemblyFile property and correctly imported props from targets

* [dotnet] Make Windows pack using target files from the output dir

We need to take the target files from the output dir to include targets that are part of nuget packages, otherwise we will only include targets from our source

* [dotnet] Adds the Windows Sdk pack to the workload manifest

* [msbuild] Fixes the Windows Sdk pack name

* [dotnet] Merge Mqtt instead of Mqtt.Server

We only need System.Net.Mqtt to be merged into Xamarin.iOS.Tasks

* Updated Messaging version

* [dotnet] Several fixes for the Windows Sdk

- Adds missing task CollectMonotouchReferences
- Merges more dependencies into Xamarin.iOS.Tasks.dll needed by XMA
- Updates the msbuild/Makefile to include files from both the output dir and the source dir
- Overrides the agents directory to look for them on the Windows pack

* [dotnet] Fixes the XMA Build agent

- The build agent is an app so it cannot target ns2.0
- The MSBuild dependencies should be copied into the agent zip file
- Avoids copying all the Xamarin iOS SDK core targets into the build agent, since those are not needed
- Ensures the broker zip file is copied into the Xamarin.iOS.Windows.Tasks output dir so its included in the Windows pack

* Bumps Xamarin.Messaging to 1.2.102

* Adds net6-win branch to trigger builds

* Adds Messaging.Client missing dependency to Xamarin.Mac.Tasks

* Added Xamarin.Messaging.Apple.Tasks project and VerifyXcodeVersion Task

* Fix unloaded Xamarin.Messaging.Build project

* Added Build contracts project and unified Xamarin.Messaigng.Apple.Tasks in Xamarin.iOS.Tasks.Windows

Also added missing tasks and changes .After.targets

* Updated Xamarin.Messaging version

* Build agent - reference MSBuild assemblies from the framework

Since the assemblies will be included in the build agent we need those to be the ones that come from the framework to be compatible with macOS

* [msbuild] Fixes _UpdateDynamicLibraryId target

The tasks con this target need to be executed remotely (when building from Windows).

* Updates resources

* Bump Xamarin.Messaging

Fixes problems when executing Exec task remotely

* [dotnet] Overrides Publish targets to execute them remotely from Windows

The `_CopyResolvedFilesToPublishPreserveNewest` and `_CopyResolvedFilesToPublishAlways` targets essentially copy files into the app bundle. Since those are part of the .NET SDK we need to override those so we can pass to the Copy task the SessionId parameter and then it will be executed remotely when building from Windows.

This is done in a Windows.After.targets file so it won't affect builds on macOS.

* Added ILMerge to Xamarin.iOS.Tasks.Windows

Also modified ILMerge.targets to not include System assemblies because we don't need them on the Windows package

* Bumps Messaging

This new version of messaging fixes a problem when copying task inputs from Windows to the Mac

* [dotnet] Fixes copying files to the Mac when building from Windows

When building from Windows there are .NET SDK targets that copy dynamic libraries from the SDK to the intermediate output directory or other files to the publish directory, since we can't control those we can't run them remotely so we need to copy those files to the Mac to ensure other targets will find those.

* [dotnet] Fixes how files are copied to the output dir

- Before executing `_CopyResolvedFilesToPublishPreserveNewest` and `_CopyResolvedFilesToPublishAlways` we copy the input files for those targets to the Mac
- Then we override the original targets to execute the same copy task as the original ones but on the Mac, so the output files are placed in the right location for the following targets to pick them up.

* Fixes typo on Xamarin.iOS.Common.After.targets

* Bumps Xamarin.Messaging

* [msbuild] Fixes VerifyXcodeVersion and ResolveUTIs tasks

Both tasks were not being able to connect to the Mac mostly because of ILRepack, there were kind of 2 versions of Xamarin.Messaging, one merged into Xamarin.iOS.Tasks and another one merged into Xamarin.iOS.Windows.Tasks. Because of this the build connection object registered on the task could not be casted to the build connection type.

This essentially moves both tasks into the Xamarin.iOS.Tasks assembly to avoid this issue, and as part of that also includes the Messaging contracts into that same project.

* [msbuild] Fixes warnings when building from Windows

* [dotnet] Adds missing assemblies to merge into Xamarin.iOS.Tasks

Those 2 new assemblies will only be used from Windows and we need their implementation instead of the ref assemblies. In the future we will need to find a way of doing this on the Windows only pack insted of doing it on the core Xamarin.iOS.Tasks assembly.

* [dotnet] Compute PublishTrimmed on a target

We need to do this so the property is evaluated after VS on Windows connects to the Mac, otherwise by default IsMacEnabled is false from Windows.

* Bumps Messaging to 1.2.111

* [dotnet] Execute ILLink remotely when building from Windows

- Overrides the ILLink task and _RunILLink target to add the hability to execute it remotely, adding input and output properties so files are copied to the server and output files are created on Windows.
- This "custom" ILLink task will only be executed from the Windows targets so when building from a Mac it will execute the core SDK task.

* [dotnet] Fixes intput/output files creation for linker tasks

- Custom Linker options file should be created on the Mac so we need to execute WriteLinesToFile remotely
- All the *.items files from the linker are created on the Mac so we need to execute ReadItemsFromFile remotely
- CompileNativeCode: fixes the OutputFile metadata path, otherwise the execution fails; also copies all the files in the declared "IncludeDirectories" to the Mac
- Avoids copying input files from Windows to the Mac when running LinkNativeCode since the real input files already exist on the Mac, and Windows contains only empty files just to make MSBuild inputs/outputs check work. If we copy those empty files to the Mac we brake the build.

* [msbuild] Minor fixes after merging from main

* [dotnet] Adds missing output files to the Xamarin.iOS.Tasks.Windows project

The output of this project was missing Messaging build targets and the build agent zip file that are needed to create the dotnet Windows specific pack

* [dotnet] Fixes dotnet Windows specific pack generation

Ensures the Windows projects are built and the files are copied to the dotnet pack directory before creating the package.

It also adds a variable to enable building this pack.

* [dotnet] Adds iOS Windows specific pack to iOS only MSI

There's only a Windows specific pack for iOS available for now, so we should only add it to the iOS SDK MSI

* [dotnet] Create a separate bundle for the iOS Windows MSI

We need to do this to avoid including the Windows specific pack in the pkg. Also for now we'll only create an MSI for iOS since it's the only supported platform from Windows.

* Fixes spacing issues in Xamarin.iOS.Tasks.csproj

* Bumps Touch.Unit back to 05db76

* Fixes formatting problems

* [msbuild] Replaces error E0176 by E0186

Because there's a warning W0176 that will overlap with the error

* [msbuild] Fixes CompileEntitlements task

There were 2 problems:
1- The if statement on the DefaultEntitlementsPath was wrong, because we should return the base value if there's no SessionId (which means the task is running on a Mac)
2- We should copy to the Mac the default entitlements file if no custom file was specified

* Several fixes to cleanup the code to support iOS from Windows

* Apply suggestions from code review

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

* Formatting fixes in Xamarin.Messaging.Build

* Reverted formatting changes in CompileEntitlements.cs

* More formatting fixes

* Update msbuild/Messaging/Xamarin.Messaging.Build/Handlers/ExecuteTaskMessageHandler.cs

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

* Fixes order of MSBuild errors in the resource file

* Add newly added localizable strings to canary test of translated strings.

* Delete tests that ensure theres code only on the abstract tasks

These were needed to ensure all the code was in the base tasks so we could have tasks implementations on Windows to remote those. Now that code is part of this repo (and that is why these tests are failing now) so we do not need them anymore.

* [dotnet] Don't build the Windows SDK pack if not configured to do so.

Co-authored-by: mag <mauro.agnoletti@gmail.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-02-12 07:43:17 +01:00
Rolf Bjarne Kvinge f5d980bc08 [msbuild] Add an E7071 error message 2021-02-01 14:37:31 +01:00
Sebastien Pouliot 4eda43b1c9
[msbuild] Fix semi-conflicting options to set codesign timestamp (#10428)
TL&DR:

This effectively change nothing - but prevents (warn) if both options
contradict themselves.

Long Story....

So we have two ways to control the codesign's `--timetamp` option but
they both ignore each other so we can end up with the option being
set more than once at build time.

`DisableTimestamp` was the original one. It was meant for iOS (and
derivative OS) and disable the option (which requires the network)
for simulator or debug builds. IOW we _wanted_ timestamps when doing
release builds for devices.

```
DisableTimestamp="$(_CodesignDisableTimestamp)"
```

```
<_CodesignDisableTimestamp>False</_CodesignDisableTimestamp>
<_CodesignDisableTimestamp Condition="'$(_SdkIsSimulator)' == 'true' Or '$(_BundlerDebug)' == 'true'">True</_CodesignDisableTimestamp>
```

Now disabling the timestamp did not mean it was enabled. We did not ask
for a timestamp, leaving it to the default which from `man codesign`
means:

> If this option is not given at all, a system-specific default behavior is invoked.
> This may result in some but not all code signatures being timestamped.

Then `UseSecureTimestamp` was added for macOS builds. If hardening is
enabled then a secure timestamp is required.

`msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.targets` `_CodesignAppBundle`

```
UseSecureTimestamp="$(UseHardenedRuntime)"
```

However it's also exposed for iOS (shared target) in
`msbuild/Xamarin.Shared/Xamarin.Shared.targets` `__CodesignNativeLibraries`
but it would always be `false` in that case.

Adding this option means there's now always a `--timestamp` option given,
either to enable it (no URL so it means using Apple's server) or to
disable it (`=none`) but since it's controlled by `UseHardenedRuntime`,
which is macOS only, then iOS device builds are never timestamped.

An alternative would be to have `UseSecureTimestamp` as a macOS-only
option - but that would change how we currently sign the iOS applications
and I'd rather not change things that are known to work.
2021-01-15 10:43:11 -05:00
Rolf Bjarne Kvinge 4181593b15
[msbuild] Merge the iOS and Mac versions of the DetectSigningIdentity task. (#10407)
Mac Catalyst needs much of the Mac signing logic, so merge the iOS and Mac
versions of DetectSigningIdentity so that the Xamarin.iOS.Tasks assembly
contains what it needs for Mac Catalyst.
2021-01-14 07:49:30 +01:00
Rolf Bjarne Kvinge a54f948011
[msbuild] Unify handling of Sdks. (#10375)
* [msbuild] Unify handling of Sdks.

Create an Sdks class in Xamarin.MacDev.Tasks.Core, which handles both Xamarin.iOS
and Xamarin.Mac. Refactor the MacOSXSdks and IPhoneSdks classes to use the new Sdks
class.

This makes it possible to avoid some code duplication in MacOSXSdks and IPhoneSdks,
and also share code elsewhere.

This requires a bump of Xamarin.MacDev.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@fae0237 [Xamarin.MacDev] Add GetAppleDTSettings and GetSdkSettings to the IAppleSdk interface. (#85)

Diff: f665e3a0fc..fae0237704

* Translate exception message.

* Simplify according to review.

* Update list of non-translated strings.
2021-01-13 11:44:11 +01:00