diff options
author | 2017-10-05 18:21:49 +0200 | |
---|---|---|
committer | 2017-10-06 19:47:10 +0200 | |
commit | a784c8fc3a7b812bd2f4d9cfa9fdc1c9695ada13 (patch) | |
tree | 45a4f1d7879759a540c97a91065891b0eace87b7 /src/test/shell/bazel/android | |
parent | 334d2f155d85fca1797e249dc0acf2c47be089b0 (diff) |
Use bundled proguard 5.3.3 instead of 4.7 from the SDK
Fixes https://github.com/bazelbuild/bazel/issues/3777
Also adds a proguard integration test so that hopefully we notice next time it breaks.
RELNOTES: Updated Android proguard to 5.3.3. It now works with android-24+.
PiperOrigin-RevId: 171162295
Diffstat (limited to 'src/test/shell/bazel/android')
-rwxr-xr-x | src/test/shell/bazel/android/android_integration_test.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/test/shell/bazel/android/android_integration_test.sh b/src/test/shell/bazel/android/android_integration_test.sh index 0f6b8d23c3..965626ef6f 100755 --- a/src/test/shell/bazel/android/android_integration_test.sh +++ b/src/test/shell/bazel/android/android_integration_test.sh @@ -214,6 +214,58 @@ function test_allow_custom_manifest_name() { "Failed to build android_binary with custom Android manifest file name" } +function test_proguard() { + create_new_workspace + setup_android_sdk_support + mkdir -p java/com/bin + cat > java/com/bin/BUILD <<EOF +android_binary( + name = 'bin', + srcs = ['Bin.java', 'NotUsed.java'], + manifest = 'AndroidManifest.xml', + proguard_specs = ['proguard.config'], + deps = [':lib'], +) +android_library( + name = 'lib', + srcs = ['Lib.java'], +) +EOF + cat > java/com/bin/AndroidManifest.xml <<EOF +<manifest package='com.bin' /> +EOF + cat > java/com/bin/Bin.java <<EOF +package com.bin; +public class Bin { + public Lib getLib() { + return new Lib(); + } +} +EOF + cat > java/com/bin/NotUsed.java <<EOF +package com.bin; +public class NotUsed {} +EOF + cat > java/com/bin/Lib.java <<EOF +package com.bin; +public class Lib {} +EOF + cat > java/com/bin/proguard.config <<EOF +-keep public class com.bin.Bin { + public *; +} +EOF + assert_build //java/com/bin + output_classes=$(zipinfo -1 bazel-bin/java/com/bin/bin_proguard.jar) + assert_equals 3 $(wc -w <<< $output_classes) + assert_one_of $output_classes "META-INF/MANIFEST.MF" + assert_one_of $output_classes "com/bin/Bin.class" + # Not kept by proguard + assert_not_one_of $output_classes "com/bin/Unused.class" + # This is renamed by proguard to something else + assert_not_one_of $output_classes "com/bin/Lib.class" +} + if [[ ! -d "${TEST_SRCDIR}/androidsdk" ]]; then echo "Not running Android tests due to lack of an Android SDK." exit 0 |