From ef53aebf9e985ac18e931752d017a56705d3619f Mon Sep 17 00:00:00 2001 From: Stewart Miles Date: Thu, 12 Nov 2015 21:12:18 -0800 Subject: [PATCH] Expand local file path to allow users to fix ndk-build local-source-file-path does not expand to correct file paths in some circumstances so some users override it. Therefore flatbuffers_header_build_rules has been modified to generate rules that expand LOCAL_SRC_FILES values with flatbuffers_header_build_rules. Also, this overrides local-source-file-path to allow nest projects to build when NDK_OUT is set. Tested: Verified a dependent project continues to build. Bug: 25673744 Change-Id: Ic90186fe96d6e4533f9f3b7ca9ef78084de08a7e --- android/jni/include.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/android/jni/include.mk b/android/jni/include.mk index 417f66700..02d345e4e 100644 --- a/android/jni/include.mk +++ b/android/jni/include.mk @@ -192,7 +192,7 @@ $(foreach schema,$(1),\ $(call flatbuffers_header_build_rule,\ $(schema),$(strip $(2)),$(strip $(3)),$(strip $(4))))\ $(foreach src,$(strip $(5)),\ - $(eval $(PORTABLE_LOCAL_PATH)$$(src): \ + $(eval $(call local-source-file-path,$(src)): \ $(foreach schema,$(strip $(1)),\ $(call flatbuffers_fbs_to_h,$(strip $(2)),$(strip $(3)),$(schema)))))\ $(if $(6),\ @@ -201,11 +201,18 @@ $(if $(6),\ $(call flatbuffers_fbs_to_h,$(strip $(2)),$(strip $(3)),$(schema)))),)\ $(if $(7),\ $(foreach src,$(strip $(5)),\ - $(eval $(PORTABLE_LOCAL_PATH)$$(src): $(strip $(7)))),)\ + $(eval $(call local-source-file-path,$(src)): $(strip $(7)))),)\ $(if $(7),\ $(foreach dependency,$(strip $(7)),\ $(eval $(6): $(dependency))),) endef +# TODO: Remove when the LOCAL_PATH expansion bug in the NDK is fixed. +# Override the default behavior of local-source-file-path to workaround +# a bug which prevents the build of deeply nested projects when NDK_OUT is +# set. +local-source-file-path = \ + $(if $(call host-path-is-absolute,$1),$1,$(realpath $(LOCAL_PATH)/$1)) + endif # FLATBUFFERS_INCLUDE_MK_