Fix mm and mmm in Android.bp directories
mm and mmm were not parsing out/soong/Android.mk, so they were ignoring all modules defined in an Android.bp file. Always include out/soong/Android.mk when ONE_SHOT_MAKEFILE is set, and convert the mm and mmm functions to build MODULES-IN-$DIR instead of all_modules so that only the subset of modules defined in out/soong/Android.mk for the requested directory are built. Bug: 28986194 Change-Id: I6e1ff8cacfc668a4154a0d5937450db840bb7a6b
This commit is contained in:
@@ -105,4 +105,4 @@ endif
|
|||||||
# variable will be changed. After you have modified this file with the new
|
# variable will be changed. After you have modified this file with the new
|
||||||
# changes (see buildspec.mk.default), update this to the new value from
|
# changes (see buildspec.mk.default), update this to the new value from
|
||||||
# buildspec.mk.default.
|
# buildspec.mk.default.
|
||||||
BUILD_ENV_SEQUENCE_NUMBER := 10
|
BUILD_ENV_SEQUENCE_NUMBER := 11
|
||||||
|
@@ -20,7 +20,7 @@ include $(BUILD_SYSTEM)/version_defaults.mk
|
|||||||
# people who haven't re-run those will have to do so before they
|
# people who haven't re-run those will have to do so before they
|
||||||
# can build. Make sure to also update the corresponding value in
|
# can build. Make sure to also update the corresponding value in
|
||||||
# buildspec.mk.default and envsetup.sh.
|
# buildspec.mk.default and envsetup.sh.
|
||||||
CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 10
|
CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 11
|
||||||
|
|
||||||
# ---------------------------------------------------------------
|
# ---------------------------------------------------------------
|
||||||
# The product defaults to generic on hardware
|
# The product defaults to generic on hardware
|
||||||
|
@@ -515,7 +515,7 @@ endif
|
|||||||
ifneq ($(ONE_SHOT_MAKEFILE),)
|
ifneq ($(ONE_SHOT_MAKEFILE),)
|
||||||
# We've probably been invoked by the "mm" shell function
|
# We've probably been invoked by the "mm" shell function
|
||||||
# with a subdirectory's makefile.
|
# with a subdirectory's makefile.
|
||||||
include $(ONE_SHOT_MAKEFILE)
|
include $(SOONG_ANDROID_MK) $(call filter-soong-makefiles,$(ONE_SHOT_MAKEFILE))
|
||||||
# Change CUSTOM_MODULES to include only modules that were
|
# Change CUSTOM_MODULES to include only modules that were
|
||||||
# defined by this makefile; this will install all of those
|
# defined by this makefile; this will install all of those
|
||||||
# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
|
# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
|
||||||
|
31
envsetup.sh
31
envsetup.sh
@@ -290,7 +290,7 @@ function set_stuff_for_environment()
|
|||||||
|
|
||||||
function set_sequence_number()
|
function set_sequence_number()
|
||||||
{
|
{
|
||||||
export BUILD_ENV_SEQUENCE_NUMBER=10
|
export BUILD_ENV_SEQUENCE_NUMBER=11
|
||||||
}
|
}
|
||||||
|
|
||||||
function settitle()
|
function settitle()
|
||||||
@@ -749,7 +749,7 @@ function findmakefile()
|
|||||||
T=
|
T=
|
||||||
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
|
while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
|
||||||
T=`PWD= /bin/pwd`
|
T=`PWD= /bin/pwd`
|
||||||
if [ -f "$T/Android.mk" ]; then
|
if [ -f "$T/Android.mk" -o -f "$T/Android.bp" ]; then
|
||||||
echo $T/Android.mk
|
echo $T/Android.mk
|
||||||
\cd $HERE
|
\cd $HERE
|
||||||
return
|
return
|
||||||
@@ -791,7 +791,9 @@ function mm()
|
|||||||
MODULES=
|
MODULES=
|
||||||
ARGS=GET-INSTALL-PATH
|
ARGS=GET-INSTALL-PATH
|
||||||
else
|
else
|
||||||
MODULES=all_modules
|
MODULES=MODULES-IN-$(dirname ${M})
|
||||||
|
# Convert "/" to "-".
|
||||||
|
MODULES=${MODULES//\//-}
|
||||||
ARGS=$@
|
ARGS=$@
|
||||||
fi
|
fi
|
||||||
if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
|
if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
|
||||||
@@ -809,18 +811,25 @@ function mmm()
|
|||||||
if [ "$T" ]; then
|
if [ "$T" ]; then
|
||||||
local MAKEFILE=
|
local MAKEFILE=
|
||||||
local MODULES=
|
local MODULES=
|
||||||
|
local MODULES_IN_PATHS=
|
||||||
local ARGS=
|
local ARGS=
|
||||||
local DIR TO_CHOP
|
local DIR TO_CHOP
|
||||||
|
local DIR_MODULES
|
||||||
local GET_INSTALL_PATH=
|
local GET_INSTALL_PATH=
|
||||||
local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
|
local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
|
||||||
local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
|
local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
|
||||||
for DIR in $DIRS ; do
|
for DIR in $DIRS ; do
|
||||||
MODULES=`echo $DIR | sed -n -e 's/.*:\(.*$\)/\1/p' | sed 's/,/ /'`
|
DIR_MODULES=`echo $DIR | sed -n -e 's/.*:\(.*$\)/\1/p' | sed 's/,/ /'`
|
||||||
if [ "$MODULES" = "" ]; then
|
|
||||||
MODULES=all_modules
|
|
||||||
fi
|
|
||||||
DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'`
|
DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'`
|
||||||
if [ -f $DIR/Android.mk ]; then
|
# Remove the leading ./ and trailing / if any exists.
|
||||||
|
DIR=${DIR#./}
|
||||||
|
DIR=${DIR%/}
|
||||||
|
if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then
|
||||||
|
if [ "$DIR_MODULES" = "" ]; then
|
||||||
|
MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$DIR"
|
||||||
|
else
|
||||||
|
MODULES="$MODULES $DIR_MODULES"
|
||||||
|
fi
|
||||||
local TO_CHOP=`(\cd -P -- $T && pwd -P) | wc -c | tr -d ' '`
|
local TO_CHOP=`(\cd -P -- $T && pwd -P) | wc -c | tr -d ' '`
|
||||||
local TO_CHOP=`expr $TO_CHOP + 1`
|
local TO_CHOP=`expr $TO_CHOP + 1`
|
||||||
local START=`PWD= /bin/pwd`
|
local START=`PWD= /bin/pwd`
|
||||||
@@ -847,11 +856,15 @@ function mmm()
|
|||||||
if [ -n "$GET_INSTALL_PATH" ]; then
|
if [ -n "$GET_INSTALL_PATH" ]; then
|
||||||
ARGS=$GET_INSTALL_PATH
|
ARGS=$GET_INSTALL_PATH
|
||||||
MODULES=
|
MODULES=
|
||||||
|
MODULES_IN_PATHS=
|
||||||
fi
|
fi
|
||||||
if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
|
if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
|
||||||
MODULES=tidy_only
|
MODULES=tidy_only
|
||||||
|
MODULES_IN_PATHS=
|
||||||
fi
|
fi
|
||||||
ONE_SHOT_MAKEFILE="$MAKEFILE" $DRV make -C $T -f build/core/main.mk $DASH_ARGS $MODULES $ARGS
|
# Convert "/" to "-".
|
||||||
|
MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
|
||||||
|
ONE_SHOT_MAKEFILE="$MAKEFILE" $DRV make -C $T -f build/core/main.mk $DASH_ARGS $MODULES $MODULES_IN_PATHS $ARGS
|
||||||
else
|
else
|
||||||
echo "Couldn't locate the top of the tree. Try setting TOP."
|
echo "Couldn't locate the top of the tree. Try setting TOP."
|
||||||
return 1
|
return 1
|
||||||
|
Reference in New Issue
Block a user