Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: Use --module-source-path and --module for javac/javadoc/etc. #128

Open
tlinkowski opened this issue Dec 8, 2019 · 1 comment
Open
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@tlinkowski
Copy link
Collaborator

Currently, we instrument javac and javadoc with --module-path and some other options, but we're not making use of --module-source-path. Such approach means that some references between module descriptors are not allowed although they should (compilation fails).

Example

module A {
  requires B;
}
module B {
  exports org.test.pkg to A;
}

Currently, Gradle will first try to compile B's module-info.java, but it will fail saying that it can't find module A.

With --module-source-path + --module (as suggested by @sormuras), we should be able to compile one module at a time (as we do now), but with the awareness of other modules before they're compiled.

Problems

  1. To use --module-source-path, projects need to be in a layout where project dir name = module name. There's a convention for such naming (again, by @sormuras), but it's not widely used yet. Hence, this plugin would need to work for any kind of layout.

    • Potential solution: add a build-wide task that would copy all the module-info.java files into e.g. build/modules (all compileJava and javadoc tasks would need to depend on such a task).
@tlinkowski tlinkowski added the enhancement New feature or request label Dec 8, 2019
@sormuras
Copy link
Contributor

sormuras commented Dec 10, 2019

It would be sooo ... normal, if Gradle supported Java modules (including all related standard javac options) out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants