diff --git a/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApi.XmlModel.cs b/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApi.XmlModel.cs index 3f838518a..3d1c68f8b 100644 --- a/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApi.XmlModel.cs +++ b/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApi.XmlModel.cs @@ -13,6 +13,7 @@ public JavaApi () } public string ExtendedApiSource { get; set; } + public string Platform { get; set; } public IList Packages { get; set; } } diff --git a/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApiXmlGeneratorExtensions.cs b/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApiXmlGeneratorExtensions.cs index 24073d05f..efb3b7203 100644 --- a/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApiXmlGeneratorExtensions.cs +++ b/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApiXmlGeneratorExtensions.cs @@ -21,7 +21,9 @@ public static void Save (this JavaApi api, string xmlfile) public static void Save (this JavaApi api, XmlWriter writer) { writer.WriteStartElement ("api"); - + if (api.Platform != null) + writer.WriteAttributeString ("platform", api.Platform); + foreach (var pkg in api.Packages) { if (!pkg.Types.Any (t => !t.IsReferenceOnly)) continue; diff --git a/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApiXmlLoaderExtensions.cs b/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApiXmlLoaderExtensions.cs index 60dc9c11a..c51b89ea8 100644 --- a/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApiXmlLoaderExtensions.cs +++ b/src/Xamarin.Android.Tools.ApiXmlAdjuster/JavaApiXmlLoaderExtensions.cs @@ -20,7 +20,8 @@ public static void Load (this JavaApi api, XmlReader reader, bool isReferenceOnl if (reader.LocalName != "api") throw XmlUtil.UnexpectedElementOrContent (null, reader, "api"); api.ExtendedApiSource = reader.GetAttribute ("api-source"); - XmlUtil.CheckExtraneousAttributes ("api", reader, "api-source"); + api.Platform = reader.GetAttribute ("platform"); + XmlUtil.CheckExtraneousAttributes ("api", reader, "api-source", "platform"); if (reader.IsEmptyElement) reader.Read (); else { diff --git a/src/Xamarin.Android.Tools.Bytecode/ClassPath.cs b/src/Xamarin.Android.Tools.Bytecode/ClassPath.cs index 34ff92628..ce4bc0610 100644 --- a/src/Xamarin.Android.Tools.Bytecode/ClassPath.cs +++ b/src/Xamarin.Android.Tools.Bytecode/ClassPath.cs @@ -30,6 +30,8 @@ public class ClassPath { public IEnumerable DocumentationPaths { get; set; } + public string AndroidFrameworkPlatform { get; set; } + public bool AutoRename { get; set; } public ClassPath (string path = null) @@ -109,6 +111,13 @@ XAttribute GetApiSource () return new XAttribute ("api-source", ApiSource); } + XAttribute GetPlatform () + { + if (string.IsNullOrEmpty (AndroidFrameworkPlatform)) + return null; + return new XAttribute ("platform", AndroidFrameworkPlatform); + } + bool IsGeneratedName (string parameterName) { return parameterName.StartsWith ("p") && parameterName.Length > 1 && Char.IsDigit (parameterName [1]); @@ -311,6 +320,7 @@ public XElement ToXElement () var packagesDictionary = GetPackages (); var api = new XElement ("api", GetApiSource (), + GetPlatform (), packagesDictionary.Keys.OrderBy (p => p, StringComparer.OrdinalIgnoreCase) .Select (p => new XElement ("package", new XAttribute ("name", p), diff --git a/tools/class-parse/Program.cs b/tools/class-parse/Program.cs index b7c4f5ed9..e63530bd0 100644 --- a/tools/class-parse/Program.cs +++ b/tools/class-parse/Program.cs @@ -22,6 +22,7 @@ public static void Main (string[] args) int verbosity = 0; bool autorename = false; var outputFile = (string) null; + string platform = null; var docsPaths = new List (); var p = new OptionSet () { "usage: class-dump [-dump] FILES", @@ -48,6 +49,9 @@ public static void Main (string[] args) { "autorename", "Renames parameter names in the interfaces by derived classes.", v => autorename = v != null }, + { "platform=", + "(Internal use only) specify Android framework platform ID", + v => platform = v }, { "h|?|help", "Show this message and exit.", v => help = v != null }, @@ -65,6 +69,7 @@ public static void Main (string[] args) }; var classPath = new ClassPath () { ApiSource = "class-parse", + AndroidFrameworkPlatform = platform, DocumentationPaths = docsPaths.Count == 0 ? null : docsPaths, DocletType = docsType, AutoRename = autorename