• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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$(call record-module-type,HOST_JAVA_LIBRARY)
18
19#
20# Standard rules for building a host java library.
21#
22
23#######################################
24include $(BUILD_SYSTEM)/host_java_library_common.mk
25#######################################
26
27# Enable emma instrumentation only if the module asks so.
28ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
29ifneq (true,$(EMMA_INSTRUMENT))
30LOCAL_EMMA_INSTRUMENT :=
31endif
32endif
33
34full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
35full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
36full_classes_jar := $(intermediates.COMMON)/classes.jar
37
38LOCAL_INTERMEDIATE_TARGETS += \
39    $(full_classes_compiled_jar) \
40    $(full_classes_jarjar_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
52# The layers file allows you to enforce a layering between java packages.
53# Run build/tools/java-layers.py for more details.
54layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
55
56# If error prone is enabled then add LOCAL_ERROR_PRONE_FLAGS to LOCAL_JAVACFLAGS
57ifeq ($(RUN_ERROR_PRONE),true)
58LOCAL_JAVACFLAGS += $(LOCAL_ERROR_PRONE_FLAGS)
59endif
60
61$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
62$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
63$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
64$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
65$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
66$(full_classes_compiled_jar): \
67        $(java_sources) \
68        $(java_resource_sources) \
69        $(full_java_lib_deps) \
70        $(jar_manifest_file) \
71        $(proto_java_sources_file_stamp) \
72        $(annotation_processor_deps) \
73        $(NORMALIZE_PATH) \
74        $(ZIPTIME) \
75        $(LOCAL_ADDITIONAL_DEPENDENCIES) \
76        | $(SOONG_JAVAC_WRAPPER)
77	$(transform-host-java-to-package)
78	$(remove-timestamps-from-package)
79
80javac-check : $(full_classes_compiled_jar)
81javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
82
83# Run jarjar if necessary, otherwise just copy the file.
84ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
85$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
86$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
87	@echo JarJar: $@
88	$(hide) $(JAVA) -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
89else
90full_classes_jarjar_jar := $(full_classes_compiled_jar)
91endif
92
93
94LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_jarjar_jar)
95
96#######################################
97include $(BUILD_SYSTEM)/jacoco.mk
98#######################################
99
100$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(LOCAL_BUILT_MODULE)))
101$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_jar)))
102
103