feat(netd): add code generation
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-10-05 16:17:14 -04:00
parent d311d5de3c
commit 2220fccf7a
6 changed files with 10579 additions and 7 deletions

View file

@ -1,2 +1,3 @@
obj obj
bin bin
NetDaemonCodegen

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,11 @@
}, },
"ConsoleThemeType": "Ansi" "ConsoleThemeType": "Ansi"
}, },
"HomeAssistant": {
"Host": "homie.nelim.org",
"Port": 443,
"Ssl": true
},
"NetDaemon": { "NetDaemon": {
"ApplicationConfigurationFolder": "./apps" "ApplicationConfigurationFolder": "./apps"
}, },

View file

@ -42,10 +42,17 @@ in {
environment.systemPackages = [ environment.systemPackages = [
(pkgs.writeShellApplication { (pkgs.writeShellApplication {
name = "updateNuDeps"; name = "updateNuDeps";
runtimeInputs = [pkgs.dotnet-sdk_8]; runtimeInputs = with pkgs; [
dos2unix
dotnet-sdk_8
];
text = '' text = ''
# Update the codegen # Install codegen
dotnet tool update -g NetDaemon.HassModel.CodeGen dotnet tool install --create-manifest-if-needed NetDaemon.HassModel.CodeGen
# Run it
dotnet tool run nd-codegen -token "$(sed 's/HomeAssistant__Token=//' ${secrets.netdaemon.path})"
dos2unix ./HomeAssistantGenerated.cs
# Update all nugets to latest versions # Update all nugets to latest versions
regex='PackageReference Include="([^"]*)" Version="([^"]*)"' regex='PackageReference Include="([^"]*)" Version="([^"]*)"'
@ -63,6 +70,7 @@ in {
${compiled.passthru.fetch-deps} . ${compiled.passthru.fetch-deps} .
alejandra . alejandra .
rm -r "$FLAKE/.config"
''; '';
}) })
]; ];

View file

@ -4,8 +4,7 @@ using NetDaemon.Extensions.Logging;
using NetDaemon.Extensions.Scheduler; using NetDaemon.Extensions.Scheduler;
using NetDaemon.Extensions.Tts; using NetDaemon.Extensions.Tts;
using NetDaemon.Runtime; using NetDaemon.Runtime;
// Add next line if using code generator using HomeAssistantGenerated;
//using HomeAssistantGenerated;
#pragma warning disable CA1812 #pragma warning disable CA1812
@ -21,8 +20,7 @@ try
.AddAppsFromAssembly(Assembly.GetExecutingAssembly()) .AddAppsFromAssembly(Assembly.GetExecutingAssembly())
.AddNetDaemonStateManager() .AddNetDaemonStateManager()
.AddNetDaemonScheduler() .AddNetDaemonScheduler()
// Add next line if using code generator .AddHomeAssistantGenerated()
// .AddHomeAssistantGenerated()
) )
.Build() .Build()
.RunAsync() .RunAsync()

Binary file not shown.