From beba073dc8f9dd86b5f9becdb19feb4bdb8b69a0 Mon Sep 17 00:00:00 2001 From: Andrew Lock Date: Mon, 19 Jul 2021 13:08:46 +0100 Subject: [PATCH] Merge tools into Nuke (#1605) * Merge GeneratePackageVersions into Nuke * Move UpdateVendors tool to be a Nuke target Embed the template as a resource for simplicity * minor: move Nuke helper files into folder for easier navigation * Move EnvironmentTools.cs to Datadog.Trace.TestHelpers It's only used in test projects anyway * Move TcpPortProvider to TestHelpers, as again, it's only used in tests Some of the sample projects use this type, so rather than reference TestHelpers (and hence transitively Datadog.Trace), added the helper class a link file instead. * Remove remaining references to Datadog.Core.Tools * Move PrepareRelease to Nuke This required quite a lot of work in the GenerateIntegrationDefinitions code to use reflection instead of direct references. Additionally, I purposefully iterate all the built versions of the assembly, and de-dupe the duplicates, to avoid cases where some integrations are not available on some platforms. This required a slightly annoying amount of boilerplate and faffing with AppLoadContexts * Move CIAppTracking project to Nuke * Don't override everything in Nuke's editorconfig * Update build/_build/Build.Utilities.cs Co-authored-by: Zach Montoya * Remove DistributedTracer tool It's for a very specific use-case, and as it's the last remaining tool, I decided to remove it * Apply suggestions from code review Co-authored-by: Lucas Pimentel-Ordyna * Update some target names Co-authored-by: Zach Montoya Co-authored-by: Lucas Pimentel-Ordyna --- Datadog.Trace.proj | 5 +- Datadog.Trace.sln | 101 ---- build/_build/.editorconfig | 2 +- build/_build/Build.Utilities.cs | 92 ++++ build/_build/Build.cs | 5 +- .../GeneratePackageVersions/FileGenerator.cs | 0 .../MSBuildPropsFileGenerator.cs | 0 .../NuGetPackageHelper.cs | 0 .../PackageVersionEntry.cs | 0 .../GeneratePackageVersions/Program.cs | 67 +-- .../XunitFileGenerator.cs | 0 .../XunitStrategyFileGenerator.cs | 0 .../{ => NukeExtensions}/Configuration.cs | 0 .../{ => NukeExtensions}/CustomDotNetTasks.cs | 0 .../DotNetMSBuildSettings.cs | 0 .../DotNetSettingsExtensions.cs | 0 .../LazyLocalExecutableAttribute.cs | 0 .../LazyPathExecutableAttribute.cs | 0 .../{ => NukeExtensions}/MiniDumpType.cs | 0 .../GenerateIntegrationDefinitions.cs | 495 ++++++++++++++++++ .../PrepareRelease/SetAllVersions.cs | 13 +- .../PrepareRelease/SyncMsiContent.cs | 0 .../Datadog.Dependabot.Honeypot.template | 0 .../_build/UpdateVendors/UpdateVendors.cs | 89 +--- .../UpdateVendors/VendoredDependency.cs | 0 build/_build/_build.csproj | 6 + build/_build/_build.csproj.DotSettings | 1 + build/tools/Directory.Build.props | 8 - .../GeneratePackageVersions.csproj | 13 - .../Properties/launchSettings.json | 8 - build/tools/GlobalSuppressions.cs | 10 - .../GenerateIntegrationDefinitions.cs | 251 --------- .../PrepareRelease/PrepareRelease.csproj | 17 - build/tools/PrepareRelease/Program.cs | 96 ---- .../Properties/launchSettings.json | 8 - build/tools/PrepareRelease/publish-all.bat | 1 - .../AWS/AwsSqsTests.cs | 1 - .../AdoNet/DapperTests.cs | 1 - .../AdoNet/FakeCommandTests.cs | 1 - .../AdoNet/MicrosoftDataSqlClientTests.cs | 1 - .../AdoNet/MicrosoftDataSqliteTests.cs | 1 - .../AdoNet/MySqlCommandTests.cs | 1 - .../AdoNet/NpgsqlCommandTests.cs | 1 - .../AdoNet/SqlCommand20Tests.cs | 1 - .../AdoNet/SystemDataSqlClientTests.cs | 1 - .../AdoNet/SystemDataSqliteTests.cs | 1 - .../AspNet/OwinWebApi2Tests.cs | 1 - .../AspNetCore/AspNetCoreMvcTestBase.cs | 1 - .../CI/MsTestV2Tests.cs | 1 - .../CI/NUnitTests.cs | 1 - .../CI/XUnitTests.cs | 1 - .../CallTargetNativeTests.cs | 1 - .../CosmosTests.cs | 1 - .../Elasticsearch5Tests.cs | 1 - .../Elasticsearch6Tests.cs | 1 - .../GraphQLTests.cs | 1 - .../Helpers/IisFixture.cs | 1 - .../Helpers/TestHelper.cs | 1 - .../HttpMessageHandlerTests.cs | 1 - .../KafkaTests.cs | 1 - .../LoadTests/AspNetCoreMvc21LoadTests.cs | 1 - .../LoadTests/LoadTestBase.cs | 1 - .../MongoDbTests.cs | 1 - .../MsmqTests.cs | 1 - .../MultiDomainHostTests.cs | 1 - .../NoMultiLoaderTests.cs | 1 - .../RabbitMQTests.cs | 1 - .../RuntimeMetricsTests.cs | 1 - .../ServiceMappingTests.cs | 1 - .../ServiceStackRedisTests.cs | 1 - .../SmokeTests/SmokeTestBase.cs | 1 - ...edisAssemblyConflictSdkProjectSmokeTest.cs | 2 +- ...ngeRedisStackOverflowExceptionSmokeTest.cs | 2 +- .../StackExchangeRedisTests.cs | 1 - .../WcfTests.cs | 1 - .../WebRequest20Tests.cs | 1 - .../WebRequestTests.cs | 1 - .../ContainerTaggingTests.cs | 1 - .../DatadogHttpClientTests.cs | 1 - .../Datadog.Trace.TestHelpers.csproj | 2 +- .../EnvironmentHelper.cs | 1 - .../EnvironmentTools.cs | 2 +- .../MockTracerAgent.cs | 1 - .../TcpPortProvider.cs | 2 +- test/Datadog.Trace.Tests/DogStatsDTests.cs | 1 - .../Samples.HttpMessageHandler/Program.cs | 2 +- .../Samples.HttpMessageHandler.csproj | 6 +- .../Program.cs | 2 +- .../Samples.WebRequest.NetFramework20.csproj | 5 +- .../Samples.WebRequest/Program.cs | 2 +- .../Samples.WebRequest.csproj | 5 +- .../DuplicateTypeProxy.csproj | 2 +- .../regression/DuplicateTypeProxy/Program.cs | 2 +- .../LargePayload/LargePayload.csproj | 1 - .../Sandbox.ManualTracing/Program.cs | 1 - .../Sandbox.ManualTracing.csproj | 1 - .../Datadog.Core.Tools.csproj | 12 - .../Extensions/AssemblyExtensions.cs | 48 -- tools/Directory.Build.props | 13 - tools/FeatureTracking/FeatureTracking.csproj | 14 - tools/FeatureTracking/Program.cs | 50 -- tools/GlobalSuppressions.cs | 10 - tools/StartDistributedTrace/Program.cs | 59 --- .../Properties/launchSettings.json | 12 - .../StartDistributedTrace.csproj | 12 - tools/UpdateVendors/UpdateVendors.csproj | 12 - 106 files changed, 682 insertions(+), 931 deletions(-) rename build/{tools => _build}/GeneratePackageVersions/FileGenerator.cs (100%) rename build/{tools => _build}/GeneratePackageVersions/MSBuildPropsFileGenerator.cs (100%) rename build/{tools => _build}/GeneratePackageVersions/NuGetPackageHelper.cs (100%) rename build/{tools => _build}/GeneratePackageVersions/PackageVersionEntry.cs (100%) rename build/{tools => _build}/GeneratePackageVersions/Program.cs (71%) rename build/{tools => _build}/GeneratePackageVersions/XunitFileGenerator.cs (100%) rename build/{tools => _build}/GeneratePackageVersions/XunitStrategyFileGenerator.cs (100%) rename build/_build/{ => NukeExtensions}/Configuration.cs (100%) rename build/_build/{ => NukeExtensions}/CustomDotNetTasks.cs (100%) rename build/_build/{ => NukeExtensions}/DotNetMSBuildSettings.cs (100%) rename build/_build/{ => NukeExtensions}/DotNetSettingsExtensions.cs (100%) rename build/_build/{ => NukeExtensions}/LazyLocalExecutableAttribute.cs (100%) rename build/_build/{ => NukeExtensions}/LazyPathExecutableAttribute.cs (100%) rename build/_build/{ => NukeExtensions}/MiniDumpType.cs (100%) create mode 100644 build/_build/PrepareRelease/GenerateIntegrationDefinitions.cs rename build/{tools => _build}/PrepareRelease/SetAllVersions.cs (95%) rename build/{tools => _build}/PrepareRelease/SyncMsiContent.cs (100%) rename {tools => build/_build}/UpdateVendors/Datadog.Dependabot.Honeypot.template (100%) rename tools/UpdateVendors/Program.cs => build/_build/UpdateVendors/UpdateVendors.cs (64%) rename {tools => build/_build}/UpdateVendors/VendoredDependency.cs (100%) delete mode 100644 build/tools/Directory.Build.props delete mode 100644 build/tools/GeneratePackageVersions/GeneratePackageVersions.csproj delete mode 100644 build/tools/GeneratePackageVersions/Properties/launchSettings.json delete mode 100644 build/tools/GlobalSuppressions.cs delete mode 100644 build/tools/PrepareRelease/GenerateIntegrationDefinitions.cs delete mode 100644 build/tools/PrepareRelease/PrepareRelease.csproj delete mode 100644 build/tools/PrepareRelease/Program.cs delete mode 100644 build/tools/PrepareRelease/Properties/launchSettings.json delete mode 100644 build/tools/PrepareRelease/publish-all.bat rename {tools/Datadog.Core.Tools => test/Datadog.Trace.TestHelpers}/EnvironmentTools.cs (98%) rename {tools/Datadog.Core.Tools => test/Datadog.Trace.TestHelpers}/TcpPortProvider.cs (97%) delete mode 100644 tools/Datadog.Core.Tools/Datadog.Core.Tools.csproj delete mode 100644 tools/Datadog.Core.Tools/Extensions/AssemblyExtensions.cs delete mode 100644 tools/Directory.Build.props delete mode 100644 tools/FeatureTracking/FeatureTracking.csproj delete mode 100644 tools/FeatureTracking/Program.cs delete mode 100644 tools/GlobalSuppressions.cs delete mode 100644 tools/StartDistributedTrace/Program.cs delete mode 100644 tools/StartDistributedTrace/Properties/launchSettings.json delete mode 100644 tools/StartDistributedTrace/StartDistributedTrace.csproj delete mode 100644 tools/UpdateVendors/UpdateVendors.csproj diff --git a/Datadog.Trace.proj b/Datadog.Trace.proj index b6d789599558..469d9b61771d 100644 --- a/Datadog.Trace.proj +++ b/Datadog.Trace.proj @@ -15,7 +15,6 @@ - @@ -37,14 +36,14 @@ - + - + diff --git a/Datadog.Trace.sln b/Datadog.Trace.sln index b3f2431d0954..4f1451128a21 100644 --- a/Datadog.Trace.sln +++ b/Datadog.Trace.sln @@ -131,12 +131,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.Elasticsearch", "te EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Samples.AspNetMvc4", "test\test-applications\aspnet\Samples.AspNetMvc4\Samples.AspNetMvc4.csproj", "{6D86109F-B7C9-477D-86D7-45735A3A0818}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{5D8E1F81-B820-4736-B797-271B0FE787EE}" - ProjectSection(SolutionItems) = preProject - tools\Directory.Build.props = tools\Directory.Build.props - tools\GlobalSuppressions.cs = tools\GlobalSuppressions.cs - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.Trace.ClrProfiler.Managed.Tests", "test\Datadog.Trace.ClrProfiler.Managed.Tests\Datadog.Trace.ClrProfiler.Managed.Tests.csproj", "{5B52C0C0-A554-4E53-9D17-B121E78FF919}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.MongoDB", "test\test-applications\integrations\Samples.MongoDB\Samples.MongoDB.csproj", "{3493346B-44F6-4F50-8FB4-51D0090DF544}" @@ -168,8 +162,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HttpMessageHandler.StackOve {C0C8D381-D6B9-4C76-9428-F40F2FA93A9A} = {C0C8D381-D6B9-4C76-9428-F40F2FA93A9A} EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GeneratePackageVersions", "build\tools\GeneratePackageVersions\GeneratePackageVersions.csproj", "{24B0357D-B0C8-46C7-96F6-006E3F66662A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.ServiceStack.Redis", "test\test-applications\integrations\Samples.ServiceStack.Redis\Samples.ServiceStack.Redis.csproj", "{8E1555D1-13D5-4DBF-9631-117D840C3158}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.StackExchange.Redis", "test\test-applications\integrations\Samples.StackExchange.Redis\Samples.StackExchange.Redis.csproj", "{DC7D131A-AF99-46AB-9AA6-463443E3B992}" @@ -207,14 +199,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFramework6x.MdTokenLo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.DatabaseHelper", "test\test-applications\integrations\dependency-libs\Samples.DatabaseHelper\Samples.DatabaseHelper.csproj", "{472DBA92-4FEA-4B9A-BA70-0E97B942E12D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UpdateVendors", "tools\UpdateVendors\UpdateVendors.csproj", "{72FB583A-A1B0-4B5F-8658-617B100DCD8E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Log4Net.SerializationException", "test\test-applications\regression\Log4Net.SerializationException\Log4Net.SerializationException.csproj", "{35F581E9-3D7C-4E80-8DFF-D437B0D86710}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithLog4Net", "test\test-applications\regression\dependency-libs\ApplicationWithLog4Net\ApplicationWithLog4Net.csproj", "{1C34D970-6081-4EFA-8F2F-5AD2B146AC58}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.Core.Tools", "tools\Datadog.Core.Tools\Datadog.Core.Tools.csproj", "{3BEACB10-89FE-4F74-8022-1A52F223CE82}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyResolveMscorlibResources.InfiniteRecursionCrash", "test\test-applications\regression\AssemblyResolveMscorlibResources.InfiniteRecursionCrash\AssemblyResolveMscorlibResources.InfiniteRecursionCrash.csproj", "{EEA89ACD-CFBB-4F60-A150-74F0A84DF028}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.Trace.AspNet", "src\Datadog.Trace.AspNet\Datadog.Trace.AspNet.csproj", "{B34EDBC7-C5FB-409D-8472-BC7469D6F2BD}" @@ -231,8 +219,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.AspNetCoreMvc21", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog10LogsInjection.NullReferenceException", "test\test-applications\regression\NLog10LogsInjection.NullReferenceException\NLog10LogsInjection.NullReferenceException.csproj", "{6209C19B-42E4-4FCF-A539-FD1E4F4A34DB}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrepareRelease", "build\tools\PrepareRelease\PrepareRelease.csproj", "{DAA6B000-5BED-4081-B5E0-B698BFB89415}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.StackExchange.Redis.Abstractions", "test\test-applications\regression\dependency-libs\Datadog.StackExchange.Redis.Abstractions\Datadog.StackExchange.Redis.Abstractions.csproj", "{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.StackExchange.Redis", "test\test-applications\regression\dependency-libs\Datadog.StackExchange.Redis\Datadog.StackExchange.Redis.csproj", "{EB0B88E2-589A-4F65-8F98-D5B958D8104F}" @@ -264,8 +250,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.MultiDomainHost.App EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.DatabaseHelper.netstandard", "test\test-applications\integrations\dependency-libs\Samples.DatabaseHelper.netstandard\Samples.DatabaseHelper.netstandard.csproj", "{8D949A40-5F4B-4EB0-B8FD-301B472C96AE}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StartDistributedTrace", "tools\StartDistributedTrace\StartDistributedTrace.csproj", "{7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}" -EndProject Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Datadog.Trace.Ci.Shared", "src\Datadog.Trace.Ci.Shared\Datadog.Trace.Ci.Shared.shproj", "{A1D7653A-C409-414A-B9B0-7879953EBCDD}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.Trace.MSBuild", "src\Datadog.Trace.MSBuild\Datadog.Trace.MSBuild.csproj", "{E02B141F-E7C0-46CF-B9F6-39427218E714}" @@ -304,13 +288,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.Trace.DuckTyping.Te EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{A0C5FBBB-CFB2-4FB9-B8F0-55676E9DCF06}" ProjectSection(SolutionItems) = preProject - build\PackageVersionsComprehensive.g.props = build\PackageVersionsComprehensive.g.props build\PackageVersionsGeneratorDefinitions.json = build\PackageVersionsGeneratorDefinitions.json - build\PackageVersionsLatestMinors.g.props = build\PackageVersionsLatestMinors.g.props EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{C70D6696-23F0-4C3D-9C2A-94C4868D5249}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "artifacts", "artifacts", "{CC53E5C5-9D3E-4AD9-A9CA-D2190463EB5B}" ProjectSection(SolutionItems) = preProject build\artifacts\createLogPath.sh = build\artifacts\createLogPath.sh @@ -390,8 +370,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.AspNetCoreRazorPage EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.AWS.SQS", "test\test-applications\integrations\Samples.AWS.SQS\Samples.AWS.SQS.csproj", "{3538EF5E-377E-430A-AFB8-F2DB5FAEDE95}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FeatureTracking", "tools\FeatureTracking\FeatureTracking.csproj", "{2829C811-66EE-4B81-96CA-2ACB00B8E813}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.XUnitTests", "test\test-applications\integrations\Samples.XUnitTests\Samples.XUnitTests.csproj", "{4AD438D9-D4E3-4EB5-8851-89DB4D1CFB9C}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.NUnitTests", "test\test-applications\integrations\Samples.NUnitTests\Samples.NUnitTests.csproj", "{BC998ACD-353B-4A56-8A56-DF6200E141B6}" @@ -726,18 +704,6 @@ Global {F47F206E-4CCA-4AD0-AEBA-FD9F491E05EC}.Release|x64.Build.0 = Release|x64 {F47F206E-4CCA-4AD0-AEBA-FD9F491E05EC}.Release|x86.ActiveCfg = Release|x86 {F47F206E-4CCA-4AD0-AEBA-FD9F491E05EC}.Release|x86.Build.0 = Release|x86 - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Debug|x64.ActiveCfg = Debug|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Debug|x64.Build.0 = Debug|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Debug|x86.ActiveCfg = Debug|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Debug|x86.Build.0 = Debug|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Release|Any CPU.Build.0 = Release|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Release|x64.ActiveCfg = Release|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Release|x64.Build.0 = Release|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Release|x86.ActiveCfg = Release|Any CPU - {24B0357D-B0C8-46C7-96F6-006E3F66662A}.Release|x86.Build.0 = Release|Any CPU {8E1555D1-13D5-4DBF-9631-117D840C3158}.Debug|Any CPU.ActiveCfg = Debug|x86 {8E1555D1-13D5-4DBF-9631-117D840C3158}.Debug|x64.ActiveCfg = Debug|x64 {8E1555D1-13D5-4DBF-9631-117D840C3158}.Debug|x64.Build.0 = Debug|x64 @@ -884,18 +850,6 @@ Global {472DBA92-4FEA-4B9A-BA70-0E97B942E12D}.Release|x64.Build.0 = Release|Any CPU {472DBA92-4FEA-4B9A-BA70-0E97B942E12D}.Release|x86.ActiveCfg = Release|Any CPU {472DBA92-4FEA-4B9A-BA70-0E97B942E12D}.Release|x86.Build.0 = Release|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Debug|x64.ActiveCfg = Debug|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Debug|x64.Build.0 = Debug|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Debug|x86.ActiveCfg = Debug|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Debug|x86.Build.0 = Debug|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Release|Any CPU.Build.0 = Release|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Release|x64.ActiveCfg = Release|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Release|x64.Build.0 = Release|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Release|x86.ActiveCfg = Release|Any CPU - {72FB583A-A1B0-4B5F-8658-617B100DCD8E}.Release|x86.Build.0 = Release|Any CPU {35F581E9-3D7C-4E80-8DFF-D437B0D86710}.Debug|Any CPU.ActiveCfg = Debug|x86 {35F581E9-3D7C-4E80-8DFF-D437B0D86710}.Debug|x64.ActiveCfg = Debug|x64 {35F581E9-3D7C-4E80-8DFF-D437B0D86710}.Debug|x64.Build.0 = Debug|x64 @@ -916,18 +870,6 @@ Global {1C34D970-6081-4EFA-8F2F-5AD2B146AC58}.Release|x64.Build.0 = Release|x64 {1C34D970-6081-4EFA-8F2F-5AD2B146AC58}.Release|x86.ActiveCfg = Release|x86 {1C34D970-6081-4EFA-8F2F-5AD2B146AC58}.Release|x86.Build.0 = Release|x86 - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Debug|x64.ActiveCfg = Debug|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Debug|x64.Build.0 = Debug|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Debug|x86.ActiveCfg = Debug|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Debug|x86.Build.0 = Debug|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Release|Any CPU.Build.0 = Release|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Release|x64.ActiveCfg = Release|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Release|x64.Build.0 = Release|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Release|x86.ActiveCfg = Release|Any CPU - {3BEACB10-89FE-4F74-8022-1A52F223CE82}.Release|x86.Build.0 = Release|Any CPU {EEA89ACD-CFBB-4F60-A150-74F0A84DF028}.Debug|Any CPU.ActiveCfg = Debug|x86 {EEA89ACD-CFBB-4F60-A150-74F0A84DF028}.Debug|x64.ActiveCfg = Debug|x64 {EEA89ACD-CFBB-4F60-A150-74F0A84DF028}.Debug|x64.Build.0 = Debug|x64 @@ -1010,18 +952,6 @@ Global {6209C19B-42E4-4FCF-A539-FD1E4F4A34DB}.Release|x64.Build.0 = Release|x64 {6209C19B-42E4-4FCF-A539-FD1E4F4A34DB}.Release|x86.ActiveCfg = Release|x86 {6209C19B-42E4-4FCF-A539-FD1E4F4A34DB}.Release|x86.Build.0 = Release|x86 - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Debug|x64.ActiveCfg = Debug|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Debug|x64.Build.0 = Debug|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Debug|x86.ActiveCfg = Debug|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Debug|x86.Build.0 = Debug|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Release|Any CPU.Build.0 = Release|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Release|x64.ActiveCfg = Release|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Release|x64.Build.0 = Release|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Release|x86.ActiveCfg = Release|Any CPU - {DAA6B000-5BED-4081-B5E0-B698BFB89415}.Release|x86.Build.0 = Release|Any CPU {24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|Any CPU.Build.0 = Debug|Any CPU {24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1182,18 +1112,6 @@ Global {8D949A40-5F4B-4EB0-B8FD-301B472C96AE}.Release|x64.Build.0 = Release|Any CPU {8D949A40-5F4B-4EB0-B8FD-301B472C96AE}.Release|x86.ActiveCfg = Release|Any CPU {8D949A40-5F4B-4EB0-B8FD-301B472C96AE}.Release|x86.Build.0 = Release|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Debug|x64.ActiveCfg = Debug|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Debug|x64.Build.0 = Debug|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Debug|x86.ActiveCfg = Debug|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Debug|x86.Build.0 = Debug|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Release|Any CPU.Build.0 = Release|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Release|x64.ActiveCfg = Release|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Release|x64.Build.0 = Release|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Release|x86.ActiveCfg = Release|Any CPU - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1}.Release|x86.Build.0 = Release|Any CPU {E02B141F-E7C0-46CF-B9F6-39427218E714}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E02B141F-E7C0-46CF-B9F6-39427218E714}.Debug|Any CPU.Build.0 = Debug|Any CPU {E02B141F-E7C0-46CF-B9F6-39427218E714}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1537,18 +1455,6 @@ Global {3538EF5E-377E-430A-AFB8-F2DB5FAEDE95}.Release|x64.Build.0 = Release|x64 {3538EF5E-377E-430A-AFB8-F2DB5FAEDE95}.Release|x86.ActiveCfg = Release|x86 {3538EF5E-377E-430A-AFB8-F2DB5FAEDE95}.Release|x86.Build.0 = Release|x86 - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Debug|x64.ActiveCfg = Debug|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Debug|x64.Build.0 = Debug|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Debug|x86.ActiveCfg = Debug|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Debug|x86.Build.0 = Debug|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Release|Any CPU.Build.0 = Release|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Release|x64.ActiveCfg = Release|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Release|x64.Build.0 = Release|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Release|x86.ActiveCfg = Release|Any CPU - {2829C811-66EE-4B81-96CA-2ACB00B8E813}.Release|x86.Build.0 = Release|Any CPU {4AD438D9-D4E3-4EB5-8851-89DB4D1CFB9C}.Debug|Any CPU.ActiveCfg = Debug|x86 {4AD438D9-D4E3-4EB5-8851-89DB4D1CFB9C}.Debug|x64.ActiveCfg = Debug|x64 {4AD438D9-D4E3-4EB5-8851-89DB4D1CFB9C}.Debug|x64.Build.0 = Debug|x64 @@ -1689,7 +1595,6 @@ Global {AD119B05-A092-41AD-B68E-4AE2DB5A96D9} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {2AD18622-9A02-41B4-915E-798BD64044D5} = {498A300E-D036-49B7-A43D-821D1CAF11A5} {F47F206E-4CCA-4AD0-AEBA-FD9F491E05EC} = {498A300E-D036-49B7-A43D-821D1CAF11A5} - {24B0357D-B0C8-46C7-96F6-006E3F66662A} = {C70D6696-23F0-4C3D-9C2A-94C4868D5249} {8E1555D1-13D5-4DBF-9631-117D840C3158} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {DC7D131A-AF99-46AB-9AA6-463443E3B992} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {DA0A44FB-D562-4776-AAFB-8266E78AA1A6} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} @@ -1704,10 +1609,8 @@ Global {DF923186-5397-4E15-A95B-F15C8327ED53} = {498A300E-D036-49B7-A43D-821D1CAF11A5} {E1706893-D3A5-43B9-9036-AEF49DB9600B} = {498A300E-D036-49B7-A43D-821D1CAF11A5} {472DBA92-4FEA-4B9A-BA70-0E97B942E12D} = {8683D82A-2BBE-4199-9C36-C59F48804F90} - {72FB583A-A1B0-4B5F-8658-617B100DCD8E} = {5D8E1F81-B820-4736-B797-271B0FE787EE} {35F581E9-3D7C-4E80-8DFF-D437B0D86710} = {498A300E-D036-49B7-A43D-821D1CAF11A5} {1C34D970-6081-4EFA-8F2F-5AD2B146AC58} = {EFE48691-1FBA-41D5-9BFD-676771973F0C} - {3BEACB10-89FE-4F74-8022-1A52F223CE82} = {5D8E1F81-B820-4736-B797-271B0FE787EE} {EEA89ACD-CFBB-4F60-A150-74F0A84DF028} = {498A300E-D036-49B7-A43D-821D1CAF11A5} {B34EDBC7-C5FB-409D-8472-BC7469D6F2BD} = {9E5F0022-0A50-40BF-AC6A-C3078585ECAB} {8BDF1DE0-E6DE-48AD-AAA3-CE09CB544E2C} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} @@ -1716,7 +1619,6 @@ Global {303F8E41-691F-4453-AB7D-88A0036C0465} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {D141BD06-DD95-4CAF-85CD-657116E0DAD4} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {6209C19B-42E4-4FCF-A539-FD1E4F4A34DB} = {498A300E-D036-49B7-A43D-821D1CAF11A5} - {DAA6B000-5BED-4081-B5E0-B698BFB89415} = {C70D6696-23F0-4C3D-9C2A-94C4868D5249} {24BE488C-A5F3-4228-8CAB-E60EBEA444EE} = {EFE48691-1FBA-41D5-9BFD-676771973F0C} {EB0B88E2-589A-4F65-8F98-D5B958D8104F} = {EFE48691-1FBA-41D5-9BFD-676771973F0C} {4E83BFB5-F225-4C3B-B96E-0AD1951A5630} = {EFE48691-1FBA-41D5-9BFD-676771973F0C} @@ -1731,7 +1633,6 @@ Global {77EAF70B-4C16-499D-8096-91AC84E12EC4} = {8683D82A-2BBE-4199-9C36-C59F48804F90} {AED23FC5-46D9-4990-B5AB-9D287A0A7BD6} = {8683D82A-2BBE-4199-9C36-C59F48804F90} {8D949A40-5F4B-4EB0-B8FD-301B472C96AE} = {8683D82A-2BBE-4199-9C36-C59F48804F90} - {7DF988E6-4F60-44A4-B3E7-89BC6EB4D3D1} = {5D8E1F81-B820-4736-B797-271B0FE787EE} {A1D7653A-C409-414A-B9B0-7879953EBCDD} = {9E5F0022-0A50-40BF-AC6A-C3078585ECAB} {E02B141F-E7C0-46CF-B9F6-39427218E714} = {9E5F0022-0A50-40BF-AC6A-C3078585ECAB} {C00D8070-A38A-4267-9730-E9985CAE77DF} = {9E5F0022-0A50-40BF-AC6A-C3078585ECAB} @@ -1744,7 +1645,6 @@ Global {AFA0AB23-64F0-4AC1-9050-6CE8FE06F580} = {9518425A-36A5-4B8F-B0B8-6137DB88441D} {8683D82A-2BBE-4199-9C36-C59F48804F90} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {91E50134-0E55-4D22-B180-6967174FCE0B} = {8CEC2042-F11C-49F5-A674-2355793B600A} - {C70D6696-23F0-4C3D-9C2A-94C4868D5249} = {A0C5FBBB-CFB2-4FB9-B8F0-55676E9DCF06} {CC53E5C5-9D3E-4AD9-A9CA-D2190463EB5B} = {A0C5FBBB-CFB2-4FB9-B8F0-55676E9DCF06} {E5439139-6F94-44FA-9590-C32FCC1C7A93} = {8CEC2042-F11C-49F5-A674-2355793B600A} {1F146D40-8B21-4630-8049-14FA4BBBB217} = {9E5F0022-0A50-40BF-AC6A-C3078585ECAB} @@ -1776,7 +1676,6 @@ Global {34B67004-7249-4EF1-8E12-6E6DA37EA6BE} = {498A300E-D036-49B7-A43D-821D1CAF11A5} {1B9E6BF4-9D48-4988-9945-248096119E46} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {3538EF5E-377E-430A-AFB8-F2DB5FAEDE95} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} - {2829C811-66EE-4B81-96CA-2ACB00B8E813} = {5D8E1F81-B820-4736-B797-271B0FE787EE} {4AD438D9-D4E3-4EB5-8851-89DB4D1CFB9C} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {BC998ACD-353B-4A56-8A56-DF6200E141B6} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} {8EAABFB9-8A47-4B11-AD7F-AC8B373CDE49} = {BAF8F246-3645-42AD-B1D0-0F7EAFBAB34A} diff --git a/build/_build/.editorconfig b/build/_build/.editorconfig index 31e43dcd8e5b..447f7d82a971 100644 --- a/build/_build/.editorconfig +++ b/build/_build/.editorconfig @@ -1,4 +1,4 @@ -[*.cs] +[{Build.cs, Build.*.cs}] dotnet_style_qualification_for_field = false:warning dotnet_style_qualification_for_property = false:warning dotnet_style_qualification_for_method = false:warning diff --git a/build/_build/Build.Utilities.cs b/build/_build/Build.Utilities.cs index d8868e2e5b01..862cbb1f9a99 100644 --- a/build/_build/Build.Utilities.cs +++ b/build/_build/Build.Utilities.cs @@ -2,13 +2,18 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; +using System.Reflection; +using GeneratePackageVersions; using Nuke.Common; using Nuke.Common.IO; using Nuke.Common.Tooling; using Nuke.Common.Tools.Docker; using Nuke.Common.Tools.DotNet; using Nuke.Common.Tools.MSBuild; +using PrepareRelease; +using UpdateVendors; using static Nuke.Common.EnvironmentInfo; +using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.Tools.DotNet.DotNetTasks; using static Nuke.Common.Tools.MSBuild.MSBuildTasks; @@ -168,4 +173,91 @@ partial class Build .SetProcessEnvironmentVariables(envVars)); }); + + Target GeneratePackageVersions => _ => _ + .Description("Regenerate the PackageVersions props and .cs files") + .Executes(async () => + { + var testDir = Solution.GetProject(Projects.ClrProfilerIntegrationTests).Directory; + + var versionGenerator = new PackageVersionGenerator(RootDirectory, testDir); + await versionGenerator.GenerateVersions(); + }); + + Target UpdateVendoredCode => _ => _ + .Description("Updates the vendored dependency code and dependabot template") + .Executes(() => + { + var honeypotProject = RootDirectory / "honeypot" / "Datadog.Dependabot.Honeypot.csproj"; + UpdateVendorsTool.UpdateHoneypotProject(honeypotProject); + + var vendorDirectory = Solution.GetProject(Projects.DatadogTrace).Directory / "Vendors"; + var downloadDirectory = TemporaryDirectory / "Downloads"; + EnsureCleanDirectory(downloadDirectory); + UpdateVendorsTool.UpdateVendors(downloadDirectory, vendorDirectory); + }); + + Target UpdateIntegrationsJson => _ => _ + .Description("Update the integrations.json file") + .DependsOn(Clean, Restore, CreateRequiredDirectories, CompileManagedSrc, PublishManagedProfiler) // We load the dlls from the output, so need to do a clean build + .Before(CopyIntegrationsJson) + .Executes(() => + { + var assemblies = TracerHomeDirectory + .GlobFiles("**/Datadog.Trace.ClrProfiler.Managed.dll") + .Select(x => x.ToString()) + .ToList(); + + GenerateIntegrationDefinitions.Run(assemblies, RootDirectory); + }); + + Target UpdateVersion => _ => _ + .Description("Update the version number for the tracer") + .Before(Clean, BuildTracerHome) + .Requires(() => Version) + .Executes(() => + { + new SetAllVersions(RootDirectory, Version, IsPrerelease).Run(); + }); + + Target UpdateMsiContents => _ => _ + .Description("Update the contents of the MSI") + .DependsOn(Clean, BuildTracerHome) + .Executes(() => + { + SyncMsiContent.Run(RootDirectory, TracerHomeDirectory); + }); + + Target CiAppFeatureTracking => _ => _ + .Description("Generate the CIApp FeatureTracking JSON") + .DependsOn(Clean, Restore, CreateRequiredDirectories, CompileManagedSrc, PublishManagedProfiler) // We load the dlls from the output, so need to do a clean build + .Executes(() => + { + // Just grab the first one for now + var assemblyPath = TracerHomeDirectory + .GlobFiles("**/netcoreapp*/Datadog.Trace.ClrProfiler.Managed.dll") + .Select(x => x.ToString()) + .First(); + + var assembly = Assembly.LoadFrom(assemblyPath); + var featureTrackingAttribute = assembly.GetType("Datadog.Trace.Ci.FeatureTrackingAttribute"); + var types = new[] { "Datadog.Trace.Ci.CommonTags", "Datadog.Trace.Ci.TestTags" } + .Select(type => assembly.GetType(type)) + .ToArray(); + + var values = GetFeatureTrackingValueFromType(types); + + var json = Newtonsoft.Json.JsonConvert.SerializeObject(values); + Console.WriteLine(json); + + IEnumerable GetFeatureTrackingValueFromType(params Type[] types) + { + return types + .SelectMany(type => type.GetFields()) + .Where(f => f.GetCustomAttributes(featureTrackingAttribute, true).Length > 0) + .Select(f => f.GetValue(null).ToString()) + .OrderBy(v => v); + } + }); + } diff --git a/build/_build/Build.cs b/build/_build/Build.cs index 1807aa1922c5..2a7a973f9eb3 100644 --- a/build/_build/Build.cs +++ b/build/_build/Build.cs @@ -50,9 +50,12 @@ partial class Build : NukeBuild [Parameter("Is the build running on Alpine linux? Default is 'false'")] readonly bool IsAlpine = false; - [Parameter("The build version (for packaging purposes). Default is latest")] + [Parameter("The build version. Default is latest")] readonly string Version = "1.28.1"; + [Parameter("Whether the build version is a prerelease(for packaging purposes). Default is latest")] + readonly bool IsPrerelease = true; + [Parameter("Prints the available drive space before executing each target. Defaults to false")] readonly bool PrintDriveSpace = false; diff --git a/build/tools/GeneratePackageVersions/FileGenerator.cs b/build/_build/GeneratePackageVersions/FileGenerator.cs similarity index 100% rename from build/tools/GeneratePackageVersions/FileGenerator.cs rename to build/_build/GeneratePackageVersions/FileGenerator.cs diff --git a/build/tools/GeneratePackageVersions/MSBuildPropsFileGenerator.cs b/build/_build/GeneratePackageVersions/MSBuildPropsFileGenerator.cs similarity index 100% rename from build/tools/GeneratePackageVersions/MSBuildPropsFileGenerator.cs rename to build/_build/GeneratePackageVersions/MSBuildPropsFileGenerator.cs diff --git a/build/tools/GeneratePackageVersions/NuGetPackageHelper.cs b/build/_build/GeneratePackageVersions/NuGetPackageHelper.cs similarity index 100% rename from build/tools/GeneratePackageVersions/NuGetPackageHelper.cs rename to build/_build/GeneratePackageVersions/NuGetPackageHelper.cs diff --git a/build/tools/GeneratePackageVersions/PackageVersionEntry.cs b/build/_build/GeneratePackageVersions/PackageVersionEntry.cs similarity index 100% rename from build/tools/GeneratePackageVersions/PackageVersionEntry.cs rename to build/_build/GeneratePackageVersions/PackageVersionEntry.cs diff --git a/build/tools/GeneratePackageVersions/Program.cs b/build/_build/GeneratePackageVersions/Program.cs similarity index 71% rename from build/tools/GeneratePackageVersions/Program.cs rename to build/_build/GeneratePackageVersions/Program.cs index bb0b78530d84..a313d2fc239b 100644 --- a/build/tools/GeneratePackageVersions/Program.cs +++ b/build/_build/GeneratePackageVersions/Program.cs @@ -9,53 +9,41 @@ using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json; +using Nuke.Common.IO; namespace GeneratePackageVersions { - public class Program + public class PackageVersionGenerator { - private static string _solutionDirectory; - private static string _baseXunitPath; - private static PackageGroup _latestMinors; - private static PackageGroup _comprehensive; - private static XunitStrategyFileGenerator _strategyGenerator; - - public static async Task Main(string[] args) + private readonly AbsolutePath _definitionsFilePath; + private readonly PackageGroup _latestMinors; + private readonly PackageGroup _comprehensive; + private readonly XunitStrategyFileGenerator _strategyGenerator; + + public PackageVersionGenerator( + AbsolutePath solutionDirectory, + AbsolutePath testProjectDirectory) { - if (args.Length < 1 || string.IsNullOrWhiteSpace(args[0])) - { - Console.Error.WriteLine("error: You must specify the solution directory. Exiting."); - return; - } - - _solutionDirectory = args[0]; - - _baseXunitPath = Path.Combine( - _solutionDirectory, - "test", - "Datadog.Trace.ClrProfiler.IntegrationTests"); - - _latestMinors = new PackageGroup("LatestMinors"); - _comprehensive = new PackageGroup("Comprehensive"); + var propsDirectory = solutionDirectory / "build"; + _definitionsFilePath = solutionDirectory / "build" / "PackageVersionsGeneratorDefinitions.json"; + _latestMinors = new PackageGroup(propsDirectory, testProjectDirectory, "LatestMinors"); + _comprehensive = new PackageGroup(propsDirectory, testProjectDirectory, "Comprehensive"); + _strategyGenerator = new XunitStrategyFileGenerator(testProjectDirectory / "PackageVersions.g.cs"); - _strategyGenerator = new XunitStrategyFileGenerator( - Path.Combine( - _baseXunitPath, - "PackageVersions.g.cs")); - - var definitionsFilename = Path.Combine(args[0], "build", "PackageVersionsGeneratorDefinitions.json"); - - if (!File.Exists(definitionsFilename)) + if (!File.Exists(_definitionsFilePath)) { - Console.Error.WriteLine($"error: Definitions file {definitionsFilename} does not exist. Exiting."); - return; + throw new Exception($"Definitions file {_definitionsFilePath} does not exist. Exiting."); } + } - var entries = JsonConvert.DeserializeObject(File.ReadAllText(definitionsFilename)); + public async Task GenerateVersions() + { + var definitions = File.ReadAllText(_definitionsFilePath); + var entries = JsonConvert.DeserializeObject(definitions); await RunFileGeneratorWithPackageEntries(entries); } - private static async Task RunFileGeneratorWithPackageEntries(IEnumerable entries) + private async Task RunFileGeneratorWithPackageEntries(IEnumerable entries) { _latestMinors.Start(); _comprehensive.Start(); @@ -114,18 +102,15 @@ private static async Task RunFileGeneratorWithPackageEntries(IEnumerable +// 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. +// + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.Loader; +using System.Text; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace PrepareRelease +{ + public static class GenerateIntegrationDefinitions + { + const string InstrumentMethodAttributeName = "Datadog.Trace.ClrProfiler.InstrumentMethodAttribute"; + const string InterceptMethodAttributeName = "Datadog.Trace.ClrProfiler.InterceptMethodAttribute"; + + public static void Run(ICollection assemblyPaths, params string[] outputDirectories) + { + Console.WriteLine("Updating the integrations definitions"); + + var callTargetIntegrations = Enumerable.Empty(); + var callSiteIntegrations = Enumerable.Empty(); + + foreach (var path in assemblyPaths) + { + Console.WriteLine($"Reading integrations for {path}..."); + var assemblyLoadContext = new CustomAssemblyLoadContext(Path.GetDirectoryName(path)); + var assembly = assemblyLoadContext.LoadFromAssemblyPath(path); + + callTargetIntegrations = callTargetIntegrations.Concat(GetCallTargetIntegrations(new[] { assembly })); + callSiteIntegrations = callSiteIntegrations.Concat(GetCallSiteIntegrations(new[] { assembly })); + + assemblyLoadContext.Unload(); + } + + var serializerSettings = new JsonSerializerSettings + { + NullValueHandling = NullValueHandling.Ignore, + Formatting = Formatting.Indented, + ContractResolver = new DefaultContractResolver + { + NamingStrategy = new SnakeCaseNamingStrategy() + } + }; + + // remove duplicates + callTargetIntegrations = callTargetIntegrations + .GroupBy(x => x.Name) + .Select(x => new Integration() + { + Name = x.Key, + MethodReplacements = x + .SelectMany(y => y.MethodReplacements) + .Distinct() + .ToArray(), + }); + + callSiteIntegrations = callSiteIntegrations + .GroupBy(x => x.Name) + .Select(x => new Integration() + { + Name = x.Key, + MethodReplacements = x + .SelectMany(y => y.MethodReplacements) + .Distinct() + .ToArray(), + }); + + var json = JsonConvert.SerializeObject(callTargetIntegrations.Concat(callSiteIntegrations), serializerSettings); + Console.WriteLine($"Writing integration.json..."); + + foreach (var outputDirectory in outputDirectories) + { + var filename = Path.Combine(outputDirectory, "integrations.json"); + var utf8NoBom = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); + File.WriteAllText(filename, json, utf8NoBom); + } + } + + static IEnumerable GetCallTargetIntegrations(ICollection assemblies) + { + var assemblyInstrumentMethodAttributes = from assembly in assemblies + let attributes = assembly.GetCustomAttributes(inherit: false) + .Where(a => InheritsFrom(a.GetType(), InstrumentMethodAttributeName)) + .ToList() + from attribute in attributes + let callTargetType = GetPropertyValue(attribute, "CallTargetType") + ?? throw new NullReferenceException($"The usage of InstrumentMethodAttribute[Type={GetPropertyValue(attribute, "TypeName")}, Method={GetPropertyValue(attribute, "MethodName")}] in assembly scope must define the CallTargetType property.") + select (callTargetType, attribute); + + // Extract all InstrumentMethodAttribute from the classes + var classesInstrumentMethodAttributes = from assembly in assemblies + from wrapperType in assembly.GetTypes() + let attributes = wrapperType.GetCustomAttributes(inherit: false) + .Where(a => InheritsFrom(a.GetType(), InstrumentMethodAttributeName)) + .Select(a => (wrapperType, a)) + .ToList() + from attribute in attributes + select attribute; + + // combine all InstrumentMethodAttributes + // and create objects that will generate correct JSON schema + var callTargetIntegrations = from attributePair in assemblyInstrumentMethodAttributes.Concat(classesInstrumentMethodAttributes) + let callTargetType = attributePair.Item1 + let attribute = attributePair.Item2 + let integrationName = GetPropertyValue(attribute, "IntegrationName") + let assembly = callTargetType.Assembly + let wrapperType = callTargetType + orderby integrationName + group new + { + assembly, + wrapperType, + attribute + } + by integrationName into g + select new Integration + { + Name = g.Key, + MethodReplacements = (from item in g + from assembly in GetPropertyValue(item.attribute, "AssemblyNames") + let version = GetPropertyValue(item.attribute, "VersionRange") + select new Integration.MethodReplacement + { + Caller = new Integration.CallerDetail(), + Target = new Integration.TargetDetail + { + Assembly = assembly, + Type = GetPropertyValue(item.attribute, "TypeName"), + Method = GetPropertyValue(item.attribute, "MethodName"), + SignatureTypes = new string[] { GetPropertyValue(item.attribute, "ReturnTypeName") } + .Concat(GetPropertyValue(item.attribute, "ParameterTypeNames") ?? Enumerable.Empty()) + .ToArray(), + MinimumMajor = GetPropertyValue(version, "MinimumMajor"), + MinimumMinor = GetPropertyValue(version, "MinimumMinor"), + MinimumPatch = GetPropertyValue(version, "MinimumPatch"), + MaximumMajor = GetPropertyValue(version, "MaximumMajor"), + MaximumMinor = GetPropertyValue(version, "MaximumMinor"), + MaximumPatch = GetPropertyValue(version, "MaximumPatch"), + }, + Wrapper = new Integration.WrapperDetail() + { + Assembly = item.assembly.FullName, + Type = item.wrapperType.FullName, + Action = "CallTargetModification" + } + }).ToArray() + }; + return callTargetIntegrations.ToList(); + } + + + + static IEnumerable GetCallSiteIntegrations(ICollection assemblies) + { + // find all methods in Datadog.Trace.ClrProfiler.Managed.dll with [InterceptMethod] + // and create objects that will generate correct JSON schema + var integrations = from assembly in assemblies + from wrapperType in assembly.GetTypes() + from wrapperMethod in wrapperType.GetRuntimeMethods() + let attributes = wrapperMethod.GetCustomAttributes(inherit: false) + .Where(a => InheritsFrom(a.GetType(), InterceptMethodAttributeName)) + .ToList() + where attributes.Any() + from attribute in attributes + let integrationName = GetPropertyValue(attribute, "Integration") ?? GetIntegrationName(wrapperType) + orderby integrationName + group new + { + assembly, + wrapperType, + wrapperMethod, + attribute + } + by integrationName into g + select new Integration + { + Name = g.Key, + MethodReplacements = (from item in g + let version = GetPropertyValue(item.attribute, "TargetVersionRange") + let methodReplacementAction = GetPropertyValue(item.attribute, "MethodReplacementAction").ToString() + from targetAssembly in GetPropertyValue(item.attribute, "TargetAssemblies") + select new Integration.MethodReplacement + { + Caller = new Integration.CallerDetail + { + Assembly = GetPropertyValue(item.attribute, "CallerAssembly"), + Type = GetPropertyValue(item.attribute, "CallerType"), + Method = GetPropertyValue(item.attribute, "CallerMethod"), + }, + Target = new Integration.TargetDetail + { + Assembly = targetAssembly, + Type = GetPropertyValue(item.attribute, "TargetType"), + Method = GetPropertyValue(item.attribute, "TargetMethod") ?? item.wrapperMethod.Name, + Signature = GetPropertyValue(item.attribute, "TargetSignature"), + SignatureTypes = GetPropertyValue(item.attribute, "TargetSignatureTypes"), + MinimumMajor = GetPropertyValue(version, "MinimumMajor"), + MinimumMinor = GetPropertyValue(version, "MinimumMinor"), + MinimumPatch = GetPropertyValue(version, "MinimumPatch"), + MaximumMajor = GetPropertyValue(version, "MaximumMajor"), + MaximumMinor = GetPropertyValue(version, "MaximumMinor"), + MaximumPatch = GetPropertyValue(version, "MaximumPatch"), + }, + Wrapper = new Integration.WrapperDetail + { + Assembly = item.assembly.FullName, + Type = item.wrapperType.FullName, + Method = item.wrapperMethod.Name, + Signature = GetMethodSignature(item.wrapperMethod, item.attribute, methodReplacementAction), + Action = methodReplacementAction + } + }).ToArray() + }; + return integrations.ToList(); + } + + private static bool InheritsFrom(Type type, string baseType) + { + if (type.FullName == baseType) + { + return true; + } + + if (type.BaseType is null) + { + return false; + } + + return InheritsFrom(type.BaseType, baseType); + } + private static T GetPropertyValue(object attribute, string propertyName) + { + var type = attribute.GetType(); + var getValue = type.GetProperty(propertyName)?.GetGetMethod(); + if (getValue is null || !getValue.ReturnType.IsAssignableTo(typeof(T))) + { + throw new ArgumentException($"Provided type {type} does not contain a property {propertyName} with a getter that returns {typeof(T)}"); + } + + return (T)getValue.Invoke(attribute, Array.Empty()); + } + + private static string GetIntegrationName(Type wrapperType) + { + const string integrations = "Integration"; + var typeName = wrapperType.Name; + + if (typeName.EndsWith(integrations, StringComparison.OrdinalIgnoreCase)) + { + return typeName.Substring(startIndex: 0, length: typeName.Length - integrations.Length); + } + + return typeName; + } + + private static string GetMethodSignature(MethodInfo method, object attribute, string methodReplacementAction) + { + var returnType = method.ReturnType; + var parameters = method.GetParameters().Select(p => p.ParameterType).ToArray(); + + var requiredParameterTypes = new[] { typeof(int), typeof(int), typeof(long) }; + var lastParameterTypes = parameters.Skip(parameters.Length - requiredParameterTypes.Length); + + if (methodReplacementAction == "ReplaceTargetMethod") + { + if (!lastParameterTypes.SequenceEqual(requiredParameterTypes)) + { + throw new Exception( + $"Method {method.DeclaringType.FullName}.{method.Name}() does not meet parameter requirements. " + + "Wrapper methods must have at least 3 parameters and the last 3 must be of types Int32 (opCode), Int32 (mdToken), and Int64 (moduleVersionPtr)."); + } + } + else if (methodReplacementAction == "InsertFirst") + { + var callerAssembly = GetPropertyValue(attribute, "CallerAssembly"); + var callerType = GetPropertyValue(attribute, "CallerType"); + var callerMethod = GetPropertyValue(attribute, "CallerMethod"); + if (callerAssembly == null || callerType == null || callerMethod == null) + { + throw new Exception( + $"Method {method.DeclaringType.FullName}.{method.Name}() does not meet InterceptMethodAttribute requirements. " + + "Currently, InsertFirst methods must have CallerAssembly, CallerType, and CallerMethod defined. " + + $"Current values: CallerAssembly=\"{callerAssembly}\", CallerType=\"{callerType}\", CallerMethod=\"{callerMethod}\""); + } + else if (parameters.Any()) + { + throw new Exception( + $"Method {method.DeclaringType.FullName}.{method.Name}() does not meet parameter requirements. " + + "Currently, InsertFirst methods must have zero parameters."); + } + else if (returnType != typeof(void)) + { + throw new Exception( + $"Method {method.DeclaringType.FullName}.{method.Name}() does not meet return type requirements. " + + "Currently, InsertFirst methods must have a void return type."); + } + } + + var signatureHelper = SignatureHelper.GetMethodSigHelper(method.CallingConvention, returnType); + signatureHelper.AddArguments(parameters, requiredCustomModifiers: null, optionalCustomModifiers: null); + var signatureBytes = signatureHelper.GetSignature(); + + if (method.IsGenericMethod) + { + // if method is generic, fix first byte (calling convention) + // and insert a second byte with generic parameter count + const byte IMAGE_CEE_CS_CALLCONV_GENERIC = 0x10; + var genericArguments = method.GetGenericArguments(); + + var newSignatureBytes = new byte[signatureBytes.Length + 1]; + newSignatureBytes[0] = (byte)(signatureBytes[0] | IMAGE_CEE_CS_CALLCONV_GENERIC); + newSignatureBytes[1] = (byte)genericArguments.Length; + Array.Copy(signatureBytes, 1, newSignatureBytes, 2, signatureBytes.Length - 1); + + signatureBytes = newSignatureBytes; + } + + return string.Join(" ", signatureBytes.Select(b => b.ToString("X2"))); + } + + private class Integration + { + public string Name { get; init; } + + public MethodReplacement[] MethodReplacements { get; init; } + + public class MethodReplacement + { + public CallerDetail Caller { get; init; } + + public TargetDetail Target { get; init; } + + public WrapperDetail Wrapper { get; init; } + + protected bool Equals(MethodReplacement other) => + Equals(Caller, other.Caller) && + Equals(Target, other.Target) && + Equals(Wrapper, other.Wrapper); + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + if (obj.GetType() != this.GetType()) + { + return false; + } + + return Equals((MethodReplacement)obj); + } + + public override int GetHashCode() => HashCode.Combine(Caller, Target, Wrapper); + } + + public record CallerDetail + { + public string Assembly { get; init; } + + public string Type { get; init; } + + public string Method { get; init; } + + } + + public class TargetDetail + { + public string Assembly { get; init; } + + public string Type { get; init; } + + public string Method { get; init; } + + public string Signature { get; init; } + + public string[] SignatureTypes { get; init; } + + public ushort MinimumMajor {get;init;} + + public ushort MinimumMinor {get;init;} + + public ushort MinimumPatch {get;init;} + + public ushort MaximumMajor {get;init;} + + public ushort MaximumMinor {get;init;} + + public ushort MaximumPatch {get;init;} + + private bool Equals(TargetDetail other) => + Assembly == other.Assembly && + Type == other.Type && + Method == other.Method && + Signature == other.Signature && + ((SignatureTypes is null && other.SignatureTypes is null) || + (SignatureTypes is not null && other.SignatureTypes is not null && + string.Join(",", SignatureTypes) == string.Join(",", other.SignatureTypes))) && + MinimumMajor == other.MinimumMajor && + MinimumMinor == other.MinimumMinor && + MinimumPatch == other.MinimumPatch && + MaximumMajor == other.MaximumMajor && + MaximumMinor == other.MaximumMinor && + MaximumPatch == other.MaximumPatch; + + public override bool Equals(object obj) + { + if (ReferenceEquals(null, obj)) + { + return false; + } + + if (ReferenceEquals(this, obj)) + { + return true; + } + + if (obj.GetType() != this.GetType()) + { + return false; + } + + return Equals((TargetDetail)obj); + } + + public override int GetHashCode() + { + var hashCode = new HashCode(); + hashCode.Add(Assembly); + hashCode.Add(Type); + hashCode.Add(Method); + hashCode.Add(Signature); + hashCode.Add(SignatureTypes?.Length > 0 ? string.Join(",", SignatureTypes) : null); + hashCode.Add(MinimumMajor); + hashCode.Add(MinimumMinor); + hashCode.Add(MinimumPatch); + hashCode.Add(MaximumMajor); + hashCode.Add(MaximumMinor); + hashCode.Add(MaximumPatch); + return hashCode.ToHashCode(); + } + } + + public record WrapperDetail + { + public string Assembly { get; init; } + + public string Type { get; init; } + + public string Method { get; init; } + + public string Signature { get; init; } + + public string Action { get; init; } + } + } + + class CustomAssemblyLoadContext : AssemblyLoadContext + { + readonly string _assemblyLoadPath; + + public CustomAssemblyLoadContext(string assemblyLoadPath) + : base("IntegrationsJsonLoadContext", true) + { + _assemblyLoadPath = assemblyLoadPath; + } + + protected override Assembly Load(AssemblyName assemblyName) + { + var assemblyPath = Path.Combine(_assemblyLoadPath, $"{assemblyName.Name}.dll"); + if(File.Exists(assemblyPath)) + { + return LoadFromAssemblyPath(assemblyPath); + } + + return null; + } + + } + } +} diff --git a/build/tools/PrepareRelease/SetAllVersions.cs b/build/_build/PrepareRelease/SetAllVersions.cs similarity index 95% rename from build/tools/PrepareRelease/SetAllVersions.cs rename to build/_build/PrepareRelease/SetAllVersions.cs index 15a997de7d0f..c2e132401d13 100644 --- a/build/tools/PrepareRelease/SetAllVersions.cs +++ b/build/_build/PrepareRelease/SetAllVersions.cs @@ -7,14 +7,17 @@ using System.IO; using System.Text; using System.Text.RegularExpressions; +using Nuke.Common.IO; namespace PrepareRelease { public class SetAllVersions { - public SetAllVersions(string solutionDirectory) + public SetAllVersions(string solutionDirectory, string tracerVersion, bool isPrerelease) { SolutionDirectory = solutionDirectory; + TracerVersion = new Version(tracerVersion); + IsPrerelease = isPrerelease; } /// @@ -28,12 +31,12 @@ public SetAllVersions(string solutionDirectory) /// When changing the tracer version, update this value and , /// then run the "PrepareRelease" tool to update the entire solution. /// - public Version TracerVersion { get; } = new("1.28.1"); + public Version TracerVersion { get; } /// /// Gets a value indicating whether the current tracer version is a prerelease. /// - public bool IsPrerelease { get; } = true; + public bool IsPrerelease { get; } public void Run() { @@ -82,6 +85,10 @@ public void Run() "build/_build/Build.cs", text => Regex.Replace(text, $"readonly string Version = \"{VersionPattern()}\"", $"readonly string Version = \"{VersionString()}\"")); + SynchronizeVersion( + "build/_build/Build.cs", + text => Regex.Replace(text, "readonly bool IsPrerelease = (true|false)", $"readonly bool IsPrerelease = {(IsPrerelease ? "true" : "false")}")); + // Managed project / NuGet package updates SynchronizeVersion( "src/Datadog.Trace/Datadog.Trace.csproj", diff --git a/build/tools/PrepareRelease/SyncMsiContent.cs b/build/_build/PrepareRelease/SyncMsiContent.cs similarity index 100% rename from build/tools/PrepareRelease/SyncMsiContent.cs rename to build/_build/PrepareRelease/SyncMsiContent.cs diff --git a/tools/UpdateVendors/Datadog.Dependabot.Honeypot.template b/build/_build/UpdateVendors/Datadog.Dependabot.Honeypot.template similarity index 100% rename from tools/UpdateVendors/Datadog.Dependabot.Honeypot.template rename to build/_build/UpdateVendors/Datadog.Dependabot.Honeypot.template diff --git a/tools/UpdateVendors/Program.cs b/build/_build/UpdateVendors/UpdateVendors.cs similarity index 64% rename from tools/UpdateVendors/Program.cs rename to build/_build/UpdateVendors/UpdateVendors.cs index 7108b1d5785e..d46942fde511 100644 --- a/tools/UpdateVendors/Program.cs +++ b/build/_build/UpdateVendors/UpdateVendors.cs @@ -9,61 +9,48 @@ using System.IO.Compression; using System.Linq; using System.Net; -using Datadog.Core.Tools; +using Nuke.Common.IO; namespace UpdateVendors { - public class Program + public static class UpdateVendorsTool { - private static readonly string DownloadDirectory = Path.Combine(Environment.CurrentDirectory, "downloads"); - private static string _vendorProjectDirectory; - - public static void Main() + public static void UpdateHoneypotProject(AbsolutePath honeypotProject) { - InitializeCleanDirectory(DownloadDirectory); - var solutionDirectory = GetSolutionDirectory(); - _vendorProjectDirectory = Path.Combine(solutionDirectory, "src", "Datadog.Trace", "Vendors"); - var fakeRefs = string.Empty; foreach (var dependency in VendoredDependency.All) { fakeRefs += $@"{Environment.NewLine} "; fakeRefs += $@"{Environment.NewLine} {Environment.NewLine}"; - UpdateVendor(dependency); } var honeypotProjTemplate = GetHoneyPotProjTemplate(); honeypotProjTemplate = honeypotProjTemplate.Replace("##PACKAGE_REFS##", fakeRefs); - var projLocation = Path.Combine(EnvironmentTools.GetSolutionDirectory(), "honeypot", "Datadog.Dependabot.Honeypot.csproj"); - File.WriteAllText(projLocation, honeypotProjTemplate); + + File.WriteAllText(honeypotProject, honeypotProjTemplate); } - private static string GetHoneyPotProjTemplate() + public static void UpdateVendors( + AbsolutePath downloadDirectory, + AbsolutePath vendorDirectory) { - var templateName = "Datadog.Dependabot.Honeypot.template"; - var directory = Directory.GetCurrentDirectory(); - string template = null; - var levelLimit = 4; - - while (template == null && --levelLimit >= 0) + foreach (var dependency in VendoredDependency.All) { - foreach (var filePath in Directory.EnumerateFiles(directory)) - { - if (filePath.Contains(templateName)) - { - template = File.ReadAllText(filePath); - break; - } - } - - directory = Directory.GetParent(directory).FullName; + UpdateVendor(dependency, downloadDirectory, vendorDirectory); } + } - return template; + private static string GetHoneyPotProjTemplate() + { + var thisAssembly = typeof(UpdateVendorsTool).Assembly; + var resourceStream = thisAssembly.GetManifestResourceStream("UpdateVendors.Datadog.Dependabot.Honeypot.template"); + using var reader = new StreamReader(resourceStream); + + return reader.ReadToEnd(); } - private static void UpdateVendor(VendoredDependency dependency) + private static void UpdateVendor(VendoredDependency dependency, AbsolutePath downloadDirectory, AbsolutePath vendorDirectory) { var libraryName = dependency.LibraryName; var downloadUrl = dependency.DownloadUrl; @@ -71,9 +58,9 @@ private static void UpdateVendor(VendoredDependency dependency) Console.WriteLine($"Starting {libraryName} upgrade."); - var zipLocation = Path.Combine(DownloadDirectory, $"{libraryName}.zip"); - var extractLocation = Path.Combine(DownloadDirectory, $"{libraryName}"); - var vendorFinalPath = Path.Combine(_vendorProjectDirectory, libraryName); + var zipLocation = Path.Combine(downloadDirectory, $"{libraryName}.zip"); + var extractLocation = Path.Combine(downloadDirectory, $"{libraryName}"); + var vendorFinalPath = Path.Combine(vendorDirectory, libraryName); var sourceUrlLocation = Path.Combine(vendorFinalPath, "_last_downloaded_source_url.txt"); // Ensure the url has changed, or don't bother upgrading @@ -155,12 +142,6 @@ private static bool ShouldDropFile(string filePath) return false; } - private static void InitializeCleanDirectory(string directoryPath) - { - SafeDeleteDirectory(directoryPath); - Directory.CreateDirectory(directoryPath); - } - private static void SafeDeleteDirectory(string directoryPath) { if (Directory.Exists(directoryPath)) @@ -168,31 +149,5 @@ private static void SafeDeleteDirectory(string directoryPath) Directory.Delete(directoryPath, recursive: true); } } - - private static string GetSolutionDirectory() - { - var startDirectory = Environment.CurrentDirectory; - var currentDirectory = Directory.GetParent(startDirectory); - const string searchItem = @"Datadog.Trace.sln"; - - while (true) - { - var slnFile = currentDirectory.GetFiles(searchItem).SingleOrDefault(); - - if (slnFile != null) - { - break; - } - - currentDirectory = currentDirectory.Parent; - - if (currentDirectory == null || !currentDirectory.Exists) - { - throw new Exception($"Unable to find solution directory from: {startDirectory}"); - } - } - - return currentDirectory.FullName; - } } } diff --git a/tools/UpdateVendors/VendoredDependency.cs b/build/_build/UpdateVendors/VendoredDependency.cs similarity index 100% rename from tools/UpdateVendors/VendoredDependency.cs rename to build/_build/UpdateVendors/VendoredDependency.cs diff --git a/build/_build/_build.csproj b/build/_build/_build.csproj index 23d45320de30..b57d4e32757b 100644 --- a/build/_build/_build.csproj +++ b/build/_build/_build.csproj @@ -15,6 +15,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -24,4 +25,9 @@ + + + + + \ No newline at end of file diff --git a/build/_build/_build.csproj.DotSettings b/build/_build/_build.csproj.DotSettings index 7bc28484c4f1..37a32df43e9c 100644 --- a/build/_build/_build.csproj.DotSettings +++ b/build/_build/_build.csproj.DotSettings @@ -3,6 +3,7 @@ DO_NOT_SHOW DO_NOT_SHOW DO_NOT_SHOW + True Implicit Implicit ExpressionBody diff --git a/build/tools/Directory.Build.props b/build/tools/Directory.Build.props deleted file mode 100644 index c561143442df..000000000000 --- a/build/tools/Directory.Build.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/build/tools/GeneratePackageVersions/GeneratePackageVersions.csproj b/build/tools/GeneratePackageVersions/GeneratePackageVersions.csproj deleted file mode 100644 index 05180c780f2d..000000000000 --- a/build/tools/GeneratePackageVersions/GeneratePackageVersions.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - Exe - net5.0 - - - - - - - - diff --git a/build/tools/GeneratePackageVersions/Properties/launchSettings.json b/build/tools/GeneratePackageVersions/Properties/launchSettings.json deleted file mode 100644 index 80918d8419e9..000000000000 --- a/build/tools/GeneratePackageVersions/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "GeneratePackageVersions": { - "commandName": "Project", - "commandLineArgs": "$(SolutionDir)" - } - } -} \ No newline at end of file diff --git a/build/tools/GlobalSuppressions.cs b/build/tools/GlobalSuppressions.cs deleted file mode 100644 index 4c20b0bf5c11..000000000000 --- a/build/tools/GlobalSuppressions.cs +++ /dev/null @@ -1,10 +0,0 @@ -// -// 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. -// - -using System.Diagnostics.CodeAnalysis; - -[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Reviewed.")] -[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1652:EnableXmlDocumentationOutput", Justification = "Reviewed.")] -[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1025:Code must not contain multiple whitespace in a row", Justification = "Reviewed. Used for pretty formatting.")] diff --git a/build/tools/PrepareRelease/GenerateIntegrationDefinitions.cs b/build/tools/PrepareRelease/GenerateIntegrationDefinitions.cs deleted file mode 100644 index 7d060fcaa925..000000000000 --- a/build/tools/PrepareRelease/GenerateIntegrationDefinitions.cs +++ /dev/null @@ -1,251 +0,0 @@ -// -// 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. -// - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Reflection.Emit; -using System.Text; -using Datadog.Trace.ClrProfiler; -using Newtonsoft.Json; - -namespace PrepareRelease -{ - public static class GenerateIntegrationDefinitions - { - public static void Run(params string[] outputDirectories) - { - Console.WriteLine("Updating the integrations definitions"); - - var assemblies = new List(); - assemblies.Add(typeof(Instrumentation).Assembly); - - // Extract all InstrumentMethodAttribute at assembly scope level - var assemblyInstrumentMethodAttributes = from assembly in assemblies - let attributes = assembly.GetCustomAttributes(inherit: false) - .Select(a => a as InstrumentMethodAttribute) - .Where(a => a != null).ToList() - from attribute in attributes - let callTargetClassCheck = attribute.CallTargetType - ?? throw new NullReferenceException($"The usage of InstrumentMethodAttribute[Type={attribute.TypeName}, Method={attribute.MethodName}] in assembly scope must define the CallTargetType property.") - select attribute; - - // Extract all InstrumentMethodAttribute from the classes - var classesInstrumentMethodAttributes = from assembly in assemblies - from wrapperType in assembly.GetTypes() - let attributes = wrapperType.GetCustomAttributes(inherit: false) - .Select(a => a as InstrumentMethodAttribute) - .Where(a => a != null) - .Select(a => - { - a.CallTargetType = wrapperType; - return a; - }).ToList() - from attribute in attributes - select attribute; - - // combine all InstrumentMethodAttributes - // and create objects that will generate correct JSON schema - var callTargetIntegrations = from attribute in assemblyInstrumentMethodAttributes.Concat(classesInstrumentMethodAttributes) - let integrationName = attribute.IntegrationName - let assembly = attribute.CallTargetType.Assembly - let wrapperType = attribute.CallTargetType - orderby integrationName - group new - { - assembly, - wrapperType, - attribute - } - by integrationName into g - select new - { - name = g.Key, - method_replacements = from item in g - from assembly in item.attribute.AssemblyNames - select new - { - caller = new - { - assembly = (string)null, - type = (string)null, - method = (string)null - }, - target = new - { - assembly = assembly, - type = item.attribute.TypeName, - method = item.attribute.MethodName, - signature = (string)null, - signature_types = new string[] { item.attribute.ReturnTypeName }.Concat(item.attribute.ParameterTypeNames ?? Enumerable.Empty()).ToArray(), - minimum_major = item.attribute.VersionRange.MinimumMajor, - minimum_minor = item.attribute.VersionRange.MinimumMinor, - minimum_patch = item.attribute.VersionRange.MinimumPatch, - maximum_major = item.attribute.VersionRange.MaximumMajor, - maximum_minor = item.attribute.VersionRange.MaximumMinor, - maximum_patch = item.attribute.VersionRange.MaximumPatch - }, - wrapper = new - { - assembly = item.assembly.FullName, - type = item.wrapperType.FullName, - method = (string)null, - signature = (string)null, - action = MethodReplacementActionType.CallTargetModification.ToString() - } - } - }; - - // find all methods in Datadog.Trace.ClrProfiler.Managed.dll with [InterceptMethod] - // and create objects that will generate correct JSON schema - var integrations = from assembly in assemblies - from wrapperType in assembly.GetTypes() - from wrapperMethod in wrapperType.GetRuntimeMethods() - let attributes = wrapperMethod.GetCustomAttributes(inherit: false) - where attributes.Any() - from attribute in attributes - let integrationName = attribute.Integration ?? GetIntegrationName(wrapperType) - orderby integrationName - group new - { - assembly, - wrapperType, - wrapperMethod, - attribute - } - by integrationName into g - select new - { - name = g.Key, - method_replacements = from item in g - from targetAssembly in item.attribute.TargetAssemblies - select new - { - caller = new - { - assembly = item.attribute.CallerAssembly, - type = item.attribute.CallerType, - method = item.attribute.CallerMethod - }, - target = new - { - assembly = targetAssembly, - type = item.attribute.TargetType, - method = item.attribute.TargetMethod ?? item.wrapperMethod.Name, - signature = item.attribute.TargetSignature, - signature_types = item.attribute.TargetSignatureTypes, - minimum_major = item.attribute.TargetVersionRange.MinimumMajor, - minimum_minor = item.attribute.TargetVersionRange.MinimumMinor, - minimum_patch = item.attribute.TargetVersionRange.MinimumPatch, - maximum_major = item.attribute.TargetVersionRange.MaximumMajor, - maximum_minor = item.attribute.TargetVersionRange.MaximumMinor, - maximum_patch = item.attribute.TargetVersionRange.MaximumPatch - }, - wrapper = new - { - assembly = item.assembly.FullName, - type = item.wrapperType.FullName, - method = item.wrapperMethod.Name, - signature = GetMethodSignature(item.wrapperMethod, item.attribute), - action = item.attribute.MethodReplacementAction.ToString() - } - } - }; - - var serializerSettings = new JsonSerializerSettings - { - NullValueHandling = NullValueHandling.Ignore, - Formatting = Formatting.Indented - }; - - var json = JsonConvert.SerializeObject(callTargetIntegrations.Concat(integrations), serializerSettings); - Console.WriteLine(json); - - foreach (var outputDirectory in outputDirectories) - { - var filename = Path.Combine(outputDirectory, "integrations.json"); - var utf8NoBom = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); - File.WriteAllText(filename, json, utf8NoBom); - } - } - - private static string GetIntegrationName(Type wrapperType) - { - const string integrations = "Integration"; - var typeName = wrapperType.Name; - - if (typeName.EndsWith(integrations, StringComparison.OrdinalIgnoreCase)) - { - return typeName.Substring(startIndex: 0, length: typeName.Length - integrations.Length); - } - - return typeName; - } - - private static string GetMethodSignature(MethodInfo method, InterceptMethodAttribute attribute) - { - var returnType = method.ReturnType; - var parameters = method.GetParameters().Select(p => p.ParameterType).ToArray(); - - var requiredParameterTypes = new[] { typeof(int), typeof(int), typeof(long) }; - var lastParameterTypes = parameters.Skip(parameters.Length - requiredParameterTypes.Length); - - if (attribute.MethodReplacementAction == MethodReplacementActionType.ReplaceTargetMethod) - { - if (!lastParameterTypes.SequenceEqual(requiredParameterTypes)) - { - throw new Exception( - $"Method {method.DeclaringType.FullName}.{method.Name}() does not meet parameter requirements. " + - "Wrapper methods must have at least 3 parameters and the last 3 must be of types Int32 (opCode), Int32 (mdToken), and Int64 (moduleVersionPtr)."); - } - } - else if (attribute.MethodReplacementAction == MethodReplacementActionType.InsertFirst) - { - if (attribute.CallerAssembly == null || attribute.CallerType == null || attribute.CallerMethod == null) - { - throw new Exception( - $"Method {method.DeclaringType.FullName}.{method.Name}() does not meet InterceptMethodAttribute requirements. " + - "Currently, InsertFirst methods must have CallerAssembly, CallerType, and CallerMethod defined. " + - $"Current values: CallerAssembly=\"{attribute.CallerAssembly}\", CallerType=\"{attribute.CallerType}\", CallerMethod=\"{attribute.CallerMethod}\""); - } - else if (parameters.Any()) - { - throw new Exception( - $"Method {method.DeclaringType.FullName}.{method.Name}() does not meet parameter requirements. " + - "Currently, InsertFirst methods must have zero parameters."); - } - else if (returnType != typeof(void)) - { - throw new Exception( - $"Method {method.DeclaringType.FullName}.{method.Name}() does not meet return type requirements. " + - "Currently, InsertFirst methods must have a void return type."); - } - } - - var signatureHelper = SignatureHelper.GetMethodSigHelper(method.CallingConvention, returnType); - signatureHelper.AddArguments(parameters, requiredCustomModifiers: null, optionalCustomModifiers: null); - var signatureBytes = signatureHelper.GetSignature(); - - if (method.IsGenericMethod) - { - // if method is generic, fix first byte (calling convention) - // and insert a second byte with generic parameter count - const byte IMAGE_CEE_CS_CALLCONV_GENERIC = 0x10; - var genericArguments = method.GetGenericArguments(); - - var newSignatureBytes = new byte[signatureBytes.Length + 1]; - newSignatureBytes[0] = (byte)(signatureBytes[0] | IMAGE_CEE_CS_CALLCONV_GENERIC); - newSignatureBytes[1] = (byte)genericArguments.Length; - Array.Copy(signatureBytes, 1, newSignatureBytes, 2, signatureBytes.Length - 1); - - signatureBytes = newSignatureBytes; - } - - return string.Join(" ", signatureBytes.Select(b => b.ToString("X2"))); - } - } -} diff --git a/build/tools/PrepareRelease/PrepareRelease.csproj b/build/tools/PrepareRelease/PrepareRelease.csproj deleted file mode 100644 index 30875a49bd6d..000000000000 --- a/build/tools/PrepareRelease/PrepareRelease.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - Exe - net461 - netcoreapp3.1 - - - - - - - - - - - diff --git a/build/tools/PrepareRelease/Program.cs b/build/tools/PrepareRelease/Program.cs deleted file mode 100644 index 6f1b2d1bc752..000000000000 --- a/build/tools/PrepareRelease/Program.cs +++ /dev/null @@ -1,96 +0,0 @@ -// -// 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. -// - -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; - -namespace PrepareRelease -{ - public class Program - { - public const string Versions = "versions"; - public const string Integrations = "integrations"; - public const string Msi = "msi"; - - public static void Main(string[] args) - { - if (args.Length == 0) - { - throw new ArgumentException($@"You must specify at least one job name from [""{Versions}"", ""{Integrations}, ""{Msi}""]."); - } - - var solutionDir = GetSolutionDirectory(); - - if (JobShouldRun(Integrations, args)) - { - Console.WriteLine("--------------- Integrations Job Started ---------------"); - GenerateIntegrationDefinitions.Run(solutionDir); - Console.WriteLine("--------------- Integrations Job Complete ---------------"); - } - - if (JobShouldRun(Versions, args)) - { - Console.WriteLine("--------------- Versions Job Started ---------------"); - new SetAllVersions(solutionDir).Run(); - Console.WriteLine("--------------- Versions Job Complete ---------------"); - } - - if (JobShouldRun(Msi, args)) - { - Environment.SetEnvironmentVariable("SOLUTION_DIR", solutionDir); - - var outputDir = Path.Combine(solutionDir, "bin", "tracer-home"); - var publishBatch = Path.Combine(solutionDir, "build", "tools", "PrepareRelease", "publish-all.bat"); - ExecuteCommand(publishBatch); - - Console.WriteLine("--------------- MSI Job Started ---------------"); - SyncMsiContent.Run(solutionDir, outputDir); - Console.WriteLine("--------------- MSI Job Complete ---------------"); - } - } - - private static bool JobShouldRun(string jobName, string[] args) - { - return args.Any(a => string.Equals(a, jobName, StringComparison.OrdinalIgnoreCase)); - } - - private static void ExecuteCommand(string command) - { - var processInfo = new ProcessStartInfo("cmd.exe", "/c " + command) { CreateNoWindow = true, UseShellExecute = true }; - var process = Process.Start(processInfo); - process.WaitForExit(240_000); - Console.WriteLine("Publish ExitCode: " + process.ExitCode, "ExecuteCommand"); - process?.Close(); - } - - private static string GetSolutionDirectory() - { - var startDirectory = Environment.CurrentDirectory; - var currentDirectory = Directory.GetParent(startDirectory); - const string searchItem = @"Datadog.Trace.sln"; - - while (true) - { - var slnFile = currentDirectory.GetFiles(searchItem).SingleOrDefault(); - - if (slnFile != null) - { - break; - } - - currentDirectory = currentDirectory.Parent; - - if (currentDirectory == null || !currentDirectory.Exists) - { - throw new Exception($"Unable to find solution directory from: {startDirectory}"); - } - } - - return currentDirectory.FullName; - } - } -} diff --git a/build/tools/PrepareRelease/Properties/launchSettings.json b/build/tools/PrepareRelease/Properties/launchSettings.json deleted file mode 100644 index d1851bdbd038..000000000000 --- a/build/tools/PrepareRelease/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "PrepareRelease": { - "commandName": "Project", - "commandLineArgs": "versions integrations msi" - } - } -} \ No newline at end of file diff --git a/build/tools/PrepareRelease/publish-all.bat b/build/tools/PrepareRelease/publish-all.bat deleted file mode 100644 index 31a8f5bc1142..000000000000 --- a/build/tools/PrepareRelease/publish-all.bat +++ /dev/null @@ -1 +0,0 @@ -%SOLUTION_DIR%\build.cmd Clean BuildTracerHome diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsSqsTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsSqsTests.cs index 8e2c1b668182..0dac9046715c 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsSqsTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AWS/AwsSqsTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ClrProfiler.IntegrationTests.Helpers; using Datadog.Trace.TestHelpers; using FluentAssertions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/DapperTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/DapperTests.cs index 971a95d1a5cf..463dd9475476 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/DapperTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/DapperTests.cs @@ -4,7 +4,6 @@ // #if !NET452 -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/FakeCommandTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/FakeCommandTests.cs index 2b81731fdddd..a25ea0777652 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/FakeCommandTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/FakeCommandTests.cs @@ -4,7 +4,6 @@ // using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs index 3f2c025a3611..c7720f53ebf3 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqlClientTests.cs @@ -6,7 +6,6 @@ #if !NET452 using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqliteTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqliteTests.cs index 78212fbef5c9..f992946ffcb2 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqliteTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MicrosoftDataSqliteTests.cs @@ -6,7 +6,6 @@ #if !NET452 using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MySqlCommandTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MySqlCommandTests.cs index 686b29acc90f..5ecf2ffa477f 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MySqlCommandTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/MySqlCommandTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/NpgsqlCommandTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/NpgsqlCommandTests.cs index 6aa301584d24..3b04c48e31cd 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/NpgsqlCommandTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/NpgsqlCommandTests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SqlCommand20Tests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SqlCommand20Tests.cs index 332a7af9664e..760447ac9178 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SqlCommand20Tests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SqlCommand20Tests.cs @@ -9,7 +9,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqlClientTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqlClientTests.cs index 7755b8e5a000..4dcb60b4cab7 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqlClientTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqlClientTests.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqliteTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqliteTests.cs index 8e2fc7078311..645691834acf 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqliteTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AdoNet/SystemDataSqliteTests.cs @@ -6,7 +6,6 @@ #if !NET452 using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AspNet/OwinWebApi2Tests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AspNet/OwinWebApi2Tests.cs index 4ee0f9110bd8..46497bb75c1d 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AspNet/OwinWebApi2Tests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AspNet/OwinWebApi2Tests.cs @@ -15,7 +15,6 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.TestHelpers; using VerifyXunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AspNetCore/AspNetCoreMvcTestBase.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AspNetCore/AspNetCoreMvcTestBase.cs index d79a896bf809..dca031867f4d 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/AspNetCore/AspNetCoreMvcTestBase.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/AspNetCore/AspNetCoreMvcTestBase.cs @@ -10,7 +10,6 @@ using System.Net.Http; using System.Threading; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/MsTestV2Tests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/MsTestV2Tests.cs index 24b94f3f04d8..79cad9561ff9 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/MsTestV2Tests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/MsTestV2Tests.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Ci; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/NUnitTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/NUnitTests.cs index 3f428cd2e726..a9902539d393 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/NUnitTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/NUnitTests.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Ci; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/XUnitTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/XUnitTests.cs index 3ab2cf6d9d1a..6e56291a3e68 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/XUnitTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CI/XUnitTests.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.Ci; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CallTargetNativeTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CallTargetNativeTests.cs index c2d9f9d1fcc9..54c0c82ea43c 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CallTargetNativeTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CallTargetNativeTests.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CosmosTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CosmosTests.cs index db8169dc5bd5..bd687f15f29d 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/CosmosTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/CosmosTests.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; -using Datadog.Core.Tools; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; using FluentAssertions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch5Tests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch5Tests.cs index fda9a037b2a6..5242b32e3500 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch5Tests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch5Tests.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch6Tests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch6Tests.cs index 90705aa41a3e..403c40837f37 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch6Tests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/Elasticsearch6Tests.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/GraphQLTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/GraphQLTests.cs index 8be077672c0d..0cfdaa92c8e7 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/GraphQLTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/GraphQLTests.cs @@ -10,7 +10,6 @@ using System.Linq; using System.Net; using System.Threading; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/Helpers/IisFixture.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/Helpers/IisFixture.cs index 4754b2950e24..7da11ce6338d 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/Helpers/IisFixture.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/Helpers/IisFixture.cs @@ -7,7 +7,6 @@ using System.Diagnostics; using System.IO; using System.Net; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; namespace Datadog.Trace.ClrProfiler.IntegrationTests diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/Helpers/TestHelper.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/Helpers/TestHelper.cs index 98a0daed4beb..85270cc75c31 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/Helpers/TestHelper.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/Helpers/TestHelper.cs @@ -14,7 +14,6 @@ using System.Net.NetworkInformation; using System.Threading; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/HttpMessageHandlerTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/HttpMessageHandlerTests.cs index aa004ef3ffaa..a6492ad0b661 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/HttpMessageHandlerTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/HttpMessageHandlerTests.cs @@ -8,7 +8,6 @@ using System.Globalization; using System.Linq; using System.Runtime.InteropServices; -using Datadog.Core.Tools; using Datadog.Trace.ClrProfiler.IntegrationTests.Helpers; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/KafkaTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/KafkaTests.cs index 1297472551dd..36766b10ed2e 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/KafkaTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/KafkaTests.cs @@ -7,7 +7,6 @@ using System.Collections.Immutable; using System.Linq; using System.Text.RegularExpressions; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using FluentAssertions; using FluentAssertions.Execution; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/LoadTests/AspNetCoreMvc21LoadTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/LoadTests/AspNetCoreMvc21LoadTests.cs index 803827828450..650233590eec 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/LoadTests/AspNetCoreMvc21LoadTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/LoadTests/AspNetCoreMvc21LoadTests.cs @@ -4,7 +4,6 @@ // using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/LoadTests/LoadTestBase.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/LoadTests/LoadTestBase.cs index 0bbfd25fbca7..bc15d0a2beed 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/LoadTests/LoadTestBase.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/LoadTests/LoadTestBase.cs @@ -9,7 +9,6 @@ using System.IO; using System.Linq; using System.Threading; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit.Abstractions; using Xunit.Sdk; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/MongoDbTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/MongoDbTests.cs index 07b4f4c31e34..b936d3f423b7 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/MongoDbTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/MongoDbTests.cs @@ -4,7 +4,6 @@ // using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/MsmqTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/MsmqTests.cs index a02bbe25efeb..52f8c5df4fc4 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/MsmqTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/MsmqTests.cs @@ -6,7 +6,6 @@ #if NETFRAMEWORK using System; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using FluentAssertions; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/MultiDomainHostTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/MultiDomainHostTests.cs index 7010223401f2..01fe205665f5 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/MultiDomainHostTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/MultiDomainHostTests.cs @@ -11,7 +11,6 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/NoMultiLoaderTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/NoMultiLoaderTests.cs index e6d29737f54e..29495b5e6c1b 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/NoMultiLoaderTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/NoMultiLoaderTests.cs @@ -6,7 +6,6 @@ using System.Globalization; using System.IO; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ClrProfiler.IntegrationTests.Helpers; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/RabbitMQTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/RabbitMQTests.cs index d620ac467ac6..4b7b0e18b07e 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/RabbitMQTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/RabbitMQTests.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; -using Datadog.Core.Tools; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/RuntimeMetricsTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/RuntimeMetricsTests.cs index 17f33c1fc168..cc12c049072d 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/RuntimeMetricsTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/RuntimeMetricsTests.cs @@ -5,7 +5,6 @@ using System; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/ServiceMappingTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/ServiceMappingTests.cs index 26a11c04278e..c7d5c5f4a497 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/ServiceMappingTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/ServiceMappingTests.cs @@ -3,7 +3,6 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. // -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/ServiceStackRedisTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/ServiceStackRedisTests.cs index 72e6d6386be8..b36c763510e7 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/ServiceStackRedisTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/ServiceStackRedisTests.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/SmokeTestBase.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/SmokeTestBase.cs index 5d7b051025ed..c75838458636 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/SmokeTestBase.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/SmokeTestBase.cs @@ -5,7 +5,6 @@ using System; using System.Diagnostics; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/StackExchangeRedisAssemblyConflictSdkProjectSmokeTest.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/StackExchangeRedisAssemblyConflictSdkProjectSmokeTest.cs index e95ba7d7a38e..e6a61ae65a09 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/StackExchangeRedisAssemblyConflictSdkProjectSmokeTest.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/StackExchangeRedisAssemblyConflictSdkProjectSmokeTest.cs @@ -3,8 +3,8 @@ // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc. // -using Datadog.Core.Tools; using Datadog.Trace.ClrProfiler.IntegrationTests.TestCollections; +using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/StackExchangeRedisStackOverflowExceptionSmokeTest.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/StackExchangeRedisStackOverflowExceptionSmokeTest.cs index 6a1a2831a1b0..e37d2b5d22ef 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/StackExchangeRedisStackOverflowExceptionSmokeTest.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/SmokeTests/StackExchangeRedisStackOverflowExceptionSmokeTest.cs @@ -4,8 +4,8 @@ // #if !NET452 -using Datadog.Core.Tools; using Datadog.Trace.ClrProfiler.IntegrationTests.TestCollections; +using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/StackExchangeRedisTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/StackExchangeRedisTests.cs index 58e0a9bf5738..28fa71e0bb11 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/StackExchangeRedisTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/StackExchangeRedisTests.cs @@ -6,7 +6,6 @@ using System; using System.Collections.Generic; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ClrProfiler.IntegrationTests.TestCollections; using Datadog.Trace.ExtensionMethods; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/WcfTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/WcfTests.cs index acfa32acb0b3..208098b4e67e 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/WcfTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/WcfTests.cs @@ -6,7 +6,6 @@ #if NET461 using System.Collections.Generic; -using Datadog.Core.Tools; using Datadog.Trace.TestHelpers; using Xunit; using Xunit.Abstractions; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/WebRequest20Tests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/WebRequest20Tests.cs index a2a61c9ef558..d961be61ae55 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/WebRequest20Tests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/WebRequest20Tests.cs @@ -6,7 +6,6 @@ #if NET452 using System.Globalization; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ClrProfiler.IntegrationTests.Helpers; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.ClrProfiler.IntegrationTests/WebRequestTests.cs b/test/Datadog.Trace.ClrProfiler.IntegrationTests/WebRequestTests.cs index 9e6599643dfb..fa25bc27677a 100644 --- a/test/Datadog.Trace.ClrProfiler.IntegrationTests/WebRequestTests.cs +++ b/test/Datadog.Trace.ClrProfiler.IntegrationTests/WebRequestTests.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.Linq; -using Datadog.Core.Tools; using Datadog.Trace.ClrProfiler.IntegrationTests.Helpers; using Datadog.Trace.TestHelpers; using Xunit; diff --git a/test/Datadog.Trace.IntegrationTests/ContainerTaggingTests.cs b/test/Datadog.Trace.IntegrationTests/ContainerTaggingTests.cs index 557132a08500..16ae57ba1406 100644 --- a/test/Datadog.Trace.IntegrationTests/ContainerTaggingTests.cs +++ b/test/Datadog.Trace.IntegrationTests/ContainerTaggingTests.cs @@ -5,7 +5,6 @@ using System; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.PlatformHelpers; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.IntegrationTests/DatadogHttpClientTests.cs b/test/Datadog.Trace.IntegrationTests/DatadogHttpClientTests.cs index 6850ffc69510..f48665e9f51e 100644 --- a/test/Datadog.Trace.IntegrationTests/DatadogHttpClientTests.cs +++ b/test/Datadog.Trace.IntegrationTests/DatadogHttpClientTests.cs @@ -6,7 +6,6 @@ using System; using System.Linq; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace.Agent; using Datadog.Trace.Configuration; using Datadog.Trace.TestHelpers; diff --git a/test/Datadog.Trace.TestHelpers/Datadog.Trace.TestHelpers.csproj b/test/Datadog.Trace.TestHelpers/Datadog.Trace.TestHelpers.csproj index 756c4cde137b..1f58192ccc41 100644 --- a/test/Datadog.Trace.TestHelpers/Datadog.Trace.TestHelpers.csproj +++ b/test/Datadog.Trace.TestHelpers/Datadog.Trace.TestHelpers.csproj @@ -8,11 +8,11 @@ - + diff --git a/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs b/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs index d10dcb8d7308..6650b60eef21 100644 --- a/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs +++ b/test/Datadog.Trace.TestHelpers/EnvironmentHelper.cs @@ -11,7 +11,6 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Runtime.Versioning; -using Datadog.Core.Tools; using Xunit.Abstractions; namespace Datadog.Trace.TestHelpers diff --git a/tools/Datadog.Core.Tools/EnvironmentTools.cs b/test/Datadog.Trace.TestHelpers/EnvironmentTools.cs similarity index 98% rename from tools/Datadog.Core.Tools/EnvironmentTools.cs rename to test/Datadog.Trace.TestHelpers/EnvironmentTools.cs index e58933e2f657..daaaf9bbc5f8 100644 --- a/tools/Datadog.Core.Tools/EnvironmentTools.cs +++ b/test/Datadog.Trace.TestHelpers/EnvironmentTools.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Runtime.InteropServices; -namespace Datadog.Core.Tools +namespace Datadog.Trace.TestHelpers { /// /// General use utility methods for all tests and tools. diff --git a/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs b/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs index b0811ef84e32..c1a36481bdfd 100644 --- a/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs +++ b/test/Datadog.Trace.TestHelpers/MockTracerAgent.cs @@ -14,7 +14,6 @@ using System.Net.Sockets; using System.Text; using System.Threading; -using Datadog.Core.Tools; using Datadog.Trace.ExtensionMethods; using MessagePack; diff --git a/tools/Datadog.Core.Tools/TcpPortProvider.cs b/test/Datadog.Trace.TestHelpers/TcpPortProvider.cs similarity index 97% rename from tools/Datadog.Core.Tools/TcpPortProvider.cs rename to test/Datadog.Trace.TestHelpers/TcpPortProvider.cs index d09c2505897d..57ea83f8aa84 100644 --- a/tools/Datadog.Core.Tools/TcpPortProvider.cs +++ b/test/Datadog.Trace.TestHelpers/TcpPortProvider.cs @@ -6,7 +6,7 @@ using System.Net; using System.Net.Sockets; -namespace Datadog.Core.Tools +namespace Datadog.Trace.TestHelpers { /// /// Helper class that tries to provide unique ports numbers across processes and threads in the same machine. diff --git a/test/Datadog.Trace.Tests/DogStatsDTests.cs b/test/Datadog.Trace.Tests/DogStatsDTests.cs index dbeac96d6ea1..c5f6293bc01d 100644 --- a/test/Datadog.Trace.Tests/DogStatsDTests.cs +++ b/test/Datadog.Trace.Tests/DogStatsDTests.cs @@ -7,7 +7,6 @@ using System.Collections.Immutable; using System.Linq; using System.Threading; -using Datadog.Core.Tools; using Datadog.Trace.Configuration; using Datadog.Trace.DogStatsd; using Datadog.Trace.TestHelpers; diff --git a/test/test-applications/integrations/Samples.HttpMessageHandler/Program.cs b/test/test-applications/integrations/Samples.HttpMessageHandler/Program.cs index 8dca34031697..fbb0d78b37ce 100644 --- a/test/test-applications/integrations/Samples.HttpMessageHandler/Program.cs +++ b/test/test-applications/integrations/Samples.HttpMessageHandler/Program.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Datadog.Core.Tools; +using Datadog.Trace.TestHelpers; namespace Samples.HttpMessageHandler { diff --git a/test/test-applications/integrations/Samples.HttpMessageHandler/Samples.HttpMessageHandler.csproj b/test/test-applications/integrations/Samples.HttpMessageHandler/Samples.HttpMessageHandler.csproj index 20559dcc4ed1..dfc514686120 100644 --- a/test/test-applications/integrations/Samples.HttpMessageHandler/Samples.HttpMessageHandler.csproj +++ b/test/test-applications/integrations/Samples.HttpMessageHandler/Samples.HttpMessageHandler.csproj @@ -5,15 +5,19 @@ - + + + + + diff --git a/test/test-applications/integrations/Samples.WebRequest.NetFramework20/Program.cs b/test/test-applications/integrations/Samples.WebRequest.NetFramework20/Program.cs index abf024b7d6bb..a109b8ad2eb2 100644 --- a/test/test-applications/integrations/Samples.WebRequest.NetFramework20/Program.cs +++ b/test/test-applications/integrations/Samples.WebRequest.NetFramework20/Program.cs @@ -4,8 +4,8 @@ using System.Net; using System.Text; using System.Threading; -using Datadog.Core.Tools; using Datadog.Trace; +using Datadog.Trace.TestHelpers; namespace Samples.WebRequest.NetFramework20 { diff --git a/test/test-applications/integrations/Samples.WebRequest.NetFramework20/Samples.WebRequest.NetFramework20.csproj b/test/test-applications/integrations/Samples.WebRequest.NetFramework20/Samples.WebRequest.NetFramework20.csproj index dcf25ddedb7e..0c322a3de76a 100644 --- a/test/test-applications/integrations/Samples.WebRequest.NetFramework20/Samples.WebRequest.NetFramework20.csproj +++ b/test/test-applications/integrations/Samples.WebRequest.NetFramework20/Samples.WebRequest.NetFramework20.csproj @@ -8,8 +8,11 @@ - + + + + diff --git a/test/test-applications/integrations/Samples.WebRequest/Program.cs b/test/test-applications/integrations/Samples.WebRequest/Program.cs index dc5278ad4ac8..8ccca815f3e2 100644 --- a/test/test-applications/integrations/Samples.WebRequest/Program.cs +++ b/test/test-applications/integrations/Samples.WebRequest/Program.cs @@ -5,8 +5,8 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace; +using Datadog.Trace.TestHelpers; namespace Samples.WebRequest { diff --git a/test/test-applications/integrations/Samples.WebRequest/Samples.WebRequest.csproj b/test/test-applications/integrations/Samples.WebRequest/Samples.WebRequest.csproj index 2b09b4a6c765..5c8acaa93fa4 100644 --- a/test/test-applications/integrations/Samples.WebRequest/Samples.WebRequest.csproj +++ b/test/test-applications/integrations/Samples.WebRequest/Samples.WebRequest.csproj @@ -5,7 +5,10 @@ - + + + + diff --git a/test/test-applications/regression/DuplicateTypeProxy/DuplicateTypeProxy.csproj b/test/test-applications/regression/DuplicateTypeProxy/DuplicateTypeProxy.csproj index 04f2450a821e..b261aa886202 100644 --- a/test/test-applications/regression/DuplicateTypeProxy/DuplicateTypeProxy.csproj +++ b/test/test-applications/regression/DuplicateTypeProxy/DuplicateTypeProxy.csproj @@ -9,7 +9,7 @@ - + \ No newline at end of file diff --git a/test/test-applications/regression/DuplicateTypeProxy/Program.cs b/test/test-applications/regression/DuplicateTypeProxy/Program.cs index 10869867f442..16f15d278aa8 100644 --- a/test/test-applications/regression/DuplicateTypeProxy/Program.cs +++ b/test/test-applications/regression/DuplicateTypeProxy/Program.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Datadog.Core.Tools; +using Datadog.Trace.TestHelpers; namespace DuplicateTypeProxy { diff --git a/test/test-applications/regression/LargePayload/LargePayload.csproj b/test/test-applications/regression/LargePayload/LargePayload.csproj index ba07e8517688..894c0414518b 100644 --- a/test/test-applications/regression/LargePayload/LargePayload.csproj +++ b/test/test-applications/regression/LargePayload/LargePayload.csproj @@ -6,7 +6,6 @@ - diff --git a/test/test-applications/regression/Sandbox.ManualTracing/Program.cs b/test/test-applications/regression/Sandbox.ManualTracing/Program.cs index 64a9f20f3693..78f532d268c8 100644 --- a/test/test-applications/regression/Sandbox.ManualTracing/Program.cs +++ b/test/test-applications/regression/Sandbox.ManualTracing/Program.cs @@ -9,7 +9,6 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using Datadog.Core.Tools; using Datadog.Trace; namespace Sandbox.ManualTracing diff --git a/test/test-applications/regression/Sandbox.ManualTracing/Sandbox.ManualTracing.csproj b/test/test-applications/regression/Sandbox.ManualTracing/Sandbox.ManualTracing.csproj index 740e0857f90e..65bdbe1cbe07 100644 --- a/test/test-applications/regression/Sandbox.ManualTracing/Sandbox.ManualTracing.csproj +++ b/test/test-applications/regression/Sandbox.ManualTracing/Sandbox.ManualTracing.csproj @@ -6,7 +6,6 @@ - diff --git a/tools/Datadog.Core.Tools/Datadog.Core.Tools.csproj b/tools/Datadog.Core.Tools/Datadog.Core.Tools.csproj deleted file mode 100644 index 446f684c889e..000000000000 --- a/tools/Datadog.Core.Tools/Datadog.Core.Tools.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - net452;net461;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1;net5.0 - - - - - - - - diff --git a/tools/Datadog.Core.Tools/Extensions/AssemblyExtensions.cs b/tools/Datadog.Core.Tools/Extensions/AssemblyExtensions.cs deleted file mode 100644 index 4a850d73181b..000000000000 --- a/tools/Datadog.Core.Tools/Extensions/AssemblyExtensions.cs +++ /dev/null @@ -1,48 +0,0 @@ -// -// 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. -// - -using System; -using System.Reflection; -using System.Runtime.Versioning; - -namespace Datadog.Core.Tools.Extensions -{ - public static class AssemblyExtensions - { - private const string DotNetFramework = ".NETFramework"; - private const string CoreFramework = ".NETCoreApp"; - - public static string GetTargetFrameworkMoniker(this Assembly assembly) - { - var targetFramework = assembly.GetCustomAttribute(); - var parts = targetFramework?.FrameworkName?.Split(','); - - if (parts?.Length > 1) - { - var runtime = parts[0]; - var versionParts = parts[1].Replace("Version=v", string.Empty).Split('.'); - - if (versionParts.Length > 1) - { - var major = int.Parse(versionParts[0]); - var minor = int.Parse(versionParts[1]); - - if (runtime.Equals(CoreFramework)) - { - return $"netcoreapp{major}.{minor}"; - } - - if (runtime.Equals(DotNetFramework)) - { - var patch = versionParts.Length > 2 ? versionParts[2] : null; - return $"net{major}{minor}{patch}"; - } - } - } - - return "unsupported"; - } - } -} diff --git a/tools/Directory.Build.props b/tools/Directory.Build.props deleted file mode 100644 index 0558820e785a..000000000000 --- a/tools/Directory.Build.props +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - false - - - - - - - diff --git a/tools/FeatureTracking/FeatureTracking.csproj b/tools/FeatureTracking/FeatureTracking.csproj deleted file mode 100644 index b5e2125059c4..000000000000 --- a/tools/FeatureTracking/FeatureTracking.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - Exe - netcoreapp3.1 - - - - - - - - - diff --git a/tools/FeatureTracking/Program.cs b/tools/FeatureTracking/Program.cs deleted file mode 100644 index d9aecb76a1f8..000000000000 --- a/tools/FeatureTracking/Program.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// 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. -// - -using System; -using System.Collections.Generic; -using System.Linq; -using Datadog.Trace.Ci; -using Datadog.Trace.Vendors.Newtonsoft.Json; - -namespace FeatureTracking -{ - internal class Program - { - private static void Main(string[] args) - { - if (args.Length == 0) - { - CIAppFeatureTracking(); - return; - } - - switch (args[0]) - { - case "ciapp": - CIAppFeatureTracking(); - break; - default: - break; - } - } - - private static IEnumerable GetFeatureTrackingValueFromType(params Type[] types) - { - return types - .SelectMany(type => type.GetFields()) - .Where(f => f.GetCustomAttributes(typeof(FeatureTrackingAttribute), true).Length > 0) - .Select(f => f.GetValue(null).ToString()) - .OrderBy(v => v); - } - - private static void CIAppFeatureTracking() - { - var values = GetFeatureTrackingValueFromType(typeof(CommonTags), typeof(TestTags)); - var json = JsonConvert.SerializeObject(values); - Console.WriteLine(json); - } - } -} diff --git a/tools/GlobalSuppressions.cs b/tools/GlobalSuppressions.cs deleted file mode 100644 index 4c20b0bf5c11..000000000000 --- a/tools/GlobalSuppressions.cs +++ /dev/null @@ -1,10 +0,0 @@ -// -// 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. -// - -using System.Diagnostics.CodeAnalysis; - -[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Reviewed.")] -[assembly: SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1652:EnableXmlDocumentationOutput", Justification = "Reviewed.")] -[assembly: SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1025:Code must not contain multiple whitespace in a row", Justification = "Reviewed. Used for pretty formatting.")] diff --git a/tools/StartDistributedTrace/Program.cs b/tools/StartDistributedTrace/Program.cs deleted file mode 100644 index 5d8d3bcf91e6..000000000000 --- a/tools/StartDistributedTrace/Program.cs +++ /dev/null @@ -1,59 +0,0 @@ -// -// 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. -// - -using System; -using System.Globalization; -using System.Net.Http; -using System.Threading.Tasks; -using Datadog.Trace; - -namespace StartDistributedTrace -{ - public class Program - { - public static async Task Main(string[] args) - { - if (args.Length == 0) - { - Console.WriteLine($"Usage: {nameof(StartDistributedTrace)} "); - return; - } - - string url = args[0]; - Console.WriteLine($"[HttpClient] sending request to {url}"); - - using (var scope = Tracer.Instance.StartActive("http.request")) - using (var client = new HttpClient()) - { - // Set basic span information for HTTP operations - var span = scope.Span; - span.Type = SpanTypes.Http; - span.SetTag(Tags.HttpMethod, "GET"); - span.SetTag(Tags.HttpUrl, url); - - // Set distributed tracing headers - client.DefaultRequestHeaders.Add(HttpHeaderNames.TraceId, span.TraceId.ToString(CultureInfo.InvariantCulture)); - client.DefaultRequestHeaders.Add(HttpHeaderNames.ParentId, span.SpanId.ToString(CultureInfo.InvariantCulture)); - client.DefaultRequestHeaders.Add("upstream-service", nameof(StartDistributedTrace)); - - // Send HTTP request - using (var responseMessage = await client.GetAsync(url)) - { - // read response content and headers - var responseContent = await responseMessage.Content.ReadAsStringAsync(); - - foreach (var header in responseMessage.Headers) - { - var name = header.Key; - var values = string.Join(",", header.Value); - Console.WriteLine($"[HttpClient] response header: {name}={values}"); - } - - Console.WriteLine($"[HttpClient] response content: {responseContent}"); - } - } - } - } -} diff --git a/tools/StartDistributedTrace/Properties/launchSettings.json b/tools/StartDistributedTrace/Properties/launchSettings.json deleted file mode 100644 index 8abf19560de8..000000000000 --- a/tools/StartDistributedTrace/Properties/launchSettings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "profiles": { - "StartDistributedTrace": { - "commandName": "Project", - "commandLineArgs": "http://localhost", - "environmentVariables": { - "DD_VERSION": "1.0.0" - }, - "nativeDebugging": true - } - } -} \ No newline at end of file diff --git a/tools/StartDistributedTrace/StartDistributedTrace.csproj b/tools/StartDistributedTrace/StartDistributedTrace.csproj deleted file mode 100644 index fdc6151cd04c..000000000000 --- a/tools/StartDistributedTrace/StartDistributedTrace.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - Exe - netcoreapp3.1 - - - - - - - diff --git a/tools/UpdateVendors/UpdateVendors.csproj b/tools/UpdateVendors/UpdateVendors.csproj deleted file mode 100644 index 922d8218ad69..000000000000 --- a/tools/UpdateVendors/UpdateVendors.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - Exe - net5.0 - - - - - - -