2009-03-04 04:28:42 +01:00
|
|
|
#
|
|
|
|
# Copyright (C) 2008 The Android Open Source Project
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
2016-07-26 01:03:53 +02:00
|
|
|
$(call record-module-type,HOST_JAVA_LIBRARY)
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
#
|
|
|
|
# Standard rules for building a host java library.
|
|
|
|
#
|
|
|
|
|
2013-10-02 19:30:27 +02:00
|
|
|
#######################################
|
2013-10-28 14:20:52 +01:00
|
|
|
include $(BUILD_SYSTEM)/host_java_library_common.mk
|
2013-12-28 00:55:08 +01:00
|
|
|
#######################################
|
|
|
|
|
|
|
|
# Enable emma instrumentation only if the module asks so.
|
|
|
|
ifeq (true,$(LOCAL_EMMA_INSTRUMENT))
|
|
|
|
ifneq (true,$(EMMA_INSTRUMENT))
|
|
|
|
LOCAL_EMMA_INSTRUMENT :=
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
2016-03-02 12:19:41 +01:00
|
|
|
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
2017-03-29 22:53:29 +02:00
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
2017-05-27 00:22:02 +02:00
|
|
|
java_source_list_file := $(intermediates.COMMON)/java-source-list
|
2017-08-31 23:43:04 +02:00
|
|
|
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
2017-09-13 22:13:53 +02:00
|
|
|
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
|
2013-12-28 00:55:08 +01:00
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += \
|
|
|
|
$(full_classes_compiled_jar) \
|
2016-03-02 12:19:41 +01:00
|
|
|
$(full_classes_jarjar_jar) \
|
2017-09-13 22:13:53 +02:00
|
|
|
$(java_source_list_file) \
|
|
|
|
$(full_classes_combined_jar)
|
2013-12-28 00:55:08 +01:00
|
|
|
|
|
|
|
#######################################
|
2010-09-24 01:29:53 +02:00
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
2013-10-02 19:30:27 +02:00
|
|
|
#######################################
|
2010-09-24 01:29:53 +02:00
|
|
|
|
2015-08-28 20:47:03 +02:00
|
|
|
java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) \
|
|
|
|
$(filter %.java,$(LOCAL_GENERATED_SOURCES))
|
|
|
|
all_java_sources := $(java_sources)
|
|
|
|
|
2019-05-23 08:22:45 +02:00
|
|
|
ALL_MODULES.$(my_register_name).SRCS := $(ALL_MODULES.$(my_register_name).SRCS) $(all_java_sources)
|
|
|
|
|
2015-08-28 20:47:03 +02:00
|
|
|
include $(BUILD_SYSTEM)/java_common.mk
|
2015-05-20 17:52:15 +02:00
|
|
|
|
2016-03-02 12:19:41 +01:00
|
|
|
# The layers file allows you to enforce a layering between java packages.
|
2017-12-06 23:38:40 +01:00
|
|
|
# Run build/make/tools/java-layers.py for more details.
|
2016-03-02 12:19:41 +01:00
|
|
|
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
|
|
|
|
|
2017-05-27 00:22:02 +02:00
|
|
|
# List of dependencies for anything that needs all java sources in place
|
|
|
|
java_sources_deps := \
|
|
|
|
$(java_sources) \
|
|
|
|
$(java_resource_sources) \
|
2018-03-08 00:44:54 +01:00
|
|
|
$(LOCAL_SRCJARS) \
|
2017-05-27 00:22:02 +02:00
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
|
|
|
|
|
|
|
$(java_source_list_file): $(java_sources_deps)
|
|
|
|
$(write-java-source-list)
|
|
|
|
|
2020-03-05 21:41:30 +01:00
|
|
|
# TODO(b/143658984): goma can't handle the --system argument to javac.
|
|
|
|
#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL)
|
2016-03-02 12:19:41 +01:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
2017-08-30 21:32:12 +02:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
2016-03-02 12:19:41 +01:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
|
2018-03-08 00:44:54 +01:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_SRCJAR_LIST_FILE := $(intermediates.COMMON)/srcjar-list
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_SRCJAR_INTERMEDIATES_DIR := $(intermediates.COMMON)/srcjars
|
2016-03-02 12:19:41 +01:00
|
|
|
$(full_classes_compiled_jar): \
|
2017-05-27 00:22:02 +02:00
|
|
|
$(java_source_list_file) \
|
|
|
|
$(java_sources_deps) \
|
2017-09-13 22:13:53 +02:00
|
|
|
$(full_java_libs) \
|
2017-09-24 03:19:05 +02:00
|
|
|
$(full_java_bootclasspath_libs) \
|
2017-05-27 00:22:02 +02:00
|
|
|
$(annotation_processor_deps) \
|
|
|
|
$(NORMALIZE_PATH) \
|
|
|
|
$(ZIPTIME) \
|
2017-08-31 23:43:04 +02:00
|
|
|
$(JAR_ARGS) \
|
2018-03-16 00:26:08 +01:00
|
|
|
$(ZIPSYNC) \
|
2020-04-16 21:43:40 +02:00
|
|
|
$(SOONG_ZIP) \
|
2017-05-27 00:22:02 +02:00
|
|
|
| $(SOONG_JAVAC_WRAPPER)
|
2016-03-02 12:19:41 +01:00
|
|
|
$(transform-host-java-to-package)
|
2017-05-16 20:05:29 +02:00
|
|
|
$(remove-timestamps-from-package)
|
2016-03-02 12:19:41 +01:00
|
|
|
|
2016-03-24 19:00:30 +01:00
|
|
|
javac-check : $(full_classes_compiled_jar)
|
2016-09-15 15:34:42 +02:00
|
|
|
javac-check-$(LOCAL_MODULE) : $(full_classes_compiled_jar)
|
2018-07-24 10:21:12 +02:00
|
|
|
.PHONY: javac-check-$(LOCAL_MODULE)
|
2016-03-24 19:00:30 +01:00
|
|
|
|
2019-04-23 07:18:09 +02:00
|
|
|
$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
2017-09-13 22:13:53 +02:00
|
|
|
$(full_classes_combined_jar): $(full_classes_compiled_jar) \
|
2017-09-20 23:56:48 +02:00
|
|
|
$(jar_manifest_file) \
|
2017-09-13 22:13:53 +02:00
|
|
|
$(full_static_java_libs) | $(MERGE_ZIPS)
|
2017-09-20 23:56:48 +02:00
|
|
|
$(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
|
|
|
|
$(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
|
2018-02-14 19:32:48 +01:00
|
|
|
$(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
|
2019-04-23 07:18:09 +02:00
|
|
|
$(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \
|
2019-04-29 19:25:20 +02:00
|
|
|
$@ $< $(PRIVATE_STATIC_JAVA_LIBRARIES)
|
2017-09-13 22:13:53 +02:00
|
|
|
|
2016-03-02 12:19:41 +01:00
|
|
|
# Run jarjar if necessary, otherwise just copy the file.
|
|
|
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
|
|
|
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
2018-02-27 20:05:40 +01:00
|
|
|
$(full_classes_jarjar_jar): $(full_classes_combined_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
2021-02-08 19:55:05 +01:00
|
|
|
$(call transform-jarjar)
|
2016-03-02 12:19:41 +01:00
|
|
|
else
|
2017-09-13 22:13:53 +02:00
|
|
|
full_classes_jarjar_jar := $(full_classes_combined_jar)
|
2016-03-02 12:19:41 +01:00
|
|
|
endif
|
|
|
|
|
2017-04-12 01:36:46 +02:00
|
|
|
|
2018-01-31 23:34:07 +01:00
|
|
|
#######################################
|
2017-04-12 01:36:46 +02:00
|
|
|
LOCAL_FULL_CLASSES_PRE_JACOCO_JAR := $(full_classes_jarjar_jar)
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/jacoco.mk
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(LOCAL_BUILT_MODULE)))
|
|
|
|
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_jar)))
|
|
|
|
|
2017-10-21 03:30:55 +02:00
|
|
|
ifeq ($(TURBINE_ENABLED),false)
|
2017-08-31 23:43:04 +02:00
|
|
|
$(eval $(call copy-one-file,$(LOCAL_FULL_CLASSES_JACOCO_JAR),$(full_classes_header_jar)))
|
2017-09-27 01:17:24 +02:00
|
|
|
endif
|