예제 #1
0
파일: Program.cs 프로젝트: tomdef/nTeamCity
        static void Main(string[] args)
        {
            if (args.Count() >= 4)
            {
                string teamCityUrl = args[0].Trim();
                int buildsDeep = int.Parse(args[1]);
                string[] buildTypes = args[2].Split(new char[] { ',', ';' });
                string outputXmlFile = args[3];
                string xsltFile = args[4];

                TCConnection tcConnection = new TCConnection(teamCityUrl);

                XElement root = new XElement("reports");

                foreach (string buildTypeId in buildTypes)
                {
                    ReportParameters parameters = new ReportParameters(
                        teamCityUrl,
                        buildTypeId,
                        0,
                        buildsDeep,
                        f => { return (f.DefaultBranch == true); }
                        );

                    IReportGenerator<ReportParameters> reportGenerator = new ReportGenerator();
                    IReport<ReportParameters> report = reportGenerator.Generate(parameters);
                    root.Add(report.ToXML(buildTypeId));
                }

                XDocument xdoc = new XDocument(
                    new XDeclaration("1.0", "utf-8", null),
                    root);

                xdoc.Save(outputXmlFile);

                if (!String.IsNullOrEmpty(xsltFile))
                {
                    string outputHtmlFile = Path.Combine(
                        Path.GetDirectoryName(outputXmlFile),
                        String.Concat(Path.GetFileNameWithoutExtension(outputXmlFile), ".html"));

                    XslCompiledTransform myXslTrans = new XslCompiledTransform();
                    myXslTrans.Load(xsltFile);
                    myXslTrans.Transform(outputXmlFile, outputHtmlFile);
                }
            }
            else
            {
                Console.WriteLine("Invalid arguments");
            }
        }
예제 #2
0
        public void TestReport()
        {
            /* jetbrains local test server */
            ReportParameters parameters = new ReportParameters(
                "http://192.168.137.49",
                "NTeamCity_NTeamCityMain",
                0,
                3,
                f => { return (f.Status == BuildStatus.SUCCESS); }
            );

            IReportGenerator<ReportParameters> reportGenerator = new ReportGenerator();
            var report = reportGenerator.Generate(parameters);
            var xml = report.ToXML("Tests");
        }