Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit caffff96 authored by Ying Wang's avatar Ying Wang Committed by Android (Google) Code Review
Browse files

Merge "Support for unbundled app build"

parents b510ff81 1a031e41
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -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))|),)
+14 −5
Original line number Diff line number Diff line
@@ -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
#
+33 −6
Original line number Diff line number Diff line
@@ -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

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)
+7 −0
Original line number Diff line number Diff line
@@ -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