Skip to content

Commit

Permalink
This snowballed a bit...
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne committed Jun 11, 2024
1 parent c315807 commit 6f013af
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/CompileEntitlements.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public class CompileEntitlements : XamarinTask, ITaskCallback, ICancelableTask {
}
}

PString MergeEntitlementString (PString pstr, MobileProvision? profile, bool expandWildcards, string key)
PString MergeEntitlementString (PString pstr, MobileProvision? profile, bool expandWildcards, string? key)
{
string TeamIdentifierPrefix;
string AppIdentifierPrefix;
Expand Down Expand Up @@ -198,19 +198,19 @@ PString MergeEntitlementString (PString pstr, MobileProvision? profile, bool exp
return new PString (expanded);
}

PArray? MergeEntitlementArray (PArray array, MobileProvision? profile)
PArray? MergeEntitlementArray (PArray array, MobileProvision? profile, string? key)
{
var result = new PArray ();

foreach (var item in array) {
PObject? value;

if (item is PDictionary)
value = MergeEntitlementDictionary ((PDictionary) item, profile);
value = MergeEntitlementDictionary ((PDictionary) item, profile, key);
else if (item is PString)
value = MergeEntitlementString ((PString) item, profile, false);
value = MergeEntitlementString ((PString) item, profile, false, key);
else if (item is PArray)
value = MergeEntitlementArray ((PArray) item, profile);
value = MergeEntitlementArray ((PArray) item, profile, key);
else
value = item.Clone ();

Expand All @@ -224,19 +224,19 @@ PString MergeEntitlementString (PString pstr, MobileProvision? profile, bool exp
return null;
}

PDictionary MergeEntitlementDictionary (PDictionary dict, MobileProvision? profile)
PDictionary MergeEntitlementDictionary (PDictionary dict, MobileProvision? profile, string? key)
{
var result = new PDictionary ();

foreach (var item in dict) {
PObject? value = item.Value;

if (value is PDictionary)
value = MergeEntitlementDictionary ((PDictionary) value, profile);
value = MergeEntitlementDictionary ((PDictionary) value, profile, item.Key);
else if (value is PString)
value = MergeEntitlementString ((PString) value, profile, false);
value = MergeEntitlementString ((PString) value, profile, false, item.Key);
else if (value is PArray)
value = MergeEntitlementArray ((PArray) value, profile);
value = MergeEntitlementArray ((PArray) value, profile, item.Key);
else
value = value.Clone ();

Expand Down Expand Up @@ -286,7 +286,7 @@ void AddCustomEntitlements (PDictionary dict, MobileProvision? profile)
dict [entitlement] = new PBoolean (booleanValue);
break;
case "string":
dict [entitlement] = MergeEntitlementString (new PString (value), profile, entitlement == ApplicationIdentifierKey);
dict [entitlement] = MergeEntitlementString (new PString (value), profile, entitlement == ApplicationIdentifierKey, entitlement);
break;
case "stringarray":
var arraySeparator = item.GetMetadata ("ArraySeparator");
Expand All @@ -295,7 +295,7 @@ void AddCustomEntitlements (PDictionary dict, MobileProvision? profile)
var arrayContent = value.Split (new string [] { arraySeparator }, StringSplitOptions.None);
var parray = new PArray ();
foreach (var element in arrayContent)
parray.Add (MergeEntitlementString (new PString (element), profile, entitlement == ApplicationIdentifierKey));
parray.Add (MergeEntitlementString (new PString (element), profile, entitlement == ApplicationIdentifierKey, entitlement));
dict [entitlement] = parray;
break;
default:
Expand Down Expand Up @@ -358,11 +358,11 @@ protected virtual PDictionary GetCompiledEntitlements (MobileProvision? profile,
if (key == "com.apple.developer.icloud-container-environment")
value = new PString ("Development");
else if (value is PDictionary)
value = MergeEntitlementDictionary ((PDictionary) value, profile);
value = MergeEntitlementDictionary ((PDictionary) value, profile, key);
else if (value is PString)
value = MergeEntitlementString ((PString) value, profile, item.Key == ApplicationIdentifierKey);
value = MergeEntitlementString ((PString) value, profile, item.Key == ApplicationIdentifierKey, key);
else if (value is PArray)
value = MergeEntitlementArray ((PArray) value, profile);
value = MergeEntitlementArray ((PArray) value, profile, key);
else
value = value.Clone ();

Expand Down Expand Up @@ -393,11 +393,11 @@ protected virtual PDictionary GetCompiledEntitlements (MobileProvision? profile,
}

if (value is PDictionary)
value = MergeEntitlementDictionary ((PDictionary) value, profile);
value = MergeEntitlementDictionary ((PDictionary) value, profile, key);
else if (value is PString)
value = MergeEntitlementString ((PString) value, profile, key == ApplicationIdentifierKey);
value = MergeEntitlementString ((PString) value, profile, key == ApplicationIdentifierKey, key);
else if (value is PArray)
value = MergeEntitlementArray ((PArray) value, profile);
value = MergeEntitlementArray ((PArray) value, profile, key);
else
value = value.Clone ();

Expand Down

1 comment on commit 6f013af

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.