コード例 #1
0
 public ConanOptions(
     IMenuCommandService commandService,
     Core.IErrorListService errorListService,
     OptionsDelegate optionsDelegate)
     : base(commandService, errorListService)
 {
     _optionsDelegate = optionsDelegate;
 }
コード例 #2
0
        public MenuCommandBase(IMenuCommandService commandService, Core.IErrorListService errorListService)
        {
            _errorListService = errorListService;
            var menuCommandId = new CommandID(PackageGuids.guidVSConanPackageCmdSet, CommandId);

            _menuCommand = new OleMenuCommand(MenuItemCallback, menuCommandId);
            _menuCommand.BeforeQueryStatus += new EventHandler(OnBeforeQueryStatus);
            commandService.AddCommand(_menuCommand);
        }
コード例 #3
0
 public AddConanDependsSolution(
     IMenuCommandService commandService,
     Core.IErrorListService errorListService,
     IVcProjectService vcProjectService,
     IConanService conanService) : base(commandService, errorListService)
 {
     _vcProjectService = vcProjectService;
     _errorListService = errorListService;
     _conanService     = conanService;
 }
コード例 #4
0
 public AddConanDependsConanfile(
     IMenuCommandService commandService,
     Core.IErrorListService errorListService,
     IVcProjectService vcProjectService,
     IConanService conanService) : base(commandService, errorListService)
 {
     _errorListService = errorListService;
     _vcProjectService = vcProjectService;
     _conanService     = conanService;
     _dte2             = Package.GetGlobalService(typeof(SDTE)) as DTE2;
 }
コード例 #5
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initialization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress)
        {
            await base.InitializeAsync(cancellationToken, progress);

            _dte = await GetServiceAsync <DTE>();

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            _solution = await GetServiceAsync <SVsSolution>() as IVsSolution;

            _solutionBuildManager = await GetServiceAsync <IVsSolutionBuildManager>() as IVsSolutionBuildManager3;

            var serviceProvider = new ServiceProvider((Microsoft.VisualStudio.OLE.Interop.IServiceProvider)_dte);

            await TaskScheduler.Default;

            var commandService = await GetServiceAsync <IMenuCommandService>();

            _vcProjectService = new VcProjectService();
            _settingsService  = new VisualStudioSettingsService(this);
            _errorListService = new ErrorListService();
            _conanService     = new ConanService(_settingsService, _errorListService, _vcProjectService);

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            _solutionEventsHandler = new SolutionEventsHandler(this);
            _solution.AdviseSolutionEvents(_solutionEventsHandler, out var _solutionEventsCookie);

            _addConanDependsProject   = new AddConanDependsProject(commandService, _errorListService, _vcProjectService, _conanService);
            _addConanDependsSolution  = new AddConanDependsSolution(commandService, _errorListService, _vcProjectService, _conanService);
            _addConanDependsConanfile = new AddConanDependsConanfile(commandService, _errorListService, _vcProjectService, _conanService);

            _conanOptions = new ConanOptions(commandService, _errorListService, ShowOptionPage);

            await TaskScheduler.Default;

            Logger.Initialize(serviceProvider, "Conan");

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            SubscribeToEvents();

            EnableMenus(_dte.Solution != null && _dte.Solution.IsOpen);

            await TaskScheduler.Default;
        }
コード例 #6
0
 public string getProfile(ConanConfiguration configuration, Core.IErrorListService errorListService)
 {
     if (!File.Exists(ConfigFile))
     {
         return(null);
     }
     try
     {
         JObject jObject = JObject.Parse(File.ReadAllText(ConfigFile));
         var     configs = jObject["configurations"].ToObject <Dictionary <string, string> >();
         configs.TryGetValue(configuration.VSName, out string conanProfile);
         if (conanProfile == null)
         {
             errorListService.WriteWarning($"File for Conan configuration found at '{ConfigFile}'," +
                                           $" but no profile declared for VS configuration '{configuration.VSName}'");
         }
         return(conanProfile);
     }
     catch (Exception)
     {
         errorListService.WriteError($"Error parsing Conan configuration from file '{ConfigFile}'");
         return(null);
     }
 }
コード例 #7
0
 public ConanService(ISettingsService settingsService, Core.IErrorListService errorListService, IVcProjectService vcProjectService)
 {
     _settingsService  = settingsService;
     _errorListService = errorListService;
     _vcProjectService = vcProjectService;
 }
コード例 #8
0
        public Task <Process> Install(ConanProject project, ConanConfiguration configuration, ConanGeneratorType generator, ConanBuildType build, bool update, Core.IErrorListService errorListService)
        {
            string ProcessArgument(string name, string value) => $"-s {name}={Escape(value)}";

            var arguments = string.Empty;

            string profile = project.getProfile(configuration, errorListService);

            if (profile != null)
            {
                string generatorName = generator.ToString();
                string options       = "";
                if (build != ConanBuildType.none)
                {
                    options += " --build " + build.ToString();
                }
                if (update)
                {
                    options += " --update";
                }

                arguments = $"install {Escape(project.Path)} " +
                            $"-g {generatorName} " +
                            $"--install-folder {Escape(configuration.InstallPath)} " +
                            $"--profile {Escape(profile)}" +
                            $"{options}";
            }
            else if (_conanSettings != null)
            {
                var installConfig = _conanSettings.ConanCommands.FirstOrDefault(c => c.Name.Equals("install"));
                arguments = installConfig.Args;
            }
            else
            {
                string generatorName = generator.ToString();
                var    settingValues = new[]
コード例 #9
0
ファイル: ConanAbout.cs プロジェクト: tarc/conan-vs-extension
 public ConanAbout(
     IMenuCommandService commandService,
     Core.IErrorListService errorListService)
     : base(commandService, errorListService)
 {
 }
コード例 #10
0
        public ProcessStartInfo Install(ConanProject project, ConanConfiguration configuration, ConanGeneratorType generator, ConanBuildType build, bool update, Core.IErrorListService errorListService)
        {
            string ProcessArgument(string name, string value) => $"-s {name}={Escape(value)}";

            var arguments = string.Empty;

            string profile = project.getProfile(configuration, errorListService);

            if (profile != null)
            {
                string generatorName = generator.ToString();
                arguments = $"install {Escape(project.Path)} " +
                            $"-g {generatorName} " +
                            $"--install-folder {Escape(configuration.InstallPath)} " +
                            $"--profile {Escape(profile)}" +
                            $"{BuildOptions(build, update)}";
            }
            else
            {
                string generatorName = generator.ToString();
                var    settingValues = new[]