MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Main

Method Main

Source/Tools/Flax.Build/Program.cs:16–200  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 class Program
15 {
16 static int Main()
17 {
18 // Setup
19 ServicePointManager.Expect100Continue = true;
20 ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
21 var culture = CultureInfo.InvariantCulture;
22 CultureInfo.DefaultThreadCurrentCulture = culture;
23 CultureInfo.DefaultThreadCurrentUICulture = culture;
24 Thread.CurrentThread.CurrentCulture = culture;
25
26 // Show help option
27 if (CommandLine.HasOption("help"))
28 {
29 Console.WriteLine(CommandLine.GetHelp(typeof(Configuration)));
30 return 0;
31 }
32
33 Mutex singleInstanceMutex = null;
34 Stopwatch stopwatch = Stopwatch.StartNew();
35 bool failed = false;
36
37 try
38 {
39 // Setup
40 CommandLine.Configure(typeof(Configuration));
41 foreach (var option in CommandLine.GetOptions())
42 {
43 if (option.Name.Length > 1 && option.Name[0] == 'D')
44 {
45 var define = option.Name.Substring(1);
46 if (!string.IsNullOrEmpty(option.Value))
47 define += "=" + option.Value;
48 Configuration.CustomDefines.Add(define);
49 }
50 }
51 if (Configuration.CurrentDirectory != null)
52 Environment.CurrentDirectory = Configuration.CurrentDirectory;
53 Globals.Root = Directory.GetCurrentDirectory();
54 var executingAssembly = System.Reflection.Assembly.GetExecutingAssembly();
55 Globals.EngineRoot = Utilities.RemovePathRelativeParts(Path.Combine(Path.GetDirectoryName(executingAssembly.Location), "..", ".."));
56 Log.Init();
57
58 // Log basic info
59 Version version = executingAssembly.GetName().Version;
60 string versionString = string.Join(".", version.Major, version.Minor, version.Build);
61 Log.Info(string.Format("Flax.Build {0}", versionString));
62 using (new LogIndentScope())
63 {
64 Log.Verbose("Arguments: " + CommandLine.Get());
65 Log.Verbose("Workspace: " + Globals.Root);
66 Log.Verbose("Engine: " + Globals.EngineRoot);
67 Log.Verbose(System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
68 }
69
70 // Load project
71 {
72 var projectFiles = Directory.GetFiles(Globals.Root, "*.flaxproj", SearchOption.TopDirectoryOnly);
73 if (projectFiles.Length == 1)

Callers

nothing calls this directly

Calls 15

HasOptionMethod · 0.80
WriteLineMethod · 0.80
GetHelpMethod · 0.80
StartNewMethod · 0.80
ConfigureMethod · 0.80
SubstringMethod · 0.80
GetDirectoryNameMethod · 0.80
FormatMethod · 0.80
VerboseMethod · 0.80
ConfigureChildMethod · 0.80
GenerateRulesAssemblyMethod · 0.80
CleanMethod · 0.80

Tested by

no test coverage detected