Exemple #1
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);
        }
Exemple #2
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);
            }
        }
Exemple #3
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);
        }
Exemple #4
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";
        }
        /// <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);
            }
        }
Exemple #6
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);
         }
     }
 }