protected override void Run() { base.Run(); var pchFile = PositionalArguments.DequeueOrDefault(); string xmPath = PositionalArguments.DequeueOrDefault(); if (pchFile == null || !File.Exists(pchFile)) { throw new ExitException("PCH file must be specified"); } if (xmPath == null || !File.Exists(xmPath)) { throw new ExitException("Xamarin.Mac Assembly must be specified"); } XamarinMacAssembly = Assembly.LoadFrom(xmPath); if (XamarinMacAssembly == null) { throw new ExitException("Unable to load Xamarin.Mac Assembly"); } var reader = new AstReader(); reader.TranslationUnitParsed += tu => tu.Accept(new PropertyGetSetMismatchVisitor()); reader.TranslationUnitParsed += tu => tu.Accept(new PropertyArgumentSemanticVisitor()); if (!reader.Load(pchFile)) { throw new ExitException("PCH file failed to load"); } }
public void Execute(string pchFile, IEnumerable <string> assemblyNames) { var managed_reader = new AssemblyReader() { new ReleaseAttributeCheck(), new DesignatedInitializerCheck(), new DllImportCheck(), new EnumCheck(), new FieldCheck(), new ObjCInterfaceCheck(), new ObjCProtocolCheck(), new SelectorCheck(), new SimdCheck(), new RequiresSuperCheck(), new DeprecatedCheck(), new NullabilityCheck(), new UIAppearanceCheck(), // new ListNative (), // for debug }; foreach (var assemblyName in assemblyNames) { var name = Path.GetFileNameWithoutExtension(assemblyName); if (name.EndsWith(".iOS", StringComparison.Ordinal)) { Helpers.Platform = Platforms.iOS; } else if (name.EndsWith(".Mac", StringComparison.Ordinal)) { Helpers.Platform = Platforms.macOS; } else if (name.EndsWith(".WatchOS", StringComparison.Ordinal)) { Helpers.Platform = Platforms.watchOS; } else if (name.EndsWith(".TVOS", StringComparison.Ordinal)) { Helpers.Platform = Platforms.tvOS; } managed_reader.Load(assemblyName); } managed_reader.Process(); var reader = new AstReader(); foreach (var v in managed_reader) { reader.TranslationUnitParsed += tu => { tu.Accept(v); }; } reader.Load(pchFile); managed_reader.End(); Log.Save(); }
public void Execute(string pchFile, IEnumerable <string> assemblyNames) { var managed_reader = new AssemblyReader() { new DesignatedInitializerCheck(), new DllImportCheck(), new EnumCheck(), new FieldCheck(), // very noisy now, some stuff are still manually bound / harder to detect new ObjCInterfaceCheck(), new ObjCProtocolCheck(), new SelectorCheck(), new SimdCheck(), // new ListNative (), // for debug }; foreach (var assemblyName in assemblyNames) { var name = Path.GetFileNameWithoutExtension(assemblyName); if (name.EndsWith(".iOS", StringComparison.Ordinal)) { Helpers.Platform = Helpers.Platforms.iOS; } else if (name.EndsWith(".Mac", StringComparison.Ordinal)) { Helpers.Platform = Helpers.Platforms.macOS; } else if (name.EndsWith(".WatchOS", StringComparison.Ordinal)) { Helpers.Platform = Helpers.Platforms.watchOS; } else if (name.EndsWith(".TVOS", StringComparison.Ordinal)) { Helpers.Platform = Helpers.Platforms.tvOS; } managed_reader.Load(assemblyName); } var reader = new AstReader(); foreach (var v in managed_reader) { reader.TranslationUnitParsed += tu => { tu.DeclFilter = ModuleExclusionList.DeclFilter; tu.Accept(v); }; } reader.Load(pchFile); managed_reader.End(); }
public static int Main(string[] args) { Directory.CreateDirectory(Output); Console.WriteLine(Environment.CurrentDirectory); if (System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)) == 4) { Console.Error.WriteLine("This needs a 64-bit Mono to run"); return(1); } if (args.Length == 0) { args = new [] { "../../bindings/Urho.pch" }; } var reader = new AstReader(); var binder = new CxxBinder(Output); var lookup = new ScanBaseTypes(); reader.TranslationUnitParsed += tu => { tu.Accept(lookup); lookup.PrepareProperties(); tu.Accept(binder); binder.GenerateProperties(); }; reader.Load(args [0]); binder.FixupOverrides(); foreach (var st in binder.Generate()) { File.WriteAllText(Output + "/" + st.FileName, st.ToString()); } foreach (var a in binder.unhandledEnums) { Console.WriteLine("Missing special Enum processing for {0}", a); } Console.WriteLine($"Dumped data into {Output}"); binder.Close(); return(0); }
public static int Main(string[] args) { Directory.CreateDirectory (Output); Console.WriteLine(Environment.CurrentDirectory); if (System.Runtime.InteropServices.Marshal.SizeOf(typeof (IntPtr)) == 4) { Console.Error.WriteLine ("This needs a 64-bit Mono to run"); return 1; } if (args.Length == 0) { args = new [] { "../../bindings/Urho.pch" }; } var reader = new AstReader (); var binder = new CxxBinder(Output); var lookup = new ScanBaseTypes (); reader.TranslationUnitParsed += tu => { tu.Accept(lookup); lookup.PrepareProperties(); tu.Accept(binder); binder.GenerateProperties(); }; reader.Load (args [0]); binder.FixupOverrides(); foreach (var st in binder.Generate()) { File.WriteAllText (Output + "/" + st.FileName, st.ToString ()); } foreach (var a in binder.unhandledEnums) Console.WriteLine ("Missing special Enum processing for {0}", a); Console.WriteLine($"Dumped data into {Output}"); binder.Close (); return 0; }