Beispiel #1
0
        /// <summary>
        /// WPDTs the ops uninstall.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="results">The results.</param>
        private static void WpdtOpsUninstall(
            BuildControlParameters configuration,
            DailyBuildFullResults results)
        {
            ExecutionStatus status = GeneralFileOperations.ReadProgramStatusFile();

            results.WpdtVersion = WpdtOperations.DetermineWdptInstalledVersion(configuration);
            results.YdrVersion  = "Same as Wpdt";
            if (status != ExecutionStatus.UninstallWdpt &&
                configuration.UpdateWpdt)
            {
                if (WpdtOperations.IsWpdtInstalled(configuration))
                {
                    if (!WpdtOperations.IsInstalledWpdtVersionSameAsLkg(configuration))
                    {
                        WpdtOperations.UninstallWdpt(configuration);
                        // Just show some time on the console before we exit
                        for (Int32 i = 0; i < 10; i++)
                        {
                            Console.Write(".");
                            Thread.Sleep(1000);
                        }
                        Console.WriteLine("Exiting process, waiting for Wpdt Uninstall to complete and reboot");
                        // Just show some more time on the console
                        for (Int32 i = 0; i < 10; i++)
                        {
                            Console.Write(".");
                            Thread.Sleep(1000);
                        }
                        Environment.Exit(0);
                    }
                }
                else
                {
                    Console.WriteLine("Requested to Uninstall Wpdt, but it was not installed!");
                    ProgramExecutionLog.AddEntry(
                        "Requested to uninstall Wpdt, but it was not installed");
                }
            }
            if (status == ExecutionStatus.UninstallWdpt)
            {
                results.UninstallWdpt.SetResults(true, "");
                ProcessOperations.KillSwanProcesses();
                Console.WriteLine("Continuing build process after reboot from Wpdt uninstall ...");
                GeneralFileOperations.WriteProgramStatusFile(ExecutionStatus.Running);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Mains the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        static void Main(string[] args)
        {
            DailyBuildFullResults  results       = new DailyBuildFullResults();
            BuildControlParameters configuration = null;

            try
            {
                if (File.Exists(MainConfigurationFile))
                {
                    Console.Write("Reading Configuration File .... ");
                    configuration = BuildControlParameters.LoadConfiguration(MainConfigurationFile);
                    Console.WriteLine(" Success");
                }
                else
                {
                    Console.WriteLine("Fail. No Configuration file found, creating sample starting file...");
                    configuration = new BuildControlParameters();
                    configuration.SampleInit();
                    BuildControlParameters.SaveConfiguration(configuration, MainConfigurationFile);
                    Console.WriteLine("Sample file created ");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Failed to read Configuration File. Program will exit. " +
                                  "See log file");
                Thread.Sleep(5000);
                ProgramExecutionLog.AddEntry("Failed to read Configuration File. Error was " +
                                             e.Message);
                ProgramExecutionLog.AddEntry("Required configuration file is " +
                                             MainConfigurationFile + " and in the same directory");

                string[] logEntries = ProgramExecutionLog.FullLogContents();
                File.WriteAllLines(ExecutionLogFile, logEntries);
                Environment.Exit(1);
            }
            configuration.UpdateWpdtLkgLink();
            results.Reset(configuration);
            results.UpdateWpdtOpsForInstalledVersion(configuration);

            CheckForWpdtTestCaseFiles(configuration);

            ExecutionStatus status = GeneralFileOperations.ReadProgramStatusFile();

            ParseCommandLineArguments(args, status);

            WpdtOpsUninstall(configuration, results);

            if (configuration.SyncEnlistment)
            {
                SourceCodeOps.SyncEnlistment(configuration, results);
            }

            WpdtOpsInstall(configuration, results);

            UpdateYdr(configuration, results);

            SourceCodeOps.CreateBuildScriptAndExecute(configuration, results);

            WriteSummaryResults(configuration, results);
            GeneralFileOperations.WriteProgramStatusFile(ExecutionStatus.Idle);
        }