1# 2# Copyright (C) 2013 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16 17# 18# Rules for building a host dalvik java library. These libraries 19# are meant to be used by a dalvik VM instance running on the host. 20# They will be compiled against libcore and not the host JRE. 21# 22 23USE_CORE_LIB_BOOTCLASSPATH := true 24 25####################################### 26include $(BUILD_SYSTEM)/host_java_library_common.mk 27####################################### 28 29ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true) 30 LOCAL_JAVA_LIBRARIES += core-libart-hostdex 31endif 32 33full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar 34full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar 35full_classes_jar := $(intermediates.COMMON)/classes.jar 36built_dex := $(intermediates.COMMON)/classes.dex 37 38LOCAL_INTERMEDIATE_TARGETS += \ 39 $(full_classes_compiled_jar) \ 40 $(full_classes_jarjar_jar) \ 41 $(full_classes_jar) \ 42 $(built_dex) 43 44# See comment in java.mk 45java_alternative_checked_module := $(full_classes_compiled_jar) 46 47####################################### 48include $(BUILD_SYSTEM)/base_rules.mk 49####################################### 50 51$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g 52 53java_alternative_checked_module := 54 55# The layers file allows you to enforce a layering between java packages. 56# Run build/tools/java-layers.py for more details. 57layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE)) 58 59$(LOCAL_INTERMEDIATE_TARGETS): \ 60 PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes 61$(LOCAL_INTERMEDIATE_TARGETS): \ 62 PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR) 63 64$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON) 65 66$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) 67$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) 68$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := 69$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := 70$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := 71$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := 72$(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \ 73 $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) 74 $(transform-host-java-to-package) 75 76# Run jarjar if necessary, otherwise just copy the file. 77ifneq ($(strip $(LOCAL_JARJAR_RULES)),) 78$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) 79$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR) 80 @echo JarJar: $@ 81 $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@ 82else 83$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP) 84 @echo Copying: $@ 85 $(hide) $(ACP) -fp $< $@ 86endif 87 88$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP) 89 @echo Copying: $@ 90 $(hide) $(ACP) -fp $< $@ 91 92$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON) 93$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS) 94$(built_dex): $(full_classes_jar) $(DX) 95 $(transform-classes.jar-to-dex) 96 97$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex) 98$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources) 99 @echo "Host Jar: $(PRIVATE_MODULE) ($@)" 100 $(create-empty-package) 101 $(add-dex-to-package) 102 $(add-carried-java-resources) 103ifneq ($(extra_jar_args),) 104 $(add-java-resources-to-package) 105endif 106 107USE_CORE_LIB_BOOTCLASSPATH := 108