Use new aapt feature to add default version info to .apks.

This commit is contained in:
Dianne Hackborn
2009-05-15 18:01:20 -07:00
parent eefd0212f1
commit 9bd5404a9d
2 changed files with 29 additions and 3 deletions

View File

@@ -1122,7 +1122,11 @@ $(hide) $(AAPT) package $(PRIVATE_AAPT_FLAGS) -m -z \
$(addprefix -P , $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) \
$(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
$(addprefix -A , $(PRIVATE_ASSET_DIR)) \
$(addprefix -I , $(PRIVATE_AAPT_INCLUDES))
$(addprefix -I , $(PRIVATE_AAPT_INCLUDES)) \
$(addprefix --min-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
$(addprefix --target-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
$(addprefix --version-code , $(PLATFORM_SDK_VERSION)) \
$(addprefix --version-name , $(PLATFORM_VERSION))
endef
ifeq ($(HOST_OS),windows)
@@ -1250,6 +1254,9 @@ endef
# A list of dynamic and static parameters; build layers for
# dynamic params that lay over the static ones.
#TODO: update the manifest to point to the package file
#Note that the version numbers are given to aapt as simple default
#values; applications can override these by explicitly stating
#them in their manifest.
define add-assets-to-package
$(hide) $(AAPT) package -z -u $(PRIVATE_AAPT_FLAGS) \
$(addprefix -c , $(PRODUCT_AAPT_CONFIG)) \
@@ -1257,6 +1264,10 @@ $(hide) $(AAPT) package -z -u $(PRIVATE_AAPT_FLAGS) \
$(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
$(addprefix -A , $(PRIVATE_ASSET_DIR)) \
$(addprefix -I , $(PRIVATE_AAPT_INCLUDES)) \
$(addprefix --min-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
$(addprefix --target-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
$(addprefix --version-code , $(PLATFORM_SDK_VERSION)) \
$(addprefix --version-name , $(PLATFORM_VERSION)) \
-F $@
endef

View File

@@ -20,6 +20,8 @@
# Guarantees that the following are defined:
# PLATFORM_VERSION
# PLATFORM_SDK_VERSION
# PLATFORM_VERSION_CODENAME
# DEFAULT_APP_TARGET_SDK
# BUILD_ID
# BUILD_NUMBER
#
@@ -55,11 +57,24 @@ ifeq "" "$(PLATFORM_SDK_VERSION)"
endif
ifeq "" "$(PLATFORM_VERSION_CODENAME)"
# This is the current development code-name, if the build is not a final
# release build. If this is a final release build, it is simply "REL".
# If the build is not a final release build, then this is the current
# development code-name. If this is a final release build, it is simply "REL".
PLATFORM_VERSION_CODENAME := Donut
endif
ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
# This is the default minSdkVersion and targetSdkVersion to use for
# all .apks created by the build system. It can be overridden by explicitly
# setting these in the .apk's AndroidManifest.xml. It is either the code
# name of the development build or, if this is a release build, the official
# SDK version of this release.
ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION)
else
DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)
endif
endif
ifeq "" "$(BUILD_ID)"
# Used to signify special builds. E.g., branches and/or releases,
# like "M5-RC7". Can be an arbitrary string, but must be a single