當前位置: 首頁>>代碼示例>>Python>>正文


Python gcp.CommonTemplates方法代碼示例

本文整理匯總了Python中synthtool.gcp.CommonTemplates方法的典型用法代碼示例。如果您正苦於以下問題:Python gcp.CommonTemplates方法的具體用法?Python gcp.CommonTemplates怎麽用?Python gcp.CommonTemplates使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在synthtool.gcp的用法示例。


在下文中一共展示了gcp.CommonTemplates方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: common_templates

# 需要導入模塊: from synthtool import gcp [as 別名]
# 或者: from synthtool.gcp import CommonTemplates [as 別名]
def common_templates(
    excludes: List[str] = [], template_path: Optional[Path] = None, **kwargs
) -> None:
    """Generate common templates for a Java Library

    Fetches information about the repository from the .repo-metadata.json file,
    information about the latest artifact versions and copies the files into
    their expected location.

    Args:
        excludes (List[str], optional): List of template paths to ignore
        **kwargs: Additional options for CommonTemplates.java_library()
    """
    metadata = {}  # type: Dict[str, Any]
    repo_metadata = common._load_repo_metadata()
    if repo_metadata:
        metadata["repo"] = repo_metadata
        group_id, artifact_id = repo_metadata["distribution_name"].split(":")

        metadata["latest_version"] = latest_maven_version(
            group_id=group_id, artifact_id=artifact_id
        )

    metadata["latest_bom_version"] = latest_maven_version(
        group_id="com.google.cloud", artifact_id="libraries-bom",
    )

    metadata["samples"] = samples.all_samples(["samples/**/src/main/java/**/*.java"])
    metadata["snippets"] = snippets.all_snippets(
        ["samples/**/src/main/java/**/*.java", "samples/**/pom.xml"]
    )
    if repo_metadata and "min_java_version" in repo_metadata:
        metadata["min_java_version"] = repo_metadata["min_java_version"]
    else:
        metadata["min_java_version"] = DEFAULT_MIN_SUPPORTED_JAVA_VERSION

    kwargs["metadata"] = metadata
    templates = gcp.CommonTemplates(template_path=template_path).java_library(**kwargs)
    s.copy([templates], excludes=excludes, merge=_merge_common_templates) 
開發者ID:googleapis,項目名稱:synthtool,代碼行數:41,代碼來源:java.py


注:本文中的synthtool.gcp.CommonTemplates方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。