diff options
author | 2015-10-05 15:58:23 +0000 | |
---|---|---|
committer | 2015-10-06 07:03:20 +0000 | |
commit | 6817a6fcdd4275f9d3d4c3b9451a6c4144adcee1 (patch) | |
tree | 83a0a735ac0c48f777ed4a8ac06881262e2a2e50 /tools | |
parent | 1c0543c626bf29eda95348c5c97391bc5d372fa3 (diff) |
Allow Java libraries to export and propagate proguard_specs.
It may be the case that a library used by Java clients is also used
by Android clients, but when used for the latter, it requires a particular
Proguard configuration. This change modifies Java library rules to accept
Proguard specs and pass them up to Android rules.
Note that this does not cause Proguard to be used on normal Java binaries.
RELNOTES[NEW]: java_library now supports the proguard_specs attribute for
passing Proguard configuration up to Android (not Java) binaries.
--
MOS_MIGRATED_REVID=104661799
Diffstat (limited to 'tools')
-rw-r--r-- | tools/android/BUILD | 19 | ||||
-rw-r--r-- | tools/jdk/BUILD | 26 | ||||
-rw-r--r-- | tools/jdk/proguard_whitelister.py (renamed from tools/android/proguard_whitelister.py) | 6 | ||||
-rw-r--r-- | tools/jdk/proguard_whitelister_test.py (renamed from tools/android/proguard_whitelister_test.py) | 2 | ||||
-rw-r--r-- | tools/jdk/proguard_whitelister_test_input.cfg (renamed from tools/android/proguard_whitelister_test_input.cfg) | 0 |
5 files changed, 30 insertions, 23 deletions
diff --git a/tools/android/BUILD b/tools/android/BUILD index c2aeb9a667..02e5e93e5d 100644 --- a/tools/android/BUILD +++ b/tools/android/BUILD @@ -60,25 +60,6 @@ py_test( ) py_binary( - name = "proguard_whitelister", - srcs = [ - "proguard_whitelister.py", - ], - deps = [ - "//third_party/py/gflags", - ], -) - -py_test( - name = "proguard_whitelister_test", - srcs = ["proguard_whitelister_test.py"], - data = ["proguard_whitelister_test_input.cfg"], - deps = [ - ":proguard_whitelister", - ], -) - -py_binary( name = "build_incremental_dexmanifest", srcs = [":build_incremental_dexmanifest.py"], deps = [], diff --git a/tools/jdk/BUILD b/tools/jdk/BUILD index 3326081607..b8f04197eb 100644 --- a/tools/jdk/BUILD +++ b/tools/jdk/BUILD @@ -103,10 +103,34 @@ exports_files([ filegroup( name = "srcs", - srcs = ["BUILD"], # Tools are build from the workspace for tests. + srcs = [ + "BUILD", # Tools are build from the workspace for tests. + "proguard_whitelister.py", + "proguard_whitelister_test.py", + "proguard_whitelister_test_input.cfg", + ], ) filegroup( name = "package-srcs", srcs = glob(["**"]), ) + +py_binary( + name = "proguard_whitelister", + srcs = [ + "proguard_whitelister.py", + ], + deps = [ + "//third_party/py/gflags", + ], +) + +py_test( + name = "proguard_whitelister_test", + srcs = ["proguard_whitelister_test.py"], + data = ["proguard_whitelister_test_input.cfg"], + deps = [ + ":proguard_whitelister", + ], +) diff --git a/tools/android/proguard_whitelister.py b/tools/jdk/proguard_whitelister.py index e5b000fb57..6c95360df7 100644 --- a/tools/android/proguard_whitelister.py +++ b/tools/jdk/proguard_whitelister.py @@ -15,8 +15,10 @@ """Checks for proguard configuration rules that cannot be combined across libs. The only valid proguard arguments for a library are -keep, -assumenosideeffects, -and -dontnote and -dontwarn and -checkdiscard when they are provided with -arguments. +and -dontnote and -dontwarn when they are provided with arguments. +Limiting libraries to using these flags prevents drastic, sweeping effects +(such as obfuscation being disabled) from being inadvertently applied to a +binary through a library dependency. """ import re diff --git a/tools/android/proguard_whitelister_test.py b/tools/jdk/proguard_whitelister_test.py index 2229cfbd12..6a24501fbe 100644 --- a/tools/android/proguard_whitelister_test.py +++ b/tools/jdk/proguard_whitelister_test.py @@ -15,7 +15,7 @@ import os import unittest -from tools.android import proguard_whitelister +from tools.jdk import proguard_whitelister class ProguardConfigValidatorTest(unittest.TestCase): diff --git a/tools/android/proguard_whitelister_test_input.cfg b/tools/jdk/proguard_whitelister_test_input.cfg index ceb3709dd8..ceb3709dd8 100644 --- a/tools/android/proguard_whitelister_test_input.cfg +++ b/tools/jdk/proguard_whitelister_test_input.cfg |