private static Compiler FindSuitableCompiler(Logger logger, Platform platform, string monoProfile, string projectDir, string[] compilationOptions, string unityEditorDataDir) { Compiler compiler = null; // Looking for Incremental C# 6.0 compiler var icscDirectory = Path.Combine(projectDir, LANGUAGE_SUPPORT_DIR); if (Incremental60Compiler.IsAvailable(icscDirectory)) { compiler = new Incremental60Compiler(logger, icscDirectory); } // Looking for Roslyn C# 6.0 compiler var roslynDirectory = Path.Combine(Path.Combine(projectDir, LANGUAGE_SUPPORT_DIR), "Roslyn"); if (compiler == null && Microsoft60Compiler.IsAvailable(roslynDirectory)) { compiler = new Microsoft60Compiler(logger, roslynDirectory); if (platform != Platform.Windows) { compiler = null; logger?.Append("Microsoft C# 6.0 compiler found, but it is not supported on the current platform. Looking for another compiler..."); } } if (compiler == null) { // Looking for Mono C# 6.0 compiler var mcsDirectory = Path.Combine(projectDir, LANGUAGE_SUPPORT_DIR); if (Mono60Compiler.IsAvailable(mcsDirectory)) { compiler = new Mono60Compiler(logger, mcsDirectory); } } if (compiler == null && compilationOptions.Any(line => line.Contains("AsyncBridge.Net35.dll"))) { // Using Mono C# 5.0 compiler var bleedingEdgeCompilerPath = Path.Combine(unityEditorDataDir, @"MonoBleedingEdge/lib/mono/4.5/mcs.exe"); compiler = new Mono50Compiler(logger, bleedingEdgeCompilerPath); } if (compiler == null) { // Using stock Mono C# 3.0 compiler var stockCompilerPath = monoProfile == "2.0" ? Path.Combine(unityEditorDataDir, @"Mono/lib/mono/2.0/gmcs.exe") : Path.Combine(unityEditorDataDir, @"Mono/lib/mono/" + monoProfile + "/smcs.exe"); compiler = new Mono30Compiler(logger, stockCompilerPath); } return(compiler); }
private static Compiler FindSuitableCompiler(Logger logger, Platform platform, string projectDir, string[] compilationOptions, string unityEditorDataDir) { Compiler compiler = null; // Looking for Roslyn C# 6.0 compiler var roslynDirectory = Path.Combine(Path.Combine(projectDir, LANGUAGE_SUPPORT_DIR), "Roslyn"); if (Microsoft60Compiler.IsAvailable(roslynDirectory)) { compiler = new Microsoft60Compiler(logger, roslynDirectory); } if (compiler != null && platform != Platform.Windows) { compiler = null; logger?.Append("Microsoft C# 6.0 compiler found, but it is not supported on the current platform. Looking for another compiler..."); } if (compiler == null) { // Looking for Mono C# 6.0 compiler var mcsDirectory = Path.Combine(projectDir, LANGUAGE_SUPPORT_DIR); if (Mono60Compiler.IsAvailable(mcsDirectory)) { compiler = new Mono60Compiler(logger, mcsDirectory); } } if (compiler == null) { // Using stock Mono C# 3.0 compiler var stockCompilerPath = Path.Combine(unityEditorDataDir, @"Mono/lib/mono/2.0/gmcs.exe"); compiler = new Mono30Compiler(logger, stockCompilerPath); } return(compiler); }
private static Compiler FindSuitableCompiler(Logger logger, Platform platform, string monoProfile, string projectDir, string[] compilationOptions, string unityEditorDataDir) { Compiler compiler = null; // Looking for Incremental C# 6.0 compiler var icscDirectory = Path.Combine(projectDir, LANGUAGE_SUPPORT_DIR); if (Incremental60Compiler.IsAvailable(icscDirectory)) { compiler = new Incremental60Compiler(logger, icscDirectory); } // Looking for Roslyn C# 6.0 compiler var roslynDirectory = Path.Combine(Path.Combine(projectDir, LANGUAGE_SUPPORT_DIR), "Roslyn"); if (compiler == null && Microsoft60Compiler.IsAvailable(roslynDirectory)) { compiler = new Microsoft60Compiler(logger, roslynDirectory); if (platform != Platform.Windows) { compiler = null; logger?.Append("Microsoft C# 6.0 compiler found, but it is not supported on the current platform. Looking for another compiler..."); } } if (compiler == null) { // Looking for Mono C# 6.0 compiler var mcsDirectory = Path.Combine(projectDir, LANGUAGE_SUPPORT_DIR); if (Mono60Compiler.IsAvailable(mcsDirectory)) { compiler = new Mono60Compiler(logger, mcsDirectory); } } if (compiler == null && compilationOptions.Any(line => line.Contains("AsyncBridge.Net35.dll"))) { // Using Mono C# 5.0 compiler var bleedingEdgeCompilerPath = Path.Combine(unityEditorDataDir, @"MonoBleedingEdge/lib/mono/4.5/mcs.exe"); compiler = new Mono50Compiler(logger, bleedingEdgeCompilerPath); } if (compiler == null) { // Using stock Mono C# 3.0 compiler var stockCompilerPath = monoProfile == "2.0" ? Path.Combine(unityEditorDataDir, @"Mono/lib/mono/2.0/gmcs.exe") : Path.Combine(unityEditorDataDir, @"Mono/lib/mono/" + monoProfile + "/smcs.exe"); compiler = new Mono30Compiler(logger, stockCompilerPath); } return compiler; }