Esempio n. 1
0
        public ConanProject ExtractConanProject(VCProject vcProject, ISettingsService settingsService)
        {
            var projectPath = ConanPathHelper.GetNearestConanfilePath(vcProject.ProjectDirectory);

            if (projectPath == null)
            {
                return(null);
            }
            var project = new ConanProject
            {
                Path = projectPath,
            };

            if (settingsService != null && settingsService.GetConanInstallOnlyActiveConfiguration())
            {
                project.Configurations.Add(ExtractConanConfiguration(settingsService, vcProject.ActiveConfiguration));
            }
            else
            {
                foreach (VCConfiguration configuration in vcProject.Configurations)
                {
                    project.Configurations.Add(ExtractConanConfiguration(settingsService, configuration));
                }
            }
            return(project);
        }
Esempio n. 2
0
        public ConanProject ExtractConanProject(VCProject vcProject, ISettingsService settingsService)
        {
            var projectPath = ConanPathHelper.GetNearestConanfilePath(vcProject.ProjectDirectory); // TODO: Instead of nearest, use the one added to the project (be explicit)

            if (projectPath == null)
            {
                return(null);
            }

            string projectConanConfig = ConanPathHelper.GetNearestConanConfig(vcProject.ProjectDirectory);
            var    project            = new ConanProject
            {
                Path       = projectPath,
                ConfigFile = projectConanConfig
            };

            if (settingsService != null && settingsService.GetConanInstallOnlyActiveConfiguration())
            {
                project.Configurations.Add(ExtractConanConfiguration(settingsService, vcProject.ActiveConfiguration));
            }
            else
            {
                foreach (VCConfiguration configuration in vcProject.Configurations)
                {
                    project.Configurations.Add(ExtractConanConfiguration(settingsService, configuration));
                }
            }
            return(project);
        }
        public async Task GetNearestConanfilePathWorksForDiskRoot()
        {
            var dir  = FileSystemUtils.CreateTempDirectory();
            var root = Path.GetPathRoot(dir);

            FileSystemUtils.CreateTempFile(root, "conanfile.txt");
            Assert.Equal(root, await ConanPathHelper.GetNearestConanfilePath(dir));
            Assert.Equal(root, await ConanPathHelper.GetNearestConanfilePath(root));
        }
Esempio n. 4
0
        protected internal override async Task MenuItemCallback()
        {
            var project            = _vcProjectService.GetActiveProject();
            var projectDirectory   = project.ProjectDirectory;
            var conanfileDirectory = await ConanPathHelper.GetNearestConanfilePath(projectDirectory);

            var propFilePath         = Path.Combine(conanfileDirectory, @"conan\conanbuildinfo_multi.props");
            var relativePropFilePath = ConanPathHelper.GetRelativePath(projectDirectory, propFilePath);
            await _vcProjectService.AddPropsImport(project.ProjectFile, relativePropFilePath);
        }
        public async Task GetNearestConanfilePathReturnsParentPathIfValid()
        {
            var dir    = FileSystemUtils.CreateTempDirectory();
            var subdir = Path.Combine(dir, "test");

            Directory.CreateDirectory(subdir);

            FileSystemUtils.CreateTempFile(dir, "conanfile.txt");
            Assert.Equal(dir, await ConanPathHelper.GetNearestConanfilePath(subdir));
        }
        public async Task GetNearestConanfilePathReturnsCurrentPathIfValid()
        {
            var dir       = FileSystemUtils.CreateTempDirectory();
            var conanfile = FileSystemUtils.CreateTempFile(dir, "conanfile.txt");

            Assert.Equal(dir, await ConanPathHelper.GetNearestConanfilePath(dir));

            File.Delete(conanfile);
            FileSystemUtils.CreateTempFile(dir, "conanfile.py");
            Assert.Equal(dir, await ConanPathHelper.GetNearestConanfilePath(dir));
        }
        public async Task <ConanProject> ExtractConanProject(VCProject vcProject)
        {
            var projectPath = await ConanPathHelper.GetNearestConanfilePath(vcProject.ProjectDirectory);

            var project = new ConanProject
            {
                Path        = projectPath,
                InstallPath = Path.Combine(projectPath, "conan")
            };

            foreach (VCConfiguration configuration in vcProject.Configurations)
            {
                project.Configurations.Add(ExtractConanConfiguration(configuration));
            }

            return(project);
        }
Esempio n. 8
0
 public bool IsConanProject(Project project)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     return(IsCppProject(project) && null != ConanPathHelper.GetNearestConanfilePath(AsVCProject(project).ProjectDirectory));
 }
        public async Task GetNearestConanfilePathReturnsNullIfThereIsNoConanfile()
        {
            var dir = FileSystemUtils.CreateTempDirectory();

            Assert.Null(await ConanPathHelper.GetNearestConanfilePath(dir));
        }