Ejemplo n.º 1
0
        public virtual void OnCompilationRequest(RequestCompilationOptions options)
        {
            var compilationOptions = GetCompilationOptions();

            // Register
            m_PluginRepository.RegisterPlugins(compilationOptions);

            VSGraphModel vsGraphModel = Store.GetState().CurrentGraphModel as VSGraphModel;

            if (vsGraphModel == null || vsGraphModel.Stencil == null)
            {
                return;
            }

            ITranslator translator = vsGraphModel.Stencil.CreateTranslator();

            if (!translator.SupportsCompilation())
            {
                return;
            }

            if (options == RequestCompilationOptions.SaveGraph)
            {
                AssetDatabase.SaveAssets();
            }

            CompilationResult r = vsGraphModel.Compile(AssemblyType.None, translator, compilationOptions, m_PluginRepository.GetPluginHandlers());

            if (Store?.GetState()?.CompilationResultModel is CompilationResultModel compilationResultModel) // TODO: could have disappeared during the await
            {
                compilationResultModel.lastResult = r;
                OnCompilationDone(vsGraphModel, compilationOptions, r);
            }
        }