示例#1
0
        /// <summary>
        /// Updates the engine version files
        /// </summary>
        public List<string> UpdateVersionFiles(bool ActuallyUpdateVersionFiles = true, int? ChangelistNumberOverride = null)
        {
            bool bIsLicenseeVersion = OwnerCommand.ParseParam("Licensee");
            bool bDoUpdateVersionFiles = CommandUtils.P4Enabled && ActuallyUpdateVersionFiles;
            int ChangelistNumber = 0;
            string ChangelistString = String.Empty;
            if (bDoUpdateVersionFiles)
            {
                ChangelistNumber = ChangelistNumberOverride.GetValueOrDefault(P4Env.Changelist);
                ChangelistString = ChangelistNumber.ToString();
            }

            var Result = new List<String>();
            string Branch = P4Enabled ? P4Env.BuildRootEscaped : "";
            {
                string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Build", "build.properties");
                if (bDoUpdateVersionFiles)
                {
                    Log("Updating {0} with:", VerFile);
                    Log("  TimestampForBVT={0}", CmdEnv.TimestampAsString);
                    Log("  EngineVersion={0}", ChangelistNumber.ToString());
                    Log("  BranchName={0}", Branch);

                    PrepareBuildProduct(VerFile, false);
                    VersionFileUpdater BuildProperties = new VersionFileUpdater(VerFile);
                    BuildProperties.ReplaceLine("TimestampForBVT=", CmdEnv.TimestampAsString);
                    BuildProperties.ReplaceLine("EngineVersion=", ChangelistNumber.ToString());
                    BuildProperties.ReplaceLine("BranchName=", Branch);
                    BuildProperties.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                if (IsBuildMachine)
                {
                    // Only BuildMachines can check this file in
                    AddBuildProduct(VerFile);
                }
                Result.Add(VerFile);
            }

            {
                string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Runtime", "Core", "Private", "UObject", "ObjectVersion.cpp");
                if (bDoUpdateVersionFiles)
                {
                    Log("Updating {0} with:", VerFile);
                    Log(" #define	ENGINE_VERSION  {0}", ChangelistNumber.ToString());

                    VersionFileUpdater ObjectVersionCpp = new VersionFileUpdater(VerFile);
                    ObjectVersionCpp.ReplaceLine("#define	ENGINE_VERSION	", ChangelistNumber.ToString());
                    ObjectVersionCpp.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                Result.Add(VerFile);
            }

            string EngineVersionFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Runtime", "Launch", "Resources", "Version.h");
            {
                string VerFile = EngineVersionFile;
                if (bDoUpdateVersionFiles)
                {
                    Log("Updating {0} with:", VerFile);
                    Log(" #define	ENGINE_VERSION  {0}", ChangelistNumber.ToString());
                    Log(" #define	BRANCH_NAME  {0}", Branch);
                    Log(" #define	BUILT_FROM_CHANGELIST  {0}", ChangelistString);
                    Log(" #define   ENGINE_IS_LICENSEE_VERSION  {0}", bIsLicenseeVersion ? "1" : "0");

                    VersionFileUpdater VersionH = new VersionFileUpdater(VerFile);
                    VersionH.ReplaceLine("#define ENGINE_VERSION ", ChangelistNumber.ToString());
                    VersionH.ReplaceLine("#define BRANCH_NAME ", "\"" + Branch + "\"");
                    VersionH.ReplaceLine("#define BUILT_FROM_CHANGELIST ", ChangelistString);
                    VersionH.ReplaceOrAddLine("#define ENGINE_IS_LICENSEE_VERSION ", bIsLicenseeVersion ? "1" : "0");

                    VersionH.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                Result.Add(VerFile);
            }

            {
                // Use Version.h data to update MetaData.cs so the assemblies match the engine version.
                string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Programs", "DotNETCommon", "MetaData.cs");

                if (bDoUpdateVersionFiles)
                {
                    // Get the MAJOR/MINOR/PATCH from the Engine Version file, as it is authoritative. The rest we get from the P4Env.
                    string NewInformationalVersion = FEngineVersionSupport.FromVersionFile(EngineVersionFile, ChangelistNumber).ToString();

                    Log("Updating {0} with AssemblyInformationalVersion: {1}", VerFile, NewInformationalVersion);

                    VersionFileUpdater VersionH = new VersionFileUpdater(VerFile);
                    VersionH.SetAssemblyInformationalVersion(NewInformationalVersion);
                    VersionH.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                Result.Add(VerFile);
            }

            return Result;
        }
示例#2
0
        /// <summary>
        /// Updates the engine version files
        /// </summary>
        public List<string> UpdateVersionFiles()
        {
            var Result = new List<String>();
            string Branch = P4Enabled ? P4Env.BuildRootEscaped : "";
            {
                string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Build", "build.properties");
                if (CommandUtils.P4Enabled)
                {
                    Log("Updating {0} with:", VerFile);
                    Log("  TimestampForBVT={0}", CmdEnv.TimestampAsString);
                    Log("  EngineVersion={0}", P4Env.ChangelistString);
                    Log("  BranchName={0}", Branch);

                    PrepareBuildProduct(VerFile, false);
                    VersionFileUpdater BuildProperties = new VersionFileUpdater(VerFile);
                    BuildProperties.ReplaceLine("TimestampForBVT=", CmdEnv.TimestampAsString);
                    BuildProperties.ReplaceLine("EngineVersion=", P4Env.ChangelistString);
                    BuildProperties.ReplaceLine("BranchName=", Branch);
                    BuildProperties.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                if (IsBuildMachine)
                {
                    // Only BuildMachines can check this file in
                    AddBuildProduct(VerFile);
                }
                Result.Add(VerFile);
            }

            {
                string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Runtime", "Core", "Private", "UObject", "ObjectVersion.cpp");
                if (CommandUtils.P4Enabled)
                {
                    Log("Updating {0} with:", VerFile);
                    Log(" #define	ENGINE_VERSION  {0}", P4Env.ChangelistString);

                    VersionFileUpdater ObjectVersionCpp = new VersionFileUpdater(VerFile);
                    ObjectVersionCpp.ReplaceLine("#define	ENGINE_VERSION	", P4Env.ChangelistString);
                    ObjectVersionCpp.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                Result.Add(VerFile);
            }

            string EngineVersionFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Runtime", "Launch", "Resources", "Version.h");
            {
                string VerFile = EngineVersionFile;
                if (CommandUtils.P4Enabled)
                {
                    Log("Updating {0} with:", VerFile);
                    Log(" #define	ENGINE_VERSION  {0}", P4Env.ChangelistString);
                    Log(" #define	ENGINE_VERSION_HIWORD  {0}", (P4Env.Changelist >> 16).ToString());
                    Log(" #define	ENGINE_VERSION_LOWORD  {0}", (P4Env.Changelist & 0xFFFF).ToString());
                    Log(" #define	BRANCH_NAME  {0}", Branch);
                    Log(" #define	BUILT_FROM_CHANGELIST  {0}", P4Env.ChangelistString);

                    VersionFileUpdater VersionH = new VersionFileUpdater(VerFile);
                    VersionH.ReplaceLine("#define ENGINE_VERSION ", P4Env.ChangelistString);
                    VersionH.ReplaceLine("#define ENGINE_VERSION_HIWORD ", (P4Env.Changelist >> 16).ToString());
                    VersionH.ReplaceLine("#define ENGINE_VERSION_LOWORD ", (P4Env.Changelist & 0xFFFF).ToString());
                    VersionH.ReplaceLine("#define BRANCH_NAME ", "\"" + Branch + "\"");
                    VersionH.ReplaceLine("#define BUILT_FROM_CHANGELIST ", P4Env.ChangelistString);

                    VersionH.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                Result.Add(VerFile);
            }

            {
                // Use Version.h data to update MetaData.cs so the assemblies match the engine version.
                string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Programs", "DotNETCommon", "MetaData.cs");

                if (CommandUtils.P4Enabled)
                {
                    // Get the MAJOR/MINOR/PATCH from the Engine Version file, as it is authoritative. The rest we get from the P4Env.
                    string NewInformationalVersion = FEngineVersionSupport.FromVersionFile(EngineVersionFile).ToString();

                    Log("Updating {0} with AssemblyInformationalVersion: {1}", VerFile, NewInformationalVersion);

                    VersionFileUpdater VersionH = new VersionFileUpdater(VerFile);
                    VersionH.SetAssemblyInformationalVersion(NewInformationalVersion);
                    VersionH.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                Result.Add(VerFile);
            }

            return Result;
        }
示例#3
0
		public static List<string> StaticUpdateVersionFiles(int ChangelistNumber, int CompatibleChangelistNumber, string Branch, string Build, bool bIsLicenseeVersion, bool bDoUpdateVersionFiles)
		{
			string ChangelistString = (ChangelistNumber != 0 && bDoUpdateVersionFiles)? ChangelistNumber.ToString() : String.Empty;

			var Result = new List<String>();
			{
				string VerFile = BuildVersion.GetDefaultFileName();
				if (bDoUpdateVersionFiles)
				{
					LogLog("Updating {0} with:", VerFile);
					LogLog("  Changelist={0}", ChangelistNumber);
					LogLog("  CompatibleChangelist={0}", CompatibleChangelistNumber);
					LogLog("  IsLicenseeVersion={0}", bIsLicenseeVersion? 1 : 0);
					LogLog("  BranchName={0}", Branch);

					BuildVersion Version;
					if(!BuildVersion.TryRead(VerFile, out Version))
					{
						Version = new BuildVersion();
					}

					Version.Changelist = ChangelistNumber;
					Version.CompatibleChangelist = CompatibleChangelistNumber;
					Version.IsLicenseeVersion = bIsLicenseeVersion? 1 : 0;
					Version.BranchName = Branch;

					VersionFileUpdater.MakeFileWriteable(VerFile);

					Version.Write(VerFile);
				}
				else
				{
					LogVerbose("{0} will not be updated because P4 is not enabled.", VerFile);
				}
				Result.Add(VerFile);
			}

            string EngineVersionFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Runtime", "Launch", "Resources", "Version.h");
            {
                string VerFile = EngineVersionFile;
				if (bDoUpdateVersionFiles)
				{
					LogLog("Updating {0} with:", VerFile);
					LogLog(" #define	BRANCH_NAME  {0}", Branch);
					LogLog(" #define	BUILT_FROM_CHANGELIST  {0}", ChangelistString);
					if(CompatibleChangelistNumber > 0)
					{
						LogLog(" #define	ENGINE_COMPATIBLE_CL_VERSION  {0}", CompatibleChangelistNumber);
					}
					if (Build != null)
					{
						LogLog(" #define	BUILD_VERSION  {0}", Build);
					}
					LogLog(" #define   ENGINE_IS_LICENSEE_VERSION  {0}", bIsLicenseeVersion ? "1" : "0");

					VersionFileUpdater VersionH = new VersionFileUpdater(VerFile);
					VersionH.ReplaceLine("#define BRANCH_NAME ", "\"" + Branch + "\"");
					VersionH.ReplaceLine("#define BUILT_FROM_CHANGELIST ", ChangelistString);
					if (Build != null)
					{
						VersionH.ReplaceLine("#define BUILD_VERSION ", "L\"" + Build + "\"");
					}
					if(CompatibleChangelistNumber > 0)
					{
						VersionH.ReplaceLine("#define ENGINE_COMPATIBLE_CL_VERSION", CompatibleChangelistNumber.ToString(), bIsLicenseeVersion? 0 : 1);
					}
					VersionH.ReplaceLine("#define ENGINE_IS_LICENSEE_VERSION ", bIsLicenseeVersion ? "1" : "0");

                    VersionH.Commit();
                }
				else
				{
					LogVerbose("{0} will not be updated because P4 is not enabled.", VerFile);
				}
                Result.Add(VerFile);
            }

            {
                // Use Version.h data to update MetaData.cs so the assemblies match the engine version.
                string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Programs", "DotNETCommon", "MetaData.cs");

				if (bDoUpdateVersionFiles)
                {
                    // Get the MAJOR/MINOR/PATCH from the Engine Version file, as it is authoritative. The rest we get from the P4Env.
                    string NewInformationalVersion = FEngineVersionSupport.FromVersionFile(EngineVersionFile, ChangelistNumber).ToString();

                    LogLog("Updating {0} with AssemblyInformationalVersion: {1}", VerFile, NewInformationalVersion);

                    VersionFileUpdater VersionH = new VersionFileUpdater(VerFile);
                    VersionH.SetAssemblyInformationalVersion(NewInformationalVersion);
                    VersionH.Commit();
                }
                else
                {
                    LogVerbose("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                Result.Add(VerFile);
            }

			return Result;
		}
示例#4
0
		/// <summary>
		/// Updates the engine version files
		/// </summary>
		public List<string> UpdateVersionFiles(bool ActuallyUpdateVersionFiles = true, int? ChangelistNumberOverride = null)
		{
			bool bIsLicenseeVersion = OwnerCommand.ParseParam("Licensee");
			bool bDoUpdateVersionFiles = CommandUtils.P4Enabled && ActuallyUpdateVersionFiles;		
			int ChangelistNumber = 0;
			string ChangelistString = String.Empty;
			if (bDoUpdateVersionFiles)
			{
				ChangelistNumber = ChangelistNumberOverride.GetValueOrDefault(P4Env.Changelist);
				ChangelistString = ChangelistNumber.ToString();
			}

			var Result = new List<String>();
			string Branch = P4Enabled ? P4Env.BuildRootEscaped : "";
			{
				string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Build", "Build.version");
				if (bDoUpdateVersionFiles)
				{
					Log("Updating {0} with:", VerFile);
					Log("  Changelist={0}", ChangelistNumber);
					Log("  IsLicenseeVersion={0}", bIsLicenseeVersion? 1 : 0);
					Log("  BranchName={0}", Branch);

					string VerText = CommandUtils.ReadAllText(VerFile);

					JavaScriptSerializer Serializer = new JavaScriptSerializer();
					Dictionary<string, object> Pairs = Serializer.Deserialize<Dictionary<string, object>>(VerText);
					Pairs["Changelist"] = ChangelistNumber;
					Pairs["IsLicenseeVersion"] = bIsLicenseeVersion? 1 : 0;
					Pairs["BranchName"] = Branch;
					VerText = Serializer.Serialize(Pairs).Replace("{\"", "{\n\t\"").Replace(",\"", ",\n\t\"").Replace("\":", "\": ").Replace("\"}", "\"\n}");

					CommandUtils.SetFileAttributes(VerFile, ReadOnly: false);
					CommandUtils.WriteAllText(VerFile, VerText);
				}
				else
				{
					Log("{0} will not be updated because P4 is not enabled.", VerFile);
				}
				if (IsBuildMachine)
				{
					// Only BuildMachines can check this file in
					AddBuildProduct(VerFile);
				}
				Result.Add(VerFile);
			}

            string EngineVersionFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Runtime", "Launch", "Resources", "Version.h");
            {
                string VerFile = EngineVersionFile;
				if (bDoUpdateVersionFiles)
				{
					Log("Updating {0} with:", VerFile);
					Log(" #define	BRANCH_NAME  {0}", Branch);
					Log(" #define	BUILT_FROM_CHANGELIST  {0}", ChangelistString);
					Log(" #define   ENGINE_IS_LICENSEE_VERSION  {0}", bIsLicenseeVersion ? "1" : "0");

					VersionFileUpdater VersionH = new VersionFileUpdater(VerFile);
					VersionH.ReplaceLine("#define BRANCH_NAME ", "\"" + Branch + "\"");
					VersionH.ReplaceLine("#define BUILT_FROM_CHANGELIST ", ChangelistString);
					VersionH.ReplaceOrAddLine("#define ENGINE_IS_LICENSEE_VERSION ", bIsLicenseeVersion ? "1" : "0");

                    VersionH.Commit();
                }
				else
				{
					Log("{0} will not be updated because P4 is not enabled.", VerFile);
				}
                Result.Add(VerFile);
            }

            {
                // Use Version.h data to update MetaData.cs so the assemblies match the engine version.
                string VerFile = CombinePaths(CmdEnv.LocalRoot, "Engine", "Source", "Programs", "DotNETCommon", "MetaData.cs");

				if (bDoUpdateVersionFiles)
                {
                    // Get the MAJOR/MINOR/PATCH from the Engine Version file, as it is authoritative. The rest we get from the P4Env.
                    string NewInformationalVersion = FEngineVersionSupport.FromVersionFile(EngineVersionFile, ChangelistNumber).ToString();

                    Log("Updating {0} with AssemblyInformationalVersion: {1}", VerFile, NewInformationalVersion);

                    VersionFileUpdater VersionH = new VersionFileUpdater(VerFile);
                    VersionH.SetAssemblyInformationalVersion(NewInformationalVersion);
                    VersionH.Commit();
                }
                else
                {
                    Log("{0} will not be updated because P4 is not enabled.", VerFile);
                }
                Result.Add(VerFile);
            }

			return Result;
		}