private string ProjectHeader( Assembly assembly, IEnumerable <ResponseFileData> responseFilesData, string[] roslynAnalyzerDllPaths ) { var toolsVersion = "4.0"; var productVersion = "10.0.20506"; const string baseDirectory = "."; var targetFrameworkVersion = "v4.7.1"; var targetLanguageVersion = "latest"; // danger: latest is not the same absolute value depending on the VS version. if (m_CurrentInstallation != null) { var vsLanguageSupport = m_CurrentInstallation.LatestLanguageVersionSupported; var unityLanguageSupport = UnityInstallation.LatestLanguageVersionSupported(assembly); // Use the minimal supported version between VS and Unity, so that compilation will work in both targetLanguageVersion = (vsLanguageSupport <= unityLanguageSupport ? vsLanguageSupport : unityLanguageSupport).ToString(2); // (major, minor) only } var projectType = ProjectTypeOf(assembly.name); var arguments = new object[] { toolsVersion, productVersion, ProjectGuid(assembly), XmlFilename(FileUtility.Normalize(InternalEditorUtility.GetEngineAssemblyPath())), XmlFilename(FileUtility.Normalize(InternalEditorUtility.GetEditorAssemblyPath())), string.Join(";", assembly.defines.Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, assembly.name, assembly.outputPath, GetRootNamespace(assembly), targetFrameworkVersion, targetLanguageVersion, baseDirectory, assembly.compilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe), // flavoring projectType + ":" + (int)projectType, EditorUserBuildSettings.activeBuildTarget + ":" + (int)EditorUserBuildSettings.activeBuildTarget, Application.unityVersion, VisualStudioIntegration.PackageVersion() }; try { #if UNITY_2020_2_OR_NEWER return(string.Format(GetProjectHeaderTemplate(roslynAnalyzerDllPaths, assembly.compilerOptions.RoslynAnalyzerRulesetPath), arguments)); #else return(string.Format(GetProjectHeaderTemplate(Array.Empty <string>(), null), arguments)); #endif } catch (Exception) { throw new NotSupportedException("Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
string ProjectHeader( Assembly island, IEnumerable <ResponseFileData> responseFilesData ) { var arguments = new object[] { k_ToolsVersion, k_ProductVersion, ProjectGuid(island.outputPath), InternalEditorUtility.GetEngineAssemblyPath(), InternalEditorUtility.GetEditorAssemblyPath(), string.Join(";", new[] { "DEBUG", "TRACE" }.Concat(EditorUserBuildSettings.activeScriptCompilationDefines).Concat(island.defines).Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, Utility.FileNameWithoutExtension(island.outputPath), EditorSettings.projectGenerationRootNamespace, k_TargetFrameworkVersion, k_TargetLanguageVersion, k_BaseDirectory, island.compilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe) }; try { return(string.Format(GetProjectHeaderTemplate(), arguments)); } catch (Exception) { throw new NotSupportedException("Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
private void OnGUI() { m_scrollPos = EditorGUILayout.BeginScrollView(m_scrollPos); EditorGUILayout.LabelField("Application", EditorStyles.boldLabel); var drawer = new Drawer(224); drawer.Draw("dataPath", Application.dataPath); drawer.Draw("consoleLogPath", Application.consoleLogPath); drawer.Draw("persistentDataPath", Application.persistentDataPath); drawer.Draw("streamingAssetsPath", Application.streamingAssetsPath); drawer.Draw("temporaryCachePath", Application.temporaryCachePath); EditorGUILayout.Space(); EditorGUILayout.LabelField("EditorApplication", EditorStyles.boldLabel); drawer.Draw("applicationContentsPath", EditorApplication.applicationContentsPath); drawer.Draw("applicationPath", EditorApplication.applicationPath); EditorGUILayout.Space(); EditorGUILayout.LabelField("InternalEditorUtility", EditorStyles.boldLabel); drawer.Draw("unityPreferencesFolder", InternalEditorUtility.unityPreferencesFolder); drawer.Draw("GetCrashReportFolder", InternalEditorUtility.GetCrashReportFolder()); drawer.Draw("GetEditorAssemblyPath", InternalEditorUtility.GetEditorAssemblyPath()); drawer.Draw("GetEngineAssemblyPath", InternalEditorUtility.GetEngineAssemblyPath()); drawer.Draw("GetEngineCoreModuleAssemblyPath", InternalEditorUtility.GetEngineCoreModuleAssemblyPath()); EditorGUILayout.EndScrollView(); }
public WeaverAssemblyResolver() { // Get the location of the core dll ([ProjectRoot]/Library/UnityAssemblies) string coreAssemblyPath = InternalEditorUtility.GetEngineAssemblyPath(); // Get the directory name _unityAssembliesDirectory = Path.GetDirectoryName(coreAssemblyPath); }
string ProjectHeader( Assembly assembly, IEnumerable <ResponseFileData> responseFilesData ) { var toolsVersion = "4.0"; var productVersion = "10.0.20506"; const string baseDirectory = "."; var targetFrameworkVersion = "v4.7.1"; var targetLanguageVersion = "latest"; // danger: latest is not the same absolute value depending on the VS version. if (m_CurrentInstallation != null && m_CurrentInstallation.SupportsCSharp8) { // Current VS installation is compatible with C# 8. #if !UNITY_2020_2_OR_NEWER // Unity 2020.2.0a12 added support for C# 8 // <=2020.1 has no support for C# 8 constructs, so tell the compiler to accept only C# 7.3 or lower. targetLanguageVersion = "7.3"; #endif } var projectType = ProjectTypeOf(assembly.name); var arguments = new object[] { toolsVersion, productVersion, ProjectGuid(assembly), XmlFilename(FileUtility.Normalize(InternalEditorUtility.GetEngineAssemblyPath())), XmlFilename(FileUtility.Normalize(InternalEditorUtility.GetEditorAssemblyPath())), string.Join(";", assembly.defines.Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, assembly.name, assembly.outputPath, GetRootNamespace(assembly), targetFrameworkVersion, targetLanguageVersion, baseDirectory, assembly.compilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe), // flavoring projectType + ":" + (int)projectType, EditorUserBuildSettings.activeBuildTarget + ":" + (int)EditorUserBuildSettings.activeBuildTarget, Application.unityVersion, VisualStudioIntegration.PackageVersion() }; try { return(string.Format(GetProjectHeaderTemplate(), arguments)); } catch (Exception) { throw new NotSupportedException("Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
private static JSONValue JsonForProject() { List <ProjectStateRestHandler.Island> list = (from i in EditorCompilationInterface.GetAllMonoIslands() select new ProjectStateRestHandler.Island { MonoIsland = i, Name = Path.GetFileNameWithoutExtension(i._output), References = i._references.ToList <string>() }).ToList <ProjectStateRestHandler.Island>(); foreach (ProjectStateRestHandler.Island current in list) { List <string> list2 = new List <string>(); List <string> list3 = new List <string>(); foreach (string current2 in current.References) { string refName = Path.GetFileNameWithoutExtension(current2); if (current2.StartsWith("Library/") && list.Any((ProjectStateRestHandler.Island i) => i.Name == refName)) { list2.Add(refName); list3.Add(current2); } if (current2.EndsWith("/UnityEditor.dll") || current2.EndsWith("/UnityEngine.dll") || current2.EndsWith("\\UnityEditor.dll") || current2.EndsWith("\\UnityEngine.dll")) { list3.Add(current2); } } current.References.Add(InternalEditorUtility.GetEditorAssemblyPath()); current.References.Add(InternalEditorUtility.GetEngineAssemblyPath()); foreach (string current3 in list2) { current.References.Add(current3); } foreach (string current4 in list3) { current.References.Remove(current4); } } string[] array = list.SelectMany((ProjectStateRestHandler.Island i) => i.MonoIsland._files).Concat(ProjectStateRestHandler.GetAllSupportedFiles()).Distinct <string>().ToArray <string>(); string[] strings = ProjectStateRestHandler.RelativeToProjectPath(ProjectStateRestHandler.FindEmptyDirectories(ProjectStateRestHandler.AssetsPath, array)); JSONValue result = default(JSONValue); result["islands"] = new JSONValue((from i in list select ProjectStateRestHandler.JsonForIsland(i) into i2 where !i2.IsNull() select i2).ToList <JSONValue>()); result["basedirectory"] = ProjectStateRestHandler.ProjectPath; JSONValue value = default(JSONValue); value["files"] = JSONHandler.ToJSON(array); value["emptydirectories"] = JSONHandler.ToJSON(strings); result["assetdatabase"] = value; return(result); }
private string ProjectHeader( ProjectPart assembly, List <ResponseFileData> responseFilesData, string[] roslynAnalyzerDllPaths ) { var otherResponseFilesData = GetOtherArgumentsFromResponseFilesData(responseFilesData); var arguments = new object[] { k_ToolsVersion, k_ProductVersion, ProjectGuid(assembly.Name, assembly.OutputPath), InternalEditorUtility.GetEngineAssemblyPath(), InternalEditorUtility.GetEditorAssemblyPath(), string.Join(";", assembly.Defines.Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, assembly.Name, assembly.OutputPath, assembly.RootNamespace, k_TargetFrameworkVersion, GenerateLangVersion(otherResponseFilesData["langversion"], assembly), k_BaseDirectory, assembly.CompilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe), GenerateNoWarn(otherResponseFilesData["nowarn"].Distinct().ToArray()), GenerateAnalyserItemGroup( otherResponseFilesData["analyzer"].Concat(otherResponseFilesData["a"]) .SelectMany(x => x.Split(';')) .Concat(roslynAnalyzerDllPaths) .Distinct() .ToArray()), GenerateAnalyserAdditionalFiles(otherResponseFilesData["additionalfile"].SelectMany(x => x.Split(';')).Distinct().ToArray()), #if UNITY_2020_2_OR_NEWER GenerateAnalyserRuleSet(otherResponseFilesData["ruleset"].Append(assembly.CompilerOptions.RoslynAnalyzerRulesetPath).Where(a => !string.IsNullOrEmpty(a)).Distinct().ToArray()), #else GenerateAnalyserRuleSet(otherResponseFilesData["ruleset"].Distinct().ToArray()), #endif GenerateWarningLevel(otherResponseFilesData["warn"].Concat(otherResponseFilesData["w"]).Distinct()), GenerateWarningAsError(otherResponseFilesData["warnaserror"]), GenerateDocumentationFile(otherResponseFilesData["doc"].ToArray()), GenerateNullable(otherResponseFilesData["nullable"]) }; try { return(string.Format(GetProjectHeaderTemplate(), arguments)); } catch (Exception) { throw new NotSupportedException( "Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
internal static IEnumerable <SearchAction> ActionHandlers() { return(new[] { new SearchAction(type, "locate", null, "locate") { handler = (item, context) => { var sCSCode = item.description; var c = new CSharpCodeProvider(); #pragma warning disable CS0618 var icc = c.CreateCompiler(); #pragma warning restore CS0618 var cp = new CompilerParameters(); cp.ReferencedAssemblies.Add("system.dll"); cp.ReferencedAssemblies.Add(InternalEditorUtility.GetEngineAssemblyPath()); cp.ReferencedAssemblies.Add(InternalEditorUtility.GetEngineCoreModuleAssemblyPath()); cp.ReferencedAssemblies.Add(InternalEditorUtility.GetEditorAssemblyPath()); cp.CompilerOptions = "/t:library"; cp.GenerateInMemory = true; CompilerResults cr; if (!CompileSource(sCSCode, icc, cp, out cr, true)) { if (!CompileSource(sCSCode, icc, cp, out cr, false)) { return; } } var a = cr.CompiledAssembly; var o = a.CreateInstance("CSCodeEvaler.CSCodeEvaler"); var t = o.GetType(); var mi = t.GetMethod("EvalCode"); var s = mi.Invoke(o, null); if (s != null && s.GetType() != typeof(void)) { UnityEngine.Debug.Log(s); } } } }); }
private string ProjectHeader( ProjectPart assembly, List <ResponseFileData> responseFilesData ) { var otherResponseFilesData = GetOtherArgumentsFromResponseFilesData(responseFilesData); var arguments = new object[] { k_ToolsVersion, k_ProductVersion, ProjectGuid(m_AssemblyNameProvider.GetProjectName(assembly.Name, assembly.Defines)), InternalEditorUtility.GetEngineAssemblyPath(), InternalEditorUtility.GetEditorAssemblyPath(), string.Join(";", assembly.Defines.Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, assembly.Name, assembly.OutputPath, assembly.RootNamespace, assembly.CompilerOptions.ApiCompatibilityLevel, GenerateLangVersion(otherResponseFilesData["langversion"], assembly), k_BaseDirectory, assembly.CompilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe), GenerateNoWarn(otherResponseFilesData["nowarn"].Distinct().ToList()), GenerateAnalyserItemGroup(RetrieveRoslynAnalyzers(assembly, otherResponseFilesData)), GenerateAnalyserAdditionalFiles(otherResponseFilesData["additionalfile"].SelectMany(x => x.Split(';')).Distinct().ToArray()), GenerateRoslynAnalyzerRulesetPath(assembly, otherResponseFilesData), GenerateWarningLevel(otherResponseFilesData["warn"].Concat(otherResponseFilesData["w"]).Distinct()), GenerateWarningAsError(otherResponseFilesData["warnaserror"], otherResponseFilesData["warnaserror-"], otherResponseFilesData["warnaserror+"]), GenerateDocumentationFile(otherResponseFilesData["doc"].ToArray()), GenerateNullable(otherResponseFilesData["nullable"]) }; try { return(string.Format(GetProjectHeaderTemplate(), arguments)); } catch (Exception) { throw new NotSupportedException( "Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
string ProjectHeader( Assembly assembly, List <ResponseFileData> responseFilesData ) { var otherResponseFilesData = GetOtherArgumentsFromResponseFilesData(responseFilesData); var arguments = new object[] { k_ToolsVersion, k_ProductVersion, m_GUIDGenerator.ProjectGuid(m_ProjectName, assembly.name), InternalEditorUtility.GetEngineAssemblyPath(), InternalEditorUtility.GetEditorAssemblyPath(), string.Join(";", new[] { "DEBUG", "TRACE" }.Concat(EditorUserBuildSettings.activeScriptCompilationDefines).Concat(assembly.defines) .Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, assembly.name, m_AssemblyNameProvider.ProjectGenerationRootNamespace, k_TargetFrameworkVersion, GenerateLangVersion(otherResponseFilesData["langversion"]), k_BaseDirectory, assembly.compilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe), GenerateNoWarn(otherResponseFilesData["nowarn"].Distinct().ToArray()), GenerateAnalyserItemGroup(otherResponseFilesData["analyzer"].Concat(otherResponseFilesData["a"]).SelectMany(x => x.Split(';')).Distinct().ToArray()), GenerateAnalyserAdditionalFiles(otherResponseFilesData["additionalfile"].SelectMany(x => x.Split(';')).Distinct().ToArray()), GenerateAnalyserRuleSet(otherResponseFilesData["ruleset"].Distinct().ToArray()), GenerateWarningLevel(otherResponseFilesData["warn"].Concat(otherResponseFilesData["w"]).Distinct()), GenerateWarningAsError(otherResponseFilesData["warnaserror"]), GenerateDocumentationFile(otherResponseFilesData["doc"]) }; try { return(string.Format(GetProjectHeaderTemplate(), arguments)); } catch (Exception) { throw new NotSupportedException( "Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
string ProjectHeader( Assembly island, IEnumerable <ResponseFileData> responseFilesData ) { var toolsVersion = "4.0"; var productVersion = "10.0.20506"; const string baseDirectory = "."; var targetFrameworkVersion = "v4.7.1"; var targetLanguageVersion = "latest"; var projectType = ProjectTypeOf(island.outputPath); var arguments = new object[] { toolsVersion, productVersion, ProjectGuid(island.outputPath), XmlFilename(FileUtility.Normalize(InternalEditorUtility.GetEngineAssemblyPath())), XmlFilename(FileUtility.Normalize(InternalEditorUtility.GetEditorAssemblyPath())), string.Join(";", new[] { "DEBUG", "TRACE" }.Concat(EditorUserBuildSettings.activeScriptCompilationDefines).Concat(island.defines).Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, FileUtility.FileNameWithoutExtension(island.outputPath), EditorSettings.projectGenerationRootNamespace, targetFrameworkVersion, targetLanguageVersion, baseDirectory, island.compilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe), // flavoring projectType + ":" + (int)projectType, EditorUserBuildSettings.activeBuildTarget + ":" + (int)EditorUserBuildSettings.activeBuildTarget, Application.unityVersion, }; try { return(string.Format(GetProjectHeaderTemplate(), arguments)); } catch (Exception) { throw new NotSupportedException("Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
private string ProjectHeader(Assembly island) { string targetframeworkversion = "v3.5"; string targetLanguageVersion = "4"; string toolsversion = "4.0"; string productversion = "10.0.20506"; #if ENABLE_PACKMAN string baseDirectory = "."; #else string baseDirectory = "Assets"; #endif ScriptingLanguage language = ScriptingLanguageFor(GetExtensionOfSourceFiles(island.sourceFiles)); targetframeworkversion = "v4.7.1"; targetLanguageVersion = "6"; var arguments = new object[] { toolsversion, productversion, ProjectGuid(island.outputPath), InternalEditorUtility.GetEngineAssemblyPath(), InternalEditorUtility.GetEditorAssemblyPath(), string.Join(";", new[] { "DEBUG", "TRACE" }.Concat(island.defines).Distinct().ToArray()), MSBuildNamespaceUri, Path.GetFileNameWithoutExtension(island.outputPath), EditorSettings.projectGenerationRootNamespace, targetframeworkversion, targetLanguageVersion, baseDirectory, island.compilerOptions.AllowUnsafeCode // | responseFileData.Unsafe }; try { return(string.Format(GetProjectHeaderTemplate(), arguments)); } catch (Exception) { throw new System.NotSupportedException("Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
string ProjectHeader( Assembly island, List <ResponseFileData> responseFilesData ) { var arguments = new object[] { k_ToolsVersion, k_ProductVersion, ProjectGuid(island.outputPath), InternalEditorUtility.GetEngineAssemblyPath(), InternalEditorUtility.GetEditorAssemblyPath(), string.Join(";", new[] { "DEBUG", "TRACE" }.Concat(EditorUserBuildSettings.activeScriptCompilationDefines).Concat(island.defines) .Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, FileSystemUtil.FileNameWithoutExtension(island.outputPath), EditorSettings.projectGenerationRootNamespace, k_TargetFrameworkVersion, PluginSettings.OverrideLangVersion?PluginSettings.LangVersion:k_TargetLanguageVersion, k_BaseDirectory, island.compilerOptions.AllowUnsafeCode | responseFilesData.Any(x => x.Unsafe), responseFilesData.Select(x => { const string start = "/nowarn:"; var codes = x.OtherArguments.FirstOrDefault(a => a.StartsWith(start))?.Substring(start.Length); return(codes != null ? "," + codes: string.Empty); }).FirstOrDefault() }; try { return(string.Format(GetProjectHeaderTemplate(), arguments)); } catch (Exception) { throw new NotSupportedException( "Failed creating c# project because the c# project header did not have the correct amount of arguments, which is " + arguments.Length); } }
private static JSONValue JsonForProject() { var islands = EditorCompilationInterface.GetAllMonoIslands().Select(i => new Island { MonoIsland = i, Name = Path.GetFileNameWithoutExtension(i._output), References = i._references.ToList() }).ToList(); // Mono islands have references to each others output location. For MD we want to have the reference // be to the actual project, so we are going to update the references here foreach (Island island in islands) { var toAdd = new List <string>(); var toRemove = new List <string>(); foreach (var reference in island.References) { var refName = Path.GetFileNameWithoutExtension(reference); if (reference.StartsWith("Library/") && islands.Any(i => i.Name == refName)) { toAdd.Add(refName); toRemove.Add(reference); } if (reference.EndsWith("/UnityEditor.dll") || reference.EndsWith("/UnityEngine.dll") || reference.EndsWith("\\UnityEditor.dll") || reference.EndsWith("\\UnityEngine.dll")) { toRemove.Add(reference); } } island.References.Add(InternalEditorUtility.GetEditorAssemblyPath()); island.References.Add(InternalEditorUtility.GetEngineAssemblyPath()); foreach (var a in toAdd) { island.References.Add(a); } foreach (var r in toRemove) { island.References.Remove(r); } } var files = islands.SelectMany(i => i.MonoIsland._files).Concat(GetAllSupportedFiles()).Distinct().ToArray(); var emptyDirectories = RelativeToProjectPath(FindEmptyDirectories(AssetsPath, files)); var result = new JSONValue(); result["islands"] = new JSONValue(islands.Select(i => JsonForIsland(i)).Where(i2 => !i2.IsNull()).ToList()); result["basedirectory"] = ProjectPath; var assetDatabase = new JSONValue(); assetDatabase["files"] = ToJSON(files); assetDatabase["emptydirectories"] = ToJSON(emptyDirectories); result["assetdatabase"] = assetDatabase; return(result); }
/// <summary> /// engine assembly path /// </summary> public static string GetEngineAssemblyPath() { return(InternalEditorUtility.GetEngineAssemblyPath()); }
private static JSONValue JsonForProject() { List <ProjectStateRestHandler.Island> list = ((IEnumerable <MonoIsland>)InternalEditorUtility.GetMonoIslands()).Select <MonoIsland, ProjectStateRestHandler.Island>((Func <MonoIsland, ProjectStateRestHandler.Island>)(i => new ProjectStateRestHandler.Island() { MonoIsland = i, Name = Path.GetFileNameWithoutExtension(i._output), References = ((IEnumerable <string>)i._references).ToList <string>() })).ToList <ProjectStateRestHandler.Island>(); using (List <ProjectStateRestHandler.Island> .Enumerator enumerator1 = list.GetEnumerator()) { while (enumerator1.MoveNext()) { ProjectStateRestHandler.Island current1 = enumerator1.Current; List <string> stringList1 = new List <string>(); List <string> stringList2 = new List <string>(); using (List <string> .Enumerator enumerator2 = current1.References.GetEnumerator()) { while (enumerator2.MoveNext()) { string current2 = enumerator2.Current; // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type ProjectStateRestHandler.\u003CJsonForProject\u003Ec__AnonStorey25 projectCAnonStorey25 = new ProjectStateRestHandler.\u003CJsonForProject\u003Ec__AnonStorey25(); // ISSUE: reference to a compiler-generated field projectCAnonStorey25.refName = Path.GetFileNameWithoutExtension(current2); // ISSUE: reference to a compiler-generated method if (current2.StartsWith("Library/") && list.Any <ProjectStateRestHandler.Island>(new Func <ProjectStateRestHandler.Island, bool>(projectCAnonStorey25.\u003C\u003Em__31))) { // ISSUE: reference to a compiler-generated field stringList1.Add(projectCAnonStorey25.refName); stringList2.Add(current2); } if (current2.EndsWith("/UnityEditor.dll") || current2.EndsWith("/UnityEngine.dll") || (current2.EndsWith("\\UnityEditor.dll") || current2.EndsWith("\\UnityEngine.dll"))) { stringList2.Add(current2); } } } current1.References.Add(InternalEditorUtility.GetEditorAssemblyPath()); current1.References.Add(InternalEditorUtility.GetEngineAssemblyPath()); using (List <string> .Enumerator enumerator2 = stringList1.GetEnumerator()) { while (enumerator2.MoveNext()) { string current2 = enumerator2.Current; current1.References.Add(current2); } } using (List <string> .Enumerator enumerator2 = stringList2.GetEnumerator()) { while (enumerator2.MoveNext()) { string current2 = enumerator2.Current; current1.References.Remove(current2); } } } } string[] array = list.SelectMany <ProjectStateRestHandler.Island, string>((Func <ProjectStateRestHandler.Island, IEnumerable <string> >)(i => (IEnumerable <string>)i.MonoIsland._files)).Concat <string>(ProjectStateRestHandler.GetAllSupportedFiles()).Distinct <string>().ToArray <string>(); string[] projectPath = ProjectStateRestHandler.RelativeToProjectPath(ProjectStateRestHandler.FindEmptyDirectories(ProjectStateRestHandler.AssetsPath, array)); JSONValue jsonValue1 = new JSONValue(); jsonValue1["islands"] = new JSONValue((object)list.Select <ProjectStateRestHandler.Island, JSONValue>((Func <ProjectStateRestHandler.Island, JSONValue>)(i => ProjectStateRestHandler.JsonForIsland(i))).Where <JSONValue>((Func <JSONValue, bool>)(i2 => !i2.IsNull())).ToList <JSONValue>()); jsonValue1["basedirectory"] = (JSONValue)ProjectStateRestHandler.ProjectPath; JSONValue jsonValue2 = new JSONValue(); jsonValue2["files"] = Handler.ToJSON((IEnumerable <string>)array); jsonValue2["emptydirectories"] = Handler.ToJSON((IEnumerable <string>)projectPath); jsonValue1["assetdatabase"] = jsonValue2; return(jsonValue1); }
internal bool CompileScripts(ScriptAssemblySettings scriptAssemblySettings, string tempBuildDirectory, BuildFlags buildflags, ref EditorBuildRules.TargetAssembly[] notCompiledTargetAssemblies) { this.DeleteUnusedAssemblies(); this.allScripts.RemoveWhere((string path) => !File.Exists(Path.Combine(this.projectDirectory, path))); this.StopAllCompilation(); if (!Directory.Exists(scriptAssemblySettings.OutputDirectory)) { Directory.CreateDirectory(scriptAssemblySettings.OutputDirectory); } if (!Directory.Exists(tempBuildDirectory)) { Directory.CreateDirectory(tempBuildDirectory); } IEnumerable <string> enumerable = (!this.areAllScriptsDirty) ? this.dirtyScripts.ToArray <string>() : this.allScripts.ToArray <string>(); this.areAllScriptsDirty = false; this.dirtyScripts.Clear(); bool result; if (!enumerable.Any <string>() && this.runScriptUpdaterAssemblies.Count == 0) { result = false; } else { EditorBuildRules.CompilationAssemblies assemblies = new EditorBuildRules.CompilationAssemblies { UnityAssemblies = this.unityAssemblies, PrecompiledAssemblies = this.precompiledAssemblies, CustomTargetAssemblies = this.customTargetAssemblies, EditorAssemblyReferences = ModuleUtils.GetAdditionalReferencesForUserScripts() }; EditorBuildRules.GenerateChangedScriptAssembliesArgs generateChangedScriptAssembliesArgs = new EditorBuildRules.GenerateChangedScriptAssembliesArgs { AllSourceFiles = this.allScripts, DirtySourceFiles = enumerable, ProjectDirectory = this.projectDirectory, BuildFlags = buildflags, Settings = scriptAssemblySettings, Assemblies = assemblies, RunUpdaterAssemblies = this.runScriptUpdaterAssemblies }; ScriptAssembly[] array = EditorBuildRules.GenerateChangedScriptAssemblies(generateChangedScriptAssembliesArgs); notCompiledTargetAssemblies = generateChangedScriptAssembliesArgs.NotCompiledTargetAssemblies.ToArray <EditorBuildRules.TargetAssembly>(); if (!array.Any <ScriptAssembly>()) { result = false; } else { this.compilationTask = new CompilationTask(array, tempBuildDirectory, buildflags, SystemInfo.processorCount); this.compilationTask.OnCompilationStarted += delegate(ScriptAssembly assembly, int phase) { Console.WriteLine("- Starting compile {0}", Path.Combine(scriptAssemblySettings.OutputDirectory, assembly.Filename)); }; IEnumerable <MonoIsland> compilingMonoIslands = from i in this.GetAllMonoIslands() where 0 < i._files.Length select i; this.compilationTask.OnCompilationFinished += delegate(ScriptAssembly assembly, List <CompilerMessage> messages) { Console.WriteLine("- Finished compile {0}", Path.Combine(scriptAssemblySettings.OutputDirectory, assembly.Filename)); if (this.runScriptUpdaterAssemblies.Contains(assembly.Filename)) { this.runScriptUpdaterAssemblies.Remove(assembly.Filename); } if (!messages.Any((CompilerMessage m) => m.type == CompilerMessageType.Error)) { string engineAssemblyPath = InternalEditorUtility.GetEngineAssemblyPath(); string unityUNet = EditorApplication.applicationContentsPath + "/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll"; if (!Weaver.WeaveUnetFromEditor(compilingMonoIslands, Path.Combine(tempBuildDirectory, assembly.Filename), Path.Combine(EditorCompilation.EditorTempPath, assembly.Filename), engineAssemblyPath, unityUNet, (buildflags & BuildFlags.BuildingForEditor) != BuildFlags.None)) { messages.Add(new CompilerMessage { message = "UNet Weaver failed", type = CompilerMessageType.Error, file = assembly.FullPath, line = -1, column = -1 }); this.StopAllCompilation(); } else { EditorCompilation.CopyAssembly(Path.Combine(tempBuildDirectory, assembly.Filename), assembly.FullPath); } } }; this.compilationTask.Poll(); result = true; } } return(result); }
private static void OpenEngineAssemblyPath() { RevealInFinder(new FileInfo(InternalEditorUtility.GetEngineAssemblyPath()).Directory.FullName); }
internal static string[] GetUnityEngineAssemblysNames() { return(GetAssemblysNames(InternalEditorUtility.GetEngineAssemblyPath())); }