Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast up to date check for .NET Core projects #2241

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<CheckBox x:Name="FastUpToDateCheck" x:Uid="General_FastUpToDateCheck" Content="{x:Static r:GeneralOptionPageResources.General_FastUpToDateCheck}" Margin="0" />
<CheckBox x:Name="OutputPane" x:Uid="General_OutputPane" Content="{x:Static r:GeneralOptionPageResources.General_OutputPane}" Margin="0" />
<CheckBox x:Name="VerboseFastUpToDateLogging" x:Uid="General_VerboseFastUpToDateLogging" Content="{x:Static r:GeneralOptionPageResources.General_VerboseFastUpToDateLogging}" Margin="0" />
</StackPanel>
</ScrollViewer>
</local:OptionPageControl>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Namespace Microsoft.VisualStudio.Editors.OptionPages

Dim binding = New Binding() With {
.Source = _generalOptions,
.Path = New Windows.PropertyPath(NameOf(GeneralOptions.FastUpToDateCheckDisabled)),
.Path = New Windows.PropertyPath(NameOf(GeneralOptions.FastUpToDateCheckEnabled)),
.UpdateSourceTrigger = UpdateSourceTrigger.Explicit
}

Expand All @@ -27,11 +27,11 @@ Namespace Microsoft.VisualStudio.Editors.OptionPages

binding = New Binding() With {
.Source = _generalOptions,
.Path = New Windows.PropertyPath(NameOf(GeneralOptions.OutputPaneEnabled)),
.Path = New Windows.PropertyPath(NameOf(GeneralOptions.VerboseFastUpToDateLogging)),
.UpdateSourceTrigger = UpdateSourceTrigger.Explicit
}

bindingExpression = OutputPane.SetBinding(CheckBox.IsCheckedProperty, binding)
bindingExpression = VerboseFastUpToDateLogging.SetBinding(CheckBox.IsCheckedProperty, binding)
AddBinding(bindingExpression)
End Sub
End Class
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="General_FastUpToDateCheck" xml:space="preserve">
<value>Always call MSBuild, even if a project appears to be up to date.</value>
<value>Don't call MSBuild if a project appears to be up to date.</value>
</data>
<data name="General_OutputPane" xml:space="preserve">
<value>Log project information to the Output window.</value>
<data name="General_VerboseFastUpToDateLogging" xml:space="preserve">
<value>Log diagnostic information for project up to date checks to the output window.</value>
</data>
</root>
16 changes: 8 additions & 8 deletions src/Microsoft.VisualStudio.Editors/OptionPages/GeneralOptions.vb
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ Namespace Microsoft.VisualStudio.Editors.OptionPages
Private Class SVsSettingsPersistenceManager
End Class

Private Const FastUpToDateSettingKey As String = "ManagedProjectSystem\FastUpToDateCheckDisabled"
Private Const OutputPaneSettingKey As String = "ManagedProjectSystem\OutputPaneEnabled"
Private Const FastUpToDateEnabledSettingKey As String = "ManagedProjectSystem\FastUpToDateCheckEnabled"
Private Const VerboseFastUpToDateLoggingSettingKey As String = "ManagedProjectSystem\VerboseFastUpToDateLogging"

Private ReadOnly _settingsManager As ISettingsManager

Public Property FastUpToDateCheckDisabled As Boolean
Public Property FastUpToDateCheckEnabled As Boolean
Get
Return If(_settingsManager?.GetValueOrDefault(FastUpToDateSettingKey, False), False)
Return If(_settingsManager?.GetValueOrDefault(FastUpToDateEnabledSettingKey, True), True)
End Get
Set
_settingsManager.SetValueAsync(FastUpToDateSettingKey, Value, isMachineLocal:=False)
_settingsManager.SetValueAsync(FastUpToDateEnabledSettingKey, Value, isMachineLocal:=False)
End Set
End Property

Public Property OutputPaneEnabled As Boolean
Public Property VerboseFastUpToDateLogging As Boolean
Get
Return If(_settingsManager?.GetValueOrDefault(OutputPaneSettingKey, False), False)
Return If(_settingsManager?.GetValueOrDefault(VerboseFastUpToDateLoggingSettingKey, False), False)
End Get
Set
_settingsManager.SetValueAsync(OutputPaneSettingKey, Value, isMachineLocal:=False)
_settingsManager.SetValueAsync(VerboseFastUpToDateLoggingSettingKey, Value, isMachineLocal:=False)
End Set
End Property

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.ProjectSystem.Utilities;
using Microsoft.VisualStudio.Settings;
using Microsoft.VisualStudio.Shell;
using System.Runtime.InteropServices;
using System.Threading.Tasks;

namespace Microsoft.VisualStudio.ProjectSystem.VS
{
[Export(typeof(IProjectSystemOptions))]
internal class ProjectSystemOptions : IProjectSystemOptions
{
[Guid("9B164E40-C3A2-4363-9BC5-EB4039DEF653")]
private class SVsSettingsPersistenceManager { }

private const string FastUpToDateEnabledSettingKey = @"ManagedProjectSystem\FastUpToDateCheckEnabled";
private const string VerboseFastUpToDateLoggingSettingKey = @"ManagedProjectSystem\VerboseFastUpToDateLogging";

private readonly IVsOptionalService<SVsSettingsPersistenceManager, ISettingsManager> _settingsManager;
private readonly IEnvironmentHelper _environment;

[ImportingConstructor]
private ProjectSystemOptions(IEnvironmentHelper environment, IVsOptionalService<SVsSettingsPersistenceManager, ISettingsManager> settingsManager)
{
Requires.NotNull(environment, nameof(environment));

_environment = environment;
_settingsManager = settingsManager;
}

public bool IsProjectOutputPaneEnabled
{
get
{
#if DEBUG
return true;
#else
return IsEnabled("PROJECTSYSTEM_PROJECTOUTPUTPANEENABLED");
#endif
}
}

public async Task<bool> GetIsFastUpToDateCheckEnabledAsync()
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
return _settingsManager.Value?.GetValueOrDefault(FastUpToDateEnabledSettingKey, true) ?? true;
}

public async Task<bool> GetVerboseFastUpToDateLoggingAsync()
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
return _settingsManager.Value?.GetValueOrDefault(VerboseFastUpToDateLoggingSettingKey, false) ?? false;
}

private bool IsEnabled(string variable)
{
string value = _environment.GetEnvironmentVariable(variable);

return string.Equals(value, "1", StringComparison.OrdinalIgnoreCase);
}
}
}
Loading