From 2b9a505ff04208013b1867dee16ca9704b6ef677 Mon Sep 17 00:00:00 2001 From: colin-higgins Date: Tue, 28 Jan 2020 09:51:11 -0500 Subject: [PATCH 1/2] Simplify release process --- Datadog.Trace.sln | 60 +++++------------- tools/Datadog.Core.Tools/DependencyHelpers.cs | 62 +++++++++++++++++++ .../GenerateIntegrationDefinitions.csproj | 16 ----- .../Properties/launchSettings.json | 8 --- .../GenerateIntegrationDefinitions.cs} | 13 ++-- .../PrepareRelease.csproj} | 1 + tools/PrepareRelease/Program.cs | 41 ++++++++++++ .../SetAllVersions.cs} | 21 ++++++- .../SyncMsiContent.cs} | 31 +++------- .../SynchronizeVersions.csproj | 12 ---- 10 files changed, 151 insertions(+), 114 deletions(-) create mode 100644 tools/Datadog.Core.Tools/DependencyHelpers.cs delete mode 100644 tools/GenerateIntegrationDefinitions/GenerateIntegrationDefinitions.csproj delete mode 100644 tools/GenerateIntegrationDefinitions/Properties/launchSettings.json rename tools/{GenerateIntegrationDefinitions/Program.cs => PrepareRelease/GenerateIntegrationDefinitions.cs} (96%) rename tools/{SynchronizeInstaller/SynchronizeInstaller.csproj => PrepareRelease/PrepareRelease.csproj} (71%) create mode 100644 tools/PrepareRelease/Program.cs rename tools/{SynchronizeVersions/Program.cs => PrepareRelease/SetAllVersions.cs} (86%) rename tools/{SynchronizeInstaller/Program.cs => PrepareRelease/SyncMsiContent.cs} (82%) delete mode 100644 tools/SynchronizeVersions/SynchronizeVersions.csproj diff --git a/Datadog.Trace.sln b/Datadog.Trace.sln index ed4b5afc16db..efdd22a4dbb8 100644 --- a/Datadog.Trace.sln +++ b/Datadog.Trace.sln @@ -133,8 +133,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{5D8E1F81 tools\GlobalSuppressions.cs = tools\GlobalSuppressions.cs EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GenerateIntegrationDefinitions", "tools\GenerateIntegrationDefinitions\GenerateIntegrationDefinitions.csproj", "{5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}" -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", "samples\Samples.MongoDB\Samples.MongoDB.csproj", "{3493346B-44F6-4F50-8FB4-51D0090DF544}" @@ -244,8 +242,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".azure-pipelines", ".azure- .azure-pipelines\unit-tests.yml = .azure-pipelines\unit-tests.yml EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SynchronizeVersions", "tools\SynchronizeVersions\SynchronizeVersions.csproj", "{7F0BD409-FA74-4FB1-853F-D10D888E1542}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.MySql", "samples\Samples.MySql\Samples.MySql.csproj", "{42FA33DD-AEA3-4FF3-8319-F30244A666A4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TraceContext.InvalidOperationException", "reproductions\TraceContext.InvalidOperationException\TraceContext.InvalidOperationException.csproj", "{DF923186-5397-4E15-A95B-F15C8327ED53}" @@ -260,8 +256,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.DatabaseHelper", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UpdateVendors", "tools\UpdateVendors\UpdateVendors.csproj", "{72FB583A-A1B0-4B5F-8658-617B100DCD8E}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SynchronizeInstaller", "tools\SynchronizeInstaller\SynchronizeInstaller.csproj", "{EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Log4Net.SerializationException", "reproductions\Log4Net.SerializationException\Log4Net.SerializationException.csproj", "{35F581E9-3D7C-4E80-8DFF-D437B0D86710}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ApplicationWithLog4Net", "reproduction-dependencies\ApplicationWithLog4Net\ApplicationWithLog4Net.csproj", "{1C34D970-6081-4EFA-8F2F-5AD2B146AC58}" @@ -293,6 +287,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.AspNetCoreMvc21", " EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog10LogsInjection.NullReferenceException", "reproductions\NLog10LogsInjection.NullReferenceException\NLog10LogsInjection.NullReferenceException.csproj", "{6209C19B-42E4-4FCF-A539-FD1E4F4A34DB}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrepareRelease", "tools\PrepareRelease\PrepareRelease.csproj", "{DAA6B000-5BED-4081-B5E0-B698BFB89415}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -513,18 +509,6 @@ Global {6D86109F-B7C9-477D-86D7-45735A3A0818}.Release|x64.Build.0 = Release|x64 {6D86109F-B7C9-477D-86D7-45735A3A0818}.Release|x86.ActiveCfg = Release|x86 {6D86109F-B7C9-477D-86D7-45735A3A0818}.Release|x86.Build.0 = Release|x86 - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|x64.ActiveCfg = Debug|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|x64.Build.0 = Debug|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|x86.ActiveCfg = Debug|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Debug|x86.Build.0 = Debug|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|Any CPU.Build.0 = Release|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|x64.ActiveCfg = Release|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|x64.Build.0 = Release|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|x86.ActiveCfg = Release|Any CPU - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3}.Release|x86.Build.0 = Release|Any CPU {5B52C0C0-A554-4E53-9D17-B121E78FF919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5B52C0C0-A554-4E53-9D17-B121E78FF919}.Debug|Any CPU.Build.0 = Debug|Any CPU {5B52C0C0-A554-4E53-9D17-B121E78FF919}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -779,18 +763,6 @@ Global {1A5E9F40-F3A5-4B59-9898-3DCD65C459C3}.Release|x64.Build.0 = Release|x64 {1A5E9F40-F3A5-4B59-9898-3DCD65C459C3}.Release|x86.ActiveCfg = Release|x86 {1A5E9F40-F3A5-4B59-9898-3DCD65C459C3}.Release|x86.Build.0 = Release|x86 - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Debug|x64.ActiveCfg = Debug|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Debug|x64.Build.0 = Debug|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Debug|x86.ActiveCfg = Debug|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Debug|x86.Build.0 = Debug|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Release|Any CPU.Build.0 = Release|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Release|x64.ActiveCfg = Release|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Release|x64.Build.0 = Release|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Release|x86.ActiveCfg = Release|Any CPU - {7F0BD409-FA74-4FB1-853F-D10D888E1542}.Release|x86.Build.0 = Release|Any CPU {42FA33DD-AEA3-4FF3-8319-F30244A666A4}.Debug|Any CPU.ActiveCfg = Debug|x86 {42FA33DD-AEA3-4FF3-8319-F30244A666A4}.Debug|x64.ActiveCfg = Debug|x64 {42FA33DD-AEA3-4FF3-8319-F30244A666A4}.Debug|x64.Build.0 = Debug|x64 @@ -867,18 +839,6 @@ Global {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 - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Debug|x64.ActiveCfg = Debug|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Debug|x64.Build.0 = Debug|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Debug|x86.ActiveCfg = Debug|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Debug|x86.Build.0 = Debug|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Release|Any CPU.Build.0 = Release|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Release|x64.ActiveCfg = Release|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Release|x64.Build.0 = Release|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.Release|x86.ActiveCfg = Release|Any CPU - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63}.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 @@ -1015,6 +975,18 @@ 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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1039,7 +1011,6 @@ Global {086FF8A0-9CEE-470A-9751-78B0F1340649} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE} {C98950B1-DC4B-43DA-974F-EF2CF325EC2B} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE} {6D86109F-B7C9-477D-86D7-45735A3A0818} = {65DF5743-B7B5-4BC8-8AB5-9DE596AF3FB8} - {5B844A49-CA3C-42CB-AD31-E44CD73FD1A3} = {5D8E1F81-B820-4736-B797-271B0FE787EE} {5B52C0C0-A554-4E53-9D17-B121E78FF919} = {8CEC2042-F11C-49F5-A674-2355793B600A} {3493346B-44F6-4F50-8FB4-51D0090DF544} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE} {DD3E8ED8-A0E4-482E-A5ED-115E21D543C0} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE} @@ -1066,7 +1037,6 @@ Global {1A5E9F40-F3A5-4B59-9898-3DCD65C459C3} = {550AE553-2BBB-4021-B55A-137EF31A6B1F} {6ABAD006-E206-488E-ACA1-1AA73F9B5146} = {FEBCE7DC-9FD1-48A6-B911-71ABB240A030} {C52D6695-4E05-4930-88F8-0EFF8056A967} = {FEBCE7DC-9FD1-48A6-B911-71ABB240A030} - {7F0BD409-FA74-4FB1-853F-D10D888E1542} = {5D8E1F81-B820-4736-B797-271B0FE787EE} {42FA33DD-AEA3-4FF3-8319-F30244A666A4} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE} {DF923186-5397-4E15-A95B-F15C8327ED53} = {550AE553-2BBB-4021-B55A-137EF31A6B1F} {E1706893-D3A5-43B9-9036-AEF49DB9600B} = {550AE553-2BBB-4021-B55A-137EF31A6B1F} @@ -1074,7 +1044,6 @@ Global {48283691-0D4B-4ABD-B75B-EDFC682E1547} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE} {472DBA92-4FEA-4B9A-BA70-0E97B942E12D} = {FA03944C-2391-4C25-8979-2E078A8CE0DD} {72FB583A-A1B0-4B5F-8658-617B100DCD8E} = {5D8E1F81-B820-4736-B797-271B0FE787EE} - {EBDDF6D7-59B8-4831-80C6-458C1ABBFC63} = {5D8E1F81-B820-4736-B797-271B0FE787EE} {35F581E9-3D7C-4E80-8DFF-D437B0D86710} = {550AE553-2BBB-4021-B55A-137EF31A6B1F} {1C34D970-6081-4EFA-8F2F-5AD2B146AC58} = {641C9C61-53FD-4504-B8D9-84008BDB89D1} {3BEACB10-89FE-4F74-8022-1A52F223CE82} = {5D8E1F81-B820-4736-B797-271B0FE787EE} @@ -1088,6 +1057,7 @@ Global {303F8E41-691F-4453-AB7D-88A0036C0465} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE} {D141BD06-DD95-4CAF-85CD-657116E0DAD4} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE} {6209C19B-42E4-4FCF-A539-FD1E4F4A34DB} = {550AE553-2BBB-4021-B55A-137EF31A6B1F} + {DAA6B000-5BED-4081-B5E0-B698BFB89415} = {5D8E1F81-B820-4736-B797-271B0FE787EE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F} diff --git a/tools/Datadog.Core.Tools/DependencyHelpers.cs b/tools/Datadog.Core.Tools/DependencyHelpers.cs new file mode 100644 index 000000000000..48120c3f6a2e --- /dev/null +++ b/tools/Datadog.Core.Tools/DependencyHelpers.cs @@ -0,0 +1,62 @@ +using System; +using System.IO; +using Datadog.Core.Tools; + +namespace PrepareRelease.Tools +{ + public static class DependencyHelpers + { + private const string RequiredBuildConfig = "Release"; + + public static string[] GetTracerReleaseBinContent(string frameworkMoniker, string extension = "dll") + { + var solutionDirectory = EnvironmentTools.GetSolutionDirectory(); + var projectBin = + Path.Combine( + solutionDirectory, + "src", + "Datadog.Trace.ClrProfiler.Managed", + "bin", + RequiredBuildConfig); + + var outputFolder = Path.Combine(projectBin, frameworkMoniker); + + var filePaths = Directory.GetFiles( + outputFolder, + $"*.{extension}", + SearchOption.AllDirectories); + + if (filePaths.Length == 0) + { + throw new Exception("Be sure to build in release mode before running this tool."); + } + + return filePaths; + } + + public static string[] GetProfilerReleaseBinContent(string architecture, string extension = "dll") + { + var solutionDirectory = EnvironmentTools.GetSolutionDirectory(); + var outputFolder = + Path.Combine( + solutionDirectory, + "src", + "Datadog.Trace.ClrProfiler.Native", + "bin", + RequiredBuildConfig, + architecture); + + var filePaths = Directory.GetFiles( + outputFolder, + $"*.{extension}", + SearchOption.AllDirectories); + + if (filePaths.Length == 0) + { + throw new Exception("Be sure to build in release mode before running this tool."); + } + + return filePaths; + } + } +} diff --git a/tools/GenerateIntegrationDefinitions/GenerateIntegrationDefinitions.csproj b/tools/GenerateIntegrationDefinitions/GenerateIntegrationDefinitions.csproj deleted file mode 100644 index 9c379ff10112..000000000000 --- a/tools/GenerateIntegrationDefinitions/GenerateIntegrationDefinitions.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - Exe - net472 - - - - - - - - - - - diff --git a/tools/GenerateIntegrationDefinitions/Properties/launchSettings.json b/tools/GenerateIntegrationDefinitions/Properties/launchSettings.json deleted file mode 100644 index 2486ac3cdf69..000000000000 --- a/tools/GenerateIntegrationDefinitions/Properties/launchSettings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "profiles": { - "GenerateIntegrationDefinitions": { - "commandName": "Project", - "commandLineArgs": "\"$(SolutionDir)integrations.json\"" - } - } -} \ No newline at end of file diff --git a/tools/GenerateIntegrationDefinitions/Program.cs b/tools/PrepareRelease/GenerateIntegrationDefinitions.cs similarity index 96% rename from tools/GenerateIntegrationDefinitions/Program.cs rename to tools/PrepareRelease/GenerateIntegrationDefinitions.cs index 0f9d7eaee58a..b1dcaf45aa68 100644 --- a/tools/GenerateIntegrationDefinitions/Program.cs +++ b/tools/PrepareRelease/GenerateIntegrationDefinitions.cs @@ -7,12 +7,14 @@ using Datadog.Trace.ClrProfiler; using Newtonsoft.Json; -namespace GenerateIntegrationDefinitions +namespace PrepareRelease { - public static class Program + public static class GenerateIntegrationDefinitions { - public static void Main(string[] args) + public static void Run() { + Console.WriteLine("Updating the integrations definitions"); + var integrationsAssembly = typeof(Instrumentation).Assembly; // find all methods in Datadog.Trace.ClrProfiler.Managed.dll with [InterceptMethod] @@ -79,11 +81,6 @@ from targetAssembly in item.attribute.TargetAssemblies string filename = "integrations.json"; - if (args.Length > 0 && !string.IsNullOrWhiteSpace(args[0])) - { - filename = args[0]; - } - var utf8NoBom = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false); File.WriteAllText(filename, json, utf8NoBom); } diff --git a/tools/SynchronizeInstaller/SynchronizeInstaller.csproj b/tools/PrepareRelease/PrepareRelease.csproj similarity index 71% rename from tools/SynchronizeInstaller/SynchronizeInstaller.csproj rename to tools/PrepareRelease/PrepareRelease.csproj index 07a4184fc992..6c412c3f5257 100644 --- a/tools/SynchronizeInstaller/SynchronizeInstaller.csproj +++ b/tools/PrepareRelease/PrepareRelease.csproj @@ -6,6 +6,7 @@ + diff --git a/tools/PrepareRelease/Program.cs b/tools/PrepareRelease/Program.cs new file mode 100644 index 000000000000..805fed4c85d5 --- /dev/null +++ b/tools/PrepareRelease/Program.cs @@ -0,0 +1,41 @@ +using System; +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 (JobShouldRun(Integrations, args)) + { + Console.WriteLine("--------------- Integrations Job Started ---------------"); + GenerateIntegrationDefinitions.Run(); + Console.WriteLine("--------------- Integrations Job Complete ---------------"); + } + + if (JobShouldRun(Versions, args)) + { + Console.WriteLine("--------------- Versions Job Started ---------------"); + SetAllVersions.Run(); + Console.WriteLine("--------------- Versions Job Complete ---------------"); + } + + if (JobShouldRun(Msi, args)) + { + Console.WriteLine("--------------- MSI Job Started ---------------"); + SyncMsiContent.Run(); + Console.WriteLine("--------------- MSI Job Complete ---------------"); + } + } + + private static bool JobShouldRun(string jobName, string[] args) + { + return args.Length == 0 || args.Any(a => string.Equals(a, jobName, StringComparison.OrdinalIgnoreCase)); + } + } +} diff --git a/tools/SynchronizeVersions/Program.cs b/tools/PrepareRelease/SetAllVersions.cs similarity index 86% rename from tools/SynchronizeVersions/Program.cs rename to tools/PrepareRelease/SetAllVersions.cs index c1f87f93b1d3..a6547fdc7f3a 100644 --- a/tools/SynchronizeVersions/Program.cs +++ b/tools/PrepareRelease/SetAllVersions.cs @@ -4,11 +4,11 @@ using System.Text.RegularExpressions; using Datadog.Core.Tools; -namespace SynchronizeVersions +namespace PrepareRelease { - public class Program + public static class SetAllVersions { - public static void Main(string[] args) + public static void Run() { Console.WriteLine($"Updating version instances to {VersionString()}"); @@ -73,9 +73,19 @@ public static void Main(string[] args) "deploy/Datadog.Trace.ClrProfiler.WindowsInstaller/Datadog.Trace.ClrProfiler.WindowsInstaller.wixproj", WixProjReplace); + // SynchronizeVersion("deploy/AzureAppServices/Datadog.Trace.AzureAppServices.nuspec", NuspecVersionReplace); + // SynchronizeVersion("deploy/AzureAppServices/content/applicationHost.xdt", AzureAppServicesReplace); + // SynchronizeVersion("deploy/AzureAppServices/content/install.cmd", AzureAppServicesReplace); + // SynchronizeVersion("deploy/AzureAppServices/content/Agent/datadog.yaml", AzureAppServicesReplace); + Console.WriteLine($"Completed synchronizing versions to {VersionString()}"); } + private static string AzureAppServicesReplace(string text) + { + return Regex.Replace(text, VersionPattern("_"), VersionString("_"), RegexOptions.Singleline); + } + private static string FullVersionReplace(string text, string split) { return Regex.Replace(text, VersionPattern(split), VersionString(split), RegexOptions.Singleline); @@ -96,6 +106,11 @@ private static string NugetVersionReplace(string text) return Regex.Replace(text, $"{VersionPattern(withPrereleasePostfix: true)}", $"{VersionString(withPrereleasePostfix: true)}", RegexOptions.Singleline); } + private static string NuspecVersionReplace(string text) + { + return Regex.Replace(text, $"{VersionPattern(withPrereleasePostfix: true)}", $"{VersionString(withPrereleasePostfix: true)}", RegexOptions.Singleline); + } + private static string WixProjReplace(string text) { text = Regex.Replace( diff --git a/tools/SynchronizeInstaller/Program.cs b/tools/PrepareRelease/SyncMsiContent.cs similarity index 82% rename from tools/SynchronizeInstaller/Program.cs rename to tools/PrepareRelease/SyncMsiContent.cs index 86043a62c680..538c01c22bf6 100644 --- a/tools/SynchronizeInstaller/Program.cs +++ b/tools/PrepareRelease/SyncMsiContent.cs @@ -2,10 +2,11 @@ using System.IO; using System.Text; using Datadog.Trace.TestHelpers; +using PrepareRelease.Tools; -namespace SynchronizeInstaller +namespace PrepareRelease { - public class Program + public class SyncMsiContent { private const string FileNameTemplate = @"{{file_name}}"; private const string ComponentListTemplate = @"{{component_list}}"; @@ -33,7 +34,7 @@ public class Program "; - public static void Main(string[] args) + public static void Run() { CreateWixFile( groupId: "Files.Managed.Net45.GAC", @@ -59,18 +60,12 @@ private static void CreateWixFile( string filePrefix = null, bool isGac = false) { + Console.WriteLine($"Creating the {groupId} Group"); + groupDirectory = groupDirectory ?? $"{frameworkMoniker}"; filePrefix = filePrefix ?? $"{frameworkMoniker.Replace(".", string.Empty)}_"; var solutionDirectory = EnvironmentHelper.GetSolutionDirectory(); - var requiredBuildConfig = "Release"; - var managedProjectBin = - Path.Combine( - solutionDirectory, - "src", - "Datadog.Trace.ClrProfiler.Managed", - "bin", - requiredBuildConfig); var wixProjectRoot = Path.Combine( @@ -78,17 +73,7 @@ private static void CreateWixFile( "deploy", "Datadog.Trace.ClrProfiler.WindowsInstaller"); - var outputFolder = Path.Combine(managedProjectBin, frameworkMoniker); - - var filePaths = Directory.GetFiles( - outputFolder, - "*.dll", - SearchOption.AllDirectories); - - if (filePaths.Length == 0) - { - throw new Exception("Be sure to build in release mode before running this tool."); - } + var filePaths = DependencyHelpers.GetTracerReleaseBinContent(frameworkMoniker); var components = string.Empty; @@ -118,6 +103,8 @@ private static void CreateWixFile( var wixFilePath = Path.Combine(wixProjectRoot, groupId + ".wxs"); File.WriteAllText(wixFilePath, wixFileContent, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); + + Console.WriteLine($"{groupId} Group successfully created."); } } } diff --git a/tools/SynchronizeVersions/SynchronizeVersions.csproj b/tools/SynchronizeVersions/SynchronizeVersions.csproj deleted file mode 100644 index 5db17ceb002d..000000000000 --- a/tools/SynchronizeVersions/SynchronizeVersions.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - Exe - netcoreapp3.0 - - - - - - - From 0870c3c4476e9c7df1798384116abfa83bf56111 Mon Sep 17 00:00:00 2001 From: colin-higgins Date: Tue, 28 Jan 2020 10:33:24 -0500 Subject: [PATCH 2/2] Remove unused lines --- tools/PrepareRelease/SetAllVersions.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/PrepareRelease/SetAllVersions.cs b/tools/PrepareRelease/SetAllVersions.cs index a6547fdc7f3a..fb6fd9233ddb 100644 --- a/tools/PrepareRelease/SetAllVersions.cs +++ b/tools/PrepareRelease/SetAllVersions.cs @@ -73,11 +73,6 @@ public static void Run() "deploy/Datadog.Trace.ClrProfiler.WindowsInstaller/Datadog.Trace.ClrProfiler.WindowsInstaller.wixproj", WixProjReplace); - // SynchronizeVersion("deploy/AzureAppServices/Datadog.Trace.AzureAppServices.nuspec", NuspecVersionReplace); - // SynchronizeVersion("deploy/AzureAppServices/content/applicationHost.xdt", AzureAppServicesReplace); - // SynchronizeVersion("deploy/AzureAppServices/content/install.cmd", AzureAppServicesReplace); - // SynchronizeVersion("deploy/AzureAppServices/content/Agent/datadog.yaml", AzureAppServicesReplace); - Console.WriteLine($"Completed synchronizing versions to {VersionString()}"); }