Ejemplo n.º 1
0
        int IVsProjectFlavorCfgProvider.CreateProjectFlavorCfg(IVsCfg pBaseProjectCfg, out IVsProjectFlavorCfg ppFlavorCfg)
        {
            ppFlavorCfg = null;
            if (m_projectConfiguration == null)
            {
                object projectExtObj        = null;
                var    hr                   = _innerVsHierarchy?.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_ExtObject, out projectExtObj);
                var    buildPropertyStorage = _innerVsHierarchy as IVsBuildPropertyStorage;

                EnvDTE.Project dteProject = projectExtObj as EnvDTE.Project;

                if (dteProject != null)
                {
                    m_projectName = dteProject.FullName;
                }

                if (m_innerVsProjectFlavorCfgProvider != null)
                {
                    m_innerVsProjectFlavorCfgProvider.CreateProjectFlavorCfg(pBaseProjectCfg, out ppFlavorCfg);
                }

                m_projectConfiguration = new BuildProjectConfiguration(pBaseProjectCfg, ppFlavorCfg, m_buildManager, m_traceDominoMessage, buildPropertyStorage, m_projectName);
            }

            ppFlavorCfg = m_projectConfiguration;

            return(VSConstants.S_OK);
        }
        int IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(
            IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
        {
            //
            //   if clean project or solution,   dwAction == 0x100000
            //   if build project or solution,   dwAction == 0x010000
            //   if rebuild project or solution, dwAction == 0x410000
            //
            if (dwAction == 0x010000
                || dwAction == 0x410000)
            {
                var validationSuccessful =
                    VisualStudioEdmxValidator.LoadAndValidateAllFilesInProject(
                        pHierProj, /*doEscherValidation*/ false, ShouldValidateArtifactDuringBuild);

                // we cause a 'build break' for command-line builds by setting PfCancel = 1
                if (PackageManager.Package.IsBuildingFromCommandLine
                    && !validationSuccessful)
                {
                    pfCancel = 1;
                }
            }

            return VSConstants.S_OK;
        }
 int IVsCfgBrowseObject.GetCfg(out IVsCfg ppCfg)
 {
     return(Node.ProjectMgr.ConfigProvider.GetCfgOfName(
                Node.ProjectMgr.CurrentConfig.GetPropertyValue(ProjectFileConstants.Configuration),
                Node.ProjectMgr.CurrentConfig.GetPropertyValue(ProjectFileConstants.Platform),
                out ppCfg));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Returns the configuration associated with a specified configuration or platform name.
        /// </summary>
        /// <param name="name">The name of the configuration to be returned.</param>
        /// <param name="platName">The name of the platform for the configuration to be returned.</param>
        /// <param name="cfg">The implementation of the IVsCfg interface.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int GetCfgOfName(string name, string platName, out IVsCfg cfg)
        {
            cfg = null;
            cfg = this.GetProjectConfiguration(new ConfigCanonicalName(name, platName));

            return(VSConstants.S_OK);
        }
 public NodejsUwpProjectFlavorCfg(NodejsUwpProjectFlavor baseProjectNode, IVsCfg baseConfiguration, IVsProjectFlavorCfg innerConfiguration)
 {
     _baseCfg = baseConfiguration;
     _innerCfg = innerConfiguration;
     project = baseProjectNode;
     mapIVsCfgToNodejsUwpProjectFlavorCfg.Add(baseConfiguration, this);
 }
        public VsProjectFlavorCfg(VsProject project, IVsCfg baseCfg)
        {
            m_vsCfg   = baseCfg;
            m_project = project;

            m_innerIVsDebuggableProjectCfg = m_vsCfg as IVsDebuggableProjectCfg;
            m_IVsBuildPropertyStorage      = m_project as IVsBuildPropertyStorage;

            Debug.Assert(m_innerIVsDebuggableProjectCfg != null);

            m_connectionsDeployStatusCallback = new ConnectionPoint.Connections();

            DeployPropertyPort   = new ProjectBuildProperty("DeployTransport", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE, _PersistStorageType.PST_PROJECT_FILE, DebugPort.NameFromPortFilter(PortFilter.Emulator));
            DeployPropertyDevice = new ProjectBuildProperty("DeployDevice", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE, _PersistStorageType.PST_PROJECT_FILE);

            GenerateStubsFlag      = new ProjectBuildPropertyBool("MF_GenerateStubs", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE);
            GenerateStubsRootName  = new ProjectBuildProperty("MF_GenerateStubsRootName", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE, _PersistStorageType.PST_PROJECT_FILE, "TARGET");
            GenerateStubsDirectory = new ProjectBuildProperty("MF_GenerateStubsDirectory", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE, _PersistStorageType.PST_PROJECT_FILE, "DIRECTORY");

            try
            {
                ActivateDebugEngine();
            }
            catch (Exception e)
            {
                VsPackage.MessageCentre.InternalErrorMsg(false, String.Format("Unable to register debug engine: {0}", e.Message));
            }
        }
        int IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(
            IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
        {
            //
            //   if clean project or solution,   dwAction == 0x100000
            //   if build project or solution,   dwAction == 0x010000
            //   if rebuild project or solution, dwAction == 0x410000
            //
            if (dwAction == 0x010000 ||
                dwAction == 0x410000)
            {
                var validationSuccessful =
                    VisualStudioEdmxValidator.LoadAndValidateAllFilesInProject(
                        pHierProj, /*doEscherValidation*/ false, ShouldValidateArtifactDuringBuild);

                // we cause a 'build break' for command-line builds by setting PfCancel = 1
                if (PackageManager.Package.IsBuildingFromCommandLine &&
                    !validationSuccessful)
                {
                    pfCancel = 1;
                }
            }

            return(VSConstants.S_OK);
        }
Ejemplo n.º 8
0
        public int UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
        {
            if (this.allTasksCleanedDuringThisSolutionUpdate)
            {
                return(0);
            }

            var  start    = DateTime.Now;
            bool cleanAll = false;
            VSSOLNBUILDUPDATEFLAGS flags = (VSSOLNBUILDUPDATEFLAGS)dwAction;

            if ((flags & VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_FORCE_UPDATE) != 0)
            {
                cleanAll = true;
            }
            if (cleanAll)
            {
                this.allTasksCleanedDuringThisSolutionUpdate = true;
                tools.ClearTasks();
            }
            else
            {
                tools.ClearTasksOnHierarchy(pHierProj);
            }
            Debug.WriteLine("UpdateProjectCfg_Begin: {0}", ElapsedSince(start));

            return(0);
        }
        public VsProjectFlavorCfg(VsProject project, IVsCfg baseCfg)
        {
            m_vsCfg = baseCfg;
            m_project = project;

            m_innerIVsDebuggableProjectCfg = m_vsCfg as IVsDebuggableProjectCfg;
            m_IVsBuildPropertyStorage = m_project as IVsBuildPropertyStorage;

            Debug.Assert(m_innerIVsDebuggableProjectCfg != null);

            m_connectionsDeployStatusCallback = new ConnectionPoint.Connections();

            DeployPropertyPort = new ProjectBuildProperty("DeployTransport", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE, _PersistStorageType.PST_PROJECT_FILE, DebugPort.NameFromPortFilter(PortFilter.Emulator));
            DeployPropertyDevice = new ProjectBuildProperty("DeployDevice", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE, _PersistStorageType.PST_PROJECT_FILE);

            GenerateStubsFlag = new ProjectBuildPropertyBool("MF_GenerateStubs", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE);
            GenerateStubsRootName = new ProjectBuildProperty("MF_GenerateStubsRootName", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE, _PersistStorageType.PST_PROJECT_FILE, "TARGET");
            GenerateStubsDirectory = new ProjectBuildProperty("MF_GenerateStubsDirectory", m_IVsBuildPropertyStorage, this, _PersistStorageType.PST_USER_FILE, _PersistStorageType.PST_PROJECT_FILE, "DIRECTORY");

            try
            {
                ActivateDebugEngine();
            }
            catch (Exception e)
            {
                VsPackage.MessageCentre.InternalErrorMsg(false, String.Format("Unable to register debug engine: {0}", e.Message));
            }
        }
 internal static SampSharpFlavorConfig GetSampSharpFlavorCfgFromVsCfg(IVsCfg configuration)
 {
     if (Configs.ContainsKey(configuration))
         return Configs[configuration];
     throw new ArgumentOutOfRangeException(nameof(configuration),
         $"Cannot find configuration in {nameof(Configs)}.");
 }
Ejemplo n.º 11
0
            public int UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
            {
                const bool isSuccess = true;

                OnProjectUpdate(true, pHierProj, dwAction, isSuccess);

                return(VSConstants.S_OK);
            }
 /// <summary>
 /// Initialize the CustomPropertyPageProjectFlavorCfg instance.
 /// </summary>
 public void Initialize(CustomPropertyPageProjectFlavor project,
                        IVsCfg baseConfiguration, IVsProjectFlavorCfg innerConfiguration)
 {
     this.project            = project;
     this.baseConfiguration  = baseConfiguration;
     this.innerConfiguration = innerConfiguration;
     mapIVsCfgToCustomPropertyPageProjectFlavorCfg.Add(baseConfiguration, this);
 }
        public int OnBeforeActiveSolutionCfgChange(IVsCfg pOldActiveSlnCfg, IVsCfg pNewActiveSlnCfg)
        {
            string solutionConfiguration;

            pNewActiveSlnCfg.get_DisplayName(out solutionConfiguration);
            MainSite.BeforeChangeActiveSolutionConfiguration(solutionConfiguration);
            return(VSConstants.S_OK);
        }
		int IVsCfgProvider2.GetCfgOfName(string pszCfgName, string pszPlatformName, out IVsCfg ppCfg)
		{
			Tracer.Assert(pszPlatformName == null || pszPlatformName.Length == 0, "We don't support platforms, so the environment shouldn't be sending us a platform name.");
			ppCfg = this.ProjectConfigurations[pszCfgName];

			// If we didn't find a configuration return DISP_E_MEMBERNOTFOUND.
			return (ppCfg != null ? NativeMethods.S_OK : NativeMethods.DISP_E_MEMBERNOTFOUND);
		}
Ejemplo n.º 15
0
 public NodejsUwpProjectFlavorCfg(NodejsUwpProjectFlavor baseProjectNode, IVsCfg baseConfiguration, IVsProjectFlavorCfg innerConfiguration)
 {
     _baseCfg  = baseConfiguration;
     _innerCfg = innerConfiguration;
     project   = baseProjectNode;
     mapIVsCfgToNodejsUwpProjectFlavorCfg.Add(baseConfiguration, this);
     serviceProvider = this.project as System.IServiceProvider;
 }
        public int UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
        {
            Debug.Assert(_activeSolutionCancellationTokenSource != null, "We should not get build events when there is no active solution");

            CurrentUpdateTaskForTests = OnProjectBuiltAsync(pHierProj, _activeSolutionCancellationTokenSource?.Token ?? CancellationToken.None);

            return(VSConstants.S_OK);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Binding 'POST' of Projects
        /// </summary>
        public int bindProjectPost(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
        {
#if VSSDK_15_AND_NEW
            ThreadHelper.ThrowIfNotOnUIThread(); //TODO: upgrade to 15
#endif

            onProject(pHierProj, ExecutionOrderType.After, fSuccess == 1 ? true : false);
            return(Codes.Success);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Binding 'PRE' of Projects
        /// </summary>
        public int bindProjectPre(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
        {
#if VSSDK_15_AND_NEW
            ThreadHelper.ThrowIfNotOnUIThread(); //TODO: upgrade to 15
#endif

            onProject(pHierProj, ExecutionOrderType.Before);
            return(Codes.Success);
        }
Ejemplo n.º 19
0
            public int UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
            {
                const int updateActionFailed = 0;
                bool      isSuccess          = (fSuccess != updateActionFailed);

                OnProjectUpdate(false, pHierProj, dwAction, isSuccess);

                return(VSConstants.S_OK);
            }
        public int CreateProjectFlavorCfg(IVsCfg baseProjectCfg, out IVsProjectFlavorCfg flavoredProjectCfg)
        {
            IVsProjectFlavorCfg config;

            _innerCfgProvider.CreateProjectFlavorCfg(baseProjectCfg, out config);

            flavoredProjectCfg = new SampSharpFlavorConfig(this, baseProjectCfg, config);
            return(VSConstants.S_OK);
        }
Ejemplo n.º 21
0
        public int CreateProjectFlavorCfg(IVsCfg baseProjectCfg, out IVsProjectFlavorCfg flavoredProjectCfg)
        {
            IVsProjectFlavorCfg cfg;

            innerCfgProvider.CreateProjectFlavorCfg(baseProjectCfg, out cfg);

            flavoredProjectCfg = new MonoProgramFlavorCfg(this, baseProjectCfg, cfg);
            return(VSConstants.S_OK);
        }
Ejemplo n.º 22
0
        int IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(IVsHierarchy proj, IVsCfg cfgProj, IVsCfg cfgSln, uint action, ref int cancel)
        {
            // This method is called when a specific project begins building.

            // if clean project or solution,   dwAction == 0x100000
            // if build project or solution,   dwAction == 0x010000
            // if rebuild project or solution, dwAction == 0x410000
            return(VSConstants.S_OK);
        }
Ejemplo n.º 23
0
        int IVsUpdateSolutionEvents2.UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
        {
            // This method is called when a specific project finishes building.
            var project = GetProject(pHierProj);

            monitor.ProjectBuildStop(project);

            return(VSConstants.S_OK);
        }
Ejemplo n.º 24
0
        int IVsUpdateSolutionEvents2.UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
        {
            // This method is called when a specific project begins building.
            var project = GetProject(pHierProj);

            monitor.ProjectBuildStart(project);

            return(VSConstants.S_OK);
        }
Ejemplo n.º 25
0
 public int UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
 {
     try {
         return(library.Event.onProjectPost(pHierProj, pCfgProj, pCfgSln, dwAction, fSuccess, fCancel));
     }
     finally {
         termination();
     }
 }
Ejemplo n.º 26
0
 public int UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
 {
     try {
         return(library.Event.onProjectPre(pHierProj, pCfgProj, pCfgSln, dwAction, ref pfCancel));
     }
     finally {
         termination();
     }
 }
Ejemplo n.º 27
0
        private void SolutionEventsListener_AfterActiveConfigurationChange(IVsCfg oldConfiguration, IVsCfg newConfiguration)
        {
            if (configurationLock || newConfiguration is null)
            {
                return;
            }

            UpdateStartupProjectFromConfiguration();
        }
Ejemplo n.º 28
0
 public override int GetCfgOfName(string name, string platName, out IVsCfg cfg)
 {
     if (name.IndexOf("|") >= 0)
     {
         var elements = name.Split("|".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
         name     = elements[0];
         platName = elements[1];
     }
     return(base.GetCfgOfName(name, platName, out cfg));
 }
        int IVsUpdateSolutionEvents2.UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
        {
            var name = GetNameProperty(pHierProj);
            var folder = GetProjectDirectoryProperty(pHierProj);
                
            if (!string.IsNullOrEmpty(name))
                BuildFinishedEvent(this, new SolutionBuildFinishedEvent() { ProjectName = name, ProjectFolder = folder });

            return VSConstants.S_OK;
        }
Ejemplo n.º 30
0
 public void GetCfgOfName(string name, string platName, out IVsCfg cfg) { 
   CCITracing.TraceCall();
   cfg = null;
   foreach (XmlElement e in this.projectManager.StateElement.SelectNodes("Build/Settings/Config")) {
     if (name == e.GetAttribute("Name")) {
       cfg = new ProjectConfig(this.projectManager, e);
       break;
     }
   }
 }
Ejemplo n.º 31
0
        int IVsUpdateSolutionEvents3.OnAfterActiveSolutionCfgChange(IVsCfg pOldActiveSlnCfg, IVsCfg pNewActiveSlnCfg)
        {
            var evt = ActiveSolutionConfigurationChanged;

            if (evt != null)
            {
                evt(this, EventArgs.Empty);
            }
            return(VSConstants.S_OK);
        }
Ejemplo n.º 32
0
        /// <summary>
        /// Fired after the active solution config is changed (pOldActiveSlnCfg can be NULL).
        /// </summary>
        /// <param name="oldActiveSlnCfg">Old configuration.</param>
        /// <param name="newActiveSlnCfg">New configuration.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public virtual int OnAfterActiveSolutionCfgChange(IVsCfg oldActiveSlnCfg, IVsCfg newActiveSlnCfg)
        {
            var handlers = AfterActiveSolutionConfigurationChange;

            if (handlers != null)
            {
                handlers(this, EventArgs.Empty);
            }
            return(VSConstants.S_OK);
        }
Ejemplo n.º 33
0
 internal static NodejsUwpProjectFlavorCfg GetPropertyPageFromIVsCfg(IVsCfg configuration)
 {
     if (mapIVsCfgToNodejsUwpProjectFlavorCfg.ContainsKey(configuration))
     {
         return((NodejsUwpProjectFlavorCfg)mapIVsCfgToNodejsUwpProjectFlavorCfg[configuration]);
     }
     else
     {
         throw new ArgumentOutOfRangeException("Cannot find configuration in mapIVsCfgToSpecializedCfg.");
     }
 }
Ejemplo n.º 34
0
 internal static MonoProgramFlavorCfg GetMonoProgramFlavorCfgFromVsCfg(IVsCfg configuration)
 {
     if (cfgs.ContainsKey(configuration))
     {
         return(cfgs[configuration]);
     }
     else
     {
         throw new ArgumentOutOfRangeException(nameof(configuration), $"Cannot find configuration in {nameof(cfgs)}.");
     }
 }
 internal static ACSPropertyPageProjectFlavorCfg GetACSPropertyPageProjectFlavorCfgFromIVsCfg(IVsCfg configuration)
 {
     if (mapIVsCfgToACSPropertyPageProjectFlavorCfg.ContainsKey(configuration))
     {
         return (ACSPropertyPageProjectFlavorCfg)mapIVsCfgToACSPropertyPageProjectFlavorCfg[configuration];
     }
     else
     {
         throw new ArgumentOutOfRangeException("Cannot find configuration in mapIVsCfgToSpecializedCfg.");
     }
 }
        /// <summary>
        /// This is overridden to open the help file after a successful build or the log viewer tool window
        /// after a failed build if so indicated by the Sandcastle Help File Builder options.
        /// </summary>
        /// <inheritdoc />
        /// <remarks>Note that the base method documentation is wrong.  The action parameter is actually a
        /// combination of VSSOLNBUILDUPDATEFLAGS values.</remarks>
        public override int UpdateProjectCfg_Done(IVsHierarchy hierarchy, IVsCfg configProject,
          IVsCfg configSolution, uint action, int success, int cancel)
        {
            SandcastleBuilderProjectNode projectNode;
            SandcastleBuilderOptionsPage options;
            ProjectConfig cfg = configProject as ProjectConfig;

            if(cfg != null)
            {
                if(cancel == 0 && success != 0)
                {
                    // Open the help file on a successful build if so requested
                    projectNode = cfg.ProjectMgr as SandcastleBuilderProjectNode;
                    options = SandcastleBuilderPackage.Instance.GeneralOptions;

                    if(projectNode != null && options != null)
                        if((action & (uint)VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_BUILD) != 0 && options.OpenHelpAfterBuild)
                            SandcastleBuilderPackage.Instance.ViewBuiltHelpFile(projectNode);
                        else
                            if((action & (uint)VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_CLEAN) != 0)
                            {
                                var window = cfg.ProjectMgr.Package.FindToolWindow(typeof(ToolWindows.BuildLogToolWindow), 0, false) as
                                    BuildLogToolWindow;

                                if(window != null)
                                    window.ClearLog();
                            }
                }
                else
                    if(cancel == 0 && success == 0)
                    {
                        // Open the build log tool window on a failed build if so requested
                        projectNode = cfg.ProjectMgr as SandcastleBuilderProjectNode;
                        options = SandcastleBuilderPackage.Instance.GeneralOptions;

                        if(projectNode != null && options != null)
                            if((action & (uint)VSSOLNBUILDUPDATEFLAGS.SBF_OPERATION_BUILD) != 0 && options.OpenLogViewerOnFailedBuild)
                                projectNode.OpenBuildLogToolWindow(true);
                            else
                            {
                                // The user doesn't want it opened.  However, if it's already open, refresh the
                                // log file reference so that it shows the correct file when it is displayed.
                                var window = cfg.ProjectMgr.Package.FindToolWindow(typeof(ToolWindows.BuildLogToolWindow), 0, false) as
                                    BuildLogToolWindow;

                                if(window != null && ((IVsWindowFrame)window.Frame).IsVisible() == VSConstants.S_OK)
                                    projectNode.OpenBuildLogToolWindow(false);
                            }
                    }
            }

            return VSConstants.S_OK;
        }
Ejemplo n.º 37
0
        public override int GetCfgOfName(string name, string platName, out IVsCfg cfg)
        {
            if (!string.IsNullOrEmpty(platName))
            {
                cfg = this.GetProjectConfiguration(name + "|" + platName);

                return(VSConstants.S_OK);
            }
            cfg = this.GetProjectConfiguration(name);

            return(VSConstants.S_OK);
        }
Ejemplo n.º 38
0
        public int CreateProjectFlavorCfg(IVsCfg pBaseProjectCfg, out IVsProjectFlavorCfg ppFlavorCfg)
        {
            IVsProjectFlavorCfg cfg;
            ErrorHandler.ThrowOnFailure(
                _innerVsProjectFlavorCfgProvider.CreateProjectFlavorCfg(
                    pBaseProjectCfg,
                    out cfg
                )
            );

            ppFlavorCfg = _config = new NodejsUwpProjectFlavorCfg(this, pBaseProjectCfg, cfg);
            return VSConstants.S_OK;
        }
        int IVsCfgProvider2.GetCfgOfName(string pszCfgName, string pszPlatformName, out IVsCfg ppCfg)
        {
            Tracer.Assert(pszPlatformName == null || pszPlatformName.Length == 0, "We don't support platforms, so the environment shouldn't be sending us a platform name.");
            ppCfg = this.ProjectConfigurations[pszCfgName];

            // If we didn't find a configuration return DISP_E_MEMBERNOTFOUND.
            return (ppCfg != null ? NativeMethods.S_OK : NativeMethods.DISP_E_MEMBERNOTFOUND);
        }
Ejemplo n.º 40
0
        protected void PersistXMLFragments()
        {
            if (this.IsFlavorDirty() != 0)
            {
                XmlDocument doc = new XmlDocument();
                XmlElement root = doc.CreateElement("ROOT");

                // We will need the list of configuration inside the loop, so get it before entering the loop
                uint[] count = new uint[1];
                IVsCfg[] configs = null;
                int hr = this.ConfigProvider.GetCfgs(0, null, count, null);
                if (ErrorHandler.Succeeded(hr) && count[0] > 0)
                {
                    configs = new IVsCfg[count[0]];
                    hr = this.ConfigProvider.GetCfgs((uint)configs.Length, configs, count, null);
                    if (ErrorHandler.Failed(hr))
                        count[0] = 0;
                }
                if (count[0] == 0)
                    configs = new IVsCfg[0];

                // We need to loop through all the flavors
                string flavorsGuid;
                ErrorHandler.ThrowOnFailure(((IVsAggregatableProject)this).GetAggregateProjectTypeGuids(out flavorsGuid));
                foreach (Guid flavor in Utilities.GuidsArrayFromSemicolonDelimitedStringOfGuids(flavorsGuid))
                {
                    IPersistXMLFragment outerHierarchy = HierarchyNode.GetOuterHierarchy(this) as IPersistXMLFragment;
                    // First check the project
                    if (outerHierarchy != null)
                    {
                        // Retrieve the XML fragment
                        string fragment = string.Empty;
                        Guid flavorGuid = flavor;
                        ErrorHandler.ThrowOnFailure((outerHierarchy).Save(ref flavorGuid, (uint)_PersistStorageType.PST_PROJECT_FILE, out fragment, 1));
                        if (!String.IsNullOrEmpty(fragment))
                        {
                            // Add the fragment to our XML
                            WrapXmlFragment(doc, root, flavor, null, fragment);
                        }
                        // While we don't yet support user files, our flavors might, so we will store that in the project file until then
                        // TODO: Refactor this code when we support user files
                        fragment = String.Empty;
                        ErrorHandler.ThrowOnFailure((outerHierarchy).Save(ref flavorGuid, (uint)_PersistStorageType.PST_USER_FILE, out fragment, 1));
                        if (!String.IsNullOrEmpty(fragment))
                        {
                            // Add the fragment to our XML
                            XmlElement node = WrapXmlFragment(doc, root, flavor, null, fragment);
                            node.Attributes.Append(doc.CreateAttribute(ProjectFileConstants.User));
                        }
                    }

                    // Then look at the configurations
                    foreach (IVsCfg config in configs)
                    {
                        // Get the fragment for this flavor/config pair
                        string fragment;
                        ErrorHandler.ThrowOnFailure(((ProjectConfig)config).GetXmlFragment(flavor, _PersistStorageType.PST_PROJECT_FILE, out fragment));
                        if (!String.IsNullOrEmpty(fragment))
                        {
                            string configName;
                            ErrorHandler.ThrowOnFailure(config.get_DisplayName(out configName));
                            WrapXmlFragment(doc, root, flavor, configName, fragment);
                        }
                    }
                }
                if (root.ChildNodes != null && root.ChildNodes.Count > 0)
                {
                    // Save our XML (this is only the non-build information for each flavor) in msbuild
                    SetProjectExtensions(ProjectFileConstants.VisualStudio, root.InnerXml.ToString());
                }
            }
        }
Ejemplo n.º 41
0
 public int CreateProjectFlavorCfg(IVsCfg pBaseProjectCfg, out IVsProjectFlavorCfg ppFlavorCfg) {
     // We're flavored with a Web Application project and our normal
     // project...  But we don't want the web application project to
     // influence our config as that alters our debug launch story.  We
     // control that w/ the web project which is actually just letting
     // the base Python project handle it. So we keep the base Python
     // project config here.
     IVsProjectFlavorCfg webCfg;
     ErrorHandler.ThrowOnFailure(
         _innerVsProjectFlavorCfgProvider.CreateProjectFlavorCfg(
             pBaseProjectCfg,
             out webCfg
         )
     );
     ppFlavorCfg = new PythonWebProjectConfig(pBaseProjectCfg, webCfg);
     return VSConstants.S_OK;
 }
Ejemplo n.º 42
0
        /// <summary>
        /// Returns the configuration associated with a specified configuration or platform name. 
        /// </summary>
        /// <param name="name">The name of the configuration to be returned.</param>
        /// <param name="platName">The name of the platform for the configuration to be returned.</param>
        /// <param name="cfg">The implementation of the IVsCfg interface.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public override int GetCfgOfName(string name, string platName, out IVsCfg cfg)
        {
            cfg = this.GetProjectConfiguration(name, platName);

            return VSConstants.S_OK;
        }
Ejemplo n.º 43
0
 public int UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel)
 {
     return VSConstants.S_OK;
 }
Ejemplo n.º 44
0
 /// <summary>
 /// Called right before a project configuration begins to build. 
 /// </summary>
 /// <param name="hierarchy">The project that is to be build.</param>
 /// <param name="configProject">A configuration project object.</param>
 /// <param name="configSolution">A configuration solution object.</param>
 /// <param name="action">The action taken.</param>
 /// <param name="cancel">A flag indicating cancel.</param>
 /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
 /// <remarks>The values for the action are defined in the enum _SLNUPDACTION env\msenv\core\slnupd2.h</remarks>
 public int UpdateProjectCfg_Begin(IVsHierarchy hierarchy, IVsCfg configProject, IVsCfg configSolution, uint action, ref int cancel) {
     return VSConstants.E_NOTIMPL;
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Fired after the active solution config is changed (pOldActiveSlnCfg can be NULL).
 /// </summary>
 /// <param name="oldActiveSlnCfg">Old configuration.</param>
 /// <param name="newActiveSlnCfg">New configuration.</param>
 /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
 public virtual int OnAfterActiveSolutionCfgChange(IVsCfg oldActiveSlnCfg, IVsCfg newActiveSlnCfg) {
     var handlers = AfterActiveSolutionConfigurationChange;
     if (handlers != null) {
         handlers(this, EventArgs.Empty);
     }
     return VSConstants.S_OK;
 }
        public NodejsUwpProjectFlavorCfg(NodejsUwpProjectFlavor baseProjectNode, IVsCfg baseConfiguration, IVsProjectFlavorCfg innerConfiguration)
        {
            _baseCfg = baseConfiguration;
            _innerCfg = innerConfiguration;
            project = baseProjectNode;
            mapIVsCfgToNodejsUwpProjectFlavorCfg.Add(baseConfiguration, this);
            serviceProvider = this.project as System.IServiceProvider;

            packagesToDeployList = new VsBootstrapperPackageInfo[] {
                new VsBootstrapperPackageInfo { PackageName = "D8B19935-BDBF-4D5B-9619-A6693AFD4554" }, // ScriptMsVsMon
                new VsBootstrapperPackageInfo { PackageName = "EB22551A-7F66-465F-B53F-E5ABA0C0574E" }, // NativeMsVsMon  
                new VsBootstrapperPackageInfo { PackageName = "62B807E2-6539-46FB-8D67-A73DC9499940" } // ManagedMsVsMon  
            };
            optionalPackagesToDeploy = new VsBootstrapperPackageInfo[] {
                new VsBootstrapperPackageInfo { PackageName = "FEC73B34-86DE-4EA8-BFF4-3600A0443E9C" }, // NativeMsVsMonDependency  
                new VsBootstrapperPackageInfo { PackageName = "B968CC6A-D2C8-4197-88E3-11662042C291" }, // XamlUIDebugging  
                new VsBootstrapperPackageInfo { PackageName = "8CDEABEF-33E1-4A23-A13F-94A49FF36E84" }  // XamlUIDebuggingDependency  
            };
        }
        int IVsCfgProvider2.GetCfgs(uint celt, IVsCfg[] rgpcfg, uint[] pcActual, uint[] prgfFlags)
        {
            // prgfFlags is ignored because according to the documentation, the flags are currently not used.

            if (celt == 0)
            {
                // When celt (the count of elements) is zero, then the caller is requesting the
                // total size of the array, which will be returned in pcActual.
                pcActual[0] = (uint)this.ProjectConfigurations.Count;
            }
            else
            {
                // If celt is non-zero, but the array is null, then we've got a problem.
                Tracer.VerifyNonNullArgument(rgpcfg, "rgpcfg");

                // celt could very well be larger than our array, so we have to stop looping
                // when celt or Count is reached, whichever is lower.
                int totalToRetrieve = Math.Min((int)celt, this.ProjectConfigurations.Count);
                for (int i = 0; i < totalToRetrieve; i++)
                {
                    rgpcfg[i] = (IVsCfg)this.ProjectConfigurations[i];
                }
                pcActual[0] = (uint)totalToRetrieve;
            }

            return NativeMethods.S_OK;
        }
 public int GetCfg(out IVsCfg ppCfg)
 {
     ppCfg = this;
     return VSConstants.S_OK;
 }
 int IVsProjectCfgProvider.GetCfgs(uint celt, IVsCfg[] rgpcfg, uint[] pcActual, uint[] prgfFlags)
 {
     return ((IVsCfgProvider2)this).GetCfgs(celt, rgpcfg, pcActual, prgfFlags);
 }
Ejemplo n.º 50
0
        public override int GetCfgOfName(string name, string platName, out IVsCfg cfg) {
            if (!string.IsNullOrEmpty(platName)) {
                cfg = this.GetProjectConfiguration(name + "|" + platName);

                return VSConstants.S_OK;
            }
            cfg = this.GetProjectConfiguration(name);

            return VSConstants.S_OK;
        }
Ejemplo n.º 51
0
 /// <summary>
 /// Maps back to the configuration corresponding to the browse object. 
 /// </summary>
 /// <param name="cfg">The IVsCfg object represented by the browse object</param>
 /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code. </returns>
 public virtual int GetCfg(out IVsCfg cfg)
 {
     cfg = this;
     return VSConstants.S_OK;
 }
Ejemplo n.º 52
0
        public override int GetCfgs(uint celt, IVsCfg[] a, uint[] actual, uint[] flags) {
            if (_isPlatformAware) {
                if (flags != null) {
                    flags[0] = 0;
                }

                int i = 0;
                string[] configList = GetPropertiesConditionedOn(ProjectFileConstants.Configuration);
                string[] platformList = GetSupportedPlatformsFromProject();

                if (a != null) {
                    foreach (string platformName in platformList) {
                        foreach (string configName in configList) {
                            a[i] = this.GetProjectConfiguration(configName + "|" + platformName);
                            i++;
                            if (i == celt) {
                                break;
                            }
                        }
                        if(i == celt) {
                            break;
                        }
                    }
                }
                else {
                    i = configList.Length * platformList.Length;
                }

                if (actual != null) {
                    actual[0] = (uint)i;
        }

                return VSConstants.S_OK;
            }

            return base.GetCfgs(celt, a, actual, flags);
            }
Ejemplo n.º 53
0
 /// <summary>
 /// Fired before the active solution config is changed (pOldActiveSlnCfg can be NULL
 /// </summary>
 /// <param name="oldActiveSlnCfg">Old configuration.</param>
 /// <param name="newActiveSlnCfg">New configuration.</param>
 /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
 public virtual int OnBeforeActiveSolutionCfgChange(IVsCfg oldActiveSlnCfg, IVsCfg newActiveSlnCfg) {
     return VSConstants.E_NOTIMPL;
 }
Ejemplo n.º 54
0
 int IVsUpdateSolutionEvents3.OnBeforeActiveSolutionCfgChange(IVsCfg pOldActiveSlnCfg, IVsCfg pNewActiveSlnCfg)
 {
     return VSConstants.S_OK;
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Called right after a project configuration is finished building. 
 /// </summary>
 /// <param name="hierarchy">The project that has finished building.</param>
 /// <param name="configProject">A configuration project object.</param>
 /// <param name="configSolution">A configuration solution object.</param>
 /// <param name="action">The action taken.</param>
 /// <param name="success">Flag indicating success.</param>
 /// <param name="cancel">Flag indicating cancel.</param>
 /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
 /// <remarks>The values for the action are defined in the enum _SLNUPDACTION env\msenv\core\slnupd2.h</remarks>
 public virtual int UpdateProjectCfg_Done(IVsHierarchy hierarchy, IVsCfg configProject, IVsCfg configSolution, uint action, int success, int cancel) {
     return VSConstants.E_NOTIMPL;
 }
Ejemplo n.º 56
0
 int IVsUpdateSolutionEvents3.OnAfterActiveSolutionCfgChange(IVsCfg pOldActiveSlnCfg, IVsCfg pNewActiveSlnCfg)
 {
     AfterActiveConfigurationChange?.Invoke(pOldActiveSlnCfg, pNewActiveSlnCfg);
     return VSConstants.S_OK;
 }
Ejemplo n.º 57
0
 public int UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel)
 {
     return VSConstants.S_OK;
 }
Ejemplo n.º 58
0
        int IVsProjectFlavorCfgProvider.CreateProjectFlavorCfg(IVsCfg pBaseProjectCfg, out IVsProjectFlavorCfg ppFlavorCfg)
        {
            // Our config object is also our IVsProjectFlavorCfg object
            ppFlavorCfg = pBaseProjectCfg as IVsProjectFlavorCfg;

            return VSConstants.S_OK;
        }
Ejemplo n.º 59
0
        /// <summary>
        /// Returns the per-configuration objects for this object. 
        /// </summary>
        /// <param name="celt">Number of configuration objects to be returned or zero, indicating a request for an unknown number of objects.</param>
        /// <param name="a">On input, pointer to an interface array or a null reference. On output, this parameter points to an array of IVsCfg interfaces belonging to the requested configuration objects.</param>
        /// <param name="actual">The number of configuration objects actually returned or a null reference, if this information is not necessary.</param>
        /// <param name="flags">Flags that specify settings for project configurations, or a null reference (Nothing in Visual Basic) if no additional flag settings are required. For valid prgrFlags values, see __VSCFGFLAGS.</param>
        /// <returns>If the method succeeds, it returns S_OK. If it fails, it returns an error code.</returns>
        public override int GetCfgs(uint celt, IVsCfg[] a, uint[] actual, uint[] flags)
        {
            if (flags != null)
            {
                flags[0] = 0;
            }

            int i = 0;
            string[] configList = this.GetConfigurations();
            string[] platformList = this.GetPlatforms();

            if (a != null)
            {
                foreach (string config in configList)
                {
                    foreach (string platform in platformList)
                    {
                        if (i < celt)
                        {
                            a[i] = this.GetProjectConfiguration(config, platform);
                            i++;
                        }
                    }
                }
            }
            else
            {
                i = configList.Length * platformList.Length;
            }

            if (actual != null)
            {
                actual[0] = (uint)i;
            }

            return VSConstants.S_OK;
        }
Ejemplo n.º 60
0
 protected int IsFlavorDirty()
 {
     int isDirty = 0;
     // See if one of our flavor consider us dirty
     IPersistXMLFragment outerHierarchy = HierarchyNode.GetOuterHierarchy(this) as IPersistXMLFragment;
     if (outerHierarchy != null)
     {
         // First check the project
         ErrorHandler.ThrowOnFailure(outerHierarchy.IsFragmentDirty((uint)_PersistStorageType.PST_PROJECT_FILE, out isDirty));
         // While we don't yet support user files, our flavors might, so we will store that in the project file until then
         // TODO: Refactor this code when we support user files
         if (isDirty == 0)
             ErrorHandler.ThrowOnFailure(outerHierarchy.IsFragmentDirty((uint)_PersistStorageType.PST_USER_FILE, out isDirty));
     }
     if (isDirty == 0)
     {
         // Then look at the configurations
         uint[] count = new uint[1];
         int hr = this.ConfigProvider.GetCfgs(0, null, count, null);
         if (ErrorHandler.Succeeded(hr) && count[0] > 0)
         {
             // We need to loop through the configurations
             IVsCfg[] configs = new IVsCfg[count[0]];
             hr = this.ConfigProvider.GetCfgs((uint)configs.Length, configs, count, null);
             Debug.Assert(ErrorHandler.Succeeded(hr), "failed to retrieve configurations");
             foreach (IVsCfg config in configs)
             {
                 isDirty = ((ProjectConfig)config).IsFlavorDirty(_PersistStorageType.PST_PROJECT_FILE);
                 if (isDirty != 0)
                     break;
             }
         }
     }
     return isDirty;
 }