From 1046d20624318563aba92cfdd7eb7d39ecc44703 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 6 Aug 2009 13:02:19 -0700 Subject: [PATCH 1/4] add feature to strip "# comment" lines from prebuilt files Change things so that when $(LOCAL_PREBUILT_STRIP_COMMENTS) is nonempty, we copy the source file using sed to strip out all the "# line"-style comments and blank lines, saving considerable system image space in the case of some wifi configurations. Bug: 2036961 --- core/definitions.mk | 13 +++++++++++++ core/prebuilt.mk | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/core/definitions.mk b/core/definitions.mk index c84cbd867a..1c2f05b205 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1469,6 +1469,13 @@ define copy-file-to-target-with-cp $(hide) cp -fp $< $@ endef +# The same as copy-file-to-target, but strip out "# comment"-style +# comments (for config files and such). +define copy-file-to-target-strip-comments +@mkdir -p $(dir $@) +$(hide) sed -e 's/#.*$$//' -e 's/[ \t]*$$//' -e '/^$$/d' < $< > $@ +endef + # The same as copy-file-to-target, but don't preserve # the old modification time. define copy-file-to-new-target @@ -1489,6 +1496,12 @@ define transform-prebuilt-to-target $(copy-file-to-target) endef +# Copy a prebuilt file to a target location, stripping "# comment" comments. +define transform-prebuilt-to-target-strip-comments +@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt: $(PRIVATE_MODULE) ($@)" +$(copy-file-to-target-strip-comments) +endef + ########################################################### ## On some platforms (MacOS), after copying a static diff --git a/core/prebuilt.mk b/core/prebuilt.mk index 2d931624f4..8eaa922b75 100644 --- a/core/prebuilt.mk +++ b/core/prebuilt.mk @@ -3,7 +3,7 @@ ## ## Additional inputs from base_rules.make: ## None. -## +## ########################################################### ifneq ($(LOCAL_PREBUILT_LIBS),) @@ -26,8 +26,14 @@ else prebuilt_module_is_a_library := endif +ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),) +$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) + $(transform-prebuilt-to-target-strip-comments) +else $(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) $(transform-prebuilt-to-target) +endif + ifneq ($(prebuilt_module_is_a_library),) ifneq ($(LOCAL_IS_HOST_MODULE),) $(transform-host-ranlib-copy-hack) From d0a44722be82319e45b6616267011d4dd17e767b Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Thu, 6 Aug 2009 21:50:51 -0700 Subject: [PATCH 2/4] add LOCAL_PREBUILT_STRIP_COMMENTS to clear_vars.mk --- core/clear_vars.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 031bc0b477..28044c4590 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -47,6 +47,7 @@ LOCAL_PREBUILT_LIBS:= LOCAL_PREBUILT_EXECUTABLES:= LOCAL_PREBUILT_JAVA_LIBRARIES:= LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES:= +LOCAL_PREBUILT_STRIP_COMMENTS:= LOCAL_INTERMEDIATE_SOURCES:= LOCAL_JAVA_LIBRARIES:= LOCAL_NO_STANDARD_LIBRARIES:= From f7c8b9adb4b65fafac786e77f6dd7c3411344dba Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Fri, 7 Aug 2009 08:45:49 -0700 Subject: [PATCH 3/4] reenable ranlib transform for prebuilts An extra blank line detached the ranlib commands from the rules they were supposed to be for. --- core/prebuilt.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/core/prebuilt.mk b/core/prebuilt.mk index 8eaa922b75..6df276cb2f 100644 --- a/core/prebuilt.mk +++ b/core/prebuilt.mk @@ -33,7 +33,6 @@ else $(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP) $(transform-prebuilt-to-target) endif - ifneq ($(prebuilt_module_is_a_library),) ifneq ($(LOCAL_IS_HOST_MODULE),) $(transform-host-ranlib-copy-hack) From c539dbe6a2810818ac22f180e64bdc0256557532 Mon Sep 17 00:00:00 2001 From: Phil Dubach Date: Fri, 7 Aug 2009 10:59:04 -0700 Subject: [PATCH 4/4] CTS: Add missing integration of 147397 to fix VM tests For host side test packages, the name of the jar file containing the tests is declared in the packages Android.mk. The name of the make file needs to be passed to the description generator so that it can pick up this information. The makefile was not passing on the parameter containing the make file name. --- core/tasks/cts.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/tasks/cts.mk b/core/tasks/cts.mk index 42ad42a75a..4cb074eedd 100644 --- a/core/tasks/cts.mk +++ b/core/tasks/cts.mk @@ -106,13 +106,17 @@ $(cts_dir)/all_cts_files_stamp: $(CTS_CASE_LIST) $(junit_host_jar) $(ACP) $(hide) touch $@ # Generate the test descriptions for the core-tests - +# Parameters: +# $1 : The output file where the description should be written (without the '.xml' extension) +# $2 : The AndroidManifest.xml corresponding to the test package +# $3 : The name of the TestSuite generator class to use +# $4 : The Android.mk corresponding to the test package (required for host-side tests only) define generate-core-test-description @echo "Generate core-test description ("$(notdir $(1))")" $(hide) java $(PRIVATE_JAVAOPTS) \ -classpath $(PRIVATE_CLASSPATH) \ $(PRIVATE_PARAMS) CollectAllTests $(1) \ - $(2) $(3) + $(2) $(3) $(4) endef CORE_INTERMEDIATES :=$(call intermediates-dir-for,JAVA_LIBRARIES,core,,COMMON)