예제 #1
0
파일: VulcanTask.cs 프로젝트: japj/vulcan
        public override bool Execute()
        {
            MessageEngine.Reset();
            MessageEngine Message = MessageEngine.Create("__VULCAN MAIN");
            Message.Trace(Severity.Notification, Resources.VulcanStart + Assembly.GetExecutingAssembly().GetName().Version);

#if DEBUG
            Message.Trace(Severity.Notification, "DEBUG VERSION");
#endif

            PhaseWorkflowLoader WorkflowLoader = new PhaseWorkflowLoader();
            PhaseWorkflow Workflow = WorkflowLoader.PhaseWorkflowsByName[WorkflowLoader.DefaultWorkflowName];
            PathManager.TargetPath = Path.GetFullPath(OutputPath) + Path.DirectorySeparatorChar;

            XmlIR xmlIR = new XmlIR();

            foreach (ITaskItem item in Sources)
            {
                string filename = item.ItemSpec;
                if (File.Exists(filename))
                {
                    xmlIR.AddXml(Path.GetFullPath(filename),XmlIRDocumentType.SOURCE);
                }
                else
                {
                    Message.Trace(Severity.Error, new FileNotFoundException("Vulcan File Not Found", filename), Resources.VulcanFileNotFound, filename);
                }
            }

            foreach (ITaskItem item in Includes)
            {
                string filename = item.ItemSpec;
                if (File.Exists(filename))
                {
                    xmlIR.AddXml(Path.GetFullPath(filename), XmlIRDocumentType.INCLUDE);
                }
                else
                {
                    Message.Trace(Severity.Error, new FileNotFoundException("Vulcan File Not Found", filename), Resources.VulcanFileNotFound, filename);
                }
            }

            Workflow.ExecutePhaseWorkflowGraph(xmlIR);

            return (MessageEngine.AllEnginesErrorCount + MessageEngine.AllEnginesWarningCount) <= 0;
        }
예제 #2
0
파일: Vulcan.cs 프로젝트: japj/vulcan
        public static int Main(string[] args)
        {
            int errorCount = 0;

            MessageEngine.Trace(Severity.Notification, Resources.VulcanStart, Assembly.GetAssembly(typeof(XmlIR)).GetName().Version);
            try
            {
                var workflowLoader = new PhaseWorkflowLoader();
                PhaseWorkflow workflow = workflowLoader.PhaseWorkflowsByName[workflowLoader.DefaultWorkflowName];

                var cmdLineParser = new SimpleCommandLineParser("-/", args);

                if (args.Length == 0 || cmdLineParser["?"] != null)
                {
                    DisplayHelpMenu();
                    return errorCount;
                }

                if (cmdLineParser["t"] != null && cmdLineParser["t"].Count > 0)
                {
                    PathManager.TargetPath = Path.GetFullPath(cmdLineParser["t"][0]); //// +Path.DirectorySeparatorChar;
                }
                else
                {
                    PathManager.TargetPath = Path.GetFullPath(".");
                }

                var xmlIR = new XmlIR();

                foreach (string filename in cmdLineParser.NoSwitchArguments)
                {
                    if (File.Exists(filename))
                    {
                        xmlIR.AddXml(Path.GetFullPath(filename), XmlIRDocumentType.Source, true);
                    }
                    else
                    {
                        MessageEngine.Trace(Severity.Error, new FileNotFoundException("Vulcan File Not Found", filename), Resources.VulcanFileNotFound, filename);
                    }
                }

                IList<string> includedFiles = cmdLineParser["i"];

                if (includedFiles != null)
                {
                    foreach (string filename in includedFiles)
                    {
                        if (File.Exists(filename))
                        {
                            xmlIR.AddXml(Path.GetFullPath(filename), XmlIRDocumentType.Include, true);
                        }
                    }
                }

                workflow.ExecutePhaseWorkflowGraph(xmlIR);
            }
            catch (Exception ex)
            {
                MessageEngine.Trace(Severity.Error, ex, "One or more fatal errors were encountered!");
            }

            errorCount = (MessageEngine.ErrorCount + MessageEngine.WarningCount) * -1;
            return errorCount;
        } // end main
예제 #3
0
파일: Vulcan.cs 프로젝트: japj/vulcan
        public static int Main(string[] args)
        {
            int errorCount = 0;

            MessageEngine Message = MessageEngine.Create("__VULCAN MAIN");

            Message.Trace(Severity.Notification, Resources.VulcanStart + Assembly.GetAssembly(typeof(XmlIR)).GetName().Version);

#if DEBUG
            Message.Trace(Severity.Notification, "DEBUG VERSION");
#endif

            // TODO: Can we set permissions so that only PhaseworkflowLoader can see the workflow editing methods?  (Vsabella: yes you can if you make it its own dll and mark the classes internal)
            PhaseWorkflowLoader WorkflowLoader = new PhaseWorkflowLoader();
            PhaseWorkflow Workflow = WorkflowLoader.PhaseWorkflowsByName[WorkflowLoader.DefaultWorkflowName];

            SimpleCommandLineParser cmdLineParser = new SimpleCommandLineParser("-/", args);

            if (args.Length == 0 || cmdLineParser["?"] != null)
            {
                DisplayHelpMenu();
                return errorCount;
            }

            if (cmdLineParser["t"] != null && cmdLineParser["t"].Count > 0)
            {
                PathManager.TargetPath = Path.GetFullPath(cmdLineParser["t"][0]);// +Path.DirectorySeparatorChar;
            }
            else
            {
                PathManager.TargetPath = Path.GetFullPath(".");
            }

            XmlIR xmlIR = new XmlIR();

            if (cmdLineParser["r"] != null && cmdLineParser["r"].Count > 0)
            {
                string[] rootPath = cmdLineParser["r"][0].Split(new char[] { '=' });

                if (rootPath != null && rootPath.Length == 2 && Directory.Exists(rootPath[1]))
                {
                    xmlIR.SetDocumentRoot(rootPath[0].ToUpperInvariant(), Path.GetFullPath(rootPath[1]));
                }
            }

            foreach (string filename in cmdLineParser.NoSwitchArguments)
            {
                if (File.Exists(filename))
                {
                    VulcanEngine.IR.XmlIRDocumentType docType = XmlIRDocumentType.SOURCE;
                    xmlIR.AddXml(Path.GetFullPath(filename), docType);
                }
                else
                {
                    Message.Trace(Severity.Error, new FileNotFoundException("Vulcan File Not Found", filename), Resources.VulcanFileNotFound, filename);
                }
            }

            IList<string> includedFiles = cmdLineParser["i"];

            if (includedFiles != null)
            {
                foreach (string filename in includedFiles)
                {
                    if (File.Exists(filename))
                    {
                        VulcanEngine.IR.XmlIRDocumentType docType = XmlIRDocumentType.INCLUDE;
                        xmlIR.AddXml(Path.GetFullPath(filename), docType);
                    }
                }
            }

            Workflow.ExecutePhaseWorkflowGraph(xmlIR);
            errorCount = (MessageEngine.AllEnginesErrorCount + MessageEngine.AllEnginesWarningCount) * -1;
            return errorCount;
        }// end main
예제 #4
0
파일: VulcanTask.cs 프로젝트: japj/vulcan
        public override bool Execute()
        {
            MessageEngine.MSBuildTask = this;

            MessageEngine.Trace(Severity.Notification, Resources.VulcanStart + Assembly.GetExecutingAssembly().GetName().Version);
            try
            {
                InitializeVulcanParameters();

                var workflowLoader = new PhaseWorkflowLoader();
                PhaseWorkflow workflow = workflowLoader.PhaseWorkflowsByName[workflowLoader.DefaultWorkflowName];
                PathManager.TargetPath = Path.GetFullPath(OutputPath) + Path.DirectorySeparatorChar + Path.DirectorySeparatorChar;

                var xmlIR = new XmlIR();

                if (!String.IsNullOrEmpty(TemplatePath))
                {
                    xmlIR.TemplatePath = Path.GetFullPath(TemplatePath) + Path.DirectorySeparatorChar;
                }

                if (Sources != null)
                {
                    foreach (ITaskItem item in Sources)
                    {
                        string filename = item.ItemSpec;
                        if (File.Exists(filename))
                        {
                            xmlIR.AddXml(Path.GetFullPath(filename), XmlIRDocumentType.Source, true);
                        }
                        else
                        {
                            MessageEngine.Trace(Severity.Error, new FileNotFoundException("Vulcan File Not Found", filename), Resources.VulcanFileNotFound, filename);
                        }
                    }
                }

                if (Includes != null)
                {
                    foreach (ITaskItem item in Includes)
                    {
                        string filename = item.ItemSpec;
                        if (File.Exists(filename))
                        {
                            xmlIR.AddXml(Path.GetFullPath(filename), XmlIRDocumentType.Include, true);
                        }
                        else
                        {
                            MessageEngine.Trace(Severity.Error, new FileNotFoundException("Vulcan File Not Found", filename), Resources.VulcanFileNotFound, filename);
                        }
                    }
                }

                workflow.ExecutePhaseWorkflowGraph(xmlIR);
            }
            catch (Exception e)
            {
                MessageEngine.Trace(Severity.Error, e, "One or more fatal errors were encountered!");
            }

            return (MessageEngine.ErrorCount + MessageEngine.WarningCount) <= 0;
        }