Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkit Jain <radical@gmail.com>2021-09-17 02:38:26 +0300
committerGitHub <noreply@github.com>2021-09-17 02:38:26 +0300
commit4af01264ae1537e9a0551406c6e58b181093a670 (patch)
tree35a796636402a1c1b573bffdbf4338b765ba966b /src/tasks/WasmAppBuilder/WasmAppBuilder.cs
parent16a0ab39f17e1a0ec39825b085c0d0cc8fd751b2 (diff)
[wasm] Add support for native relinking after Build, and… (#59153)
… AOT after publish (#58913) Forward port #58913 (cherry picked from commit f38d58f)
Diffstat (limited to 'src/tasks/WasmAppBuilder/WasmAppBuilder.cs')
-rw-r--r--src/tasks/WasmAppBuilder/WasmAppBuilder.cs25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs
index 57cb7c383f1..58b4b9259e6 100644
--- a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs
+++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs
@@ -118,10 +118,23 @@ public class WasmAppBuilder : Task
public override bool Execute ()
{
+ try
+ {
+ return ExecuteInternal();
+ }
+ catch (LogAsErrorException laee)
+ {
+ Log.LogError(laee.Message);
+ return false;
+ }
+ }
+
+ private bool ExecuteInternal ()
+ {
if (!File.Exists(MainJS))
- throw new ArgumentException($"File MainJS='{MainJS}' doesn't exist.");
+ throw new LogAsErrorException($"File MainJS='{MainJS}' doesn't exist.");
if (!InvariantGlobalization && string.IsNullOrEmpty(IcuDataFileName))
- throw new ArgumentException("IcuDataFileName property shouldn't be empty if InvariantGlobalization=false");
+ throw new LogAsErrorException("IcuDataFileName property shouldn't be empty if InvariantGlobalization=false");
if (Assemblies?.Length == 0)
{
@@ -162,8 +175,12 @@ public class WasmAppBuilder : Task
}
FileCopyChecked(MainJS!, Path.Combine(AppDir, "runtime.js"), string.Empty);
- var html = @"<html><body><script type=""text/javascript"" src=""runtime.js""></script></body></html>";
- File.WriteAllText(Path.Combine(AppDir, "index.html"), html);
+ string indexHtmlPath = Path.Combine(AppDir, "index.html");
+ if (!File.Exists(indexHtmlPath))
+ {
+ var html = @"<html><body><script type=""text/javascript"" src=""runtime.js""></script></body></html>";
+ File.WriteAllText(indexHtmlPath, html);
+ }
foreach (var assembly in _assemblies)
{