From e9ef1d28970692cb142c776b4cfefe470a72964a Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Thu, 16 May 2024 17:24:34 +0000 Subject: [PATCH 1/2] feat: [java] allow passing libraries_bom_version from env --- synthtool/languages/java.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/synthtool/languages/java.py b/synthtool/languages/java.py index 55556c35e..2d52cea07 100644 --- a/synthtool/languages/java.py +++ b/synthtool/languages/java.py @@ -64,6 +64,7 @@ DEFAULT_MIN_SUPPORTED_JAVA_VERSION = 8 METADATA = "metadata" LIBRARIES_BOM_VERSION = "libraries_bom_version" +LIBRARIES_BOM_VERSION_ENV_KEY = "SYNTHTOOL_LIBRARIES_BOM_VERSION" def format_code( @@ -501,8 +502,8 @@ def common_templates( split_repo = not monorepo repo_metadata = metadata["repo"] repo_short = repo_metadata["repo_short"] - if LIBRARIES_BOM_VERSION in kwargs: - kwargs[METADATA][LIBRARIES_BOM_VERSION] = kwargs.get(LIBRARIES_BOM_VERSION) + if os.getenv(LIBRARIES_BOM_VERSION_ENV_KEY, default = None) is not None: + kwargs[METADATA][LIBRARIES_BOM_VERSION] = os.getenv(LIBRARIES_BOM_VERSION_ENV_KEY) # Special libraries that are not GAPIC_AUTO but in the monorepo special_libs_in_monorepo = [ "java-translate", From a2c9b4a5da2d7f583c8a1869fd2843c206145834 Mon Sep 17 00:00:00 2001 From: diegomarquezp Date: Thu, 16 May 2024 18:51:55 +0000 Subject: [PATCH 2/2] reformat --- synthtool/languages/java.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/synthtool/languages/java.py b/synthtool/languages/java.py index 2d52cea07..93eaead61 100644 --- a/synthtool/languages/java.py +++ b/synthtool/languages/java.py @@ -502,8 +502,10 @@ def common_templates( split_repo = not monorepo repo_metadata = metadata["repo"] repo_short = repo_metadata["repo_short"] - if os.getenv(LIBRARIES_BOM_VERSION_ENV_KEY, default = None) is not None: - kwargs[METADATA][LIBRARIES_BOM_VERSION] = os.getenv(LIBRARIES_BOM_VERSION_ENV_KEY) + if os.getenv(LIBRARIES_BOM_VERSION_ENV_KEY, default=None) is not None: + kwargs[METADATA][LIBRARIES_BOM_VERSION] = os.getenv( + LIBRARIES_BOM_VERSION_ENV_KEY + ) # Special libraries that are not GAPIC_AUTO but in the monorepo special_libs_in_monorepo = [ "java-translate",