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
diff --git a/core/definitions.mk b/core/definitions.mk
index cfc2897..1ed2ca2 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2247,7 +2247,8 @@
$(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 @@
@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 ) && \
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 81fddd9..da80509 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -112,6 +112,7 @@
$(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 @@
$(java_source_list_file) \
$(java_sources_deps) \
$(full_java_header_libs) \
+ $(full_java_bootclasspath_libs) \
$(NORMALIZE_PATH) \
$(JAR_ARGS) \
$(ZIPTIME) \
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 03dc67c..43a04cc 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -82,6 +82,7 @@
$(java_source_list_file) \
$(java_sources_deps) \
$(full_java_libs) \
+ $(full_java_bootclasspath_libs) \
$(annotation_processor_deps) \
$(NORMALIZE_PATH) \
$(ZIPTIME) \
diff --git a/core/java.mk b/core/java.mk
index ea16779..dca242f 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -484,6 +484,7 @@
$(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 @@
$(java_source_list_file) \
$(java_sources_deps) \
$(full_java_header_libs) \
+ $(full_java_bootclasspath_libs) \
$(NORMALIZE_PATH) \
$(JAR_ARGS) \
$(ZIPTIME) \
diff --git a/core/java_common.mk b/core/java_common.mk
index d39e275..ca52626 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -201,29 +201,31 @@
$(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 @@
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)