/// <summary> /// </summary> /// <param name="project"> </param> /// <returns> </returns> public ThemaCompilerContext Compile(ThemaProject project) { lock (this) { _pipeline = new ThemaCompilerPipeline(); var context = new ThemaCompilerContext {Project = project}; context.UserLog.Debug("context created"); context.Pipeline = _pipeline; PrepareDefaultPipeline(context); context.UserLog.Debug("default pipeline created"); if (null != project.CustomCompiler) { context.UserLog.Debug("need call custom compiler InternalSetup"); project.CustomCompiler.Setup(context); context.UserLog.Debug("custom compile InternalSetup called"); } context.UserLog.Trace("preparation finished"); context.UserLog.Info("compilation started"); _pipeline.Execute(context); context.UserLog.Info("compilation finished"); if (context.IsComplete) { context.UserLog.Info("IsComplete : true"); } else { context.UserLog.Error("IsComplete : false (see errors)"); } return context; } }
/// <summary> /// Processes the specified CTX. /// </summary> /// <param name="ctx"> The CTX. </param> /// <remarks> /// </remarks> public void Process(ThemaCompilerContext ctx) { Context = ctx; InternalProcess(); }
/// <summary> /// executes generator /// </summary> /// <param name="context"> </param> /// <param name="callelement"> </param> public void Execute(ThemaCompilerContext context, XElement callelement) { var generator = Activator.CreateInstance(Type) as IThemaXmlGenerator; if (generator is IThemaCompileTimeGenerator) { callelement.ReplaceWith(((IThemaCompileTimeGenerator) generator).Generate(callelement, context).ToArray()); } else { if (generator != null) { callelement.ReplaceWith(generator.Generate(callelement).ToArray()); } } }
private static void PrepareDefaultPipeline(ThemaCompilerContext context) { new CompileToXml().Setup(context); }