Add dependencies on bootclasspath libraries

The libraries in the bootclasspath were getting their dependencies
because they were also in the default libraries list.  Make the
dependencies explicit in preparation for rearranging the default
libraries.

Test: m -j checkbuild
Change-Id: I3ea004714a31cd648ec2ef57ed3099bce70bc6b9
This commit is contained in:
Colin Cross 2017-09-23 18:19:05 -07:00
parent f6bc1a1ac0
commit 1d1e5ef61b
5 changed files with 29 additions and 13 deletions

View File

@ -2247,7 +2247,8 @@ $(hide) mkdir -p $(PRIVATE_CLASS_INTERMEDIATES_DIR) $(PRIVATE_ANNO_INTERMEDIATES
$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \
$(SOONG_JAVAC_WRAPPER) $(1) -encoding UTF-8 \
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
$(2) \
$(addprefix -bootclasspath ,$(strip \
$(call normalize-path-list,$(2)))) \
$(addprefix -classpath ,$(strip \
$(call normalize-path-list,$(3)))) \
$(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \
@ -2286,9 +2287,11 @@ define transform-java-to-header.jar
@mkdir $(dir $@)/classes-turbine
$(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \
$(JAVA) -jar $(TURBINE) \
--output $@.premerged --temp_dir $(dir $@)/classes-turbine -$(PRIVATE_BOOTCLASSPATH) \
--output $@.premerged --temp_dir $(dir $@)/classes-turbine \
--sources \@$(PRIVATE_JAVA_SOURCE_LIST) \
--javacopts $(PRIVATE_JAVACFLAGS) $(COMMON_JDK_FLAGS) \
$(addprefix --bootclasspath, $(strip \
$(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH)))) \
$(addprefix --classpath ,$(strip \
$(call normalize-path-list,$(PRIVATE_ALL_JAVA_HEADER_LIBRARIES)))) \
|| ( rm -rf $(dir $@)/classes-turbine ; exit 41 ) && \

View File

@ -112,6 +112,7 @@ $(full_classes_compiled_jar): \
$(java_source_list_file) \
$(java_sources_deps) \
$(full_java_header_libs) \
$(full_java_bootclasspath_libs) \
$(annotation_processor_deps) \
$(NORMALIZE_PATH) \
$(JAR_ARGS) \
@ -124,6 +125,7 @@ $(full_classes_turbine_jar): \
$(java_source_list_file) \
$(java_sources_deps) \
$(full_java_header_libs) \
$(full_java_bootclasspath_libs) \
$(NORMALIZE_PATH) \
$(JAR_ARGS) \
$(ZIPTIME) \

View File

@ -82,6 +82,7 @@ $(full_classes_compiled_jar): \
$(java_source_list_file) \
$(java_sources_deps) \
$(full_java_libs) \
$(full_java_bootclasspath_libs) \
$(annotation_processor_deps) \
$(NORMALIZE_PATH) \
$(ZIPTIME) \

View File

@ -484,6 +484,7 @@ $(full_classes_compiled_jar): \
$(java_source_list_file) \
$(java_sources_deps) \
$(full_java_header_libs) \
$(full_java_bootclasspath_libs) \
$(layers_file) \
$(annotation_processor_deps) \
$(NORMALIZE_PATH) \
@ -497,6 +498,7 @@ $(full_classes_turbine_jar): \
$(java_source_list_file) \
$(java_sources_deps) \
$(full_java_header_libs) \
$(full_java_bootclasspath_libs) \
$(NORMALIZE_PATH) \
$(JAR_ARGS) \
$(ZIPTIME) \

View File

@ -201,29 +201,31 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_fi
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RMTYPEDEFS := $(LOCAL_RMTYPEDEFS)
full_java_bootclasspath_libs :=
empty_bootclasspath :=
# full_java_libs: The list of files that should be used as the classpath.
# Using this list as a dependency list WILL NOT WORK.
ifndef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SDK_VERSION),)
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
# No bootclasspath. But we still need "" to prevent javac from using default host bootclasspath.
my_bootclasspath := ""
empty_bootclasspath := ""
else # LOCAL_NO_STANDARD_LIBRARIES
my_bootclasspath := $(call java-lib-header-files,core-oj):$(call java-lib-header-files,core-libart)
full_java_bootclasspath_libs := $(call java-lib-header-files,core-oj core-libart)
endif # LOCAL_NO_STANDARD_LIBRARIES
else
ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),current)
# LOCAL_SDK_VERSION is current and no TARGET_BUILD_APPS.
my_bootclasspath := $(call java-lib-header-files,android_stubs_current)
full_java_bootclasspath_libs := $(call java-lib-header-files,android_stubs_current)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),system_current)
my_bootclasspath := $(call java-lib-header-files,android_system_stubs_current)
full_java_bootclasspath_libs := $(call java-lib-header-files,android_system_stubs_current)
else ifeq ($(LOCAL_SDK_VERSION)$(TARGET_BUILD_APPS),test_current)
my_bootclasspath := $(call java-lib-header-files,android_test_stubs_current)
full_java_bootclasspath_libs := $(call java-lib-header-files,android_test_stubs_current)
else
my_bootclasspath := $(call java-lib-header-files,sdk_v$(LOCAL_SDK_VERSION))
full_java_bootclasspath_libs := $(call java-lib-header-files,sdk_v$(LOCAL_SDK_VERSION))
endif # current, system_current, or test_current
endif # LOCAL_SDK_VERSION
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
# In order to compile lambda code javac requires various invokedynamic-
# related classes to be present. This change adds stubs needed for
@ -244,22 +246,28 @@ else # LOCAL_IS_HOST_MODULE
ifeq ($(USE_CORE_LIB_BOOTCLASSPATH),true)
ifeq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
my_bootclasspath := ""
empty_bootclasspath := ""
else
my_bootclasspath := $(call normalize-path-list,$(call java-lib-header-files,core-oj-hostdex core-libart-hostdex,true))
full_java_bootclasspath_libs := $(call java-lib-header-files,core-oj-hostdex core-libart-hostdex,true)
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(my_bootclasspath)
full_shared_java_libs := $(call java-lib-files,$(LOCAL_JAVA_LIBRARIES),true)
full_shared_java_header_libs := $(call java-lib-header-files,$(LOCAL_JAVA_LIBRARIES),true)
else # !USE_CORE_LIB_BOOTCLASSPATH
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH :=
full_shared_java_libs := $(addprefix $(HOST_OUT_JAVA_LIBRARIES)/,\
$(addsuffix $(COMMON_JAVA_PACKAGE_SUFFIX),$(LOCAL_JAVA_LIBRARIES)))
endif # USE_CORE_LIB_BOOTCLASSPATH
endif # !LOCAL_IS_HOST_MODULE
ifdef empty_bootclasspath
ifdef full_java_bootclasspath_libs
$(call pretty-error,internal error: empty_bootclasspath and full_java_bootclasspath_libs should not both be set)
endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := $(empty_bootclasspath)$(full_java_bootclasspath_libs)
full_java_libs := $(full_shared_java_libs) $(full_static_java_libs) $(LOCAL_CLASSPATH)
full_java_header_libs := $(full_shared_java_header_libs) $(full_static_java_header_libs)