Merge "Add the product version to target_files.zip."
diff --git a/core/definitions.mk b/core/definitions.mk
index 9d6311e..5e45e1f 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -182,16 +182,53 @@
endef
###########################################################
+## Find all of the directories under the named directories with
+## the specified name.
+## Meant to be used like:
+## INC_DIRS := $(call all-named-dirs-under,inc,.)
+###########################################################
+
+define all-named-dirs-under
+$(call find-subdir-files,$(2) -type d -name "$(1)")
+endef
+
+###########################################################
+## Find all the directories under the current directory that
+## haves name that match $(1)
+###########################################################
+
+define all-subdir-named-dirs
+$(call all-named-dirs-under,$(1),.)
+endef
+
+###########################################################
+## Find all of the files under the named directories with
+## the specified name.
+## Meant to be used like:
+## SRC_FILES := $(call all-named-files-under,*.h,src tests)
+###########################################################
+
+define all-named-files-under
+$(call find-files-in-subdirs,$(LOCAL_PATH),"$(1)",$(2))
+endef
+
+###########################################################
+## Find all of the files under the current directory with
+## the specified name.
+###########################################################
+
+define all-subdir-named-files
+$(call all-named-files-under,$(1),.)
+endef
+
+###########################################################
## Find all of the java files under the named directories.
## Meant to be used like:
## SRC_FILES := $(call all-java-files-under,src tests)
###########################################################
define all-java-files-under
-$(sort $(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.java" -and -not -name ".*") \
- ))
+$(call all-named-files-under,*.java,$(1))
endef
###########################################################
@@ -210,10 +247,7 @@
###########################################################
define all-c-files-under
-$(sort $(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.c" -and -not -name ".*") \
- ))
+$(call all-named-files-under,*.c,$(1))
endef
###########################################################
@@ -255,10 +289,7 @@
###########################################################
define all-Iaidl-files-under
-$(sort $(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "I*.aidl" -and -not -name ".*") \
- ))
+$(call all-named-files-under,I*.aidl,$(1))
endef
###########################################################
@@ -276,10 +307,7 @@
###########################################################
define all-logtags-files-under
-$(sort $(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.logtags" -and -not -name ".*") \
- ))
+$(call all-named-files-under,*.logtags,$(1))
endef
###########################################################
@@ -289,10 +317,7 @@
###########################################################
define all-proto-files-under
-$(sort $(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.proto" -and -not -name ".*") \
- ))
+$(call all-named-files-under,*.proto,$(1))
endef
###########################################################
@@ -302,10 +327,7 @@
###########################################################
define all-renderscript-files-under
-$(sort $(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) \( -name "*.rs" -or -name "*.fs" \) -and -not -name ".*") \
- ))
+$(call find-subdir-files,$(1) \( -name "*.rs" -or -name "*.fs" \) -and -not -name ".*")
endef
###########################################################
@@ -315,10 +337,7 @@
###########################################################
define all-S-files-under
-$(sort $(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.S" -and -not -name ".*") \
- ))
+$(call all-named-files-under,*.S,$(1))
endef
###########################################################
@@ -328,10 +347,7 @@
###########################################################
define all-html-files-under
-$(sort $(patsubst ./%,%, \
- $(shell cd $(LOCAL_PATH) ; \
- find -L $(1) -name "*.html" -and -not -name ".*") \
- ))
+$(call all-named-files-under,*.html,$(1))
endef
###########################################################
@@ -382,11 +398,11 @@
###########################################################
define find-other-java-files
- $(call find-subdir-files,$(1) -name "*.java" -and -not -name ".*")
+$(call all-java-files-under,$(1))
endef
define find-other-html-files
- $(call find-subdir-files,$(1) -name "*.html" -and -not -name ".*")
+$(call all-html-files-under,$(1))
endef
###########################################################
diff --git a/core/main.mk b/core/main.mk
index 1ca02d1..8610492 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -179,7 +179,7 @@
ifneq ($(EXPERIMENTAL_USE_JAVA8),)
required_version := "1.8.x"
required_javac_version := "1.8"
-java_version := $(shell echo '$(java_version_str)' | grep 'openjdk .*[ "]1\.8[\. "$$]')
+java_version := $(shell echo '$(java_version_str)' | grep '[ "]1\.8[\. "$$]')
javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.8[\. "$$]')
else # default
required_version := "1.7.x"
diff --git a/core/ninja.mk b/core/ninja.mk
index 2ac8c8e..6fc508d 100644
--- a/core/ninja.mk
+++ b/core/ninja.mk
@@ -136,7 +136,7 @@
.INTERMEDIATE: kati.intermediate
kati.intermediate: $(KATI) $(MAKEPARALLEL)
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
- +$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo --use_find_emulator -f build/core/main.mk $(KATI_TARGETS) --gen_all_phony_targets --gen_all_targets BUILDING_WITH_NINJA=true
+ +$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo --use_find_emulator -f build/core/main.mk $(KATI_TARGETS) --gen_all_targets BUILDING_WITH_NINJA=true
KATI_CXX := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_CFLAGS) $(CLANG_HOST_GLOBAL_CPPFLAGS)
KATI_LD := $(CLANG_CXX) $(CLANG_HOST_GLOBAL_LDFLAGS)