RFR: JDK-8171859: Configure check for modular boot jdk needs to be updated

Mandy Chung mandy.chung at oracle.com
Thu Dec 22 17:17:33 UTC 2016


+1

Mandy

> On Dec 22, 2016, at 8:53 AM, Erik Joelsson <erik.joelsson at oracle.com> wrote:
> 
> Here is a new patch, using --list-mods instead, seems cleaner to me.
> 
> diff -r 84c58139cbd3 common/autoconf/boot-jdk.m4
> --- a/common/autoconf/boot-jdk.m4
> +++ b/common/autoconf/boot-jdk.m4
> @@ -305,9 +305,8 @@
>   BOOT_JDK_SOURCETARGET="-source 8 -target 8"
>   AC_SUBST(BOOT_JDK_SOURCETARGET)
> 
> -  ADD_JVM_ARG_IF_OK([--patch-module foo=bar], dummy, [$JAVA])
>   AC_MSG_CHECKING([if Boot JDK supports modules])
> -  if test "x$JVM_ARG_OK" = "xtrue"; then
> +  if "$JAVA" --list-modules > /dev/null 2>&1; then
>     AC_MSG_RESULT([yes])
>     BOOT_JDK_MODULAR="true"
>   else
> 
> 
> /Erik
> 
> 
> On 2016-12-22 17:48, Erik Joelsson wrote:
>> Hello,
>> 
>> Thanks for the suggestions. The way the test is currently implemented is using a framework for finding valid JVM parameters. It basically runs:
>> 
>> java $ArgToTest -version
>> 
>> and parses the output for warnings and verifies that the version was printed. After looking at this more closely, I realize the --patch-module option was chosen to fit this kind of test. On the other hand, we could easily change the implementation here to just run "java --list-modules > /devnull" and check the return code. That's probably cleaner anyway.
>> 
>> /Erik
>> 
>> On 2016-12-22 17:33, Mandy Chung wrote:
>>> Using —-patch-module is one option.
>>> 
>>> Alternatively, you can use other new options such as:
>>>   $ java --dry-run -m jdk.compiler/com.sun.tools.javac.Main
>>> 
>>> This stops before invoking the main method.
>>> 
>>> or
>>>   $ java —-list-modules
>>> 
>>> This lists the observable modules in the image.
>>> 
>>> Mandy
>>> 
>>>> On Dec 22, 2016, at 1:39 AM, Erik Joelsson <erik.joelsson at oracle.com> wrote:
>>>> 
>>>> Hello,
>>>> 
>>>> Configure has a check to see if the boot jdk is module aware/enabled. Like many others, the build needs to adapt its behavior when using such a boot jdk. The current check is no longer compatible with the latest JDK 9 builds:
>>>> 
>>>> java -version --patch-module foo=bar
>>>> WARNING: Unknown module: foo specified in --patch-module
>>>> 
>>>> I propose a simple adjustment, to instead specify java.base as the module to patch. I also made it explicit that the directory to patch from does not exist.
>>>> 
>>>> I'm open to suggestions on better tests though, but would prefer if they can be as simple as checking for a command line argument.
>>>> 
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8171859
>>>> 
>>>> Patch:
>>>> 
>>>> diff -r 84c58139cbd3 common/autoconf/boot-jdk.m4
>>>> --- a/common/autoconf/boot-jdk.m4
>>>> +++ b/common/autoconf/boot-jdk.m4
>>>> @@ -305,7 +305,9 @@
>>>>   BOOT_JDK_SOURCETARGET="-source 8 -target 8"
>>>>   AC_SUBST(BOOT_JDK_SOURCETARGET)
>>>> 
>>>> -  ADD_JVM_ARG_IF_OK([--patch-module foo=bar], dummy, [$JAVA])
>>>> +  # Use a non existing directory as the directory will be scanned otherwise
>>>> +  # and can potentially take a lot of time.
>>>> +  ADD_JVM_ARG_IF_OK([--patch-module java.base=SOME_DIR_THAT_DOES_NOT_EXIST], dummy, [$JAVA])
>>>>   AC_MSG_CHECKING([if Boot JDK supports modules])
>>>>   if test "x$JVM_ARG_OK" = "xtrue"; then
>>>>     AC_MSG_RESULT([yes])
>>>> 
>>>> 
>>>> /Erik
>>>> 
>> 
> 




More information about the build-dev mailing list