public NuGetPackageRestoreCommandLine(IPackageManagementSolution solution) : this( solution, MonoRuntimeInfo.FromCurrentRuntime(), EnvironmentUtility.IsMonoRuntime) { }
/// <summary> /// Resolves MSBuild assemblies that are used by MonoDevelop.Ide and are included with Mono. /// </summary> void ResolveMSBuildAssemblies() { if (Platform.IsWindows) { return; } var currentRuntime = MonoRuntimeInfo.FromCurrentRuntime(); if (currentRuntime != null) { var rootMSBuildBinDir = Path.Combine(currentRuntime.Prefix, "lib", "mono", "msbuild"); msbuildBinDir = Path.Combine(rootMSBuildBinDir, "Current", "bin"); if (Directory.Exists(msbuildBinDir)) { AppDomain.CurrentDomain.AssemblyResolve += MSBuildAssemblyResolve; return; } // Fallback to MSBuild 15.0 msbuildBinDir = Path.Combine(rootMSBuildBinDir, "15.0", "bin"); if (Directory.Exists(msbuildBinDir)) { AppDomain.CurrentDomain.AssemblyResolve += MSBuildAssemblyResolve; } } }
ModifiedCommandLineArguments GetModifiedCommandLine(string filePath, IEnumerable <string> arguments) { string extension = Path.GetExtension(filePath); if (!StringComparer.OrdinalIgnoreCase.Equals(".exe", extension)) { return(null); } var runtime = MonoRuntimeInfo.FromCurrentRuntime(); if (runtime == null) { return(null); } string monoPath = Path.Combine(runtime.Prefix, "bin", "mono"); List <string> updatedArguments = arguments.ToList(); updatedArguments.Insert(0, "\"" + filePath + "\""); return(new ModifiedCommandLineArguments { FilePath = monoPath, Arguments = updatedArguments }); }
public PaketCommandLine(string rootPath, string arguments) : this( rootPath, arguments, MonoRuntimeInfo.FromCurrentRuntime(), !Platform.IsWindows) { }
void CreateCommandLineWithSolution(string fileName, MonoRuntimeInfo monoRuntimeInfo, bool isMonoRuntime) { var solution = new FakePackageManagementSolution(); solution.FileName = fileName; commandLine = new NuGetPackageRestoreCommandLine( solution, monoRuntimeInfo, isMonoRuntime); }
/// <summary> /// Resolves MSBuild 15.0 assemblies that are used by MonoDevelop.Ide and are included with Mono. /// </summary> void ResolveMSBuildAssemblies () { var currentRuntime = MonoRuntimeInfo.FromCurrentRuntime (); if (currentRuntime != null) { msbuildBinDir = Path.Combine (currentRuntime.Prefix, "lib", "mono", "msbuild", "15.0", "bin"); if (Directory.Exists (msbuildBinDir)) { AppDomain.CurrentDomain.AssemblyResolve += MSBuildAssemblyResolve; } } }
public void ApplyParameters() { CryEngineParameters = new CryEngineParameters(Project); var engineDirectory = GetEngineDirectoryName(CryEngineParameters); if (engineDirectory == null) { LoggingService.LogError("Unable to set the correct mono-runtime! Make sure the launcher path is set in the project's settings."); return; } var engineRoot = (FilePath)engineDirectory; var monoRoot = engineRoot.Combine("bin", "common", "Mono").FullPath; if (!Directory.Exists(monoRoot)) { LoggingService.LogError("Unable to locate the mono-runtime at {0}! Make sure the launcher path is set to the correct launcher in the project's settings.", monoRoot); return; } var currentRuntime = Runtime.SystemAssemblyService.CurrentRuntime as MonoTargetRuntime; if (currentRuntime != null && ((FilePath)currentRuntime.Prefix).CanonicalPath.CompareTo(monoRoot.CanonicalPath) == 0) { // The right runtime is already set, so our job is done here. return; } // Apply proper mono runtime for CryEngine foreach (TargetRuntime runtime in Runtime.SystemAssemblyService.GetTargetRuntimes()) { var monoRuntime = runtime as MonoTargetRuntime; if (monoRuntime == null) { continue; } var monoRuntimePath = (FilePath)monoRuntime.Prefix; if (monoRuntimePath.CanonicalPath.CompareTo(monoRoot.CanonicalPath) == 0) { CryEngineRuntime = monoRuntime; } } if (CryEngineRuntime == null) { var mri = new MonoRuntimeInfo(monoRoot.FullPath); CryEngineRuntime = MonoTargetRuntime.RegisterRuntime(mri); } Runtime.SystemAssemblyService.DefaultRuntime = CryEngineRuntime; Project.NotifyModified("RunTime"); }
void GenerateMonoCommandLine(IPackageManagementSolution solution) { Arguments = String.Format( "--runtime=v4.0 \"{0}\" restore \"{1}\"", NuGetExePath.GetPath(), solution.FileName); string monoPrefix = MonoRuntimeInfo.FromCurrentRuntime().Prefix; Command = Path.Combine(monoPrefix, "bin", "mono"); }
public NuGetPackageRestoreCommandLine( IPackageManagementSolution solution, MonoRuntimeInfo monoRuntime, bool isMonoRuntime) { this.monoRuntime = monoRuntime; this.isMonoRuntime = isMonoRuntime; GenerateCommandLine(solution); GenerateWorkingDirectory(solution); }
public PaketCommandLine( string rootPath, string arguments, MonoRuntimeInfo monoRuntime, bool isMonoRuntime) { this.monoRuntime = monoRuntime; this.isMonoRuntime = isMonoRuntime; RootPath = rootPath; GenerateCommandLine(arguments); GenerateWorkingDirectory(); }
public void CommandLine_RestoreSolutionOnMono_MonoUsedFromCurrentPrefix() { var monoRuntime = new MonoRuntimeInfo(@"c:\Users\Prefix"); CreateCommandLineWithSolution(@"d:\projects\MySolution\MySolution.sln", monoRuntime); string arguments = commandLine.Arguments; string expectedCommandLine = Path.Combine(@"c:\Users\Prefix", "bin", "mono"); Assert.IsTrue(arguments.StartsWith("--runtime=v4.0 "), arguments); Assert.IsTrue(arguments.EndsWith("restore \"d:\\projects\\MySolution\\MySolution.sln\""), arguments); Assert.AreEqual(expectedCommandLine, commandLine.Command); }
static bool IsAtLeastMono43() { MonoRuntimeInfo monoInfo = MonoRuntimeInfo.FromCurrentRuntime(); if (monoInfo == null) { return(false); } Version version; if (!Version.TryParse(monoInfo.MonoVersion, out version)) { return(false); } var version43 = new Version("4.3.0"); return(version >= version43); }
protected virtual void OnButtonAddClicked(object sender, System.EventArgs e) { var dlg = new SelectFolderDialog(GettextCatalog.GetString("Select the mono installation prefix")) { TransientFor = this.Toplevel as Gtk.Window, }; //set a platform-dependent default folder for the dialog if possible if (Platform.IsWindows) { // ProgramFilesX86 is broken on 32-bit WinXP string programFilesX86 = Environment.GetFolderPath( IntPtr.Size == 8? Environment.SpecialFolder.ProgramFilesX86 : Environment.SpecialFolder.ProgramFiles); if (!string.IsNullOrEmpty(programFilesX86) && System.IO.Directory.Exists(programFilesX86)) { dlg.CurrentFolder = programFilesX86; } } else { if (System.IO.Directory.Exists("/usr")) { dlg.CurrentFolder = "/usr"; } } if (!dlg.Run()) { return; } var rinfo = new MonoRuntimeInfo(dlg.SelectedFile); if (!rinfo.IsValidRuntime) { MessageService.ShowError(GettextCatalog.GetString("Mono runtime not found"), GettextCatalog.GetString("Please provide a valid directory prefix where mono is installed (for example, /usr)")); return; } newInfos.Add(rinfo); store.AppendValues(rinfo.DisplayName, rinfo); }
public void Store() { object ob = store.GetValue(defaultIter, 1); MonoRuntimeInfo newDefaultInfo = ob as MonoRuntimeInfo; if (ob is TargetRuntime) { IdeApp.Preferences.DefaultTargetRuntime = (TargetRuntime)ob; } foreach (MonoRuntimeInfo rinfo in newInfos) { TargetRuntime tr = MonoTargetRuntime.RegisterRuntime(rinfo); if (rinfo == newDefaultInfo) { IdeApp.Preferences.DefaultTargetRuntime = tr; } } foreach (MonoTargetRuntime tr in removedRuntimes) { MonoTargetRuntime.UnregisterRuntime(tr); } }
protected virtual void OnButtonAddClicked(object sender, System.EventArgs e) { var dlg = new SelectFolderDialog(GettextCatalog.GetString("Select the mono installation prefix")) { TransientFor = this.Toplevel as Gtk.Window, CurrentFolder = "/usr", }; if (!dlg.Run()) { return; } var rinfo = new MonoRuntimeInfo(dlg.SelectedFile); if (!rinfo.IsValidRuntime) { MessageService.ShowError(GettextCatalog.GetString("Mono runtime not found"), GettextCatalog.GetString("Please provide a valid directory prefix where mono is installed (for example, /usr)")); return; } newInfos.Add(rinfo); store.AppendValues(rinfo.DisplayName, rinfo); }
void CreateCommandLineWithSolution(string fileName, MonoRuntimeInfo monoRuntimeInfo) { CreateCommandLineWithSolution(fileName, monoRuntimeInfo, true); }