Skip to content

Commit

Permalink
[msbuild] Share the CodesignVerify task implementation between iOS an…
Browse files Browse the repository at this point in the history
…d macOS. (#12918)
  • Loading branch information
rolfbjarne committed Oct 6, 2021
1 parent c0032be commit 2bc66b0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 48 deletions.
21 changes: 0 additions & 21 deletions msbuild/Xamarin.Mac.Tasks/Tasks/CodesignVerify.cs

This file was deleted.

20 changes: 16 additions & 4 deletions msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CodesignVerifyTaskBase.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using System;
using System.IO;
using System.Collections.Specialized;

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

using Xamarin.MacDev;
using Xamarin.Localization.MSBuild;
using Xamarin.Utils;

namespace Xamarin.MacDev.Tasks
{
Expand Down Expand Up @@ -35,14 +34,27 @@ protected override string GenerateFullPathToTool ()
return File.Exists (path) ? path : ToolExe;
}

// Note: Xamarin.Mac and Xamarin.iOS should both override this method to do pass platform-specific verify rules
protected override string GenerateCommandLineCommands ()
{
var args = new CommandLineArgumentBuilder ();

args.Add ("--verify");
args.Add ("-vvvv");

switch (Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.WatchOS:
case ApplePlatform.MacCatalyst:
args.AddQuoted ("-R=anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.1] exists and (certificate leaf[field.1.2.840.113635.100.6.1.2] exists or certificate leaf[field.1.2.840.113635.100.6.1.4] exists)");
break;
case ApplePlatform.MacOSX:
args.Add ("--deep");
break;
default:
throw new InvalidOperationException (string.Format (MSBStrings.InvalidPlatform, Platform));
}

args.AddQuoted (Resource);

return args.ToString ();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Xamarin.Messaging.Build.Client;

namespace Xamarin.iOS.Tasks
namespace Xamarin.MacDev.Tasks
{
public class CodesignVerify : CodesignVerifyTaskBase
{
Expand Down
5 changes: 3 additions & 2 deletions msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<UsingTask TaskName="Microsoft.Build.Tasks.WriteLinesToFile" AssemblyFile="$(_TaskAssemblyName)" />

<!-- Xamarin.iOS-specific tasks. Some of these are duplicated with the Xamarin.Mac ones below, and should eventually be re-namespaced to be in Xamarin.MacDev -->
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.CodesignVerify" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.CollectAssetPacks" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.CollectITunesArtwork" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.CollectITunesSourceFiles" AssemblyFile="$(_TaskAssemblyName)" />
Expand Down Expand Up @@ -62,7 +61,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<UsingTask Condition="'$(_PlatformName)' != 'macOS'" TaskName="Xamarin.iOS.Tasks.WriteAssetPackManifest" AssemblyFile="$(_TaskAssemblyName)" />

<!-- Xamarin.Mac-specific tasks. Some of these are duplicated with the Xamarin.iOS ones above, and should eventually be re-namespaced to be in Xamarin.MacDev -->
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.CodesignVerify" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.CompileAppManifest" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.CompileEntitlements" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask Condition="'$(_PlatformName)' == 'macOS'" TaskName="Xamarin.Mac.Tasks.CompileSceneKitAssets" AssemblyFile="$(_TaskAssemblyName)" />
Expand All @@ -81,6 +79,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<UsingTask TaskName="Xamarin.MacDev.Tasks.AOTCompile" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.BTouch" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.Codesign" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.CodesignVerify" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.CollectBundleResources" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.CollectFrameworks" AssemblyFile="$(_TaskAssemblyName)" />
<UsingTask TaskName="Xamarin.MacDev.Tasks.ComputeBundleResourceOutputPaths" AssemblyFile="$(_TaskAssemblyName)" />
Expand Down Expand Up @@ -1736,6 +1735,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
ToolPath="$(CodesignPath)"
CodesignAllocate="$(_CodesignAllocate)"
Resource="$(_AppBundlePath)PlugIns\%(_ResolvedAppExtensionReferences.Filename)%(_ResolvedAppExtensionReferences.Extension)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
>
</CodesignVerify>

Expand All @@ -1746,6 +1746,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
ToolPath="$(CodesignPath)"
CodesignAllocate="$(_CodesignAllocate)"
Resource="$(AppBundleDir)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
>
</CodesignVerify>
</Target>
Expand Down
20 changes: 0 additions & 20 deletions msbuild/Xamarin.iOS.Tasks.Core/Tasks/CodesignVerifyTaskBase.cs

This file was deleted.

6 comments on commit 2bc66b0

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on Build (no summary found). 🔥

Result file $(TEST_SUMMARY_PATH) not found.

Pipeline on Agent
[msbuild] Share the CodesignVerify task implementation between iOS and macOS. (#12918)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ [CI Build] Tests passed on Build. ✅

Tests passed on Build.

API diff

✅ API Diff from stable

View API diff

Packages generated

View packages

🎉 All 218 tests passed 🎉

Pipeline on Agent XAMBOT-1027.BigSur'
[msbuild] Share the CodesignVerify task implementation between iOS and macOS. (#12918)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[msbuild] Share the CodesignVerify task implementation between iOS and macOS. (#12918)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[msbuild] Share the CodesignVerify task implementation between iOS and macOS. (#12918)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS M1 - Mac Big Sur (11.5) ❌

Tests failed on M1 - Mac Big Sur (11.5).

Failed tests are:

  • introspection

Pipeline on Agent
[msbuild] Share the CodesignVerify task implementation between iOS and macOS. (#12918)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Tests failed on macOS Mac Mojave (10.14) ❌

Tests failed on Mac Mojave (10.14).

Failed tests are:

  • dontlink
  • introspection

Pipeline on Agent
[msbuild] Share the CodesignVerify task implementation between iOS and macOS. (#12918)

Please sign in to comment.