Esempio n. 1
0
        public async Task ExtractConanProjectExtractsThePathsProperly()
        {
            var directory = FileSystemUtils.CreateTempDirectory();

            FileSystemUtils.CreateTempFile(directory, "conanfile.txt");
            var installPath = Path.Combine(directory, "conan");

            var vcProject = MockVcProject(directory);

            var project = await _service.ExtractConanProject(vcProject);

            Assert.Equal(directory, project.Path);
            Assert.Equal(installPath, project.InstallPath);
        }
        protected internal override async Task MenuItemCallback()
        {
            var vcProject = _vcProjectService.GetActiveProject();

            if (vcProject == null)
            {
                _dialogService.ShowPluginError("A C++ project with a conan file must be selected.");
                return;
            }

            if (!_dialogService.ShowOkCancel($"Process conanbuild.txt for '{vcProject.Name}'?\n"))
            {
                return;
            }

            var conanPath = _settingsService.GetConanExecutablePath();

            if (conanPath == null)
            {
                _dialogService.ShowPluginError(
                    "Conan executable path is not set and Conan executable wasn't found automatically. " +
                    "Please set it up in the Tools → Settings → Conan menu.");
                return;
            }

            var conan   = new ConanRunner(conanPath);
            var project = await _vcProjectService.ExtractConanProject(vcProject);

            await InstallDependencies(conan, project);
        }