Skip to content

Commit f40bb6a

Browse files
committed
2 parents b2351a5 + 0ce49ab commit f40bb6a

1 file changed

Lines changed: 30 additions & 18 deletions

File tree

apps/pwabuilder-microsoft-store/Services/PwaBuilderWrapper.cs

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ public class PwaBuilderWrapper
3030
protected readonly WindowsActionsService windowsActionService;
3131

3232
public PwaBuilderWrapper(
33-
IOptions<AppSettings> settings,
33+
IOptions<AppSettings> settings,
3434
ProcessRunner procRunner,
35-
IWebHostEnvironment host,
35+
IWebHostEnvironment host,
3636
ILogger<PwaBuilderWrapper> logger,
3737
IHttpClientFactory httpClientFactory,
3838
TempDirectory tempDirectory,
@@ -59,12 +59,12 @@ public PwaBuilderWrapper(
5959
/// <param name="fallback"></param>
6060
/// <returns></returns>
6161
public async Task<PwaBuilderCommandLineResult> Run(
62-
WindowsAppPackageOptions options,
63-
ImageGeneratorResult appImages,
64-
WebAppManifestContext webManifest,
62+
WindowsAppPackageOptions options,
63+
ImageGeneratorResult appImages,
64+
WebAppManifestContext webManifest,
6565
string outputDirectory,
6666
string processor,
67-
bool fallback,
67+
bool fallback,
6868
CancellationToken cancelToken)
6969
{
7070
var pwaBuilderFilePath = Path.Combine(host.ContentRootPath, PwaBuilderPath);
@@ -104,16 +104,27 @@ private async Task<PwaBuilderCommandLineResult> RunPwabuilderExe(WindowsAppPacka
104104

105105
protected virtual string PwaBuilderPath => settings.PwaBuilderPath;
106106

107-
private ProcessException CreatePwaBuilderCliError(Exception innerException, string message, WindowsActionsFiles? actionFiles, string outputDirectory, WindowsAppPackageOptions options, string? standardOutput, string? standardErrorOutput, ImageGeneratorResult appImages, WebAppManifestContext webManifest)
107+
private ProcessException CreatePwaBuilderCliError(
108+
Exception innerException,
109+
string message,
110+
WindowsActionsFiles? actionFiles,
111+
string outputDirectory,
112+
WindowsAppPackageOptions options,
113+
string? standardOutput,
114+
string? standardErrorOutput,
115+
ImageGeneratorResult appImages,
116+
WebAppManifestContext webManifest)
108117
{
109-
var msixOptionsStr = CreateCommandLineArgs(options, appImages, webManifest, actionFiles, outputDirectory);
118+
var pwabuilderCLIArgs = CreateCommandLineArgs(options, appImages, webManifest, actionFiles, outputDirectory);
110119
var formattedMessage = string.Join(Environment.NewLine + Environment.NewLine, message, $"Output directory: {outputDirectory}", $"Standard output: {standardOutput}", $"Standard error: {standardErrorOutput}");
111120
var toolFailedError = new ProcessException(formattedMessage, innerException, standardOutput, standardErrorOutput);
112121
toolFailedError.Data.Add("StandardOutput", standardOutput);
113122
toolFailedError.Data.Add("StandardError", standardErrorOutput);
114123
toolFailedError.Data.Add("outputDirectory", outputDirectory);
115-
toolFailedError.Data.Add("msixOptions", msixOptionsStr);
124+
toolFailedError.Data.Add("pwabuilderCLIArgs", pwabuilderCLIArgs);
116125
toolFailedError.Data.Add("url", options.Url);
126+
toolFailedError.Data.Add("appImagesCount", appImages.ImagePaths.Count);
127+
toolFailedError.Data.Add("appImages", appImages.ImagePaths);
117128
logger.LogError(toolFailedError, toolFailedError.Message);
118129
return toolFailedError;
119130
}
@@ -174,16 +185,16 @@ var startUrl when string.IsNullOrWhiteSpace(startUrl) => null, // If null, pwa_b
174185

175186
if (fallback && options.ManifestFilePath != null)
176187
{
177-
args.Add( "manifest-file", options.ManifestFilePath );
188+
args.Add("manifest-file", options.ManifestFilePath);
178189
}
179190

180-
if(options.EnableWebAppWidgets != null)
191+
if (options.EnableWebAppWidgets != null)
181192
{
182-
if(options.EnableWebAppWidgets == true)
193+
if (options.EnableWebAppWidgets == true)
183194
{
184195
args.Add("enable-features", "msWebAppWidgets");
185196
//For sideload package, there is no processor specification. For store package, there is.
186-
if (processor != "")
197+
if (processor != "")
187198
{
188199
args.Add("processor-architecture", processor);
189200
}
@@ -192,23 +203,24 @@ var startUrl when string.IsNullOrWhiteSpace(startUrl) => null, // If null, pwa_b
192203

193204
//Allowed values for targetDeviceFamilies are Holographic, Desktop and Team
194205
if (options.TargetDeviceFamilies != null)
195-
{
196-
string families = string.Join(";", options.TargetDeviceFamilies.Select(family => {
197-
switch(family.ToLower())
206+
{
207+
string families = string.Join(";", options.TargetDeviceFamilies.Select(family =>
208+
{
209+
switch (family.ToLower())
198210
{
199211
case "desktop": return "Windows.Desktop";
200212
case "holographic": return "Windows.Holographic";
201213
case "team": return "Windows.Team";
202214
default: return "";
203215
}
204216

205-
}));
217+
}));
206218

207219
if (families != null && families != "")
208220
{
209221
args.Add("target-device-family", families);
210222
}
211-
223+
212224
}
213225

214226

0 commit comments

Comments
 (0)