public void Execute(GeneratorExecutionContext context) { context.TryDebug(); this.context = context; var attributeData = context.GetCurrentAssemblyAttribute(Constants.ShinyApplicationAttributeTypeName); if (attributeData != null) { this.values = new ShinyApplicationValues(attributeData); this.Iterate("AndroidX.AppCompat.App.AppCompatActivity"); this.Iterate("Android.Support.V7.App.AppCompatActivity"); } }
public void Execute(GeneratorExecutionContext context) { context.TryDebug(); this.context = context; var attribute = context.GetCurrentAssemblyAttribute("Shiny.GenerateStaticClassesAttribute"); if (attribute == null) { return; } this.context.Log("SHINYINFO", "Shiny static class generation will run on this assembly", DiagnosticSeverity.Info); this.useNamespace = attribute.ConstructorArguments.FirstOrDefault().Value?.ToString(); if (String.IsNullOrWhiteSpace(this.useNamespace)) { throw new ArgumentException("Namespace not supplied for static generation"); } this.context.Log( "SHINYINFO", "Shiny static class generation namespace: " + this.useNamespace, DiagnosticSeverity.Info ); var shinyAssemblies = this.context .GetAllAssemblies() .Where(x => x .ToDisplayString() .StartsWith("Shiny.") ) .ToList(); foreach (var ass in shinyAssemblies) { var staticAttributes = ass .GetAttributes() .Where(x => { var other = x.AttributeClass.ToDisplayString(); return(ShinyStaticGenerationAttribute.Equals(other)); }) .ToList(); foreach (var attr in staticAttributes) { var typeName = (string)attr.ConstructorArguments[0].Value; var genFileName = (string)attr.ConstructorArguments[1].Value; this.BuildStaticClass(typeName, genFileName); } } }