public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater) { if (CSharpLanguage.GetUseMicrosoftCSharpCompiler(targetPlatform, buildingForEditor, island._output)) { return new MicrosoftCSharpCompiler(island, runUpdater); } return new MonoCSharpCompiler(island, runUpdater); }
public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater) { switch (CSharpLanguage.GetCSharpCompiler(targetPlatform, buildingForEditor, island._output)) { case CSharpCompiler.Microsoft: return (ScriptCompilerBase) new MicrosoftCSharpCompiler(island, runUpdater); default: return (ScriptCompilerBase) new MonoCSharpCompiler(island, runUpdater); } }
public static string[] Compile(string[] sources, string[] references, string[] defines, string outputFile) { MonoIsland island = new MonoIsland(BuildTarget.StandaloneWindows, "unity", sources, references, defines, outputFile); string[] result; using (MonoCSharpCompiler monoCSharpCompiler = new MonoCSharpCompiler(island, false)) { monoCSharpCompiler.BeginCompiling(); while (!monoCSharpCompiler.Poll()) { Thread.Sleep(50); } result = ( from cm in monoCSharpCompiler.GetCompilerMessages() select cm.message).ToArray<string>(); } return result; }
public UnityScriptCompiler(MonoIsland island, bool runUpdater) : base(island, runUpdater) { }
protected MonoScriptCompilerBase(MonoIsland island, bool runUpdater) : base(island) { this.runUpdater = runUpdater; }
private void SyncProject(MonoIsland island, Dictionary <string, string> allAssetsProjectParts, string[] additionalDefines, List <MonoIsland> allProjectIslands) { SolutionSynchronizer.SyncFileIfNotChanged(this.ProjectFile(island), this.ProjectText(island, SolutionSynchronizer.ModeForCurrentExternalEditor(), allAssetsProjectParts, additionalDefines, allProjectIslands)); }
public string ProjectFile(MonoIsland island) { ScriptingLanguage key = SolutionSynchronizer.ScriptingLanguageFor(island); return(Path.Combine(this._projectDirectory, string.Format("{0}{1}", Path.GetFileNameWithoutExtension(island._output), SolutionSynchronizer.ProjectExtensions[key]))); }
public MonoCSharpCompiler(MonoIsland island, bool runUpdater) : base(island, runUpdater) { }
private static ScriptingLanguage ScriptingLanguageFor(MonoIsland island) { return(SolutionSynchronizer.ScriptingLanguageFor(island.GetExtensionOfSourceFiles())); }
public MicrosoftCSharpCompiler(MonoIsland island, bool runUpdater) : base(island) { }
public static string[] GetReferences(MonoIsland island, string projectDirectory) { List<string> stringList = new List<string>(); foreach (string str in new List<string>().Union<string>((IEnumerable<string>) island._references)) { string fileName = Path.GetFileName(str); if (string.IsNullOrEmpty(fileName) || !fileName.Contains("UnityEditor.dll") && !fileName.Contains("UnityEngine.dll")) { string file = !Path.IsPathRooted(str) ? Path.Combine(projectDirectory, str) : str; if (AssemblyHelper.IsManagedAssembly(file) && !AssemblyHelper.IsInternalAssembly(file)) stringList.Add(file); } } return stringList.ToArray(); }
private string ProjectText(MonoIsland island, SolutionSynchronizer.Mode mode, string allAssetsProject) { StringBuilder stringBuilder = new StringBuilder(this.ProjectHeader(island)); List <string> list = new List <string>(); List <Match> list2 = new List <Match>(); bool isBuildingEditorProject = island._output.EndsWith("-Editor.dll"); string[] files = island._files; for (int i = 0; i < files.Length; i++) { string text = files[i]; string b = Path.GetExtension(text).ToLower(); string text2 = (!Path.IsPathRooted(text)) ? Path.Combine(this._projectDirectory, text) : text; if (".dll" != b) { string arg = "Compile"; stringBuilder.AppendFormat(" <{0} Include=\"{1}\" />{2}", arg, this.EscapedRelativePathFor(text2), SolutionSynchronizer.WindowsNewline); } else { list.Add(text2); } } stringBuilder.Append(allAssetsProject); List <string> list3 = new List <string>(); foreach (string current in list.Union(island._references)) { if (!current.EndsWith("/UnityEditor.dll") && !current.EndsWith("/UnityEngine.dll") && !current.EndsWith("\\UnityEditor.dll") && !current.EndsWith("\\UnityEngine.dll")) { Match match = SolutionSynchronizer.scriptReferenceExpression.Match(current); if (match.Success) { if (mode == SolutionSynchronizer.Mode.UnityScriptAsUnityProj || (ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), match.Groups["language"].Value, true) == ScriptingLanguage.CSharp) { list2.Add(match); continue; } } string text3 = (!Path.IsPathRooted(current)) ? Path.Combine(this._projectDirectory, current) : current; if (AssemblyHelper.IsManagedAssembly(text3)) { if (AssemblyHelper.IsInternalAssembly(text3)) { if (!SolutionSynchronizer.IsAdditionalInternalAssemblyReference(isBuildingEditorProject, text3)) { continue; } string fileName = Path.GetFileName(text3); if (list3.Contains(fileName)) { continue; } list3.Add(fileName); } text3 = text3.Replace("\\", "/"); text3 = text3.Replace("\\\\", "/"); stringBuilder.AppendFormat(" <Reference Include=\"{0}\">{1}", Path.GetFileNameWithoutExtension(text3), SolutionSynchronizer.WindowsNewline); stringBuilder.AppendFormat(" <HintPath>{0}</HintPath>{1}", text3, SolutionSynchronizer.WindowsNewline); stringBuilder.AppendFormat(" </Reference>{0}", SolutionSynchronizer.WindowsNewline); } } } if (0 < list2.Count) { stringBuilder.AppendLine(" </ItemGroup>"); stringBuilder.AppendLine(" <ItemGroup>"); foreach (Match current2 in list2) { string value = current2.Groups["project"].Value; stringBuilder.AppendFormat(" <ProjectReference Include=\"{0}{1}\">{2}", value, SolutionSynchronizer.GetProjectExtension((ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), current2.Groups["language"].Value, true)), SolutionSynchronizer.WindowsNewline); stringBuilder.AppendFormat(" <Project>{{{0}}}</Project>", this.ProjectGuid(Path.Combine("Temp", current2.Groups["project"].Value + ".dll")), SolutionSynchronizer.WindowsNewline); stringBuilder.AppendFormat(" <Name>{0}</Name>", value, SolutionSynchronizer.WindowsNewline); stringBuilder.AppendLine(" </ProjectReference>"); } } stringBuilder.Append(this.ProjectFooter(island)); return(stringBuilder.ToString()); }
private string ProjectFooter(MonoIsland island) { return(string.Format(this._settings.GetProjectFooterTemplate(SolutionSynchronizer.ScriptingLanguageFor(island)), this.ReadExistingMonoDevelopProjectProperties(island))); }
private void SyncProject(MonoIsland island, string otherAssetsProjectPart) { SolutionSynchronizer.SyncFileIfNotChanged(this.ProjectFile(island), this.ProjectText(island, SolutionSynchronizer.ModeForCurrentExternalEditor(), otherAssetsProjectPart)); }
private string ProjectText(MonoIsland island, Mode mode, string allAssetsProject) { StringBuilder builder = new StringBuilder(this.ProjectHeader(island)); List <string> first = new List <string>(); List <Match> list2 = new List <Match>(); foreach (string str3 in island._files) { string str = Path.GetExtension(str3).ToLower(); string file = !Path.IsPathRooted(str3) ? Path.Combine(this._projectDirectory, str3) : str3; if (".dll" != str) { string str4 = "Compile"; builder.AppendFormat(" <{0} Include=\"{1}\" />{2}", str4, this.EscapedRelativePathFor(file), WindowsNewline); } else { first.Add(file); } } builder.Append(allAssetsProject); IEnumerator <string> enumerator = first.Union <string>(island._references).GetEnumerator(); try { while (enumerator.MoveNext()) { string current = enumerator.Current; if (((!current.EndsWith("/UnityEditor.dll") && !current.EndsWith("/UnityEngine.dll")) && !current.EndsWith(@"\UnityEditor.dll")) && !current.EndsWith(@"\UnityEngine.dll")) { Match item = scriptReferenceExpression.Match(current); if (item.Success && ((mode == Mode.UnityScriptAsUnityProj) || (((int)Enum.Parse(typeof(ScriptingLanguage), item.Groups["language"].Value, true)) == 2))) { list2.Add(item); } else { string str6 = !Path.IsPathRooted(current) ? Path.Combine(this._projectDirectory, current) : current; if (AssemblyHelper.IsManagedAssembly(str6) && !AssemblyHelper.IsInternalAssembly(str6)) { str6 = str6.Replace(@"\", "/").Replace(@"\\", "/"); builder.AppendFormat(" <Reference Include=\"{0}\">{1}", Path.GetFileNameWithoutExtension(str6), WindowsNewline); builder.AppendFormat(" <HintPath>{0}</HintPath>{1}", str6, WindowsNewline); builder.AppendFormat(" </Reference>{0}", WindowsNewline); } } } } } finally { if (enumerator == null) { } enumerator.Dispose(); } if (0 < list2.Count) { builder.AppendLine(" </ItemGroup>"); builder.AppendLine(" <ItemGroup>"); foreach (Match match2 in list2) { string str7 = match2.Groups["project"].Value; builder.AppendFormat(" <ProjectReference Include=\"{0}{1}\">{2}", str7, GetProjectExtension((ScriptingLanguage)((int)Enum.Parse(typeof(ScriptingLanguage), match2.Groups["language"].Value, true))), WindowsNewline); builder.AppendFormat(" <Project>{{{0}}}</Project>", this.ProjectGuid(Path.Combine("Temp", match2.Groups["project"].Value + ".dll")), WindowsNewline); builder.AppendFormat(" <Name>{0}</Name>", str7, WindowsNewline); builder.AppendLine(" </ProjectReference>"); } } builder.Append(this.ProjectFooter(island)); return(builder.ToString()); }
string ProjectFooter(MonoIsland island) { return(_settings.GetProjectFooterTemplate(ScriptingLanguageFor(island))); }
public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater) { return new BooCompiler(island, runUpdater); }
string ProjectText(MonoIsland island, Mode mode, Dictionary <string, string> allAssetsProjectParts, ScriptCompilerBase.ResponseFileData responseFileData, List <MonoIsland> allProjectIslands) { var projectBuilder = new StringBuilder(ProjectHeader(island, responseFileData)); var references = new List <string>(); var projectReferences = new List <Match>(); Match match; bool isBuildingEditorProject = island._output.EndsWith("-Editor.dll"); foreach (string file in island._files) { if (!ShouldFileBePartOfSolution(file)) { continue; } var extension = Path.GetExtension(file).ToLower(); var fullFile = EscapedRelativePathFor(file); if (".dll" != extension) { var tagName = "Compile"; projectBuilder.AppendFormat(" <{0} Include=\"{1}\" />{2}", tagName, fullFile, WindowsNewline); } else { references.Add(fullFile); } } string additionalAssetsForProject; var assemblyName = Path.GetFileNameWithoutExtension(island._output); // Append additional non-script files that should be included in project generation. if (allAssetsProjectParts.TryGetValue(assemblyName, out additionalAssetsForProject)) { projectBuilder.Append(additionalAssetsForProject); } var allAdditionalReferenceFilenames = new List <string>(); foreach (string reference in references.Union(island._references).Union(responseFileData.References.Select(r => r.Assembly))) { if (reference.EndsWith("/UnityEditor.dll") || reference.EndsWith("/UnityEngine.dll") || reference.EndsWith("\\UnityEditor.dll") || reference.EndsWith("\\UnityEngine.dll")) { continue; } match = scriptReferenceExpression.Match(reference); if (match.Success) { var language = ScriptCompilers.GetLanguageFromExtension(island.GetExtensionOfSourceFiles()); var targetLanguage = (ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), language.GetLanguageName(), true); if (mode == Mode.UnityScriptAsUnityProj || ScriptingLanguage.CSharp == targetLanguage) { // Add a reference to a project except if it's a reference to a script assembly // that we are not generating a project for. This will be the case for assemblies // coming from .assembly.json files in non-internalized packages. var dllName = match.Groups["dllname"].Value; if (allProjectIslands.Any(i => Path.GetFileName(i._output) == dllName)) { projectReferences.Add(match); continue; } } } string fullReference = Path.IsPathRooted(reference) ? reference : Path.Combine(_projectDirectory, reference); if (!AssemblyHelper.IsManagedAssembly(fullReference)) { continue; } if (AssemblyHelper.IsInternalAssembly(fullReference)) { if (!IsAdditionalInternalAssemblyReference(isBuildingEditorProject, fullReference)) { continue; } var referenceName = Path.GetFileName(fullReference); if (allAdditionalReferenceFilenames.Contains(referenceName)) { continue; } allAdditionalReferenceFilenames.Add(referenceName); } //replace \ with / and \\ with / fullReference = fullReference.Replace("\\", "/"); fullReference = fullReference.Replace("\\\\", "/"); projectBuilder.AppendFormat(" <Reference Include=\"{0}\">{1}", Path.GetFileNameWithoutExtension(fullReference), WindowsNewline); projectBuilder.AppendFormat(" <HintPath>{0}</HintPath>{1}", fullReference, WindowsNewline); projectBuilder.AppendFormat(" </Reference>{0}", WindowsNewline); } if (0 < projectReferences.Count) { string referencedProject; projectBuilder.AppendLine(" </ItemGroup>"); projectBuilder.AppendLine(" <ItemGroup>"); foreach (Match reference in projectReferences) { var targetAssembly = EditorCompilationInterface.Instance.GetTargetAssemblyDetails(reference.Groups["dllname"].Value); ScriptingLanguage targetLanguage = ScriptingLanguage.None; if (targetAssembly != null) { targetLanguage = (ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), targetAssembly.Language.GetLanguageName(), true); } referencedProject = reference.Groups["project"].Value; projectBuilder.AppendFormat(" <ProjectReference Include=\"{0}{1}\">{2}", referencedProject, GetProjectExtension(targetLanguage), WindowsNewline); projectBuilder.AppendFormat(" <Project>{{{0}}}</Project>", ProjectGuid(Path.Combine("Temp", reference.Groups["project"].Value + ".dll")), WindowsNewline); projectBuilder.AppendFormat(" <Name>{0}</Name>", referencedProject, WindowsNewline); projectBuilder.AppendLine(" </ProjectReference>"); } } projectBuilder.Append(ProjectFooter(island)); return(projectBuilder.ToString()); }
private string ProjectHeader(MonoIsland island, IEnumerable <ScriptCompilerBase.ResponseFileData> responseFilesData) { string targetframeworkversion = "v3.5"; string targetLanguageVersion = "4"; string toolsversion = "4.0"; string productversion = "10.0.20506"; string baseDirectory = "."; string cscToolPath = "$(CscToolPath)"; string cscToolExe = "$(CscToolExe)"; ScriptingLanguage language = ScriptingLanguageFor(island); if (PlayerSettingsEditor.IsLatestApiCompatibility(island._api_compatibility_level)) { targetframeworkversion = "v4.7.1"; targetLanguageVersion = "latest"; cscToolPath = Paths.Combine(EditorApplication.applicationContentsPath, "Tools", "RoslynScripts"); if (Application.platform == RuntimePlatform.WindowsEditor) { cscToolExe = "unity_csc.bat"; } else { cscToolExe = "unity_csc.sh"; } cscToolPath = Paths.UnifyDirectorySeparator(cscToolPath); } else if (_settings.VisualStudioVersion == 9) { toolsversion = "3.5"; productversion = "9.0.21022"; } var arguments = new object[] { toolsversion, productversion, ProjectGuid(island._output), _settings.EngineAssemblyPath, _settings.EditorAssemblyPath, string.Join(";", new[] { "DEBUG", "TRACE" }.Concat(island._defines).Concat(responseFilesData.SelectMany(x => x.Defines)).Distinct().ToArray()), MSBuildNamespaceUri, Utility.FileNameWithoutExtension(island._output), EditorSettings.projectGenerationRootNamespace, targetframeworkversion, targetLanguageVersion, baseDirectory, island._allowUnsafeCode | responseFilesData.Any(x => x.Unsafe), cscToolPath, cscToolExe, }; try { return(string.Format(_settings.GetProjectHeaderTemplate(language), 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); } }
public string ProjectFile(MonoIsland island) { ScriptingLanguage language = ScriptingLanguageFor(island); return(Path.Combine(_projectDirectory, string.Format("{0}{1}", Path.GetFileNameWithoutExtension(island._output), ProjectExtensions[language]))); }
public abstract ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater);
string ProjectFooter(MonoIsland island) { return(string.Format(_settings.GetProjectFooterTemplate(ScriptingLanguageFor(island)), ReadExistingMonoDevelopProjectProperties(island))); }
protected ScriptCompilerBase(MonoIsland island, bool runAPIUpdater) { _island = island; _runAPIUpdater = runAPIUpdater; }
protected ScriptCompilerBase(MonoIsland island, bool runAPIUpdater) { m_Island = island; _runAPIUpdater = runAPIUpdater; m_ProjectDirectory = Directory.GetParent(Application.dataPath).FullName.ConvertSeparatorsToUnity(); }
public bool ProjectExists(MonoIsland island) { return(File.Exists(this.ProjectFile(island))); }
public BooCompiler(MonoIsland island, bool runUpdater) : base(island, runUpdater) { }
private string ProjectText(MonoIsland island, SolutionSynchronizer.Mode mode, Dictionary <string, string> allAssetsProjectParts, string[] additionalDefines, List <MonoIsland> allProjectIslands) { StringBuilder stringBuilder = new StringBuilder(this.ProjectHeader(island, additionalDefines)); List <string> list = new List <string>(); List <Match> list2 = new List <Match>(); bool isBuildingEditorProject = island._output.EndsWith("-Editor.dll"); string[] files = island._files; for (int j = 0; j < files.Length; j++) { string text = files[j]; if (this.ShouldFileBePartOfSolution(text)) { string b = Path.GetExtension(text).ToLower(); string text2 = (!Path.IsPathRooted(text)) ? Path.Combine(this._projectDirectory, text) : text; if (".dll" != b) { string arg = "Compile"; stringBuilder.AppendFormat(" <{0} Include=\"{1}\" />{2}", arg, this.EscapedRelativePathFor(text2), SolutionSynchronizer.WindowsNewline); } else { list.Add(text2); } } } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(island._output); string value; if (allAssetsProjectParts.TryGetValue(fileNameWithoutExtension, out value)) { stringBuilder.Append(value); } List <string> list3 = new List <string>(); foreach (string current in list.Union(island._references)) { if (!current.EndsWith("/UnityEditor.dll") && !current.EndsWith("/UnityEngine.dll") && !current.EndsWith("\\UnityEditor.dll") && !current.EndsWith("\\UnityEngine.dll")) { Match match = SolutionSynchronizer.scriptReferenceExpression.Match(current); if (match.Success) { SupportedLanguage languageFromExtension = ScriptCompilers.GetLanguageFromExtension(island.GetExtensionOfSourceFiles()); ScriptingLanguage scriptingLanguage = (ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), languageFromExtension.GetLanguageName(), true); if (mode == SolutionSynchronizer.Mode.UnityScriptAsUnityProj || scriptingLanguage == ScriptingLanguage.CSharp) { string dllName = match.Groups["dllname"].Value; if (allProjectIslands.Any((MonoIsland i) => Path.GetFileName(i._output) == dllName)) { list2.Add(match); continue; } } } string text3 = (!Path.IsPathRooted(current)) ? Path.Combine(this._projectDirectory, current) : current; if (AssemblyHelper.IsManagedAssembly(text3)) { if (AssemblyHelper.IsInternalAssembly(text3)) { if (!SolutionSynchronizer.IsAdditionalInternalAssemblyReference(isBuildingEditorProject, text3)) { continue; } string fileName = Path.GetFileName(text3); if (list3.Contains(fileName)) { continue; } list3.Add(fileName); } text3 = text3.Replace("\\", "/"); text3 = text3.Replace("\\\\", "/"); stringBuilder.AppendFormat(" <Reference Include=\"{0}\">{1}", Path.GetFileNameWithoutExtension(text3), SolutionSynchronizer.WindowsNewline); stringBuilder.AppendFormat(" <HintPath>{0}</HintPath>{1}", text3, SolutionSynchronizer.WindowsNewline); stringBuilder.AppendFormat(" </Reference>{0}", SolutionSynchronizer.WindowsNewline); } } } if (0 < list2.Count) { stringBuilder.AppendLine(" </ItemGroup>"); stringBuilder.AppendLine(" <ItemGroup>"); foreach (Match current2 in list2) { EditorBuildRules.TargetAssembly targetAssemblyDetails = EditorCompilationInterface.Instance.GetTargetAssemblyDetails(current2.Groups["dllname"].Value); ScriptingLanguage language = ScriptingLanguage.None; if (targetAssemblyDetails != null) { language = (ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), targetAssemblyDetails.Language.GetLanguageName(), true); } string value2 = current2.Groups["project"].Value; stringBuilder.AppendFormat(" <ProjectReference Include=\"{0}{1}\">{2}", value2, SolutionSynchronizer.GetProjectExtension(language), SolutionSynchronizer.WindowsNewline); stringBuilder.AppendFormat(" <Project>{{{0}}}</Project>", this.ProjectGuid(Path.Combine("Temp", current2.Groups["project"].Value + ".dll")), SolutionSynchronizer.WindowsNewline); stringBuilder.AppendFormat(" <Name>{0}</Name>", value2, SolutionSynchronizer.WindowsNewline); stringBuilder.AppendLine(" </ProjectReference>"); } } stringBuilder.Append(this.ProjectFooter(island)); return(stringBuilder.ToString()); }
static DotNetAssemblyProject CreateMonoDevelopProjectFromProjectUpdate(UnitySolution solution, MonoIsland projectUpdate) { var p = new DotNetAssemblyProject(projectUpdate.Language); // FIXME switch (projectUpdate.Language) { default: var dotNetProjectConfig = (DotNetProjectConfiguration)p.AddNewConfiguration("Debug"); dotNetProjectConfig.CompilationParameters = new CSharpCompilerParameters(); p.DefaultConfiguration = dotNetProjectConfig; break; } var rootFolder = solution.RootFolder; rootFolder.AddItem(p); solution.DefaultConfiguration.AddItem(p).Build = true; return(p); }
private string SolutionGuid(MonoIsland island) { return(SolutionGuidGenerator.GuidForSolution(this._projectName, island.GetExtensionOfSourceFiles())); }
public bool ProjectExists(MonoIsland island) => File.Exists(this.ProjectFile(island));
public string ProjectFile(MonoIsland island) { ScriptingLanguage language = ScriptingLanguageFor(island); return(Path.Combine(this._projectDirectory, $"{Path.GetFileNameWithoutExtension(island._output)}{ProjectExtensions[language]}")); }
private string ProjectFooter(MonoIsland island) => string.Format(this._settings.GetProjectFooterTemplate(ScriptingLanguageFor(island)), this.ReadExistingMonoDevelopProjectProperties(island));
private string ProjectText(MonoIsland island, Mode mode, string allAssetsProject) { StringBuilder builder = new StringBuilder(this.ProjectHeader(island)); List <string> first = new List <string>(); List <Match> list2 = new List <Match>(); bool isBuildingEditorProject = island._output.EndsWith("-Editor.dll"); foreach (string str3 in island._files) { string str = Path.GetExtension(str3).ToLower(); string file = !Path.IsPathRooted(str3) ? Path.Combine(this._projectDirectory, str3) : str3; if (".dll" != str) { string str4 = "Compile"; builder.AppendFormat(" <{0} Include=\"{1}\" />{2}", str4, this.EscapedRelativePathFor(file), WindowsNewline); } else { first.Add(file); } } builder.Append(allAssetsProject); List <string> list3 = new List <string>(); foreach (string str5 in first.Union <string>(island._references)) { if ((!str5.EndsWith("/UnityEditor.dll") && !str5.EndsWith("/UnityEngine.dll")) && (!str5.EndsWith(@"\UnityEditor.dll") && !str5.EndsWith(@"\UnityEngine.dll"))) { Match item = scriptReferenceExpression.Match(str5); if (item.Success && ((mode == Mode.UnityScriptAsUnityProj) || (((ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), item.Groups["language"].Value, true)) == ScriptingLanguage.CSharp))) { list2.Add(item); } else { string str6 = !Path.IsPathRooted(str5) ? Path.Combine(this._projectDirectory, str5) : str5; if (AssemblyHelper.IsManagedAssembly(str6)) { if (AssemblyHelper.IsInternalAssembly(str6)) { if (!IsAdditionalInternalAssemblyReference(isBuildingEditorProject, str6)) { continue; } string fileName = Path.GetFileName(str6); if (list3.Contains(fileName)) { continue; } list3.Add(fileName); } str6 = str6.Replace(@"\", "/").Replace(@"\\", "/"); builder.AppendFormat(" <Reference Include=\"{0}\">{1}", Path.GetFileNameWithoutExtension(str6), WindowsNewline); builder.AppendFormat(" <HintPath>{0}</HintPath>{1}", str6, WindowsNewline); builder.AppendFormat(" </Reference>{0}", WindowsNewline); } } } } if (0 < list2.Count) { builder.AppendLine(" </ItemGroup>"); builder.AppendLine(" <ItemGroup>"); foreach (Match match2 in list2) { string str8 = match2.Groups["project"].Value; builder.AppendFormat(" <ProjectReference Include=\"{0}{1}\">{2}", str8, GetProjectExtension((ScriptingLanguage)Enum.Parse(typeof(ScriptingLanguage), match2.Groups["language"].Value, true)), WindowsNewline); builder.AppendFormat(" <Project>{{{0}}}</Project>", this.ProjectGuid(Path.Combine("Temp", match2.Groups["project"].Value + ".dll")), WindowsNewline); builder.AppendFormat(" <Name>{0}</Name>", str8, WindowsNewline); builder.AppendLine(" </ProjectReference>"); } } builder.Append(this.ProjectFooter(island)); return(builder.ToString()); }
public override ScriptCompilerBase CreateCompiler(MonoIsland island, bool buildingForEditor, BuildTarget targetPlatform, bool runUpdater) { return(new BooCompiler(island, runUpdater)); }
protected ScriptCompilerBase(MonoIsland island) { this._island = island; }