public BaseSearchPathNode(CommonProjectNode project, string path, ProjectElement element) : base(project, path, element) { _project = project; this.VirtualNodeName = path; this.ExcludeNodeFromScc = true; }
public CommonSearchPathContainerNode(CommonProjectNode project) : base(project.ProjectMgr) { _projectNode = project; this.VirtualNodeName = SearchPathsNodeVirtualName; this.ExcludeNodeFromScc = true; }
public CommonProjectConfig(CommonProjectNode/*!*/ project, string configuration) : base(project, configuration) { _project = project; }
public override string CreateCommandLineNoDebug(CommonProjectNode project, string/*!*/ startupFile) { return CreateCommandLine(project, startupFile, false); }
/*!*/ private string CreateCommandLine(CommonProjectNode project, string/*!*/ startupFile, bool debug) { var commandLine = new StringBuilder(); bool disableDebugging = project != null && Convert.ToBoolean(project.GetProjectProperty(RubyConstants.ProjectProperties.DisableDebugging, true)); if (debug && !disableDebugging) { commandLine.Append(" -D"); } string searchPath = (project != null) ? project.GetProjectProperty(CommonConstants.SearchPath, true) : null; if (!String.IsNullOrEmpty(searchPath)) { foreach (string path in searchPath.Split(Path.PathSeparator)) { try { // the path is relative to the .rbproj file, not to the ir.exe file: var fullPath = RubyUtils.CanonicalizePath(Path.GetFullPath(path)); commandLine.Append(" -I"); if (fullPath.IndexOf(' ') >= 0) { commandLine.Append('"').Append(fullPath).Append('"'); } else { commandLine.Append(path); } } catch { // ignore } } } commandLine.Append(' ').Append('"').Append(startupFile).Append('"'); string args = null; string launcher = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.Launcher, true) : null; if (launcher == RubyConstants.ProjectProperties.Launcher_Spec) { string testDir = Path.GetFullPath(Path.Combine(project.GetWorkingDirectory(), "test")); if (Directory.Exists(testDir)) { args = String.Join(" ", Directory.GetFiles(testDir, "*_spec.rb").ConvertAll((path) => path.IndexOf(' ') >= 0 ? '"' + path + '"' : path) ); } } else { args = (project != null) ? project.GetProjectProperty(CommonConstants.CommandLineArguments, true) : null; } if (!String.IsNullOrEmpty(args)) { commandLine.Append(' '); commandLine.Append(args); } return commandLine.ToString(); }
public override void StartFile(CommonProjectNode project, string/*!*/ file, bool debug) { string appType = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.RubyApplicationType, true) : null; if (appType == RubyConstants.ProjectProperties.RubyApplicationType_WebApp) { string host = "localhost"; int port = Convert.ToInt32(project.GetProjectProperty(RubyConstants.ProjectProperties.DefaultPort, true)); if (LaunchWebServer(project, file, host, port)) { StartInBrowser("http://" + host + ":" + port, null); } else { throw new ApplicationException(String.Format( "Unable to start a web server by running file '{0}'. No response on http://{1}:{2}.", file, host, port )); } } else { base.StartFile(project, file, debug); } }
/// <summary> /// Default implementation of the "Start withput Debugging" command. /// </summary> protected virtual void StartWithoutDebugger(CommonProjectNode project, string startupFile) { Process.Start(CreateProcessStartInfoNoDebug(project, startupFile)); }
public void StartSilverlightApp(CommonProjectNode project, string/*!*/ file, bool debug) { string webSiteRoot; if (project != null) { webSiteRoot = project.GetWorkingDirectory(); file = Path.GetFullPath(Path.Combine(webSiteRoot, file)); } else { file = Path.GetFullPath(file); webSiteRoot = Path.GetDirectoryName(file); } webSiteRoot = webSiteRoot.TrimEnd('\\'); int port = EnsureChiron(webSiteRoot); string url = "http://localhost:" + port; if (file.StartsWith(webSiteRoot) && file.Length > webSiteRoot.Length && file[webSiteRoot.Length] == '\\') { url += file.Substring(webSiteRoot.Length).Replace('\\', '/'); } else if (file.StartsWith("\\")) { url += file.Replace('\\', '/'); } else{ url += '/' + file.Replace('\\', '/'); } StartInBrowser(url, debug ? guidSilvelightDebug : (Guid?)null); }
public void ApplyConfig(CommonProjectNode node) { MakeSureAtLeastOneLibraryTypeIsSelected(); config.SaveTo(node); originalConfig = config.Clone(); }
public CurrentWorkingDirectoryNode(CommonProjectNode project, string path) : base(project, path, project.MakeProjectElement("WorkingDirectory", path)) { }
/// <summary> /// Initializes a new instance of the <see cref="PowerShellFileNode"/> class. /// </summary> /// <param name="root">The project node.</param> /// <param name="e">The project element node.</param> internal PowerShellFileNode(CommonProjectNode root, ProjectElement e) : base(root, e) { }
public override string GetInterpreterExecutable(CommonProjectNode project) { bool isWindows = Convert.ToBoolean(project.GetProjectProperty(CommonConstants.IsWindowsApplication, true)); return(isWindows ? WindowsInterpreterExecutable : InterpreterExecutable); }
/// <summary> /// Returns full path of the language specififc iterpreter executable file. /// </summary> /*!*/ public abstract string GetInterpreterExecutable(CommonProjectNode project);
public RustConfigProvider(CommonProjectNode proj) : base(proj) { this.project = proj; }
public virtual void StartFile(CommonProjectNode project, string/*!*/ file, bool debug) { string extension = Path.GetExtension(file); if (String.Equals(extension, ".html", StringComparison.OrdinalIgnoreCase) || String.Equals(extension, ".htm", StringComparison.OrdinalIgnoreCase)) { StartSilverlightApp(project, file, debug); return; } if (debug) { StartWithDebugger(project, file); } else { StartWithoutDebugger(project, file); } }
public AllFilesProjectElement(string path, string itemType, CommonProjectNode project) : base(project) { Rename(path); }
/// <summary> /// Sets up environment variables before starting the project. /// </summary> protected virtual void SetupEnvironment(CommonProjectNode project, StringDictionary environment) { //Do nothing by default }
public ProjectDocumentsListenerForStartupFileUpdates(System.IServiceProvider serviceProvider, CommonProjectNode project) : base(serviceProvider) { _project = project; }
private string ResolveStartupFile(CommonProjectNode project) { if (project == null) { throw new ArgumentNullException("project"); } string startupFile = project.GetStartupFile(); if (string.IsNullOrEmpty(startupFile)) { //TODO: need to start active file then throw new ApplicationException("No startup file is defined for the startup project."); } return startupFile; }
public NodejsFolderNode(CommonProjectNode root, ProjectElement element) : base(root, element) { _project = root; }
public CurrentWorkingDirectoryNode(CommonProjectNode project, string path) : base(project, path, new VirtualProjectElement(project)) { }
internal RustProjectNodeProperties(CommonProjectNode node) : base(node) { }
public override void StartProject(CommonProjectNode project, bool debug) { IronRubyToolsPackage.Instance.RequireIronRubyInstalled(allowCancel: false); string launcher = (project != null) ? project.GetProjectProperty(RubyConstants.ProjectProperties.Launcher, true) : null; string file; switch (launcher) { case RubyConstants.ProjectProperties.Launcher_Rack: file = Path.Combine(IronRubyToolsPackage.Instance.IronRubyToolsPath, "Rackup.rb"); break; case RubyConstants.ProjectProperties.Launcher_Spec: file = Path.Combine(IronRubyToolsPackage.Instance.IronRubyToolsPath, "Spec.rb"); break; default: file = project.GetStartupFile(); if (String.IsNullOrEmpty(file)) { //TODO: need to start active file then throw new ApplicationException("No startup file is defined for the startup project."); } break; } StartFile(project, file, debug); }
public PythonFolderNode(CommonProjectNode root, string path, ProjectElement element) : base(root, path, element) { }
private bool LaunchWebServer(CommonProjectNode/*!*/ project, string/*!*/ file, string/*!*/ host, int port) { bool serverLaunched = false; Socket socket; socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); int time = 0; while (time < 50000) { try { socket.Connect(host, port); socket.Disconnect(false); return true; } catch (SocketException e) { if (e.SocketErrorCode != SocketError.ConnectionRefused) { throw; } if (!serverLaunched) { Process.Start(CreateProcessStartInfoNoDebug(project, file)); serverLaunched = true; } Thread.Sleep(500); time += 500; } } return false; }
public ProjectLibraryNode(CommonProjectNode project) : base(null, project.Caption, project.Caption, LibraryNodeType.PhysicalContainer) { this._project = project; }
public override string GetInterpreterExecutable(CommonProjectNode project) { return project != null && Convert.ToBoolean(project.GetProjectProperty(CommonConstants.IsWindowsApplication, true)) ? IronRubyToolsPackage.Instance.IronRubyWindowsExecutable : IronRubyToolsPackage.Instance.IronRubyExecutable; }
public CommonConfigProvider(CommonProjectNode project) : base(project) { _project = project; }
public CommonFileNode(CommonProjectNode root, ProjectElement e) : base(root, e) { _project = root; }
//TODO: this method should be protected, but due to IPy bug #19649 //we keep it temporary public. /// <summary> /// Sets up debugger information. /// </summary> public virtual void SetupDebugInfo(ref VsDebugTargetInfo dbgInfo, CommonProjectNode project, string startupFile) { dbgInfo.dlo = DEBUG_LAUNCH_OPERATION.DLO_CreateProcess; dbgInfo.bstrExe = GetInterpreterExecutableInternal(project); dbgInfo.bstrCurDir = project != null ? project.GetWorkingDirectory() : Path.GetDirectoryName(startupFile); dbgInfo.bstrArg = CreateCommandLineDebug(project, startupFile); dbgInfo.bstrRemoteMachine = null; dbgInfo.fSendStdoutToOutputWindow = 0; StringDictionary env = new StringDictionary(); SetupEnvironment(project, env); if (env.Count > 0) { // add any inherited env vars var variables = Environment.GetEnvironmentVariables(); foreach (var key in variables.Keys) { string strKey = (string)key; if (!env.ContainsKey(strKey)) { env.Add(strKey, (string)variables[key]); } } //Environemnt variables should be passed as a //null-terminated block of null-terminated strings. //Each string is in the following form:name=value\0 StringBuilder buf = new StringBuilder(); foreach (DictionaryEntry entry in env) { buf.AppendFormat("{0}={1}\0", entry.Key, entry.Value); } buf.Append("\0"); dbgInfo.bstrEnv = buf.ToString(); } //Set the managed debugger dbgInfo.clsidCustom = VSConstants.CLSID_ComPlusOnlyDebugEngine; dbgInfo.grfLaunch = (uint)__VSDBGLAUNCHFLAGS.DBGLAUNCH_StopDebuggingOnEnd; }
public override string GetInterpreterExecutable(CommonProjectNode project) { bool isWindows = Convert.ToBoolean(project.GetProjectProperty(CommonConstants.IsWindowsApplication, true)); return isWindows ? WindowsInterpreterExecutable : InterpreterExecutable; }
public virtual void StartProject(CommonProjectNode project, bool debug) { string startupFile = ResolveStartupFile(project); StartFile(project, startupFile, debug); }
private string GetOptions(CommonProjectNode project) { if (project != null) { var debugStdLib = project.GetProjectProperty(PythonConstants.DebugStandardLibrary, false); bool debugStdLibResult; if (!bool.TryParse(debugStdLib, out debugStdLibResult) || !debugStdLibResult) { var res = "-X:NoDebug \"" + System.Text.RegularExpressions.Regex.Escape(Path.Combine(InstallPath, "Lib\\")) + ".*\""; return res; } } return ""; }
/// <summary> /// Creates process info used to start the project with no debugging. /// </summary> protected virtual ProcessStartInfo CreateProcessStartInfoNoDebug(CommonProjectNode project, string startupFile) { string command = CreateCommandLineNoDebug(project, startupFile); string interpreter = GetInterpreterExecutableInternal(project); command = "/c \"\"" + interpreter + "\" " + command + " & pause\""; ProcessStartInfo startInfo = new ProcessStartInfo("cmd.exe", command); startInfo.WorkingDirectory = project != null ? project.GetWorkingDirectory() : Path.GetDirectoryName(startupFile); //In order to update environment variables we have to set UseShellExecute to false startInfo.UseShellExecute = false; SetupEnvironment(project, startInfo.EnvironmentVariables); return startInfo; }
protected override void SetupEnvironment(CommonProjectNode project, StringDictionary environment) { if (project != null) { //IronPython passes search path via IRONPYTHONPATH environment variable string searchPath = project.GetProjectProperty(CommonConstants.SearchPath, true); if (!string.IsNullOrEmpty(searchPath)) { environment[PythonConstants.IronPythonPath] = searchPath; } } }
/// <summary> /// Default implementation of the "Start Debugging" command. /// </summary> protected virtual void StartWithDebugger(CommonProjectNode project, string startupFile) { VsDebugTargetInfo dbgInfo = new VsDebugTargetInfo(); dbgInfo.cbSize = (uint)Marshal.SizeOf(dbgInfo); IntPtr ptr = Marshal.AllocCoTaskMem((int)dbgInfo.cbSize); try { Marshal.StructureToPtr(dbgInfo, ptr, false); SetupDebugInfo(ref dbgInfo, project, startupFile); LaunchDebugger(_serviceProvider, dbgInfo); } finally { if (ptr != IntPtr.Zero) { Marshal.FreeCoTaskMem(ptr); } } }
public override string CreateCommandLineNoDebug(CommonProjectNode project, string startupFile) { string cmdLineArgs = null; if (project != null) { cmdLineArgs = project.GetProjectProperty(CommonConstants.CommandLineArguments, true); } return String.Format("{0} \"{1}\" {2}", GetOptions(project), startupFile, cmdLineArgs); }
/*!*/ private string GetInterpreterExecutableInternal(CommonProjectNode project) { string result; if (project != null) { result = (project.ProjectMgr.GetProjectProperty(CommonConstants.InterpreterPath, true) ?? "").Trim(); if (!String.IsNullOrEmpty(result)) { if (!File.Exists(result)) { throw new FileNotFoundException(String.Format("Interpreter specified in the project does not exist: '{0}'", result), result); } return result; } } result = GetInterpreterExecutable(project); if (result == null) { ContractUtils.RequiresNotNull(result, "result of GetInterpreterExecutable"); } return result; }
public ProjectDocumentsListenerForStartupFileUpdates(ServiceProvider serviceProvider, CommonProjectNode project) : base(serviceProvider) { _project = project; }
/// <summary> /// Creates language specific command line for starting the project without debigging. /// </summary> public abstract string CreateCommandLineNoDebug(CommonProjectNode project, string startupFile);
public PowerShellNonCodeFileNode(CommonProjectNode root, ProjectElement e) : base(root, e) { }