| Brian Carlstrom | e143538 | 2010-06-17 19:42:09 -0700 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2010 The Android Open Source Project |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | # |
| 16 | LOCAL_PATH := $(call my-dir) |
| 17 | |
| Brian Carlstrom | e143538 | 2010-06-17 19:42:09 -0700 | [diff] [blame] | 18 | include $(CLEAR_VARS) |
| 19 | LOCAL_MODULE := bouncycastle |
| 20 | LOCAL_SRC_FILES := $(call all-java-files-under,src/main/java) |
| Brian Carlstrom | c37f4a0 | 2010-06-21 09:45:31 -0700 | [diff] [blame] | 21 | LOCAL_JAVACFLAGS := -encoding UTF-8 |
| Brian Carlstrom | 10261d9 | 2010-06-23 00:14:16 -0700 | [diff] [blame] | 22 | LOCAL_JAVA_LIBRARIES := core |
| 23 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 24 | include $(BUILD_JAVA_LIBRARY) |
| Brian Carlstrom | e143538 | 2010-06-17 19:42:09 -0700 | [diff] [blame] | 25 | |
| 26 | # Based on "Finding dead code" example in ProGuard manual at http://proguard.sourceforge.net/ |
| 27 | .PHONY: bouncycastle-proguard-deadcode |
| 28 | bouncycastle-proguard-deadcode: $(full_classes_compiled_jar) $(full_java_libs) |
| 29 | $(PROGUARD) \ |
| 30 | -injars $(full_classes_compiled_jar) \ |
| 31 | -libraryjars "$(call normalize-path-list,$(addsuffix (!org/bouncycastle/**.class,!org/apache/harmony/xnet/provider/jsse/OpenSSLMessageDigest.class),$(full_java_libs)))" \ |
| 32 | -dontoptimize \ |
| 33 | -dontobfuscate \ |
| 34 | -dontpreverify \ |
| 35 | -ignorewarnings \ |
| 36 | -printusage \ |
| 37 | -keep class org.bouncycastle.jce.provider.BouncyCastleProvider "{ public protected *; }" \ |
| 38 | -keep class org.bouncycastle.jce.provider.symmetric.AESMappings "{ public protected *; }" \ |
| 39 | -keep class org.bouncycastle.asn1.ASN1TaggedObject "{ public protected *; }" \ |
| 40 | -keep class org.bouncycastle.asn1.x509.CertificateList "{ public protected *; }" \ |
| 41 | -keep class org.bouncycastle.crypto.AsymmetricBlockCipher "{ public protected *; }" \ |
| 42 | -keep class org.bouncycastle.x509.ExtendedPKIXBuilderParameters "{ public protected *; }" \ |
| 43 | `(find $(LOCAL_PATH) -name '*.java' | xargs grep '"org.bouncycastle' | egrep ' (put|add)' | sed -e 's/");//' -e 's/.*"//'; \ |
| 44 | find $(LOCAL_PATH) -name '*.java' | xargs grep ' addHMACAlgorithm' | sed 's/"org.bouncycastle/\norg.bouncycastle/g' | grep ^org.bouncycastle | sed 's/".*//'; \ |
| 45 | find . -name '*.java' | xargs grep 'import org.bouncycastle' | grep -v /bouncycastle/ | sed -e 's/.*:import //' -e 's/;//') \ |
| 46 | | sed -e 's/^/-keep class /' -e 's/$$/ { public protected \*; } /' | sort | uniq` \ |
| 47 | -keepclassmembers "class * { \ |
| 48 | static final % *; \ |
| 49 | static final java.lang.String *; \ |
| 50 | }" \ |
| 51 | -keepclassmembers "class * implements java.io.Serializable { \ |
| 52 | private static final java.io.ObjectStreamField[] serialPersistentFields; \ |
| 53 | private void writeObject(java.io.ObjectOutputStream); \ |
| 54 | private void readObject(java.io.ObjectInputStream); \ |
| 55 | java.lang.Object writeReplace(); \ |
| 56 | java.lang.Object readResolve(); \ |
| 57 | }" \ |
| 58 | -keepclassmembers "interface org.bouncycastle.crypto.paddings.BlockCipherPadding { \ |
| 59 | abstract public java.lang.String getPaddingName(); \ |
| 60 | }" \ |
| 61 | -keepclassmembers "class * implements org.bouncycastle.crypto.paddings.BlockCipherPadding { \ |
| 62 | public java.lang.String getPaddingName(); \ |
| 63 | }" |