Open gbl opened 5 years ago
How are you setting it? Through the CompileOptions.compilerArgs
? Anyway, if something is readable from the Gradle script, then it can be done with relatively little pain.
I don't really understand a lot about Gradle, I'm just using somebody's script from here: https://github.com/FabricMC/fabric-loom
That thing has, in AbstractPlugin.java (I amended some logging):
project.getLogger().lifecycle(":setting java compiler args");
try {
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFileNamedIntermediary=" + extension.getMappingsProvider().MAPPINGS_TINY.getCanonicalPath());
javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFileNamedIntermediary=" + extension.getMappingsProvider().MAPPINGS_MIXIN_EXPORT.getCanonicalPath());
javaCompileTask.getOptions().getCompilerArgs().add("-AoutRefMapFile=" + new File(javaCompileTask.getDestinationDir(), extension.getRefmapName()).getCanonicalPath());
javaCompileTask.getOptions().getCompilerArgs().add("-AdefaultObfuscationEnv=named:intermediary");
} catch (IOException e) {
e.printStackTrace();
}
project.getLogger().lifecycle(String.join("\n",javaCompileTask.getOptions().getCompilerArgs()));
Of course it would be great if the netbeans plugin could catch these options when it runs a build. But a way to input them manually, like the annotation processor input box in standard ant netbeans projects (project/properties/compiling) would be greatly appreciated as well.
I have a project that uses annotations, with an annotation processor that needs some configuration. The Gradle plugin itself uses several "-AX=Y" options to pass this configuration to the compiler.
NetBeans with the netbeans-gradle-project plugin finds the annotation processor and seems to call it when syntax-checking editor contents, but without those options, which results in the processor emitting warnings/errors, which in turn get marked as errors in the editor.
As far as I can tell, the org/netbeans/gradle/project/java/query/GradleAnnotationProcessingQuery.java file is responsible for configuring the annotation processor, and as that class has a processorOptions() method which always returns an empty map, there's no configuration option, not even a hard-to-find or hidden one, to configure those options.
Unfortunately, I know way too little about the netbeans ecosystem to create a PR myself, but I hope this won't be too hard to implement for someone who does.