Exemplo n.º 1
0
    private void Update()
    {
        if (isBuilding)
        {
            if (_buildJob.Update())
            {
                // chunk work is done, fraw resulting chunks
                OnBuildJobFinished(_buildJob.GetFinishedData());
                isBuilding = false;
            }
        }
        else
        {
            if (chunkQueue.Count >= queueBuildSize)
            {
                _buildJob.SetQueue(chunkQueue);
                chunkQueue.Clear();

                _buildJob.Start();
                isBuilding = true;
            }
        }
    }
Exemplo n.º 2
0
        public void Build(List <ProjectVersion> projectVersions)
        {
            ProjectVersion activeProjectVersion = null;

            try
            {
                foreach (ProjectVersion projectVersion in projectVersions.Distinct())
                {
                    activeProjectVersion = projectVersion;

                    projectVersion.SetStringProperty("LastBuildResult", "Not started");
                    entities.SaveChanges();

                    BuildJob job = new BuildJob();
                    job.Start(
                        projectVersion.Id,
                        projectId => TaskRunnerContext.SetProjectVersionState(projectId, ProjectState.Building),
                        (projectId, isSuccess) =>
                    {
                        TaskRunnerContext.SetProjectVersionState(projectId, isSuccess ? ProjectState.Idle : ProjectState.Error);
                    });
                }
            }
            catch (Exception e)
            {
                AspNetDeployException aspNetDeployException = new AspNetDeployException("Build project failed", e);
                aspNetDeployException.Data.Add("SourceControl version Id", activeProjectVersion.SourceControlVersion.Id);
                aspNetDeployException.Data.Add("Solution file", activeProjectVersion.SolutionFile);

                Factory.GetInstance <ILoggingService>().Log(aspNetDeployException, null);

                if (e.IsCritical())
                {
                    throw;
                }
            }
        }