From e4a2eed1625d0c11c487aeb68b8964c06b1eae3f Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Mon, 19 Aug 2024 09:27:05 -0700 Subject: [PATCH] Add NativeRuntimeEventSource metadata to NativeAot CoreLib This is necessary to allow consumers to parse the payload. Delete unnecessary runtimeflavor argument of genRuntimeEventSources.py script. Fixes #105556 --- .../System.Private.CoreLib.csproj | 11 ++----- .../src/System.Private.CoreLib.csproj | 30 +++++++++++++++++-- src/coreclr/scripts/genRuntimeEventSources.py | 25 +++++----------- .../System.Private.CoreLib.csproj | 8 ++--- src/tests/issues.targets | 3 -- 5 files changed, 42 insertions(+), 35 deletions(-) diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj index 5ac4d2d78b58e..e77a87c666571 100644 --- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -302,11 +302,6 @@ - - - - - @@ -317,15 +312,15 @@ - - src\System\Diagnostics\Eventing\Generated\NativeRuntimeEventSource.CoreCLR.cs + + src\System\Diagnostics\Eventing\NativeRuntimeEventSource.Generated.cs - + <_PythonWarningParameter>-Wall <_PythonWarningParameter Condition="'$(MSBuildTreatWarningsAsErrors)' == 'true'">$(_PythonWarningParameter) -Werror diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj index 8cb3c82645e69..8f2c7695334f5 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System.Private.CoreLib.csproj @@ -571,8 +571,34 @@ + - - + + + + src\System\Diagnostics\Eventing\NativeRuntimeEventSource.Generated.cs + + + + + + + + <_PythonWarningParameter>-Wall + <_PythonWarningParameter Condition="'$(MSBuildTreatWarningsAsErrors)' == 'true'">$(_PythonWarningParameter) -Werror + <_EventingSourceFileDirectory>%(EventingSourceFile.RootDir)%(EventingSourceFile.Directory) + <_EventingSourceFileDirectory Condition="HasTrailingSlash('$(_EventingSourceFileDirectory)')">$(_EventingSourceFileDirectory.TrimEnd('\')) + + + + + + + + diff --git a/src/coreclr/scripts/genRuntimeEventSources.py b/src/coreclr/scripts/genRuntimeEventSources.py index 5fcfbc0476f11..7352bfbbb5004 100644 --- a/src/coreclr/scripts/genRuntimeEventSources.py +++ b/src/coreclr/scripts/genRuntimeEventSources.py @@ -6,7 +6,6 @@ import os import xml.dom.minidom as DOM from utilities import open_for_update -from genEventing import RuntimeFlavor import argparse import sys @@ -24,12 +23,8 @@ ######################################################################## # START CONFIGURATION ######################################################################## -coreCLRManifestsToGenerate = { - "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource.CoreCLR.cs" -} - -monoManifestsToGenerate = { - "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource.Mono.cs" +manifestsToGenerate = { + "Microsoft-Windows-DotNETRuntime" : "NativeRuntimeEventSource.Generated.cs" } providerNameToClassNameMap = { @@ -77,11 +72,8 @@ def writeOutput(outputFile, str): def getCSharpTypeFromManifestType(manifestType): return manifestTypeToCSharpTypeMap[manifestType] -def getManifestsToGenerate(runtimeFlavor): - if runtimeFlavor.coreclr: - return coreCLRManifestsToGenerate - elif runtimeFlavor.mono: - return monoManifestsToGenerate +def getManifestsToGenerate(): + return manifestsToGenerate def generateEvent(eventNode, providerNode, outputFile, stringTable): @@ -338,7 +330,7 @@ def loadStringTable(manifest): return stringTable -def generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlavor): +def generateEventSources(manifestFullPath, intermediatesDirFullPath): # Open the manifest for reading. manifest = DOM.parse(manifestFullPath) @@ -347,7 +339,7 @@ def generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlav stringTable = loadStringTable(manifest) # Iterate over each provider that we want to generate an EventSource for. - for providerName, outputFileName in getManifestsToGenerate(runtimeFlavor).items(): + for providerName, outputFileName in getManifestsToGenerate().items(): for node in manifest.getElementsByTagName("provider"): if node.getAttribute("name") == providerName: providerNode = node @@ -413,8 +405,6 @@ def main(argv): help='full path to manifest containing the description of events') required.add_argument('--intermediate', type=str, required=True, help='full path to eventprovider intermediate directory') - required.add_argument('--runtimeflavor', type=str,default="CoreCLR", - help='runtime flavor') args, unknown = parser.parse_known_args(argv) if unknown: print('Unknown argument(s): ', ', '.join(unknown)) @@ -422,7 +412,6 @@ def main(argv): manifestFullPath = args.man intermediatesDirFullPath = args.intermediate - runtimeFlavor = RuntimeFlavor(args.runtimeflavor) # Ensure the intermediates directory exists. try: @@ -432,7 +421,7 @@ def main(argv): raise # Generate event sources. - generateEventSources(manifestFullPath, intermediatesDirFullPath, runtimeFlavor) + generateEventSources(manifestFullPath, intermediatesDirFullPath) return 0 if __name__ == '__main__': diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index 20fa27df32e89..d7983bef48786 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -315,8 +315,8 @@ - - src\System\Diagnostics\Eventing\Generated\NativeRuntimeEventSource.Mono.cs + + src\System\Diagnostics\Eventing\NativeRuntimeEventSource.Generated.cs @@ -327,7 +327,7 @@ DependsOnTargets="FindPython" BeforeTargets="BeforeCompile"> - + <_PythonWarningParameter>-Wall <_PythonWarningParameter Condition="'$(MSBuildTreatWarningsAsErrors)' == 'true'">$(_PythonWarningParameter) -Werror @@ -335,7 +335,7 @@ <_EventingSourceFileDirectory Condition="HasTrailingSlash('$(_EventingSourceFileDirectory)')">$(_EventingSourceFileDirectory.TrimEnd('\')) - + diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 078ca36547d11..0440ee51964ac 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -686,9 +686,6 @@ - - https://github.com/dotnet/runtime/issues/105556 - https://github.com/dotnet/runtime/issues/102544