diff --git a/synthtool/gcp/common.py b/synthtool/gcp/common.py index 3b7ea16ad..74aee51e4 100644 --- a/synthtool/gcp/common.py +++ b/synthtool/gcp/common.py @@ -56,14 +56,16 @@ def _generic_library( partial_files: List[str] = None, **kwargs, ) -> Path: + # load default values that used to render templates. defaults_path = self._template_root / directory / "defaults" - kwargs["metadata"]["defaults"] = {} - for default_file in defaults_path.glob("*-default.yaml"): - self.excludes.append("defaults/{}".format(os.path.basename(default_file))) - with open(default_file) as f: - kwargs["metadata"]["defaults"].update( - yaml.load(f, Loader=yaml.SafeLoader) - ) + if defaults_path.exists(): + kwargs["metadata"]["defaults"] = {} + for default_file in defaults_path.glob("*-default.yaml"): + self.excludes.append("defaults/{}".format(os.path.basename(default_file))) + with open(default_file) as f: + kwargs["metadata"]["defaults"].update( + yaml.load(f, Loader=yaml.SafeLoader) + ) # load common repo meta information (metadata that's not language # specific). if "metadata" in kwargs: diff --git a/synthtool/languages/java.py b/synthtool/languages/java.py index cd829bfdc..468c831da 100644 --- a/synthtool/languages/java.py +++ b/synthtool/languages/java.py @@ -486,7 +486,8 @@ def common_templates( Args: :param excludes: List of template paths to ignore :param template_path: - :param partial_files: + :param partial_files: List of partial files to save customizations on + templates :param kwargs: Additional options for CommonTemplates.java_library() """