blob: 47189d7d05e231fbb2e307142e020868af0ec08a [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001#
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
Chris Wrend4b1d522013-10-02 13:30:27 -040021#######################################
Narayan Kamath0dd273a2013-10-28 13:20:52 +000022include $(BUILD_SYSTEM)/host_java_library_common.mk
Ying Wang1ff08362013-12-27 15:55:08 -080023#######################################
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#######################################
Ying Wang50d7d7a2010-09-23 16:29:53 -070043include $(BUILD_SYSTEM)/base_rules.mk
Chris Wrend4b1d522013-10-02 13:30:27 -040044#######################################
Ying Wang50d7d7a2010-09-23 16:29:53 -070045
Yohann Roussel5b2c6e22015-05-20 17:52:15 +020046$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS :=
47
Ying Wang1ff08362013-12-27 15:55:08 -080048ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
49$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
50$(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
51ifdef LOCAL_EMMA_COVERAGE_FILTER
52$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER)
53else
54# by default, avoid applying emma instrumentation onto emma classes itself,
55# otherwise there will be exceptions thrown
56$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.*
57endif
58# this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
59# $(full_classes_emma_jar)
60$(full_classes_emma_jar) : $(full_classes_compiled_jar) | $(EMMA_JAR)
61 $(transform-classes.jar-to-emma)
jeffhaodc6757a2012-04-17 16:24:33 -070062
Yohann Rousseld2a76c12015-02-05 16:10:58 +010063$(built_javalib_jar) : $(full_classes_emma_jar)
Ying Wang1ff08362013-12-27 15:55:08 -080064 @echo Copying: $@
65 $(hide) $(ACP) -fp $< $@
66
67else # LOCAL_EMMA_INSTRUMENT
Yohann Rousseld2a76c12015-02-05 16:10:58 +010068# Directly build into $(built_javalib_jar).
69full_classes_compiled_jar := $(built_javalib_jar)
Ying Wang1ff08362013-12-27 15:55:08 -080070endif # LOCAL_EMMA_INSTRUMENT
71
72$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
Ying Wang1d977e32013-01-30 11:22:06 -080073
Joe Onorato9a6a3262012-10-26 16:25:05 -070074# The layers file allows you to enforce a layering between java packages.
75# Run build/tools/java-layers.py for more details.
76layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
77
Ying Wang1ff08362013-12-27 15:55:08 -080078$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
79$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
80$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
81$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
Jeff Brown4c4aa992014-05-23 18:41:19 -070082$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
Dan Albert954b5bd2014-11-08 22:20:03 -080083$(full_classes_compiled_jar): \
84 $(java_sources) \
85 $(java_resource_sources) \
86 $(full_java_lib_deps) \
87 $(jar_manifest_file) \
88 $(proto_java_sources_file_stamp) \
89 $(LOCAL_MODULE_MAKEFILE) \
90 $(LOCAL_ADDITIONAL_DEPENDENCIES)
The Android Open Source Project88b60792009-03-03 19:28:42 -080091 $(transform-host-java-to-package)