Exemplo n.º 1
0
        public void RaiseBuildTab(MonoBuildTab buildTab)
        {
            if (buildTab.GetParent() != buildTabs)
            {
                throw new InvalidOperationException("Build tab is not in the tabs list");
            }

            buildTabs.MoveChild(buildTab, 0);
            _UpdateBuildTabsList();
        }
Exemplo n.º 2
0
        public static bool Build(MonoBuildInfo buildInfo)
        {
            if (BuildsInProgress.Contains(buildInfo))
            {
                throw new InvalidOperationException("A build is already in progress");
            }

            BuildsInProgress.Add(buildInfo);

            try
            {
                MonoBuildTab buildTab = GodotSharpEditor.Instance.MonoBottomPanel.GetBuildTabFor(buildInfo);
                buildTab.OnBuildStart();

                // Required in order to update the build tasks list
                Internal.GodotMainIteration();

                try
                {
                    RemoveOldIssuesFile(buildInfo);
                }
                catch (IOException e)
                {
                    buildTab.OnBuildExecFailed($"Cannot remove issues file: {GetIssuesFilePath(buildInfo)}");
                    Console.Error.WriteLine(e);
                }

                try
                {
                    int exitCode = BuildSystem.Build(buildInfo);

                    if (exitCode != 0)
                    {
                        PrintVerbose($"MSBuild exited with code: {exitCode}. Log file: {GetLogFilePath(buildInfo)}");
                    }

                    buildTab.OnBuildExit(exitCode == 0 ? MonoBuildTab.BuildResults.Success : MonoBuildTab.BuildResults.Error);

                    return(exitCode == 0);
                }
                catch (Exception e)
                {
                    buildTab.OnBuildExecFailed($"The build method threw an exception.\n{e.GetType().FullName}: {e.Message}");
                    Console.Error.WriteLine(e);
                    return(false);
                }
            }
            finally
            {
                BuildsInProgress.Remove(buildInfo);
            }
        }
Exemplo n.º 3
0
        public MonoBuildTab GetBuildTabFor(MonoBuildInfo buildInfo)
        {
            foreach (var buildTab in new Array <MonoBuildTab>(buildTabs.GetChildren()))
            {
                if (buildTab.BuildInfo.Equals(buildInfo))
                {
                    return(buildTab);
                }
            }

            var newBuildTab = new MonoBuildTab(buildInfo);

            AddBuildTab(newBuildTab);

            return(newBuildTab);
        }
Exemplo n.º 4
0
 public void AddBuildTab(MonoBuildTab buildTab)
 {
     buildTabs.AddChild(buildTab);
     RaiseBuildTab(buildTab);
 }
Exemplo n.º 5
0
 public static void StopBuild(MonoBuildTab buildTab) => throw new NotImplementedException();