From 8a5d597bbfca272f6510d332b27b9162153f91a0 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Mon, 29 Jul 2019 14:22:05 -0700 Subject: [PATCH] Remove the PRODUCT-* goal I've switched all the build server configs to using TARGET_PRODUCT / TARGET_BUILD_VARIANT and explicit goals instead. Remove tools/check_builds.sh which relied on this, but hasn't been touched in a long time. Test: m PRODUCT-test Test: treehugger Change-Id: If5f8c714567b33aeb38223c176ca24ea649eb57d --- Usage.txt | 6 --- core/envsetup.mk | 9 ++++- core/main.mk | 2 + core/ninja_config.mk | 2 +- core/product_config.mk | 64 +---------------------------- tools/check_builds.sh | 92 ------------------------------------------ 6 files changed, 12 insertions(+), 163 deletions(-) delete mode 100644 tools/check_builds.sh diff --git a/Usage.txt b/Usage.txt index 558329bda..ea4788a1b 100644 --- a/Usage.txt +++ b/Usage.txt @@ -26,12 +26,6 @@ Ways to specify what to build: If no targets are specified, the build system will build the images for the configured product and variant. - An alternative to setting $TARGET_PRODUCT and $TARGET_BUILD_VARIANT, - which you may see in build servers, is to execute: - - m PRODUCT-- - - A target may be a file path. For example, out/host/linux-x86/bin/adb . Note that when giving a relative file path as a target, that path is interpreted relative to the root of the source tree (rather than relative diff --git a/core/envsetup.mk b/core/envsetup.mk index 05957cdb5..3e8fd3f84 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -82,8 +82,6 @@ CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 13 # --------------------------------------------------------------- # The product defaults to generic on hardware -# NOTE: This will be overridden in product_config.mk if make -# was invoked with a PRODUCT-xxx-yyy goal. ifeq ($(TARGET_PRODUCT),) TARGET_PRODUCT := aosp_arm endif @@ -94,6 +92,13 @@ ifeq ($(strip $(TARGET_BUILD_VARIANT)),) TARGET_BUILD_VARIANT := eng endif +TARGET_BUILD_APPS ?= + +.KATI_READONLY := \ + TARGET_PRODUCT \ + TARGET_BUILD_VARIANT \ + TARGET_BUILD_APPS + # --------------------------------------------------------------- # Set up configuration for host machine. We don't do cross- # compiles except for arm/mips, so the HOST is whatever we are diff --git a/core/main.mk b/core/main.mk index b7b6cd0fd..ecdbcbd73 100644 --- a/core/main.mk +++ b/core/main.mk @@ -194,6 +194,8 @@ $(info ***************************************************************) $(error stopping) endif +# These are the valid values of TARGET_BUILD_VARIANT. +INTERNAL_VALID_VARIANTS := user userdebug eng ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),) $(info ***************************************************************) $(info ***************************************************************) diff --git a/core/ninja_config.mk b/core/ninja_config.mk index 85a756838..e33ebf598 100644 --- a/core/ninja_config.mk +++ b/core/ninja_config.mk @@ -7,7 +7,7 @@ endif KATI_OUTPUT_PATTERNS := $(OUT_DIR)/build%.ninja $(OUT_DIR)/ninja%.sh # Modifier goals we don't need to pass to Ninja. -NINJA_EXCLUDE_GOALS := all PRODUCT-% +NINJA_EXCLUDE_GOALS := all # A list of goals which affect parsing of makefiles and we need to pass to Kati. PARSE_TIME_MAKE_GOALS := \ diff --git a/core/product_config.mk b/core/product_config.mk index 21d6a1693..1293c94fc 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -78,78 +78,18 @@ $(sort $(shell find $(2) -name "$(1)" -type f | $(SED_EXTENDED) "s:($(2)/?(.*)): endef # --------------------------------------------------------------- - -# These are the valid values of TARGET_BUILD_VARIANT. Also, if anything else is passed -# as the variant in the PRODUCT-$TARGET_BUILD_PRODUCT-$TARGET_BUILD_VARIANT form, -# it will be treated as a goal, and the eng variant will be used. -INTERNAL_VALID_VARIANTS := user userdebug eng - -# --------------------------------------------------------------- -# Provide "PRODUCT--" targets, which lets you build -# a particular configuration without needing to set up the environment. -# +# Check for obsolete PRODUCT- and APP- goals ifeq ($(CALLED_FROM_SETUP),true) product_goals := $(strip $(filter PRODUCT-%,$(MAKECMDGOALS))) ifdef product_goals - # Scrape the product and build names out of the goal, - # which should be of the form PRODUCT--. - # - ifneq ($(words $(product_goals)),1) - $(error Only one PRODUCT-* goal may be specified; saw "$(product_goals)") - endif - goal_name := $(product_goals) - product_goals := $(patsubst PRODUCT-%,%,$(product_goals)) - product_goals := $(subst -, ,$(product_goals)) - ifneq ($(words $(product_goals)),2) - $(error Bad PRODUCT-* goal "$(goal_name)") - endif - - # The product they want - TARGET_PRODUCT := $(word 1,$(product_goals)) - - # The variant they want - TARGET_BUILD_VARIANT := $(word 2,$(product_goals)) - - ifeq ($(TARGET_BUILD_VARIANT),tests) - $(error "tests" has been deprecated as a build variant. Use it as a build goal instead.) - endif - - # The build server wants to do make PRODUCT-dream-sdk - # which really means TARGET_PRODUCT=dream make sdk. - ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),) - override MAKECMDGOALS := $(MAKECMDGOALS) $(TARGET_BUILD_VARIANT) - TARGET_BUILD_VARIANT := userdebug - default_goal_substitution := - else - default_goal_substitution := droid - endif - - # Replace the PRODUCT-* goal with the build goal that it refers to. - # Note that this will ensure that it appears in the same relative - # position, in case it matters. - override MAKECMDGOALS := $(patsubst $(goal_name),$(default_goal_substitution),$(MAKECMDGOALS)) + $(error The PRODUCT-* goal is no longer supported. Use `TARGET_PRODUCT= m droid` instead) endif -endif # CALLED_FROM_SETUP -# else: Use the value set in the environment or buildspec.mk. - -# --------------------------------------------------------------- -# Provide "APP-" targets, which lets you build -# an unbundled app. -# -ifeq ($(CALLED_FROM_SETUP),true) unbundled_goals := $(strip $(filter APP-%,$(MAKECMDGOALS))) ifdef unbundled_goals $(error The APP-* goal is no longer supported. Use `TARGET_BUILD_APPS="" m droid` instead) endif # unbundled_goals endif -# Now that we've parsed APP-* and PRODUCT-*, mark these as readonly -TARGET_BUILD_APPS ?= -.KATI_READONLY := \ - TARGET_PRODUCT \ - TARGET_BUILD_VARIANT \ - TARGET_BUILD_APPS - # Default to building dalvikvm on hosts that support it... ifeq ($(HOST_OS),linux) # ... or if the if the option is already set diff --git a/tools/check_builds.sh b/tools/check_builds.sh deleted file mode 100644 index 7e4ea7c9b..000000000 --- a/tools/check_builds.sh +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright (C) 2009 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the 'License'); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an 'AS IS' BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# -# Usage: -# -# Source this file into your environment. Then: -# -# $ golden_builds sdk-sdk generic-eng generic-userdebug dream-eng -# -# will build a set of combos. This might take a while. Then you can -# go make changes, and run: -# -# $ check_builds sdk-sdk generic-eng generic-userdebug dream-eng -# -# Go get dinner, and when you get back, there will be a file -# test-builds/sizes.html that has a pretty chart of which files are -# in which tree, and how big they are. In that chart, cells for files -# that are missing are red, and rows where the file sizes are not all -# the same will be blue. -# - -TEST_BUILD_DIR=test-builds - -function do_builds -{ - PREFIX=$1 - shift - while [ -n "$1" ] - do - rm -rf $TEST_BUILD_DIR/$PREFIX-$1 - make PRODUCT-$(echo $1 | sed "s/-.*//" )-installclean - make -j16 PRODUCT-$1 dist DIST_DIR=$TEST_BUILD_DIR/$PREFIX-$1 - if [ $? -ne 0 ] ; then - echo FAILED - return - fi - shift - done -} - -function golden_builds -{ - rm -rf $TEST_BUILD_DIR/golden-* $TEST_BUILD_DIR/dist-* - do_builds golden "$@" -} - -function compare_builds -{ - local inputs= - while [ -n "$1" ] - do - inputs="$inputs $TEST_BUILD_DIR/golden-$1/installed-files.txt" - inputs="$inputs $TEST_BUILD_DIR/dist-$1/installed-files.txt" - shift - done - build/make/tools/compare_fileslist.py $inputs > $TEST_BUILD_DIR/sizes.html -} - -function check_builds -{ - rm -rf $TEST_BUILD_DIR/dist-* - do_builds dist "$@" - compare_builds "$@" -} - -function diff_builds -{ - local inputs= - while [ -n "$1" ] - do - diff $TEST_BUILD_DIR/golden-$1/installed-files.txt $TEST_BUILD_DIR/dist-$1/installed-files.txt &> /dev/null - if [ $? != 0 ]; then - echo =========== $1 =========== - diff $TEST_BUILD_DIR/golden-$1/installed-files.txt $TEST_BUILD_DIR/dist-$1/installed-files.txt - fi - shift - done - build/make/tools/compare_fileslist.py $inputs > $TEST_BUILD_DIR/sizes.html -} -