From 474046ef4bd2f14e5d5781325efa6335de552dc8 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Tue, 17 Dec 2024 12:52:14 +0000 Subject: [PATCH] fix: Set environment variables used by pre/postgeneration scripts These were removed when refactoring GenerateApisCommand, as that no longer picks the values up from the environment when provided with a root layout - but we still want to be able to refer to them from the scripts. --- .../ContainerCommands/GenerateCommand.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/Google.Cloud.Tools.ReleaseManager/ContainerCommands/GenerateCommand.cs b/tools/Google.Cloud.Tools.ReleaseManager/ContainerCommands/GenerateCommand.cs index e62afbe73b78..66ae4435a03e 100644 --- a/tools/Google.Cloud.Tools.ReleaseManager/ContainerCommands/GenerateCommand.cs +++ b/tools/Google.Cloud.Tools.ReleaseManager/ContainerCommands/GenerateCommand.cs @@ -56,6 +56,11 @@ public int Execute(Dictionary options) } else { + // Set environment variables used by scripts invoked by GenerateApisCommand. + Environment.SetEnvironmentVariable(GenerateApisCommand.GeneratorInputDirectoryEnvironmentVariable, rootLayout.GeneratorInput); + Environment.SetEnvironmentVariable(GenerateApisCommand.GeneratorOutputDirectoryEnvironmentVariable, rootLayout.GeneratorOutput); + Environment.SetEnvironmentVariable(GenerateApisCommand.GoogleApisDirectoryEnvironmentVariable, rootLayout.Googleapis); + if (apiPath is not null) { var catalog = ApiCatalog.Load(rootLayout);