本文整理汇总了C#中AutomationTool.CommandEnvironment类的典型用法代码示例。如果您正苦于以下问题:C# CommandEnvironment类的具体用法?C# CommandEnvironment怎么用?C# CommandEnvironment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandEnvironment类属于AutomationTool命名空间,在下文中一共展示了CommandEnvironment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunUBT
/// <summary>
/// Runs UBT with the specified commandline. Automatically creates a logfile. When
/// no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">Environment to use.</param>
/// <param name="CommandLine">Commandline to pass on to UBT.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void RunUBT(CommandEnvironment Env, string UBTExecutable, string CommandLine, string LogName = null, Dictionary<string, string> EnvVars = null)
{
if (!FileExists(UBTExecutable))
{
throw new AutomationException("Unable to find UBT executable: " + UBTExecutable);
}
if (GlobalCommandLine.Rocket)
{
CommandLine += " -rocket";
}
if (!IsBuildMachine && UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealBuildTool.UnrealTargetPlatform.Mac)
{
CommandLine += " -nocreatestub";
}
CommandLine += " -NoHotReloadFromIDE";
if (bJunkDeleted || GlobalCommandLine.IgnoreJunk)
{
// UBT has already deleted junk files, make sure it doesn't do it again
CommandLine += " -ignorejunk";
}
else
{
// UBT will delete junk on first run
bJunkDeleted = true;
}
CommandUtils.RunAndLog(Env, UBTExecutable, CommandLine, LogName, EnvVars: EnvVars);
}
示例2: InitEnvironment
protected virtual void InitEnvironment(P4Connection Connection, CommandEnvironment CmdEnv)
{
//
// P4 Environment
//
P4Port = CommandUtils.GetEnvVar(EnvVarNames.P4Port);
ClientRoot = CommandUtils.GetEnvVar(EnvVarNames.ClientRoot);
User = CommandUtils.GetEnvVar(EnvVarNames.User);
ChangelistStringInternal = CommandUtils.GetEnvVar(EnvVarNames.Changelist, null);
Client = CommandUtils.GetEnvVar(EnvVarNames.Client);
BuildRootP4 = CommandUtils.GetEnvVar(EnvVarNames.BuildRootP4);
if (BuildRootP4.EndsWith("/", StringComparison.InvariantCultureIgnoreCase) || BuildRootP4.EndsWith("\\", StringComparison.InvariantCultureIgnoreCase))
{
// We expect the build root to not end with a path separator
BuildRootP4 = BuildRootP4.Substring(0, BuildRootP4.Length - 1);
CommandUtils.SetEnvVar(EnvVarNames.BuildRootP4, BuildRootP4);
}
BuildRootEscaped = CommandUtils.GetEnvVar(EnvVarNames.BuildRootEscaped);
LabelToSync = CommandUtils.GetEnvVar(EnvVarNames.LabelToSync);
string CodeChangelistString = CommandUtils.GetEnvVar(EnvVarNames.CodeChangelist);
if(!String.IsNullOrEmpty(CodeChangelistString))
{
CodeChangelist = Int32.Parse(CodeChangelistString);
}
if (((CommandUtils.P4Enabled || CommandUtils.IsBuildMachine) && (ClientRoot == String.Empty || User == String.Empty ||
(String.IsNullOrEmpty(ChangelistStringInternal) && CommandUtils.IsBuildMachine) || Client == String.Empty || BuildRootP4 == String.Empty)))
{
Log.TraceInformation("P4Enabled={0}", CommandUtils.P4Enabled);
Log.TraceInformation("ClientRoot={0}",ClientRoot );
Log.TraceInformation("User={0}", User);
Log.TraceInformation("ChangelistString={0}", ChangelistStringInternal);
Log.TraceInformation("Client={0}", Client);
Log.TraceInformation("BuildRootP4={0}", BuildRootP4);
throw new AutomationException("BUILD FAILED Perforce Environment is not set up correctly. Please check your environment variables.");
}
LabelPrefix = BuildRootP4 + "/";
if (CommandUtils.P4Enabled)
{
if (CommandUtils.IsBuildMachine || ChangelistStringInternal != null)
{
// We may not always need the changelist number if we're not a build machine.
// In local runs, changelist initialization can be really slow!
VerifyChangelistStringAndSetChangelistNumber();
}
}
LogSettings();
}
示例3: RunUBT
/// <summary>
/// Runs UBT with the specified commandline. Automatically creates a logfile. When
/// no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">Environment to use.</param>
/// <param name="CommandLine">Commandline to pass on to UBT.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void RunUBT(CommandEnvironment Env, string UBTExecutable, string CommandLine, string LogName = null)
{
if (!FileExists(UBTExecutable))
{
throw new AutomationException("Unable to find UBT executable: " + UBTExecutable);
}
if (GlobalCommandLine.Rocket)
{
CommandLine += " -rocket";
}
CommandUtils.RunAndLog(Env, UBTExecutable, CommandLine, LogName);
}
示例4: BuildSolution
/// <summary>
/// Builds a Visual Studio solution with MsDevEnv. Automatically creates a logfile. When
/// no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">BuildEnvironment to use.</param>
/// <param name="SolutionFile">Path to the solution file</param>
/// <param name="BuildConfig">Configuration to build.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void BuildSolution(CommandEnvironment Env, string SolutionFile, string BuildConfig = "Development", string LogName = null)
{
if (!FileExists(SolutionFile))
{
throw new AutomationException(String.Format("Unabled to build Solution {0}. Solution file not found.", SolutionFile));
}
if (String.IsNullOrEmpty(Env.MsDevExe))
{
throw new AutomationException(String.Format("Unabled to build Solution {0}. devenv.com not found.", SolutionFile));
}
string CmdLine = String.Format("\"{0}\" /build \"{1}\"", SolutionFile, BuildConfig);
RunAndLog(Env, Env.MsDevExe, CmdLine, LogName);
}
示例5: BuildCSharpProject
/// <summary>
/// Builds a CSharp project with msbuild.exe. Automatically creates a logfile. When
/// no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">BuildEnvironment to use.</param>
/// <param name="ProjectFile">Path to the project file. Must be a .csproj file.</param>
/// <param name="BuildConfig">Configuration to build.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void BuildCSharpProject(CommandEnvironment Env, string ProjectFile, string BuildConfig = "Development", string LogName = null)
{
if (!ProjectFile.EndsWith(".csproj"))
{
throw new AutomationException(String.Format("Unabled to build Project {0}. Not a valid .csproj file.", ProjectFile));
}
if (!FileExists(ProjectFile))
{
throw new AutomationException(String.Format("Unabled to build Project {0}. Project file not found.", ProjectFile));
}
string CmdLine = String.Format(@"/verbosity:normal /target:Rebuild /property:Configuration={0} /property:Platform=AnyCPU", BuildConfig);
MsBuild(Env, ProjectFile, CmdLine, LogName);
}
示例6: BuildSolution
/// <summary>
/// Builds a Visual Studio solution with MsDevEnv. Automatically creates a logfile. When
/// no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">BuildEnvironment to use.</param>
/// <param name="SolutionFile">Path to the solution file</param>
/// <param name="BuildConfig">Configuration to build.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void BuildSolution(CommandEnvironment Env, string SolutionFile, string BuildConfig = "Development", string LogName = null)
{
if (!FileExists(SolutionFile))
{
throw new AutomationException(String.Format("Unabled to build Solution {0}. Solution file not found.", SolutionFile));
}
if (String.IsNullOrEmpty(Env.MsDevExe))
{
throw new AutomationException(String.Format("Unabled to build Solution {0}. devenv.com not found.", SolutionFile));
}
string CmdLine = String.Format("\"{0}\" /build \"{1}\"", SolutionFile, BuildConfig);
using(TelemetryStopwatch CompileStopwatch = new TelemetryStopwatch("Compile.{0}.{1}.{2}", Path.GetFileName(SolutionFile), "WinC#", BuildConfig))
{
RunAndLog(Env, Env.MsDevExe, CmdLine, LogName);
}
}
示例7: BuildSolution
/// <summary>
/// Builds a Visual Studio solution with MsBuild (using msbuild.exe rather than devenv.com can help circumvent issues with expired Visual Studio licenses).
/// Automatically creates a logfile. When no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">BuildEnvironment to use.</param>
/// <param name="SolutionFile">Path to the solution file</param>
/// <param name="BuildConfig">Configuration to build.</param>
/// <param name="BuildPlatform">Platform to build.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void BuildSolution(CommandEnvironment Env, string SolutionFile, string BuildConfig, string BuildPlatform, string LogName = null)
{
if (!FileExists(SolutionFile))
{
throw new AutomationException(String.Format("Unabled to build Solution {0}. Solution file not found.", SolutionFile));
}
if (String.IsNullOrEmpty(Env.MsBuildExe))
{
throw new AutomationException("Unable to find msbuild.exe at: \"{0}\"", Env.MsBuildExe);
}
string CmdLine = String.Format("\"{0}\" /m /t:Build /p:Configuration=\"{1}\" /p:Platform=\"{2}\" /verbosity:minimal /nologo", SolutionFile, BuildConfig, BuildPlatform);
using (TelemetryStopwatch CompileStopwatch = new TelemetryStopwatch("Compile.{0}.{1}.{2}", Path.GetFileName(SolutionFile), "WinC#", BuildConfig))
{
RunAndLog(Env, Env.MsBuildExe, CmdLine, LogName);
}
}
示例8: BuildSolution
/// <summary>
/// Builds a Visual Studio solution with MsDevEnv. Automatically creates a logfile. When
/// no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">BuildEnvironment to use.</param>
/// <param name="SolutionFile">Path to the solution file</param>
/// <param name="BuildConfig">Configuration to build.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void BuildSolution(CommandEnvironment Env, string SolutionFile, string BuildConfig = "Development", string LogName = null)
{
if (!FileExists(SolutionFile))
{
throw new AutomationException(String.Format("Unabled to build Solution {0}. Solution file not found.", SolutionFile));
}
if (String.IsNullOrEmpty(Env.MsDevExe))
{
throw new AutomationException(String.Format("Unabled to build Solution {0}. devenv.com not found.", SolutionFile));
}
string CmdLine = String.Format("\"{0}\" /build \"{1}\"", SolutionFile, BuildConfig);
var StartBuildSolution = DateTime.Now.ToString();
RunAndLog(Env, Env.MsDevExe, CmdLine, LogName);
var FinishBuildSolution = DateTime.Now.ToString();
PrintCSVFile(String.Format("UAT,Compile,{0},{1}", StartBuildSolution, FinishBuildSolution));
}
示例9: RunUBT
/// <summary>
/// Runs UBT with the specified commandline. Automatically creates a logfile. When
/// no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">Environment to use.</param>
/// <param name="CommandLine">Commandline to pass on to UBT.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void RunUBT(CommandEnvironment Env, string UBTExecutable, string CommandLine, string LogName = null)
{
if (!FileExists(UBTExecutable))
{
throw new AutomationException("Unable to find UBT executable: " + UBTExecutable);
}
if (GlobalCommandLine.Rocket)
{
CommandLine += " -rocket";
}
if (!IsBuildMachine && UnrealBuildTool.BuildHostPlatform.Current.Platform == UnrealBuildTool.UnrealTargetPlatform.Mac)
{
CommandLine += " -nocreatestub";
}
CommandUtils.RunAndLog(Env, UBTExecutable, CommandLine, LogName);
}
示例10: MsBuild
/// <summary>
/// Runs msbuild.exe with the specified arguments. Automatically creates a logfile. When
/// no LogName is specified, the executable name is used as logfile base name.
/// </summary>
/// <param name="Env">BuildEnvironment to use.</param>
/// <param name="Project">Path to the project to build.</param>
/// <param name="Arguments">Arguments to pass to msbuild.exe.</param>
/// <param name="LogName">Optional logfile name.</param>
public static void MsBuild(CommandEnvironment Env, string Project, string Arguments, string LogName)
{
if (String.IsNullOrEmpty(Env.MsBuildExe))
{
throw new AutomationException("Unable to find msbuild.exe at: \"{0}\"", Env.MsBuildExe);
}
if (!FileExists(Project))
{
throw new AutomationException("Project {0} does not exist!", Project);
}
var RunArguments = MakePathSafeToUseWithCommandLine(Project);
if (!String.IsNullOrEmpty(Arguments))
{
RunArguments += " " + Arguments;
}
RunAndLog(Env, Env.MsBuildExe, RunArguments, LogName);
}
示例11: DeleteLocalTempStorageManifests
public static void DeleteLocalTempStorageManifests(CommandEnvironment Env)
{
DeleteDirectory(true, LocalTempStorageManifestDirectory(Env));
}
示例12: SaveSharedTempStorageManifest
public static TempStorageManifest SaveSharedTempStorageManifest(CommandEnvironment Env, string StorageBlockName, string GameFolder, List<string> Files)
{
return SaveTempStorageManifest(SharedTempStorageDirectory(StorageBlockName, GameFolder), SharedTempStorageManifestFilename(Env, StorageBlockName, GameFolder), Files);
}
示例13: SharedTempStorageManifestFilename
public static string SharedTempStorageManifestFilename(CommandEnvironment Env, string StorageBlockName, string GameFolder)
{
return CombinePaths(SharedTempStorageDirectory(StorageBlockName, GameFolder), StorageBlockName + ".TempManifest");
}
示例14: SaveLocalTempStorageManifest
public static TempStorageManifest SaveLocalTempStorageManifest(CommandEnvironment Env, string BaseFolder, string StorageBlockName, List<string> Files)
{
return SaveTempStorageManifest(BaseFolder, LocalTempStorageManifestFilename(Env, StorageBlockName), Files);
}
示例15: LocalTempStorageManifestFilename
public static string LocalTempStorageManifestFilename(CommandEnvironment Env, string StorageBlockName)
{
return CombinePaths(LocalTempStorageManifestDirectory(Env), StorageBlockName + ".TempManifest");
}