From 57d9cb90b5db6ddc8bcdc34914630dc41469dfc9 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Thu, 25 Jul 2024 13:23:11 +0200 Subject: [PATCH 01/13] Handle MSBuild properties NoWarn, TreatWarningsAsErrors, WarningsAsErrors --- src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets | 3 +++ src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets index f937f4ab5..f6e455458 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets @@ -277,6 +277,9 @@ Value = b.ToString(); <_IkvmCompilerArgs Include="-nologo" /> <_IkvmCompilerArgs Include="-bootstrap" Condition=" '$(Bootstrap)' == 'true' " /> <_IkvmCompilerArgs Include="-debug:$(DebugType)" Condition=" '$(DebugType)' != 'none' " /> + <_IkvmCompilerArgs Include="-nowarn:$(NoWarn)" Condition=" '$(NoWarn)' != '' " /> + <_IkvmCompilerArgs Include="-warnaserror" Condition=" '$(TreatWarningsAsErrors)' == 'true' " /> + <_IkvmCompilerArgs Include="-warnaserror:$(WarningsAsErrors)" Condition=" '$(TreatWarningsAsErrors)' != 'true' And '$(WarningsAsErrors)' != '' " /> <_IkvmCompilerArgs Include="-assembly:$(AssemblyName)" /> <_IkvmCompilerArgs Include="-version:$(AssemblyVersion)" /> <_IkvmCompilerArgs Include="-runtime:$(IkvmRuntimeAssembly)" /> diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets index f0106ab7b..49b6f507f 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets @@ -126,6 +126,9 @@ Platform="$(PlatformTarget.ToLowerInvariant())" Main="$(StartupObject)" Debug="$(DebugType)" + NoWarn="$(NoWarn)" + WarnAsError="$(TreatWarningsAsErrors)" + WarnAsErrorWarnings="$(WarningsAsErrors)" KeyFile="$(KeyOriginatorFile)" CompressResources="$(CompressResources)" ClassLoader="$(ClassLoader)" From 8e9dd13cb4d2df562c2fc6e3186f9a802d9028ab Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Thu, 25 Jul 2024 13:49:21 +0200 Subject: [PATCH 02/13] Fix args --- src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets index f6e455458..6125691e4 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets @@ -277,9 +277,9 @@ Value = b.ToString(); <_IkvmCompilerArgs Include="-nologo" /> <_IkvmCompilerArgs Include="-bootstrap" Condition=" '$(Bootstrap)' == 'true' " /> <_IkvmCompilerArgs Include="-debug:$(DebugType)" Condition=" '$(DebugType)' != 'none' " /> - <_IkvmCompilerArgs Include="-nowarn:$(NoWarn)" Condition=" '$(NoWarn)' != '' " /> + <_IkvmCompilerArgs Include="-nowarn:"$(NoWarn)"" Condition=" '$(NoWarn)' != '' " /> <_IkvmCompilerArgs Include="-warnaserror" Condition=" '$(TreatWarningsAsErrors)' == 'true' " /> - <_IkvmCompilerArgs Include="-warnaserror:$(WarningsAsErrors)" Condition=" '$(TreatWarningsAsErrors)' != 'true' And '$(WarningsAsErrors)' != '' " /> + <_IkvmCompilerArgs Include="-warnaserror:"$(WarningsAsErrors)"" Condition=" '$(TreatWarningsAsErrors)' != 'true' And '$(WarningsAsErrors)' != '' " /> <_IkvmCompilerArgs Include="-assembly:$(AssemblyName)" /> <_IkvmCompilerArgs Include="-version:$(AssemblyVersion)" /> <_IkvmCompilerArgs Include="-runtime:$(IkvmRuntimeAssembly)" /> From 8909ae47e21db4b41ca56925c2fca354a054acce Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Thu, 25 Jul 2024 14:51:01 +0200 Subject: [PATCH 03/13] Use Replace function on string Property --- src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets | 4 ++-- src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets index 6125691e4..fae26f215 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.NoTasks.targets @@ -277,9 +277,9 @@ Value = b.ToString(); <_IkvmCompilerArgs Include="-nologo" /> <_IkvmCompilerArgs Include="-bootstrap" Condition=" '$(Bootstrap)' == 'true' " /> <_IkvmCompilerArgs Include="-debug:$(DebugType)" Condition=" '$(DebugType)' != 'none' " /> - <_IkvmCompilerArgs Include="-nowarn:"$(NoWarn)"" Condition=" '$(NoWarn)' != '' " /> + <_IkvmCompilerArgs Include="-nowarn:$(NoWarn.Replace(';', ','))" Condition=" '$(NoWarn)' != '' " /> <_IkvmCompilerArgs Include="-warnaserror" Condition=" '$(TreatWarningsAsErrors)' == 'true' " /> - <_IkvmCompilerArgs Include="-warnaserror:"$(WarningsAsErrors)"" Condition=" '$(TreatWarningsAsErrors)' != 'true' And '$(WarningsAsErrors)' != '' " /> + <_IkvmCompilerArgs Include="-warnaserror:$(WarningsAsErrors.Replace(';', ','))" Condition=" '$(TreatWarningsAsErrors)' != 'true' And '$(WarningsAsErrors)' != '' " /> <_IkvmCompilerArgs Include="-assembly:$(AssemblyName)" /> <_IkvmCompilerArgs Include="-version:$(AssemblyVersion)" /> <_IkvmCompilerArgs Include="-runtime:$(IkvmRuntimeAssembly)" /> diff --git a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets index 49b6f507f..e0baab8a5 100644 --- a/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets +++ b/src/IKVM.NET.Sdk/targets/IKVM.Java.Core.Tasks.targets @@ -126,9 +126,9 @@ Platform="$(PlatformTarget.ToLowerInvariant())" Main="$(StartupObject)" Debug="$(DebugType)" - NoWarn="$(NoWarn)" + NoWarn="$(NoWarn.Replace(',', ';'))" WarnAsError="$(TreatWarningsAsErrors)" - WarnAsErrorWarnings="$(WarningsAsErrors)" + WarnAsErrorWarnings="$(WarningsAsErrors.Replace(',', ';'))" KeyFile="$(KeyOriginatorFile)" CompressResources="$(CompressResources)" ClassLoader="$(ClassLoader)" From 4cfe880c25ca1e61f64c839978562dd6d84a5e0b Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Tue, 30 Jul 2024 13:57:19 +0200 Subject: [PATCH 04/13] Handle MSBuild-style warnings (Prefix0000) --- .../CompilerClassLoader.cs | 8 +- .../IkvmImporterInternal.cs | 75 ++++-- src/IKVM.Tools.Importer/StaticCompiler.cs | 247 +----------------- 3 files changed, 52 insertions(+), 278 deletions(-) diff --git a/src/IKVM.Tools.Importer/CompilerClassLoader.cs b/src/IKVM.Tools.Importer/CompilerClassLoader.cs index b03d8b438..3a3323101 100644 --- a/src/IKVM.Tools.Importer/CompilerClassLoader.cs +++ b/src/IKVM.Tools.Importer/CompilerClassLoader.cs @@ -3415,8 +3415,8 @@ sealed class CompilerOptions internal uint fileAlignment; internal bool highentropyva; internal List sharedclassloader; // should *not* be deep copied in Copy(), because we want the list of all compilers that share a class loader - internal Dictionary suppressWarnings = new Dictionary(); - internal Dictionary errorWarnings = new Dictionary(); // treat specific warnings as errors + internal HashSet suppressWarnings = new HashSet(StringComparer.OrdinalIgnoreCase); + internal HashSet errorWarnings = new HashSet(StringComparer.OrdinalIgnoreCase); internal bool warnaserror; // treat all warnings as errors internal FileInfo writeSuppressWarningsFile; internal List proxies = new List(); @@ -3438,8 +3438,8 @@ internal CompilerOptions Copy() { copy.externalResources = new Dictionary(externalResources); } - copy.suppressWarnings = new Dictionary(suppressWarnings); - copy.errorWarnings = new Dictionary(errorWarnings); + copy.suppressWarnings = new(suppressWarnings, StringComparer.OrdinalIgnoreCase); + copy.errorWarnings = new(errorWarnings, StringComparer.OrdinalIgnoreCase); return copy; } diff --git a/src/IKVM.Tools.Importer/IkvmImporterInternal.cs b/src/IKVM.Tools.Importer/IkvmImporterInternal.cs index 96da26085..1ff598e88 100644 --- a/src/IKVM.Tools.Importer/IkvmImporterInternal.cs +++ b/src/IKVM.Tools.Importer/IkvmImporterInternal.cs @@ -748,15 +748,7 @@ void ContinueParseCommandLine(RuntimeContext context, StaticCompiler compiler, I } else if (s.StartsWith("-nowarn:")) { - foreach (var w in s.Substring(8).Split(',')) - { - // lame way to chop off the leading zeroes - string ws = w; - while (ws.StartsWith("0")) - ws = ws.Substring(1); - - options.suppressWarnings[ws] = ws; - } + HandleWarnArg(options.suppressWarnings, s.Substring(8)); } else if (s == "-warnaserror") { @@ -764,15 +756,7 @@ void ContinueParseCommandLine(RuntimeContext context, StaticCompiler compiler, I } else if (s.StartsWith("-warnaserror:")) { - foreach (string w in s.Substring(13).Split(',')) - { - // lame way to chop off the leading zeroes - string ws = w; - while (ws.StartsWith("0")) - ws = ws.Substring(1); - - options.errorWarnings[ws] = ws; - } + HandleWarnArg(options.errorWarnings, s.Substring(8)); } else if (s.StartsWith("-runtime:")) { @@ -1446,20 +1430,18 @@ internal static void IssueMessage(StaticCompiler compiler, CompilerOptions optio return; } - string key = ((int)msgId).ToString(); - for (int i = 0; ; i++) + var msgIdKey = $"{(int)msgId}"; + string key = msgIdKey; + foreach (var item in values) { - if (options.suppressWarnings.ContainsKey(key)) + if (options.suppressWarnings.Contains(key)) { return; } - if (i == values.Length) - { - break; - } - key += ":" + values[i]; + + key = $"{key}:{item}"; } - options.suppressWarnings.Add(key, key); + options.suppressWarnings.Add(key); if (options.writeSuppressWarningsFile != null) { File.AppendAllText(options.writeSuppressWarningsFile.FullName, "-nowarn:" + key + Environment.NewLine); @@ -1665,8 +1647,8 @@ internal static void IssueMessage(StaticCompiler compiler, CompilerOptions optio } bool error = msgId >= Message.StartErrors || (options.warnaserror && msgId >= Message.StartWarnings) - || options.errorWarnings.ContainsKey(key) - || options.errorWarnings.ContainsKey(((int)msgId).ToString()); + || options.errorWarnings.Contains(key) + || options.errorWarnings.Contains(msgIdKey); Console.Error.Write("{0} IKVMC{1:D4}: ", error ? "error" : msgId < Message.StartWarnings ? "note" : "warning", (int)msgId); if (error && Message.StartWarnings <= msgId && msgId < Message.StartErrors) { @@ -1686,6 +1668,41 @@ internal static void IssueMessage(StaticCompiler compiler, CompilerOptions optio } } + internal static void HandleWarnArg(ICollection target, string arg) + { + foreach (var w in arg.Split(',')) + { + // Strip IKVMC prefix + int prefixStart = w.StartsWith("IKVMC", StringComparison.OrdinalIgnoreCase) ? 5 : 0; + int contextIndex = w.IndexOf(':', prefixStart); + string context = string.Empty; + string parse; + if(contextIndex != -1) + { + // context includes ':' separator + context = w.Substring(contextIndex); + parse = w.Substring(prefixStart, contextIndex - prefixStart); + } + else + { + parse = w.Substring(prefixStart); + } + + if (!int.TryParse(parse, out var intResult)) + { + if (!Enum.TryParse(parse, out var namedResult)) + { + continue; // silently continue + } + + // Warnings are handled as int. + intResult = (int)namedResult; + } + + // Check IssueMessage + target.Add($"{intResult}{context}"); + } + } } } diff --git a/src/IKVM.Tools.Importer/StaticCompiler.cs b/src/IKVM.Tools.Importer/StaticCompiler.cs index bfc78180a..ea2460cae 100644 --- a/src/IKVM.Tools.Importer/StaticCompiler.cs +++ b/src/IKVM.Tools.Importer/StaticCompiler.cs @@ -230,7 +230,7 @@ internal void IssueMissingTypeMessage(Type type) internal void SuppressWarning(CompilerOptions options, Message message, string name) { - options.suppressWarnings[(int)message + ":" + name] = null; + options.suppressWarnings.Add($"{(int)message}:{name}"); } internal void IssueMessage(Message msgId, params string[] values) @@ -240,250 +240,7 @@ internal void IssueMessage(Message msgId, params string[] values) internal void IssueMessage(CompilerOptions options, Message msgId, params string[] values) { - if (errorCount != 0 && msgId < Message.StartErrors && !options.warnaserror) - { - // don't display any warnings after we've emitted an error message - return; - } - - string key = ((int)msgId).ToString(); - for (int i = 0; ; i++) - { - if (options.suppressWarnings.ContainsKey(key)) - { - return; - } - if (i == values.Length) - { - break; - } - key += ":" + values[i]; - } - options.suppressWarnings.Add(key, key); - if (options.writeSuppressWarningsFile != null) - { - File.AppendAllText(options.writeSuppressWarningsFile.FullName, "-nowarn:" + key + Environment.NewLine); - } - string msg; - switch (msgId) - { - case Message.MainMethodFound: - msg = "Found main method in class \"{0}\""; - break; - case Message.OutputFileIs: - msg = "Output file is \"{0}\""; - break; - case Message.AutoAddRef: - msg = "Automatically adding reference to \"{0}\""; - break; - case Message.MainMethodFromManifest: - msg = "Using main class \"{0}\" based on jar manifest"; - break; - case Message.ClassNotFound: - msg = "Class \"{0}\" not found"; - break; - case Message.ClassFormatError: - msg = "Unable to compile class \"{0}\"" + Environment.NewLine + - " (class format error \"{1}\")"; - break; - case Message.DuplicateClassName: - msg = "Duplicate class name: \"{0}\""; - break; - case Message.IllegalAccessError: - msg = "Unable to compile class \"{0}\"" + Environment.NewLine + - " (illegal access error \"{1}\")"; - break; - case Message.VerificationError: - msg = "Unable to compile class \"{0}\"" + Environment.NewLine + - " (verification error \"{1}\")"; - break; - case Message.NoClassDefFoundError: - msg = "Unable to compile class \"{0}\"" + Environment.NewLine + - " (missing class \"{1}\")"; - break; - case Message.GenericUnableToCompileError: - msg = "Unable to compile class \"{0}\"" + Environment.NewLine + - " (\"{1}\": \"{2}\")"; - break; - case Message.DuplicateResourceName: - msg = "Skipping resource (name clash): \"{0}\""; - break; - case Message.SkippingReferencedClass: - msg = "Skipping class: \"{0}\"" + Environment.NewLine + - " (class is already available in referenced assembly \"{1}\")"; - break; - case Message.NoJniRuntime: - msg = "Unable to load runtime JNI assembly"; - break; - case Message.EmittedNoClassDefFoundError: - msg = "Emitted java.lang.NoClassDefFoundError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedIllegalAccessError: - msg = "Emitted java.lang.IllegalAccessError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedInstantiationError: - msg = "Emitted java.lang.InstantiationError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedIncompatibleClassChangeError: - msg = "Emitted java.lang.IncompatibleClassChangeError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedNoSuchFieldError: - msg = "Emitted java.lang.NoSuchFieldError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedAbstractMethodError: - msg = "Emitted java.lang.AbstractMethodError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedNoSuchMethodError: - msg = "Emitted java.lang.NoSuchMethodError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedLinkageError: - msg = "Emitted java.lang.LinkageError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedVerificationError: - msg = "Emitted java.lang.VerificationError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.EmittedClassFormatError: - msg = "Emitted java.lang.ClassFormatError in \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.InvalidCustomAttribute: - msg = "Error emitting \"{0}\" custom attribute" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.IgnoredCustomAttribute: - msg = "Custom attribute \"{0}\" was ignored" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.AssumeAssemblyVersionMatch: - msg = "Assuming assembly reference \"{0}\" matches \"{1}\", you may need to supply runtime policy"; - break; - case Message.InvalidDirectoryInLibOptionPath: - msg = "Directory \"{0}\" specified in -lib option is not valid"; - break; - case Message.InvalidDirectoryInLibEnvironmentPath: - msg = "Directory \"{0}\" specified in LIB environment is not valid"; - break; - case Message.LegacySearchRule: - msg = "Found assembly \"{0}\" using legacy search rule, please append '.dll' to the reference"; - break; - case Message.AssemblyLocationIgnored: - msg = "Assembly \"{0}\" is ignored as previously loaded assembly \"{1}\" has the same identity \"{2}\""; - break; - case Message.InterfaceMethodCantBeInternal: - msg = "Ignoring @ikvm.lang.Internal annotation on interface method" + Environment.NewLine + - " (\"{0}.{1}{2}\")"; - break; - case Message.NonPrimaryAssemblyReference: - msg = "Referenced assembly \"{0}\" is not the primary assembly of a shared class loader group, please reference primary assembly \"{1}\" instead"; - break; - case Message.MissingType: - msg = "Reference to type \"{0}\" claims it is defined in \"{1}\", but it could not be found"; - break; - case Message.MissingReference: - msg = "The type '{0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{1}'"; - break; - case Message.DuplicateAssemblyReference: - msg = "Duplicate assembly reference \"{0}\""; - break; - case Message.UnableToResolveType: - msg = "Reference in \"{0}\" to type \"{1}\" claims it is defined in \"{2}\", but it could not be found"; - break; - case Message.StubsAreDeprecated: - msg = "Compiling stubs is deprecated. Please add a reference to assembly \"{0}\" instead."; - break; - case Message.WrongClassName: - msg = "Unable to compile \"{0}\" (wrong name: \"{1}\")"; - break; - case Message.ReflectionCallerClassRequiresCallerID: - msg = "Reflection.getCallerClass() called from non-CallerID method" + Environment.NewLine + - " (\"{0}.{1}{2}\")"; - break; - case Message.LegacyAssemblyAttributesFound: - msg = "Legacy assembly attributes container found. Please use the -assemblyattributes: option."; - break; - case Message.UnableToCreateLambdaFactory: - msg = "Unable to create static lambda factory."; - break; - case Message.UnableToCreateProxy: - msg = "Unable to create proxy \"{0}\"" + Environment.NewLine + - " (\"{1}\")"; - break; - case Message.DuplicateProxy: - msg = "Duplicate proxy \"{0}\""; - break; - case Message.MapXmlUnableToResolveOpCode: - msg = "Unable to resolve opcode in remap file: {0}"; - break; - case Message.MapXmlError: - msg = "Error in remap file: {0}"; - break; - case Message.InputFileNotFound: - msg = "Source file '{0}' not found"; - break; - case Message.UnknownFileType: - msg = "Unknown file type: {0}"; - break; - case Message.UnknownElementInMapFile: - msg = "Unknown element {0} in remap file, line {1}, column {2}"; - break; - case Message.UnknownAttributeInMapFile: - msg = "Unknown attribute {0} in remap file, line {1}, column {2}"; - break; - case Message.InvalidMemberNameInMapFile: - msg = "Invalid {0} name '{1}' in remap file in class {2}"; - break; - case Message.InvalidMemberSignatureInMapFile: - msg = "Invalid {0} signature '{3}' in remap file for {0} {1}.{2}"; - break; - case Message.InvalidPropertyNameInMapFile: - msg = "Invalid property {0} name '{3}' in remap file for property {1}.{2}"; - break; - case Message.InvalidPropertySignatureInMapFile: - msg = "Invalid property {0} signature '{3}' in remap file for property {1}.{2}"; - break; - case Message.UnknownWarning: - msg = "{0}"; - break; - case Message.CallerSensitiveOnUnsupportedMethod: - msg = "CallerSensitive annotation on unsupported method" + Environment.NewLine + - " (\"{0}.{1}{2}\")"; - break; - case Message.RemappedTypeMissingDefaultInterfaceMethod: - msg = "{0} does not implement default interface method {1}"; - break; - default: - throw new InvalidProgramException(); - } - bool error = msgId >= Message.StartErrors - || (options.warnaserror && msgId >= Message.StartWarnings) - || options.errorWarnings.ContainsKey(key) - || options.errorWarnings.ContainsKey(((int)msgId).ToString()); - Console.Error.Write("{0} IKVMC{1:D4}: ", error ? "error" : msgId < Message.StartWarnings ? "note" : "warning", (int)msgId); - if (error && Message.StartWarnings <= msgId && msgId < Message.StartErrors) - { - Console.Error.Write("Warning as Error: "); - } - Console.Error.WriteLine(msg, values); - if (options != this.rootTarget && options.path != null) - { - Console.Error.WriteLine(" (in {0})", options.path); - } - if (error) - { - if (++errorCount == 100) - { - throw new FatalCompilerErrorException(Message.MaximumErrorCountReached); - } - } + IkvmImporterInternal.IssueMessage(this, options, msgId, values); } } From 25f168d0ef0a043a087287a695d6b3b1a127254c Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Tue, 30 Jul 2024 14:10:10 +0200 Subject: [PATCH 05/13] Restore previous behavior --- src/IKVM.Tools.Importer/IkvmImporterInternal.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/IKVM.Tools.Importer/IkvmImporterInternal.cs b/src/IKVM.Tools.Importer/IkvmImporterInternal.cs index 1ff598e88..395aaa8ab 100644 --- a/src/IKVM.Tools.Importer/IkvmImporterInternal.cs +++ b/src/IKVM.Tools.Importer/IkvmImporterInternal.cs @@ -1432,14 +1432,17 @@ internal static void IssueMessage(StaticCompiler compiler, CompilerOptions optio var msgIdKey = $"{(int)msgId}"; string key = msgIdKey; - foreach (var item in values) + for (int i = 0; ; i++) { if (options.suppressWarnings.Contains(key)) { return; } - - key = $"{key}:{item}"; + if (i == values.Length) + { + break; + } + key = $"{key}:{values[i]}"; } options.suppressWarnings.Add(key); if (options.writeSuppressWarningsFile != null) From 9cafba9a56b0d7b5f43f8d1316bafd13dda7175b Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Wed, 31 Jul 2024 09:49:00 +0200 Subject: [PATCH 06/13] Missed --- src/IKVM.Tools.Importer/IkvmImporterInternal.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IKVM.Tools.Importer/IkvmImporterInternal.cs b/src/IKVM.Tools.Importer/IkvmImporterInternal.cs index 395aaa8ab..935be11fe 100644 --- a/src/IKVM.Tools.Importer/IkvmImporterInternal.cs +++ b/src/IKVM.Tools.Importer/IkvmImporterInternal.cs @@ -756,7 +756,7 @@ void ContinueParseCommandLine(RuntimeContext context, StaticCompiler compiler, I } else if (s.StartsWith("-warnaserror:")) { - HandleWarnArg(options.errorWarnings, s.Substring(8)); + HandleWarnArg(options.errorWarnings, s.Substring(13)); } else if (s.StartsWith("-runtime:")) { From 543f2368f71c38d0ec6aa20d462e78e65c71d941 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Wed, 31 Jul 2024 14:04:42 +0200 Subject: [PATCH 07/13] Forward messages from IKVMc as-is --- src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs | 4 ++++ src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs index 80ec27e7f..1dab4bebb 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs @@ -58,6 +58,10 @@ public Task ReceiveAsync(IkvmToolDiagnosticEvent @event) logger.LogWarning(@event.Message, @event.MessageArgs); writer?.WriteLine("ERROR: " + @event.Message, @event.MessageArgs); break; + + case 0: // Unknown Level, passthrough message + logger.LogMessage(@event.Message, @event.MessageArgs); + break; } } catch diff --git a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs index 2a4673a91..c3c9f6f9e 100644 --- a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs +++ b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs @@ -299,8 +299,9 @@ public async Task ExecuteAsync(IkvmImporterOptions options, CancellationTok await LogEvent(IkvmToolDiagnosticEventLevel.Debug, "Executing {0} {1}", cli.TargetFilePath, cli.Arguments); // send output to MSBuild - cli = cli.WithStandardErrorPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Error, i))); - cli = cli.WithStandardOutputPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Debug, i))); + var logUnknown = PipeTarget.ToDelegate(i => LogEvent(0, i)); + cli = cli.WithStandardErrorPipe(logUnknown); + cli = cli.WithStandardOutputPipe(logUnknown); // combine manual cancellation with timeout var ctk = cts.Token; From a1f709ddaa8d0e93dadcd72d1c26c80370a7c20b Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Wed, 31 Jul 2024 14:45:58 +0200 Subject: [PATCH 08/13] Use Unknown enum value --- src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs | 2 +- src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs | 1 + src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs index 1dab4bebb..a08394c4d 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs @@ -59,7 +59,7 @@ public Task ReceiveAsync(IkvmToolDiagnosticEvent @event) writer?.WriteLine("ERROR: " + @event.Message, @event.MessageArgs); break; - case 0: // Unknown Level, passthrough message + case IkvmToolDiagnosticEventLevel.Unknown: // Unknown Level, passthrough message logger.LogMessage(@event.Message, @event.MessageArgs); break; } diff --git a/src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs b/src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs index bfef692c9..1190b62bb 100644 --- a/src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs +++ b/src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs @@ -11,6 +11,7 @@ public enum IkvmToolDiagnosticEventLevel Information, Warning, Error, + Unknown = -1 } diff --git a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs index c3c9f6f9e..2497a4bed 100644 --- a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs +++ b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs @@ -299,7 +299,7 @@ public async Task ExecuteAsync(IkvmImporterOptions options, CancellationTok await LogEvent(IkvmToolDiagnosticEventLevel.Debug, "Executing {0} {1}", cli.TargetFilePath, cli.Arguments); // send output to MSBuild - var logUnknown = PipeTarget.ToDelegate(i => LogEvent(0, i)); + var logUnknown = PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Unknown, i)); cli = cli.WithStandardErrorPipe(logUnknown); cli = cli.WithStandardOutputPipe(logUnknown); From 423c0ab689fb3968b2a8999ba16d6f129d6da587 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Thu, 1 Aug 2024 12:54:43 +0200 Subject: [PATCH 09/13] LogMessage logs a message LogMessageFrom* performs parsing on the message received --- src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs index a08394c4d..11d0aaa68 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using IKVM.Tools.Runner; +using Microsoft.Build.Framework; namespace IKVM.MSBuild.Tasks { @@ -43,11 +44,11 @@ public Task ReceiveAsync(IkvmToolDiagnosticEvent @event) switch (@event.Level) { case IkvmToolDiagnosticEventLevel.Debug: - logger.LogMessage(Microsoft.Build.Framework.MessageImportance.Low, @event.Message, @event.MessageArgs); + logger.LogMessage(MessageImportance.Low, @event.Message, @event.MessageArgs); writer?.WriteLine("DEBUG: " + @event.Message, @event.MessageArgs); break; case IkvmToolDiagnosticEventLevel.Information: - logger.LogMessage(Microsoft.Build.Framework.MessageImportance.Normal, @event.Message, @event.MessageArgs); + logger.LogMessage(MessageImportance.Normal, @event.Message, @event.MessageArgs); writer?.WriteLine("INFO: " + @event.Message, @event.MessageArgs); break; case IkvmToolDiagnosticEventLevel.Warning: @@ -60,7 +61,9 @@ public Task ReceiveAsync(IkvmToolDiagnosticEvent @event) break; case IkvmToolDiagnosticEventLevel.Unknown: // Unknown Level, passthrough message - logger.LogMessage(@event.Message, @event.MessageArgs); + var message = string.Format(@event.Message, @event.MessageArgs); + logger.LogMessageFromText(message, MessageImportance.Normal); + writer?.WriteLine(message); break; } } From 927cd22d37da91f938256143746ee46959e8f5a8 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Mon, 19 Aug 2024 12:08:04 +0200 Subject: [PATCH 10/13] Attempt parsing first characters for MSBuild-style warning codes. If found, use these informations to log message --- .../IkvmToolTaskDiagnosticWriter.cs | 43 ++++++++++++++----- .../IkvmToolDiagnosticEventLevel.cs | 1 - .../Importer/IkvmImporterLauncher.cs | 5 +-- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs index 11d0aaa68..991979cfc 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs @@ -39,32 +39,53 @@ public Task ReceiveAsync(IkvmToolDiagnosticEvent @event) if (@event == null) return Task.CompletedTask; + // 19: "warning IKVMC0000: " + ( + IkvmToolDiagnosticEventLevel Level, + string Code, + string Message + )? structuredLog = null; + + if (@event.Message.IndexOf("IKVMC", 0, 19, StringComparison.OrdinalIgnoreCase) is { } keyIndex and not -1 + && @event.Message.IndexOf(": ", keyIndex, 11) is { } messageStart and not -1) + { +#pragma warning disable IDE0079 // Unused suppression (net472 doesn't produce IDE0057) +#pragma warning disable IDE0057 // Suppress net6 & net8 analyzer for range-operations + var levelString = @event.Message.Substring(0, keyIndex - 1); + structuredLog = ( + levelString.ToUpperInvariant() switch + { + "ERROR" => IkvmToolDiagnosticEventLevel.Error, + "WARNING" => IkvmToolDiagnosticEventLevel.Warning, + _ => IkvmToolDiagnosticEventLevel.Information + }, + @event.Message.Substring(keyIndex, 9), + @event.Message.Substring(messageStart + 2) + ); +#pragma warning restore + } + try { - switch (@event.Level) + string message = structuredLog?.Message ?? @event.Message; + switch (structuredLog?.Level ?? @event.Level) { case IkvmToolDiagnosticEventLevel.Debug: - logger.LogMessage(MessageImportance.Low, @event.Message, @event.MessageArgs); + logger.LogMessage(null, structuredLog?.Code, null, null, 0, 0, 0, 0, MessageImportance.Low, message, @event.MessageArgs); writer?.WriteLine("DEBUG: " + @event.Message, @event.MessageArgs); break; case IkvmToolDiagnosticEventLevel.Information: - logger.LogMessage(MessageImportance.Normal, @event.Message, @event.MessageArgs); + logger.LogMessage(null, structuredLog?.Code, null, null, 0, 0, 0, 0, MessageImportance.Normal, message, @event.MessageArgs); writer?.WriteLine("INFO: " + @event.Message, @event.MessageArgs); break; case IkvmToolDiagnosticEventLevel.Warning: - logger.LogWarning(@event.Message, @event.MessageArgs); + logger.LogWarning(null, structuredLog?.Code, null, null, 0, 0, 0, 0, message, @event.MessageArgs); writer?.WriteLine("WARN: " + @event.Message, @event.MessageArgs); break; case IkvmToolDiagnosticEventLevel.Error: - logger.LogWarning(@event.Message, @event.MessageArgs); + logger.LogError(null, structuredLog?.Code, null, null, 0, 0, 0, 0, message, @event.MessageArgs); writer?.WriteLine("ERROR: " + @event.Message, @event.MessageArgs); break; - - case IkvmToolDiagnosticEventLevel.Unknown: // Unknown Level, passthrough message - var message = string.Format(@event.Message, @event.MessageArgs); - logger.LogMessageFromText(message, MessageImportance.Normal); - writer?.WriteLine(message); - break; } } catch diff --git a/src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs b/src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs index 1190b62bb..bfef692c9 100644 --- a/src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs +++ b/src/IKVM.Tools.Runner/IkvmToolDiagnosticEventLevel.cs @@ -11,7 +11,6 @@ public enum IkvmToolDiagnosticEventLevel Information, Warning, Error, - Unknown = -1 } diff --git a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs index 2497a4bed..2a4673a91 100644 --- a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs +++ b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs @@ -299,9 +299,8 @@ public async Task ExecuteAsync(IkvmImporterOptions options, CancellationTok await LogEvent(IkvmToolDiagnosticEventLevel.Debug, "Executing {0} {1}", cli.TargetFilePath, cli.Arguments); // send output to MSBuild - var logUnknown = PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Unknown, i)); - cli = cli.WithStandardErrorPipe(logUnknown); - cli = cli.WithStandardOutputPipe(logUnknown); + cli = cli.WithStandardErrorPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Error, i))); + cli = cli.WithStandardOutputPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Debug, i))); // combine manual cancellation with timeout var ctk = cts.Token; From dfcd7d1dfbff359fe4bd2b51e68a0070800f4865 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Mon, 19 Aug 2024 12:13:24 +0200 Subject: [PATCH 11/13] Simplify logging --- .../IkvmToolTaskDiagnosticWriter.cs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs index 991979cfc..5c8ccb33e 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs @@ -3,6 +3,7 @@ using System.Threading.Tasks; using IKVM.Tools.Runner; + using Microsoft.Build.Framework; namespace IKVM.MSBuild.Tasks @@ -44,7 +45,7 @@ public Task ReceiveAsync(IkvmToolDiagnosticEvent @event) IkvmToolDiagnosticEventLevel Level, string Code, string Message - )? structuredLog = null; + ) structuredLog; if (@event.Message.IndexOf("IKVMC", 0, 19, StringComparison.OrdinalIgnoreCase) is { } keyIndex and not -1 && @event.Message.IndexOf(": ", keyIndex, 11) is { } messageStart and not -1) @@ -64,26 +65,29 @@ string Message ); #pragma warning restore } + else + { + structuredLog = (@event.Level, null, @event.Message); + } try { - string message = structuredLog?.Message ?? @event.Message; - switch (structuredLog?.Level ?? @event.Level) + switch (structuredLog.Level) { case IkvmToolDiagnosticEventLevel.Debug: - logger.LogMessage(null, structuredLog?.Code, null, null, 0, 0, 0, 0, MessageImportance.Low, message, @event.MessageArgs); + logger.LogMessage(null, structuredLog.Code, null, null, 0, 0, 0, 0, MessageImportance.Low, structuredLog.Message, @event.MessageArgs); writer?.WriteLine("DEBUG: " + @event.Message, @event.MessageArgs); break; case IkvmToolDiagnosticEventLevel.Information: - logger.LogMessage(null, structuredLog?.Code, null, null, 0, 0, 0, 0, MessageImportance.Normal, message, @event.MessageArgs); + logger.LogMessage(null, structuredLog.Code, null, null, 0, 0, 0, 0, MessageImportance.Normal, structuredLog.Message, @event.MessageArgs); writer?.WriteLine("INFO: " + @event.Message, @event.MessageArgs); break; case IkvmToolDiagnosticEventLevel.Warning: - logger.LogWarning(null, structuredLog?.Code, null, null, 0, 0, 0, 0, message, @event.MessageArgs); + logger.LogWarning(null, structuredLog.Code, null, null, 0, 0, 0, 0, structuredLog.Message, @event.MessageArgs); writer?.WriteLine("WARN: " + @event.Message, @event.MessageArgs); break; case IkvmToolDiagnosticEventLevel.Error: - logger.LogError(null, structuredLog?.Code, null, null, 0, 0, 0, 0, message, @event.MessageArgs); + logger.LogError(null, structuredLog.Code, null, null, 0, 0, 0, 0, structuredLog.Message, @event.MessageArgs); writer?.WriteLine("ERROR: " + @event.Message, @event.MessageArgs); break; } From e86b482bb014ae95ad4de4c0630c4ae528f8bb71 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Mon, 19 Aug 2024 12:50:56 +0200 Subject: [PATCH 12/13] Reduce StdErr to default Information-level Handle irresponsible error/warning messages --- .../IkvmToolTaskDiagnosticWriter.cs | 51 +++++++++++++------ .../Importer/IkvmImporterLauncher.cs | 2 +- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs index 5c8ccb33e..fc71f8a7c 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmToolTaskDiagnosticWriter.cs @@ -40,35 +40,54 @@ public Task ReceiveAsync(IkvmToolDiagnosticEvent @event) if (@event == null) return Task.CompletedTask; - // 19: "warning IKVMC0000: " ( IkvmToolDiagnosticEventLevel Level, string Code, string Message ) structuredLog; - if (@event.Message.IndexOf("IKVMC", 0, 19, StringComparison.OrdinalIgnoreCase) is { } keyIndex and not -1 - && @event.Message.IndexOf(": ", keyIndex, 11) is { } messageStart and not -1) - { #pragma warning disable IDE0079 // Unused suppression (net472 doesn't produce IDE0057) #pragma warning disable IDE0057 // Suppress net6 & net8 analyzer for range-operations - var levelString = @event.Message.Substring(0, keyIndex - 1); - structuredLog = ( - levelString.ToUpperInvariant() switch - { - "ERROR" => IkvmToolDiagnosticEventLevel.Error, - "WARNING" => IkvmToolDiagnosticEventLevel.Warning, - _ => IkvmToolDiagnosticEventLevel.Information - }, - @event.Message.Substring(keyIndex, 9), - @event.Message.Substring(messageStart + 2) - ); -#pragma warning restore + // unspecified format: "Level: Message" + // MSBuild Format: "Level IKVMC0000: Message" + // Some write """ + // warning IKVMC0000: Message + // (additional information) + // """ + // Skip these: + // - StdErr is mapped to Information + // - StdOut is mapped to Debug. + if (@event.Message is [char first, ..] + && !char.IsWhiteSpace(first) + && @event.Message.IndexOf(": ", 0, 19) is { } firstColon and not -1) + { + structuredLog.Message = @event.Message.Substring(firstColon + 2); + + int levelLength; + if (@event.Message.IndexOf("IKVMC", 0, firstColon, StringComparison.OrdinalIgnoreCase) is { } codeIndex and not -1) + { + levelLength = codeIndex - 1; + structuredLog.Code = @event.Message.Substring(codeIndex, 9 /* IKVMC0000 */); + } + else + { + levelLength = firstColon; + structuredLog.Code = ""; + } + + structuredLog.Level = @event.Message.Substring(0, levelLength).ToUpperInvariant() switch + { + "ERROR" => IkvmToolDiagnosticEventLevel.Error, + "WARNING" => IkvmToolDiagnosticEventLevel.Warning, + _ => IkvmToolDiagnosticEventLevel.Information + }; } else { + // Can't figure out level. structuredLog = (@event.Level, null, @event.Message); } +#pragma warning restore try { diff --git a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs index 2a4673a91..e25aac5eb 100644 --- a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs +++ b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs @@ -299,7 +299,7 @@ public async Task ExecuteAsync(IkvmImporterOptions options, CancellationTok await LogEvent(IkvmToolDiagnosticEventLevel.Debug, "Executing {0} {1}", cli.TargetFilePath, cli.Arguments); // send output to MSBuild - cli = cli.WithStandardErrorPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Error, i))); + cli = cli.WithStandardErrorPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Information, i))); cli = cli.WithStandardOutputPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Debug, i))); // combine manual cancellation with timeout From 290034d6d7acdf9535775513fc32f59cb6548629 Mon Sep 17 00:00:00 2001 From: AliveDevil Date: Mon, 19 Aug 2024 13:00:30 +0200 Subject: [PATCH 13/13] Thought about output level. All messages on StdErr should end up in logger That is Message Error: Message (Additional Information: B) Should end up as Error Level: "Message", Warning Level: " (Additional Information: B)" NoWarn hides messages completely in IkvmImporterInternal.IssueMessage --- src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs index e25aac5eb..d695a68f5 100644 --- a/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs +++ b/src/IKVM.Tools.Runner/Importer/IkvmImporterLauncher.cs @@ -299,7 +299,7 @@ public async Task ExecuteAsync(IkvmImporterOptions options, CancellationTok await LogEvent(IkvmToolDiagnosticEventLevel.Debug, "Executing {0} {1}", cli.TargetFilePath, cli.Arguments); // send output to MSBuild - cli = cli.WithStandardErrorPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Information, i))); + cli = cli.WithStandardErrorPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Warning, i))); cli = cli.WithStandardOutputPipe(PipeTarget.ToDelegate(i => LogEvent(IkvmToolDiagnosticEventLevel.Debug, i))); // combine manual cancellation with timeout