applypatch: Forward declare struct Value.
And move '#include "edify/expr.h"' into .cpp files. This breaks the
transitive dependency on libedify. Modules that include
"applypatch/applypatch.h" don't need to add libedify into their
dependency list, unless they really need anything from libedify.
Build libedify static library for host, which is needed by
libimgpatch.
Test: mmma bootable/recovery
Change-Id: Ibb53d322579fcbf593438d058d9bcee240625941
diff --git a/applypatch/Android.mk b/applypatch/Android.mk
index f5dda2b..db72e8e 100644
--- a/applypatch/Android.mk
+++ b/applypatch/Android.mk
@@ -53,6 +53,7 @@
bootable/recovery
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
+ libedify \
libcrypto \
libbspatch \
libbase \
@@ -77,6 +78,7 @@
bootable/recovery
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_STATIC_LIBRARIES := \
+ libedify \
libcrypto \
libbspatch \
libbase \
diff --git a/applypatch/bspatch.cpp b/applypatch/bspatch.cpp
index 65ee614..b2f29fb 100644
--- a/applypatch/bspatch.cpp
+++ b/applypatch/bspatch.cpp
@@ -30,6 +30,7 @@
#include <openssl/sha.h>
#include "applypatch/applypatch.h"
+#include "edify/expr.h"
#include "print_sha1.h"
void ShowBSDiffLicense() {
@@ -91,4 +92,4 @@
}
}
return result;
-}
\ No newline at end of file
+}
diff --git a/applypatch/imgpatch.cpp b/applypatch/imgpatch.cpp
index df75f98..7a43ddb 100644
--- a/applypatch/imgpatch.cpp
+++ b/applypatch/imgpatch.cpp
@@ -37,6 +37,8 @@
#include <openssl/sha.h>
#include <zlib.h>
+#include "edify/expr.h"
+
static inline int64_t Read8(const void *address) {
return android::base::get_unaligned<int64_t>(address);
}
diff --git a/applypatch/include/applypatch/applypatch.h b/applypatch/include/applypatch/applypatch.h
index 581360e..2a3b3ef 100644
--- a/applypatch/include/applypatch/applypatch.h
+++ b/applypatch/include/applypatch/applypatch.h
@@ -27,7 +27,8 @@
#include <openssl/sha.h>
-#include "edify/expr.h"
+// Forward declaration to avoid including "edify/expr.h" in the header.
+struct Value;
struct FileContents {
uint8_t sha1[SHA_DIGEST_LENGTH];
diff --git a/edify/Android.mk b/edify/Android.mk
index cec65f4..fbf2b1b 100644
--- a/edify/Android.mk
+++ b/edify/Android.mk
@@ -34,3 +34,19 @@
LOCAL_STATIC_LIBRARIES += libbase
include $(BUILD_STATIC_LIBRARY)
+
+#
+# Build the host-side library (static library)
+#
+include $(CLEAR_VARS)
+
+LOCAL_SRC_FILES := $(edify_src_files)
+
+LOCAL_CFLAGS := -Wall -Werror
+LOCAL_CPPFLAGS := -Wno-unused-parameter
+LOCAL_CPPFLAGS += -Wno-deprecated-register
+LOCAL_MODULE := libedify
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
+LOCAL_STATIC_LIBRARIES += libbase
+
+include $(BUILD_HOST_STATIC_LIBRARY)