示例#1
0
        /// <summary>
        /// Load the measurement configuration with a supplied filename. This will
        /// normally be called as part of the command line options where the
        /// file name is supplied in the command arguments
        /// </summary>
        /// <param name="fileName">Config file name</param>
        /// <param name="showExceptionDialog">True if we want to show the user an exception dialog
        /// If false, the exception will not be caught.</param>
        /// <returns>BDC Settings</returns>
        public static BuildControlParameters LoadConfiguration(string fileName)
        {
            BuildControlParameters ret = null;

            try
            {
                XmlSerializer mySerializer = new XmlSerializer(typeof(BuildControlParameters));
                // To read the file, create a FileStream.
                FileStream myFileStream = new FileStream(fileName, FileMode.Open);
                // Call the Deserialize method and cast to the object type.
                ret = (BuildControlParameters)mySerializer.Deserialize(myFileStream);
                myFileStream.Close();
            }
            catch (FileNotFoundException e)
            {
                ProgramExecutionLog.AddEntry("Configuration file " + fileName +
                                             " was not found! Error was " + e.Message);
            }
            if (ret != null)
            {
                // For backwards compatibility, set the default to the HeroApps build
                // folder if this is not specified in the configuration file.
                if (String.IsNullOrEmpty(ret.ApplicationParentFolderName))
                {
                    ret.ApplicationParentFolderName = ApplicationParentDefaultFolderName;
                }
            }
            return(ret);
        }
示例#2
0
 /// <summary>
 /// Resets the specified configuration.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public void Reset(BuildControlParameters configuration)
 {
     this.EnlistmentSync.Reset();
     this.UninstallWdpt.Reset();
     this.InstallWdpt.Reset();
     this.ModifyWdpt.Reset();
     this.UninstallYdr.Reset();
     this.InstallYdr.Reset();
     this.PublishToReleaseShare.Reset();
     this.EmailBuildResults.Reset();
     this.BuildTargets = null;
     this.InitializeBuildTargetResults(configuration);
     this.EnlistmentSync.RequestedToRun = configuration.SyncEnlistment;
     this.UninstallWdpt.RequestedToRun  = configuration.UpdateWpdt;
     this.InstallWdpt.RequestedToRun    = configuration.UpdateWpdt;
     this.UninstallYdr.RequestedToRun   = configuration.UpdateYdr;
     this.InstallYdr.RequestedToRun     = configuration.UpdateYdr;
     if (configuration.UpdateWpdt)
     {
         this.ModifyWdpt.RequestedToRun = configuration.InstallOnW2k8;
     }
     else
     {
         this.ModifyWdpt.RequestedToRun = false;
     }
     this.PublishToReleaseShare.RequestedToRun = true;
     this.EmailBuildResults.RequestedToRun     = configuration.EmailResults;
 }
示例#3
0
        /// <summary>
        /// Checks for WPDT test case files.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        private static void CheckForWpdtTestCaseFiles(BuildControlParameters configuration)
        {
            if (configuration.UpdateWpdt)
            {
                string uninstallTestCase = Path.Combine(configuration.SwanTestCasePath,
                                                        configuration.WpdtUninstallTestCase);
                string installTestCase = Path.Combine(configuration.SwanTestCasePath,
                                                      configuration.WpdtInstallTestCase);
                bool exitProgram = false;
                if (!File.Exists(uninstallTestCase))
                {
                    exitProgram = true;
                    string error1 = "Wpddt uninstall Test Case File " + uninstallTestCase +
                                    " not found. Program will exit";

                    Console.WriteLine(error1);
                    ProgramExecutionLog.AddEntry(error1);
                    Thread.Sleep(2000);
                }
                if (!File.Exists(installTestCase))
                {
                    exitProgram = true;
                    string error2 = "Wpddt install Test Case File " + installTestCase +
                                    " not found. Program will exit";
                    Console.WriteLine(error2);
                    ProgramExecutionLog.AddEntry(error2);
                    Thread.Sleep(2000);
                }
                if (exitProgram)
                {
                    Environment.Exit(1);
                }
            }
        }
示例#4
0
        /// <summary>
        /// Determines whether [is ydr installed] [the specified configuration].
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <returns>
        ///     <c>true</c> if [is ydr installed] [the specified configuration]; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsYdrInstalled(BuildControlParameters configuration)
        {
            string outputFile = Path.Combine(Application.StartupPath, InstallationFileCheckName);
            string app        = Path.Combine(Application.StartupPath, InstallationCheckProgramName);

            try
            {
                string             arguments = @"/p";
                ProcessInformation process   = ProcessOperations.RunProcess(app, Application.StartupPath,
                                                                            arguments, true);
                string[] contents = process.GetStandardOutput();
                if (contents != null)
                {
                    var ydrInstalled = (from installId in contents
                                        where installId.Contains(BuildControlParameters.YdrGuid)
                                        select installId).Count();
                    return(ydrInstalled > 0 ? true : false);
                }
                else
                {
                    ProgramExecutionLog.AddEntry(
                        "No output was returned from the msiinv.exe program");
                    return(false);
                }
            }
            catch (Exception e)
            {
                ProgramExecutionLog.AddEntry(
                    "Failure checking for Installation of Wpdt. Error was " + e.Message);
            }
            return(false);
        }
        /// <summary>
        /// Reverts the build version files.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="results">The results.</param>
        private static void RevertBuildVersionFiles(
            BuildControlParameters configuration,
            DailyBuildFullResults results)
        {
            string heroAppSource = FindHeroAppSourceFolder(configuration);

            for (Int32 i = 0; i < configuration.Projects.Length; i++)
            {
                string assemblyFile = "";
                try
                {
                    string appFolder = Path.Combine(heroAppSource, configuration.Projects[i].ProjectPath);
                    assemblyFile = Path.Combine(appFolder, configuration.Projects[i].AssemblyFilePathAndNameFromProjectRoot);
                    ProcessInformation process = ProcessOperations.SDRevert(configuration, assemblyFile);
                    CheckForErrorFromSDOperation(process, results, results.BuildTargets[i].RevertVersion);
                    results.BuildTargets[i].RevertVersion.Success = true;
                }
                catch (Exception e)
                {
                    ProgramExecutionLog.AddEntry(
                        "Failed to revert  file " + assemblyFile + " Exception information was " +
                        e.ToString());
                    results.BuildTargets[i].RevertVersion.SetResults(false, e.Message);
                }
            }
        }
        /// <summary>
        /// Zips the source files.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="results">The results.</param>
        /// <param name="sourceDirectory">The source directory.</param>
        public static void ZipSourceFiles(
            BuildControlParameters configuration,
            DailyBuildFullResults results,
            string sourceDirectory)
        {
            string archive = Path.Combine(sourceDirectory, SourceArchiveName);

            try
            {
                string heroAppSource = FindHeroAppSourceFolder(configuration);
                using (ZipFile zip = new ZipFile(archive))
                {
                    for (Int32 i = 0; i < configuration.Projects.Length; i++)
                    {
                        if (configuration.Projects[i].BuildConfiguration != BuildProjectControl.None)
                        {
                            string appFolder = Path.Combine(heroAppSource, configuration.Projects[i].ProjectPath);
                            zip.AddDirectory(appFolder, configuration.Projects[i].ProjectPath);
                        }
                    }
                    zip.Save();
                }
            }
            catch (Exception e)
            {
                ProgramExecutionLog.AddEntry(
                    "Failed to archive source files" +
                    " Error was " + e.Message);
            }
        }
示例#7
0
        /// <summary>
        /// Call sd sync command for the enlistment
        /// </summary>
        /// <param name="configuration">Main program configuration</param>
        /// <param name="fileName">File name to have the sd command execute on</param>
        /// <returns>ProcessInformation, so the caller can look at the return code etc</returns>
        public static ProcessInformation SDSync(
            BuildControlParameters configuration)
        {
            string             arguments = "sync ";
            ProcessInformation procInfo  = SDCommand(configuration, ".", arguments);

            return(procInfo);
        }
 /// <summary>
 /// Sends the result via email.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="results">The results.</param>
 private static void SendResultViaEmail(
     BuildControlParameters configuration,
     DailyBuildFullResults results)
 {
     Console.WriteLine("Emailing results ....");
     EmailOps.SendMailtoExchange(configuration.EmailFromAlias, configuration, results);
     Console.WriteLine("Completed mailing of results");
 }
        /// <summary>
        /// This function will send email messages for either a success or failed work item.
        /// The checking will be done whether we should send the mail messages, and mail
        /// will be sent for either success or fail
        /// </summary>
        public static void SendMailtoExchange(
            string senderEmailAddress,
            BuildControlParameters configuration,
            DailyBuildFullResults results)
        {
            if (configuration.EmailResults)
            {
                MailMessage message;
                SmtpClient  client;
                String      subject;
                try
                {
                    client                       = new SmtpClient(SmtpServer);
                    message                      = new MailMessage();
                    message.IsBodyHtml           = true;
                    client.UseDefaultCredentials = true;
                    MailAddress from = new MailAddress(senderEmailAddress + @"@microsoft.com");
                    message.From = from;
                    subject      = "Hero Apps Daily Build Status for: " + DateTime.Now.ToString("MM/dd/yyyy");
                    message.To.Add(new MailAddress(configuration.EmailAlias + @"@microsoft.com"));
                    message.Subject = subject;
                }
                catch (Exception e)
                {
                    ProgramExecutionLog.AddEntry("Email SMTP, send address or to address failure." + e.Message);
                    return;
                }

                try
                {
                    // No point sending if there are none in the email list
                    if (message.To.Count > 0)
                    {
                        message.Body += "\n\n";
                        message.Body  = results.MakeHeroAppsReport(configuration);
                        client.Send(message);
                        Debug.WriteLine("Sent WI email with subject: " + message.Subject);
                    }
                }
                catch (SmtpFailedRecipientException e)
                {
                    ProgramExecutionLog.AddEntry("Partial email send failure. " + e.Message);
                }
                catch (ArgumentException e)
                {
                    ProgramExecutionLog.AddEntry("Email send failure. " + e.Message);
                }
                catch (InvalidOperationException e)
                {
                    ProgramExecutionLog.AddEntry("Email send failure. " + e.Message);
                }
                catch (SmtpException e)
                {
                    ProgramExecutionLog.AddEntry("Email send failure. " + e.Message);
                }
            }
        }
示例#10
0
        /// <summary>
        /// Save the program configuration to disk
        /// </summary>
        /// <param name="config">Configuration settings</param>
        /// <param name="directoryForSave">Directory where to save the file</param>
        /// <param name="fileName">File name to use for the saving of the file</param>
        public static void SaveConfiguration(
            BuildControlParameters config,
            string directoryForSave,
            string fileName)
        {
            string fullPath = Path.Combine(directoryForSave, fileName);

            WriteConfiguration(config, fullPath);
        }
示例#11
0
        /// <summary>
        /// Call sd edit command on the given input file
        /// </summary>
        /// <param name="configuration">Main program configuration</param>
        /// <param name="fileName">File name to have the sd command execute on</param>
        /// <returns>ProcessInformation, so the caller can look at the return code etc</returns>
        public static ProcessInformation SDEdit(
            BuildControlParameters configuration,
            string fileName)
        {
            string             arguments = "edit " + Path.GetFileName(fileName);
            ProcessInformation procInfo  = SDCommand(configuration, fileName, arguments);

            return(procInfo);
        }
示例#12
0
        /// <summary>
        /// Call sd Revert command on the given input file
        /// </summary>
        /// <param name="configuration">Main program configuration</param>
        /// <param name="fileName">File name to have the sd command execute on</param>
        /// <returns>ProcessInformation, so the caller can look at the return code etc</returns>
        public static ProcessInformation SDRevert(
            BuildControlParameters configuration,
            string fileName)
        {
            string             arguments = "revert " + fileName;
            ProcessInformation procInfo  = SDCommand(configuration, fileName, arguments);

            return(procInfo);
        }
示例#13
0
 /// <summary>
 /// Updates the ydr.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="results">The results.</param>
 private static void UpdateYdr(
     BuildControlParameters configuration,
     DailyBuildFullResults results)
 {
     if (configuration.UpdateYdr)
     {
         WpdtOperations.UninstallYdr(configuration);
         WpdtOperations.InstallYdr(configuration, results);
     }
 }
示例#14
0
 /// <summary>
 /// Initializes the build target results.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public void InitializeBuildTargetResults(BuildControlParameters configuration)
 {
     BuildTargets = new BuildTargetResults[configuration.Projects.Length];
     for (Int32 i = 0; i < configuration.Projects.Length; i++)
     {
         BuildTargets[i] = new BuildTargetResults();
         BuildTargets[i].ProjectTargetName = configuration.Projects[i].ProjectPath;
         BuildTargets[i].Reset(configuration);
     }
 }
示例#15
0
        /// <summary>
        /// Installs the ydr.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="results">The results.</param>
        public static void InstallYdr(
            BuildControlParameters configuration,
            DailyBuildFullResults results)
        {
            if (IsYdrInstalled(configuration))
            {
                UninstallWdpt(configuration);
            }
            Console.WriteLine("Beginning install of Ydr for branch " + configuration.YdrBranchSelection + " ...");
            string buildFolderFile = "";
            string setupBranchRoot = "";

            switch (configuration.YdrBranchSelection)
            {
            case YdrBranch.Mainline:
                buildFolderFile = File.ReadAllText(
                    Path.Combine(BuildControlParameters.YdrRootFolder,
                                 BuildControlParameters.YdrLatestBuildFolderFile));
                setupBranchRoot = Path.Combine(BuildControlParameters.YdrRootFolder,
                                               YdrBuildFolder(buildFolderFile));
                break;

            case YdrBranch.Wm7_AppPlatform:
            case YdrBranch.Wm7_AppPlatform_DevDiv:
                string branchRoot = Path.Combine(BuildControlParameters.YdrRootFolder,
                                                 configuration.YdrBranchSelection.ToString());
                buildFolderFile = File.ReadAllText(
                    Path.Combine(branchRoot,
                                 BuildControlParameters.YdrLatestBuildFolderFile));
                setupBranchRoot = Path.Combine(branchRoot,
                                               YdrBuildFolder(buildFolderFile));
                break;
            }
            string fullInstallPath = Path.Combine(setupBranchRoot,
                                                  BuildControlParameters.YdrInstallPathFromBranchRoot);

            Console.WriteLine("Ydr Installation Path = " + fullInstallPath);
            try
            {
                string             arguments = @"";
                ProcessInformation process   = ProcessOperations.RunProcess(fullInstallPath, Application.StartupPath,
                                                                            arguments, true);
                results.InstallYdr.Success = true;
                results.YdrVersion         = "Branch: " + configuration.YdrBranchSelection.ToString() +
                                             " Build " + YdrVersion(YdrBuildFolder(buildFolderFile)).ToString();
                ;
                Console.WriteLine("Ydr Install Completed!");
            }
            catch (Exception e)
            {
                string errorMessage = "Failed to install Ydr. Error message was " + e.Message;
                ProgramExecutionLog.AddEntry(errorMessage);
                results.InstallYdr.SetResults(false, errorMessage);
            }
        }
示例#16
0
        /// <summary>
        /// Execute a sd command
        /// </summary>
        /// <param name="configuration">Main Program configuration</param>
        /// <param name="fileName">File name to perform the SD command on</param>
        /// <param name="arguments">Filled out argument string that will contain the sd command as
        /// well as the file to operate on.</param>
        /// <returns></returns>
        private static ProcessInformation SDCommand(
            BuildControlParameters configuration,
            string fileName,
            string arguments)
        {
            string             progName         = Path.Combine(configuration.PathForSourceDepotProgram, "sd.exe");
            string             workingDirectory = Path.GetDirectoryName(fileName);
            ProcessInformation procInfo         = RunProcess(progName, workingDirectory, arguments, true);

            return(procInfo);
        }
示例#17
0
 public void UpdateWpdtOpsForInstalledVersion(BuildControlParameters configuration)
 {
     if (configuration.UpdateWpdt)
     {
         if (WpdtOperations.IsInstalledWpdtVersionSameAsLkg(configuration))
         {
             this.UninstallWdpt.RequestedToRun = false;
             this.InstallWdpt.RequestedToRun   = false;
             this.ModifyWdpt.RequestedToRun    = false;
         }
     }
 }
示例#18
0
        /// <summary>
        /// Uninstalls the WDPT.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        public static void UninstallWdpt(BuildControlParameters configuration)
        {
            ProcessOperations.KillSwanProcesses();
            UninstallYdr(configuration);

            Console.WriteLine("Beginning uninstall of Wpdt ...");
            GeneralFileOperations.WriteProgramStatusFile(ExecutionStatus.UninstallWdpt);
            string swanController = Path.Combine(configuration.SwanPath, BuildControlParameters.SwanControllerExeName);
            string swanArguments  = "/f " + Path.Combine(configuration.SwanTestCasePath, configuration.WpdtUninstallTestCase);

            ProcessOperations.RunProcess(swanController, configuration.SwanTestCasePath, swanArguments, false);
        }
示例#19
0
        /// <summary>
        /// Determines whether [is installed WPDT version same as LKG] [the specified configuration].
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <returns>
        ///     <c>true</c> if [is installed WPDT version same as LKG] [the specified configuration]; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsInstalledWpdtVersionSameAsLkg(BuildControlParameters configuration)
        {
            string currentInstalledWpdtVersion = DetermineWdptInstalledVersion(configuration);

            if (!String.IsNullOrEmpty(currentInstalledWpdtVersion))
            {
                return(configuration.WpdtLkgSourcePath.ToLower().Contains(currentInstalledWpdtVersion.ToLower()));
            }
            else
            {
                return(false);
            }
        }
示例#20
0
        /// <summary>
        /// Installs the WDPT.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="results">The results.</param>
        public static void InstallWdpt(
            BuildControlParameters configuration,
            DailyBuildFullResults results)
        {
            ProcessOperations.KillSwanProcesses();
            Console.WriteLine("Starting Wpdt installation ....");
            GeneralFileOperations.WriteProgramStatusFile(ExecutionStatus.InstallWdpt);

            string swanController = Path.Combine(configuration.SwanPath, BuildControlParameters.SwanControllerExeName);
            string swanArguments  = "/f " + Path.Combine(configuration.SwanTestCasePath, configuration.WpdtInstallTestCase);

            Console.WriteLine("SwanController = " + swanController);
            Console.WriteLine("SwanArguments = " + swanArguments);

            ProcessOperations.RunProcess(swanController, configuration.SwanTestCasePath, swanArguments, false);
            Console.WriteLine("Waiting " + configuration.WpdtInstallationTimeMinutes.ToString() +
                              " minutes for install to complete");
            bool wpdtInstalled = false;

            for (Int32 i = 0; i < configuration.WpdtInstallationTimeMinutes; i++)
            {
                for (Int32 j = 0; j < 12; j++)
                {
                    Thread.Sleep(5000);
                    Console.Write(".");
                }
                // Wait one more minute after we detect the product is installed to be sure
                // of any final cleanup required.
                if (wpdtInstalled)
                {
                    break;
                }
                Console.WriteLine("");
                Console.WriteLine("Waited " + (i + 1).ToString() + " minutes");
            }
            wpdtInstalled = IsWpdtInstalled(configuration);
            if (wpdtInstalled)
            {
                results.InstallWdpt.SetResults(true, "");
                Console.WriteLine("Completed Install of Wpdt!");
            }
            else
            {
                results.InstallWdpt.SetResults(false, "Wpdt did not install int the alloted time!");
                Console.WriteLine("Wpdt did not install int the alloted time!");
            }
            ProcessOperations.KillSwanProcesses();
            ProcessOperations.KillSetupProcesses();
            results.WpdtVersion = WpdtOperations.DetermineWdptInstalledVersion(configuration);
            results.YdrVersion  = "Same as Wpdt";
        }
示例#21
0
        /// <summary>
        /// Helper function to initialize a test set of files for development
        /// </summary>
        /// <param name="configuration">Main program configuration</param>
        /// <returns>Destination folder path. To use for other operations</returns>
        public static string PrepareWpdtTargetDirectory(
            BuildControlParameters configuration,
            DailyBuildFullResults results)
        {
            string sourcePath      = configuration.WpdtLkgSourcePath;
            string destinationPath = configuration.WpdtLkgTargetPath;

            if (Directory.Exists(destinationPath))
            {
                GeneralFileOperations.DeleteDirectory(destinationPath);
            }
            CopyWpdtLkgToTargetDirectory(sourcePath, destinationPath, results);
            return(destinationPath);
        }
        /// <summary>
        /// Creates the build script and execute.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="results">The results.</param>
        public static void CreateBuildScriptAndExecute(
            BuildControlParameters configuration,
            DailyBuildFullResults results)
        {
            string heroAppSource = FindHeroAppSourceFolder(configuration);

            if (String.IsNullOrEmpty(heroAppSource))
            {
                Console.WriteLine("Could not find Application Parent Folder. Aborting ...");
                ProgramExecutionLog.AddEntry("Could not find Application Parent Folder. Aborting ...");
                return;
            }

            Console.Write("Starting Build/Sign/License Process... ");
            GeneralFileOperations.WriteProgramStatusFile(ExecutionStatus.Running);
            if (configuration.BuildType == BuildTypeEnum.Daily &&
                configuration.UpdateDailyBuildVersion)
            {
                bool allCompletedWithSuccess = ModifyBuildVersionFiles(configuration, results);
                Console.WriteLine("Completed Modifying Revision Files. Overall status was " +
                                  allCompletedWithSuccess.ToString());
            }
            else
            {
                foreach (BuildTargetResults t in results.BuildTargets)
                {
                    t.ModifyVersion.RequestedToRun = false;
                }
            }
            Console.WriteLine("Completed!");
            Console.Write("Beginning to create batch file for build/sign/license operations ... ");
            string commandFile = BuildBatchFile(configuration, results);

            Console.WriteLine("Completed. Running batch file ....");
            ProcessOperations.RunProcess(commandFile, Application.StartupPath, "", true);
            Console.WriteLine("Batch File completed. Status not reported here");
            ValidateBuildResults(configuration, results);
            PublishBuildOutput(configuration, results);
            if (configuration.BuildType == BuildTypeEnum.Daily &&
                configuration.UpdateDailyBuildVersion)
            {
                RevertBuildVersionFiles(configuration, results);
            }

            if (configuration.EmailResults)
            {
                SendResultViaEmail(configuration, results);
            }
        }
示例#23
0
 /// <summary>
 /// WPDTs the ops install.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="results">The results.</param>
 private static void WpdtOpsInstall(
     BuildControlParameters configuration,
     DailyBuildFullResults results)
 {
     if (configuration.UpdateWpdt &&
         !WpdtOperations.IsInstalledWpdtVersionSameAsLkg(configuration))
     {
         WpdtOperations.PrepareWpdtTargetDirectory(configuration, results);
         if (configuration.InstallOnW2k8)
         {
             WpdtOperations.ModifyInstallForW2k8(configuration, results);
         }
         WpdtOperations.InstallWdpt(configuration, results);
     }
 }
示例#24
0
 /// <summary>
 /// Writes the summary results.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="results">The results.</param>
 private static void WriteSummaryResults(
     BuildControlParameters configuration,
     DailyBuildFullResults results)
 {
     // Summary results via writing execution logs to output share.
     GeneralFileOperations.WriteProgramStatusFile(ExecutionStatus.Idle);
     string[] logEntries   = ProgramExecutionLog.FullLogContents();
     string[] emailSummary = results.GenerateResultsSummary().ToArray <string>();
     File.WriteAllLines(ExecutionLogFile, logEntries);
     File.WriteAllLines(EmailSummaryLogFile, emailSummary);
     if (!String.IsNullOrEmpty(results.PublishLogShare))
     {
         File.WriteAllLines(Path.Combine(results.PublishLogShare, ExecutionLogFile), logEntries);
         File.WriteAllLines(Path.Combine(results.PublishLogShare, EmailSummaryLogFile), emailSummary);
     }
 }
示例#25
0
 /// <summary>
 /// Write to config file
 /// </summary>
 /// <param name="config">BDC config settings</param>
 /// <param name="fileName">Config file</param>
 private static void WriteConfiguration(BuildControlParameters config, string fileName)
 {
     try
     {
         XmlSerializer mySerializer = new XmlSerializer(typeof(BuildControlParameters));
         // To write to a file, create a StreamWriter object.
         StreamWriter myWriter = new StreamWriter(fileName);
         mySerializer.Serialize(myWriter, config);
         myWriter.Close();
     }
     catch (Exception e)
     {
         ProgramExecutionLog.AddEntry("Configuration file " + fileName +
                                      " could not be written to disk! Error was " + e.Message);
     }
 }
示例#26
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);
            }
        }
示例#27
0
        /// <summary>
        /// Helper function that will check to see if a file has a read only
        /// attribute set. If it does, then the attribute is removed.
        /// </summary>
        /// <param name="configuration">Main program configuration</param>
        /// <param name="fullFileName">File Name to check for read only attribute</param>
        public static void RemoveReadOnlyAttribute(
            BuildControlParameters configuration,
            string fullFileName)
        {
            FileInfo f = new FileInfo(fullFileName);

            if ((f.Attributes & FileAttributes.ReadOnly) != 0)
            {
                if (configuration.SourceDepotOnlineMode)
                {
                    ProcessOperations.SDEdit(configuration, fullFileName);
                }
                else
                {
                    f.Attributes = f.Attributes & ~FileAttributes.ReadOnly;
                }
            }
        }
示例#28
0
 /// <summary>
 /// Uninstalls the ydr.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 public static void UninstallYdr(BuildControlParameters configuration)
 {
     if (IsYdrInstalled(configuration))
     {
         Console.Write("Beginning uninstall of YDR... ");
         try
         {
             string             arguments = @"/x" + BuildControlParameters.YdrGuid + @" /qb /quiet";
             ProcessInformation process   = ProcessOperations.RunProcess(MsiExec, Application.StartupPath,
                                                                         arguments, true);
             Console.WriteLine("Completed!");
         }
         catch (Exception e)
         {
             Console.WriteLine(" Failed to uninstall YDR!");
             ProgramExecutionLog.AddEntry(
                 "Failed to uninstall Ydr. Error message was " + e.Message);
         }
     }
 }
 /// <summary>
 /// Syncs the enlistment.
 /// </summary>
 /// <param name="configuration">The configuration.</param>
 /// <param name="results">The results.</param>
 public static void SyncEnlistment(
     BuildControlParameters configuration,
     DailyBuildFullResults results)
 {
     Console.Write("Syncing Enlistment ... ");
     GeneralFileOperations.WriteProgramStatusFile(ExecutionStatus.SynEnlistment);
     try
     {
         ProcessInformation process = ProcessOperations.SDSync(configuration);
         CheckForErrorFromSDOperation(process, results, results.EnlistmentSync);
         Console.WriteLine("Success!");
     }
     catch (Exception e)
     {
         Console.WriteLine("Fail!");
         results.EnlistmentSync.SetResults(false, e.Message);
         ProgramExecutionLog.AddEntry(
             "Failed to sync enlistment " +
             " Error was " + e.Message);
     }
     Console.WriteLine("Enlistment Sync Status = " + results.EnlistmentSync.ToString());
 }
示例#30
0
        public void Reset(BuildControlParameters configuration)
        {
            Build.Reset();
            ModifyVersion.Reset();
            RevertVersion.Reset();
            SignXap.Reset();
            LicenseXap.Reset();

            if (configuration.BuildType == BuildTypeEnum.None)
            {
                Build.StatusToNotRun();
                ModifyVersion.StatusToNotRun();
                RevertVersion.StatusToNotRun();
                SignXap.StatusToNotRun();
                LicenseXap.StatusToNotRun();
            }
            if (!configuration.UpdateDailyBuildVersion)
            {
                ModifyVersion.StatusToNotRun();
                RevertVersion.StatusToNotRun();
            }
        }