Merge changes Ib0fdae2e,Ib8b9e0f8 into nyc-dev

* changes:
  Handle symlinked OUT_DIRs (again)
  Handle out being a symlink
This commit is contained in:
Colin Cross 2016-03-30 22:18:33 +00:00 committed by Android (Google) Code Review
commit bbb7b1b620
3 changed files with 31 additions and 19 deletions

View File

@ -116,11 +116,6 @@ ifndef BUILDING_WITH_NINJA
$(shell rm -f $(OUT_DIR)/ninja_build) $(shell rm -f $(OUT_DIR)/ninja_build)
endif endif
# With these files findleaves.py won't be unnecessarily slower even if
# there is a user creates a copy of $(OUT_DIR).
$(shell echo '# This file prevents findleaves.py from traversing this directory further' > $(OUT_DIR)/Android.mk)
$(shell echo '# This file prevents findleaves.py from traversing this directory further' > $(OUT_DIR)/CleanSpec.mk)
# Write the build number to a file so it can be read back in # Write the build number to a file so it can be read back in
# without changing the command line every time. Avoids rebuilds # without changing the command line every time. Avoids rebuilds
# when using ninja. # when using ninja.

View File

@ -147,11 +147,18 @@ ninja_wrapper: $(COMBINED_BUILD_NINJA) $(MAKEPARALLEL)
@echo Starting build with ninja @echo Starting build with ninja
+$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && $(NINJA_MAKEPARALLEL) $(NINJA) $(NINJA_GOALS) -C $(TOP) -f $(COMBINED_BUILD_NINJA) $(NINJA_ARGS) +$(hide) export NINJA_STATUS="$(NINJA_STATUS)" && source $(KATI_ENV_SH) && $(NINJA_MAKEPARALLEL) $(NINJA) $(NINJA_GOALS) -C $(TOP) -f $(COMBINED_BUILD_NINJA) $(NINJA_ARGS)
# Dummy Android.mk and CleanSpec.mk files so that kati won't recurse into the
# out directory
DUMMY_OUT_MKS := $(OUT_DIR)/Android.mk $(OUT_DIR)/CleanSpec.mk
$(DUMMY_OUT_MKS):
@mkdir -p $(dir $@)
$(hide) echo '# This file prevents findleaves.py from traversing this directory further' >$@
KATI_FIND_EMULATOR := --use_find_emulator KATI_FIND_EMULATOR := --use_find_emulator
ifeq ($(KATI_EMULATE_FIND),false) ifeq ($(KATI_EMULATE_FIND),false)
KATI_FIND_EMULATOR := KATI_FIND_EMULATOR :=
endif endif
$(KATI_BUILD_NINJA): $(KATI) $(MAKEPARALLEL) $(SOONG_ANDROID_MK) FORCE $(KATI_BUILD_NINJA): $(KATI) $(MAKEPARALLEL) $(DUMMY_OUT_MKS) $(SOONG_ANDROID_MK) FORCE
@echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja... @echo Running kati to generate build$(KATI_NINJA_SUFFIX).ninja...
+$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --no_ignore_dirty=$(SOONG_ANDROID_MK) --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo $(KATI_FIND_EMULATOR) -f build/core/main.mk $(KATI_GOALS) --gen_all_targets BUILDING_WITH_NINJA=true SOONG_ANDROID_MK=$(SOONG_ANDROID_MK) +$(hide) $(KATI_MAKEPARALLEL) $(KATI) --ninja --ninja_dir=$(OUT_DIR) --ninja_suffix=$(KATI_NINJA_SUFFIX) --regen --ignore_dirty=$(OUT_DIR)/% --no_ignore_dirty=$(SOONG_ANDROID_MK) --ignore_optional_include=$(OUT_DIR)/%.P --detect_android_echo $(KATI_FIND_EMULATOR) -f build/core/main.mk $(KATI_GOALS) --gen_all_targets BUILDING_WITH_NINJA=true SOONG_ANDROID_MK=$(SOONG_ANDROID_MK)

View File

@ -1,23 +1,33 @@
SOONG_OUT_DIR := $(OUT_DIR)/soong SOONG_OUT_DIR := $(OUT_DIR)/soong
SOONG := $(SOONG_OUT_DIR)/soong
SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja
SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk
SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make
SOONG_HOST_EXECUTABLES := $(SOONG_OUT_DIR)/host/$(HOST_PREBUILT_TAG)/bin SOONG_HOST_EXECUTABLES := $(SOONG_OUT_DIR)/host/$(HOST_PREBUILT_TAG)/bin
KATI := $(SOONG_HOST_EXECUTABLES)/ckati KATI := $(SOONG_HOST_EXECUTABLES)/ckati
MAKEPARALLEL := $(SOONG_HOST_EXECUTABLES)/makeparallel MAKEPARALLEL := $(SOONG_HOST_EXECUTABLES)/makeparallel
ifeq (,$(filter /%,$(SOONG_OUT_DIR))) SOONG := $(SOONG_OUT_DIR)/soong
SOONG_TOP_RELPATH := $(shell python -c "import os; print os.path.relpath('$(TOP)', '$(SOONG_OUT_DIR)')") SOONG_BOOTSTRAP := $(SOONG_OUT_DIR)/.soong.bootstrap
else SOONG_BUILD_NINJA := $(SOONG_OUT_DIR)/build.ninja
SOONG_TOP_RELPATH := $(realpath $(TOP)) SOONG_ANDROID_MK := $(SOONG_OUT_DIR)/Android.mk
SOONG_IN_MAKE := $(SOONG_OUT_DIR)/.soong.in_make
SOONG_VARIABLES := $(SOONG_OUT_DIR)/soong.variables
# We need to rebootstrap soong if SOONG_OUT_DIR or the reverse path from
# SOONG_OUT_DIR to TOP changes
SOONG_NEEDS_REBOOTSTRAP :=
ifneq ($(wildcard $(SOONG_BOOTSTRAP)),)
ifneq ($(SOONG_OUT_DIR),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$BUILDDIR)))
SOONG_NEEDS_REBOOTSTRAP := FORCE
$(warning soong_out_dir changed)
endif
ifneq ($(strip $(shell build/soong/reverse_path.py $(SOONG_OUT_DIR))),$(strip $(shell source $(SOONG_BOOTSTRAP); echo $$SRCDIR_FROM_BUILDDIR)))
SOONG_NEEDS_REBOOTSTRAP := FORCE
$(warning reverse path changed)
endif
endif endif
# Bootstrap soong. Run only the first time for clean builds # Bootstrap soong.
$(SOONG): $(SOONG_BOOTSTRAP): bootstrap.bash $(SOONG_NEEDS_REBOOTSTRAP)
$(hide) mkdir -p $(dir $@) $(hide) mkdir -p $(dir $@)
$(hide) cd $(dir $@) && $(SOONG_TOP_RELPATH)/bootstrap.bash $(hide) BUILDDIR=$(SOONG_OUT_DIR) ./bootstrap.bash
# Create soong.variables with copies of makefile settings. Runs every build, # Create soong.variables with copies of makefile settings. Runs every build,
# but only updates soong.variables if it changes # but only updates soong.variables if it changes
@ -63,7 +73,7 @@ $(SOONG_IN_MAKE):
$(hide) touch $@ $(hide) touch $@
# Build an Android.mk listing all soong outputs as prebuilts # Build an Android.mk listing all soong outputs as prebuilts
$(SOONG_ANDROID_MK): $(SOONG) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE $(SOONG_ANDROID_MK): $(SOONG_BOOTSTRAP) $(SOONG_VARIABLES) $(SOONG_IN_MAKE) FORCE
$(hide) $(SOONG) $(KATI) $(MAKEPARALLEL) $(NINJA_ARGS) $(hide) $(SOONG) $(KATI) $(MAKEPARALLEL) $(NINJA_ARGS)
$(KATI): $(SOONG_ANDROID_MK) $(KATI): $(SOONG_ANDROID_MK)