Closed sormuras closed 6 years ago
After the perfer
addition in release v0.10+44a
... I willl give formatter
another chance.
For the javac-9-dev-r3297-1-shaded.jar, it would be cool if google-java-format had an option to use javac through the service interface as we do in the compiler plugin instead of using its own version.
Sure. That would simplify the integration work.
@forax How can I help resolver
with a module name?
java.lang.IllegalArgumentException: javac.shaded.9.dev.r4023: Invalid module name: '9' is not a Java identifier
[resolver] Unable to derive module descriptor for R:\dev\github\forax\pro\.\plugins\formatter\target\deps\maven-local\com\google\errorprone\javac-shaded\9-dev-r4023-3\javac-shaded-9-dev-r4023-3.jar
Using this boot strap commands:
compileAndPackagePlugin("formatter", () -> {
String gjfVersion = "1.5";
String guavaVersion = "24.1";
String javacShadedVersion = "9+181-r4173-1";
set("resolver.dependencies", list(
// "Google Java Format"
"com.google.googlejavaformat=com.google.googlejavaformat:google-java-format:" + gjfVersion,
"com.google.guava=com.google.guava:guava:" + guavaVersion,
"com.google.errorprone=com.google.errorprone:javac-shaded:" + javacShadedVersion,
"com.google.j2objc=com.google.j2objc:j2objc-annotations:1.1",
"org.codehaus.animal.sniffer.annotations=org.codehaus.mojo:animal-sniffer-annotations:1.14"
));
});
The Manifest of the jar do not contains the property Automatic-Module-Name so the module API try to gess a name and fail. The best is to ask @cushon to add the property Automatic-Module-Name.
In the meantime, the only workaround i see is to download the jar by hand, rename it and commit it in the git repo.
GJF 1.6 will include it: https://github.com/google/google-java-format/commit/4d728e7cfac4e47f98127576ee14583e1babf8e8
Thought there was a chance to "modulefix" it. :)
I'll stick with the external java
process using google-java-format-1.5-all-deps.jar
on the classpath for now.
Superseded by #57
@cushon said he'll fix the modular problems within error-prone. Looks like we may move from '-all-deps.jar' and spawing another process to a real module-based plugin.
See https://github.com/google/google-java-format/issues/266#issuecomment-380325034 and a minimal running test at https://github.com/sormuras/bach/tree/master/demo/03-google-java-format-as-library (placing error-prone on the class-path)
Overview
Based on google-java-format -- a program that reformats Java source code to comply with Google Java Style.
The current implementation uses the
--module-path
option to launch the program. I didn't managed to make modules via module-fixer out of neither the "-all-deps" distro nor the 3 single jars:google-java-format-1.3.jar
,guava-19.0.jar
andjavac-9-dev-r3297-1-shaded.jar
The "-all-deps" jar is downloaded on-the-fly via
Boostrap.download(...)
-- a candidate forPro
itself?The "-all-deps" jar is stored in a subfolder called
plugins/formatter/libs/
. All jars found in that folder are not resolved, nor module-fixed. They are copied over to thetarget/pro
image as-is.TODO
javaFiles()
configurablejava
provides a "fake-guava" module which collides with the one bundled in google-java-format-