per-module module-source-path for javac

Nikolay Chashnikov nikolay.chashnikov at jetbrains.com
Fri Dec 16 16:57:58 UTC 2016


Hi Jonathan,

thank you, glad to hear it.

Regarding API design: we already have JavaFileManager#getLocationForModule
which takes Location and moduleName, so it looks logical to add
setLocationForModule which takes location, moduleName and list of paths, as
you suggested. It would be useful not only for MODULE_SOURCE_PATH, but also
for example for CLASS_OUTPUT to allow users specify output directories on
per-module basis. In this way, 'setLocation' method can be used to specify
paths for all modules at once if they follow the same naming scheme, and
'setLocationForModule' can be used if locations of modules don't follow any
common scheme.

On Fri, Dec 16, 2016 at 5:50 PM, Jonathan Gibbons <
jonathan.gibbons at oracle.com> wrote:

> Nikolay,
>
> We are looking at this.
>
> One aspect of the problem we have to take into account is that currently,
> the JavaFileManager API does not special case the module source path (yes,
> I know the *implementation* special cases it, even at the handleOption
> level) and so we need to come up with a way providing and specifying the
> functionality you are looking for in a way that fits in with the overall
> design.
>
> -- Jon
>
>
>
> On 12/16/16 5:05 AM, Nikolay Chashnikov wrote:
>
>> Any comments?
>>
>> On Mon, Dec 12, 2016 at 8:29 PM, Nikolay Chashnikov <
>> nikolay.chashnikov at jetbrains.com> wrote:
>>
>> Hello,
>>>
>>> we're actively working on support for Jigsaw in IntelliJ IDEA. Some time
>>> ago we asked (see this post
>>> <http://mail.openjdk.java.net/pipermail/jigsaw-dev/2016-Octo
>>> ber/009713.html>)
>>> about restrictions in --module-source-path parameter of javac command
>>> line.
>>> It appears that currently javac has rather strict requirements regarding
>>> layout of the source files of multi-module projects on the disk: module
>>> sources must be located under a directory which name is equal to the
>>> (qualified) module name, and locations of source directories for
>>> different
>>> modules must follow some common scheme. It's ok for new projects, but it
>>> complicates migration of existing projects to Jigsaw: you not only need
>>> to
>>> create module-info.java files, get rid of split packages, etc, but also
>>> most probably you'll need to rearrange directories containing the
>>> sources.
>>> For me, the latter looks like an unnecessary complication, it may make
>>> migration to Jigsaw more difficult, especially for big projects developed
>>> by large teams. I think it would be great to allow users to specify
>>> module-source-path for each module individually.
>>>
>>> Given that the implementation (com.sun.tools.javac.file.Locations.
>>> ModuleSourcePathLocationHandler) already stores paths for different
>>> modules separately, it seems to be rather easy to expose ability to
>>> specify
>>> module-source-path on per-module basis to StandardJavaFileManager's API.
>>> The change in API suggested by Jonathan Gibbons (see this post
>>> <http://mail.openjdk.java.net/pipermail/jigsaw-dev/2016-Octo
>>> ber/009781.html>)
>>> looks good, it will allow us to support arbitrary layout of sources in
>>> IntelliJ IDEA. Do you plan to implement it? How can we help you with
>>> that?
>>>
>>> --
>>> Nikolay Chashnikov
>>> Team Lead
>>> JetBrains
>>> http://www.jetbrains.com
>>> The Drive to Develop
>>>
>>>
>>
>>
>


-- 
Nikolay Chashnikov
JetBrains
http://www.jetbrains.com
The Drive to Develop


More information about the jigsaw-dev mailing list