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

Add support to set created mpak file name from CLI #460

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected override async ValueTask ExecuteCommand()
var postlinkDir = Path.Combine(file.Directory?.FullName ?? string.Empty, PackageManager.PostLinkDirectoryName);

Logger?.LogInformation($"Assembling the MPAK...");
var packagePath = await _packageManager.AssemblePackage(postlinkDir, packageDir, osVersion, Filter, true, CancellationToken);
var packagePath = await _packageManager.AssemblePackage(postlinkDir, packageDir, osVersion, MpakName, Filter, true, CancellationToken);

if (packagePath != null)
{
Expand Down
4 changes: 2 additions & 2 deletions Source/v2/Meadow.Package/IPackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ Task TrimApplication(
IList<string>? noLink = null,
CancellationToken? cancellationToken = null);

Task<string> AssemblePackage(
string contentSourceFolder,
Task<string> AssemblePackage(string contentSourceFolder,
string outputFolder,
string osVersion,
string? mpakName = null,
string filter = "*",
bool overwrite = false,
CancellationToken? cancellationToken = null);
Expand Down
7 changes: 4 additions & 3 deletions Source/v2/Meadow.Package/PackageManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ public Task TrimApplication(

public const string PackageMetadataFileName = "info.json";

public Task<string> AssemblePackage(
string contentSourceFolder,
public Task<string> AssemblePackage(string contentSourceFolder,
string outputFolder,
string osVersion,
string? mpakName = null,
string filter = "*",
bool overwrite = false,
CancellationToken? cancellationToken = null)
Expand All @@ -177,7 +177,8 @@ public Task<string> AssemblePackage(
di.Create();
}

var mpakName = Path.Combine(outputFolder, $"{DateTime.UtcNow:yyyyMMddff}.mpak");
// uncomment to force ".mpak" extension. mpakName = Path.ChangeExtension(mpakName, ".mpak");
mpakName = Path.Combine(outputFolder, string.IsNullOrWhiteSpace(mpakName) ? $"{DateTime.UtcNow:yyyyMMddff}.mpak" : mpakName);

if (File.Exists(mpakName))
{
Expand Down
Loading