Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f795dcb7 authored by Tobias Thierer's avatar Tobias Thierer
Browse files

Experimental feature: LOCAL_PATCH_MODULE option in .mk files.

Specifying this option causes the make target's sources
and classpath dependencies to be patched into the specified
module via --patch-module (if the build toolchain implements
the module system, ie. when targeting 1.9). This allows tests
to compile that have classes in packages under test.

Currently, only java.base is on the module path (everything
else is on the classpath), and only when using -target 1.9
(ie. EXPERIMENTAL_USE_OPENJDK9=true).

Bug: 71699916
Test: Treehugger
Test: Checked that I was able to compile some ojluni & icu
      test sources that had classes in (libcore) packages
      under test.

Change-Id: I044fb9d904754ed281f574ab3dd52235cf0d7fec
parent 9eba210e
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -762,6 +762,19 @@ does this.</p>
Dialer, Contacts, etc.  This will probably change or go away when we switch
to an ant-based build system for the apps.</p>

<h4>LOCAL_PATCH_MODULE (experimental option)</h4>
<p>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.</p>
<p>
When compiling language level 9+ .java code in packages that are part of a
a system module, <code>LOCAL_PATCH_MODULE</code> 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.
</p>

<h4>LOCAL_PATH</h4>
<p>The directory your Android.mk file is in. You can set it by putting the
following as the first line in your Android.mk:</p>
+1 −0
Original line number Diff line number Diff line
@@ -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:=
+3 −0
Original line number Diff line number Diff line
@@ -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),) \
+1 −0
Original line number Diff line number Diff line
@@ -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