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

979 Коммитов

Автор SHA1 Сообщение Дата
Emanuel Fernandez Dell'Oca 78cc290613
[net6] Fixes LinkNativeCode task execution from Windows (#12367)
This is an improvement on how we detect if the file that is going to be copied to the Mac is coming from the output path or not. Copying files from the Windows output dir to the Mac will make the build fail.

There were two problems:
- The paths we were comparing could contain different path separators.
- The item we are trying to copy may be in a folder that is inside the output dir.

For example:
- OutputFile = `obj\Debug\net6.0-ios\iossimulator-x64\nativelibraries/Foo`
- Item to copy: `obj/Debug/net6.0-ios/iossimulator-x64/nativelibraries/aot-output/x86_64/System.Private.CoreLib.dll.o`
2021-08-06 10:45:09 +02:00
Emanuel Fernandez Dell'Oca ff56f32c77
[net6] Stops replacing custom linker steps on Windows (#12362)
The `_AdditionalTaskAssembly` prop was already fixed by 7c66aa3829, so we don't need to do this anymore. This breaks building from Windows because we're missing custom steps.

I missed adding this file to that commit.
2021-08-06 10:25:33 +02:00
Mauro Agnoletti 9dbf451d39
Added Hot Restart support into the SDK (#12293)
- Added Hot Restart support for net6
- Added Hot Restart content into the Windows iOS pack

Co-authored-by: emaf <ema@xamarin.com>
2021-08-05 09:19:51 +02:00
Rolf Bjarne Kvinge 576dbb9b35
[msbuild/dotnet] Don't overwrite the 'CreateAppBundleDependsOn' property, only add to it. Fixes #12325. (#12346)
Fixes https://github.com/xamarin/xamarin-macios/issues/12325.
2021-08-05 08:17:44 +02:00
Rolf Bjarne Kvinge ad7d08a63d
Always create binlogs during the build. (#12331)
On CI we'll collect all the binlogs in the repository and make them available
for post-build analysis if need be, so this will make it easier to diagnose
build problems.
2021-08-04 09:30:16 +02:00
Rolf Bjarne Kvinge 63f28c0c5c
[dotnet/msbuild] Fix packaging and archiving support in .NET. Partial fix for #10413. (#12244)
* Rearrange some MSBuild logic so that the packaging/archiving code for macOS
  can also be used for Mac Catalyst.
* Make the .NET build logic package/archive when requested to do so.
* Add tests.

Partial fix for https://github.com/xamarin/xamarin-macios/issues/10413.
2021-07-29 15:33:08 +02:00
Emanuel Fernandez Dell'Oca 7c66aa3829
[net6] Fixes build issues from VS for Preview 7 (#12281)
* [net6] Adds missing custom linker steps when building from Windows

To share the definition of the custom steps we need to specify the right path to the `dotnet-linker.dll`.

When building from macOS `_XamarinSdkRootDirectoryOnMac` will have the same value as `_XamarinSdkRootDirectory` (which is the local Xamarin SDK dir), but from Windows the former will be the path to the Xamarin SDK on the connected Mac. Essentially this new property is agnostic from the platform from which the build is being executed, and will always return the path to the Xamarin SDK on macOS (either local or remote), so it can be used on scenarios like this one where we know the resource we need should always be referenced from macOS.

* [net6] Updates .NET SDK path for remote tasks execution

This path needs to be updated because VS (from Dev17 Preview 3+) will install through XMA the .NET SDK and the iOS SDK on macOS in a custom dir. This should be the preferred path when building from Windows if it does exist.

* Adds missing spaces to TaskRunner.cs
2021-07-29 15:20:20 +02:00
Rolf Bjarne Kvinge aebc0117dc [msbuild] Disable the CreateIpa target on macOS and Mac Catalyst. 2021-07-28 18:27:35 +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
Rolf Bjarne Kvinge 65b7daf620 [msbuild] We're using 'EnableSGenConc' internally now, 'MtouchEnableSGenConc' might not be set. 2021-07-28 09:17:53 +02:00
Rolf Bjarne Kvinge d1e74874dc [msbuild] Move the CreateIpa target to shared code.
There was a main version of this target for Xamarin.iOS, and then numerous dummy targets for two scenarios:

* Building app extensions.
* Building macOS apps.

The first one is handled by the '_CanArchive' property (will be false when
building app extensions), and for the second case I've added it to the
condition on the CreateIpa target.

This way we don't have to have logic elsewhere about when it's valid to call
CreateIpa.
2021-07-27 14:42:58 +02:00
Rolf Bjarne Kvinge 0c9fff29ff [msbuild] Move a few more properties to the shared files so that they're before they participate in conditions. 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 9158dcc6ff [msbuild] Make code signing required when archiving a macOS or Mac Catalyst app.
We fail later with an uninformative error ('The "Archive" task was not given a
value for the required parameter "SigningKey"') otherwise, and this way the
user doesn't have to manually enable signing to avoid the this error.
2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 1aaf9404ac [msbuild] Don't execute the CollectITunesSourceFiles target on desktop platforms. 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 46128ac62e [msbuild] Add dummy CreateIpa target for Mac. 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge d7599050a7 [msbuild] Slightly rework the logic to determine if code signing is required to take Mac Catalyst into account 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 1db432a1bd [msbuild] Share the logic to determine whether a provisioning profile is required 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 38acfafd38 [msbuild] Move/document a few properties related to signing and packaging. 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge a6b10696aa [msbuild] Accept both 'CodeSigningKey' and 'CodesignKey' as synonyms.
This makes it easier to use the same csproj for multiple platforms for customers.
2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge b62b6213e2 [msbuild] Move the EnablePackageSigning variable to shared code.
So that it's set for both macOS and Mac Catalyst.
2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge ea61948502 [msbuild] Merge the EnableSGenConc properties.
We use two different properties for the same thing: MtouchEnableSGenConc and
EnableSGenConc. Going forward, we're sticking with just EnableSGenConc, but
we'll keep accepting MtouchEnableSGenConc if it's set.
2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge a2a2221c5e [msbuild] Unify the IsAppExtension property 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 1e8698ae9b [msbuild] Unify the ArchiveOnBuild property 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 3accf61ffd [msbuild] Unify the _CanOutputAppBundle property. 2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 7e52c08a52 [msbuild/dotnet] Mac Catalyst entitlements must be embedded in the app signature, not the executable.
Just like they are for macOS apps.
2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 1e496ba458 [msbuild] Move the logic to create .pkg files from Mac-specific target files to shared target files.
Because we need it for Mac Catalyst as well.
2021-07-27 13:52:46 +02:00
Rolf Bjarne Kvinge 0549af9736
[dotnet] Add support for the interpreter + AOT when needed. Fixes #11421 and #11724. (#12211)
* Add support for the interpreter everywhere.
* Add support for the AOT compiler everywhere we didn't support it before,
  because the interpreter needs it (at least System.Private.CoreLib.dll must
  be AOT-compiled when using the interpreter).
* Do FullAOT compilation on Mac Catalyst/ARM64 if we're not using the
  interpreter, since we can't use the JIT.
* Fix monotouch-test to be green on Mac Catalyst/ARM64.

Fixes https://github.com/xamarin/xamarin-macios/issues/11724.
Fixes https://github.com/xamarin/xamarin-macios/issues/11421.
2021-07-27 07:39:43 +02:00
Rolf Bjarne Kvinge 170ab44c7c
[msbuild] Unify the Archive task between iOS and Mac. (#12200)
The iOS version and the Mac version were slightly different in that they were
adding different things to the archive, but both seemed to be resilient to
those files not existing, so I just merged both implementations to try to add
everything to the archive.
2021-07-26 09:19:01 +02:00
Rolf Bjarne Kvinge 8372cda0fa
[msbuild] Remove dead code. (#12198) 2021-07-26 09:09:29 +02:00
Rolf Bjarne Kvinge 5d07e8de59
[msbuild] Make sure DeviceSpecificOutputPath always has a trailing slash. Fixes #12158. (#12162)
Fixes https://github.com/xamarin/xamarin-macios/issues/12158.
2021-07-26 08:58:13 +02:00
Rolf Bjarne Kvinge 1b357204ee
[dotnet/msbuild] Add support for using LLVM to build .NET apps. Fixes #11379. (#12136)
Fixes https://github.com/xamarin/xamarin-macios/issues/11379.
2021-07-22 15:49:22 +02:00
Rolf Bjarne Kvinge adc63843cd
[msbuild] Share the _CodesignVerify target between iOS and Mac. (#12142)
This brings the iOS logic to verify the signature in app extensions to Mac.
2021-07-22 15:48:19 +02:00
Rolf Bjarne Kvinge d26bdf97bf [dotnet] Parse --dlsym and pass it to the dotnet-linker tasks. 2021-07-22 10:36:21 +02: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 d59c218a71 [msbuild/dotnet] Make sure target Outputs show up in a task Output to make the build work correctly on windows. 2021-07-19 17:05:48 +02:00
Rolf Bjarne Kvinge 7514250d4d [msbuild] Remove unused CompileNativeCodeTaskBase.ObjectFiles property. 2021-07-16 17:11:14 +02:00
Rolf Bjarne Kvinge ce15ba272e [dotnet] Remove unused AOTCompileTaskBase.AOTData property. 2021-07-16 17:11:14 +02:00
Mauro Agnoletti bfe6fafbee
Updated Xamarin.Messaging version (#12012) 2021-06-29 10:22:54 -04:00
Rolf Bjarne Kvinge 9f82694823 [msbuild] Use the same prefix in ErrorHelper as we do in other MSBuild code. 2021-06-24 11:40:07 +02:00
Rolf Bjarne Kvinge 7f505c35d5 [dotnet] Rework how we compute the TargetArchitectures property.
Add a _MapRuntimeIdentifierToTargetArchitecture target that computes the
TargetArchitectures property from either the RuntimeIdentifier or
the RuntimeIdentifiers properties.

Also make sure this target is executed before _ComputeTargetArchitectures.

This is required so that we have a correct TargetArchitectures value for
multi-rid builds when compiling the app manifest (Info.plist).
2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge a78be0af4e [dotnet] Ignore Info.plist files from the input app bundles when merging app bundles. 2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge 5ecb7ae337 [msbuild] List all files causing errors. 2021-06-23 18:38:46 +02:00
Rolf Bjarne Kvinge 4526a5ee44 [msbuild] Copy directories correctly. 2021-06-21 11:36:45 +02:00
Rolf Bjarne Kvinge a32d60560d [msbuild] Fix symlink check to check for file presence first. 2021-06-21 11:36:45 +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
Rolf Bjarne Kvinge 8766976b49
Remove the option of disabling the windows-specific part of the .NET build. (#11971)
* Having .NET enabled with the windows-specific parts disabled is not a
  scenario tested on CI (where we've always enabled both). This means it's
  prone to bitrotting.
* It's another configuration to keep track of and make work locally.
* It doesn't work right now anyway.

So just always enable the windows-specific parts of the .NET build, if the
.NET build is enabled.
2021-06-17 19:55:55 +02:00
Rolf Bjarne Kvinge 32a62c0030
[msbuild] Treat extension-less files as static libraries when linking native code. Fixes #11954. (#11959)
Fixes https://github.com/xamarin/xamarin-macios/issues/11954.
2021-06-17 15:58:43 +02:00
Rolf Bjarne Kvinge f9d0159e07
[msbuild] Share several cleaning targets between Xamarin.iOS and Xamarin.Mac. (#11898)
The iOS version of the cleaning tasks were much more comprehensive, so those
won out when there were any differences.

This also required moving the GetDirectoriesTask to shared code.
2021-06-11 16:39:44 +02:00
Rolf Bjarne Kvinge 8bec55e22a
[msbuild] Fix P/Invoke to stat. (#11892)
The native 'stat' function is not identical between x64 and arm64:

* The x64 version is the 32-bit version of the function, and takes a 32-bit
  version of the stat structure.
* The arm64 version is the 64-bit version of the function, and takes a 64-bit
  version of the stat structure.

We used the 32-bit version of the stat structure everywhere, which went
horribly wrong on arm64, because the layout and size of the struct is quite
different (120 bytes vs 144 bytes). The actual result on arm64 was that the
call to stat would null out one of the parameters to the calling function, and
the C# code would throw an ArgumentNullException when the code tried to use
that argument, and you'd end up with this exception which didn't make any
sense at all when looking at the code:

    error : System.ArgumentNullException: Parameter "itemSpec" cannot be null. [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
    error :    at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowArgumentNull(Object parameter, String parameterName, String resourceName) in Microsoft.Build.Utilities.Core.dll:token 0x6000121+0x20 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
    error :    at Microsoft.Build.Shared.ErrorUtilities.VerifyThrowArgumentNull(Object parameter, String parameterName) in Microsoft.Build.Utilities.Core.dll:token 0x6000120+0x0 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
    error :    at Microsoft.Build.Utilities.TaskItem..ctor(String itemSpec) in Microsoft.Build.Utilities.Core.dll:token 0x60003ba+0x6 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
    error :    at Xamarin.MacDev.Tasks.SmartCopyTaskBase.CopyFile(String source, String target, String targetItemSpec) in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/SmartCopyTaskBase.cs:line 74 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]
    error :    at Xamarin.MacDev.Tasks.SmartCopyTaskBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/SmartCopyTaskBase.cs:line 99 [/Users/rolf/work/net6-mobile-samples/HelloiOS/HelloiOS.csproj]

So fix the P/Invoke to stat:

* Use the 64-bit version of the stat struct.
* For x64, call the 64-bit version of stat (stat$INODE64), since we're now
  using the 64-bit version of the stat struct.
* For arm64, call the standard version of stat (which is the 64-bit version).

And this means that we can now use the ARM64 version of .NET to build .NET
apps.
2021-06-11 07:46:01 +02:00
Sebastien Pouliot 7916e74b89
[windows][msbuild] Copy entire directory when the native reference is a framework (#11868)
The entire `.framework` directory needs to be copied back to Windows
when a native reference is a [xc]framework. Otherwise important files
will be missing and the app bundle will be unusable.

Fix https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1339824
2021-06-09 09:21:17 -04:00