Skip to content

Commit

Permalink
Merge pull request #100 from restingbull/release_1_0_x
Browse files Browse the repository at this point in the history
Fix missing jar dependencies.
  • Loading branch information
cgruber authored May 4, 2020
2 parents aa278b0 + 7371eb8 commit c9ea4b9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions maven/maven.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ load("@{maven_rules_repository}//maven:jvm.bzl", "raw_jvm_import")
raw_jvm_import(
name = "{target}_jar",
jar = {classes},
deps = [{deps}],
)
android_library(
Expand All @@ -148,6 +149,13 @@ android_library(
)
"""

_AAR_JETIFY_TEMPLATE = """
jetify(
name = "{target}_jetified",
srcs = ["{aar_repo}:classes.jar"],
)
"""


def _convert_maven_dep(repo_name, artifact):
group_path = artifact.group_id.replace(".", "/")
Expand Down Expand Up @@ -231,7 +239,7 @@ def _cut(str, *to_phrases):

def _extract_android_package(ctx, manifest):
m = ctx.read(manifest)
pkg = ""
pkg = None
for tag in m.split("<"):
if tag.startswith("manifest"):
# matching package\s*=\s*"|'pkg"|'
Expand All @@ -245,7 +253,7 @@ def _extract_android_package(ctx, manifest):
pkg = quot_pkg_quot_trailing[1:end_idx]
break

if pkg == "":
if pkg == None:
fail("unable to get package from [%v]", m)

return pkg
Expand All @@ -265,15 +273,7 @@ def _aar_template_params(ctx, artifact, deps, manifest, should_jetify):
def _aar_jars(ctx, target, aar_repo, should_jetify):
if should_jetify:
return {
"jetify" : """
jetify(
name = "{target}_jetified",
srcs = ["{aar_repo}:classes.jar"],
)
""".format(
target = target,
aar_repo = aar_repo
),
"jetify" :_AAR_JETIFY_TEMPLATE.format(target = target, aar_repo = aar_repo),
"classes" : """ ":{target}_jetified" """.format(target = target)
}
return {
Expand Down

0 comments on commit c9ea4b9

Please sign in to comment.