Skip to content

Commit

Permalink
Moved definitions file
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-romano-DD committed Nov 11, 2024
1 parent 53f781e commit 0b98667
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 41 deletions.
2 changes: 1 addition & 1 deletion tracer/build/_build/Build.Steps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ bool RequiresThoroughTesting()
var nativeGeneratedFilesOutputPath = NativeTracerProject.Directory / "Generated";
CallSitesGenerator.GenerateCallSites(TargetFrameworks, tfm => DatadogTraceDirectory / "bin" / BuildConfiguration / tfm / Projects.DatadogTrace + ".dll", nativeGeneratedFilesOutputPath);
CallTargetsGenerator.GenerateCallTargets(TargetFrameworks, tfm => DatadogTraceDirectory / "bin" / BuildConfiguration / tfm / Projects.DatadogTrace + ".dll", nativeGeneratedFilesOutputPath, Version, DependabotPath);
CallTargetsGenerator.GenerateCallTargets(TargetFrameworks, tfm => DatadogTraceDirectory / "bin" / BuildConfiguration / tfm / Projects.DatadogTrace + ".dll", nativeGeneratedFilesOutputPath, Version, BuildDirectory);
});

Target CompileTracerNativeTestsWindows => _ => _
Expand Down
4 changes: 2 additions & 2 deletions tracer/build/_build/Build.Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ partial class Build
var testDir = Solution.GetProject(Projects.ClrProfilerIntegrationTests).Directory;
var dependabotProj = DependabotPath / "Datadog.Dependabot.Integrations.csproj";
var dependabotJsonFile = DependabotPath / FileNames.DefinitionsJson;
var definitionsFile = BuildDirectory / FileNames.DefinitionsJson;
var currentDependencies = DependabotFileManager.GetCurrentlyTestedVersions(dependabotProj);
var excludedFromUpdates = ((IncludePackages, ExcludePackages) switch
{
Expand All @@ -246,7 +246,7 @@ partial class Build
.Select(x => x.ToString())
.ToList();
var integrations = GenerateIntegrationDefinitions.GetAllIntegrations(assemblies, dependabotJsonFile);
var integrations = GenerateIntegrationDefinitions.GetAllIntegrations(assemblies, definitionsFile);
var distinctIntegrations = await DependabotFileManager.BuildDistinctIntegrationMaps(integrations, testedVersions);
await DependabotFileManager.UpdateIntegrations(dependabotProj, distinctIntegrations);
Expand Down
2 changes: 1 addition & 1 deletion tracer/build/_build/CodeGenerators/CallSitesGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public static void GenerateCallSites(IEnumerable<TargetFramework> targetFramewor
{
Serilog.Log.Debug("Generating CallSite definitions file ...");

Dictionary<string, AspectClass> aspectClasses = new Dictionary<string, AspectClass>();
var aspectClasses = new Dictionary<string, AspectClass>();
foreach(var tfm in targetFrameworks)
{
var dllPath = getDllPath(tfm);
Expand Down
70 changes: 35 additions & 35 deletions tracer/build/_build/CodeGenerators/CallTargetsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void GenerateCallTargets(IEnumerable<TargetFramework> targetFramew
{
Serilog.Log.Debug("Generating CallTarget definitions file ...");

Dictionary<CallTargetDefinitionSource, TargetFrameworks> callTargets = new Dictionary<CallTargetDefinitionSource, TargetFrameworks>();
var callTargets = new Dictionary<CallTargetDefinitionSource, TargetFrameworks>();
foreach(var tfm in targetFrameworks)
{
var tfmCategory = GetCategory(tfm);
Expand Down Expand Up @@ -64,19 +64,19 @@ static bool IsTargetAttribute(Mono.Cecil.CustomAttribute attribute)

static List<CallTargetDefinitionSource> GetCallTargetDefinition(TypeDefinition type, CustomAttribute attribute)
{
List<CallTargetDefinitionSource> res = new List<CallTargetDefinitionSource>();
var res = new List<CallTargetDefinitionSource>();
var hasMisconfiguredInput = false;
string? assemblyName = null;
string[]? assemblyNames = null;
string? integrationName = null;
string? typeName = null;
string[]? typeNames = null;
string? methodName = null;
string? returnTypeName = null;
string? minimumVersion = null;
string? maximumVersion = null;
string[]? parameterTypeNames = null;
string? callTargetType = null;
string assemblyName = null;
string[] assemblyNames = null;
string integrationName = null;
string typeName = null;
string[] typeNames = null;
string methodName = null;
string returnTypeName = null;
string minimumVersion = null;
string maximumVersion = null;
string[] parameterTypeNames = null;
string callTargetType = null;
int? integrationKind = null;
var instrumentationCategory = InstrumentationCategory.Tracing;

Expand Down Expand Up @@ -165,13 +165,13 @@ static List<CallTargetDefinitionSource> GetCallTargetDefinition(TypeDefinition t

internal static void RetrieveAdoNetCallTargets(Dictionary<CallTargetDefinitionSource, TargetFrameworks> callTargets, AssemblyDefinition assembly, TargetFrameworks tfmCategory)
{
List<AssemblyCallTargetDefinitionSource> adoNetClientInstruments = new List<AssemblyCallTargetDefinitionSource>();
var adoNetClientInstruments = new List<AssemblyCallTargetDefinitionSource>();
foreach (var attribute in assembly.MainModule.Assembly.CustomAttributes.Where(IsTargetClientInstrumentAttribute))
{
adoNetClientInstruments.AddRange(GetAdoNetClientInstruments(attribute));
}

List<AdoNetSignature> adoNetSignatures = new List<AdoNetSignature>();
var adoNetSignatures = new List<AdoNetSignature>();
foreach (var type in EnumTypes(assembly.MainModule.Types))
{
foreach (var attribute in type.CustomAttributes.Where(IsTargetSignatureAttribute))
Expand Down Expand Up @@ -202,12 +202,12 @@ static AdoNetSignature GetAdoNetSignature(TypeDefinition type, CustomAttribute a
{
var hasMisconfiguredInput = false;

string? methodName = null;
string? returnTypeName = null;
string[]? parameterTypeNames = null;
string methodName = null;
string returnTypeName = null;
string[] parameterTypeNames = null;
int? integrationKind = null;
int? returnType = null;
string? callTargetType = null;
string callTargetType = null;

foreach (var namedArgument in attribute.Properties)
{
Expand Down Expand Up @@ -254,17 +254,17 @@ static AdoNetSignature GetAdoNetSignature(TypeDefinition type, CustomAttribute a

static List<AssemblyCallTargetDefinitionSource> GetAdoNetClientInstruments(CustomAttribute attribute)
{
List<AssemblyCallTargetDefinitionSource> res = new List<AssemblyCallTargetDefinitionSource>();
var res = new List<AssemblyCallTargetDefinitionSource>();
var hasMisconfiguredInput = false;

string? assemblyName = null;
string? integrationName = null;
string? typeName = null;
string? minimumVersion = null;
string? maximumVersion = null;
string? dataReaderTypeName = null;
string? dataReaderTaskTypeName = null;
string[]? signatureAttributeTypes = null;
string assemblyName = null;
string integrationName = null;
string typeName = null;
string minimumVersion = null;
string maximumVersion = null;
string dataReaderTypeName = null;
string dataReaderTaskTypeName = null;
string[] signatureAttributeTypes = null;

foreach (var namedArgument in attribute.Properties)
{
Expand Down Expand Up @@ -461,13 +461,13 @@ namespace trace
sb.AppendLine();

// Retrieve all signatures
HashSet<string> signatureTexts = new HashSet<string>();
var signatureTexts = new HashSet<string>();
foreach (var definition in definitions)
{
signatureTexts.Add(GetSignature(definition.Key));
}

Dictionary<string, string> signatures = new Dictionary<string, string>();
var signatures = new Dictionary<string, string>();
foreach (var sig in signatureTexts.OrderBy(s => s, StringComparer.OrdinalIgnoreCase))
{
if (!signatures.TryGetValue(sig, out var sigName))
Expand Down Expand Up @@ -637,7 +637,7 @@ public CallTargetDefinitionSource(string integrationName, string assemblyName, s

internal record AdoNetSignature
{
public AdoNetSignature(string className, string targetMethodName, string? targetReturnType, string[] targetParameterTypes, string instrumentationTypeName, int callTargetIntegrationKind, int returnType)
public AdoNetSignature(string className, string targetMethodName, string targetReturnType, string[] targetParameterTypes, string instrumentationTypeName, int callTargetIntegrationKind, int returnType)
{
ClassName = className;
TargetMethodName = targetMethodName;
Expand All @@ -652,7 +652,7 @@ public AdoNetSignature(string className, string targetMethodName, string? target

public string TargetMethodName { get; }

public string? TargetReturnType { get; }
public string TargetReturnType { get; }

public EquatableArray<string> TargetParameterTypes { get; }

Expand All @@ -665,7 +665,7 @@ public AdoNetSignature(string className, string targetMethodName, string? target

internal record AssemblyCallTargetDefinitionSource
{
public AssemblyCallTargetDefinitionSource(string signatureAttributeName, string integrationName, string assemblyName, string targetTypeName, (ushort Major, ushort Minor, ushort Patch) minimumVersion, (ushort Major, ushort Minor, ushort Patch) maximumVersion, bool isAdoNetIntegration, InstrumentationCategory instrumentationCategory, string? dataReaderTypeName, string? dataReaderTaskTypeName)
public AssemblyCallTargetDefinitionSource(string signatureAttributeName, string integrationName, string assemblyName, string targetTypeName, (ushort Major, ushort Minor, ushort Patch) minimumVersion, (ushort Major, ushort Minor, ushort Patch) maximumVersion, bool isAdoNetIntegration, InstrumentationCategory instrumentationCategory, string dataReaderTypeName, string dataReaderTaskTypeName)
{
SignatureAttributeName = signatureAttributeName;
IntegrationName = integrationName;
Expand Down Expand Up @@ -695,9 +695,9 @@ public AssemblyCallTargetDefinitionSource(string signatureAttributeName, string

public InstrumentationCategory InstrumentationCategory { get; }

public string? DataReaderTypeName { get; }
public string DataReaderTypeName { get; }

public string? DataReaderTaskTypeName { get; }
public string DataReaderTaskTypeName { get; }
}

private static class InstrumentAttributeProperties
Expand Down
4 changes: 3 additions & 1 deletion tracer/build/_build/CodeGenerators/EquatableArray.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// <copyright file="EquatableArray.cs" company="Datadog">
// <copyright file="EquatableArray.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>

#nullable enable

using System;
using System.Collections;
using System.Collections.Generic;
Expand Down
2 changes: 1 addition & 1 deletion tracer/build/_build/Projects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ public static class FileNames
public const string AfterInstallScript = "after-install.sh";
public const string AfterRemoveScript = "after-remove.sh";

public const string DefinitionsJson = "generated_calltargets.g.json";
public const string DefinitionsJson = "supported_calltargets.g.json";
}
File renamed without changes.

0 comments on commit 0b98667

Please sign in to comment.