Skip to content

Commit

Permalink
Update app run command to pass build config to deploy step + minor cl…
Browse files Browse the repository at this point in the history
…eanup
  • Loading branch information
adrianstevens committed Dec 12, 2024
1 parent bcce9f7 commit 5f3c0d6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Source/v2/Meadow.Cli/Commands/Current/App/AppDeployCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private FileInfo GetMeadowAppFile(string path)
return file;
}

private async Task<bool> DeployApplication(IMeadowConnection connection, string osVersion, string path, CancellationToken GetAvailableBuiltConfigurations)
private async Task<bool> DeployApplication(IMeadowConnection connection, string osVersion, string path, CancellationToken cancellationToken)
{
connection.FileWriteProgress += OnFileWriteProgress;

Expand All @@ -103,7 +103,7 @@ private async Task<bool> DeployApplication(IMeadowConnection connection, string

Logger?.LogInformation($"Deploying app from {file.DirectoryName}...");

await AppManager.DeployApplication(_packageManager, connection, osVersion, file.DirectoryName!, true, false, Logger, GetAvailableBuiltConfigurations);
await AppManager.DeployApplication(_packageManager, connection, osVersion, file.DirectoryName!, true, false, Logger, cancellationToken);

connection.FileWriteProgress -= OnFileWriteProgress;

Expand Down
13 changes: 10 additions & 3 deletions Source/v2/Meadow.Cli/Commands/Current/App/AppRunCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected override async ValueTask ExecuteCommand()
throw new CommandException(Strings.AppTrimFailed, CommandExitCode.GeneralError);
}

if (!await DeployApplication(connection, path, CancellationToken))
if (!await DeployApplication(connection, path, Configuration, CancellationToken))
{
throw new CommandException(Strings.AppDeployFailed, CommandExitCode.GeneralError);
}
Expand All @@ -94,7 +94,7 @@ protected override async ValueTask ExecuteCommand()
Logger?.LogInformation("Listen cancelled...");
}

private async Task<bool> DeployApplication(IMeadowConnection connection, string path, CancellationToken cancellationToken)
private async Task<bool> DeployApplication(IMeadowConnection connection, string path, string configuration, CancellationToken cancellationToken)
{
connection.FileWriteProgress += OnFileWriteProgress;

Expand All @@ -113,7 +113,14 @@ private async Task<bool> DeployApplication(IMeadowConnection connection, string
return false;
}

var file = candidates.OrderByDescending(c => c.LastWriteTime).First();
//get the file that matches the configuration
var file = candidates.FirstOrDefault(c => c.DirectoryName.Contains(configuration, StringComparison.OrdinalIgnoreCase));

if (file == null)
{
Logger?.LogError($"Cannot find a compiled application for configuration '{configuration}'");
return false;
}

Logger?.LogInformation($"Deploying app from {file.DirectoryName}...");

Expand Down

0 comments on commit 5f3c0d6

Please sign in to comment.