protected string GetMonoProfileLibDirectory() { string profile = BuildPipeline.CompatibilityProfileToClassLibFolder(this._island._api_compatibility_level); string monoInstallation = (this._island._api_compatibility_level != ApiCompatibilityLevel.NET_4_6) ? "Mono" : "MonoBleedingEdge"; return(MonoInstallationFinder.GetProfileDirectory(profile, monoInstallation)); }
public static void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames) { string profileDirectory = MonoInstallationFinder.GetProfileDirectory(BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6), "MonoBleedingEdge"); string str = Path.Combine(profileDirectory, "mono-cil-strip.exe"); for (int i = 0; i < fileNames.Length; i++) { string text = fileNames[i]; Process process = MonoProcessUtility.PrepareMonoProcessBleedingEdge(managedLibrariesDirectory); string text2 = text + ".out"; process.StartInfo.Arguments = "\"" + str + "\""; ProcessStartInfo expr_67 = process.StartInfo; string arguments = expr_67.Arguments; expr_67.Arguments = string.Concat(new string[] { arguments, " \"", text, "\" \"", text, ".out\"" }); MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, text2)); MonoAssemblyStripping.ReplaceFile(managedLibrariesDirectory + "/" + text2, managedLibrariesDirectory + "/" + text); File.Delete(managedLibrariesDirectory + "/" + text2); } }
protected string GetMonoProfileLibDirectory() { string profile = BuildPipeline.CompatibilityProfileToClassLibFolder(this._island._api_compatibility_level); string monoInstallation = (!PlayerSettingsEditor.IsLatestApiCompatibility(this._island._api_compatibility_level)) ? "Mono" : "MonoBleedingEdge"; return(MonoInstallationFinder.GetProfileDirectory(profile, monoInstallation)); }
protected override Program StartCompiler() { List <string> list = new List <string> { "-debug", "-target:library", "-nowarn:0169", "-langversion:4", "-out:" + ScriptCompilerBase.PrepareFileName(this._island._output), "-unsafe" }; if (!this._island._development_player && !this._island._editor) { list.Add("-optimize"); } string[] references = this._island._references; for (int i = 0; i < references.Length; i++) { string fileName = references[i]; list.Add("-r:" + ScriptCompilerBase.PrepareFileName(fileName)); } foreach (string current in this._island._defines.Distinct <string>()) { list.Add("-define:" + current); } string[] files = this._island._files; for (int j = 0; j < files.Length; j++) { string fileName2 = files[j]; list.Add(ScriptCompilerBase.PrepareFileName(fileName2)); } string profile = (this._island._api_compatibility_level != ApiCompatibilityLevel.NET_2_0) ? base.GetMonoProfileLibDirectory() : "2.0-api"; string profileDirectory = MonoInstallationFinder.GetProfileDirectory(profile, "MonoBleedingEdge"); string[] additionalReferences = this.GetAdditionalReferences(); for (int k = 0; k < additionalReferences.Length; k++) { string path = additionalReferences[k]; string text = Path.Combine(profileDirectory, path); if (File.Exists(text)) { list.Add("-r:" + ScriptCompilerBase.PrepareFileName(text)); } } if (!base.AddCustomResponseFileIfPresent(list, "mcs.rsp")) { if (this._island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0_Subset && base.AddCustomResponseFileIfPresent(list, "smcs.rsp")) { Debug.LogWarning("Using obsolete custom response file 'smcs.rsp'. Please use 'mcs.rsp' instead."); } else if (this._island._api_compatibility_level == ApiCompatibilityLevel.NET_2_0 && base.AddCustomResponseFileIfPresent(list, "gmcs.rsp")) { Debug.LogWarning("Using obsolete custom response file 'gmcs.rsp'. Please use 'mcs.rsp' instead."); } } return(base.StartCompiler(this._island._target, this.GetCompilerPath(list), list, false, MonoInstallationFinder.GetMonoInstallation("MonoBleedingEdge"))); }
protected string GetMonoProfileLibDirectory() { var profile = BuildPipeline.CompatibilityProfileToClassLibFolder(m_Island._api_compatibility_level); var monoInstall = PlayerSettingsEditor.IsLatestApiCompatibility(m_Island._api_compatibility_level) ? MonoInstallationFinder.MonoBleedingEdgeInstallation : MonoInstallationFinder.MonoInstallation; return(MonoInstallationFinder.GetProfileDirectory(profile, monoInstall)); }
static string GetCompilerPath() { string dir = MonoInstallationFinder.GetProfileDirectory("4.5", MonoInstallationFinder.MonoBleedingEdgeInstallation); var compilerPath = Path.Combine(dir, "mcs.exe"); if (File.Exists(compilerPath)) { return(compilerPath); } throw new ApplicationException("Unable to find csharp compiler in " + dir); }
private string GetCompilerPath(List <string> arguments) { string profileDirectory = MonoInstallationFinder.GetProfileDirectory(this._island._target, "4.5", "MonoBleedingEdge"); string text = Path.Combine(profileDirectory, "mcs.exe"); if (File.Exists(text)) { arguments.Add("-sdk:" + this._island._classlib_profile); return(text); } throw new ApplicationException("Unable to find csharp compiler in " + profileDirectory); }
static string GetSystemReference(ApiCompatibilityLevel apiCompatibilityLevel) { if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_Unity_4_8) { return(GetUnityReferenceProfileDirectory()); } if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_2_0) { return(MonoInstallationFinder.GetProfileDirectory("2.0-api", MonoInstallationFinder.MonoBleedingEdgeInstallation)); } return(MonoInstallationFinder.GetProfileDirectory(BuildPipeline.CompatibilityProfileToClassLibFolder(apiCompatibilityLevel), MonoInstallationFinder.MonoBleedingEdgeInstallation)); }
private string GetCompilerPath(List <string> arguments) { string profileDirectory = MonoInstallationFinder.GetProfileDirectory("4.5", "MonoBleedingEdge"); string text = Path.Combine(profileDirectory, "mcs.exe"); if (File.Exists(text)) { string str = (this._island._api_compatibility_level != ApiCompatibilityLevel.NET_4_6) ? BuildPipeline.CompatibilityProfileToClassLibFolder(this._island._api_compatibility_level) : "4.6"; arguments.Add("-sdk:" + str); return(text); } throw new ApplicationException("Unable to find csharp compiler in " + profileDirectory); }
private string GetCompilerPath(List <string> arguments) { string profileDirectory = MonoInstallationFinder.GetProfileDirectory("4.5", "MonoBleedingEdge"); string text = Path.Combine(profileDirectory, "mcs.exe"); if (File.Exists(text)) { string profile = (this._island._api_compatibility_level != ApiCompatibilityLevel.NET_2_0) ? BuildPipeline.CompatibilityProfileToClassLibFolder(this._island._api_compatibility_level) : "2.0-api"; if (this._island._api_compatibility_level != ApiCompatibilityLevel.NET_Standard_2_0) { arguments.Add("-lib:" + ScriptCompilerBase.PrepareFileName(MonoInstallationFinder.GetProfileDirectory(profile, "MonoBleedingEdge"))); } return(text); } throw new ApplicationException("Unable to find csharp compiler in " + profileDirectory); }
public static string GetSystemReferenceDirectory(ApiCompatibilityLevel apiCompatibilityLevel) { if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_Standard_2_0) { return(""); } else if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_4_6) { return(MonoInstallationFinder.GetProfileDirectory("4.7.1-api", MonoInstallationFinder.MonoBleedingEdgeInstallation)); } else if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_2_0) { return(MonoInstallationFinder.GetProfileDirectory("2.0-api", MonoInstallationFinder.MonoBleedingEdgeInstallation)); } return(MonoInstallationFinder.GetProfileDirectory(BuildPipeline.CompatibilityProfileToClassLibFolder(apiCompatibilityLevel), MonoInstallationFinder.MonoBleedingEdgeInstallation)); }
private string GetCompilerPath(List <string> arguments) { string dir = MonoInstallationFinder.GetProfileDirectory("4.5", MonoInstallationFinder.MonoBleedingEdgeInstallation); var compilerPath = Path.Combine(dir, "mcs.exe"); if (File.Exists(compilerPath)) { var systemAssemblyDirectory = MonoLibraryHelpers.GetSystemReferenceDirectory(_island._api_compatibility_level); if (!string.IsNullOrEmpty(systemAssemblyDirectory) && Directory.Exists(systemAssemblyDirectory)) { arguments.Add("-lib:" + PrepareFileName(systemAssemblyDirectory)); } return(compilerPath); } throw new ApplicationException("Unable to find csharp compiler in " + dir); }
static public void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames) { string basePath = MonoInstallationFinder.GetProfileDirectory(BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6), MonoInstallationFinder.MonoBleedingEdgeInstallation); string cilStripper = Path.Combine(basePath, "mono-cil-strip.exe"); foreach (string fileName in fileNames) { Process process = MonoProcessUtility.PrepareMonoProcessBleedingEdge(managedLibrariesDirectory); string outFile = fileName + ".out"; process.StartInfo.Arguments = "\"" + cilStripper + "\""; process.StartInfo.Arguments += " \"" + fileName + "\" \"" + fileName + ".out\""; MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, outFile)); ReplaceFile(managedLibrariesDirectory + "/" + outFile, managedLibrariesDirectory + "/" + fileName); File.Delete(managedLibrariesDirectory + "/" + outFile); } }
static string[] GetCachedSystemLibraryReferences(ApiCompatibilityLevel apiCompatibilityLevel) { // We cache the references because they are computed by getting files in directories on disk, // which is very slow. if (cachedReferences != null && cachedReferences.ApiCompatibilityLevel == apiCompatibilityLevel) { return(cachedReferences.References); } var references = new List <string>(); var monoAssemblyDirectories = GetSystemReferenceDirectories(apiCompatibilityLevel); if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_Standard_2_0) { references.AddRange(GetNetStandardClassLibraries()); } else if (apiCompatibilityLevel == ApiCompatibilityLevel.NET_4_6) { references.AddRange(GetSystemReferences().FindReferencesInDirectories(monoAssemblyDirectories)); references.AddRange(GetNet46SystemReferences().FindReferencesInDirectories(monoAssemblyDirectories)); // Look in the mono assembly directory for a facade folder and get a list of all the DLL's to be // used later by the language compilers. var monoAssemblyDirectory = MonoInstallationFinder.GetProfileDirectory("4.7.1-api", MonoInstallationFinder.MonoBleedingEdgeInstallation); references.AddRange(Directory.GetFiles(Path.Combine(monoAssemblyDirectory, "Facades"), "*.dll")); references.AddRange(GetBooAndUsReferences().Select(dll => Path.Combine(MonoInstallationFinder.GetProfileDirectory("unityscript", MonoInstallationFinder.MonoBleedingEdgeInstallation), dll))); } else { references.AddRange(GetSystemReferences().FindReferencesInDirectories(monoAssemblyDirectories)); references.AddRange(GetBooAndUsReferences().FindReferencesInDirectories(monoAssemblyDirectories)); } cachedReferences = new CachedReferences { ApiCompatibilityLevel = apiCompatibilityLevel, References = references.ToArray() }; return(cachedReferences.References); }
public static Process PrepareMonoProcessBleedingEdge(string workDir) { Process process = new Process(); string text = (Application.platform != RuntimePlatform.WindowsEditor) ? "mono" : "mono.exe"; process.StartInfo.FileName = Paths.Combine(new string[] { MonoInstallationFinder.GetMonoBleedingEdgeInstallation(), "bin", text }); process.StartInfo.EnvironmentVariables["_WAPI_PROCESS_HANDLE_OFFSET"] = "5"; string profile = BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6); process.StartInfo.EnvironmentVariables["MONO_PATH"] = MonoInstallationFinder.GetProfileDirectory(profile); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = true; process.StartInfo.WorkingDirectory = workDir; return(process); }
static public void MonoCilStrip(BuildTarget buildTarget, string managedLibrariesDirectory, string[] fileNames) { // Previously requested the directory for the ApiCompatibilityLevel.NET_4_6 profile. That gets // translated to unityjit which does not contain mono-cil-strip.exe. // Per the scripting team, hardcoding to 4.5 is the correct course of action at this time. string basePath = MonoInstallationFinder.GetProfileDirectory("4.5", MonoInstallationFinder.MonoBleedingEdgeInstallation); string cilStripper = Path.Combine(basePath, "mono-cil-strip.exe"); foreach (string fileName in fileNames) { Process process = MonoProcessUtility.PrepareMonoProcessBleedingEdge(managedLibrariesDirectory); string outFile = fileName + ".out"; process.StartInfo.Arguments = "\"" + cilStripper + "\""; process.StartInfo.Arguments += " \"" + fileName + "\" \"" + fileName + ".out\""; MonoProcessUtility.RunMonoProcess(process, "byte code stripper", Path.Combine(managedLibrariesDirectory, outFile)); ReplaceFile(managedLibrariesDirectory + "/" + outFile, managedLibrariesDirectory + "/" + fileName); File.Delete(managedLibrariesDirectory + "/" + outFile); } }
public static Process PrepareMonoProcessBleedingEdge(string workDir) { var process = new Process(); var executableName = Application.platform == RuntimePlatform.WindowsEditor ? "mono.exe" : "mono"; process.StartInfo.FileName = Paths.Combine(MonoInstallationFinder.GetMonoBleedingEdgeInstallation(), "bin", executableName); // ;; TODO fix this hack for strange process handle duplication problem inside mono process.StartInfo.EnvironmentVariables["_WAPI_PROCESS_HANDLE_OFFSET"] = "5"; // We run the stripper on .NET 4.6 profile var monoProfile = BuildPipeline.CompatibilityProfileToClassLibFolder(ApiCompatibilityLevel.NET_4_6); process.StartInfo.EnvironmentVariables["MONO_PATH"] = MonoInstallationFinder.GetProfileDirectory(monoProfile); process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.StartInfo.CreateNoWindow = true; process.StartInfo.WorkingDirectory = workDir; return(process); }
protected string GetProfileDirectory() { return(MonoInstallationFinder.GetProfileDirectory(this._island._target, this._island._classlib_profile)); }