Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions build-tools/api-merge/ApiDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ApiDescription {
public static bool HackGenericTypeParameterNames = true;

XDocument Contents;
XAttribute contentsPlatform;
Dictionary<string, XElement> Types = new Dictionary<string, XElement>();

public ApiDescription (string source)
Expand All @@ -26,6 +27,8 @@ public ApiDescription (string source)
foreach (var package in api.Elements ("package")) {
AddPackage (package, platform);
}

contentsPlatform = api.Attributes ("platform").LastOrDefault ();
}

XElement GetRoot (XDocument doc, string sourcePath, out string platform)
Expand All @@ -52,6 +55,12 @@ public void Merge (string apiLocation)
var n = XDocument.Load (apiLocation);
string platform = null;
XElement api = GetRoot (n, apiLocation, out platform);
if (!String.IsNullOrEmpty (platform) && contentsPlatform != null) {
// Update the api platform to the current document's value. Documents are
// sorted in ascending order, so we'll end up with the latest platform in
// the merged document, as it should be.
contentsPlatform.SetValue (platform);
}

foreach (var npackage in api.Elements ("package")) {
var spackage = GetPackage ((string) npackage.Attribute ("name"));
Expand Down