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

152 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 335f8c9d90
[dotnet/msbuild] Don't bundle *.xml files that match any assemblies. Fixes #14939 and fixes #15897. (#17908)
This fixes a warning when documentation is enabled for a project:

> The file '~/.nuget/packages/fsharp.core/6.0.0/contentFiles/any/netstandard2.1/FSharp.Core.xml' does not specify a 'PublishFolderType' metadata, and a default value could not be calculated. The file will not be copied to the app bundle.

This doesn't change any behavior (as the warning says, the file wasn't copied
to the app bundle before either), but it makes the behavior explicitly
documented and silences the warning.

Fixes https://github.com/xamarin/xamarin-macios/issues/14939.
Fixes https://github.com/xamarin/xamarin-macios/issues/15897.
2023-03-30 07:24:00 +02:00
Rolf Bjarne Kvinge 7ea0044224
[dotnet/msbuild] Copy binding resource packages to output directories together with CopyLocal assemblies. Fixes #13910. (#17806)
With a project structure like this:

* Executable project references a library project.
* The library project references a binding project (or assembly).

The binding project's assembly will be copied to the library project's
output directory during the build. Unless we also make sure any binding
resource packages are copied as well, the executable project won't find those,
and the final app won't contain any native bits from the binding project.

The solution is to add any binding resource packages to the list of
files to be copied to the library's output directory.

Fixes https://github.com/xamarin/xamarin-macios/issues/13910.
2023-03-22 10:49:26 +01:00
Rolf Bjarne Kvinge 74c4fe7e25
[msbuild] Enable nullability and unify base and derived class for the GetFiles task. (#17814) 2023-03-21 18:22:12 +01:00
Rolf Bjarne Kvinge bfd87e4bb2
[msbuild] Verify Mac Catalyst apps like we verify macOS apps. Fixes #17829. (#17835)
* For Mac Catalyst apps we must verify the code signature like we do it for macOS apps. Fixes #17829.
* Enable nullability and fix code accordingly.
* Merge the CodesignVerify and CodesignVerifyTaskBase classes to simplify the code.

Submission test is added as well:

* https://github.com/xamarin/maccore/pull/2656
* https://github.com/xamarin/SubmissionSamples/pull/51

Fixes https://github.com/xamarin/xamarin-macios/issues/17829.
2023-03-21 18:20:05 +01:00
Rolf Bjarne Kvinge d6c1121f8f
[msbuild] Extract the PublishFolderType enum into its own file. (#17715) 2023-03-07 16:24:40 +01:00
Rolf Bjarne Kvinge 8e4f22d20e
[msbuild] Add DT* entries to the Info.plist for all platforms. Fixes #13300. (#17499)
Modify the code to add Xcode (DT*) variables to the Info.plist:

* Do it for all platforms, not only mobile platforms. Apple uses these fields to
  determine if an app was built with a prerelease or old version of Xcode, and will
  reject any app submissions if this validation fails.

* Change the behavior to do not distinguish simulator builds, a bit of testing
  in Xcode shows that Xcode always adds these values to the Info.plist, even for
  simulator builds. This is probably something that changed in Xcode a *long* time
  ago, since this code is old (from the initial import of the build logic from MonoDevelop
  around 10 years ago).

* Also bump Xamarin.MacDev to get a related fix:

  New commits in xamarin/Xamarin.MacDev:

  * xamarin/Xamarin.MacDev@74c95ee [Xamarin.MacDev] Always fetch the DTSDKBuild variable.

  Diff: 14d53612d4..74c95ee1c3

Fixes https://github.com/xamarin/xamarin-macios/issues/13300.
2023-02-10 22:58:38 +01:00
Emanuel Fernandez Dell'Oca 33512be08d
Update Xamarin.Messaging to 1.9.17 (#17501)
Co-authored-by: Mauro Agnoletti <mauro.agnoletti@gmail.com>
2023-02-10 22:40:08 +01:00
Andoni Morales Alastruey 97ab14801f
[dotnet] Add support for .so files (#16887)
Autotools-based project using libtool's -module flag generate plugins
with the .so extension that needs to be treated like DynamicLibraries in
terms of deployment location and relocation, except they are not linked
to the app.

This PR adds support for such .so files: they're treated as .dylib files, except
that they're not linked to the app.
2023-02-03 09:16:40 +01:00
Rolf Bjarne Kvinge 48f9d5c5ea
[msbuild] Add an SdkDevPath property to the DSymUtil task. (#17108)
Add an SdkDevPath property to the DSymUtil task, and use it to set DEVELOPER_DIR when calling dsymutil.

Should fix this:

> xcrun: error: unable to find utility "dsymutil", not a developer tool or in PATH

when `xcode-select -p` and VSMac are configured with two different Xcodes.
2023-01-12 07:09:57 +01:00
Rolf Bjarne Kvinge 10b1907b22
[msbuild] Fix a compile warning about file being added twice. (#17097)
Fixes:

> CSC : warning CS2002: Source file 'xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Errors.designer.cs' specified multiple times
2023-01-12 07:09:17 +01:00
Rolf Bjarne Kvinge aee3f88ae8
[msbuild/dotnet] Use a more unique property name than _AOTCompiler. (#17049)
Use a more unique property name than _AOTCompiler (use _XamarinAOTCompiler
instead) to try to prevent any problems if somebody else tries to use
'_AOTCompiler' somewhere.

Ref: https://github.com/xamarin/xamarin-macios/pull/17033#discussion_r1047823981
2022-12-16 07:22:51 +01:00
Rolf Bjarne Kvinge 9bf322525e
Bump Xamarin.MacDev. (#17056)
This requires a few nullability updates in our code as well.

New commits in xamarin/Xamarin.MacDev:

* xamarin/Xamarin.MacDev@14d5361 Enable nullability in PListObject.cs

Diff: ac2647b643..14d53612d4
2022-12-16 07:22:37 +01:00
Dean Ellis 669070c6ad
[perf] Update Delete Task to use DeleteFilesAsync. (#16929) 2022-12-07 07:57:39 +01:00
Rolf Bjarne Kvinge 59910e6147
[msbuild] Fix nullability issue. (#16897)
Return early after a failure, in order to fix a nullability problem where the
out variable from a method call can be null if the function returns false - in
which case we can't keep doing things, we need to return, because the
subsequent code doesn't handle the potential null value from the out
parameter.
2022-12-01 16:47:47 +01:00
Rolf Bjarne Kvinge cbfcabacf6
[msbuild] Fix parsing -gcc_flags when the value is the next argument. Fixes #16861. (#16862)
The -gcc_flags in the extra mtouch/mmp arguments can either be of the format
'-gcc_flags=<value>' or '-gcc_flags <value>'. Previously we only parsed the
former correctly, and now fix the parsing logic to handle the latter version
correctly as well.

Fixes https://github.com/xamarin/xamarin-macios/issues/16861.
2022-11-29 09:29:27 +01:00
Tim Miller 97ec7c12c8
Add Accent Color to ACTool task (#16844)
This PR addresses https://github.com/xamarin/xamarin-macios/issues/10275

`actool` can set an application's "Global" color set, overwriting the system defaults. XCode sets this as "AccentColor," but when we call it directly, we don't pass in anything. This means a user cannot overwrite this setting themselves unless they rewrite the ACTool task.

This PR adds support for the "AccentColor" property to set the accent color.

To use this:

- Create a new Asset Catalog or use the default.
- Add a new ColorSet.
- Set the "AccentColor" property in the project file:

    <PropertyGroup>
        <AccentColor>AccentColor</AccentColor>
    </PropertyGroup>

You should now see the colors reflected in the application.
2022-11-23 17:15:04 +01:00
Dean Ellis 3e4aa12a54
Do not copy files to build server for a Delete. (#16752)
The `Delete` task should not need to copy any files to the remote server.
Lets try to set this up by implementing the `ShouldCopyToBuildServer` method.

This should help reduce build times if it works.
2022-11-17 17:31:11 +01:00
Rolf Bjarne Kvinge cdc62aeae9 Merge remote-tracking branch 'origin/net7.0-xcode14.1' into main-net7.0-xcode14.1 2022-11-03 08:21:55 +01:00
VS MobileTools Engineering Service 2 36394065a3
[net7.0-xcode14.1] Updated Xamarin.Messaging to 1.8.25 (#16426)
Also adapted Build Agent and MSBuild Tasks to the new Messaging changes

This brings important changes in Xamarin.Messaging to fix an SSH incompatibility with macOS Ventura and also to fix some issues with the iOS remote build with multi targeting dotnet scenarios and also scenarios mixing dotnet and traditional Xamarin projects in the same VS session


Backport of #16419

Co-authored-by: Mauro Agnoletti <mauro.agnoletti@gmail.com>
2022-10-25 08:17:35 +02:00
Mauro Agnoletti f317b7421e
Updated Xamarin.Messaging to 1.8.25 (#16419)
Also adapted Build Agent and MSBuild Tasks to the new Messaging changes

This brings important changes in Xamarin.Messaging to fix an SSH incompatibility with macOS Ventura and also to fix some issues with the iOS remote build with multi targeting dotnet scenarios and also scenarios mixing dotnet and traditional Xamarin projects in the same VS session
2022-10-25 07:50:11 +02:00
Rolf Bjarne Kvinge 73101f2689
[msbuild] Fix dirty working copy with Errors.designer.cs. (#16404)
The Xamarin.MacDev.Tasks.sln solution is built with dotnet, while other projects
are still built with msbuild. This becomes a problem when generating Errors.designer.cs,
because depending on the runtime the output is different.

This means that the Errors.designer.cs will sometimes randomly change (depending
on which project re-generated the file), leaving the file modified in git. This is
quite annoying, but it also breaks the api comparison, which depends on the build
not leaving modified files behind. So for now, we generate Errors.designer.cs separately
for Xamarin.MacDev.Tasks.sln to not conflict with the mtouch version.

Also fix capitalization in numerous places to be consistent (it's Errors.designer.cs,
not Errors.Designer.cs).
2022-10-24 18:56:06 +02:00
Rolf Bjarne Kvinge 24f1fc18ed Merge remote-tracking branch 'origin/xcode14.1' into net7.0-xcode14.1 2022-10-20 19:30:22 +02:00
Rolf Bjarne Kvinge 6b0d192131 Merge main into xcode14.1. 2022-10-10 13:02:13 +02:00
Rolf Bjarne Kvinge 9d306f3862 Merge main into net7.0. 2022-10-10 13:01:32 +02:00
Mauro Agnoletti 448ffa9754
Updated Xamarin.Messaging to 1.8.6 (#16281) 2022-10-07 17:15:26 +02:00
Mauro Agnoletti 6bc66bf2ee
Ensure we restore the temp csproj to compute AOT compiler path (#16280)
The build command doesn't support a parameter to specify a NuGet.config, so we need to restore the temp project first, so we pass the NuGet.config file to use the sources from, in case it exists (e.g: the NuGet.config from the XMA dotnet path).

This is useful to support auhtorized NuGet feeds

Fixes Bug #1611102 - [XVS][MAUI] Failed to build .NET MAUI (net6.0) with iOS Simulator: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1611102

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2022-10-07 08:16:01 +02:00
Rolf Bjarne Kvinge fb97063227 Merge main into net7.0. 2022-10-06 14:01:27 +02:00
Rolf Bjarne Kvinge 45b97d838e Merge main into xcode14.1. 2022-10-06 13:59:29 +02:00
Rolf Bjarne Kvinge 96d7b958b6
[msbuild] Fix processing static libraries in binding sidecars. (#16227)
Fixes an issue where we'd end up trying to link with the managed assembly instead:

> ld: warning: ignoring file .../bin/Debug/net6.0-ios/MyBinding.dll, building for iOS Simulator-x86_64 but attempting to link with file built for unknown-unsupported file format ( 0x4D 0x5A 0x90 0x00 0x03 0x00 0x00 0x00 0x04 0x00 0x00 0x00 0xFF 0xFF 0x00 0x00 )

Also add a warning if we run into other types of libraries in the future to
make it easier to diagnose.
2022-10-05 08:40:20 +02:00
Rolf Bjarne Kvinge c7badeacf1 Merge main into xcode14.1. 2022-10-04 16:21:54 +02:00
Rolf Bjarne Kvinge 8b247307ab Merge main into net7.0. 2022-09-30 14:02:34 +02:00
Rolf Bjarne Kvinge 513355602d
[msbuild] Make DetectSigningIdentity.CodesignEntitlements an ITaskItem property. (#16174)
This way XVS will copy the corresponding file to the mac during a build.

Fixes this error:

Target Name=_DetectSigningIdentity
Project=C:\Users\admin\source\repos\iOSApp4\iOSApp4\iOSApp4.csproj
        DetectSigningIdentity
Assembly = C:\Program
Files\dotnet\packs\Microsoft.iOS.Sdk\16.0.515\tools\msbuild\iOS\..\iOS\Xamarin.iOS.Tasks.dll
            Parameters
                AppBundleName = iOSApp4
                BundleIdentifier = com.companyname.iOSApp4
                CodesignEntitlements = Entitlements.plist
                RequireCodeSigning = False
                SdkIsSimulator = True
                SdkPlatform = iPhoneSimulator
                SessionId = ...
TargetFrameworkMoniker = .NETCoreApp,Version=v6.0,Profile=ios
DetectSigningIdentity: 2022-09-28T04:17:13.3947732-07:00 - Started
DetectSigningIdentity: 2022-09-28T04:17:13.3947732-07:00 - Initializing
[xma][info]: Trying to get a Build Connection for Session '...':
Xamarin.Messaging.Build.Client.BuildConnection...., Lifetime: AppDomain
DetectSigningIdentity: 2022-09-28T04:17:13.3947732-07:00 - Initialized
DetectSigningIdentity: 2022-09-28T04:17:13.3957722-07:00 - There's no
available inputs to copy to the Mac
DetectSigningIdentity: 2022-09-28T04:17:13.3957722-07:00 - Serializing
intputs
DetectSigningIdentity: 2022-09-28T04:17:13.4077719-07:00 - Executing
[xma][info]: Starting remote task execution for 'iOSApp4':
Xamarin.MacDev.Tasks.DetectSigningIdentity
[xma][info]: Sending Request
Xamarin.Messaging.Build.Contracts.ExecuteTaskMessage to topic
xvs/build/execute-task/iOSApp4/01e0050002fDetectSigningIdentity
[xma][err]: An error occurred on the receiver while executing a post for
topic xvs/build/execute-task/iOSApp4/01e0050002fDetectSigningIdentity
and client
build01e0050ee064bdc5af5fe8d051898268699b25ed1eeec849023e711753e8d82d6484admin
[xma][info]: An error occurred while executing the operation. The Build
Server connection is active and running so no retries will be attempted.
            Errors
C:\Program
Files\dotnet\packs\Microsoft.iOS.Sdk\16.0.515\tools\msbuild\iOS\Xamarin.Shared.targets(1699,3):
MessagingRemoteException: An error occurred on client Build while
executing a reply for topic
xvs/build/execute-task/iOSApp4/01e0050002fDetectSigningIdentity
FileNotFoundException: Could not find file
"/Users/vstester/Library/Caches/Xamarin/mtbs/builds/iOSApp4/.../Entitlements.plist"
     [C:\Users\admin\source\repos\iOSApp4\iOSApp4\iOSApp4.csproj]
DetectSigningIdentity: 2022-09-28T04:17:13.4631033-07:00 - Finished

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1635214.
2022-09-30 09:33:33 +02:00
Rolf Bjarne Kvinge ed612dcd6e Merge main into net7.0. 2022-09-28 17:17:10 +02:00
Rolf Bjarne Kvinge 7cc91e0c53 Merge main into xcode14.1. 2022-09-28 17:14:31 +02:00
Rolf Bjarne Kvinge 9e0fecc4ff
Autoformat msbuild projects. (#16132)
All other changes should be blank space only: https://github.com/xamarin/xamarin-macios/pull/16132/files?w=1

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
2022-09-28 16:25:35 +02:00
Rolf Bjarne Kvinge 9c3458dc33 Merge main into xcode14.1. 2022-09-26 22:46:59 +02:00
Rolf Bjarne Kvinge 56165a77ec Merge main into net7.0. 2022-09-26 22:44:48 +02:00
Rolf Bjarne Kvinge b82b1685a7
Use Environment.SpecialFolder.UserProfile, not SpecialFolder.Personal. (#16017)
Context: dotnet/runtime#68610
Context: https://github.com/xamarin/xamarin-android-tools/commit/0be567a9

In Mono and .NET prior to .NET 8, the
[`System.Environment.SpecialFolder`][0]`.Personal` enum value would refer to
`$HOME` on Unix platforms.

This will be changing in .NET 8, such that
`Environment.SpecialFolder.Personal` will instead refer to
`$XDG_DOCUMENTS_DIR` (if set) or `$HOME/Documents`.  This is for "semantic
compatibility" with .NET on Windows.

Replace usage of `Environment.SpecialFolder.Personal` with
`Environment.SpecialFolder.UserProfile`, so that our code continues to work as
expected under .NET 8.

[0]: https://docs.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=net-6.0
2022-09-23 16:29:19 +02:00
Rolf Bjarne Kvinge 15e9683a53 Bump main in net7.0. 2022-09-22 07:55:18 +02:00
Rolf Bjarne Kvinge f4d5e6eeab Merge main into xcode14.1. 2022-09-22 07:50:58 +02:00
Rolf Bjarne Kvinge 52a332cb9b
[dotnet/msbuild] Add support for skipping/adding items (and bundles) to be signed. Fixes #15594. (#15894)
Add support for two new MSBuild item groups:

* CodesignBundle: lists additional app bundles inside the main bundle which should
  be signed (typically manually copied into the app bundle by the developer).
* SkipCodesignItems: lists files we'd sign by default, but which shouldn't be signed.

Fixes https://github.com/xamarin/xamarin-macios/issues/15594.
2022-09-21 11:38:03 +02:00
Rolf Bjarne Kvinge 5a613f7c86 Merge remote-tracking branch 'origin/main' into bump-main-in-net7.0-2022-09-15 2022-09-15 09:30:29 +02:00
Rolf Bjarne Kvinge 5fda07d3f3 Merge remote-tracking branch 'origin/main' into bump-main-in-xcode14.1-2022-09-15 2022-09-15 09:29:28 +02:00
Rolf Bjarne Kvinge 40199966b6
[msbuild] Automatically add the 'com.apple.security.cs.allow-jit' entitlement for desktop release builds. Fixes #15745. (#15927)
* Add support for specifying custom entitlements with an MSBuild item group.
* Use this new support to automatically add the 'com.apple.security.cs.allow-jit'
  entitlement to .NET desktop apps when building for release, since all apps that
  go through notarization will need it in order to be able to use the JIT.

It's possible to override the default behavior by adding something like this to the project file:

    <ItemGroup>
        <CustomEntitlements Include="com.apple.security.cs.allow-jit" Type="Remove" />
    </ItemGroup>

Fixes https://github.com/xamarin/xamarin-macios/issues/15745.
2022-09-13 17:41:22 +02:00
Rolf Bjarne Kvinge 7df80a40da
[msbuild] Remove MS7068 so allow creating binding projects without native libraries. Fixes #15489. (#15926)
Fixes https://github.com/xamarin/xamarin-macios/issues/15489.
2022-09-13 17:40:43 +02:00
Rolf Bjarne Kvinge f93e5fba12 Merge remote-tracking branch 'origin/main' into bump-main-in-xcode14-2022-09-13 2022-09-13 11:00:35 +02:00
Rolf Bjarne Kvinge dea88f7fed Merge remote-tracking branch 'origin/main' into bump-main-in-net7.0-2022-09-13 2022-09-13 10:59:01 +02:00
Rolf Bjarne Kvinge d769fa99cc
[msbuild] Only require a provisioning profile if we have non-empty entitlements. (#15918)
This is the behavior in legacy Xamarin (for mobile projects): if a project
contains a CodesignEntitlements=Entitlements.plist property, we require a
provisioning profile (and failing the build if none is found).

In .NET, the expected behavior is that if a file is in the project directory,
it should be detected automatically and handled accordingly. We didn't do this
for the initial release of .NET, but we implemented it later
(https://github.com/xamarin/xamarin-macios/pull/15729).

However, this turned out to be complicated, because many templates provide an
Entitlements.plist file, and now suddenly just the presence of such a file
would require a provisioning profile, which also means setting up the whole
rigmarole of Apple's certificates and provisioning profiles (and even
potentially getting a paid Apple Developer account).

This usually worked well in legacy Xamarin, because in templates only the
Release configuration would set the CodesignEntitlements=Entitlements.plist
property, and thus we'd only require a provisioning profile for release builds
(and the Entitlements.plist file would be ignored for Debug builds).

Here we change the default behavior when building for .NET so that we only
require a provisioning profile if the Entitlements.plist file is empty (i.e.
doesn't request any entitlements).

I've also implemented an override, where setting the
CodesignRequireProvisioningProfile=true property will override our default
logic.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1613459.
2022-09-13 10:51:41 +02:00
Rolf Bjarne Kvinge 17821f0585 Merge remote-tracking branch 'origin/main' into bump-main-in-net7.0-2022-09-12 2022-09-12 11:28:02 +02:00
Rolf Bjarne Kvinge 68eb7d401f Merge remote-tracking branch 'origin/main' into bump-main-in-xcode14-2022-09-12 2022-09-12 11:27:02 +02:00