diff --git a/core/build-system.html b/core/build-system.html index c7938ccfb4..3d86e24a9b 100644 --- a/core/build-system.html +++ b/core/build-system.html @@ -762,6 +762,19 @@ does this.

Dialer, Contacts, etc. This will probably change or go away when we switch to an ant-based build system for the apps.

+

LOCAL_PATCH_MODULE (experimental option)

+

As of January 2018, you almost certainly don't need this option, so please +ask and only use it if you understand what you're doing. This feature is +experimental and may go away in future.

+

+When compiling language level 9+ .java code in packages that are part of a +a system module, LOCAL_PATCH_MODULE names the module that your +sources and dependencies should be patched into. The Android runtime currently +(Jan 2018) doesn't implement the JEP 261 module system so this option is only +supported at compile time. It should only be needed to compile tests in packages +that exist in libcore and which are inconvenient to move elsewhere. +

+

LOCAL_PATH

The directory your Android.mk file is in. You can set it by putting the following as the first line in your Android.mk:

diff --git a/core/clear_vars.mk b/core/clear_vars.mk index b4a03ea11e..a151beff76 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -181,6 +181,7 @@ LOCAL_OVERRIDES_MODULES:= LOCAL_PACKAGE_NAME:= LOCAL_PACKAGE_SPLITS:= LOCAL_PACK_MODULE_RELOCATIONS:= +LOCAL_PATCH_MODULE:= LOCAL_PICKUP_FILES:= LOCAL_POST_INSTALL_CMD:= LOCAL_POST_LINK_CMD:= diff --git a/core/definitions.mk b/core/definitions.mk index a20bf44a95..7aef2907fd 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2245,6 +2245,9 @@ $(hide) if [ -s $(PRIVATE_JAVA_SOURCE_LIST) ] ; then \ $(addprefix -bootclasspath ,$(strip \ $(call normalize-path-list,$(PRIVATE_BOOTCLASSPATH)) \ $(PRIVATE_EMPTY_BOOTCLASSPATH)))) \ + $(if $(PRIVATE_USE_SYSTEM_MODULES), \ + $(if $(PRIVATE_PATCH_MODULE), \ + --patch-module=$(PRIVATE_PATCH_MODULE)=$(call normalize-path-list,. $(2)))) \ $(addprefix -classpath ,$(strip \ $(call normalize-path-list,$(2)))) \ $(if $(findstring true,$(PRIVATE_WARNINGS_ENABLE)),$(xlint_unchecked),) \ diff --git a/core/java_common.mk b/core/java_common.mk index cfc9d7f65f..436f3a3b3b 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -359,6 +359,7 @@ endif $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := $(full_java_bootclasspath_libs) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EMPTY_BOOTCLASSPATH := $(empty_bootclasspath) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SYSTEM_MODULES := $(my_system_modules_dir) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PATCH_MODULE := $(LOCAL_PATCH_MODULE) ifndef LOCAL_IS_HOST_MODULE # This is set by packages that are linking to other packages that export