-
Notifications
You must be signed in to change notification settings - Fork 537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Xamarin.Android.Build.Tasks] Fix Removal of Non Duplicate elements #856
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -402,11 +402,18 @@ void MergeLibraryManifest (string mergedManifest) | |
} | ||
} | ||
|
||
public IEnumerable<XElement> ResolveDuplicates (IEnumerable<XElement> elements) | ||
{ | ||
foreach (var e in elements) | ||
foreach (var d in ResolveDuplicates (e.Elements ())) | ||
yield return d; | ||
foreach (var d in elements.GroupBy (x => x.ToFullString ()).SelectMany (x => x.Skip (1))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand how this method works. :-( This part appears to be identical to what's being removed, i.e. this fragment is "buggy" (hence it needing to be fixed in the first place). Presumably then, the above Assuming that the How's this work? It's blowing my mind. :-( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The previous method used <foo>
<bar>
<bug/>
</bar>
<dar>
<bug/>
</dar>
<too/>
<too/>
</foo> In the previous method both |
||
yield return d; | ||
} | ||
|
||
void RemoveDuplicateElements () | ||
{ | ||
var duplicates = doc.Descendants () | ||
.GroupBy (x => x.ToFullString ()) | ||
.SelectMany (x => x.Skip (1)); | ||
var duplicates = ResolveDuplicates (doc.Elements ()); | ||
foreach (var duplicate in duplicates) | ||
duplicate.Remove (); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside: these lines full of whitespace are weird.