Skip to content

Commit

Permalink
Merge branch 'release/2.1.0'
Browse files Browse the repository at this point in the history
* release/2.1.0:
  (maint) Update to latest version of chocolatey.lib
  (maint) Update GRM configuration file
  (maint) Remove version bump in nuspec file
  (build) Use latest Chocolatey.Cake.Recipe package
  (maint) Switch to Http for variable names
  (chocolatey#1014) Add advanced option to ignore cached items
  (chocolatey#1014) Ignore cached files on forced outdated check
  (build) Make build files consistent with others
  (chocolatey#993) (fix) Correct syntax in KTS file
  (chocolatey#993) Add TC schedule trigger
  (maint) Fix StyleCop warnings
  (chocolatey#980) Use assembly location when debugging
  (maint) Update to released alpha package
  (chocolatey#1003) Handle null keys during source translation
  (chocolatey#1005) Normalize version numbers
  (maint) Add banned api analyzer
  (maint) Remove usage of obsolete methods
  (maint) Update to latest Chocolatey.Lib package
  • Loading branch information
gep13 committed Jun 29, 2023
2 parents a0082c2 + d9823b0 commit 7cc2949
Show file tree
Hide file tree
Showing 32 changed files with 287 additions and 87 deletions.
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
dotnet_diagnostic.RS0030.severity = error
dotnet_diagnostic.RS0031.severity = error
19 changes: 16 additions & 3 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.script
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.powerShell
import jetbrains.buildServer.configs.kotlin.v2019_2.buildFeatures.pullRequests
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.vcs
import jetbrains.buildServer.configs.kotlin.v2019_2.triggers.schedule
import jetbrains.buildServer.configs.kotlin.v2019_2.vcs.GitVcsRoot

version = "2021.2"

project {
buildType(ChocolateyGUI)
}
Expand Down Expand Up @@ -62,14 +61,28 @@ object ChocolateyGUI : BuildType({

script {
name = "Call Cake"
scriptContent = "call build.official.bat"
scriptContent = """
IF "%teamcity.build.triggeredBy%" == "Schedule Trigger" (SET TestType=all) ELSE (SET TestType=unit)
call build.official.bat --verbosity=diagnostic --target=CI --testExecutionType=%%TestType%% --shouldRunOpenCover=false
""".trimIndent()
}
}

triggers {
vcs {
branchFilter = ""
}
schedule {
schedulingPolicy = daily {
hour = 2
minute = 0
}
branchFilter = """
+:<default>
""".trimIndent()
triggerBuild = always()
withPendingChangesOnly = false
}
}

features {
Expand Down
2 changes: 1 addition & 1 deletion GitReleaseManager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ issue-labels-include:
- Documentation
issue-labels-exclude:
- Internal Refactoring
- Build
- BuildAutomation
- NO RELEASE NOTES
issue-labels-alias:
- name: Documentation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
Expand Down Expand Up @@ -68,7 +68,7 @@
<HintPath>..\packages\Caliburn.Micro.3.2.0\lib\net45\Caliburn.Micro.Platform.Core.dll</HintPath>
</Reference>
<Reference Include="chocolatey">
<HintPath>..\packages\chocolatey.lib.2.0.0\lib\net48\chocolatey.dll</HintPath>
<HintPath>..\packages\chocolatey.lib.2.1.0\lib\net48\chocolatey.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<Private Condition="'$(Configuration)' != 'Debug'">False</Private>
</Reference>
Expand Down Expand Up @@ -235,6 +235,7 @@
<Compile Include="Services\IPackageArgumentsService.cs" />
<Compile Include="Services\PackageArgumentsService.cs" />
<Compile Include="Utilities\Converters\LocalizationConverter.cs" />
<Compile Include="Utilities\Converters\NuGetVersionToString.cs" />
<Compile Include="Utilities\Extensions\LocalizeExtension.cs" />
<Compile Include="Utilities\Converters\NullToInverseBool.cs" />
<Compile Include="Utilities\ToolTipBehavior.cs" />
Expand Down Expand Up @@ -422,9 +423,16 @@
<SourceRoot Include="$(MSBuildThisFileDirectory)/../" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.BannedApiAnalyzers.3.3.4\analyzers\dotnet\cs\Microsoft.CodeAnalysis.BannedApiAnalyzers.dll" />
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.BannedApiAnalyzers.3.3.4\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.BannedApiAnalyzers.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.CodeFixes.dll" />
<Analyzer Include="..\packages\StyleCop.Analyzers.1.0.2\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="..\ChocolateyGui\BannedSymbols.txt">
<Link>BannedSymbols.txt</Link>
</AdditionalFiles>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\HarfBuzzSharp.2.6.1.4\build\net462\HarfBuzzSharp.targets" Condition="Exists('..\packages\HarfBuzzSharp.2.6.1.4\build\net462\HarfBuzzSharp.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public async Task<IReadOnlyList<OutdatedPackage>> GetOutdatedPackages(bool inclu
config.RegularOutput = false;
config.QuietOutput = true;
config.Prerelease = false;
if (forceCheckForOutdatedPackages)
{
config.SetCacheExpirationInMinutes(0);
}
});
var chocoConfig = choco.GetConfiguration();

Expand Down Expand Up @@ -195,7 +200,7 @@ public async Task<PackageOperationResult> InstallPackage(
if (version != null)
{
config.Version = version.ToString();
config.Version = version;
}
if (source != null)
Expand Down Expand Up @@ -248,6 +253,11 @@ public async Task<PackageOperationResult> InstallPackage(
config.DownloadChecksum64 = advancedInstallOptions.DownloadChecksum64bit;
config.DownloadChecksumType = advancedInstallOptions.DownloadChecksumType;
config.DownloadChecksumType64 = advancedInstallOptions.DownloadChecksumType64bit;
if (advancedInstallOptions.IgnoreHttpCache)
{
config.SetCacheExpirationInMinutes(0);
}
}
});

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright company="Chocolatey" file="NuGetVersionToString.cs">
// Copyright 2017 - Present Chocolatey Software, LLC
// Copyright 2014 - 2017 Rob Reynolds, the maintainers of Chocolatey, and RealDimensions Software, LLC
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace ChocolateyGui.Common.Windows.Utilities.Converters
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using chocolatey;
using NuGet.Versioning;

public class NuGetVersionToString : DependencyObject, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is NuGetVersion version)
{
return version.ToNormalizedStringChecked();
}

return value;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is string sValue && NuGetVersion.TryParse(sValue, out var version))
{
return version;
}

throw new InvalidOperationException("The passed in value is not a parseable string version!");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public class AdvancedInstallViewModel : ObservableBase, IClosableChildWindow<Adv
private bool _applyInstallArgumentsToDependencies;
private bool _applyPackageParametersToDependencies;
private bool _allowDowngrade;
private bool _ignoreHttpCache;
private bool _ignoreDependencies;
private bool _forceDependencies;
private bool _skipPowerShell;
Expand All @@ -66,7 +67,7 @@ public AdvancedInstallViewModel(

_cts = new CancellationTokenSource();

_packageVersion = packageVersion.ToString();
_packageVersion = packageVersion.ToNormalizedStringChecked();
SelectedVersion = _packageVersion;

FetchAvailableVersions();
Expand Down Expand Up @@ -225,6 +226,17 @@ public bool AllowDowngrade
set { SetPropertyValue(ref _allowDowngrade, value); }
}

public bool IgnoreHttpCache
{
get { return _ignoreHttpCache; }
set { SetPropertyValue(ref _ignoreHttpCache, value); }
}

public bool IgnoreHttpCacheIsAvailable
{
get { return ChocolateyConfigurationExtensions.HasCacheExpirationInMinutes(); }
}

public bool IgnoreDependencies
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Threading.Tasks;
using AutoMapper;
using Caliburn.Micro;
using chocolatey;
using ChocolateyGui.Common.Base;
using ChocolateyGui.Common.Models;
using ChocolateyGui.Common.Models.Messages;
Expand Down Expand Up @@ -405,7 +406,8 @@ public bool IsPackageSizeAvailable

public async Task ShowArguments()
{
var decryptedArguments = _packageArgumentsService.DecryptPackageArgumentsFile(Id, Version.ToString()).ToList();
// TODO: Add legacy handling for packages installed prior to v2.0.0.
var decryptedArguments = _packageArgumentsService.DecryptPackageArgumentsFile(Id, Version.ToNormalizedStringChecked()).ToList();

if (decryptedArguments.Count == 0)
{
Expand All @@ -423,7 +425,7 @@ await _dialogService.ShowMessageAsync(

public async Task Install()
{
await InstallPackage(Version.ToString());
await InstallPackage(Version.ToNormalizedStringChecked());
}

public async Task InstallAdvanced()
Expand Down Expand Up @@ -465,7 +467,7 @@ public async Task Reinstall()
{
using (await StartProgressDialog(L(nameof(Resources.PackageViewModel_ReinstallingPackage)), L(nameof(Resources.PackageViewModel_ReinstallingPackage)), Id))
{
await _chocolateyService.InstallPackage(Id, Version.ToString(), Source, true);
await _chocolateyService.InstallPackage(Id, Version.ToNormalizedStringChecked(), Source, true);
_chocolateyGuiCacheService.PurgeOutdatedPackages();
await _eventAggregator.PublishOnUIThreadAsync(new PackageChangedMessage(Id, PackageChangeType.Installed, Version));
}
Expand Down Expand Up @@ -496,7 +498,7 @@ public async Task Uninstall()
{
using (await StartProgressDialog(L(nameof(Resources.PackageViewModel_UninstallingPackage)), L(nameof(Resources.PackageViewModel_UninstallingPackage)), Id))
{
var result = await _chocolateyService.UninstallPackage(Id, Version.ToString(), true);
var result = await _chocolateyService.UninstallPackage(Id, Version.ToNormalizedStringChecked(), true);

if (!result.Successful)
{
Expand Down Expand Up @@ -584,7 +586,7 @@ public async Task Pin()
{
using (await StartProgressDialog(L(nameof(Resources.PackageViewModel_PinningPackage)), L(nameof(Resources.PackageViewModel_PinningPackage)), Id))
{
var result = await _chocolateyService.PinPackage(Id, Version.ToString());
var result = await _chocolateyService.PinPackage(Id, Version.ToNormalizedStringChecked());

if (!result.Successful)
{
Expand Down Expand Up @@ -628,7 +630,7 @@ public async Task Unpin()
{
using (await StartProgressDialog(L(nameof(Resources.PackageViewModel_UnpinningPackage)), L(nameof(Resources.PackageViewModel_UnpinningPackage)), Id))
{
var result = await _chocolateyService.UnpinPackage(Id, Version.ToString());
var result = await _chocolateyService.UnpinPackage(Id, Version.ToNormalizedStringChecked());

if (!result.Successful)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<converters:BooleanToVisibilityInverted x:Key="BooleanToVisibilityInverted" />
<converters:NullToInverseBool x:Key="NullToInverseBool" />
<converters:BooleanInverter x:Key="BooleanInverter" />
<converters:BooleanToVisibility x:Key="BooleanToVisibilty" />
<GridLength x:Key="ToggleSwitchPreContentMargin">0</GridLength>
<GridLength x:Key="ToggleSwitchPostContentMargin">0</GridLength>

Expand Down Expand Up @@ -247,6 +248,9 @@
<Button Grid.Column="1" Content="{lang:Localize AdvancedChocolateyDialog_Browse}" Command="{Binding BrowseLogFileCommand}" />
</Grid>
</mah:MetroHeader>
<mah:MetroHeader Header="{lang:Localize AdvancedChocolateyDialog_IgnoreHttpCache_Header}" Tag="{lang:Localize AdvancedChocolateyDialog_IgnoreHttpCache_ToolTip}" Visibility="{Binding IgnoreHttpCacheIsAvailable, Converter={StaticResource BooleanToVisibilty}}">
<mah:ToggleSwitch VerticalAlignment="Center" IsOn="{Binding IgnoreHttpCache}" />
</mah:MetroHeader>
<mah:MetroHeader Header="{lang:Localize AdvancedChocolateyDialog_OverrideArguments_Header}" Tag="{lang:Localize AdvancedChocolateyDialog_OverrideArguments_ToolTip}">
<mah:ToggleSwitch VerticalAlignment="Center" IsOn="{Binding OverrideArguments}">
<mah:ToggleSwitch.IsEnabled>
Expand Down
10 changes: 6 additions & 4 deletions Source/ChocolateyGui.Common.Windows/Views/LocalSourceView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
xmlns:commands="clr-namespace:ChocolateyGui.Common.Windows.Commands"
xmlns:controls="clr-namespace:ChocolateyGui.Common.Windows.Controls"
xmlns:theming="clr-namespace:ChocolateyGui.Common.Windows.Theming"
xmlns:converters="clr-namespace:ChocolateyGui.Common.Windows.Utilities.Converters"
mc:Ignorable="d"
d:DesignHeight="768" d:DesignWidth="1366"
d:DataContext="{d:DesignInstance viewModels:LocalSourceViewModel}"
d:DataContext="{d:DesignInstance {x:Type viewModels:LocalSourceViewModel}}"
Background="{DynamicResource MahApps.Brushes.ThemeBackground}">

<UserControl.Resources>
<converters:NuGetVersionToString x:Key="NuGetVersionToString"/>
<utilities:BindingProxy x:Key="BindingProxy" Data="{Binding}" />
<utilities:PackageAuthorsComparer x:Key="PackageAuthorsComparer" />

Expand Down Expand Up @@ -59,12 +61,12 @@
<TextBlock Grid.Row="2"
Margin="4 0"
Style="{DynamicResource TileLatestVersionTextStyle}"
Text="{Binding LatestVersion, Mode=OneWay}" />
Text="{Binding LatestVersion, Converter={StaticResource NuGetVersionToString}, Mode=OneWay}" />

<TextBlock Grid.Row="3"
Margin="4 0 4 1"
Style="{DynamicResource TileVersionTextStyle}"
Text="{Binding Version, Mode=OneWay}" />
Text="{Binding Version, Converter={StaticResource NuGetVersionToString}, Mode=OneWay}" />

<ContentControl x:Name="OutOfDateOverlay" Grid.Row="0" Grid.RowSpan="4"
Visibility="Collapsed"
Expand Down Expand Up @@ -320,7 +322,7 @@
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
Text="{Binding LatestVersion, IsAsync=True}"
Text="{Binding LatestVersion, Converter={StaticResource NuGetVersionToString}, IsAsync=True}"
Padding="3 3 2 3"
VerticalAlignment="Stretch"
HorizontalAlignment="Left"
Expand Down
3 changes: 2 additions & 1 deletion Source/ChocolateyGui.Common.Windows/Views/PackageView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
</FrameworkElement.CommandBindings>

<UserControl.Resources>
<converters:NuGetVersionToString x:Key="NuGetVersionToString"/>
<converters:NullToVisibility x:Key="UriToVisibility" />
<converters:NullToVisibility x:Key="NullToVisibility" />
<converters:LongSizeToFileSizeString x:Key="LongSizeToFileSizeString" />
Expand Down Expand Up @@ -196,7 +197,7 @@
<Label Style="{StaticResource PackageResourceLabel}"
Content="{lang:Localize PackageView_Version}"
Target="{Binding ElementName=Version}" />
<TextBlock x:Name="Version" Text="{Binding Version}"
<TextBlock x:Name="Version" Text="{Binding Version, Converter={StaticResource NuGetVersionToString}}"
Style="{StaticResource PackageResourceValue}" />

<Label Style="{StaticResource PackageResourceLabel}" Content="{lang:Localize PackageView_Downloads}"
Expand Down
Loading

0 comments on commit 7cc2949

Please sign in to comment.