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

[v2] [refactor] Update meadow firmware download command to use Meadow Cloud #447

Merged
merged 17 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .github/workflows/dotnet-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@ jobs:
- name: Build CLI v2
run: dotnet build -c Release Meadow.CLI/Source/v2/Meadow.CLI.v2.sln

- name: Unit Test CLI v2
run: dotnet test -c Release --no-build --no-restore --filter "FullyQualifiedName~.Unit.Tests" .\Meadow.CLI\Source\v2\Meadow.CLI.v2.sln


1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ PublishScripts/
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
!**/Source/v2/Meadow.Cloud.Client/**/packages/*
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
Expand Down
1 change: 0 additions & 1 deletion Source/v2/Meadow.CLI.Core/Meadow.CLI.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Meadow.Cloud.Client\Meadow.Cloud.Client.csproj" />
<ProjectReference Include="..\Meadow.HCom\Meadow.HCom.csproj" />
<ProjectReference Include="..\Meadow.SoftwareManager\Meadow.SoftwareManager.csproj" />
<ProjectReference Include="..\Meadow.UsbLib.Core\Meadow.UsbLib.Core.csproj" />
Expand Down
1 change: 1 addition & 0 deletions Source/v2/Meadow.CLI.Core/PackageManager/PackageManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using GlobExpressions;
using LinkerTest;
using Meadow.Cloud;
using Meadow.Cloud.Client;
using Meadow.Software;
using System.Diagnostics;
using System.IO.Compression;
Expand Down
42 changes: 30 additions & 12 deletions Source/v2/Meadow.CLI.v2.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.HCom", "Meadow.HCom\Meadow.HCom.csproj", "{6C2FA084-701B-4A28-8775-BF18B84E366B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.HCom.Integration.Tests", "Meadow.HCom.Integration.Tests\Meadow.HCom.Integration.Tests.csproj", "{9EAF2357-2AB3-45BB-822B-B9B4629E651E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.CLI", "Meadow.CLI\Meadow.CLI.csproj", "{1BD32521-158C-478A-AEE7-0EE52BF3571F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.Contracts", "..\..\..\Meadow.Contracts\Source\Meadow.Contracts\Meadow.Contracts.csproj", "{62D2092A-5A19-47AC-9B81-A8F5D9D7BD47}"
Expand All @@ -18,8 +16,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.Units", "..\..\..\Me
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.SoftwareManager", "Meadow.SoftwareManager\Meadow.SoftwareManager.csproj", "{B842E44B-F57F-4728-980F-776DE6E2CDAA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.SoftwareManager.Unit.Tests", "Meadow.SoftwareManager.Unit.Tests\Meadow.SoftwareManager.Unit.Tests.csproj", "{B093D40B-AA2F-4BA8-9B7E-DB14DAC9AFC9}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.UsbLib", "Meadow.UsbLib\Meadow.UsbLib.csproj", "{5B071B58-550C-492D-8A24-973D4183FAAF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.UsbLibClassic", "Meadow.UsbLibClassic\Meadow.UsbLibClassic.csproj", "{42F3A4D2-CBF9-4DF3-8ADC-BF775101F34A}"
Expand All @@ -30,6 +26,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.Cloud.Client", "Mead
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.UsbLib.Core", "Meadow.UsbLib.Core\Meadow.UsbLib.Core.csproj", "{F02ADBEF-4D52-4A71-9D95-74F45D68B43B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{21DDDD82-ED2C-49F3-988A-97F34D4AE8F5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.HCom.Integration.Tests", "Tests\Meadow.HCom.Integration.Tests\Meadow.HCom.Integration.Tests.csproj", "{F6617A9E-0CE9-4F6E-8D0B-F90DCD5FAC67}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.SoftwareManager.Unit.Tests", "Tests\Meadow.SoftwareManager.Unit.Tests\Meadow.SoftwareManager.Unit.Tests.csproj", "{5EE89C75-DCDA-40A6-920B-0FA7915AB1D8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.SoftwareManager.Integration.Tests", "Tests\Meadow.SoftwareManager.Integration.Tests\Meadow.SoftwareManager.Integration.Tests.csproj", "{6D8D2257-09C0-4DCF-9E06-60A7D44A3FDC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Meadow.Cloud.Client.Unit.Tests", "Tests\Meadow.Cloud.Client.Unit.Tests\Meadow.Cloud.Client.Unit.Tests.csproj", "{E5DD4338-135A-4906-B67D-3EF2C44C96D9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -40,10 +46,6 @@ Global
{6C2FA084-701B-4A28-8775-BF18B84E366B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C2FA084-701B-4A28-8775-BF18B84E366B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C2FA084-701B-4A28-8775-BF18B84E366B}.Release|Any CPU.Build.0 = Release|Any CPU
{9EAF2357-2AB3-45BB-822B-B9B4629E651E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9EAF2357-2AB3-45BB-822B-B9B4629E651E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EAF2357-2AB3-45BB-822B-B9B4629E651E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EAF2357-2AB3-45BB-822B-B9B4629E651E}.Release|Any CPU.Build.0 = Release|Any CPU
{1BD32521-158C-478A-AEE7-0EE52BF3571F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1BD32521-158C-478A-AEE7-0EE52BF3571F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1BD32521-158C-478A-AEE7-0EE52BF3571F}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -68,10 +70,6 @@ Global
{B842E44B-F57F-4728-980F-776DE6E2CDAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B842E44B-F57F-4728-980F-776DE6E2CDAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B842E44B-F57F-4728-980F-776DE6E2CDAA}.Release|Any CPU.Build.0 = Release|Any CPU
{B093D40B-AA2F-4BA8-9B7E-DB14DAC9AFC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B093D40B-AA2F-4BA8-9B7E-DB14DAC9AFC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B093D40B-AA2F-4BA8-9B7E-DB14DAC9AFC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B093D40B-AA2F-4BA8-9B7E-DB14DAC9AFC9}.Release|Any CPU.Build.0 = Release|Any CPU
{5B071B58-550C-492D-8A24-973D4183FAAF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B071B58-550C-492D-8A24-973D4183FAAF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B071B58-550C-492D-8A24-973D4183FAAF}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -92,6 +90,22 @@ Global
{F02ADBEF-4D52-4A71-9D95-74F45D68B43B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F02ADBEF-4D52-4A71-9D95-74F45D68B43B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F02ADBEF-4D52-4A71-9D95-74F45D68B43B}.Release|Any CPU.Build.0 = Release|Any CPU
{F6617A9E-0CE9-4F6E-8D0B-F90DCD5FAC67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6617A9E-0CE9-4F6E-8D0B-F90DCD5FAC67}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6617A9E-0CE9-4F6E-8D0B-F90DCD5FAC67}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6617A9E-0CE9-4F6E-8D0B-F90DCD5FAC67}.Release|Any CPU.Build.0 = Release|Any CPU
{5EE89C75-DCDA-40A6-920B-0FA7915AB1D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EE89C75-DCDA-40A6-920B-0FA7915AB1D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EE89C75-DCDA-40A6-920B-0FA7915AB1D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EE89C75-DCDA-40A6-920B-0FA7915AB1D8}.Release|Any CPU.Build.0 = Release|Any CPU
{6D8D2257-09C0-4DCF-9E06-60A7D44A3FDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D8D2257-09C0-4DCF-9E06-60A7D44A3FDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D8D2257-09C0-4DCF-9E06-60A7D44A3FDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D8D2257-09C0-4DCF-9E06-60A7D44A3FDC}.Release|Any CPU.Build.0 = Release|Any CPU
{E5DD4338-135A-4906-B67D-3EF2C44C96D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5DD4338-135A-4906-B67D-3EF2C44C96D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5DD4338-135A-4906-B67D-3EF2C44C96D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5DD4338-135A-4906-B67D-3EF2C44C96D9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -100,6 +114,10 @@ Global
{62D2092A-5A19-47AC-9B81-A8F5D9D7BD47} = {562945CE-DA15-4A2E-86A2-CA7E3FF22DCA}
{946B7200-8CC1-4A8D-9BCE-FCB06EDC705B} = {562945CE-DA15-4A2E-86A2-CA7E3FF22DCA}
{5DC0D8EC-85D4-4E98-9403-2D5B9700D8AC} = {562945CE-DA15-4A2E-86A2-CA7E3FF22DCA}
{F6617A9E-0CE9-4F6E-8D0B-F90DCD5FAC67} = {21DDDD82-ED2C-49F3-988A-97F34D4AE8F5}
{5EE89C75-DCDA-40A6-920B-0FA7915AB1D8} = {21DDDD82-ED2C-49F3-988A-97F34D4AE8F5}
{6D8D2257-09C0-4DCF-9E06-60A7D44A3FDC} = {21DDDD82-ED2C-49F3-988A-97F34D4AE8F5}
{E5DD4338-135A-4906-B67D-3EF2C44C96D9} = {21DDDD82-ED2C-49F3-988A-97F34D4AE8F5}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9BA76C46-6C2E-447A-BCAD-423B3C51C52D}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using CliFx.Attributes;
using CliFx.Exceptions;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using CliFx.Attributes;
using CliFx.Exceptions;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using CliFx.Attributes;
using CliFx.Exceptions;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using CliFx.Attributes;
using CliFx.Exceptions;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
2 changes: 1 addition & 1 deletion Source/v2/Meadow.CLI/Meadow.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<PackageReference Include="Serilog" Version="3.0.1" />
<PackageReference Include="CliFx" Version="*" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
<PackageReference Include="System.Management" Version="7.0.2" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />
Expand All @@ -42,7 +43,6 @@

<ItemGroup>
<ProjectReference Include="..\Meadow.CLI.Core\Meadow.CLI.Core.csproj" />
<ProjectReference Include="..\Meadow.SoftwareManager\Meadow.SoftwareManager.csproj" />
<ProjectReference Include="..\Meadow.UsbLibClassic\Meadow.UsbLibClassic.csproj" />
<ProjectReference Include="..\Meadow.UsbLib\Meadow.UsbLib.csproj" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions Source/v2/Meadow.Cli/Commands/Current/BaseCloudCommand.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CliFx.Attributes;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CliFx.Attributes;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CliFx.Attributes;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using CliFx.Attributes;
using CliFx.Exceptions;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;
using System.Text.Json;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CliFx.Attributes;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Meadow.Software;
using Microsoft.Extensions.Logging;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CliFx.Attributes;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CliFx.Attributes;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using CliFx.Attributes;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using CliFx.Attributes;
using Meadow.Cloud;
using Meadow.Cloud.Client;
using Microsoft.Extensions.Logging;

namespace Meadow.CLI.Commands.DeviceManagement;
Expand Down Expand Up @@ -112,7 +112,7 @@ protected override async ValueTask ExecuteCommand()

if (!valid)
{
Logger?.LogError("Device returned an invali dpublic key");
Logger?.LogError("Device returned an invalid public key");
return;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
using CliFx.Attributes;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Meadow.Software;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using System.Net.Http.Headers;

namespace Meadow.CLI.Commands.DeviceManagement;

[Command("firmware download", Description = "Download a firmware package")]
public class FirmwareDownloadCommand : BaseFileCommand<FirmwareDownloadCommand>
{
public FirmwareDownloadCommand(FileManager fileManager, ISettingsManager settingsManager, ILoggerFactory loggerFactory)
private readonly IMeadowCloudClient _meadowCloudClient;

public FirmwareDownloadCommand(
FileManager fileManager,
IMeadowCloudClient meadowCloudClient,
ISettingsManager settingsManager,
ILoggerFactory loggerFactory)
: base(fileManager, settingsManager, loggerFactory)
{ }
{
_meadowCloudClient = meadowCloudClient;
}

[CommandOption("force", 'f', IsRequired = false)]
public bool Force { get; init; }

[CommandOption("version", 'v', IsRequired = false)]
public string? Version { get; set; }

[CommandOption("host", Description = "Optionally set a host (default is https://www.meadowcloud.co)", IsRequired = false)]
public string? Host { get; set; }

protected override async ValueTask ExecuteCommand()
{
var isAuthenticated = await _meadowCloudClient.Authenticate(Host, CancellationToken);
if (!isAuthenticated)
{
Logger?.LogError($"You must be signed into Meadow.Cloud to execute this command. Run 'meadow cloud login' to do so.");
return;
}

await FileManager.Refresh();

// for now we only support F7
Expand Down Expand Up @@ -51,7 +73,13 @@ protected override async ValueTask ExecuteCommand()

if (!isAvailable)
{
Logger?.LogError($"Requested package version '{Version}' is not available.");
Logger?.LogError($"Requested package version '{Version}' is not available");
return;
}

if (collection[Version] != null)
{
Logger?.LogInformation($"Firmware package '{Version}' already exists locally");
return;
}

Expand Down
6 changes: 4 additions & 2 deletions Source/v2/Meadow.Cli/Commands/Legacy/DownloadOsCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using CliFx.Attributes;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Meadow.Software;
using Microsoft.Extensions.Logging;

Expand All @@ -7,8 +9,8 @@ namespace Meadow.CLI.Commands.DeviceManagement;
[Command("download os", Description = "** Deprecated ** Use `firmware download` instead")]
public class DownloadOsCommand : FirmwareDownloadCommand
{
public DownloadOsCommand(FileManager fileManager, ISettingsManager settingsManager, ILoggerFactory loggerFactory)
: base(fileManager, settingsManager, loggerFactory)
public DownloadOsCommand(FileManager fileManager, IMeadowCloudClient meadowCloudClient, ISettingsManager settingsManager, ILoggerFactory loggerFactory)
: base(fileManager, meadowCloudClient, settingsManager, loggerFactory)
{
Logger?.LogWarning($"Deprecated command - use `firmware download` instead");
}
Expand Down
18 changes: 15 additions & 3 deletions Source/v2/Meadow.Cli/Program.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
using CliFx;
using Meadow.CLI;
using Meadow.CLI.Commands.DeviceManagement;
using Meadow.Cloud;
using Meadow.Cloud.Identity;
using Meadow.Cloud.Client;
using Meadow.Cloud.Client.Identity;
using Meadow.Software;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Http;
using Serilog;
using Serilog.Events;
using System.Diagnostics;
using System.Runtime.CompilerServices;

[assembly: InternalsVisibleTo("Meadow.SoftwareManager")]

public class Program
{
Expand Down Expand Up @@ -56,7 +61,14 @@ public static async Task<int> Main(string[] args)
services.AddSingleton<PackageService>();
services.AddSingleton<ApiTokenService>();
services.AddSingleton<IdentityManager>();
services.AddSingleton<JsonDocumentBindingConverter>();
services.AddSingleton<JsonDocumentBindingConverter>();
services.AddSingleton<IMeadowCloudClient, MeadowCloudClient>();
services.AddSingleton(MeadowCloudUserAgent.Cli);

services.AddHttpClient<MeadowCloudClient>();

// Required to disable console logging of HttpClient
services.RemoveAll<IHttpMessageHandlerBuilderFilter>();

if (File.Exists("appsettings.json"))
{
Expand Down
Loading
Loading