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

1171 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge d8e7d2c854
[dotnet] Sign the 'createdump' executable. Fixes #13417. (#14111)
Fixes https://github.com/xamarin/xamarin-macios/issues/13417.
2022-02-15 08:28:29 +01:00
Rolf Bjarne Kvinge d9a02066ce
[msbuild] Provide a stamp file when codesign on-demand resources. Fixes #14126. (#14127)
Fixes https://github.com/xamarin/xamarin-macios/issues/14126.
2022-02-11 15:33:24 -05:00
Mauro Agnoletti 4cee76e0e1
Improvements on Xamarin.iOS.Tasks.Windows (#13862)
* Changes covered by this PR:

   - Removed unused references
   - Removed Xamarin.PreBuilt.iOS.app.zip since it's now built and included automatically as part of the CI build
   - Added missing signing and versioning
   - Replaced DotNetZip with System.IO.Compression.ZipFile: now that .net provides its own zip implementation we no longer require DotNetZip reference for unzipping purposes
   - Fixes the Tasks missing CodePages reference: we no longer need to replace the CodePages reference assembly by its implementation, since this project already specifies the `win` RID. The replacement was failing because `RuntimeTargetsCopyLocalItems` is empty now that the RID is set, so we ended up removing the reference.

Co-authored-by: Emanuel Fernandez Dell'Oca <ema@xamarin.com>
2022-02-10 14:20:33 +01:00
Rolf Bjarne Kvinge 808a61a12b
[msbuild] Make sure to set 'ResolveAssemblyConflicts=true' before importing Microsoft.CSharp.targets. Fixes #11691. (#14109)
We must set `ResolveAssemblyConflicts=true` before loading
Microsoft.Common.targets (which is loaded by Microsoft.CSharp.targets),
because otherwise we won'd do any conflict resolution at all, since the
variable isn't 'true' when it needs to be.

Also add test.

Fixes https://github.com/xamarin/xamarin-macios/issues/11691.
2022-02-09 14:07:35 -05:00
Rolf Bjarne Kvinge 5e462b1c21
[dotnet] Fix non-bundling of debug files for release builds. Fixes #14085. (#14103)
Fixes https://github.com/xamarin/xamarin-macios/issues/14085.
2022-02-09 16:46:04 +01: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
Rolf Bjarne Kvinge 0d27c71a48
[msbuild] Unify the _CodesignAppBundle targets between iOS and Mac. (#13870)
The targets were somewhat different, where the Mac version seemed much less
evolved than the iOS version, so this meant mostly update the iOS version to
be Mac-compatible as well (and use it for macOS).
2022-01-28 09:20:58 +01:00
Rolf Bjarne Kvinge 82207afc70
[msbuild] Share the logic to CalculateCodesignAppBundleInputs between iOS and Mac. (#13844) 2022-01-25 11:34:42 +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
Israel Soto fb65faf113
ResolveNativeReferences task pass the Xcframework NativeReference metadata to the _FrameworkNativeReference (#13846)
* This fixes issue #13843
2022-01-24 11:13:26 -05:00
Rolf Bjarne Kvinge b3a9b07244
[msbuild] Share the logic to sign app extensions between iOS and Mac. (#13807) 2022-01-21 21:12:47 +01:00
Rolf Bjarne Kvinge c965b56784
[msbuild] Copy all the files in a framework to the Mac for the FilterStaticFrameworks task. Fixes #13804. (#13805)
The FilterStaticFrameworks task takes a list of frameworks to process, but the
files actually needed by the task are inside those frameworks, which means we
have to tell XVS that those have to be copied to the Mac for the build as well.

Fixes https://github.com/xamarin/xamarin-macios/issues/13804.
2022-01-21 08:57:39 +01:00
Rolf Bjarne Kvinge bc1368cae0
[msbuild] Move the GetFiles task to shared msbuild code (Xamarin.MacDev.Tasks). (#13800) 2022-01-20 16:22:01 +01:00
Rolf Bjarne Kvinge c6ee74377a
[msbuild] Unify some of the codesign dependency properties. (#13725) 2022-01-19 18:54:08 +01:00
Rolf Bjarne Kvinge 1d9a02cbef
[dotnet] Figure out where to publish files in the app bundle. Fixes #12572. (#13591)
In .NET, all files that should be published (put into the final .app bundle) are put into the @(ResolvedFileToPublish) item group, and at the end of the build process, .NET will publish all the files in that item group. Which files are in this item group, and how they're put in there, is out of our control (it's just how the build process works in .NET), so we'll have to cope.

Additionally, publishing an app for Apple platforms is different than publishing other .NET apps, because we can't just put all the files in the a directory like .NET usually does, we have a fairly strict directory structure we need to follow, and it also differs between platforms (the structure is different between macOS and iOS for instance).

This means that for every file in the `ResolvedFileToPublish` item group, we have to figure out:

* Should it be put into the app bundle in the first place?
* If so, in which subdirectory (if any)?

This PR implements these changes. The exact details are explained in a document in the PR, but the general logic is:

* We make an educated guess for some types of files we know about (assemblies, unmanaged libraries, images, etc).
* We provide a way to set metadata on each item specifying which type of item it is (assembly, unmanaged library, image, etc), and we'll treat the item as such. This method can also be used to override the guess we made (for files that shouldn't be published for instance).
* We warn if we run into files we're not educated enough to be able to guess about, and for which there's no custom metadata set.

Fixes https://github.com/xamarin/xamarin-macios/issues/12572.
2022-01-17 09:50:06 +01:00
Rolf Bjarne Kvinge 2992e3be1b
[msbuild] Touch all files when copying an app extension into the app. (#13721)
Touch all files when copying an app extension into the app.

This fixes an issue where we'd in some cases run into this scenario:

* Build once (successfully), and sign the app (and app extension), including all dylibs.
* We build again, copy the (unsigned) app extension into the app again, but
  not sign dylibs because the timestamp went back into the past.
2022-01-17 09:05:08 +01:00
Rolf Bjarne Kvinge a2e4438536 Merge remote-tracking branch 'origin/main' into dotnet-resolvedfiletopublish 2022-01-13 22:13:00 +01:00
Rolf Bjarne Kvinge 205f22ff75 [dotnet] Touch all the destination files when copying a directory to an app bundle.
This fixes the following problem:

* App with framework is built and signed.
* App is rebuilt, and the framework is copied in again.
* This time, the framework's executable's timestamp will be earlier than the
  timestamp when it was last signed, and as such it won't be signed again.

Fix this by touching all the copied files when copying a directory to the app bundle.
2022-01-13 22:09:02 +01:00
Rolf Bjarne Kvinge 0a6f7e7fd8 [msbuild] Touch up-to-date symlinks when merging app bundles.
The symlink might point to a file that has been updated, and if that file
needs more processing and the logic checks the symlink to check if the file is
up-to-date, then we need to reflect that in the symlink (for instance if a
framework binary is updated (which is a symlink on some platforms), it needs
to be resigned, even if the symlink itself didn't change).
2022-01-13 22:04:45 +01:00
Rolf Bjarne Kvinge 70851a0e9a
[msbuild] Add helpful comment about unused property (#13676)
This way I don't keep having to figure out why the property must not be
removed, even though it's not (visibly) used.
2022-01-12 20:49:10 +01:00
Rolf Bjarne Kvinge 38cf423936
[msbuild] Share the _CleanAppBundleRootDirectory target between iOS and Mac logic. (#13680) 2022-01-12 19:21:45 +01:00
Rolf Bjarne Kvinge 0bbe4423ac [msbuild] Simplify code a bit according to review. 2022-01-11 18:31:12 +01: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
Mauro Agnoletti 165924f83a
Ensure we remotely copy all project pdbs and not only the main app one (#13650) 2022-01-06 08:00:15 -05:00
Mauro Agnoletti 9e4eaf1f1c
[hotrestart] Fixed MSBuild outputs when using $(AppBundleManifest) (#13629)
We only want the file name of the app manifest path to define the outputs because the app manifest will be always located at the app bundle root level.
For MAUI, the app manifest source file could be located on a sub-folder (like \Platforms\iOS\Info.plist) so if we take the full value of the property we will end up looking the manifest in the wrong place inside the app bundle, causing the inputs/outputs checks to fail and forcing many tasks to always run (like code sign), also causing unwanted behaviors like breaking incremental builds and incremental deployments

Co-authored-by: Alex Soto <alex@alexsoto.me>
2022-01-04 07:10:40 -05:00
Rolf Bjarne Kvinge 3fe85ef24c
[msbuild] Make sure to update global.json/NuGet.config for the Xamarin.HotRestart.PreBuilt build whenever needed. (#13625)
This fixes an issue where rebuilding in an already build working copy after a
.NET bump would fail.
2021-12-22 21:54:18 +01:00
Rolf Bjarne Kvinge 394c8fa4c7 [msbuild] The CollectBundleResources and DetectAppManifest targets need to know the target framework moniker. 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 22220b149c [dotnet] Start using the new ComputeBundleLocation task 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 19dc9ce0aa [msbuild] Add a ComputeBundleLocation task 2021-12-22 10:17:35 +01:00
Rolf Bjarne Kvinge 5551e2fff7 [msbuild] Fix the ResolveNativeReferences task to return the path to the framework binary instead of the framework directory.
That's what the _FrameworkNativeReference item group contains: framework binaries
instead of the framework directory itself. This makes us process frameworks in binding
packages correctly.
2021-12-22 10:17:34 +01:00
Rolf Bjarne Kvinge a269eec46a [msbuild] Add support for computing linker arguments for native references that are dynamic libraries.
Dynamic libraries are perfectly valid native references for macOS and Mac Catalyst.
2021-12-22 10:17:34 +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
Rolf Bjarne Kvinge 41711e7c66 [msbuild] Refactor out the logic to process the sidecar into its own function.
Best viewed by ignoring whitespace, since this is mostly whitespace changes.
2021-12-22 10:17:33 +01:00
Rolf Bjarne Kvinge 09fc600d0d [msbuild] Augment the ResolveNativeReferences task to accept and understand *.xcframework paths.
Previously we'd only support passing in a fake reference to a file inside the *.xcframework.

This makes some other code simpler later on.

Best viewed by ignoring whitespace, since this is mostly whitespace changes.
2021-12-22 10:17:33 +01:00
Rolf Bjarne Kvinge c9610cfb6b [msbuild] Augment the Ditto task to take an AdditionalArguments property to pass to 'ditto'. 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
Mauro Agnoletti d117b0a01e
Updated Xamarin.Messaging reference (#13615) 2021-12-21 09:24:42 +01:00
TJ Lambert c4e3ab85c2
[Dotnet] Fix building twice in a row issue (#13573) 2021-12-16 09:07:47 -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 342b312a73
Our current behavior is to detect any None, BundleResource or Content item that's (#13550)
named 'Info.plist', and assume that's the app manifest.

That doesn't quite work when we end up with multiple 'Info.plist' entries in any
of those item groups (one example being a framework as a BundleResource - all frameworks
have an Info.plist, and there's no good way to distinguish what the developer's intention
was).

So:

1. Implement a 'AppManifestDetectionEnabled' property to disable automatic app manifest
   detection.

2. Add a public 'AppBundleManifest' property that specifies the app manifest
   (this is just a renamed version of our previously private '_AppManifest' property).

This makes it possible for app developers to:

* Disable automatic app manifest detection.
* Still have an app manifest by specifying it manually.
* Disable automatic app manifest detection, but also not specify an app manifest
  manually (so no custom app manifest at all).

Also:

* Rename '_AppBundleManifest' to '_AppBundleManifestPath' to make it less confusing
  with the new 'AppBundleManifest' property.
2021-12-14 20:56:52 +01:00
Rolf Bjarne Kvinge d0f33c7931
[msbuild] Fix merging of apps with symlinks to directories. (#13546)
Symlinks to directories are treated the same as other symlinks (as files), not
as directories. This way we don't end up re-creating a directory hierarchy
when we only have to create a symlink.
2021-12-14 08:10:23 +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
Rolf Bjarne Kvinge b3c6218c5f
[msbuild] Improve logic to clean up the app bundle for macOS and Mac Catalyst apps before signing. (#13479)
There can't be any files in the root directory of the app bundle for macOS and
Mac Catalyst, otherwise code signing will fail. The problem is that Mono will
create a crash report in the current directory if the process crashes, and the
current directory is the root directory of the app bundle, which means that if
running an app crashes, the next build will likely fail because of the crash
report.

We had logic to detect this and remove any crash reports, but our crash report
detection pattern wasn't good enough and let some files through. This PR
updates that pattern, and also improves the code to report warnings for any
other files in the app bundle's root directory.
2021-12-07 21:33:22 +01:00
Rolf Bjarne Kvinge 6db2ef0d90
[msbuild] Enable nullable code for the Ditto task (#13493) 2021-12-07 21:33:13 +01:00
Rolf Bjarne Kvinge f8b6699ab2 Merge remote-tracking branch 'origin/main' into arm64-sim 2021-12-02 09:38:36 +01:00
Rolf Bjarne Kvinge 7dc5851520
[msbuild] Hardcode values for the nuget short folder name for legacy builds. Fixes #13469. (#13478)
The GetNuGetShortFolderName task only exists in .NET builds, which means we
have to find another way to compute the path to resources in nugets for legacy
builds. Do it the simple way by hardcoding the possible values.

Fixes https://github.com/xamarin/xamarin-macios/issues/13469.
2021-12-02 07:43:23 +01:00
Rolf Bjarne Kvinge ac441c1106 [msbuild] Detect SdkIsSimulator better for .NET by using the RuntimeIdentifier instead of only the architecture.
This way we're able to detect that "iossimulator-arm64" is actually a RID for the simulator.
2021-11-30 18:20:43 +01:00
Rolf Bjarne Kvinge 78f52e2fc2
[msbuild/tests] Add support for xcframeworks with static libraries in them. (#13459)
* [tests] Create a libtest.xcframework and libtest2.xcframework

* [tests] Make bindings-test and bindings-test2 use an xcframework instead of plain static library

* [msbuild] Add support for xcframeworks with static libraries in them.

* List the frameworks libtest needs.

* [tests] Update .NET unit tests according to test project changes.

* [tests] Add new test to verify that packing an old-style binding project doesn't work.
2021-11-30 18:19:22 +01:00
Rolf Bjarne Kvinge e2cacb8931
[msbuild] Don't use custom logic to handle facades in .NET. (#13461)
It's not needed, and may in some cases do the wrong thing: for instance, this
logic will automatically reference any *.dll files in the project directory,
which breaks the build if those *.dll files aren't actually assemblies.
2021-11-29 07:54:47 +01:00
Rolf Bjarne Kvinge 4afc8f7e3f
[dotnet] Put packages (.ipa/.pkg) in the publish directory by default. (#13436)
Partial fix for #12997.
2021-11-24 16:00:16 +01:00
Rolf Bjarne Kvinge fd126c8261
[msbuild] Use the correct logic to determine the PlugIns directory for all platforms. Fixes #13415. (#13418)
The '_AppExtensionRoot' contains the correct parent directory of the 'PlugIns'
directory for all platforms, so use that instead of appending 'PlugIns' to
'_AppBundlePath' - which is incorrect on macOS and Mac Catalyst, because the
'PlugIns' parent directory is '$(_AppBundlePath)/Contents' on those platforms.

Fixes https://github.com/xamarin/xamarin-macios/issues/13415.
2021-11-23 18:34:11 +01:00
Mauro Agnoletti 61e43f8486
Updated Hot Restart pre-built app and launch icons (#13399) 2021-11-19 09:27:03 +01:00
Rolf Bjarne Kvinge 17e7f65b2c
[msbuild] Don't execute the entire _CreateBindingResourcePackage if 'NoBindingEmbedding!=true'. (#13374)
This fixes an issue where we'd create the stamp file even if 'NoBindingEmbedding' wasn't set.

Also remove SkipBindingResourcePackage property, it doesn't show up anywhere
else in our code base, nor in the history, nor anywhere relevant in Google.
2021-11-19 08:53:01 +01:00
Mauro Agnoletti 6e532b401e
Updated Messaging and Hot Restart versions (#13367)
* Updated Xamarin.Messaging version

* Updated Xamarin.iOS.HotRestart.Application version
2021-11-18 09:17:58 +01:00
Rolf Bjarne Kvinge ab5bf2faba
[msbuild/dotnet] Build the Xamarin.PreBuilt.iOS app bundle. Fixes #12945. (#13342)
Build the Xamarin.PreBuilt.iOS app bundle instead of using a prebuilt bundle.

This makes sure that we're always using the latest BCL.

Some accurate build massaging was needed, because:

* To build the prebuilt app we need the iOS workload installed (into our build-local
  .NET installation).
* The iOS workload contains the Microsoft.iOS.Windows.Sdk pack.
* The Microsoft.iOS.Windows.Sdk pack contains the prebuilt app.

Thus we had a circular reference. Fortunately, the Microsoft.iOS.Windows.Sdk pack
is only required on Windows, which means we can break this circular reference by:

* Mark Microsoft.iOS.Windows.Sdk pack as only to be installed on Windows (unfortunately
  it seems we have to list the exact runtime identifiers for the platforms where
  to install the pack, so we can't do something like "win-*", but new variations
  of the "win-*" runtime identifier shouldn't show up all that often).
* Build the prebuilt app on macOS.

This way we don't need the Microsoft.iOS.Windows.Sdk pack when installing the iOS
workload locally.

The .NET build order is now:

* Build general sdk, runtime and ref packs for .NET.
* Build the prebuilt app.
* Build the Microsoft.iOS.Windows.Sdk pack.

Fixes https://github.com/xamarin/xamarin-macios/issues/12945.
2021-11-12 07:38:07 +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
Rolf Bjarne Kvinge 669dd22742
[msbuild] Create the directory for the .stamp file for the _CreateBindingResourcePackage target before trying to create the .stamp file. (#13179) 2021-10-29 18:34:01 +02:00
Chris Hamons 2d278e4712
[msbuild] Fix dSYM generation of iOS binding projects (#13112)
- Fixes https://github.com/xamarin/xamarin-macios/issues/13096
- This was broken in https://github.com/xamarin/xamarin-macios/pull/10304
2021-10-29 10:20:44 -05:00
Mauro Agnoletti a88ca0d29d
Updated Xamarin.Messaging version (#13145)
* Updated Xamarin.Messaging version

* Adapt BuildAgent to new Messaging changes
2021-10-28 17:00:14 +02:00
Rolf Bjarne Kvinge b70e6f4674
Submodule MonoTouch.Dialog. (#13058)
* Submodule MonoTouch.Dialog.

Submodule MonoTouch.Dialog, so that we can easily build it using .NET. This
submodule will become redundant when/if we publish a .NET version of
MonoTouch.Dialog, but until that happens we need it at least for our own test
suites.

This also means we have to copy our NuGet.config and global.json files to the
MonoTouch.Dialog project directory so that we point msbuild to use our local
build.

New commits in spouliot/Touch.Unit:

* spouliot/Touch.Unit@cbda703 [Touch.Client] Use MonoTouch.Dialog from a submodule. (#109)

Diff: 3345db2f4e..cbda703583

* Use relative path for submodule.

And fix indentation and set the branch name.

* Don't use 'RootTestsDirectory' when it might not be defined yet.

* [tests] Our test projects don't need to reference MonoTouch.Dialog directly.

The projects get the MonoTouch.Dialog reference indirectly through the
Touch.Client project reference.

* [tests] Only validate unique errors in the .NET unit tests.

* [tests] No need to reference System.Json anymore, that's handled directly in the MonoTouch.Dialog project.

* [tests] Reference nunit.framework.targets so we get a workaround for an NUnit issue everywhere.

* [msbuild] Only try to create a package if we're able to create an app bundle.

This fixes an issue where a library project would try (and fail) to create a
package when 'CreatePackage=true' (which could be set for the executable
project, but inherited by the library project since the executable project
depends on it).

* [tests] Adjust PackTest.BindingXcFrameworksProject to not set the AssemblyName property.

MSBuild ends up being very confused when the project we're trying to build
depends on other projects, because AssemblyName is set for all the projects
being build, and MSBuild complains about ambiguous projects:

> error: Ambiguous project name 'bindings-xcframework-test'
2021-10-26 08:18:34 +02:00
Chris Hamons ab5c0c6b56
[net6] Fix ILStrip'ed apps to actually work again (#13098)
* [net6] Fix ILStrip'ed apps to actually work again

- In a late minute change to the ILStrip PR (https://github.com/xamarin/xamarin-macios/pull/12563) a change to support XVS support broke execution of Apps that were stripped
- Applications were broken because none of the stripped assemblies were actually copied into the bundle
- However, the tests still passed, because all assemblies that were there had no IL (zero assemblies total)

Now why did this happen?
- The stripped assemblies were changed to return via an msbuild Output Element
- Output Element can return an Property or ItemGroup, depending if you use the PropertyName or ItemName attributes
- Unfortunately I used PropertyName, when I expected an ItemGroup. So I silently had a property created instead.
- Thus zero items were added to the list of files to copy into the bundle
- Which was undetected as the test did not confirm files were copied in, and manual tests were not run so late into the PR (3 weeks after PR was opened)

How was it fixed?
- Correctly using ItemName on Output created a valid item group to reference
- However, that still failed with an absurdly confusing error:

 PATH/Microsoft.NET.Publish.targets(277,5): error MSB3024: Could not copy the file FILE to the destination file PATH, because the destination is a folder instead of a file. To copy the source file into a folder, consider using the DestinationFolder parameter instead of DestinationFiles.

- After a splunking through netcore targets, I found the metadata on these assemblies references really matters. Without it, they are not processed correctly at all.
- Thus, I updated ILStripBase to clone the existing metadata when changing the original assembly reference to the stripped path
- Finally, I corrected the test to assert that required files are copied in. I also manually ran our device test.

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-10-25 11:31:42 -05:00
Mauro Agnoletti b2678a413c
Updated Hot Restart client package (#13029) 2021-10-20 07:45:34 +02: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
Rolf Bjarne Kvinge 79b4c9234d
[msbuild] Rename ResolveFrameworksBase.cs to ResolveNativeReferencesBase.cs (#12943)
This way the filename matches the class within.
2021-10-07 08:18:16 +02:00
Rolf Bjarne Kvinge f12d09f405
[msbuild] Share the CompileEntitlements task implementation between iOS and macOS. (#12946) 2021-10-07 08:17:50 +02:00
Rolf Bjarne Kvinge 2bc66b0cbe
[msbuild] Share the CodesignVerify task implementation between iOS and macOS. (#12918) 2021-10-06 15:51:42 +02: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
Chris Hamons a300dfc56b
[msbuild] Add ILStrip'ing for net6 applications. Fixes #11445. (#12563)
- Controlled by EnableAssemblyILStripping which defaults to true
- Integration test included

Before - https://gist.github.com/chamons/c7886f7bacbc2e5ac5966e4251d13e71
After - https://gist.github.com/chamons/148e1bef22fa336f953f3d02dcf20667

859,136 -> 527,872 managed

Fixes https://github.com/xamarin/xamarin-macios/issues/11445.
2021-10-05 09:43:22 -05:00
Rolf Bjarne Kvinge b772397b63
[msbuild] Share the BTouch task implementation between iOS and macOS. (#12873) 2021-10-04 08:18:47 +02:00
Rolf Bjarne Kvinge 62bdd683cf
[dotnet] Add support for 'dotnet pack'. Fixes #12631. (#12900)
Add support for 'dotnet pack', by:

1. Add a workaround for the fact that as soon as a project has a
   'NativeReference' item, .NET's MSBuild logic wants to include a
   'Native.$(AssemblyName).manifest' file in the NuGet. This obviously breaks,
   because we don't create such a file, so we work around it by removing the
   file in question from the corresponding item groups.

2. Add any binding resource packages to the NuGet.

3. Add tests.

Fixes https://github.com/xamarin/xamarin-macios/issues/12631.
2021-10-04 07:43:55 +02:00
Rolf Bjarne Kvinge 82e5fc4192
[msbuild] Ignore CS8002 for the Xamarin.iOS.Tasks and Xamarin.Mac.Tasks projects. (#12867)
Fixes these warnings, which we don't care about:

    CSC : warning CS8002: Referenced assembly 'Xamarin.MacDev.Tasks.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. [(...)/xamarin-macios/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj]
    CSC : warning CS8002: Referenced assembly 'Xamarin.iOS.Tasks.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. [(...)/xamarin-macios/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj]
    CSC : warning CS8002: Referenced assembly 'Xamarin.MacDev.Tasks, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. [(...)/xamarin-macios/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj]
    CSC : warning CS8002: Referenced assembly 'Xamarin.Localization.MSBuild, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. [(...)/xamarin-macios/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj]
    CSC : warning CS8002: Referenced assembly 'Xamarin.MacDev.Tasks.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. [(...)/xamarin-macios/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj]
    CSC : warning CS8002: Referenced assembly 'Xamarin.Mac.Tasks.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name. [(...)/xamarin-macios/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj]
2021-10-01 08:40:19 +02: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 10f833b032
[dotnet] Implement support for the MtouchFloat32 MSBuild property. Fixes #12524. (#12882)
Implement support for the MtouchFloat32 MSBuild property, and do so in a way
that allows us to change the default in the future, if we so wish.

Fixes https://github.com/xamarin/xamarin-macios/issues/12524.
2021-10-01 08:31:11 +02:00
Rolf Bjarne Kvinge 9286bfb793
[msbuild/dotnet] Compile project-level assets in the outer build for multi-rid builds. Fixes #12410. (#12847)
We don't need to compile project-level assets for every RuntimeIdentifier in
multi-rid builds, we can instead compile them just once in the outer build.

There is also a correctness issue here: we can't compile assets more than once
and expect to get the exact same compiled result every time (in particular
actool seems to be adding random bytes in to the compiled output), and this
creates a problem when trying to merge the different runtime-specific compiled
output into a universal binary.

We accomplish this by:

* Processing these assets in the outer build, before we execute the
  rid-specific inner builds.
* Store the paths to the assets we've processed in a file.
* In the inner builds, we read that file, and remove any matches from the
  corresponding item group.
* Make sure to copy the compiled assets to the app bundle at the end of the
  outer build.

These are the assets we currently handle this way:

* BundleResource
* ImageAsset
* InterfaceDefinition
* SceneKitAsset
* Collada
* TextureAtlas
* CoreMLModel

Also:

* Add a new test case (AppWithResource) that contains all these different
  types of assets.
* Add support for the ScnTool task on Mac Catalyst (which the new test case
  revealed was missing).

Fixes https://github.com/xamarin/xamarin-macios/issues/12410.
2021-09-30 08:25:10 +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
Rolf Bjarne Kvinge cd2867d44c
[msbuild] Share the Metal[Lib] task implementations between iOS and macOS. (#12851) 2021-09-29 07:55:55 +02:00
Rolf Bjarne Kvinge 09905e8021
[msbuild] Share the ALToolUpload and ALToolValidate task implementations between iOS and macOS. (#12852) 2021-09-28 17:38:51 +02:00
Rolf Bjarne Kvinge 8b2288fe59
[msbuild] Share the ScnTool task implementation between iOS and macOS. (#12850) 2021-09-28 17:31:53 +02:00
Rolf Bjarne Kvinge 7dc2d9af61
[msbuild] Sign Xamarin.iOS.Tasks.dll and Xamarin.Mac.Tasks.dll. Fixes #9835. (#12831)
We need to strongname our MSBuild assemblies, so that different versions
can be loaded side-by-side (one example being having both a legacy and a
.NET project in the same solution).

This required setting a version for Xamarin.iOS.Tasks.dll and
Xamarin.Mac.Tasks.dll, otherwise strong-naming won't work properly (all
versions of an assembly would have the same identity).

Also sign the corresponding test assemblies, since they poke into the
internals of the task assemblies.

Fixes https://github.com/xamarin/xamarin-macios/issues/9835.
2021-09-28 17:31:35 +02:00
Rolf Bjarne Kvinge 5cd7c96dcf
[msbuild] Share the TextureAtlas task implementation between iOS and macOS. (#12826) 2021-09-27 20:27:24 +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 9a299aeded
[msbuild] Share the OptimizeImage and OptimizePropertyList tasks and targets between iOS and macOS. (#12819)
This brings .png and .plist optimization to macOS (but no behavior is changed,
because it's already disabled by default).
2021-09-24 16:26:28 +02:00
Rolf Bjarne Kvinge 4464cc7cc7
[msbuild] Share the *CompileTextureAtlas targets between Xamarin.iOS and Xamarin.Mac. (#12818)
The iOS version is more advanced (has additional fixes for incremental
builds), so that's the one that got chosen.
2021-09-24 07:46:50 +02:00
Rolf Bjarne Kvinge 5318a2b9fa
[msbuild] Make the CompileAppManifestTaskBase.AppManifest property an ITaskItem. (#12804)
So that any input app manifest is copied to Windows when doing remote builds.
2021-09-23 18:46:37 +02:00
Rolf Bjarne Kvinge cc4bd44407
[msbuild] Fix a compiler warning about an unused variable. (#12793) 2021-09-23 15:32:57 +02:00
Rolf Bjarne Kvinge 8d994be235
[msbuild] Fix casing for couple of properties to match their other usages. (#12806) 2021-09-23 15:32:35 +02:00
Rolf Bjarne Kvinge 1e90493ccf
[msbuild] Remove dead property (AotScope). (#12805)
All the other code related to this property was removed a long time ago
(659a74cc36).
2021-09-23 15:31:58 +02:00
Mauro Agnoletti ac3325f518
Fix CopyDSYMFromMac target to copy *.DSYM to the right path in Windows (#12811)
The working directory on the Zip task was causing relative paths to be used and the resulting zip file to have unnecessary sub folders
2021-09-23 07:59:12 +02: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 a96c28b979
[msbuild] Call the generator using a response file. (#12756)
Fixes this warning:

> Xamarin.Shared.targets(992,3): warning MSB6002: The command-line for the "BTouch" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "BTouch" into multiple calls with fewer parameters per call.
2021-09-20 07:40:57 +02:00
Rolf Bjarne Kvinge f2e3e5d991
[msbuild] Simplify some code and remove usage of the 'GeneratedSources' item group, which looks public, but really isn't. (#12757) 2021-09-17 16:17:26 +02:00
Rolf Bjarne Kvinge d7651c0631
[msbuild] Remove the BundleDependentFiles item group, it's not used. (#12755)
The BundleDependentFiles item group was added as a target input some time ago [1],
but nothing ever adds to it, so it's always empty. Googling doesn't show anything
relevant either, so this looks like dead code we can remove.

[1]: d7c2a45ca9
Ref: https://github.com/xamarin/xamarin-macios/issues/11863#issuecomment-920917955
2021-09-17 16:02:09 +02: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
Rolf Bjarne Kvinge 811384f7d2
[msbuild] Fix parsing extra bundler arguments where a space separates the name and value of the argument. (#12731)
Fix parsing extra bundler arguments where a space separates the name and the
value of the argument, like this: '--xml file.xml' (as opposed to
'--xml:file.xml' or '--xml=file.xml').

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1385946.
2021-09-16 08:17:33 +02:00
Rolf Bjarne Kvinge 9cd9f17dca
[msbuild] Unify the iOS and macOS versions of the CreateBindingResourcePackage task. (#12710)
* Slightly less code.
* More code sharing.
* Brings remote windows support to this task for macOS projects if we ever
  want that.
2021-09-15 15:10:35 +02:00
Mauro Agnoletti 67fa841aa5
Updated Xamarin.Messaging version (#12728) 2021-09-15 09:37:56 +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 42471c1d22
[msbuild] Implement ITaskCallback in [Read|Write]AppManifest to tell the remote task execution that any files on Windows shouldn't be copied back to the mac. (#12646)
Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1394206.
2021-09-13 16:06:06 +02:00