public override void ExecuteBuild()
    {
        var SourcePath = ParseParamValue("Source=");
        var DestPath   = ParseParamValue("Dest=");
        var Threads    = ParseParamInt("Threads=", 64);

        if (String.IsNullOrEmpty(SourcePath))
        {
            throw new AutomationException("Source path not specified, please use -source=Path");
        }
        if (String.IsNullOrEmpty(DestPath))
        {
            throw new AutomationException("Destination path not specified, please use -dest=Path");
        }
        if (!DirectoryExists(SourcePath))
        {
            throw new AutomationException("Source path {0} does not exist", SourcePath);
        }

        DeleteDirectory(DestPath);

        using (var ScopedCopyTimer = new ScopedTimer("ThreadedCopyFiles"))
        {
            ThreadedCopyFiles(SourcePath, DestPath, Threads);
        }
    }
예제 #2
0
 public void timer(Level level, string description, Stopwatch stopwatch, object data)
 {
     if (LogLevel <= level)
     {
         TimeSpan duration = stopwatch.Elapsed;
         ScopedTimer.TrackTimerResult(description, duration, data);
         timer(level, "Finished timer \"{0}\" with duration '{1:g}'",
               description, duration.TotalSeconds);
     }
 }
예제 #3
0
        /// <summary>
        /// Gets the latest write time of any of the UnrealHeaderTool binaries (including DLLs and Plugins) or DateTime.MaxValue if UnrealHeaderTool does not exist
        /// </summary>
        /// <returns>
        /// Latest timestamp of UHT binaries or DateTime.MaxValue if UnrealHeaderTool is out of date and needs to be rebuilt.
        /// </returns>
        static bool GetHeaderToolTimestamp(out DateTime Timestamp)
        {
            using (var TimestampTimer = new ScopedTimer("GetHeaderToolTimestamp"))
            {
                // Try to read the receipt for UHT.
                string ReceiptPath = BuildReceipt.GetDefaultPath(BuildConfiguration.RelativeEnginePath, "UnrealHeaderTool", BuildHostPlatform.Current.Platform, UnrealTargetConfiguration.Development, null);
                if(!File.Exists(ReceiptPath))
                {
                    Timestamp = DateTime.MaxValue;
                    return false;
                }

                BuildReceipt Receipt;
                try
                {
                    Receipt = BuildReceipt.Read(ReceiptPath);
                }
                catch(Exception)
                {
                    Timestamp = DateTime.MaxValue;
                    return false;
                }
                Receipt.ExpandPathVariables(BuildConfiguration.RelativeEnginePath, BuildConfiguration.RelativeEnginePath);

                // Check all the binaries exist, and that all the DLLs are built against the right version
                if(!CheckBinariesExist(Receipt) || !CheckDynamicLibaryVersionsMatch(Receipt))
                {
                    Timestamp = DateTime.MaxValue;
                    return false;
                }

                // Return the timestamp for all the binaries
                Timestamp = GetTimestampFromBinaries(Receipt);
                return true;
            }
        }
예제 #4
0
    public override void ExecuteBuild()
    {
        var SourcePath = ParseParamValue("Source=");
        var DestPath = ParseParamValue("Dest=");
        var Threads = ParseParamInt("Threads=", 64);

        if (String.IsNullOrEmpty(SourcePath))
        {
            throw new AutomationException("Source path not specified, please use -source=Path");
        }
        if (String.IsNullOrEmpty(DestPath))
        {
            throw new AutomationException("Destination path not specified, please use -dest=Path");
        }
        if (!DirectoryExists(SourcePath))
        {
            throw new AutomationException("Source path {0} does not exist", SourcePath);
        }

        DeleteDirectory(DestPath);

        using (var ScopedCopyTimer = new ScopedTimer("ThreadedCopyFiles"))
        {
            ThreadedCopyFiles(SourcePath, DestPath, Threads);
        }
    }
예제 #5
0
 /// <summary>
 /// Gets the latest write time of any of the UnrealHeaderTool binaries (including DLLs and Plugins) or DateTime.MaxValue if UnrealHeaderTool does not exist
 /// </summary>
 /// <returns>
 /// Latest timestamp of UHT binaries or DateTime.MaxValue if UnrealHeaderTool is out of date and needs to be rebuilt.
 /// </returns>
 static DateTime CheckIfUnrealHeaderToolIsUpToDate()
 {
     var LatestWriteTime = DateTime.MinValue;
     int? MinVersion = null;
     using (var TimestampTimer = new ScopedTimer("GetHeaderToolTimestamp"))
     {
         var HeaderToolBinaries = GetHeaderToolBinaries();
         // Find the latest write time for all UnrealHeaderTool binaries
         foreach (var Binary in HeaderToolBinaries)
         {
             var BinaryInfo = new FileInfo(Binary.Filename);
             if (BinaryInfo.Exists)
             {
                 // Latest write time
                 if (BinaryInfo.LastWriteTime > LatestWriteTime)
                 {
                     LatestWriteTime = BinaryInfo.LastWriteTime;
                 }
                 // Minimum version
                 if (Binary.Version > -1)
                 {
                     MinVersion = MinVersion.HasValue ? Math.Min(MinVersion.Value, Binary.Version) : Binary.Version;
                 }
             }
         }
         if (MinVersion.HasValue)
         {
             // If we were able to retrieve the minimal API version, go through all binaries one more time
             // and delete all binaries that do not match the minimum version (which for local builds would be 0, but it will
             // also detect bad or partial syncs)
             foreach (var Binary in HeaderToolBinaries)
             {
                 if (Binary.Version > -1)
                 {
                     if (Binary.Version != MinVersion.Value)
                     {
                         // Bad sync
                         File.Delete(Binary.Filename);
                         LatestWriteTime = DateTime.MaxValue;
                         Log.TraceWarning("Detected mismatched version in UHT binary {0} (API Version {1}, expected: {2})", Path.GetFileName(Binary.Filename), Binary.Version, MinVersion.Value);
                     }
                 }
             }
         }
     }
     // If UHT doesn't exist or is out of date/mismatched, force regenerate.
     return LatestWriteTime > DateTime.MinValue ? LatestWriteTime : DateTime.MaxValue;
 }
		/// <summary>
		/// Runs install/uninstall hooks for SDK
		/// </summary>
		/// <param name="PlatformSDKRoot">absolute path to platform SDK root</param>
		/// <param name="SDKVersionString">version string to run for (can be empty!)</param>
		/// <param name="Hook">which one of hooks to run</param>
		/// <param name="bHookCanBeNonExistent">whether a non-existing hook means failure</param>
		/// <returns>true if succeeded</returns>
		protected virtual bool RunAutoSDKHooks(string PlatformSDKRoot, string SDKVersionString, SDKHookType Hook, bool bHookCanBeNonExistent = true)
		{
			if (!IsAutoSDKSafe())
			{
				Console.ForegroundColor = ConsoleColor.Red;
				LogAutoSDK(GetSDKTargetPlatformName() + " attempted to run SDK hook which could have damaged manual SDK install!");
				Console.ResetColor();

				return false;
			}
			if (SDKVersionString != "")
			{
				string SDKDirectory = Path.Combine(PlatformSDKRoot, SDKVersionString);
				string HookExe = Path.Combine(SDKDirectory, GetHookExecutableName(Hook));

				if (File.Exists(HookExe))
				{
					LogAutoSDK("Running {0} hook {1}", Hook, HookExe);

					// run it
					Process HookProcess = new Process();
					HookProcess.StartInfo.WorkingDirectory = SDKDirectory;
					HookProcess.StartInfo.FileName = HookExe;
					HookProcess.StartInfo.Arguments = "";
					HookProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;

					// seems to break the build machines?
					//HookProcess.StartInfo.UseShellExecute = false;
					//HookProcess.StartInfo.RedirectStandardOutput = true;
					//HookProcess.StartInfo.RedirectStandardError = true;					

					using (ScopedTimer HookTimer = new ScopedTimer("Time to run hook: ", bShouldLogInfo ? LogEventType.Log : LogEventType.Verbose))
					{
						//installers may require administrator access to succeed. so run as an admmin.
						HookProcess.StartInfo.Verb = "runas";
						HookProcess.Start();
						HookProcess.WaitForExit();
					}

					//LogAutoSDK(HookProcess.StandardOutput.ReadToEnd());
					//LogAutoSDK(HookProcess.StandardError.ReadToEnd());
					if (HookProcess.ExitCode != 0)
					{
						LogAutoSDK("Hook exited uncleanly (returned {0}), considering it failed.", HookProcess.ExitCode);
						return false;
					}

					return true;
				}
				else
				{
					LogAutoSDK("File {0} does not exist", HookExe);
				}
			}
			else
			{
				LogAutoSDK("Version string is blank for {0}. Can't determine {1} hook.", PlatformSDKRoot, Hook.ToString());
			}

			return bHookCanBeNonExistent;
		}