Support for unbundled app build

With this CL, run "make APP-{appname}" to build unbundled app in
the unbundled app src tree.
See http://b/issue?id=2667113

Change-Id: I1d753db795142508bc841ae66b4408220ab687c5
This commit is contained in:
Ying Wang 2010-05-10 16:35:39 -07:00
parent 11905ca038
commit 1a031e411e
4 changed files with 62 additions and 12 deletions

View file

@ -691,7 +691,14 @@ droidcore: files \
# The actual files built by the droidcore target changes depending
# on the build variant.
.PHONY: droid tests
droid tests: droidcore
ifeq ($(strip $(is_unbundled_app_build)),true)
# We build all modules in the source tree for an unbundled app build.
unbundled_build_modules := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS)))
droid: $(unbundled_build_modules)
else
droid: droidcore
endif
tests: droidcore
# Dist for droid if droid is among the cmd goals, or no cmd goal is given.
ifneq ($(filter droid,$(MAKECMDGOALS))$(filter ||,|$(filter-out $(INTERNAL_MODIFIER_TARGETS),$(MAKECMDGOALS))|),)

View file

@ -29,13 +29,13 @@ $(shell test -d device && find device -maxdepth 6 -name AndroidProducts.mk) \
endef
#
# Returns the sorted concatenation of all PRODUCT_MAKEFILES
# variables set in all AndroidProducts.mk files.
# $(call ) isn't necessary.
# Returns the sorted concatenation of PRODUCT_MAKEFILES
# variables set in the given AndroidProducts.mk files.
# $(1): the list of AndroidProducts.mk files.
#
define get-all-product-makefiles
define get-product-makefiles
$(sort \
$(foreach f,$(_find-android-products-files), \
$(foreach f,$(1), \
$(eval PRODUCT_MAKEFILES :=) \
$(eval LOCAL_DIR := $(patsubst %/,%,$(dir $(f)))) \
$(eval include $(f)) \
@ -46,6 +46,15 @@ $(sort \
)
endef
#
# Returns the sorted concatenation of all PRODUCT_MAKEFILES
# variables set in all AndroidProducts.mk files.
# $(call ) isn't necessary.
#
define get-all-product-makefiles
$(call get-product-makefiles,$(_find-android-products-files))
endef
#
# Functions for including product makefiles
#

View file

@ -148,6 +148,27 @@ $(goal_name): $(MAKECMDGOALS)
endif
# else: Use the value set in the environment or buildspec.mk.
# ---------------------------------------------------------------
# Provide "APP-<appname>" targets, which lets you build
# an unbundled app.
#
unbundled_goals := $(strip $(filter APP-%,$(MAKECMDGOALS)))
ifdef unbundled_goals
ifneq ($(words $(unbundled_goals)),1)
$(error Only one APP-* goal may be specified; saw "$(unbundled_goals)"))
endif
UNBUNDLED_APP := $(patsubst APP-%,%,$(unbundled_goals))
ifneq ($(filter $(DEFAULT_GOAL),$(MAKECMDGOALS)),)
MAKECMDGOALS := $(patsubst $(unbundled_goals),,$(MAKECMDGOALS))
else
MAKECMDGOALS := $(patsubst $(unbundled_goals),$(DEFAULT_GOAL),$(MAKECMDGOALS))
endif
is_unbundled_app_build := true
.PHONY: $(unbundled_goals)
$(unbundled_goals): $(MAKECMDGOALS)
endif # unbundled_goals
# ---------------------------------------------------------------
# Include the product definitions.
# We need to do this to translate TARGET_PRODUCT into its
@ -157,12 +178,18 @@ include $(BUILD_SYSTEM)/node_fns.mk
include $(BUILD_SYSTEM)/product.mk
include $(BUILD_SYSTEM)/device.mk
# Read in all of the product definitions specified by the AndroidProducts.mk
# files in the tree.
#
#TODO: when we start allowing direct pointers to product files,
# guarantee that they're in this list.
$(call import-products, $(get-all-product-makefiles))
ifeq ($(strip $(is_unbundled_app_build)),true)
# An unbundled app build needs only the core product makefiles.
$(call import-products,$(call get-product-makefiles,\
$(SRC_TARGET_DIR)/product/AndroidProducts.mk))
else
# Read in all of the product definitions specified by the AndroidProducts.mk
# files in the tree.
#
#TODO: when we start allowing direct pointers to product files,
# guarantee that they're in this list.
$(call import-products, $(get-all-product-makefiles))
endif # is_unbundled_app_build
$(check-all-products)
#$(dump-products)
#$(error done)

View file

@ -25,6 +25,12 @@
# it includes.
#
ifeq ($(strip $(is_unbundled_app_build)),true)
# An unbundled app build needs only generic.mk.
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/core.mk \
$(LOCAL_DIR)/generic.mk
else
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/core.mk \
$(LOCAL_DIR)/generic.mk \
@ -33,3 +39,4 @@ PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/sdk.mk \
$(LOCAL_DIR)/sim.mk \
$(LOCAL_DIR)/large_emu_hw.mk
endif