From 85fbcf4a680d04db703f417f5fc0b3eb06f5c2b7 Mon Sep 17 00:00:00 2001 From: Jayant Chowdhary Date: Mon, 27 Nov 2017 15:01:02 -0800 Subject: [PATCH] Export DIST_DIR to soong on dist builds. Bug: 64267858 Test: Adding DistDir to build/soong/android/variable.go enables access to DIST_DIR_SOONG. Change-Id: I74faea11255edf37db6a4eaf193df300c363bfb7 --- core/config.mk | 3 +++ core/distdir.mk | 3 --- core/soong_config.mk | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/core/config.mk b/core/config.mk index bebc18645..3f503ad38 100644 --- a/core/config.mk +++ b/core/config.mk @@ -67,6 +67,9 @@ FORCE: ORIGINAL_MAKECMDGOALS := $(MAKECMDGOALS) +dist_goal := $(strip $(filter dist,$(MAKECMDGOALS))) +MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS))) + # Tell python not to spam the source tree with .pyc files. This # only has an effect on python 2.6 and above. export PYTHONDONTWRITEBYTECODE := 1 diff --git a/core/distdir.mk b/core/distdir.mk index 89c5966c0..c074186b8 100644 --- a/core/distdir.mk +++ b/core/distdir.mk @@ -17,9 +17,6 @@ # When specifying "dist", the user has asked that we copy the important # files from this build into DIST_DIR. -dist_goal := $(strip $(filter dist,$(MAKECMDGOALS))) -MAKECMDGOALS := $(strip $(filter-out dist,$(MAKECMDGOALS))) - ifdef dist_goal # $(1): source file diff --git a/core/soong_config.mk b/core/soong_config.mk index 5ebd12311..a90e5af4f 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -119,6 +119,8 @@ $(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT $(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA))) +$(call add_json_str, DistDir, $(if $(dist_goal), $(DIST_DIR))) + _contents := $(subst $(comma)$(newline)__SV_END,$(newline)}$(newline),$(_contents)__SV_END) $(file >$(SOONG_VARIABLES).tmp,$(_contents))