IEnumerable <ScriptCompilerBase.ResponseFileData> ParseResponseFileData(MonoIsland island) { var systemReferenceDirectories = CSharpLanguage.GetCSharpCompiler(island._target, true, "Assembly-CSharp") == CSharpCompiler.Microsoft && PlayerSettings.GetScriptingBackend(BuildPipeline.GetBuildTargetGroup(island._target)) == ScriptingImplementation.WinRTDotNET && !island._editor ? MicrosoftCSharpCompiler.GetClassLibraries(island._target, island._editor) : MonoLibraryHelpers.GetSystemReferenceDirectories(island._api_compatibility_level); Dictionary <string, ScriptCompilerBase.ResponseFileData> responseFilesData = island._responseFiles.ToDictionary(x => x, x => ScriptCompilerBase.ParseResponseFileFromFile( Path.Combine(_projectDirectory, x), _projectDirectory, systemReferenceDirectories )); Dictionary <string, ScriptCompilerBase.ResponseFileData> responseFilesWithErrors = responseFilesData.Where(x => x.Value.Errors.Any()) .ToDictionary(x => x.Key, x => x.Value); if (responseFilesWithErrors.Any()) { foreach (var error in responseFilesWithErrors) { foreach (var valueError in error.Value.Errors) { UnityEngine.Debug.LogErrorFormat("{0} Parse Error : {1}", error.Key, valueError); } } } return(responseFilesData.Select(x => x.Value)); }
public ScriptCompilerBase Create(ScriptAssembly scriptAssembly, string tempOutputDirectory) { if (scriptAssembly.Files.Length == 0) { throw new ArgumentException($"Cannot compile ScriptAssembly {scriptAssembly.Filename} with no files"); } ScriptCompilerBase scriptCompilerBase; if (m_FactoryHelper.HasExternalCompiler()) { scriptCompilerBase = new ExternalCSharpCompiler(scriptAssembly, tempOutputDirectory); } else { scriptCompilerBase = new MicrosoftCSharpCompiler(scriptAssembly, tempOutputDirectory); } if (CompilerChanged()) { UpdateCompilerUsed(); } return(scriptCompilerBase); }
public static AssemblyTypeInfoGenerator.ClassInfo[] ExtractAssemblyTypeInfo(BuildTarget targetPlatform, bool isEditor, string assemblyPathName, string[] searchDirs) { if (CSharpLanguage.GetUseMicrosoftCSharpCompiler(targetPlatform, isEditor, assemblyPathName)) { WSASDK wSASDK = EditorUserBuildSettings.wsaSDK; if (wSASDK == WSASDK.UniversalSDK81) { wSASDK = WSASDK.SDK81; } string nETCoreFrameworkReferencesDirectory = MicrosoftCSharpCompiler.GetNETCoreFrameworkReferencesDirectory(wSASDK); searchDirs = new List <string>(searchDirs) { nETCoreFrameworkReferencesDirectory }.ToArray(); } AssemblyTypeInfoGenerator.ClassInfo[] result; try { AssemblyTypeInfoGenerator assemblyTypeInfoGenerator = new AssemblyTypeInfoGenerator(assemblyPathName, searchDirs); result = assemblyTypeInfoGenerator.GatherClassInfo(); } catch (Exception ex) { throw new Exception(string.Concat(new object[] { "ExtractAssemblyTypeInfo: Failed to process ", assemblyPathName, ", ", ex })); } return(result); }
ScriptCompilerBase.ResponseFileData parseResponseFileData(MonoIsland island, string responseFilePath) { var systemReferenceDirectories = CSharpLanguage.GetCSharpCompiler(island._target, true, "Assembly-CSharp") == CSharpCompiler.Microsoft && PlayerSettings.GetScriptingBackend(BuildPipeline.GetBuildTargetGroup(island._target)) == ScriptingImplementation.WinRTDotNET ? MicrosoftCSharpCompiler.GetClassLibraries(island._target) : MonoLibraryHelpers.GetSystemReferenceDirectories(island._api_compatibility_level); ScriptCompilerBase.ResponseFileData responseFileData = ScriptCompilerBase.ParseResponseFileFromFile( Path.Combine(_projectDirectory, responseFilePath), _projectDirectory, systemReferenceDirectories); if (responseFileData.Errors.Length > 0) { foreach (var error in responseFileData.Errors) { UnityEngine.Debug.LogErrorFormat("{0} Parse Error : {1}", responseFilePath, error); } } return(responseFileData); }
protected override string GetResourceCompilerPath() => Path.Combine(MicrosoftCSharpCompiler.GetWindowsKitDirectory(WSASDK.SDK81), @"bin\x86\rc.exe");
protected static string GetReferenceAssembliesDirectory(WSASDK sdk) => PostProcessWinRT.GetReferenceAssembliesDirectory(MicrosoftCSharpCompiler.GetNETCoreFrameworkReferencesDirectory(sdk));
protected override string GetPlatformAssemblyPath() => MicrosoftCSharpCompiler.GetPlatformAssemblyPath(base._sdk);