Inheritance: System.EventArgs
コード例 #1
0
 void BuildProjects(BuildContext ctx, ServerEventArgs ev)
 {
     foreach (SourceInfo source in ctx.Server.GetSources(ctx.AppId))
     {
         if (ev.ProjectId != -1 && ev.ProjectId != source.ProjectId)
         {
             continue;
         }
         foreach (SourceTagInfo stag in source.SourceTags)
         {
             try {
                 string sourcesPath = source.GetAddinSourcePath(ctx, stag);
                 if (!Directory.Exists(sourcesPath) || !Directory.Exists(stag.GetPackagePath(ctx)) || stag.Status == SourceTagStatus.Waiting)
                 {
                     BuildSource(ctx, source, stag);
                 }
             }
             catch (Exception ex) {
                 try {
                     File.AppendAllText(stag.GetLogFile(ctx), "<pre>" + HttpUtility.HtmlEncode(ex.ToString()) + "</pre>");
                     PushFiles(ctx, source, stag, true);
                     ctx.Server.SetSourceTagStatus(ctx.AppId, stag.Id, SourceTagStatus.BuildError);
                 }
                 catch { }
             }
         }
     }
 }
コード例 #2
0
        void Build(BuildContext ctx, ServerEventArgs ev)
        {
            try {
                ctx.ServerSettings = ctx.Server.GetSettings();
            }
            catch (Exception ex) {
                HandleError(ctx, ex);
                return;
            }

            foreach (ApplicationInfo app in ctx.ServerSettings.Applications.Where(ap => ev.AppId == -1 || ev.AppId == ap.Id))
            {
                try {
                    ctx.Application = app;
                    UpdateSourceTags(ctx, ev);
                    BuildProjects(ctx, ev);
                }
                catch (Exception ex) {
                    if (!HandleError(ctx, ex))
                    {
                        return;
                    }
                }
            }

            try {
                ctx.Status = "Waiting";
            }
            catch (Exception ex) {
                HandleError(ctx, ex);
                return;
            }
        }
コード例 #3
0
 void HandleEvent(object sender, ServerEventArgs e)
 {
     LogService.WriteLine("Got event: " + e.AppId + " " + e.ProjectId + " " + e.EventId + " " + e.EventArgs);
     lock (eventQueue) {
         eventQueue.Enqueue(e);
     }
     buildEvent.Set();
 }
コード例 #4
0
        void QueueBuildAll()
        {
            ServerEventArgs e = new ServerEventArgs()
            {
                EventId = "BuildAll", AppId = -1, ProjectId = -1
            };

            lock (eventQueue) {
                eventQueue.Enqueue(e);
            }
        }
コード例 #5
0
 public void UpdateSourceTags(BuildContext ctx, ServerEventArgs ev)
 {
     ctx.Status = "Updating version control source tags";
     foreach (SourceInfo s in ctx.Server.GetSources(ctx.AppId))
     {
         if (ev.ProjectId != -1 && s.ProjectId != ev.ProjectId)
         {
             continue;
         }
         ctx.Status = "Updating version control source tags for project '" + s.ProjectName + "'";
         UpdateSourceTags(ctx, s, true);
     }
 }
コード例 #6
0
        void ReadEvents()
        {
            do
            {
                try {
                    string lin;
                    do
                    {
                        lin = eventsReader.ReadLine();
                    }while (lin != "[event]" && lin != null);

                    if (lin == null)
                    {
                        throw new Exception("Disconnected");
                    }

                    ServerEventArgs args = new ServerEventArgs();
                    args.EventId   = eventsReader.ReadLine();
                    args.AppId     = int.Parse(eventsReader.ReadLine());
                    args.ProjectId = int.Parse(eventsReader.ReadLine());
                    int           nargs = int.Parse(eventsReader.ReadLine());
                    List <string> eargs = new List <string> ();
                    for (int n = 0; n < nargs; n++)
                    {
                        eargs.Add(eventsReader.ReadLine());
                    }
                    args.EventArgs = eargs.ToArray();
                    if (Event != null)
                    {
                        Event(this, args);
                    }
                } catch (Exception ex) {
                    try {
                        eventsReader.Close();
                    } catch { }
                    Connected    = false;
                    eventsThread = null;
                    eventsReader = null;
                    ThreadPool.QueueUserWorkItem(delegate {
                        if (Disconnected != null)
                        {
                            Disconnected(this, EventArgs.Empty);
                        }
                    });
                    return;
                }
            } while (true);
        }
コード例 #7
0
ファイル: BuildService.cs プロジェクト: garuma/cydin
 void QueueBuildAll()
 {
     ServerEventArgs e = new ServerEventArgs () { EventId = "BuildAll" };
     lock (eventQueue) {
         eventQueue.Enqueue (e);
     }
 }
コード例 #8
0
ファイル: BuildService.cs プロジェクト: garuma/cydin
 void HandleEvent(object sender, ServerEventArgs e)
 {
     lock (eventQueue) {
         eventQueue.Enqueue (e);
     }
     buildEvent.Set ();
 }
コード例 #9
0
ファイル: BuildService.cs プロジェクト: garuma/cydin
 void BuildProjects(BuildContext ctx, ServerEventArgs ev)
 {
     foreach (SourceInfo source in ctx.Server.GetSources (ctx.AppId)) {
         if (ev.ProjectId != -1 && ev.ProjectId != source.ProjectId)
             continue;
         foreach (SourceTagInfo stag in source.SourceTags) {
             try {
                 string sourcesPath = source.GetAddinSourcePath (ctx, stag);
                 if (!Directory.Exists (sourcesPath) || !Directory.Exists (stag.GetPackagePath (ctx)) || stag.Status == SourceTagStatus.Waiting) {
                     BuildSource (ctx, source, stag);
                 }
             }
             catch (Exception ex) {
                 try {
                     File.AppendAllText (stag.GetLogFile (ctx), "<pre>" + HttpUtility.HtmlEncode (ex.ToString ()) + "</pre>");
                     PushFiles (ctx, source, stag, true);
                     ctx.Server.SetSourceTagStatus (ctx.AppId, stag.Id, SourceTagStatus.BuildError);
                 }
                 catch { }
             }
         }
     }
 }
コード例 #10
0
ファイル: BuildService.cs プロジェクト: garuma/cydin
        void Build(BuildContext ctx, ServerEventArgs ev)
        {
            try {
                ctx.ServerSettings = ctx.Server.GetSettings ();
            }
            catch (Exception ex) {
                HandleError (ctx, ex);
                return;
            }

            foreach (ApplicationInfo app in ctx.ServerSettings.Applications.Where (ap => ev.AppId == -1 || ev.AppId == ap.Id)) {
                try {
                    ctx.Application = app;
                    UpdateSourceTags (ctx, ev);
                    BuildProjects (ctx, ev);
                }
                catch (Exception ex) {
                    if (!HandleError (ctx, ex))
                        return;
                }
            }

            try {
                ctx.Status = "Waiting";
            }
            catch (Exception ex) {
                HandleError (ctx, ex);
                return;
            }
        }
コード例 #11
0
ファイル: BuildService.cs プロジェクト: garuma/cydin
 public void UpdateSourceTags(BuildContext ctx, ServerEventArgs ev)
 {
     ctx.Status = "Updating version control source tags";
     foreach (SourceInfo s in ctx.Server.GetSources (ctx.AppId)) {
         if (ev.ProjectId != -1 && s.ProjectId != ev.ProjectId)
             continue;
         ctx.Status = "Updating version control source tags for project '" + s.ProjectName + "'";
         UpdateSourceTags (ctx, s, true);
     }
 }
コード例 #12
0
ファイル: BuildService.cs プロジェクト: garuma/cydin
        void ReadEvents()
        {
            do {
                try {
                    string lin;
                    do {
                        lin = eventsReader.ReadLine ();
                    }
                    while (lin != "[event]" && lin != null);

                    if (lin == null)
                        throw new Exception ("Disconnected");

                    ServerEventArgs args = new ServerEventArgs ();
                    args.EventId = eventsReader.ReadLine ();
                    Console.WriteLine ("Got event " + args.EventId);
                    args.AppId = int.Parse (eventsReader.ReadLine ());
                    args.ProjectId = int.Parse (eventsReader.ReadLine ());
                    int nargs = int.Parse (eventsReader.ReadLine ());
                    List<string> eargs = new List<string> ();
                    for (int n=0; n<nargs; n++)
                        eargs.Add (eventsReader.ReadLine ());
                    args.EventArgs = eargs.ToArray ();
                    if (Event != null)
                        Event (this, args);
                } catch {
                    try {
                        eventsReader.Close ();
                    } catch { }
                    Connected = false;
                    eventsThread = null;
                    eventsReader = null;
                    ThreadPool.QueueUserWorkItem (delegate {
                        if (Disconnected != null)
                            Disconnected (this, EventArgs.Empty);
                    });
                    return;
                }
            } while (true);
        }
コード例 #13
0
ファイル: BuildService.cs プロジェクト: slluis/cydin
 void QueueBuildAll()
 {
     ServerEventArgs e = new ServerEventArgs () { EventId = "BuildAll", AppId=-1, ProjectId=-1 };
     lock (eventQueue) {
         eventQueue.Enqueue (e);
     }
 }
コード例 #14
0
ファイル: BuildService.cs プロジェクト: slluis/cydin
 void HandleEvent(object sender, ServerEventArgs e)
 {
     LogService.WriteLine ("Got event: " + e.AppId + " " + e.ProjectId + " " + e.EventId + " " + e.EventArgs);
     lock (eventQueue) {
         eventQueue.Enqueue (e);
     }
     buildEvent.Set ();
 }