public SupportedTargetFrameworksEnumProvider(IProjectXmlAccessor projectXmlAccessor, ConfiguredProject configuredProject) { Requires.NotNull(projectXmlAccessor, nameof(projectXmlAccessor)); Requires.NotNull(configuredProject, nameof(configuredProject)); _projectXmlAccessor = projectXmlAccessor; _configuredProject = configuredProject; }
public async Task PlatformProjectConfigurationDimensionProvider_OnDimensionValueChanged_Remove() { using (var projectFile = new MsBuildProjectFile(projectXml)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new PlatformProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); // On ChangeEventStage.After nothing should be changed ProjectConfigurationDimensionValueChangedEventArgs args = new ProjectConfigurationDimensionValueChangedEventArgs( unconfiguredProject, ConfigurationDimensionChange.Delete, ChangeEventStage.After, ConfigurationGeneral.PlatformProperty, "x86"); await provider.OnDimensionValueChangedAsync(args); var property = BuildUtilities.GetProperty(projectFile.Project, Platforms); Assert.NotNull(property); Assert.Equal("AnyCPU;x64;x86", property.Value); // On ChangeEventStage.Before the property should be removed args = new ProjectConfigurationDimensionValueChangedEventArgs( unconfiguredProject, ConfigurationDimensionChange.Delete, ChangeEventStage.Before, ConfigurationGeneral.PlatformProperty, "x86"); await provider.OnDimensionValueChangedAsync(args); property = BuildUtilities.GetProperty(projectFile.Project, Platforms); Assert.NotNull(property); Assert.Equal("AnyCPU;x64", property.Value); } }
public TempFileTextBufferManager(UnconfiguredProject unconfiguredProject, IProjectXmlAccessor projectXmlAccessor, IVsEditorAdaptersFactoryService editorAdaptersService, ITextDocumentFactoryService textDocumentService, IVsShellUtilitiesHelper shellUtilities, IFileSystem fileSystem, IProjectThreadingService threadingService, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) : base(threadingService != null ? threadingService.JoinableTaskContext : throw new ArgumentNullException(nameof(threadingService))) { Requires.NotNull(unconfiguredProject, nameof(unconfiguredProject)); Requires.NotNull(projectXmlAccessor, nameof(projectXmlAccessor)); Requires.NotNull(editorAdaptersService, nameof(editorAdaptersService)); Requires.NotNull(textDocumentService, nameof(textDocumentService)); Requires.NotNull(shellUtilities, nameof(shellUtilities)); Requires.NotNull(fileSystem, nameof(fileSystem)); Requires.NotNull(serviceProvider, nameof(serviceProvider)); _unconfiguredProject = unconfiguredProject; _projectXmlAccessor = projectXmlAccessor; _editorAdaptersService = editorAdaptersService; _textDocumentService = textDocumentService; _shellUtilities = shellUtilities; _fileSystem = fileSystem; _threadingService = threadingService; _serviceProvider = serviceProvider; }
public async void ConfigurationProjectConfigurationDimensionProvider_OnDimensionValueChanged_Add() { using (var projectFile = new MsBuildProjectFile(projectXml)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new ConfigurationProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); // On ChangeEventStage.After nothing should be changed ProjectConfigurationDimensionValueChangedEventArgs args = new ProjectConfigurationDimensionValueChangedEventArgs( unconfiguredProject, ConfigurationDimensionChange.Add, ChangeEventStage.After, ConfigurationGeneral.ConfigurationProperty, "CustomConfig"); await provider.OnDimensionValueChangedAsync(args); var property = BuildUtilities.GetProperty(projectFile.Project, Configurations); Assert.NotNull(property); Assert.Equal("Debug;Release;CustomConfiguration", property.Value); // On ChangeEventStage.Before the property should be added args = new ProjectConfigurationDimensionValueChangedEventArgs( unconfiguredProject, ConfigurationDimensionChange.Add, ChangeEventStage.Before, ConfigurationGeneral.ConfigurationProperty, "CustomConfig"); await provider.OnDimensionValueChangedAsync(args); property = BuildUtilities.GetProperty(projectFile.Project, Configurations); Assert.NotNull(property); Assert.Equal("Debug;Release;CustomConfiguration;CustomConfig", property.Value); } }
/// <summary> /// Initializes a new instance of the <see cref="BaseProjectConfigurationDimensionProvider"/> class. /// </summary> /// <param name="projectXmlAccessor">Lock service for the project file.</param> /// <param name="dimensionName">Name of the dimension.</param> /// <param name="propertyName">Name of the project property containing the dimension values.</param> public BaseProjectConfigurationDimensionProvider(IProjectXmlAccessor projectXmlAccessor, string dimensionName, string propertyName) { Requires.NotNull(projectXmlAccessor, nameof(projectXmlAccessor)); _projectXmlAccessor = projectXmlAccessor; _dimensionName = dimensionName; _propertyName = propertyName; }
public async void ConfigurationProjectConfigurationDimensionProvider_GetDefaultValuesForDimensionsAsync_NoPropertyValue() { using (var projectFile = new MsBuildProjectFile()) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new ConfigurationProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var values = await provider.GetDefaultValuesForDimensionsAsync(unconfiguredProject); Assert.Equal(0, values.Count()); } }
public async Task GetProjectConfigurationDimensionsAsync_NoPropertyValue() { using (var projectFile = new MsBuildProjectFile()) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new ConfigurationProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var values = await provider.GetProjectConfigurationDimensionsAsync(unconfiguredProject); Assert.Empty(values); } }
public async Task TargetFrameworkProjectConfigurationDimensionProvider_GetProjectConfigurationDimensionsAsync_TFM() { using (var projectFile = new MsBuildProjectFile(ProjectXmlTFM)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new TargetFrameworkProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var values = await provider.GetProjectConfigurationDimensionsAsync(unconfiguredProject); Assert.Equal(0, values.Count()); } }
public async Task TargetFrameworkProjectConfigurationDimensionProvider_GetDefaultValuesForDimensionsAsync_TFMs(string projectXml) { using (var projectFile = new MsBuildProjectFile(projectXml)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new TargetFrameworkProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var values = await provider.GetDefaultValuesForDimensionsAsync(unconfiguredProject); Assert.Equal(1, values.Count()); var value = values.First(); Assert.Equal(ConfigurationGeneral.TargetFrameworkProperty, value.Key); Assert.Equal("netcoreapp1.0", value.Value); } }
public async Task GetDefaultValuesForDimensionsAsync() { using (var projectFile = new MsBuildProjectFile(projectXml)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new ConfigurationProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var values = await provider.GetDefaultValuesForDimensionsAsync(unconfiguredProject); Assert.Single(values); var value = values.First(); Assert.Equal(ConfigurationGeneral.ConfigurationProperty, value.Key); Assert.Equal("Debug", value.Value); } }
public async void TargetFrameworkProjectConfigurationDimensionProvider_GetProjectConfigurationDimensionsAsync_TFMs(string projectXml) { using (var projectFile = new MsBuildProjectFile(projectXml)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new TargetFrameworkProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var values = await provider.GetProjectConfigurationDimensionsAsync(unconfiguredProject); Assert.Equal(1, values.Count()); var value = values.First(); Assert.Equal(ConfigurationGeneral.TargetFrameworkProperty, value.Key); string[] dimensionValues = value.Value.ToArray(); Assert.Equal(2, dimensionValues.Length); Assert.Equal("netcoreapp1.0", dimensionValues[0]); Assert.Equal("net45", dimensionValues[1]); } }
public async void ConfigurationProjectConfigurationDimensionProvider_GetProjectConfigurationDimensionsAsync() { using (var projectFile = new MsBuildProjectFile(projectXml)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new ConfigurationProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var values = await provider.GetProjectConfigurationDimensionsAsync(unconfiguredProject); Assert.Equal(1, values.Count()); var value = values.First(); Assert.Equal(ConfigurationGeneral.ConfigurationProperty, value.Key); string[] dimensionValues = value.Value.ToArray(); Assert.Equal(3, dimensionValues.Length); Assert.Equal("Debug", dimensionValues[0]); Assert.Equal("Release", dimensionValues[1]); Assert.Equal("CustomConfiguration", dimensionValues[2]); } }
public async Task PlatformProjectConfigurationDimensionProvider_GetProjectConfigurationDimensionsAsync() { using (var projectFile = new MsBuildProjectFile(projectXml)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new PlatformProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var values = await provider.GetProjectConfigurationDimensionsAsync(unconfiguredProject); Assert.Single(values); var value = values.First(); Assert.Equal(ConfigurationGeneral.PlatformProperty, value.Key); string[] dimensionValues = value.Value.ToArray(); Assert.Equal(3, dimensionValues.Length); Assert.Equal("AnyCPU", dimensionValues[0]); Assert.Equal("x64", dimensionValues[1]); Assert.Equal("x86", dimensionValues[2]); } }
public async void ConfigurationProjectConfigurationDimensionProvider_OnDimensionValueChanged_Remove_MissingValue() { using (var projectFile = new MsBuildProjectFile(projectXml)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new ConfigurationProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); ProjectConfigurationDimensionValueChangedEventArgs args = new ProjectConfigurationDimensionValueChangedEventArgs( unconfiguredProject, ConfigurationDimensionChange.Delete, ChangeEventStage.Before, ConfigurationGeneral.ConfigurationProperty, "NonExistantConfiguration"); await Assert.ThrowsAsync <ArgumentException>(() => provider.OnDimensionValueChangedAsync(args)); var property = BuildUtilities.GetProperty(projectFile.Project, Configurations); Assert.NotNull(property); Assert.Equal("Debug;Release;CustomConfiguration", property.Value); } }
public async Task TargetFrameworkProjectConfigurationDimensionProvider_OnDimensionValueChanged(ConfigurationDimensionChange change, ChangeEventStage stage) { // No changes should happen for TFM so verify that the property is the same before and after using (var projectFile = new MsBuildProjectFile(ProjectXmlTFMs)) { IProjectXmlAccessor _projectXmlAccessor = IProjectXmlAccessorFactory.Create(projectFile.Project); var provider = new TargetFrameworkProjectConfigurationDimensionProvider(_projectXmlAccessor); var unconfiguredProject = UnconfiguredProjectFactory.Create(filePath: projectFile.Filename); var property = BuildUtilities.GetProperty(projectFile.Project, ConfigurationGeneral.TargetFrameworksProperty); string expectedTFMs = property.Value; ProjectConfigurationDimensionValueChangedEventArgs args = new ProjectConfigurationDimensionValueChangedEventArgs( unconfiguredProject, change, stage, ConfigurationGeneral.TargetFrameworkProperty, "NewTFM"); await provider.OnDimensionValueChangedAsync(args); Assert.NotNull(property); Assert.Equal(expectedTFMs, property.Value); } }
public DependencySubscriptionsHost( IUnconfiguredProjectCommonServices commonServices, Lazy <IAggregateCrossTargetProjectContextProvider> contextProvider, [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService tasksService, IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscriptionService, IActiveProjectConfigurationRefreshService activeProjectConfigurationRefreshService, ITargetFrameworkProvider targetFrameworkProvider, IAggregateDependenciesSnapshotProvider aggregateSnapshotProvider, IProjectXmlAccessor projectXmlAccessor) : base(commonServices, contextProvider, tasksService, activeConfiguredProjectSubscriptionService, activeProjectConfigurationRefreshService) { CommonServices = commonServices; DependencySubscribers = new OrderPrecedenceImportCollection <IDependencyCrossTargetSubscriber>( projectCapabilityCheckProvider: commonServices.Project); SnapshotFilters = new OrderPrecedenceImportCollection <IDependenciesSnapshotFilter>( projectCapabilityCheckProvider: commonServices.Project, orderingStyle: ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast); SubTreeProviders = new OrderPrecedenceImportCollection <IProjectDependenciesSubTreeProvider>( ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast, projectCapabilityCheckProvider: commonServices.Project); DependenciesUpdateScheduler = new TaskDelayScheduler( _dependenciesUpdateThrottleInterval, commonServices.ThreadingService, tasksService.UnloadCancellationToken); TargetFrameworkProvider = targetFrameworkProvider; AggregateSnapshotProvider = aggregateSnapshotProvider; ProjectXmlAccessor = projectXmlAccessor; ProjectFilePath = CommonServices.Project.FullPath; }
public PlatformProjectConfigurationDimensionProvider(IProjectXmlAccessor projectXmlAccessor) : base(projectXmlAccessor, ConfigurationGeneral.PlatformProperty, "Platforms") { }
public ConfigurationProjectConfigurationDimensionProvider(IProjectXmlAccessor projectXmlAccessor) : base(projectXmlAccessor, ConfigurationGeneral.ConfigurationProperty, "Configurations") { }
public TargetFrameworkProjectConfigurationDimensionProvider(IProjectXmlAccessor projectXmlAccessor) : base(projectXmlAccessor, ConfigurationGeneral.TargetFrameworkProperty, ConfigurationGeneral.TargetFrameworksProperty) { }
public SupportedTargetFrameworksEnumValuesGenerator(IProjectXmlAccessor projectXmlAccessor, ConfiguredProject configuredProject) { _projectXmlAccessor = projectXmlAccessor; _configuredProject = configuredProject; }