diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CompileEntitlementsTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CompileEntitlementsTaskBase.cs
index b3ed4906d4..dbcac8337d 100644
--- a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CompileEntitlementsTaskBase.cs
+++ b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/CompileEntitlementsTaskBase.cs
@@ -29,6 +29,7 @@ namespace Xamarin.MacDev.Tasks
[Required]
public string BundleIdentifier { get; set; }
+ [Output]
[Required]
public string CompiledEntitlements { get; set; }
@@ -315,9 +316,6 @@ namespace Xamarin.MacDev.Tasks
Log.LogError ("Could not locate the provisioning profile with a Name or UUID of {0}.", ProvisioningProfile);
return false;
}
- } else if (Platform == MobileProvisionPlatform.iOS) {
- Log.LogError ("Provisioning Profiles are REQUIRED for iOS.");
- return false;
} else {
profile = null;
}
diff --git a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/DetectSigningIdentityTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/DetectSigningIdentityTaskBase.cs
index 98b9fd2465..ace2ccb11a 100644
--- a/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/DetectSigningIdentityTaskBase.cs
+++ b/msbuild/Xamarin.MacDev.Tasks.Core/Tasks/DetectSigningIdentityTaskBase.cs
@@ -353,7 +353,7 @@ namespace Xamarin.MacDev.Tasks
return !Log.HasLoggedErrors;
}
- if (!RequireProvisioningProfile && string.IsNullOrEmpty (ProvisioningProfile)) {
+ if (!RequireProvisioningProfile) {
if (SdkIsSimulator && AppleSdkSettings.XcodeVersion.Major >= 8) {
// Note: Starting with Xcode 8.0, we need to codesign iOS Simulator builds in order for them to run.
// The "-" key is a special value allowed by the codesign utility that allows us to get away with
diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs
index e923a762a2..c5f363e4f5 100644
--- a/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs
+++ b/msbuild/Xamarin.iOS.Tasks.Core/Tasks/MTouchTaskBase.cs
@@ -70,7 +70,6 @@ namespace Xamarin.iOS.Tasks
public string ArchiveSymbols { get; set; }
- [Required]
public string CompiledEntitlements { get; set; }
[Required]
@@ -82,8 +81,6 @@ namespace Xamarin.iOS.Tasks
[Required]
public bool EnableGenericValueTypeSharing { get; set; }
- public string Entitlements { get; set; }
-
public string License { get; set; }
[Required]
diff --git a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
index 381daf767c..0e373c2db6 100644
--- a/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
+++ b/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets
@@ -120,7 +120,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
<_RequireCodeSigning Condition="'$(ComputedPlatform)' == 'iPhone'">True
<_RequireProvisioningProfile>False
- <_RequireProvisioningProfile Condition="'$(ComputedPlatform)' == 'iPhone' Or '$(CodesignEntitlements)' != ''">True
+ <_RequireProvisioningProfile Condition="'$(ComputedPlatform)' == 'iPhone'">True
<_PreparedResourceRules>
<_AppBundleName>$(AssemblyName)
@@ -781,10 +781,9 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
AppBundleDir="$(AppBundleDir)"
AppManifest="$(_AppBundlePath)Info.plist"
Architectures="$(TargetArchitectures)"
- Entitlements="$(CodesignEntitlements)"
ExecutableName="$(_ExecutableName)"
NativeExecutable="$(_NativeExecutable)"
- CompiledEntitlements="$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent"
+ CompiledEntitlements="$(_CompiledEntitlements)"
Debug="$(MtouchDebug)"
EnableGenericValueTypeSharing="$(MtouchEnableGenericValueTypeSharing)"
ExtraArgs="$(MtouchExtraArgs)"
@@ -1395,7 +1394,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
-
-
+
@@ -1676,7 +1676,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
<_CodesignDisableTimestamp>False
- <_CodesignDisableTimestamp Condition="'$(_SdkIsSimulator)' == 'true' Or '$(MtouchDebug)' == 'true'">True
+ <_CodesignDisableTimestamp Condition="'$(_CodeSigningKey)' == '-' Or '$(MtouchDebug)' == 'true'">True
<_CodesignDisableTimestamp>False
- <_CodesignDisableTimestamp Condition="'$(_SdkIsSimulator)' == 'true' Or '$(MtouchDebug)' == 'true'">True
+ <_CodesignDisableTimestamp Condition="'$(_CodeSigningKey)' == '-' Or '$(MtouchDebug)' == 'true'">True
-
@@ -1773,14 +1773,15 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
-
+
+ <_CompiledEntitlementsFullPath>
<_ResourceRulesFullPath>
@@ -1788,8 +1789,8 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
-
-
+
+
@@ -1806,7 +1807,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
<_NativeExecutableFileName>$([System.IO.Path]::GetFileName('$(_NativeExecutable)'))
<_CodesignDisableTimestamp>False
- <_CodesignDisableTimestamp Condition="'$(_SdkIsSimulator)' == 'true' Or '$(MtouchDebug)' == 'true'">True
+ <_CodesignDisableTimestamp Condition="'$(_CodeSigningKey)' == '-' Or '$(MtouchDebug)' == 'true'">True
<_CodesignAppExtensionInputs>@(_AppExtensionBundleFiles);$(_EntitlementsFullPath)
@@ -1819,7 +1820,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
$(_NativeExecutableFileName)
$(_CodesignAllocate)
$(_CodesignDisableTimestamp)
- $(_EntitlementsFullPath)
+ $(_CompiledEntitlementsFullPath)
$(_ResourceRulesFullPath)
$(CodesignKeychain)
$(_CodeSigningKey)
@@ -1837,7 +1838,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
/>
-
+
<_CodesignAppBundleInputs Include="$(_AppBundlePath)**\*.*" Exclude="$(_AppBundlePath)_CodeSignature\CodeResources" />
@@ -1848,7 +1849,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
<_CodesignDisableTimestamp>False
- <_CodesignDisableTimestamp Condition="'$(_SdkIsSimulator)' == 'true' Or '$(MtouchDebug)' == 'true'">True
+ <_CodesignDisableTimestamp Condition="'$(_CodeSigningKey)' == '-' Or '$(MtouchDebug)' == 'true'">True
true
<_CodesignDisableTimestamp>False
- <_CodesignDisableTimestamp Condition="'$(_SdkIsSimulator)' == 'true' Or '$(MtouchDebug)' == 'true'">True
+ <_CodesignDisableTimestamp Condition="'$(_CodeSigningKey)' == '-' Or '$(MtouchDebug)' == 'true'">True
@@ -2048,7 +2049,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
CodesignAllocate="$(_CodesignAllocate)"
DisableTimestamp="$(_CodesignDisableTimestamp)"
Keychain="$(CodesignKeychain)"
- Entitlements="$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent"
+ Entitlements="$(_CompiledEntitlements)"
Resources="@(_AssetPack)"
SigningKey="$(_CodeSigningKey)"
ExtraArgs="$(CodesignExtraArgs)"
@@ -2075,7 +2076,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
CodesignAllocate="$(_CodesignAllocate)"
DisableTimestamp="$(_CodesignDisableTimestamp)"
Keychain="$(CodesignKeychain)"
- Entitlements="$(DeviceSpecificIntermediateOutputPath)Entitlements.xcent"
+ Entitlements="$(_CompiledEntitlements)"
ResourceRules="$(_PreparedResourceRules)"
Resources="$(_IpaAppBundleDir)"
SigningKey="$(_CodeSigningKey)"
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/CodesignAppBundle.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/CodesignAppBundle.cs
index 7591d71050..f83a713f74 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/CodesignAppBundle.cs
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/CodesignAppBundle.cs
@@ -1,7 +1,9 @@
-using System.IO;
+using System;
+using System.IO;
using System.Linq;
using System.Threading;
using System.Diagnostics;
+using System.Collections.Generic;
using NUnit.Framework;
@@ -9,13 +11,15 @@ using Xamarin.MacDev;
namespace Xamarin.iOS.Tasks
{
- [TestFixture ("Debug")]
- [TestFixture ("Release")]
+ [TestFixture ("iPhone", "Debug")]
+ [TestFixture ("iPhone", "Release")]
+ [TestFixture ("iPhoneSimulator", "Debug")]
+ [TestFixture ("iPhoneSimulator", "Release")]
public class CodesignAppBundle : ProjectTest
{
readonly string config;
- public CodesignAppBundle (string configuration) : base ("iPhone")
+ public CodesignAppBundle (string platform, string configuration) : base (platform)
{
config = configuration;
}
@@ -62,8 +66,12 @@ namespace Xamarin.iOS.Tasks
var appexDsymDir = Path.GetFullPath (Path.Combine (AppBundlePath, "..", "MyActionExtension.appex.dSYM"));
var timestamps = Directory.EnumerateFiles (AppBundlePath, "*.*", SearchOption.TopDirectoryOnly).ToDictionary (file => file, file => GetLastModified (file));
- var dsymTimestamps = Directory.EnumerateFiles (dsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file));
- var appexDsymTimestamps = Directory.EnumerateFiles (appexDsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file));
+ Dictionary dsymTimestamps = null, appexDsymTimestamps = null;
+
+ if (Platform != "iPhoneSimulator") {
+ dsymTimestamps = Directory.EnumerateFiles (dsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file));
+ appexDsymTimestamps = Directory.EnumerateFiles (appexDsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file));
+ }
Thread.Sleep (1000);
@@ -73,8 +81,6 @@ namespace Xamarin.iOS.Tasks
AssertProperlyCodesigned ();
var newTimestamps = Directory.EnumerateFiles (AppBundlePath, "*.*", SearchOption.TopDirectoryOnly).ToDictionary (file => file, file => GetLastModified (file));
- var newDsymTimestamps = Directory.EnumerateFiles (dsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file));
- var newAppexDsymTimestamps = Directory.EnumerateFiles (appexDsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file));
foreach (var file in timestamps.Keys) {
// The executable files will all be newer because they get touched during each Build, all other files should not change
@@ -84,22 +90,27 @@ namespace Xamarin.iOS.Tasks
Assert.AreEqual (timestamps[file], newTimestamps[file], "App Bundle timestamp changed: " + file);
}
- foreach (var file in dsymTimestamps.Keys) {
- // The Info.plist should be newer because it gets touched
- if (Path.GetFileName (file) == "Info.plist") {
- Assert.IsTrue (dsymTimestamps[file] < newDsymTimestamps[file], "App Bundle dSYMs Info.plist not touched: " + file);
- } else {
- Assert.AreEqual (dsymTimestamps[file], newDsymTimestamps[file], "App Bundle dSYMs changed: " + file);
- }
- }
+ if (Platform != "iPhoneSimulator") {
+ var newDsymTimestamps = Directory.EnumerateFiles (dsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file));
+ var newAppexDsymTimestamps = Directory.EnumerateFiles (appexDsymDir, "*.*", SearchOption.AllDirectories).ToDictionary (file => file, file => GetLastModified (file));
- // The appex dSYMs will all be newer because they currently get regenerated after each Build due to the fact that the entire
- // *.appex gets cloned into the app bundle each time.
- //
- // Note: we could fix this by not using `ditto` and instead implementing this ourselves to only overwrite files if they've changed
- // and then setting some [Output] params that specify whether or not we need to re-codesign and/or strip debug symbols.
- foreach (var file in appexDsymTimestamps.Keys)
- Assert.IsTrue (appexDsymTimestamps[file] < newAppexDsymTimestamps[file], "App Extension dSYMs should be newer: " + file);
+ foreach (var file in dsymTimestamps.Keys) {
+ // The Info.plist should be newer because it gets touched
+ if (Path.GetFileName (file) == "Info.plist") {
+ Assert.IsTrue (dsymTimestamps[file] < newDsymTimestamps[file], "App Bundle dSYMs Info.plist not touched: " + file);
+ } else {
+ Assert.AreEqual (dsymTimestamps[file], newDsymTimestamps[file], "App Bundle dSYMs changed: " + file);
+ }
+ }
+
+ // The appex dSYMs will all be newer because they currently get regenerated after each Build due to the fact that the entire
+ // *.appex gets cloned into the app bundle each time.
+ //
+ // Note: we could fix this by not using `ditto` and instead implementing this ourselves to only overwrite files if they've changed
+ // and then setting some [Output] params that specify whether or not we need to re-codesign and/or strip debug symbols.
+ foreach (var file in appexDsymTimestamps.Keys)
+ Assert.IsTrue (appexDsymTimestamps[file] < newAppexDsymTimestamps[file], "App Extension dSYMs should be newer: " + file);
+ }
}
[Test]