Exemple #1
0
        public BuildEventDialog(Project project)
        {
            InitializeComponent();

            this.project = project;
            this.vars    = new BuildEventVars(project, Settings.GlobalClasspaths.Split(';'));

            foreach (BuildEventInfo info in vars.GetVars())
            {
                Add(info);
            }
        }
Exemple #2
0
        public void Run(string buildEvents)
        {
            foreach (string buildEvent in buildEvents.Split('\n'))
            {
                Environment.CurrentDirectory = project.Directory;

                string line = buildEvent.Trim();

                if (line.Length <= 0)
                {
                    continue;                     // nothing to do
                }
                foreach (BuildEventInfo info in vars.GetVars())
                {
                    line = line.Replace(info.FormattedName, info.Value);
                }

                if (line.StartsWith("\""))
                {
                    int    endQuote = line.IndexOf("\"", 1);
                    string command  = line.Substring(1, endQuote - 1);
                    string args     = line.Substring(endQuote + 2);

                    if (project.CompilerOptions.Verbose)
                    {
                        Console.WriteLine("{0} {1}", command, args);
                    }

                    if (!ProcessRunner.Run(command, args, false))
                    {
                        throw new BuildException("Build halted with errors.");
                    }
                }
                else
                {
                    int    space   = line.IndexOf(" ");
                    string command = (space > -1) ? line.Substring(0, space) : line;
                    string args    = (space > -1) ? line.Substring(space + 1) : "";

                    if (project.CompilerOptions.Verbose)
                    {
                        Console.WriteLine("{0} {1}", command, args);
                    }

                    if (!ProcessRunner.Run(command, args, false))
                    {
                        throw new BuildException("Build halted with errors.");
                    }
                }
            }
        }
        public BuildEventDialog(Project project)
        {
            InitializeComponent();
            InitializeLocalization();
            this.FormGuid = "ada69d37-2ec0-4484-b113-72bfeab2f239";
            this.Font     = PluginCore.PluginBase.Settings.DefaultFont;

            this.project = project;
            this.vars    = new BuildEventVars(project);
            foreach (BuildEventInfo info in vars.GetVars())
            {
                Add(info);
            }
        }
Exemple #4
0
        public BuildEventDialog(Project project)
        {
            InitializeComponent();
            InitializeLocalization();
            this.FormGuid = "ada69d37-2ec0-4484-b113-72bfeab2f239";
            this.Font     = PluginCore.PluginBase.Settings.DefaultFont;

            this.project = project;
            this.vars    = new BuildEventVars(project);

            // this operation requires a message to ASCompletion so we don't add it to the BuildEventVars
            string path = BuildActions.GetCompilerPath(project);

            if (File.Exists(path))
            {
                path = Path.GetDirectoryName(path);
            }
            vars.AddVar("CompilerPath", path);

            foreach (BuildEventInfo info in vars.GetVars())
            {
                Add(info);
            }
        }
        public void Run(string buildEvents, bool noTrace)
        {
            string[] events = buildEvents.Split('\n');
            if (events.Length == 0)
            {
                return;
            }

            BuildEventInfo[] infos = vars.GetVars();
            foreach (string buildEvent in events)
            {
                Environment.CurrentDirectory = project.Directory;

                string line = buildEvent.Trim();

                if (line.Length <= 0)
                {
                    continue; // nothing to do
                }
                // conditional execution
                if (line.StartsWith("DEBUG:"))
                {
                    if (noTrace)
                    {
                        continue;
                    }
                    else
                    {
                        line = line.Substring("DEBUG:".Length).Trim();
                    }
                }
                if (line.StartsWith("RELEASE:"))
                {
                    if (!noTrace)
                    {
                        continue;
                    }
                    else
                    {
                        line = line.Substring("RELEASE:".Length).Trim();
                    }
                }
                // expand variables
                foreach (BuildEventInfo info in infos)
                {
                    line = line.Replace(info.FormattedName, info.Value);
                }
                // bin/debug output path
                line = project.FixDebugReleasePath(line);

                Console.WriteLine("cmd: " + line);
                string[] tokens  = tokenize(line);
                string   command = tokens[0];
                string   args    = tokens[1];

                //switch command and act on "recognized" commands
                switch (command)
                {
                case "BuildProject":
                    FDBuild.Program.BuildProject(args);
                    break;

                case "RunMxmlc":
                    string[] mxmlctokens = tokenize(args);
                    FDBuild.Program.BuildMXMLC(mxmlctokens[0], mxmlctokens[1]);
                    break;

                case "RunCompc":
                    string[] compctokens = tokenize(args);
                    FDBuild.Program.BuildCOMPC(compctokens[0], compctokens[1]);
                    break;

                default:
                    if (!ProcessRunner.Run(command, args, false))
                    {
                        throw new BuildException("Build halted with errors.");
                    }
                    break;
                }
            }
        }
Exemple #6
0
        // Receives only events in EventMask
        public void HandleEvent(object sender, NotifyEvent e)
        {
            TextEvent te = e as TextEvent;

            switch (e.Type)
            {
            // replace @MACRO type stuff with things we know about
            case EventType.ProcessArgs:
                if (Project != null)
                {
                    // steal macro names and values from the very useful
                    // BuildEvent macros, except instead of $(Var) we expect @VAR
                    string[]       globalCP = Settings.GlobalClasspaths.Split(';');
                    BuildEventVars vars     = new BuildEventVars(Project, globalCP);

                    foreach (BuildEventInfo info in vars.GetVars())
                    {
                        te.Text = te.Text.Replace("@" + info.Name.ToUpper(), info.Value);
                    }
                }
                break;

            case EventType.FileOpening:
                // if this is an .fdp file, we can handle it ourselves
                if (Path.GetExtension(te.Text).ToLower() == ".fdp")
                {
                    te.Handled = true;
                    OpenProjectSilent(te.Text);
                    menus.RecentComboBox.Add(Project);
                }
                break;

            case EventType.FileOpen:

                if (fileActions.DocumentSeekRequest > 0)
                {
                    // we just created a new class, put the cursor between the brackets.
                    MainForm.CurSciControl.GotoPos(fileActions.DocumentSeekRequest);
                    fileActions.DocumentSeekRequest = 0;
                }
                // add some support for additional known xml files (like asml)
                if (MainForm.CurSciControl.ConfigurationLanguage == "text" &&
                    FileHelper.IsXml(MainForm.CurFile))
                {
                    MainForm.CallCommand("ChangeSyntax", "xml");
                }

                OpenNextFile();                         // it's safe to open any other files on the queue
                break;

            case EventType.ProcessStart:
                buildActions.NotifyBuildStarted();
                break;

            case EventType.ProcessEnd:
                string result = (e as TextEvent).Text;
                buildActions.NotifyBuildEnded(result);
                break;

            case EventType.Command:
                if (te.Text == COMMAND_SENDPROJECTINFO)
                {
                    BroadcastProjectInfo();
                    e.Handled = true;
                }
                else if (te.Text == COMMAND_BUILDPROJECT)
                {
                    if (Project != null)
                    {
                        buildActions.Build(Project, false, pluginUI.IsTraceDisabled);
                        e.Handled = true;
                    }
                }
                else if (te.Text == COMMAND_HOTBUILD)
                {
                    if (Project != null && Project.OutputPath.Length > 0)
                    {
                        buildActions.Build(Project, true, pluginUI.IsTraceDisabled);
                        e.Handled = true;
                    }
                }
                break;

            case EventType.SettingUpdate:
                if (Project == null)
                {
                    return;
                }

                if (showProjectClasspaths != Settings.ShowProjectClasspaths ||
                    showGlobalClasspaths != Settings.ShowGlobalClasspaths)
                {
                    showProjectClasspaths = Settings.ShowProjectClasspaths;
                    showGlobalClasspaths  = Settings.ShowGlobalClasspaths;
                    pluginUI.Tree.RebuildTree(true);
                }
                break;

            // PHILIPPE: handle copy/paste shortcuts
            case EventType.Shortcut:
                KeyEvent ke = e as KeyEvent;
                if (pluginUI.Tree.Focused && !pluginUI.IsEditingLabel && ke != null)
                {
                    switch (ke.Value)
                    {
                    case Keys.Control | Keys.C:
                        if (pluginUI.Menu.Copy.IsEnabled)
                        {
                            TreeCopyItems(null, null);
                        }
                        ke.Handled = true;
                        break;

                    case Keys.Control | Keys.X:
                        if (pluginUI.Menu.Cut.IsEnabled)
                        {
                            TreeCutItems(null, null);
                        }
                        ke.Handled = true;
                        break;

                    case Keys.Control | Keys.V:
                        if (pluginUI.Menu.Paste.IsEnabled)
                        {
                            TreePasteItems(null, null);
                        }
                        ke.Handled = true;
                        break;

                    case Keys.Delete:
                        if (pluginUI.Menu.Delete.IsEnabled)
                        {
                            TreeDeleteItems(null, null);
                        }
                        ke.Handled = true;
                        break;

                    case Keys.Enter:

                        break;
                    }
                }
                break;
            }
        }