I'm replying through the dev mailing list as others could help and/or comment that way.

In my personal point of view as Gradle build scripts are read-only. The are wide variety of those files out there.

An editor hint might work. Though detecting if the given compiler arg is set for a source set may require support from the plugin and the generated additional code might not work at all.

On 5/15/19 6:20 AM, Arunava Sinha wrote:
Hi laszlo,

I am working on below issue to enable preview feature in java projects.(Planned to support for ant/maven/gradle projects).
https://issues.apache.org/jira/browse/NETBEANS-2457

Hints will add below parameters in build.gradle file to enable preview.

compileJava {
    options.compilerArgs =['--enable-preview']
}
run{
    jvmArgs(['--enable-preview'])
}


I am not able to find and utility/model class to read and write into build.gradle. So I am planning to read  build.gradle as text file line by line and then will manipulate the lines to add the parameters .

I will be using the below APIs

java.nio.file.Files.readAllLines(<build.gradle file path>, StandardCharsets.UTF_8); java.nio.file.File.write(<build.gradle file path>, lines, StandardCharsets.UTF_8);

Also I found that even if parameters were added in build.gradle, in editor it still shows error for that below fix I am proposing

https://github.com/arusinha/incubator-netbeans/pull/3

Please let me know is there any better approach to read/write build.gradle file.

Regards,
Arunava sinha

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to