maven/internal/maven_repository.bzl
def _get_artifact_sha1(rtx, artifact):
    """Fetch and read the expected sha1 value for an artifact.
    Args:
      rtx: !repository_ctx
      artifact: !dict<string,string>
    Returns: string
    """

    # Prepare the path.  TODO: is this repeatable across multiple
    # maven repositories?
    group = artifact["group"].replace(".", "/")
    name = artifact["name"]
    version = artifact["version"]
    ws_name = artifact["ws_name"]
    output_file = ws_name + ".jar.sha1"

    # Default url is maven central
    url = _get_repository_url(rtx.attr.repositories, artifact) or "https://repo1.maven.org/maven2"

    # TODO: make this configurable.
    path = "{url}/{group}/{name}/{version}/{name}-{version}.jar.sha1".format(
        url = url,
        group = group,
        name = name,
        version = version,
    )

    # Download the file - I guess bazel just bails on exception here,
    # can't catch it.
    rtx.download(path, output_file)

    # Print the contents of the file and store it in the 'sha1'
    # fields.
    result = rtx.execute(["cat", output_file])
    if result.return_code:
        fail("Unable to cat sha1 value at %s" % output_file)
    sha1 = result.stdout.strip()
    # Some files have this form:
    # 6975da39a7040257bd51d21a231b76c915872d38  /home/maven/repository-staging/to-ibiblio/maven2/javax/inject/javax.inject/1/javax.inject-1.jar
    if len(sha1) > 40:
        # Some files have the form
        sha1 = sha1.split(" ")[0]
    return sha1
Fetch and read the expected sha1 value for an artifact.
    Args:
      rtx: !repository_ctx
      artifact: !dict<string,string>
    Returns: string
    
Fetch and read the expected sha1 value for an artifact.
Fetch and read the expected sha1 value for an artifact .
def _get_artifact_sha1(rtx, artifact):
    group = artifact["group"].replace(".", "/")
    name = artifact["name"]
    version = artifact["version"]
    ws_name = artifact["ws_name"]
    output_file = ws_name + ".jar.sha1"
    url = _get_repository_url(rtx.attr.repositories, artifact) or "https://repo1.maven.org/maven2"
    path = "{url}/{group}/{name}/{version}/{name}-{version}.jar.sha1".format(
        url = url,
        group = group,
        name = name,
        version = version,
    )
    rtx.download(path, output_file)
    result = rtx.execute(["cat", output_file])
    if result.return_code:
        fail("Unable to cat sha1 value at %s" % output_file)
    sha1 = result.stdout.strip()
    if len(sha1) > 40:
        sha1 = sha1.split(" ")[0]
    return sha1
def _get_artifact_sha1 ( rtx , artifact ) : group = artifact [ "group" ] . replace ( "." , "/" ) name = artifact [ "name" ] version = artifact [ "version" ] ws_name = artifact [ "ws_name" ] output_file = ws_name + ".jar.sha1" url = _get_repository_url ( rtx . attr . repositories , artifact ) or "https://repo1.maven.org/maven2" path = "{url}/{group}/{name}/{version}/{name}-{version}.jar.sha1" . format ( url = url , group = group , name = name , version = version , ) rtx . download ( path , output_file ) result = rtx . execute ( [ "cat" , output_file ] ) if result . return_code : fail ( "Unable to cat sha1 value at %s" % output_file ) sha1 = result . stdout . strip ( ) if len ( sha1 ) > 40 : sha1 = sha1 . split ( " " ) [ 0 ] return sha1
Fetch and read the expected sha1 value for an artifact.
Fetch and read the expected sha1 value for an artifact .
"""Fetch and read the expected sha1 value for an artifact.
    Args:
      rtx: !repository_ctx
      artifact: !dict<string,string>
    Returns: string
    """ # Prepare the path.  TODO: is this repeatable across multiple # maven repositories? # Default url is maven central # TODO: make this configurable. # Download the file - I guess bazel just bails on exception here, # can't catch it. # Print the contents of the file and store it in the 'sha1' # fields. # Some files have this form: # 6975da39a7040257bd51d21a231b76c915872d38  /home/maven/repository-staging/to-ibiblio/maven2/javax/inject/javax.inject/1/javax.inject-1.jar # Some files have the form
rtx
None
artifact
None