2013-10-28 13:20:52 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2013 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-25 23:03:53 +00:00
|
|
|
$(call record-module-type,HOST_DALVIK_JAVA_LIBRARY)
|
2013-10-28 13:20:52 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Rules for building a host dalvik java library. These libraries
|
|
|
|
# are meant to be used by a dalvik VM instance running on the host.
|
|
|
|
# They will be compiled against libcore and not the host JRE.
|
|
|
|
#
|
|
|
|
|
2015-01-26 17:52:28 +00:00
|
|
|
ifeq ($(HOST_OS),linux)
|
2013-10-28 13:20:52 +00:00
|
|
|
USE_CORE_LIB_BOOTCLASSPATH := true
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/host_java_library_common.mk
|
|
|
|
#######################################
|
|
|
|
|
2017-08-31 21:43:04 +00:00
|
|
|
full_classes_turbine_jar := $(intermediates.COMMON)/classes-turbine.jar
|
|
|
|
full_classes_header_jarjar := $(intermediates.COMMON)/classes-header-jarjar.jar
|
|
|
|
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
|
2016-12-21 22:29:13 +00:00
|
|
|
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
2017-09-13 20:13:53 +00:00
|
|
|
full_classes_combined_jar := $(intermediates.COMMON)/classes-combined.jar
|
2016-12-21 22:29:13 +00:00
|
|
|
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
2013-10-28 13:20:52 +00:00
|
|
|
built_dex := $(intermediates.COMMON)/classes.dex
|
2017-05-26 22:22:02 +00:00
|
|
|
java_source_list_file := $(intermediates.COMMON)/java-source-list
|
2013-10-28 13:20:52 +00:00
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += \
|
2017-08-31 21:43:04 +00:00
|
|
|
$(full_classes_turbine_jar) \
|
2016-12-21 22:29:13 +00:00
|
|
|
$(full_classes_compiled_jar) \
|
2017-09-13 20:13:53 +00:00
|
|
|
$(full_classes_combined_jar) \
|
2016-12-21 22:29:13 +00:00
|
|
|
$(full_classes_jarjar_jar) \
|
|
|
|
$(full_classes_jar) \
|
2017-05-26 22:22:02 +00:00
|
|
|
$(built_dex) \
|
|
|
|
$(java_source_list_file)
|
2013-10-28 13:20:52 +00:00
|
|
|
|
|
|
|
# See comment in java.mk
|
2015-09-02 02:12:05 +00:00
|
|
|
ifndef LOCAL_CHECKED_MODULE
|
2017-02-24 22:06:29 +00:00
|
|
|
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
2016-12-21 22:29:13 +00:00
|
|
|
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
|
2017-02-24 22:06:29 +00:00
|
|
|
else
|
|
|
|
LOCAL_CHECKED_MODULE := $(built_dex)
|
|
|
|
endif
|
2016-12-21 22:29:13 +00:00
|
|
|
endif
|
2013-10-28 13:20:52 +00:00
|
|
|
|
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
2015-08-28 18:47:03 +00:00
|
|
|
java_sources := $(addprefix $(LOCAL_PATH)/, $(filter %.java,$(LOCAL_SRC_FILES))) \
|
|
|
|
$(filter %.java,$(LOCAL_GENERATED_SOURCES))
|
|
|
|
all_java_sources := $(java_sources)
|
|
|
|
|
|
|
|
include $(BUILD_SYSTEM)/java_common.mk
|
2013-10-28 13:20:52 +00:00
|
|
|
|
2018-02-21 15:29:44 +00:00
|
|
|
include $(BUILD_SYSTEM)/sdk_check.mk
|
|
|
|
|
2013-10-28 13:20:52 +00:00
|
|
|
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
|
|
|
|
|
2017-05-26 22:22:02 +00:00
|
|
|
# List of dependencies for anything that needs all java sources in place
|
|
|
|
java_sources_deps := \
|
|
|
|
$(java_sources) \
|
|
|
|
$(java_resource_sources) \
|
2018-03-07 23:44:54 +00:00
|
|
|
$(LOCAL_SRCJARS) \
|
2017-05-26 22:22:02 +00:00
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
|
|
|
|
|
|
|
$(java_source_list_file): $(java_sources_deps)
|
|
|
|
$(write-java-source-list)
|
|
|
|
|
2020-03-05 20:41:30 +00:00
|
|
|
# TODO(b/143658984): goma can't handle the --system argument to javac.
|
|
|
|
#$(full_classes_compiled_jar): .KATI_NINJA_POOL := $(GOMA_POOL)
|
2016-12-21 22:29:13 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
2017-08-30 19:32:12 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
2016-12-21 22:29:13 +00: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-07 23:44:54 +00: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-12-21 22:29:13 +00:00
|
|
|
$(full_classes_compiled_jar): \
|
2017-05-26 22:22:02 +00:00
|
|
|
$(java_source_list_file) \
|
|
|
|
$(java_sources_deps) \
|
2017-08-31 21:43:04 +00:00
|
|
|
$(full_java_header_libs) \
|
2017-09-24 01:19:05 +00:00
|
|
|
$(full_java_bootclasspath_libs) \
|
2017-10-12 20:34:40 +00:00
|
|
|
$(full_java_system_modules_deps) \
|
2017-05-26 22:22:02 +00:00
|
|
|
$(annotation_processor_deps) \
|
|
|
|
$(NORMALIZE_PATH) \
|
2017-08-31 21:43:04 +00:00
|
|
|
$(JAR_ARGS) \
|
2018-03-15 23:26:08 +00:00
|
|
|
$(ZIPSYNC) \
|
2020-04-16 19:43:40 +00:00
|
|
|
$(SOONG_ZIP) \
|
2017-05-26 22:22:02 +00:00
|
|
|
| $(SOONG_JAVAC_WRAPPER)
|
2017-08-31 21:43:04 +00:00
|
|
|
$(transform-host-java-to-dalvik-package)
|
|
|
|
|
2017-09-26 23:17:24 +00:00
|
|
|
ifneq ($(TURBINE_ENABLED),false)
|
|
|
|
|
2017-08-31 21:43:04 +00:00
|
|
|
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
|
2018-03-07 23:44:54 +00:00
|
|
|
$(full_classes_turbine_jar): PRIVATE_SRCJARS := $(LOCAL_SRCJARS)
|
2017-08-31 21:43:04 +00:00
|
|
|
$(full_classes_turbine_jar): \
|
|
|
|
$(java_source_list_file) \
|
|
|
|
$(java_sources_deps) \
|
|
|
|
$(full_java_header_libs) \
|
2017-09-24 01:19:05 +00:00
|
|
|
$(full_java_bootclasspath_libs) \
|
2017-08-31 21:43:04 +00:00
|
|
|
$(NORMALIZE_PATH) \
|
|
|
|
$(JAR_ARGS) \
|
|
|
|
$(ZIPTIME) \
|
2017-09-13 20:13:53 +00:00
|
|
|
| $(TURBINE) \
|
|
|
|
$(MERGE_ZIPS)
|
2017-08-31 21:43:04 +00:00
|
|
|
$(transform-java-to-header.jar)
|
|
|
|
|
|
|
|
.KATI_RESTAT: $(full_classes_turbine_jar)
|
|
|
|
|
|
|
|
# Run jarjar before generate classes-header.jar if necessary.
|
|
|
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
|
|
|
$(full_classes_header_jarjar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
|
|
|
$(full_classes_header_jarjar): $(full_classes_turbine_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
2021-02-08 18:55:05 +00:00
|
|
|
$(call transform-jarjar)
|
2017-08-31 21:43:04 +00:00
|
|
|
else
|
|
|
|
full_classes_header_jarjar := $(full_classes_turbine_jar)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(eval $(call copy-one-file,$(full_classes_header_jarjar),$(full_classes_header_jar)))
|
2016-12-21 22:29:13 +00:00
|
|
|
|
2017-09-26 23:17:24 +00:00
|
|
|
endif # TURBINE_ENABLED != false
|
|
|
|
|
2017-09-13 20:13:53 +00:00
|
|
|
$(full_classes_combined_jar): PRIVATE_DONT_DELETE_JAR_META_INF := $(LOCAL_DONT_DELETE_JAR_META_INF)
|
|
|
|
$(full_classes_combined_jar): $(full_classes_compiled_jar) \
|
2017-09-20 21:56:48 +00:00
|
|
|
$(jar_manifest_file) \
|
2017-09-13 20:13:53 +00:00
|
|
|
$(full_static_java_libs) | $(MERGE_ZIPS)
|
2017-09-20 21:56:48 +00:00
|
|
|
$(if $(PRIVATE_JAR_MANIFEST), $(hide) sed -e "s/%BUILD_NUMBER%/$(BUILD_NUMBER_FROM_FILE)/" \
|
|
|
|
$(PRIVATE_JAR_MANIFEST) > $(dir $@)/manifest.mf)
|
2018-02-14 18:32:48 +00:00
|
|
|
$(MERGE_ZIPS) -j --ignore-duplicates $(if $(PRIVATE_JAR_MANIFEST),-m $(dir $@)/manifest.mf) \
|
2017-09-20 21:56:48 +00:00
|
|
|
$(if $(PRIVATE_DONT_DELETE_JAR_META_INF),,-stripDir META-INF -zipToNotStrip $<) \
|
2019-04-29 17:25:20 +00:00
|
|
|
$@ $< $(PRIVATE_STATIC_JAVA_LIBRARIES)
|
2017-09-13 20:13:53 +00:00
|
|
|
|
2016-12-21 22:29:13 +00: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)
|
2017-09-13 20:13:53 +00:00
|
|
|
$(full_classes_jarjar_jar): $(full_classes_combined_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
2021-02-08 18:55:05 +00:00
|
|
|
$(call transform-jarjar)
|
2016-12-21 22:29:13 +00:00
|
|
|
else
|
2017-09-13 20:13:53 +00:00
|
|
|
full_classes_jarjar_jar := $(full_classes_combined_jar)
|
2016-12-21 22:29:13 +00:00
|
|
|
endif
|
|
|
|
|
2017-03-29 19:17:36 +00:00
|
|
|
$(eval $(call copy-one-file,$(full_classes_jarjar_jar),$(full_classes_jar)))
|
2016-12-21 22:29:13 +00:00
|
|
|
|
|
|
|
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
|
|
|
# No dex; all we want are the .class files with resources.
|
|
|
|
$(LOCAL_BUILT_MODULE) : $(java_resource_sources)
|
|
|
|
$(LOCAL_BUILT_MODULE) : $(full_classes_jar)
|
|
|
|
@echo "host Static Jar: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(copy-file-to-target)
|
|
|
|
|
|
|
|
else # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
|
|
|
|
$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
|
2018-06-06 21:46:25 +00:00
|
|
|
$(built_dex): $(full_classes_jar) $(DX) $(ZIP2ZIP)
|
2016-12-21 22:29:13 +00:00
|
|
|
$(transform-classes.jar-to-dex)
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
|
2018-09-14 20:39:07 +00:00
|
|
|
$(LOCAL_BUILT_MODULE): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
|
2016-12-21 22:29:13 +00:00
|
|
|
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
|
|
|
|
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
2018-09-14 20:39:07 +00:00
|
|
|
rm -rf $@.parts
|
|
|
|
mkdir -p $@.parts
|
|
|
|
$(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE))
|
|
|
|
$(call extract-resources-jar,$@.parts/res.zip,$(PRIVATE_SOURCE_ARCHIVE))
|
|
|
|
$(MERGE_ZIPS) -j $@ $@.parts/dex.zip $@.parts/res.zip
|
|
|
|
rm -rf $@.parts
|
2016-12-21 22:29:13 +00:00
|
|
|
|
|
|
|
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
2017-02-22 00:14:55 +00:00
|
|
|
|
2019-02-06 23:40:03 +00:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(call module-target-sdk-version)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(call module-sdk-version)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_MIN_SDK_VERSION := $(call codename-or-sdk-to-sdk,$(call module-min-sdk-version))
|
2017-09-28 23:17:36 +00:00
|
|
|
|
2013-10-28 13:20:52 +00:00
|
|
|
USE_CORE_LIB_BOOTCLASSPATH :=
|
2015-01-26 17:52:28 +00:00
|
|
|
|
|
|
|
endif
|