Clean up DIST_DIR usages, move to dist-for-goals

soong_ui now guarantees DIST_DIR is set in the environment, so remove
the default.

Use dist-for-goals instead of writing directly into DIST_DIR.

When building the system image, use DIST_DIR from the environment
instead of from make. This will eventually stop working, but this will
work for now.

Bug: 117463001
Test: m dist  (check gpl_source.tgz, logs/product_copy_files_ignored.txt)
Test: m out/target/product/generic/product_copy_files_ignored.txt
Change-Id: Ice557e0a148602cb8eb154efb747d416f0d0db59
This commit is contained in:
Dan Willemsen 2018-10-16 23:15:08 -07:00
parent d5eb793c40
commit 7537fd050f
4 changed files with 13 additions and 21 deletions

View file

@ -42,11 +42,14 @@ $(foreach cf,$(unique_product_copy_files_pairs), \
$(eval unique_product_copy_files_destinations += $(_dest))))
# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
$(file >$(PRODUCT_OUT)/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
ifdef dist_goal
$(file >$(DIST_DIR)/logs/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
endif
pcf_ignored_file := $(PRODUCT_OUT)/product_copy_files_ignored.txt
$(pcf_ignored_file): PRIVATE_IGNORED := $(sort $(product_copy_files_ignored))
$(pcf_ignored_file):
echo "$(PRIVATE_IGNORED)" | tr " " "\n" >$@
$(call dist-for-goals,droidcore,$(pcf_ignored_file):logs/$(notdir $(pcf_ignored_file)))
pcf_ignored_file :=
product_copy_files_ignored :=
unique_product_copy_files_pairs :=
unique_product_copy_files_destinations :=
@ -1918,7 +1921,7 @@ define build-systemimage-target
build/make/tools/releasetools/build_image.py \
$(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
$(systemimage_intermediates)/generated_system_image_info.txt \
|| ( mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
|| ( mkdir -p $$(DIST_DIR); cp $(INSTALLED_FILES_FILE) $$(DIST_DIR)/installed-files-rescued.txt; \
exit 1 )
endef

View file

@ -50,7 +50,7 @@ backslash := $(patsubst %a,%,$(backslash))
# Mark variables that should be coming as environment variables from soong_ui
# as readonly
.KATI_READONLY := OUT_DIR TMPDIR BUILD_DATETIME_FILE
.KATI_READONLY := OUT_DIR TMPDIR BUILD_DATETIME_FILE DIST_DIR
# Mark variables deprecated/obsolete
CHANGES_URL := https://android.googlesource.com/platform/build/+/master/Changes.md

View file

@ -1036,11 +1036,6 @@ COMMON_MODULE_CLASSES := TARGET-NOTICE_FILES HOST-NOTICE_FILES HOST-JAVA_LIBRARI
PER_ARCH_MODULE_CLASSES := SHARED_LIBRARIES STATIC_LIBRARIES EXECUTABLES GYP RENDERSCRIPT_BITCODE NATIVE_TESTS HEADER_LIBRARIES
.KATI_READONLY := COMMON_MODULE_CLASSES PER_ARCH_MODULE_CLASSES
ifeq (,$(strip $(DIST_DIR)))
DIST_DIR := $(OUT_DIR)/dist
endif
.KATI_READONLY := DIST_DIR
ifeq ($(CALLED_FROM_SETUP),true)
PRINT_BUILD_CONFIG ?= true
endif

View file

@ -12,12 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
ifdef dist_goal
# The rule below doesn't have dependenices on the files that it copies,
# so manually generate directly into the DIST_DIR directory that is always
# wiped between dist builds.
gpl_source_tgz := $(DIST_DIR)/gpl_source.tgz
# so manually generate into a PACKAGING intermediate dir, which is wiped
# in installclean between incremental builds on build servers.
gpl_source_tgz := $(call intermediates-dir-for,PACKAGING,gpl_source)/gpl_source.tgz
# FORCE since we can't know whether any of the sources changed
$(gpl_source_tgz): PRIVATE_PATHS := $(sort $(patsubst %/, %, $(dir $(ALL_GPL_MODULE_LICENSE_FILES))))
@ -26,8 +24,4 @@ $(gpl_source_tgz) : $(ALL_GPL_MODULE_LICENSE_FILES)
$(hide) tar cfz $@ --exclude ".git*" $(PRIVATE_PATHS)
# Dist the tgz only if we are doing a full build
ifeq (,$(TARGET_BUILD_APPS))
droidcore: $(gpl_source_tgz)
endif
endif # dist_goal
$(call dist-for-goals,droidcore,$(gpl_source_tgz))