OSDN Git Service

Update Security string to 2017-01-01 in klp-dev am: 21f5d281f3 am: 0f344dd00a am...
[android-x86/build.git] / core / host_java_library.mk
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 full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
34 emma_intermediates_dir := $(intermediates.COMMON)/emma_out
35 # emma is hardcoded to use the leaf name of its input for the output file --
36 # only the output directory can be changed
37 full_classes_emma_jar := $(emma_intermediates_dir)/lib/$(notdir $(full_classes_jarjar_jar))
38
39 LOCAL_INTERMEDIATE_TARGETS += \
40     $(full_classes_compiled_jar) \
41     $(full_classes_jarjar_jar) \
42     $(full_classes_emma_jar)
43
44 #######################################
45 include $(BUILD_SYSTEM)/base_rules.mk
46 #######################################
47
48 java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) \
49                 $(filter %.java,$(LOCAL_GENERATED_SOURCES))
50 all_java_sources := $(java_sources)
51
52 include $(BUILD_SYSTEM)/java_common.mk
53
54 # The layers file allows you to enforce a layering between java packages.
55 # Run build/tools/java-layers.py for more details.
56 layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
57
58 $(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
59 $(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS)
60 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
61 $(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
62 $(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
63 $(full_classes_compiled_jar): \
64         $(java_sources) \
65         $(java_resource_sources) \
66         $(full_java_lib_deps) \
67         $(jar_manifest_file) \
68         $(proto_java_sources_file_stamp) \
69         $(LOCAL_MODULE_MAKEFILE_DEP) \
70         $(LOCAL_ADDITIONAL_DEPENDENCIES)
71         $(transform-host-java-to-package)
72
73 # Run jarjar if necessary, otherwise just copy the file.
74 ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
75 $(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
76 $(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
77         @echo JarJar: $@
78         $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
79 else
80 $(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
81         @echo Copying: $@
82         $(hide) $(ACP) -fp $< $@
83 endif
84
85 ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
86 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
87 $(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
88 ifdef LOCAL_EMMA_COVERAGE_FILTER
89 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER)
90 else
91 # by default, avoid applying emma instrumentation onto emma classes itself,
92 # otherwise there will be exceptions thrown
93 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.*
94 endif
95 # this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
96 # $(full_classes_emma_jar)
97 $(full_classes_emma_jar) : $(full_classes_jarjar_jar) | $(EMMA_JAR)
98         $(transform-classes.jar-to-emma)
99
100 $(built_javalib_jar) : $(full_classes_emma_jar)
101         @echo Copying: $@
102         $(hide) $(ACP) -fp $< $@
103
104 else # LOCAL_EMMA_INSTRUMENT
105 $(built_javalib_jar): $(full_classes_jarjar_jar) | $(ACP)
106         @echo Copying: $@
107         $(hide) $(ACP) -fp $< $@
108 endif # LOCAL_EMMA_INSTRUMENT
109