2009-03-04 04:28:42 +01:00
|
|
|
#
|
|
|
|
# Copyright (C) 2008 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.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Standard rules for building a "static" java library.
|
|
|
|
# Static java libraries are not installed, nor listed on any
|
|
|
|
# classpaths. They can, however, be included wholesale in
|
|
|
|
# other java modules.
|
|
|
|
|
|
|
|
LOCAL_UNINSTALLABLE_MODULE := true
|
|
|
|
LOCAL_IS_STATIC_JAVA_LIBRARY := true
|
2013-03-26 20:42:32 +01:00
|
|
|
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
|
2011-12-14 23:29:28 +01:00
|
|
|
|
|
|
|
# Hack to build static Java library with Android resource
|
|
|
|
# See bug 5714516
|
|
|
|
all_resources :=
|
|
|
|
ifdef LOCAL_RESOURCE_DIR
|
|
|
|
all_resources := $(strip \
|
|
|
|
$(foreach dir, $(LOCAL_RESOURCE_DIR), \
|
|
|
|
$(addprefix $(dir)/, \
|
|
|
|
$(patsubst res/%,%, \
|
|
|
|
$(call find-subdir-assets,$(dir)) \
|
|
|
|
) \
|
|
|
|
) \
|
|
|
|
))
|
2011-12-16 01:36:55 +01:00
|
|
|
|
|
|
|
ifneq (,$(all_resources))
|
2012-06-19 19:40:37 +02:00
|
|
|
# By default we should remove the R/Manifest classes from a static Java library,
|
|
|
|
# because they will be regenerated in the app that uses it.
|
|
|
|
# But if the static Java library will be used by a library, then we may need to
|
|
|
|
# keep the generated classes with "LOCAL_JAR_EXCLUDE_FILES := none".
|
|
|
|
ifndef LOCAL_JAR_EXCLUDE_FILES
|
|
|
|
LOCAL_JAR_EXCLUDE_FILES := $(ANDROID_RESOURCE_GENERATED_CLASSES)
|
2011-12-14 23:29:28 +01:00
|
|
|
endif
|
2012-06-19 19:40:37 +02:00
|
|
|
ifeq (none,$(LOCAL_JAR_EXCLUDE_FILES))
|
|
|
|
LOCAL_JAR_EXCLUDE_FILES :=
|
2012-04-26 21:26:33 +02:00
|
|
|
endif
|
2013-03-26 20:42:32 +01:00
|
|
|
|
|
|
|
proguard_options_file :=
|
|
|
|
|
|
|
|
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
|
|
|
|
ifneq ($(LOCAL_PROGUARD_ENABLED),custom)
|
|
|
|
proguard_options_file := $(intermediates.COMMON)/proguard_options
|
|
|
|
endif
|
|
|
|
LOCAL_PROGUARD_FLAGS := $(addprefix -include ,$(proguard_options_file)) $(LOCAL_PROGUARD_FLAGS)
|
|
|
|
|
2012-06-19 19:40:37 +02:00
|
|
|
endif # all_resources
|
|
|
|
endif # LOCAL_RESOURCE_DIR
|
2011-12-14 23:29:28 +01:00
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
include $(BUILD_SYSTEM)/java_library.mk
|
2011-12-14 23:29:28 +01:00
|
|
|
|
|
|
|
ifneq (,$(all_resources))
|
|
|
|
R_file_stamp := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/R.stamp
|
|
|
|
|
|
|
|
ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
|
2013-03-26 20:42:32 +01:00
|
|
|
LOCAL_MANIFEST_FILE := AndroidManifest.xml
|
|
|
|
endif
|
|
|
|
ifdef LOCAL_FULL_MANIFEST_FILE
|
|
|
|
full_android_manifest := $(LOCAL_FULL_MANIFEST_FILE)
|
|
|
|
else
|
|
|
|
full_android_manifest := $(LOCAL_PATH)/$(LOCAL_MANIFEST_FILE)
|
2011-12-14 23:29:28 +01:00
|
|
|
endif
|
|
|
|
|
2012-01-03 20:52:26 +01:00
|
|
|
LOCAL_SDK_RES_VERSION:=$(strip $(LOCAL_SDK_RES_VERSION))
|
|
|
|
ifeq ($(LOCAL_SDK_RES_VERSION),)
|
|
|
|
LOCAL_SDK_RES_VERSION:=$(LOCAL_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
|
2011-12-14 23:29:28 +01:00
|
|
|
framework_res_package_export :=
|
|
|
|
framework_res_package_export_deps :=
|
|
|
|
# Please refer to package.mk
|
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
2012-05-11 02:25:51 +02:00
|
|
|
ifneq ($(filter-out current,$(LOCAL_SDK_RES_VERSION))$(if $(TARGET_BUILD_APPS),$(filter current,$(LOCAL_SDK_RES_VERSION))),)
|
2011-12-14 23:29:28 +01:00
|
|
|
framework_res_package_export := \
|
|
|
|
$(HISTORICAL_SDK_VERSIONS_ROOT)/$(LOCAL_SDK_RES_VERSION)/android.jar
|
|
|
|
framework_res_package_export_deps := $(framework_res_package_export)
|
|
|
|
else
|
|
|
|
framework_res_package_export := \
|
|
|
|
$(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
|
|
|
|
framework_res_package_export_deps := \
|
|
|
|
$(dir $(framework_res_package_export))src/R.stamp
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(R_file_stamp): PRIVATE_MODULE := $(LOCAL_MODULE)
|
|
|
|
# add --non-constant-id to prevent inlining constants.
|
|
|
|
$(R_file_stamp): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS) --non-constant-id
|
|
|
|
$(R_file_stamp): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
|
|
|
|
$(R_file_stamp): PRIVATE_ANDROID_MANIFEST := $(full_android_manifest)
|
|
|
|
$(R_file_stamp): PRIVATE_RESOURCE_PUBLICS_OUTPUT := $(intermediates.COMMON)/public_resources.xml
|
|
|
|
$(R_file_stamp): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
|
|
|
|
$(R_file_stamp): PRIVATE_AAPT_INCLUDES := $(framework_res_package_export)
|
|
|
|
ifneq (,$(filter-out current, $(LOCAL_SDK_VERSION)))
|
|
|
|
$(R_file_stamp): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
|
|
|
|
else
|
|
|
|
$(R_file_stamp): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
|
|
|
|
endif
|
|
|
|
$(R_file_stamp): PRIVATE_ASSET_DIR :=
|
2013-03-26 20:42:32 +01:00
|
|
|
$(R_file_stamp): PRIVATE_PROGUARD_OPTIONS_FILE := $(proguard_options_file)
|
2011-12-14 23:29:28 +01:00
|
|
|
$(R_file_stamp): PRIVATE_MANIFEST_PACKAGE_NAME :=
|
|
|
|
$(R_file_stamp): PRIVATE_MANIFEST_INSTRUMENTATION_FOR :=
|
|
|
|
|
|
|
|
$(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(framework_res_package_export_deps)
|
|
|
|
@echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(create-resource-java-files)
|
|
|
|
$(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name R.java | xargs cat > $@
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): $(R_file_stamp)
|
|
|
|
ifneq ($(full_classes_jar),)
|
|
|
|
$(full_classes_compiled_jar): $(R_file_stamp)
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif # $(all_resources) not empty
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
LOCAL_IS_STATIC_JAVA_LIBRARY :=
|