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
|
|
|
|
|
2016-03-24 23:41:48 +00:00
|
|
|
#################################
|
|
|
|
include $(BUILD_SYSTEM)/configure_local_jack.mk
|
|
|
|
#################################
|
|
|
|
|
2013-10-28 13:20:52 +00:00
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/host_java_library_common.mk
|
|
|
|
#######################################
|
2016-12-21 22:29:13 +00:00
|
|
|
ifdef LOCAL_JACK_ENABLED
|
2016-03-24 23:41:48 +00:00
|
|
|
ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
|
|
|
# For static library, $(LOCAL_BUILT_MODULE) is $(full_classes_jack).
|
|
|
|
LOCAL_BUILT_MODULE_STEM := classes.jack
|
|
|
|
endif
|
2016-12-21 22:29:13 +00:00
|
|
|
endif
|
2013-10-28 13:20:52 +00:00
|
|
|
|
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
2016-04-21 14:49:10 +00:00
|
|
|
LOCAL_JAVA_LIBRARIES := core-oj-hostdex core-libart-hostdex $(LOCAL_JAVA_LIBRARIES)
|
2013-10-28 13:20:52 +00:00
|
|
|
endif
|
|
|
|
|
2016-12-21 22:29:13 +00:00
|
|
|
full_classes_compiled_jar := $(intermediates.COMMON)/classes-full-debug.jar
|
|
|
|
full_classes_jarjar_jar := $(intermediates.COMMON)/classes-jarjar.jar
|
|
|
|
full_classes_jar := $(intermediates.COMMON)/classes.jar
|
2014-09-08 12:45:14 +00:00
|
|
|
full_classes_jack := $(intermediates.COMMON)/classes.jack
|
2015-08-18 17:18:18 +00:00
|
|
|
jack_check_timestamp := $(intermediates.COMMON)/jack.check.timestamp
|
2013-10-28 13:20:52 +00:00
|
|
|
built_dex := $(intermediates.COMMON)/classes.dex
|
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += \
|
2016-12-21 22:29:13 +00:00
|
|
|
$(full_classes_compiled_jar) \
|
|
|
|
$(full_classes_jarjar_jar) \
|
2014-09-08 12:45:14 +00:00
|
|
|
$(full_classes_jack) \
|
2016-12-21 22:29:13 +00:00
|
|
|
$(full_classes_jar) \
|
2015-08-18 17:18:18 +00:00
|
|
|
$(jack_check_timestamp) \
|
2013-10-28 13:20:52 +00:00
|
|
|
$(built_dex)
|
|
|
|
|
|
|
|
# See comment in java.mk
|
2015-09-02 02:12:05 +00:00
|
|
|
ifndef LOCAL_CHECKED_MODULE
|
2016-12-21 22:29:13 +00:00
|
|
|
ifdef LOCAL_JACK_ENABLED
|
2015-08-18 17:18:18 +00:00
|
|
|
LOCAL_CHECKED_MODULE := $(jack_check_timestamp)
|
2016-12-21 22:29:13 +00:00
|
|
|
else
|
|
|
|
LOCAL_CHECKED_MODULE := $(full_classes_compiled_jar)
|
|
|
|
endif
|
2015-08-18 17:18:18 +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
|
|
|
|
|
|
|
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
|
|
|
|
|
2016-12-21 22:29:13 +00:00
|
|
|
ifndef LOCAL_JACK_ENABLED
|
|
|
|
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JAVACFLAGS)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
|
|
|
|
$(full_classes_compiled_jar): \
|
|
|
|
$(java_sources) \
|
|
|
|
$(java_resource_sources) \
|
|
|
|
$(full_java_lib_deps) \
|
|
|
|
$(jar_manifest_file) \
|
|
|
|
$(proto_java_sources_file_stamp) \
|
2017-02-20 03:51:27 +00:00
|
|
|
$(NORMALIZE_PATH) \
|
|
|
|
$(JAVAC_FILTER) \
|
2016-12-21 22:29:13 +00:00
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
|
|
|
$(transform-host-java-to-package)
|
|
|
|
|
|
|
|
# Run jarjar if necessary, otherwise just copy the file.
|
|
|
|
ifneq ($(strip $(LOCAL_JARJAR_RULES)),)
|
|
|
|
$(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES)
|
|
|
|
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR)
|
|
|
|
@echo JarJar: $@
|
|
|
|
$(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@
|
|
|
|
else
|
|
|
|
$(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP)
|
|
|
|
@echo Copying: $@
|
|
|
|
$(hide) $(ACP) -fp $< $@
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(full_classes_jar): $(full_classes_jarjar_jar) | $(ACP)
|
|
|
|
@echo Copying: $@
|
|
|
|
$(hide) $(ACP) -fp $< $@
|
|
|
|
|
|
|
|
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)
|
|
|
|
$(built_dex): $(full_classes_jar) $(DX)
|
|
|
|
$(transform-classes.jar-to-dex)
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DONT_DELETE_JAR_DIRS := $(LOCAL_DONT_DELETE_JAR_DIRS)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
|
|
|
|
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
|
|
|
|
$(add-dex-to-package)
|
|
|
|
|
|
|
|
endif # !LOCAL_IS_STATIC_JAVA_LIBRARY
|
2017-02-22 00:14:55 +00:00
|
|
|
|
|
|
|
ifneq (,$(filter-out current system_current test_current, $(LOCAL_SDK_VERSION)))
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(LOCAL_SDK_VERSION)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(LOCAL_SDK_VERSION)
|
|
|
|
else
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEFAULT_APP_TARGET_SDK := $(DEFAULT_APP_TARGET_SDK)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SDK_VERSION := $(PLATFORM_SDK_VERSION)
|
|
|
|
endif
|
|
|
|
|
2016-12-21 22:29:13 +00:00
|
|
|
else # LOCAL_JACK_ENABLED
|
2014-09-08 12:45:14 +00:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
2016-03-24 23:41:48 +00:00
|
|
|
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jack-rsc
|
2014-09-08 12:45:14 +00:00
|
|
|
|
|
|
|
ifeq ($(LOCAL_JACK_ENABLED),incremental)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
2016-03-24 23:41:48 +00:00
|
|
|
PRIVATE_JACK_INCREMENTAL_DIR := $(intermediates.COMMON)/jack-incremental
|
2014-09-08 12:45:14 +00:00
|
|
|
else
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
2016-03-24 23:41:48 +00:00
|
|
|
PRIVATE_JACK_INCREMENTAL_DIR :=
|
2014-09-08 12:45:14 +00:00
|
|
|
endif
|
2015-08-18 17:18:18 +00:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_FLAGS := $(GLOBAL_JAVAC_DEBUG_FLAGS) $(LOCAL_JACK_FLAGS)
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_VERSION := $(LOCAL_JACK_VERSION)
|
2016-03-09 16:19:58 +00:00
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_MIN_SDK_VERSION := $(PLATFORM_JACK_MIN_SDK_VERSION)
|
2014-09-08 12:45:14 +00:00
|
|
|
|
2015-08-18 17:18:18 +00:00
|
|
|
jack_all_deps := $(java_sources) $(java_resource_sources) $(full_jack_deps) \
|
2016-01-06 22:28:36 +00:00
|
|
|
$(jar_manifest_file) $(proto_java_sources_file_stamp) \
|
2016-04-19 07:17:55 +00:00
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES) $(NORMALIZE_PATH) $(JACK_DEFAULT_ARGS) $(JACK)
|
2016-03-24 23:41:48 +00:00
|
|
|
|
|
|
|
ifneq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
|
2015-08-18 17:18:18 +00:00
|
|
|
$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
|
2016-08-05 15:45:10 +00:00
|
|
|
$(built_dex): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
|
2016-09-19 15:49:03 +00:00
|
|
|
$(built_dex): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
|
2016-08-05 15:45:10 +00:00
|
|
|
$(built_dex): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
|
2014-09-08 12:45:14 +00:00
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(jack-java-to-dex)
|
|
|
|
|
|
|
|
# $(full_classes_jack) is just by-product of $(built_dex).
|
|
|
|
# The dummy command was added because, without it, make misses the fact the $(built_dex) also
|
|
|
|
# change $(full_classes_jack).
|
|
|
|
$(full_classes_jack): $(built_dex)
|
|
|
|
$(hide) touch $@
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
|
|
|
|
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
|
|
|
$(create-empty-package)
|
|
|
|
$(add-dex-to-package)
|
|
|
|
$(add-carried-jack-resources)
|
|
|
|
|
2016-03-24 23:41:48 +00:00
|
|
|
else # LOCAL_IS_STATIC_JAVA_LIBRARY
|
2016-08-05 15:45:10 +00:00
|
|
|
$(full_classes_jack): PRIVATE_JACK_PLUGIN_PATH := $(LOCAL_JACK_PLUGIN_PATH)
|
2016-09-19 15:49:03 +00:00
|
|
|
$(full_classes_jack): PRIVATE_JACK_PLUGIN := $(LOCAL_JACK_PLUGIN)
|
2016-08-05 15:45:10 +00:00
|
|
|
$(full_classes_jack): $(jack_all_deps) $(LOCAL_JACK_PLUGIN_PATH) | setup-jack-server
|
2016-03-24 23:41:48 +00:00
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(java-to-jack)
|
|
|
|
|
|
|
|
endif # LOCAL_IS_STATIC_JAVA_LIBRARY
|
|
|
|
|
|
|
|
$(jack_check_timestamp): $(jack_all_deps) | setup-jack-server
|
|
|
|
@echo Checking build with Jack: $@
|
|
|
|
$(jack-check-java)
|
2016-12-21 22:29:13 +00:00
|
|
|
endif # LOCAL_JACK_ENABLED
|
2014-09-08 12:45:14 +00:00
|
|
|
|
2013-10-28 13:20:52 +00:00
|
|
|
USE_CORE_LIB_BOOTCLASSPATH :=
|
2015-01-26 17:52:28 +00:00
|
|
|
|
|
|
|
endif
|