Esempio n. 1
0
        /// <summary>
        /// Initializes build environment. If the build command needs a specific env-var mapping or
        /// has an extended BuildEnvironment, it must implement this method accordingly.
        /// </summary>
        /// <returns>Initialized and ready to use BuildEnvironment</returns>
        internal static void InitP4Environment()
        {
            CheckP4Enabled();

            P4LogPath = CombinePaths(CmdEnv.LogFolder, "p4.log");
            PerforceEnvironment = Automation.IsBuildMachine ? new P4Environment(CmdEnv) : new LocalP4Environment(CmdEnv);
        }
Esempio n. 2
0
		/// <summary>
		/// Initializes build environment. If the build command needs a specific env-var mapping or
		/// has an extended BuildEnvironment, it must implement this method accordingly.
		/// </summary>
		static internal void InitP4Environment()
		{
			CheckP4Enabled();

			// Temporary connection - will use only the currently set env vars to connect to P4
			var DefaultConnection = new P4Connection(User: null, Client: null);
			PerforceEnvironment = Automation.IsBuildMachine ? new P4Environment(DefaultConnection, CmdEnv) : new LocalP4Environment(DefaultConnection, CmdEnv);
		}
Esempio n. 3
0
		/// <summary>
        /// returns the full name of a label. //depot/UE4/TEST-GUBP-Promotable-GameName-CL-CLNUMBER
		/// </summary>
		/// <param name="BuildNamePrefix">Label Prefix</param>
        public string FullLabelName(P4Environment Env, string BuildNamePrefix)
        {
            CheckP4Enabled();
			var Label = Env.LabelPrefix + BuildNamePrefix + "-CL-" + Env.ChangelistString;
			CommandUtils.Log("Label prefix {0}", BuildNamePrefix);
			CommandUtils.Log("Full Label name {0}", Label); 
            return Label;
        }
Esempio n. 4
0
        /// <summary>
        /// Creates a downstream label.
        /// </summary>
        /// <param name="BuildNamePrefix">Label Prefix</param>
		public void MakeDownstreamLabelFromLabel(P4Environment Env, string BuildNamePrefix, string CopyFromBuildNamePrefix)
        {
            CheckP4Enabled();
			string DOWNSTREAM_LabelPrefix = CommandUtils.GetEnvVar("DOWNSTREAM_LabelPrefix");
            if (!String.IsNullOrEmpty(DOWNSTREAM_LabelPrefix))
            {
                BuildNamePrefix = DOWNSTREAM_LabelPrefix;
            }
            if (String.IsNullOrEmpty(BuildNamePrefix) || String.IsNullOrEmpty(CopyFromBuildNamePrefix))
            {
                throw new P4Exception("Need a downstream label");
            }

            {
				CommandUtils.Log("Making downstream label");
                var Label = FullLabelName(Env, BuildNamePrefix);

				CommandUtils.Log("Deleting old label {0} (if any)...", Label);
                DeleteLabel(Label, false);

				CommandUtils.Log("Creating new label...");
                CreateLabel(
                    Name: Label,
					Description: "BVT Time " + CommandUtils.CmdEnv.TimestampAsString + "  CL " + Env.ChangelistString,
                    Options: "unlocked noautoreload",
					View: CommandUtils.CombinePaths(PathSeparator.Depot, Env.BuildRootP4, "...")
                    );
                LabelToLabelSync(FullLabelName(Env, CopyFromBuildNamePrefix), Label, false);
            }
        }
Esempio n. 5
0
		/// <summary>
		/// Creates a downstream label.
		/// </summary>
		/// <param name="BuildNamePrefix">Label Prefix</param>
		public void MakeDownstreamLabel(P4Environment Env, string BuildNamePrefix, List<string> Files = null)
		{
			CheckP4Enabled();
			string DOWNSTREAM_LabelPrefix = CommandUtils.GetEnvVar("DOWNSTREAM_LabelPrefix");
			if (!String.IsNullOrEmpty(DOWNSTREAM_LabelPrefix))
			{
				BuildNamePrefix = DOWNSTREAM_LabelPrefix;
			}
			if (String.IsNullOrEmpty(BuildNamePrefix))
			{
				throw new P4Exception("Need a downstream label");
			}

			{
				CommandUtils.LogLog("Making downstream label");
                var Label = FullLabelName(Env, BuildNamePrefix);

				CommandUtils.LogLog("Deleting old label {0} (if any)...", Label);
                DeleteLabel(Label, false);

				CommandUtils.LogLog("Creating new label...");
				CreateLabel(
					Name: Label,
					Description: "BVT Time " + CommandUtils.CmdEnv.TimestampAsString + "  CL " + Env.ChangelistString,
					Options: "unlocked noautoreload",
					View: CommandUtils.CombinePaths(PathSeparator.Depot, Env.BuildRootP4, "...")
					);
				if (Files == null)
				{
					CommandUtils.LogLog("Adding all files to new label {0}...", Label);
					LabelSync(Label, false);
				}
				else
				{
					CommandUtils.LogLog("Adding build products to new label {0}...", Label);
					foreach (string LabelFile in Files)
					{
						LabelSync(Label, false, LabelFile);
					}
				}
			}
		}