| 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 | |
| Jesse Wilson | 8436e16 | 2010-09-13 17:28:12 -0700 | [diff] [blame] | 18 | bouncycastle_src_files := $(call all-java-files-under,src/main/java) |
| 19 | |
| Brian Carlstrom | e143538 | 2010-06-17 19:42:09 -0700 | [diff] [blame] | 20 | include $(CLEAR_VARS) |
| 21 | LOCAL_MODULE := bouncycastle |
| Jesse Wilson | fa0f9bd | 2010-09-16 15:40:47 -0700 | [diff] [blame] | 22 | LOCAL_MODULE_TAGS := optional |
| Jesse Wilson | 8436e16 | 2010-09-13 17:28:12 -0700 | [diff] [blame] | 23 | LOCAL_SRC_FILES := $(bouncycastle_src_files) |
| Brian Carlstrom | c37f4a0 | 2010-06-21 09:45:31 -0700 | [diff] [blame] | 24 | LOCAL_JAVACFLAGS := -encoding UTF-8 |
| Brian Carlstrom | 10261d9 | 2010-06-23 00:14:16 -0700 | [diff] [blame] | 25 | LOCAL_JAVA_LIBRARIES := core |
| 26 | LOCAL_NO_STANDARD_LIBRARIES := true |
| Brian Carlstrom | 434fc78 | 2011-01-24 16:17:12 -0800 | [diff] [blame] | 27 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| Brian Carlstrom | 10261d9 | 2010-06-23 00:14:16 -0700 | [diff] [blame] | 28 | include $(BUILD_JAVA_LIBRARY) |
| Brian Carlstrom | e143538 | 2010-06-17 19:42:09 -0700 | [diff] [blame] | 29 | |
| Jesse Wilson | 8436e16 | 2010-09-13 17:28:12 -0700 | [diff] [blame] | 30 | # This is used to generate a list of what is unused so it can be removed when bouncycastle is updated. |
| Brian Carlstrom | e143538 | 2010-06-17 19:42:09 -0700 | [diff] [blame] | 31 | # Based on "Finding dead code" example in ProGuard manual at http://proguard.sourceforge.net/ |
| 32 | .PHONY: bouncycastle-proguard-deadcode |
| 33 | bouncycastle-proguard-deadcode: $(full_classes_compiled_jar) $(full_java_libs) |
| 34 | $(PROGUARD) \ |
| 35 | -injars $(full_classes_compiled_jar) \ |
| 36 | -libraryjars "$(call normalize-path-list,$(addsuffix (!org/bouncycastle/**.class,!org/apache/harmony/xnet/provider/jsse/OpenSSLMessageDigest.class),$(full_java_libs)))" \ |
| 37 | -dontoptimize \ |
| 38 | -dontobfuscate \ |
| 39 | -dontpreverify \ |
| 40 | -ignorewarnings \ |
| 41 | -printusage \ |
| 42 | -keep class org.bouncycastle.jce.provider.BouncyCastleProvider "{ public protected *; }" \ |
| 43 | -keep class org.bouncycastle.jce.provider.symmetric.AESMappings "{ public protected *; }" \ |
| 44 | -keep class org.bouncycastle.asn1.ASN1TaggedObject "{ public protected *; }" \ |
| 45 | -keep class org.bouncycastle.asn1.x509.CertificateList "{ public protected *; }" \ |
| 46 | -keep class org.bouncycastle.crypto.AsymmetricBlockCipher "{ public protected *; }" \ |
| 47 | -keep class org.bouncycastle.x509.ExtendedPKIXBuilderParameters "{ public protected *; }" \ |
| 48 | `(find $(LOCAL_PATH) -name '*.java' | xargs grep '"org.bouncycastle' | egrep ' (put|add)' | sed -e 's/");//' -e 's/.*"//'; \ |
| 49 | find $(LOCAL_PATH) -name '*.java' | xargs grep ' addHMACAlgorithm' | sed 's/"org.bouncycastle/\norg.bouncycastle/g' | grep ^org.bouncycastle | sed 's/".*//'; \ |
| 50 | find . -name '*.java' | xargs grep 'import org.bouncycastle' | grep -v /bouncycastle/ | sed -e 's/.*:import //' -e 's/;//') \ |
| 51 | | sed -e 's/^/-keep class /' -e 's/$$/ { public protected \*; } /' | sort | uniq` \ |
| 52 | -keepclassmembers "class * { \ |
| 53 | static final % *; \ |
| 54 | static final java.lang.String *; \ |
| 55 | }" \ |
| 56 | -keepclassmembers "class * implements java.io.Serializable { \ |
| 57 | private static final java.io.ObjectStreamField[] serialPersistentFields; \ |
| 58 | private void writeObject(java.io.ObjectOutputStream); \ |
| 59 | private void readObject(java.io.ObjectInputStream); \ |
| 60 | java.lang.Object writeReplace(); \ |
| 61 | java.lang.Object readResolve(); \ |
| 62 | }" \ |
| 63 | -keepclassmembers "interface org.bouncycastle.crypto.paddings.BlockCipherPadding { \ |
| 64 | abstract public java.lang.String getPaddingName(); \ |
| 65 | }" \ |
| 66 | -keepclassmembers "class * implements org.bouncycastle.crypto.paddings.BlockCipherPadding { \ |
| 67 | public java.lang.String getPaddingName(); \ |
| 68 | }" |
| Jesse Wilson | 8436e16 | 2010-09-13 17:28:12 -0700 | [diff] [blame] | 69 | |
| 70 | ifeq ($(WITH_HOST_DALVIK),true) |
| 71 | include $(CLEAR_VARS) |
| 72 | LOCAL_MODULE := bouncycastle-hostdex |
| Jesse Wilson | fa0f9bd | 2010-09-16 15:40:47 -0700 | [diff] [blame] | 73 | LOCAL_MODULE_TAGS := optional |
| Jesse Wilson | 8436e16 | 2010-09-13 17:28:12 -0700 | [diff] [blame] | 74 | LOCAL_SRC_FILES := $(bouncycastle_src_files) |
| 75 | LOCAL_JAVACFLAGS := -encoding UTF-8 |
| 76 | LOCAL_JAVA_LIBRARIES := core-hostdex |
| 77 | LOCAL_NO_STANDARD_LIBRARIES := true |
| 78 | LOCAL_BUILD_HOST_DEX := true |
| Jean-Baptiste Queru | 0ccea25 | 2010-09-14 13:50:21 -0700 | [diff] [blame] | 79 | LOCAL_MODULE_TAGS := optional |
| Brian Carlstrom | 434fc78 | 2011-01-24 16:17:12 -0800 | [diff] [blame] | 80 | LOCAL_JARJAR_RULES := $(LOCAL_PATH)/jarjar-rules.txt |
| Jesse Wilson | 8436e16 | 2010-09-13 17:28:12 -0700 | [diff] [blame] | 81 | include $(BUILD_HOST_JAVA_LIBRARY) |
| 82 | endif |