Beispiel #1
0
            public static BuildResult BuildSingle()
            {
                AbstractEditorDocument ed = ed = Instance.CurrentEditor;

                if (ed == null)
                {
                    return(null);
                }

                // Save module
                ed.Save();

                // Select appropriate language binding
                string file      = ed.AbsoluteFilePath;
                bool   IsProject = false;
                var    lang      = AbstractLanguageBinding.SearchBinding(file, out IsProject);

                // Check if binding supports building
                if (lang == null || IsProject || !lang.CanBuild || !lang.BuildSupport.CanBuildFile(file))
                {
                    return(null);
                }

                // Set debug support
                if (lang.CanUseDebugging)
                {
                    DebugManagement.CurrentDebugSupport = lang.DebugSupport;
                }
                else
                {
                    DebugManagement.CurrentDebugSupport = null;
                }

                // Enable build menu
                IsBuilding = true;

                IDEManager.Instance.MainWindow.RefreshMenu();

                // Clear build output
                Instance.MainWindow.ClearLog();

                // Execute build
                var br = LastSingleBuildResult = lang.BuildSupport.BuildStandAlone(file);

                if (br.Successful && br.NoBuildNeeded)
                {
                    ErrorLogger.Log("File wasn't changed -- No compilation required", ErrorType.Information, ErrorOrigin.Build);
                }


                // Update error list, Disable build menu
                ErrorManagement.RefreshErrorList();
                IsBuilding = false;
                IDEManager.Instance.MainWindow.RefreshMenu();

                return(br);
            }
Beispiel #2
0
            public static bool Build(Project Project, bool Incrementally)
            {
                // Enable build menu
                IsBuilding = true;
                WorkbenchLogic.Instance.SaveAllFiles();
                IDEManager.Instance.MainWindow.RefreshMenu();
                IDEManager.Instance.MainWindow.LeftStatusText = "Build " + Project.Name;
                IDEManager.Instance.MainWindow.ClearLog();

                // Build project with the interal method that's dedicated to build a project
                var r = InternalBuild(Project, Incrementally);

                // Disable build menu, Refresh error list
                IsBuilding = false;
                IDEManager.Instance.MainWindow.RefreshMenu();
                IDEManager.Instance.MainWindow.LeftStatusText = r ? "Build successful" : "Build failed";
                ErrorManagement.RefreshErrorList();
                return(r);
            }
Beispiel #3
0
            public static bool Build(Solution sln, bool Incrementally)
            {
                //TODO: Build from most independent to most dependent project

                /*
                 * TODO: How to combine D Projects?
                 * -- e.g. Project A is a class library
                 * -- Project B is an executable --> Interfacing?
                 * http://digitalmars.com/d/2.0/dll.html
                 */

                bool ret = true;

                // Enable build menu
                IsBuilding = true;
                IDEManager.Instance.MainWindow.RefreshMenu();

                IDEManager.Instance.MainWindow.LeftStatusText = "Build " + sln.Name;

                // Iterate through all projects
                // Note: see above
                foreach (var prj in sln)
                {
                    if (!InternalBuild(prj, Incrementally))
                    {
                        ret = false;
                        break;
                    }
                }

                IDEManager.Instance.MainWindow.LeftStatusText = ret ? "Build successful" : "Build failed";

                // Disable build menu
                IsBuilding = false;
                IDEManager.Instance.MainWindow.RefreshMenu();
                ErrorManagement.RefreshErrorList();
                return(ret);
            }