host_dalvik_java_library.mk revision 0757768f4309664a357c5ccb4728eb9407ad3700
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
23ifeq ($(HOST_OS),linux)
24USE_CORE_LIB_BOOTCLASSPATH := true
25
26#######################################
27include $(BUILD_SYSTEM)/host_java_library_common.mk
28#######################################
29
30ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
31  LOCAL_JAVA_LIBRARIES +=  core-libart-hostdex
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
37built_dex := $(intermediates.COMMON)/classes.dex
38
39LOCAL_INTERMEDIATE_TARGETS += \
40    $(full_classes_compiled_jar) \
41    $(full_classes_jarjar_jar) \
42    $(full_classes_jar) \
43    $(built_dex)
44
45# See comment in java.mk
46java_alternative_checked_module := $(full_classes_compiled_jar)
47
48#######################################
49include $(BUILD_SYSTEM)/base_rules.mk
50#######################################
51
52$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
53
54java_alternative_checked_module :=
55
56# The layers file allows you to enforce a layering between java packages.
57# Run build/tools/java-layers.py for more details.
58layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
59
60$(LOCAL_INTERMEDIATE_TARGETS): \
61	PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
62$(LOCAL_INTERMEDIATE_TARGETS): \
63	PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
64
65$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
66
67$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
68$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
69$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
70$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
71$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
72$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS :=
73$(full_classes_compiled_jar): \
74        $(java_sources) \
75        $(java_resource_sources) \
76        $(full_java_lib_deps) \
77        $(jar_manifest_file) \
78        $(proto_java_sources_file_stamp) \
79        $(LOCAL_MODULE_MAKEFILE) \
80        $(LOCAL_ADDITIONAL_DEPENDENCIES)
81	$(transform-host-java-to-package)
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
90$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
91	@echo Copying: $@
92	$(hide) $(ACP) -fp $< $@
93endif
94
95$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
96	@echo Copying: $@
97	$(hide) $(ACP) -fp $< $@
98
99$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
100$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
101$(built_dex): $(full_classes_jar) $(DX)
102	$(transform-classes.jar-to-dex)
103
104$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
105$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
106$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
107	@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
108	$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
109	$(add-dex-to-package)
110
111USE_CORE_LIB_BOOTCLASSPATH :=
112
113endif
114