Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
peters committed Apr 17, 2024
2 parents d87fc1e + b3e59bc commit 19eb167
Show file tree
Hide file tree
Showing 79 changed files with 635 additions and 723 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ env:
GITVERSION_VERSION: 5.12.0
MSVS_TOOLSET_VERSION: 16
SNAPX_DOTNET_FRAMEWORK_VERSION: net8.0
DOTNET_NET60_VERSION: 6.0.417
DOTNET_NET70_VERSION: 7.0.404
DOTNET_NET80_VERSION: 8.0.100
DOTNET_NET60_VERSION: 6.0.421
DOTNET_NET70_VERSION: 7.0.408
DOTNET_NET80_VERSION: 8.0.204
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: 1
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
password: ${{ secrets.SNAPX_DOCKER_READ_PAT }}

- name: Setup .NET
uses: actions/setup-dotnet@v3.2.0
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: |
${{ env.DOTNET_NET60_VERSION }}
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
- name: Upload artifacts
if: success()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.rid }}-${{ matrix.configuration }}
path: ${{ github.workspace }}/artifacts/**/*
Expand All @@ -140,7 +140,7 @@ jobs:
submodules: true

- name: Setup .NET
uses: actions/setup-dotnet@v3.2.0
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: |
${{ env.DOTNET_NET60_VERSION }}
Expand Down Expand Up @@ -179,7 +179,7 @@ jobs:
- name: Upload artifacts
if: success()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.rid }}-${{ matrix.configuration }}
path: ${{ github.workspace }}/artifacts/**/*
Expand All @@ -198,31 +198,31 @@ jobs:
lfs: true

- name: Download ubuntu-latest-linux-arm64-Release artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-linux-arm64-Release
path: ${{ github.workspace }}

- name: Download ubuntu-latest-linux-x64-Release artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ubuntu-latest-linux-x64-Release
path: ${{ github.workspace }}

- name: Download windows-latest-win-x86-Release artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: windows-latest-win-x86-Release
path: ${{ github.workspace }}

- name: Download windows-latest-win-x64-Release artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: windows-latest-win-x64-Release
path: ${{ github.workspace }}

- name: Setup .NET
uses: actions/setup-dotnet@v3.2.0
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: |
${{ env.DOTNET_NET60_VERSION }}
Expand Down
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
next-version: 5.2.5
next-version: 5.2.6
mode: ContinuousDeployment
continuous-delivery-fallback-tag: ''
branches:
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ param(
[Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
[string] $DockerImageName = "snapx",
[Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
[string] $DockerVersion = "29.0",
[string] $DockerVersion = "32.0",
[Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
[switch] $DockerLocal,
[Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ FROM ubuntu:20.04 as env-build
ENV DEBIAN_FRONTEND=noninteractive
ENV SNAPX_DOCKER_WORKING_DIR /build/snapx

ARG DOTNET_60_SDK_VERSION=6.0.417
ARG DOTNET_70_SDK_VERSION=7.0.404
ARG DOTNET_80_SDK_VERSION=8.0.100
ARG DOTNET_60_SDK_VERSION=6.0.421
ARG DOTNET_70_SDK_VERSION=7.0.408
ARG DOTNET_80_SDK_VERSION=8.0.204
ARG DOTNET_RID=linux-x64


Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
12 changes: 6 additions & 6 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageVersion Include="Mono.Cecil" Version="0.11.5" />
<PackageVersion Include="Moq" Version="4.20.69" />
<PackageVersion Include="NLog" Version="5.2.5" />
<PackageVersion Include="NuGet.Packaging.Core" Version="6.7.0" />
<PackageVersion Include="NuGet.Protocol" Version="6.7.0" />
<PackageVersion Include="SharpCompress" Version="0.34.1" />
<PackageVersion Include="NLog" Version="5.2.6" />
<PackageVersion Include="NuGet.Packaging.Core" Version="6.8.0" />
<PackageVersion Include="NuGet.Protocol" Version="6.8.0" />
<PackageVersion Include="SharpCompress" Version="0.34.2" />
<PackageVersion Include="System.CodeDom" Version="8.0.0" />
<PackageVersion Include="System.Security.Permissions" Version="8.0.0" />
<PackageVersion Include="xunit" Version="2.6.1" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageVersion Include="xunit" Version="2.6.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4" />
<PackageVersion Include="XunitXml.TestLogger" Version="3.1.17" />
<PackageVersion Include="YamlDotNet" Version="13.7.1" />
</ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/Snap.Installer/Assets/AssetsTypeRoot.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
namespace Snap.Installer.Assets;

class AssetsTypeRoot
{
}
class AssetsTypeRoot;
9 changes: 2 additions & 7 deletions src/Snap.Installer/Controls/GifAnimationControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,13 @@ namespace Snap.Installer.Controls;

public class GifAnimationControl : Control
{
readonly List<Bitmap> _bitmaps;
readonly List<Bitmap> _bitmaps = [];
DispatcherTimer _dispatcherTimer;
TimeSpan _delayTimespan;
int _bitmapindex;
Action _onFirstDrawAction;
bool _isFirstDraw;

public GifAnimationControl()
{
_bitmaps = new List<Bitmap>();
}

public void AddImages([NotNull] IEnumerable<Bitmap> bitmaps)
{
if (bitmaps == null) throw new ArgumentNullException(nameof(bitmaps));
Expand All @@ -42,7 +37,7 @@ public void Run(TimeSpan delayTimeSpan, [NotNull] Action onFirstDrawAction)
_onFirstDrawAction = onFirstDrawAction ?? throw new ArgumentNullException(nameof(onFirstDrawAction));

_dispatcherTimer = new DispatcherTimer(_delayTimespan, DispatcherPriority.Render,
(sender, args) => InvalidateVisual());
(_, _) => InvalidateVisual());
_dispatcherTimer.Start();
}

Expand Down
25 changes: 11 additions & 14 deletions src/Snap.Installer/Core/SnapEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,19 @@ internal interface ISnapInstallerEnvironment
void Shutdown();
}

internal class SnapInstallerEnvironment : ISnapInstallerEnvironment
internal class SnapInstallerEnvironment(
LogLevel logLevel,
[NotNull] CancellationTokenSource cancellationTokenSource,
[NotNull] string loggerName)
: ISnapInstallerEnvironment
{
readonly CancellationTokenSource _cancellationTokenSource;
readonly string _loggerName;
readonly CancellationTokenSource _cancellationTokenSource = cancellationTokenSource ?? throw new ArgumentNullException(nameof(cancellationTokenSource));
readonly string _loggerName = loggerName ?? throw new ArgumentNullException(nameof(loggerName));
public CancellationToken CancellationToken => _cancellationTokenSource.Token;
public LogLevel LogLevel { get; set; }
public IServiceContainer Container { get; set; }
public ISnapInstallerIoEnvironment Io { get; set; }
public LogLevel LogLevel { get; set; } = logLevel;
public IServiceContainer Container { get; init; }
public ISnapInstallerIoEnvironment Io { get; init; }

public SnapInstallerEnvironment(LogLevel logLevel, [NotNull] CancellationTokenSource cancellationTokenSource, [NotNull] string loggerName)
{
LogLevel = logLevel;
_cancellationTokenSource = cancellationTokenSource ?? throw new ArgumentNullException(nameof(cancellationTokenSource));
_loggerName = loggerName ?? throw new ArgumentNullException(nameof(loggerName));
}

public ILog BuildLogger<T>()
{
return LogProvider.GetLogger($"{_loggerName}.{typeof(T).Name}");
Expand All @@ -53,7 +50,7 @@ public void Shutdown()

internal class SnapInstallerIoEnvironment : ISnapInstallerIoEnvironment
{
public ISnapOsSpecialFolders SpecialFolders { get; set; }
public ISnapOsSpecialFolders SpecialFolders { get; init; }
public string WorkingDirectory { get; set; }
public string ThisExeWorkingDirectory { get; set; }
}
2 changes: 1 addition & 1 deletion src/Snap.Installer/Core/SnapInstallerEmbeddedResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public SnapInstallerEmbeddedResources()
{
AddFromTypeRoot(typeof(AssetsTypeRoot), x => x.StartsWith("Snap.Installer.Assets"));

GifAnimation = new List<byte[]>();
GifAnimation = [];

const string animatedGifNs = "AnimatedGif.";
foreach (var image in Resources.Where(x => x.Filename.StartsWith(animatedGifNs)).OrderBy(x => x.Filename[animatedGifNs.Length..].ToIntSafe()))
Expand Down
4 changes: 2 additions & 2 deletions src/Snap.Installer/Program.Install.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async Task InstallInBackgroundAsync(IMainWindowViewModel mainWindowViewModel)
diskLogger.Info("Main window should now be visible.");
}

var mainWindowLogger = new LogForwarder(LogLevel.Info, diskLogger, (level, func, exception, parameters) =>
var mainWindowLogger = new LogForwarder(LogLevel.Info, diskLogger, (_, func, _, _) =>
{
var message = func?.Invoke();
if (message == null)
Expand Down Expand Up @@ -419,7 +419,7 @@ await snapFilesystem.FileCopyAsync(
}

var avaloniaApp = BuildAvaloniaApp<App>()
.AfterSetup(builder =>
.AfterSetup(_ =>
{
MainWindow.Environment = environment;
MainWindow.ViewModel = new AvaloniaMainWindowViewModel(snapInstallerEmbeddedResources,
Expand Down
18 changes: 9 additions & 9 deletions src/Snap.Installer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,21 +179,21 @@ static IServiceContainer BuildEnvironment(ISnapOs snapOs, CancellationTokenSourc

container.Register<ILibPal>(_ => new LibPal());
container.Register<IBsdiffLib>(_ => new LibBsDiff());
container.Register(c => snapOs);
container.Register(c => snapOs.SpecialFolders);
container.Register(_ => snapOs);
container.Register(_ => snapOs.SpecialFolders);

container.Register(c => snapOs.Filesystem);
container.Register<ISnapHttpClient>(c => new SnapHttpClient(new HttpClient()));
container.Register<ISnapInstallerEmbeddedResources>(c => new SnapInstallerEmbeddedResources());
container.Register(_ => snapOs.Filesystem);
container.Register<ISnapHttpClient>(_ => new SnapHttpClient(new HttpClient()));
container.Register<ISnapInstallerEmbeddedResources>(_ => new SnapInstallerEmbeddedResources());
container.Register<INuGetPackageSources>(c =>
new NuGetMachineWidePackageSources(
c.GetInstance<ISnapFilesystem>(),
workingDirectory
)
);
container.Register<ISnapCryptoProvider>(c => new SnapCryptoProvider());
container.Register<ISnapAppReader>(c => new SnapAppReader());
container.Register<ISnapAppWriter>(c => new SnapAppWriter());
container.Register<ISnapCryptoProvider>(_ => new SnapCryptoProvider());
container.Register<ISnapAppReader>(_ => new SnapAppReader());
container.Register<ISnapAppWriter>(_ => new SnapAppWriter());
container.Register<ISnapBinaryPatcher>(c => new SnapBinaryPatcher(c.GetInstance<IBsdiffLib>()));
container.Register<ISnapPack>(c => new SnapPack(
c.GetInstance<ISnapFilesystem>(),
Expand All @@ -210,7 +210,7 @@ static IServiceContainer BuildEnvironment(ISnapOs snapOs, CancellationTokenSourc
c.GetInstance<ISnapOs>(),
c.GetInstance<ISnapAppWriter>()
));
container.Register<ISnapNugetLogger>(c => new NugetLogger(logger));
container.Register<ISnapNugetLogger>(_ => new NugetLogger(logger));
container.Register<INugetService>(c => new NugetService(
c.GetInstance<ISnapFilesystem>(),
c.GetInstance<ISnapNugetLogger>())
Expand Down
5 changes: 1 addition & 4 deletions src/Snap.Installer/ViewModels/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@

namespace Snap.Installer.ViewModels;

internal abstract class ViewModelBase : ReactiveObject
{

}
internal abstract class ViewModelBase : ReactiveObject;
21 changes: 9 additions & 12 deletions src/Snap.Shared.Tests/BaseFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,22 @@ public SnapApp BuildSnapApp(string id = "demoapp", bool isGenesis = false,
Version = new SemanticVersion(1, 0, 0),
IsGenesis = isGenesis,
IsFull = isGenesis,
Channels = new List<SnapChannel>
{
Channels =
[
testChannel,
stagingChannel,
productionChannel
},
],
Target = new SnapTarget
{
Framework = "net8.0",
Shortcuts = new List<SnapShortcutLocation>
{
Shortcuts =
[
SnapShortcutLocation.Desktop,
SnapShortcutLocation.Startup,
SnapShortcutLocation.StartMenu
},
PersistentAssets = new List<string>
{
"application.json"
},
],
PersistentAssets = ["application.json"],
Environment = new Dictionary<string, string>
{
{ "TEST", "123" }
Expand All @@ -152,7 +149,7 @@ public SnapApps BuildSnapApps()
{
Schema = 1,
Channels = snapApp.Channels.Select(x => new SnapsChannel(x)).ToList(),
Apps = new List<SnapsApp> { new(snapApp) },
Apps = [new(snapApp)],
Generic = new SnapAppsGeneric
{
Nuspecs = "snap/nuspecs",
Expand Down Expand Up @@ -277,7 +274,7 @@ public AssemblyDefinition BuildExecutable(string applicationName, bool randomVer

AddVersioningAttributes(assemblyDefinition, semanticVersion);

assemblyReferencesDefinitions ??= new List<AssemblyDefinition>();
assemblyReferencesDefinitions ??= [];

foreach (var assemblyReferenceDefinition in assemblyReferencesDefinitions)
{
Expand Down
Loading

0 comments on commit 19eb167

Please sign in to comment.