tools/bzl/maven_jar.bzl
def _maven_jar_impl(ctx):
    """rule to download a Maven archive."""
    coordinates = _create_coordinates(ctx.attr.artifact)

    name = ctx.name
    sha1 = ctx.attr.sha1

    parts = ctx.attr.artifact.split(":")

    # TODO(davido): Only releases for now, implement handling snapshots
    jar, url = _maven_release(ctx, parts)

    binjar = jar + ".jar"
    binjar_path = ctx.path("/".join(["jar", binjar]))
    binurl = url + ".jar"

    python = ctx.which("python")
    script = ctx.path(ctx.attr._download_script)

    args = [python, script, "-o", binjar_path, "-u", binurl]
    if ctx.attr.sha1:
        args.extend(["-v", sha1])
    for x in ctx.attr.exclude:
        args.extend(["-x", x])

    out = ctx.execute(args)

    if out.return_code:
        fail("failed %s: %s" % (args, out.stderr))

    srcjar = None
    if ctx.attr.src_sha1 or ctx.attr.attach_source:
        srcjar = jar + "-src.jar"
        srcurl = url + "-sources.jar"
        srcjar_path = ctx.path("jar/" + srcjar)
        args = [python, script, "-o", srcjar_path, "-u", srcurl]
        if ctx.attr.src_sha1:
            args.extend(["-v", ctx.attr.src_sha1])
        out = ctx.execute(args)
        if out.return_code:
            fail("failed %s: %s" % (args, out.stderr))

    _generate_build_files(ctx, binjar, srcjar)
rule to download a Maven archive.
rule to download a Maven archive.
rule to download a Maven archive .
def _maven_jar_impl(ctx):
    coordinates = _create_coordinates(ctx.attr.artifact)
    name = ctx.name
    sha1 = ctx.attr.sha1
    parts = ctx.attr.artifact.split(":")
    jar, url = _maven_release(ctx, parts)
    binjar = jar + ".jar"
    binjar_path = ctx.path("/".join(["jar", binjar]))
    binurl = url + ".jar"
    python = ctx.which("python")
    script = ctx.path(ctx.attr._download_script)
    args = [python, script, "-o", binjar_path, "-u", binurl]
    if ctx.attr.sha1:
        args.extend(["-v", sha1])
    for x in ctx.attr.exclude:
        args.extend(["-x", x])
    out = ctx.execute(args)
    if out.return_code:
        fail("failed %s: %s" % (args, out.stderr))
    srcjar = None
    if ctx.attr.src_sha1 or ctx.attr.attach_source:
        srcjar = jar + "-src.jar"
        srcurl = url + "-sources.jar"
        srcjar_path = ctx.path("jar/" + srcjar)
        args = [python, script, "-o", srcjar_path, "-u", srcurl]
        if ctx.attr.src_sha1:
            args.extend(["-v", ctx.attr.src_sha1])
        out = ctx.execute(args)
        if out.return_code:
            fail("failed %s: %s" % (args, out.stderr))
    _generate_build_files(ctx, binjar, srcjar)
def _maven_jar_impl ( ctx ) : coordinates = _create_coordinates ( ctx . attr . artifact ) name = ctx . name sha1 = ctx . attr . sha1 parts = ctx . attr . artifact . split ( ":" ) jar , url = _maven_release ( ctx , parts ) binjar = jar + ".jar" binjar_path = ctx . path ( "/" . join ( [ "jar" , binjar ] ) ) binurl = url + ".jar" python = ctx . which ( "python" ) script = ctx . path ( ctx . attr . _download_script ) args = [ python , script , "-o" , binjar_path , "-u" , binurl ] if ctx . attr . sha1 : args . extend ( [ "-v" , sha1 ] ) for x in ctx . attr . exclude : args . extend ( [ "-x" , x ] ) out = ctx . execute ( args ) if out . return_code : fail ( "failed %s: %s" % ( args , out . stderr ) ) srcjar = None if ctx . attr . src_sha1 or ctx . attr . attach_source : srcjar = jar + "-src.jar" srcurl = url + "-sources.jar" srcjar_path = ctx . path ( "jar/" + srcjar ) args = [ python , script , "-o" , srcjar_path , "-u" , srcurl ] if ctx . attr . src_sha1 : args . extend ( [ "-v" , ctx . attr . src_sha1 ] ) out = ctx . execute ( args ) if out . return_code : fail ( "failed %s: %s" % ( args , out . stderr ) ) _generate_build_files ( ctx , binjar , srcjar )
rule to download a Maven archive.
rule to download a Maven archive .
"""rule to download a Maven archive.""" # TODO(davido): Only releases for now, implement handling snapshots
ctx