Skip to content

Commit

Permalink
Warning no files (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
helto4real committed Apr 12, 2020
1 parent 9db7760 commit b952c49
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/push_addon_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ jobs:
- uses: actions/checkout@master
- name: "Set version number"
run: |
sed -i '/ const string _version = /c\ const string _version = "dev build";' ${{github.workspace}}/src/DaemonRunner/DaemonRunner/Service/RunnerService.cs
sed -i '/ const string _version = /c\ const string _version = "dev build addon";' ${{github.workspace}}/src/DaemonRunner/DaemonRunner/Service/RunnerService.cs
- name: Run deploy script using builder
run: docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ${{github.workspace}}/addon:/data homeassistant/amd64-builder -t /data --all --docker-user ${{ secrets.DOCKER_USERNAME }} --docker-password ${{ secrets.DOCKER_TOKEN }}
2 changes: 1 addition & 1 deletion addon/rootfs/etc/services.d/NetDaemon/finish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/execlineb -S0
#!/usr/bin/execlineb -S1
# ==============================================================================
# NetDaemon Service
# Take down the S6 supervision tree when NetDaemon fails
Expand Down
20 changes: 18 additions & 2 deletions src/DaemonRunner/DaemonRunner/Service/App/CodeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ public CodeManager(string codeFolder, ILogger logger)
_loadedDaemonApps = new List<Type>(100);
_instanciatedDaemonApps = new List<INetDaemonApp>(100);

_logger.LogInformation("Loading code and configuration from {path}", Path.GetFullPath(codeFolder));

_yamlConfig = new YamlConfig(codeFolder);

LoadLocalAssemblyApplicationsForDevelopment();
Expand Down Expand Up @@ -237,7 +239,13 @@ public async Task<IEnumerable<INetDaemonApp>> InstanceAndInitApplications(INetDa
CompileScriptsInCodeFolder();

var result = new List<INetDaemonApp>();
foreach (string file in _yamlConfig.GetAllConfigFilePaths())
var allConfigFilePaths = _yamlConfig.GetAllConfigFilePaths();

if (allConfigFilePaths.Count() == 0)
{
_logger.LogWarning("No yaml configuration files found, please add files to [netdaemonfolder]/apps");
}
foreach (string file in allConfigFilePaths)
{
var yamlAppConfig = new YamlAppConfig(DaemonAppTypes, File.OpenText(file), _yamlConfig, file);

Expand Down Expand Up @@ -380,7 +388,15 @@ private void LoadAllCodeToLoadContext()

using (var peStream = new MemoryStream())
{
foreach (var csFile in GetCsFiles(_codeFolder))

var csFiles = GetCsFiles(_codeFolder);
if (csFiles.Count() == 0 && _loadedDaemonApps.Count() == 0)
{
// Only log when not have locally built assemblies, typically in dev environment
_logger.LogWarning("No .cs files files found, please add files to [netdaemonfolder]/apps");
}

foreach (var csFile in csFiles)
{
var sourceText = SourceText.From(File.ReadAllText(csFile));
var syntaxTree = SyntaxFactory.ParseSyntaxTree(sourceText, path: csFile);
Expand Down

0 comments on commit b952c49

Please sign in to comment.