host_java_library.mk revision 447d69678e6ba108a2f9e034c876a8859015fe17
1# 2# Copyright (C) 2008 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# Standard rules for building a host java library. 19# 20 21####################################### 22include $(BUILD_SYSTEM)/host_java_library_common.mk 23####################################### 24 25# Enable emma instrumentation only if the module asks so. 26ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) 27ifneq (true,$(EMMA_INSTRUMENT)) 28LOCAL_EMMA_INSTRUMENT := 29endif 30endif 31 32full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar 33emma_intermediates_dir := $(intermediates.COMMON)/emma_out 34# emma is hardcoded to use the leaf name of its input for the output file -- 35# only the output directory can be changed 36full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(notdir $(full_classes_compiled_jar)) 37 38LOCAL_INTERMEDIATE_TARGETS += \ 39 $(full_classes_compiled_jar) \ 40 $(full_classes_emma_jar) 41 42####################################### 43include $(BUILD_SYSTEM)/base_rules.mk 44####################################### 45 46java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) \ 47 $(filter %.java,$(LOCAL_GENERATED_SOURCES)) 48all_java_sources := $(java_sources) 49 50include $(BUILD_SYSTEM)/java_common.mk 51 52ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) 53$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em 54$(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir) 55ifdef LOCAL_EMMA_COVERAGE_FILTER 56$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER) 57else 58# by default, avoid applying emma instrumentation onto emma classes itself, 59# otherwise there will be exceptions thrown 60$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.* 61endif 62# this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and 63# $(full_classes_emma_jar) 64$(full_classes_emma_jar) : $(full_classes_compiled_jar) | $(EMMA_JAR) 65 $(transform-classes.jar-to-emma) 66 67$(built_javalib_jar) : $(full_classes_emma_jar) 68 @echo Copying: $@ 69 $(hide) $(ACP) -fp $< $@ 70 71else # LOCAL_EMMA_INSTRUMENT 72# Directly build into $(built_javalib_jar). 73full_classes_compiled_jar := $(built_javalib_jar) 74endif # LOCAL_EMMA_INSTRUMENT 75 76# The layers file allows you to enforce a layering between java packages. 77# Run build/tools/java-layers.py for more details. 78layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE)) 79 80$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) 81$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) 82$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := 83$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := 84$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := 85$(full_classes_compiled_jar): \ 86 $(java_sources) \ 87 $(java_resource_sources) \ 88 $(full_java_lib_deps) \ 89 $(jar_manifest_file) \ 90 $(proto_java_sources_file_stamp) \ 91 $(LOCAL_MODULE_MAKEFILE) \ 92 $(LOCAL_ADDITIONAL_DEPENDENCIES) 93 $(transform-host-java-to-package) 94