From b7d4a0c9d3ad7f5774c2de00130579d196ba50f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Wed, 23 Nov 2022 10:29:42 +0100 Subject: [PATCH 1/3] Add WASM000x warning code to all warning produced in WasmAppBuilder. --- src/tasks/WasmAppBuilder/IcallTableGenerator.cs | 2 +- src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs | 2 +- src/tasks/WasmAppBuilder/WasmAppBuilder.cs | 4 ++-- src/tasks/WasmAppBuilder/WasmLoadAssembliesAndReferences.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/tasks/WasmAppBuilder/IcallTableGenerator.cs b/src/tasks/WasmAppBuilder/IcallTableGenerator.cs index c40b6b4c6ec20a..7f6062d8da777b 100644 --- a/src/tasks/WasmAppBuilder/IcallTableGenerator.cs +++ b/src/tasks/WasmAppBuilder/IcallTableGenerator.cs @@ -204,7 +204,7 @@ private void ProcessType(Type type) } catch (NotImplementedException nie) { - Log.LogWarning($"Failed to generate icall function for method '[{method.DeclaringType!.Assembly.GetName().Name}] {className}::{method.Name}'" + + Log.LogWarning(null, "WASM0001", "", "", 0, 0, 0, 0, $"Failed to generate icall function for method '[{method.DeclaringType!.Assembly.GetName().Name}] {className}::{method.Name}'" + $" because type '{nie.Message}' is not supported for parameter named '{par.Name}'. Ignoring."); return null; } diff --git a/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs b/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs index 74349b38166dde..ad2e43772cf8ea 100644 --- a/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs +++ b/src/tasks/WasmAppBuilder/PInvokeTableGenerator.cs @@ -210,7 +210,7 @@ private void EmitPInvokeTable(StreamWriter w, Dictionary modules string imports = string.Join(Environment.NewLine, candidates.Select( p => $" {p.Method} (in [{p.Method.DeclaringType?.Assembly.GetName().Name}] {p.Method.DeclaringType})")); - Log.LogWarning($"Found a native function ({first.EntryPoint}) with varargs in {first.Module}." + + Log.LogWarning(null, "WASM0001", "", "", 0, 0, 0, 0, $"Found a native function ({first.EntryPoint}) with varargs in {first.Module}." + " Calling such functions is not supported, and will fail at runtime." + $" Managed DllImports: {Environment.NewLine}{imports}"); diff --git a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs index c45a413ef53e6f..2fead7b9860bfd 100644 --- a/src/tasks/WasmAppBuilder/WasmAppBuilder.cs +++ b/src/tasks/WasmAppBuilder/WasmAppBuilder.cs @@ -253,7 +253,7 @@ private bool ExecuteInternal () string fullPath = assembly.GetMetadata("Identity"); if (string.IsNullOrEmpty(culture)) { - Log.LogWarning($"Missing CultureName metadata for satellite assembly {fullPath}"); + Log.LogWarning(null, "WASM0002", "", "", 0, 0, 0, 0, $"Missing CultureName metadata for satellite assembly {fullPath}"); continue; } // FIXME: validate the culture? @@ -290,7 +290,7 @@ private bool ExecuteInternal () if (firstPath == secondPath) { - Log.LogWarning($"Found identical vfs mappings for target path: {targetPath}, source file: {firstPath}. Ignoring."); + Log.LogWarning(null, "WASM0003", "", "", 0, 0, 0, 0, $"Found identical vfs mappings for target path: {targetPath}, source file: {firstPath}. Ignoring."); continue; } diff --git a/src/tasks/WasmAppBuilder/WasmLoadAssembliesAndReferences.cs b/src/tasks/WasmAppBuilder/WasmLoadAssembliesAndReferences.cs index de765e54093aee..e124835b45a99a 100644 --- a/src/tasks/WasmAppBuilder/WasmLoadAssembliesAndReferences.cs +++ b/src/tasks/WasmAppBuilder/WasmLoadAssembliesAndReferences.cs @@ -76,7 +76,7 @@ private bool AddAssemblyAndReferences(MetadataLoadContext mlc, Assembly assembly { if (SkipMissingAssemblies) { - Log.LogWarning($"Loading assembly reference '{aname}' for '{assembly.GetName()}' failed: {ex.Message} Skipping."); + Log.LogWarning(null, "WASM0004", "", "", 0, 0, 0, 0, $"Loading assembly reference '{aname}' for '{assembly.GetName()}' failed: {ex.Message} Skipping."); } else { From bd893ecc3e2219184a0cf8876ae86d3b724ee90e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Thu, 24 Nov 2022 15:19:59 +0100 Subject: [PATCH 2/3] Feedback from @radical. --- src/tasks/WasmAppBuilder/EmccCompile.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/tasks/WasmAppBuilder/EmccCompile.cs b/src/tasks/WasmAppBuilder/EmccCompile.cs index cec8460e6251fc..0641e799d9258c 100644 --- a/src/tasks/WasmAppBuilder/EmccCompile.cs +++ b/src/tasks/WasmAppBuilder/EmccCompile.cs @@ -271,8 +271,7 @@ bool IsNewerThanOutput(string inFile, string outFile, out string reason) { if (!File.Exists(inFile)) { - reason = $"Could not find dependency file {inFile} needed for compiling {srcFile} to {outFile}"; - Log.LogWarning(reason); + reason = $"the dependency file {inFile} needed for compiling {srcFile} to {outFile} could not be found."; return true; } From dcab141802ad0e72fb4d126c2dbb8382fa976525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Thu, 24 Nov 2022 15:23:48 +0100 Subject: [PATCH 3/3] Fix analyzer. --- src/tasks/WasmAppBuilder/EmccCompile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tasks/WasmAppBuilder/EmccCompile.cs b/src/tasks/WasmAppBuilder/EmccCompile.cs index 0641e799d9258c..c09633303da203 100644 --- a/src/tasks/WasmAppBuilder/EmccCompile.cs +++ b/src/tasks/WasmAppBuilder/EmccCompile.cs @@ -244,7 +244,7 @@ ITaskItem CreateOutputItemFor(string srcFile, string objFile) } } - private bool ShouldCompile(string srcFile, string objFile, string[] depFiles, out string reason) + private static bool ShouldCompile(string srcFile, string objFile, string[] depFiles, out string reason) { if (!File.Exists(srcFile)) throw new LogAsErrorException($"Could not find source file {srcFile}");