From 0f6f4ca54e3b283e3498064f47e2baac9a9c5db2 Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 9 Jun 2010 10:26:26 -0700 Subject: [PATCH] Unbundle the build system. Change-Id: I88912d876c3972212e8871b3e5b3b8b6d2da34d0 --- core/base_rules.mk | 2 +- core/config.mk | 28 ++++++++++++++++------------ core/package.mk | 13 ++++++++++--- core/tasks/apicheck.mk | 7 ++++++- tools/Android.mk | 23 +++++++++++++++++++++++ 5 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 tools/Android.mk diff --git a/core/base_rules.mk b/core/base_rules.mk index f0cbdca8c7..77135ae15e 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -190,7 +190,7 @@ aidl_preprocess_import := LOCAL_SDK_VERSION:=$(strip $(LOCAL_SDK_VERSION)) ifdef LOCAL_SDK_VERSION ifneq ($(LOCAL_SDK_VERSION),current) -aidl_preprocess_import := -p$(TOPDIR)prebuilt/sdk/$(LOCAL_SDK_VERSION)/framework.aidl +aidl_preprocess_import := -p$(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/framework.aidl endif # !current endif # LOCAL_SDK_VERSION $(aidl_java_sources): PRIVATE_AIDL_FLAGS := -b $(aidl_preprocess_import) -I$(LOCAL_PATH) -I$(LOCAL_PATH)/src $(addprefix -I,$(LOCAL_AIDL_INCLUDES)) diff --git a/core/config.mk b/core/config.mk index a4d3154f08..2dcd876fba 100644 --- a/core/config.mk +++ b/core/config.mk @@ -314,22 +314,26 @@ PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true) # For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE) # ############################################################### -# The files that we can convert into android.jars are are in config/api/*.xml -# The 'current' version is whatever this source tree is. Once the apicheck -# tool can generate the stubs from the xml files, we'll use that to be -# able to build back-versions. In the meantime, 'current' is the only -# one supported. +HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilt/sdk + +# Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N. +# The 'current' version is whatever this source tree is. # # sgrax is the opposite of xargs. It takes the list of args and puts them # on each line for sort to process. # sort -g is a numeric sort, so 1 2 3 10 instead of 1 10 2 3. -TARGET_AVAILABLE_SDK_VERSIONS := current \ - $(shell function sgrax() { \ - while [ -n "$$1" ] ; do echo $$1 ; shift ; done \ - } ; \ - ( sgrax $(patsubst $(SRC_API_DIR)/%.xml,%, \ - $(filter-out $(SRC_API_DIR)/current.xml, \ - $(shell find $(SRC_API_DIR) -name "*.xml"))) | sort -g ) ) +# Numerically sort a list of numbers +# $(1): the list of numbers to be sorted +define numerically_sort +$(shell function sgrax() { \ + while [ -n "$$1" ] ; do echo $$1 ; shift ; done \ + } ; \ + ( sgrax $(1) | sort -g ) ) +endef + +TARGET_AVAILABLE_SDK_VERSIONS := current $(call numerically_sort,\ + $(patsubst $(HISTORICAL_SDK_VERSIONS_ROOT)/%/android.jar,%, \ + $(wildcard $(HISTORICAL_SDK_VERSIONS_ROOT)/*/android.jar))) INTERNAL_PLATFORM_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/public_api.xml diff --git a/core/package.mk b/core/package.mk index d5de77b265..e7be05fdcf 100644 --- a/core/package.mk +++ b/core/package.mk @@ -244,17 +244,24 @@ else # Most packages should link against the resources defined by framework-res. # Even if they don't have their own resources, they may use framework # resources. +ifneq ($(filter-out current,$(LOCAL_SDK_VERSION)),) +# for released sdk versions, the platform resources were built into android.jar. +framework_res_package_export := \ + $(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_VERSION)/android.jar +framework_res_package_export_deps := $(framework_res_package_export) +else # LOCAL_SDK_VERSION framework_res_package_export := \ $(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk -$(LOCAL_INTERMEDIATE_TARGETS): \ - PRIVATE_AAPT_INCLUDES := $(framework_res_package_export) # We can't depend directly on the export.apk file; it won't get its # PRIVATE_ vars set up correctly if we do. Instead, depend on the # corresponding R.stamp file, which lists the export.apk as a dependency. framework_res_package_export_deps := \ $(dir $(framework_res_package_export))src/R.stamp +endif # LOCAL_SDK_VERSION $(R_file_stamp): $(framework_res_package_export_deps) -endif +$(LOCAL_INTERMEDIATE_TARGETS): \ + PRIVATE_AAPT_INCLUDES := $(framework_res_package_export) +endif # LOCAL_NO_STANDARD_LIBRARIES ifneq ($(full_classes_jar),) $(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex) diff --git a/core/tasks/apicheck.mk b/core/tasks/apicheck.mk index 044e4af7f7..740668c9ef 100644 --- a/core/tasks/apicheck.mk +++ b/core/tasks/apicheck.mk @@ -41,13 +41,18 @@ endef # Run the checkapi rules by default. droidcore: checkapi +last_released_sdk_version := $(lastword $(call numerically_sort,\ + $(patsubst $(SRC_API_DIR)/%.xml,%, \ + $(filter-out $(SRC_API_DIR)/current.xml, \ + $(wildcard $(SRC_API_DIR)/*.xml))))) + # INTERNAL_PLATFORM_API_FILE is the one build by droiddoc. # Check that the API we're building hasn't broken the last-released # SDK version. $(eval $(call check-api, \ checkapi-last, \ - $(SRC_API_DIR)/$(lastword $(TARGET_AVAILABLE_SDK_VERSIONS)).xml, \ + $(SRC_API_DIR)/$(last_released_sdk_version).xml, \ $(INTERNAL_PLATFORM_API_FILE), \ -hide 2 -hide 3 -hide 4 -hide 5 -hide 6 -hide 24 -hide 25 \ -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 -error 14 -error 15 \ diff --git a/tools/Android.mk b/tools/Android.mk new file mode 100644 index 0000000000..aea27857fb --- /dev/null +++ b/tools/Android.mk @@ -0,0 +1,23 @@ +# +# Copyright (C) 2010 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. +# + +LOCAL_PATH := $(my-dir) + +ifeq ($(strip $(is_unbundled_app_build)),true) +include $(LOCAL_PATH)/signapk/Android.mk +else +include $(call first-makefiles-under,$(LOCAL_PATH)) +endif