Merge "Integrate protocol buffer compiler into the build system."
diff --git a/core/Makefile b/core/Makefile
index 12ae657..f6a8191 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -15,15 +15,18 @@
 # <dest file> is relative to $(PRODUCT_OUT), so it should look like,
 # e.g., "system/etc/file.xml".
 # The filter part means "only eval the copy-one-file rule if this
-# src:dest pair is the first one to match %:dest"
+# src:dest pair is the first one to match the same dest"
+unique_product_copy_files_destinations := $(sort \
+    $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf))))
 $(foreach cf,$(PRODUCT_COPY_FILES), \
-  $(eval _src := $(call word-colon,1,$(cf))) \
-  $(eval _dest := $(call word-colon,2,$(cf))) \
-  $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
-  $(if $(filter $(_src):$(_dest),$(firstword $(filter %:$(_dest),$(PRODUCT_COPY_FILES)))), \
-    $(eval $(call copy-one-file,$(_src),$(_fulldest))),) \
-  $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
- )
+    $(eval _src := $(call word-colon,1,$(cf))) \
+    $(eval _dest := $(call word-colon,2,$(cf))) \
+    $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
+        $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
+        $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
+        $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
+        $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \
+            $(unique_product_copy_files_destinations)))))
 
 # -----------------------------------------------------------------
 # docs/index.html
@@ -121,7 +124,7 @@
 endef
 
 BUILDINFO_SH := build/tools/buildinfo.sh
-$(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
+$(INSTALLED_BUILD_PROP_TARGET): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
 	@echo Target buildinfo: $@
 	@mkdir -p $(dir $@)
 	$(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
@@ -701,6 +704,10 @@
 mkyaffs2_extra_flags :=
 endif
 
+ifneq ($(BOARD_NAND_SPARE_SIZE),)
+mkyaffs2_extra_flags += -s $(BOARD_NAND_SPARE_SIZE)
+endif
+
 
 # -----------------------------------------------------------------
 # system image
diff --git a/core/product_config.mk b/core/product_config.mk
index 70ac894..433fae2 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -194,8 +194,11 @@
   $(call import-products, $(get-all-product-makefiles))
 endif # TARGET_BUILD_APPS
 $(check-all-products)
-#$(dump-products)
-#$(error done)
+
+ifneq ($(filter dump-products, $(MAKECMDGOALS)),)
+$(dump-products)
+$(error done)
+endif
 
 # Convert a short name like "sooner" into the path to the product
 # file defining that product.
diff --git a/libs/host/CopyFile.c b/libs/host/CopyFile.c
index 44c7c2b..23f1260 100644
--- a/libs/host/CopyFile.c
+++ b/libs/host/CopyFile.c
@@ -64,18 +64,19 @@
 
 /*
  * Returns true if the source file has high resolution modification
- * date.  Cygwin doesn't support st_mtim in normal build, so always
- * return false.
+ * date. Cygwin/Mingw doesn't support st_mtim and always returns false.
  */
 static bool isHiresMtime(const struct stat* pSrcStat)
 {
-#if defined(WIN32_EXE) || defined(USE_MINGW)
-    return 0;
-#elif defined(MACOSX_RSRC)
+#if HAVE_STAT_ST_MTIM
+#if defined(MACOSX_RSRC)
     return pSrcStat->st_mtimespec.tv_nsec > 0;
 #else
     return pSrcStat->st_mtim.tv_nsec > 0;
 #endif
+#else
+    return 0;
+#endif
 }
 
 /*
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index a8aecac..97372cf 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -20,19 +20,11 @@
 PRODUCT_PACKAGES := \
 	SystemUI \
 	AccountAndSyncSettings \
-	Camera \
-	Calculator \
-	DeskClock \
 	Development \
 	DrmProvider \
-	Email \
 	Fallback \
-	Gallery \
 	GPSEnable \
 	Launcher2 \
-	Protips \
-	Music \
-	Mms \
 	Settings \
 	SdkSetup \
 	CustomLocale \
@@ -40,7 +32,6 @@
 	sqlite3 \
 	LatinIME \
 	PinyinIME \
-	Phone \
 	OpenWnn \
 	libWnnEngDic \
 	libWnnJpnDic \
@@ -52,11 +43,21 @@
 	SoftKeyboard \
 	CubeLiveWallpapers \
 	QuickSearchBox \
-        monkeyrunner \
-        guavalib \
-        jsr305lib \
+	monkeyrunner \
+	guavalib \
+	jsr305lib \
 	jython \
-        jsilver
+	jsilver
+#	Calculator \
+#	Camera \
+#	DeskClock \
+#	Email \
+#	Gallery \
+#	Music \
+#	Mms \
+#	Phone \
+#	Protips \
+
 
 # Host tools that are parts of the SDK.
 # See development/build/sdk.atree
@@ -74,7 +75,7 @@
 	traceview \
 	android \
 	dexdump \
-        monkeyrunner
+	monkeyrunner
 
 # Native host Java libraries that are parts of the SDK.
 # See development/build/sdk.atree
@@ -94,12 +95,9 @@
 	sdklib \
 	sdkuilib \
 	sdkmanager \
-	swing-worker-1.1 \
 	groovy-all-1.7.0 \
 	commons-compress-1.0 \
 	emmalib \
-	org-netbeans-api-visual \
-	org-openide-util \
 	jcommon-1.0.12 \
 	jfreechart-1.0.9 \
 	jfreechart-1.0.9-swt \
@@ -108,9 +106,9 @@
 	org.eclipse.jface_3.4.2.M20090107-0800 \
 	osgi \
 	layoutlib \
-        monkeyrunner \
-        guavalib \
-        jsr305lib \
+	monkeyrunner \
+	guavalib \
+	jsr305lib \
 	jython
 
 PRODUCT_PACKAGE_OVERLAYS := development/sdk_overlay
@@ -121,6 +119,7 @@
 	frameworks/base/data/sounds/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
 	frameworks/base/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml
 
+$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
 
 $(call inherit-product, $(SRC_TARGET_DIR)/product/locales_full.mk)