Skip to content

Commit 801764f

Browse files
authored
[msbuild] Improve logging in the DetectSigningIdentity task.
1 parent db2af37 commit 801764f

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

msbuild/Xamarin.Localization.MSBuild/MSBStrings.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@
490490
</data>
491491

492492
<data name="M0132" xml:space="preserve">
493-
<value>'{0}' doesn't match '{1}'.</value>
493+
<value>The certificate '{0}' ({1}) allowed by the provisioning profile '{2}' doesn't match the certificate '{3}' ({4}).</value>
494494
</data>
495495

496496
<data name="E0133" xml:space="preserve">
@@ -505,7 +505,7 @@
505505
</data>
506506

507507
<data name="M0135" xml:space="preserve">
508-
<value>AppID: {0} was ruled out because we found a better match: {1}.</value>
508+
<value>The profile {0} with AppId {0} was ruled out because we found a better match: {2} (with AppId {3}).</value>
509509
</data>
510510

511511
<data name="M0136" xml:space="preserve">

msbuild/Xamarin.MacDev.Tasks/Tasks/DetectSigningIdentity.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -414,24 +414,20 @@ public int Compare (CodeSignIdentity x, CodeSignIdentity y)
414414

415415
IList<MobileProvision>? GetProvisioningProfiles (MobileProvisionPlatform platform, MobileProvisionDistributionType type, CodeSignIdentity identity, IList<X509Certificate2> certs)
416416
{
417-
var failures = new List<string> ();
418417
IList<MobileProvision> profiles;
419418

420419
if (identity.BundleId is not null) {
421420
if (certs.Count > 0)
422-
profiles = MobileProvisionIndex.GetMobileProvisions (platform, identity.BundleId, type, certs, unique: true, failures: failures);
421+
profiles = MobileProvisionIndex.GetMobileProvisions (platform, identity.BundleId, type, certs, unique: true);
423422
else
424-
profiles = MobileProvisionIndex.GetMobileProvisions (platform, identity.BundleId, type, unique: true, failures: failures);
423+
profiles = MobileProvisionIndex.GetMobileProvisions (platform, identity.BundleId, type, unique: true);
425424
} else if (certs.Count > 0) {
426-
profiles = MobileProvisionIndex.GetMobileProvisions (platform, type, certs, unique: true, failures: failures);
425+
profiles = MobileProvisionIndex.GetMobileProvisions (platform, type, certs, unique: true);
427426
} else {
428-
profiles = MobileProvisionIndex.GetMobileProvisions (platform, type, unique: true, failures: failures);
427+
profiles = MobileProvisionIndex.GetMobileProvisions (platform, type, unique: true);
429428
}
430429

431430
if (profiles.Count == 0) {
432-
foreach (var f in failures)
433-
Log.LogMessage (MessageImportance.Low, "{0}", f);
434-
435431
Log.LogError (MSBStrings.E0131, AppBundleName, PlatformName);
436432
return null;
437433
}
@@ -453,7 +449,7 @@ from c in certs
453449
where p.DeveloperCertificates.Any (d => {
454450
var rv = d.Thumbprint == c.Thumbprint;
455451
if (!rv)
456-
Log.LogMessage (MessageImportance.Low, MSBStrings.M0132, d.Thumbprint, c.Thumbprint);
452+
Log.LogMessage (MessageImportance.Low, MSBStrings.M0132, SecKeychain.GetCertificateCommonName (d), d.Thumbprint, p.Name, SecKeychain.GetCertificateCommonName (c), c.Thumbprint);
457453
return rv;
458454
})
459455
select new CodeSignIdentity { SigningKey = c, Profile = p }).ToList ();
@@ -483,8 +479,8 @@ CodeSignIdentity GetBestMatch (List<CodeSignIdentity> pairs, CodeSignIdentity id
483479
if (matchLength >= bestMatchLength) {
484480
if (matchLength > bestMatchLength) {
485481
bestMatchLength = matchLength;
486-
foreach (var previousMatch in matches)
487-
Log.LogMessage (MessageImportance.Low, MSBStrings.M0135, previousMatch.AppId, appid);
482+
foreach (var previousMatch in matches.Where (v => v.AppId != appid))
483+
Log.LogMessage (MessageImportance.Low, MSBStrings.M0135, previousMatch.Profile?.Name, previousMatch.AppId, appid, pair.Profile?.Name);
488484
matches.Clear ();
489485
}
490486

0 commit comments

Comments
 (0)