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 ####################################### 22 include $(BUILD_SYSTEM)/host_java_library_common.mk 23 ####################################### 24 25 # Enable emma instrumentation only if the module asks so. 26 ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) 27 ifneq (true,$(EMMA_INSTRUMENT)) 28 LOCAL_EMMA_INSTRUMENT := 29 endif 30 endif 31 32 full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar 33 emma_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 36 full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(notdir $(full_classes_compiled_jar)) 37 38 LOCAL_INTERMEDIATE_TARGETS += \ 39 $(full_classes_compiled_jar) \ 40 $(full_classes_emma_jar) 41 42 ####################################### 43 include $(BUILD_SYSTEM)/base_rules.mk 44 ####################################### 45 46 ifeq (true,$(LOCAL_EMMA_INSTRUMENT)) 47 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em 48 $(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir) 49 ifdef LOCAL_EMMA_COVERAGE_FILTER 50 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER) 51 else 52 # by default, avoid applying emma instrumentation onto emma classes itself, 53 # otherwise there will be exceptions thrown 54 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.* 55 endif 56 # this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and 57 # $(full_classes_emma_jar) 58 $(full_classes_emma_jar) : $(full_classes_compiled_jar) | $(EMMA_JAR) 59 $(transform-classes.jar-to-emma) 60 61 $(LOCAL_BUILT_MODULE) : $(full_classes_emma_jar) 62 @echo Copying: $@ 63 $(hide) $(ACP) -fp $< $@ 64 65 else # LOCAL_EMMA_INSTRUMENT 66 # Directly build into LOCAL_BUILT_MODULE. 67 full_classes_compiled_jar := $(LOCAL_BUILT_MODULE) 68 endif # LOCAL_EMMA_INSTRUMENT 69 70 $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g 71 72 # The layers file allows you to enforce a layering between java packages. 73 # Run build/tools/java-layers.py for more details. 74 layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE)) 75 76 $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file) 77 $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) 78 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES := 79 $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES := 80 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES := 81 $(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS := 82 $(full_classes_compiled_jar): $(java_sources) $(java_resource_sources) $(full_java_lib_deps) \ 83 $(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_ADDITIONAL_DEPENDENCIES) 84 $(transform-host-java-to-package) 85