Skip to content

Commit

Permalink
Rename proguard_specs attribute for gen_maven_artifact to reflect how…
Browse files Browse the repository at this point in the history
… it will be used.

RELNOTES=n/a
PiperOrigin-RevId: 605055941
  • Loading branch information
wanyingd1996 authored and Dagger Team committed Feb 7, 2024
1 parent d7a55be commit 348bd75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions java/dagger/hilt/android/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ gen_maven_artifact(
],
manifest = "AndroidManifest.xml",
packaging = "aar",
proguard_specs = [
proguard_and_r8_specs = [
"//java/dagger/hilt:proguard-rules.pro",
":proguard-rules.pro",
"//java/dagger/hilt/android:proguard-rules.pro",
"//java/dagger/hilt/android/lifecycle:proguard-rules.pro",
"//java/dagger/hilt/internal:proguard-rules.pro",
],
Expand Down
17 changes: 9 additions & 8 deletions tools/maven.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"""Macros to simplify generating maven files.
"""

load("@google_bazel_common//tools/jarjar:jarjar.bzl", "jarjar_library")
load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
load("@google_bazel_common//tools/maven:pom_file.bzl", default_pom_file = "pom_file")
load(":maven_info.bzl", "MavenInfo", "collect_maven_info")
load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
load("@google_bazel_common//tools/jarjar:jarjar.bzl", "jarjar_library")

SHADED_MAVEN_DEPS = [
"com.google.auto:auto-common",
Expand Down Expand Up @@ -66,7 +66,7 @@ def gen_maven_artifact(
shaded_deps = None,
manifest = None,
lint_deps = None,
proguard_specs = None):
proguard_and_r8_specs = None):
_gen_maven_artifact(
name,
artifact_name,
Expand All @@ -85,7 +85,7 @@ def gen_maven_artifact(
shaded_deps,
manifest,
lint_deps,
proguard_specs
proguard_and_r8_specs
)

def _gen_maven_artifact(
Expand All @@ -106,7 +106,7 @@ def _gen_maven_artifact(
shaded_deps,
manifest,
lint_deps,
proguard_specs):
proguard_and_r8_specs):
"""Generates the files required for a maven artifact.
This macro generates the following targets:
Expand Down Expand Up @@ -140,7 +140,8 @@ def _gen_maven_artifact(
shaded_deps: The shaded deps for the jarjar.
manifest: The AndroidManifest.xml to bundle in when packaing an 'aar'.
lint_deps: The lint targets to be bundled in when packaging an 'aar'.
proguard_specs: The proguard spec files to be bundled in when packaging an 'aar'
proguard_and_r8_specs: The proguard spec files to be bundled in when
packaging an 'aar', which will be applied in both r8 and proguard.
"""

_validate_maven_deps(
Expand Down Expand Up @@ -189,11 +190,11 @@ def _gen_maven_artifact(
else:
lint_jar_name = None

if proguard_specs:
if proguard_and_r8_specs:
# Concatenate all proguard rules since an aar only contains a single proguard.txt
native.genrule(
name = name + "-proguard",
srcs = proguard_specs,
srcs = proguard_and_r8_specs,
outs = [name + "-proguard.txt"],
cmd = "cat $(SRCS) > $@",
)
Expand Down

0 comments on commit 348bd75

Please sign in to comment.