Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
BuilderOptions.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.IO;
4 
5 using Mono.Options;
6 using SiliconStudio.Core.Diagnostics;
7 
8 namespace SiliconStudio.BuildEngine
9 {
10  public class BuilderOptions
11  {
12  public readonly PluginResolver Plugins;
13  public readonly Logger Logger;
14 
15  public bool Verbose = false;
16  public bool Debug = false;
17  // This should not be a list
18  public List<string> InputFiles = new List<string>();
20  public string BuildDirectory;
21  public List<string> MonitorPipeNames = new List<string>();
22  public string OutputDirectory;
23  public string Configuration;
24  public bool EnableFileLogging;
25  public bool Append;
26  public string CustomLogFileName;
27  public string SourceBaseDirectory;
29  public string SlavePipe;
30 
31  public int ThreadCount = Environment.ProcessorCount;
32 
33  public string TestName;
34 
35  public BuilderOptions(Logger logger)
36  {
37  Logger = logger;
38  Plugins = new PluginResolver(logger);
39  BuilderMode = Builder.Mode.Build;
40  }
41 
42  /// <summary>
43  /// This function indicate if the current builder options mean to execute a master session
44  /// </summary>
45  /// <returns>true if the options mean to execute a master session</returns>
46  public bool IsValidForMaster()
47  {
48  return InputFiles.Count == 1;
49  }
50 
51  /// <summary>
52  /// This function indicate if the current builder options mean to execute a slave session
53  /// </summary>
54  /// <returns>true if the options mean to execute a slave session</returns>
55  public bool IsValidForSlave()
56  {
57  return !string.IsNullOrEmpty(SlavePipe) && !string.IsNullOrEmpty(BuildDirectory);
58  }
59 
60  /// <summary>
61  /// Ensure every parameter is correct for a master execution. Throw an OptionException if a parameter is wrong
62  /// </summary>
63  /// <exception cref="Mono.Options.OptionException">This tool requires one input file.;filename
64  /// or
65  /// The given working directory \ + workingDir + \ does not exist.;workingdir</exception>
67  {
68  if (InputFiles.Count != 1)
69  throw new OptionException("This tool requires one input file.", "filename");
70 
71  if (SourceBaseDirectory != null)
72  {
73  if (!Directory.Exists(SourceBaseDirectory))
74  throw new OptionException("The given working directory does not exist.", "workingdir");
75  }
76  }
77  }
78 }
A debug message (level 0).
A verbose message (level 1).
bool IsValidForSlave()
This function indicate if the current builder options mean to execute a slave session ...
Base implementation for ILogger.
Definition: Logger.cs:10
Mode
Indicate which mode to use with this builder
Definition: Builder.cs:69
void ValidateOptionsForMaster()
Ensure every parameter is correct for a master execution. Throw an OptionException if a parameter is ...
bool IsValidForMaster()
This function indicate if the current builder options mean to execute a master session ...