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

Update app run command to pass build config to deploy step #607

Merged
merged 1 commit into from
Dec 12, 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
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
Loading