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 host java library.
|
|
|
|
#
|
|
|
|
|
|
|
|
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
|
|
|
|
LOCAL_MODULE_SUFFIX := $(COMMON_JAVA_PACKAGE_SUFFIX)
|
|
|
|
LOCAL_IS_HOST_MODULE := true
|
|
|
|
LOCAL_BUILT_MODULE_STEM := javalib.jar
|
|
|
|
|
2010-09-11 01:19:24 +02:00
|
|
|
ifeq ($(LOCAL_BUILD_HOST_DEX),true)
|
2012-12-04 00:49:13 +01:00
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
|
|
|
LOCAL_JAVA_LIBRARIES := $(sort core-hostdex $(LOCAL_JAVA_LIBRARIES))
|
|
|
|
endif
|
|
|
|
|
2010-09-24 01:29:53 +02:00
|
|
|
intermediates := $(call local-intermediates-dir)
|
|
|
|
intermediates.COMMON := $(call local-intermediates-dir,COMMON)
|
|
|
|
|
2011-01-27 00:09:47 +01:00
|
|
|
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
|
|
|
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
2010-09-11 01:19:24 +02:00
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
|
|
|
built_dex := $(intermediates.COMMON)/classes.dex
|
|
|
|
|
2010-09-24 01:29:53 +02:00
|
|
|
LOCAL_INTERMEDIATE_TARGETS += \
|
2011-01-27 00:09:47 +01:00
|
|
|
$(full_classes_compiled_jar) \
|
|
|
|
$(full_classes_jarjar_jar) \
|
2010-09-24 01:29:53 +02:00
|
|
|
$(full_classes_jar) \
|
|
|
|
$(built_dex)
|
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_SOURCE_DIR := $(intermediates.COMMON)/src
|
2013-01-30 20:22:06 +01:00
|
|
|
# See comment in java.mk
|
|
|
|
java_alternative_checked_module := $(full_classes_compiled_jar)
|
|
|
|
|
2010-09-24 01:29:53 +02:00
|
|
|
endif # LOCAL_BUILD_HOST_DEX
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
|
2013-01-30 20:22:06 +01:00
|
|
|
java_alternative_checked_module :=
|
|
|
|
|
2012-10-27 01:25:05 +02:00
|
|
|
# The layers file allows you to enforce a layering between java packages.
|
|
|
|
# Run build/tools/java-layers.py for more details.
|
|
|
|
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
|
|
|
|
|
2010-09-24 01:29:53 +02:00
|
|
|
ifeq ($(LOCAL_BUILD_HOST_DEX),true)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
|
|
|
|
|
|
|
|
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
|
|
|
|
|
2012-10-27 01:25:05 +02:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
2011-01-27 00:09:47 +01:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
|
2011-12-16 01:36:55 +01:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
|
2012-10-10 04:39:43 +02:00
|
|
|
$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \
|
|
|
|
$(jar_manifest_file) $(LOCAL_ADDITIONAL_DEPENDENCIES)
|
2010-09-11 01:19:24 +02:00
|
|
|
$(transform-host-java-to-package)
|
|
|
|
|
2011-01-27 00:09:47 +01:00
|
|
|
# Run jarjar if necessary, otherwise just copy the file.
|
|
|
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
|
|
|
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
|
|
|
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(JARJAR)
|
|
|
|
@echo JarJar: $@
|
|
|
|
$(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
|
|
else
|
|
|
|
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
|
|
|
|
@echo Copying: $@
|
|
|
|
$(hide) $(ACP) -fp $< $@
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
|
|
|
|
@echo Copying: $@
|
|
|
|
$(hide) $(ACP) -fp $< $@
|
|
|
|
|
2010-09-11 01:19:24 +02:00
|
|
|
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
|
|
|
|
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
|
|
|
$(built_dex): $(full_classes_jar) $(DX)
|
|
|
|
$(transform-classes.jar-to-dex)
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) | $(AAPT)
|
|
|
|
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(create-empty-package)
|
|
|
|
$(add-dex-to-package)
|
2012-08-10 00:20:50 +02:00
|
|
|
$(add-carried-java-resources)
|
2010-09-11 01:19:24 +02:00
|
|
|
ifneq ($(extra_jar_args),)
|
|
|
|
$(add-java-resources-to-package)
|
|
|
|
endif
|
|
|
|
|
|
|
|
else
|
2010-02-01 20:13:32 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
|
2011-12-16 01:36:55 +01:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_JAR_EXCLUDE_FILES :=
|
2012-10-27 01:25:05 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
2012-10-10 04:39:43 +02:00
|
|
|
$(LOCAL_BUILT_MODULE): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \
|
|
|
|
$(jar_manifest_file) $(LOCAL_ADDITIONAL_DEPENDENCIES)
|
2009-03-04 04:28:42 +01:00
|
|
|
$(transform-host-java-to-package)
|
2010-09-11 01:19:24 +02:00
|
|
|
endif # LOCAL_BUILD_HOST_DEX
|