Skip to content

Commit

Permalink
Merge pull request #460 from doingnz/develop-support-mpakname-cli-par…
Browse files Browse the repository at this point in the history
…ameter

Add support to set created mpak file name from CLI
  • Loading branch information
ctacke committed Feb 10, 2024
2 parents 0dcdee8 + 6c16788 commit 227fbdf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,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 @@ -165,10 +165,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 @@ -179,7 +179,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

0 comments on commit 227fbdf

Please sign in to comment.