Separate compilation of module-info.java#73
Separate compilation of module-info.java#73paulbakker merged 4 commits intojava9-modularity:masterfrom
Conversation
9b94f1d to
365192c
Compare
paulbakker
left a comment
There was a problem hiding this comment.
Finally had time to review this. Really excellent work!
I have a few very minor suggestions and questions, but other than that I'm happy to merge.
| Compilation to a specific Java release | ||
| ---- | ||
|
|
||
| For Java releases 6-8, see [Separate compilation of `module-info.java`](#separate-compilation-of-module-infojava). |
There was a problem hiding this comment.
Add some more description why this is useful and when to use which option. You explained this really well in the issue, maybe move some of that to the docs.
There was a problem hiding this comment.
I added more description, although I didn't copy it from the issue, because it seemed to me I already copied all the necessary stuff to the "Separate compilation of module-info.java" section.
Please, let me know if the updated version reads well. I'll gladly reword/restructure it further if you provide me with any remarks you might have.
|
Thanks for your feedback, Paul! I'll provide the requested changes within a few days. Please, let me know if you prefer:
As I mentioned, I'd much prefer that the commits aren't squashed for clear change history. |
|
I'm fine with either, whatever you think shows intentions best. |
necessary for further commits MAIN: 1) renamed TestModuleOptions.isRunOnClasspath() to getRunOnClasspath() (otherwise won't work with Kotlin DSL) + added a Kotlin DSL example for "runOnClasspath = true" to README.md 2) introduced JavaProjectHelper and applied it to CompileTask 3) added comments for all anonymous classes that should not be removed 4) minor improvements in ModuleSystemPlugin 5) minor fixes in test-project-kotlin/README.md TEST: 1) bumped smoke-test Gradle version to 5.0 (for improved Kotlin DSL) 2) introduced a no-op "moduleOptions" access in greeter.api (for testing DSL) 3) introduced SmokeTestHelper for ModulePluginSmokeTest 4) disabled stackTraceFilters in all tests 5) updated Kotlin to 1.3.20
…rately" added CompileModuleOptions and CompileModuleInfoTask NOTE: potentially breaking change for "compileJava" in Kotlin DSL (see modified "build.gradle.kts")
via ModularityExtension interface
tests the "modularity" extension (incl. verifying generated class file formats)
3df9122 to
86e65c4
Compare
A proof of concept for #72 (actually, it's a fully working solution, but since #72 hasn't been discussed yet, I call it a proof of concept for now).
This PR consists of four clearly separated commits (every commit passes the build):
TestModuleOptions.isRunOnClasspath()togetRunOnClasspath()(otherwise it doesn't work with Kotlin DSL)moduleOptions.compileModuleInfoSeparately(low-level API)moduleOptions.compileModuleInfoSeparately = true, introduces a specialcompileModuleInfoJavatask → boils down to (Groovy DSL):compileJava { exclude 'module-info.java' } tasks.register('compileModuleInfoJava', JavaCompile) { classpath = files() source = 'src/main/java/module-info.java' destinationDir = compileJava.destinationDir } compileModuleInfoJava.dependsOn compileJava classes.dependsOn compileModuleInfoJavacompileModuleInfoJavainstead ofcompileJava(but always usingcompileJava's class-path as module-path)module-info.classlocation: root output directoryCompileModuleOptions extends ModuleOptions, which is a potentially breaking change forcompileJavain Kotlin DSL (see modifiedbuild.gradle.kts)modularityproject extension (high-level API)ModularityExtensioninterface--releaseoptions forcompileJavaandcompileModuleInfoJavatest-project-mixedmodularity.mixedJavaReleaseandmodularity.standardJavaReleaselocal_maven_build.gradleandsmoke_test_build.gradleby usingpluginManagementin*_settings.gradlefiles (can be ported to other test projects)PS. If you decide to merge this PR, I'd appreciate if you didn't squash the commits (they are separated on purpose, to provide a clear change history).