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.
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
|
|
|
|
USE_CORE_LIB_BOOTCLASSPATH := true
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/host_java_library_common.mk
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
|
2014-06-18 22:11:01 +00:00
|
|
|
LOCAL_JAVA_LIBRARIES += core-libart-hostdex
|
2013-10-28 13:20:52 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
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
|
2013-10-28 13:20:52 +00:00
|
|
|
built_dex := $(intermediates.COMMON)/classes.dex
|
|
|
|
|
|
|
|
LOCAL_INTERMEDIATE_TARGETS += \
|
|
|
|
$(full_classes_compiled_jar) \
|
|
|
|
$(full_classes_jarjar_jar) \
|
2014-09-08 12:45:14 +00:00
|
|
|
$(full_classes_jack) \
|
2013-10-28 13:20:52 +00:00
|
|
|
$(full_classes_jar) \
|
|
|
|
$(built_dex)
|
|
|
|
|
|
|
|
# See comment in java.mk
|
|
|
|
java_alternative_checked_module := $(full_classes_compiled_jar)
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
#######################################
|
|
|
|
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
|
|
|
|
|
|
|
|
java_alternative_checked_module :=
|
|
|
|
|
|
|
|
# The layers file allows you to enforce a layering between java packages.
|
|
|
|
# Run build/tools/java-layers.py for more details.
|
|
|
|
layers_file := $(addprefix $(LOCAL_PATH)/, $(LOCAL_JAVA_LAYERS_FILE))
|
|
|
|
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_SOURCE_INTERMEDIATES_DIR := $(LOCAL_INTERMEDIATE_SOURCE_DIR)
|
|
|
|
|
|
|
|
$(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON)
|
|
|
|
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVA_LAYERS_FILE := $(layers_file)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS)
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_FILES :=
|
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_PACKAGES :=
|
2014-05-24 01:41:19 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_JAR_EXCLUDE_PACKAGES :=
|
2013-10-28 13:20:52 +00:00
|
|
|
$(full_classes_compiled_jar): PRIVATE_RMTYPEDEFS :=
|
2014-11-09 06:20:03 +00:00
|
|
|
$(full_classes_compiled_jar): \
|
|
|
|
$(java_sources) \
|
|
|
|
$(java_resource_sources) \
|
|
|
|
$(full_java_lib_deps) \
|
|
|
|
$(jar_manifest_file) \
|
|
|
|
$(proto_java_sources_file_stamp) \
|
|
|
|
$(LOCAL_MODULE_MAKEFILE) \
|
|
|
|
$(LOCAL_ADDITIONAL_DEPENDENCIES)
|
2013-10-28 13:20:52 +00:00
|
|
|
$(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 $< $@
|
|
|
|
|
Running jarjar on Java resources.
Before this change, Java resources are added as a separate step
(add-java-resources-to-package) after dex is run, so jarjar isn't run on
the resource files.
With this change, we add Java resources immediately after we call javac,
so jarjar is run on the resource files (the module's own resource, as
well as resources carried by static Java libraries).
When we generate the final apk/jar, we use the jarjar'ed jar as the
inital pacakge file, with class files and empty folders removed.
When jack is enabled, in jack-java-to-dex we add the Java resources to
a temp jar using the PRIVATE_EXTRA_JAR_ARGS, and extrac the files in a
temp dir. Jack will process the resource files and output the result to
PRIVATE_JACK_INTERMEDIATES_DIR. When we package the final apk/jar, we
need to call add-carried-jack-resources to readd the resources.
(TODO: if jack can output all resources to a jar/zip file, we can use
that file as the initial package file as well.)
Bug: 18837479
Change-Id: I8d7296e30ec8d005054cf04c4f2aed6d7a0d823b
2015-01-14 22:23:56 +00:00
|
|
|
ifneq ($(LOCAL_USE_JACK),true)
|
2013-10-28 13:20:52 +00:00
|
|
|
$(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)
|
Running jarjar on Java resources.
Before this change, Java resources are added as a separate step
(add-java-resources-to-package) after dex is run, so jarjar isn't run on
the resource files.
With this change, we add Java resources immediately after we call javac,
so jarjar is run on the resource files (the module's own resource, as
well as resources carried by static Java libraries).
When we generate the final apk/jar, we use the jarjar'ed jar as the
inital pacakge file, with class files and empty folders removed.
When jack is enabled, in jack-java-to-dex we add the Java resources to
a temp jar using the PRIVATE_EXTRA_JAR_ARGS, and extrac the files in a
temp dir. Jack will process the resource files and output the result to
PRIVATE_JACK_INTERMEDIATES_DIR. When we package the final apk/jar, we
need to call add-carried-jack-resources to readd the resources.
(TODO: if jack can output all resources to a jar/zip file, we can use
that file as the initial package file as well.)
Bug: 18837479
Change-Id: I8d7296e30ec8d005054cf04c4f2aed6d7a0d823b
2015-01-14 22:23:56 +00:00
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_jarjar_jar)
|
2013-10-28 13:20:52 +00:00
|
|
|
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
|
|
|
|
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
Running jarjar on Java resources.
Before this change, Java resources are added as a separate step
(add-java-resources-to-package) after dex is run, so jarjar isn't run on
the resource files.
With this change, we add Java resources immediately after we call javac,
so jarjar is run on the resource files (the module's own resource, as
well as resources carried by static Java libraries).
When we generate the final apk/jar, we use the jarjar'ed jar as the
inital pacakge file, with class files and empty folders removed.
When jack is enabled, in jack-java-to-dex we add the Java resources to
a temp jar using the PRIVATE_EXTRA_JAR_ARGS, and extrac the files in a
temp dir. Jack will process the resource files and output the result to
PRIVATE_JACK_INTERMEDIATES_DIR. When we package the final apk/jar, we
need to call add-carried-jack-resources to readd the resources.
(TODO: if jack can output all resources to a jar/zip file, we can use
that file as the initial package file as well.)
Bug: 18837479
Change-Id: I8d7296e30ec8d005054cf04c4f2aed6d7a0d823b
2015-01-14 22:23:56 +00:00
|
|
|
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
|
2013-10-28 13:20:52 +00:00
|
|
|
$(add-dex-to-package)
|
|
|
|
|
2014-09-08 12:45:14 +00:00
|
|
|
else # LOCAL_USE_JACK
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): \
|
|
|
|
PRIVATE_JACK_INTERMEDIATES_DIR := $(intermediates.COMMON)/jayces
|
|
|
|
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JACK_DEBUG_FLAGS := -g
|
|
|
|
|
|
|
|
$(built_dex): PRIVATE_CLASSES_JACK := $(full_classes_jack)
|
|
|
|
$(built_dex): PRIVATE_JACK_FLAGS := $(LOCAL_JACK_FLAGS)
|
|
|
|
$(built_dex): $(java_sources) $(java_resource_sources) $(full_jack_lib_deps) \
|
|
|
|
$(jar_manifest_file) $(proto_java_sources_file_stamp) $(LOCAL_MODULE_MAKEFILE) \
|
|
|
|
$(LOCAL_MODULE_MAKEFILE) $(LOCAL_ADDITIONAL_DEPENDENCIES) $(JACK_JAR)
|
|
|
|
@echo Building with Jack: $@
|
|
|
|
$(jack-java-to-dex)
|
|
|
|
|
|
|
|
$(full_classes_jack): $(built_dex)
|
|
|
|
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
|
|
|
|
$(LOCAL_BUILT_MODULE): $(built_dex) $(java_resource_sources)
|
|
|
|
@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
|
2015-01-22 19:53:00 +00:00
|
|
|
$(call initialize-package-file,$(PRIVATE_SOURCE_ARCHIVE),$@)
|
2014-09-08 12:45:14 +00:00
|
|
|
$(add-dex-to-package)
|
|
|
|
$(add-carried-jack-resources)
|
|
|
|
|
|
|
|
endif # LOCAL_USE_JACK
|
|
|
|
|
2013-10-28 13:20:52 +00:00
|
|
|
USE_CORE_LIB_BOOTCLASSPATH :=
|