You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "lkishalmi (via GitHub)" <gi...@apache.org> on 2023/12/11 07:02:50 UTC
[PR] Support for multiple NetBeans Gradle Tooling [netbeans]
lkishalmi opened a new pull request, #6829:
URL: https://github.com/apache/netbeans/pull/6829
This one is a proposed draft to allow plugins to provide their own discovery tooling library.
The motivation is that right now every Gradle discovery has to go into `netbeans-gradle-tooling` external library,Which is already stuffed. Also to be future proof we probably would use different version of these libraries when working with different Gradle versions. Right now we are using Gradle 7.4 to build our tooling on, which still has support for deprecated APIs, but already has new enough recent features. That might be no longer true with Gradle 9.0.
This would be a multi commit series PR. The first one is extending NetBeans with a `GradlePluginProvider` service.
The following would be figuring out how to wire this support into the project introspection.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Support for multiple NetBeans Gradle Tooling [netbeans]
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on code in PR #6829:
URL: https://github.com/apache/netbeans/pull/6829#discussion_r1422036468
##########
extide/gradle/src/org/netbeans/modules/gradle/loaders/GradleDaemon.java:
##########
@@ -52,22 +52,45 @@ public final class GradleDaemon {
private GradleDaemon() {}
- public static String initScript() {
- File initScript = Places.getCacheSubfile("gradle/nb-tooling.gradle"); //NOI18N
- synchronized (initScriptReady) {
- if (!initScriptReady.get()) {
- File initTemplate = InstalledFileLocator.getDefault().locate(INIT_SCRIPT_NAME, NbGradleProject.CODENAME_BASE, false);
- try (Stream<String> lines = Files.lines(initTemplate.toPath())) {
- List<String> script = lines.map(line -> line.replace(PROP_TOOLING_JAR, TOOLING_JAR)).collect(Collectors.toList());
- Files.write(initScript.toPath(), script);
- initScriptReady.set(true);
- } catch(IOException ex) {
- // This one is unlikely
- LOG.log(Level.WARNING, "Can't create NetBeans Gradle init script", ex); //NOI18N
- // Let it pass trough. Gradle call will display some errors as well
+ public static String initScript(GradleRuntime rt) {
+ Path initScript = rt.rootDir.toPath().resolve(".gradle/nb-tooling.gradle"); //NOI18N
+ String onDisk = "";
+ try {
+ onDisk = Files.readString(initScript);
+ } catch (IOException ex) {}
+ String init = generateInitScript(rt);
+ if (!onDisk.equals(init)) {
+ try {
+ Files.createDirectories(initScript.getParent());
+ Files.writeString(initScript, init);
+ } catch (IOException ex) {}
+ }
+ return initScript.toString();
+ }
+
+ private static String generateInitScript(GradleRuntime rt) {
+ var providers = Lookup.getDefault().lookupAll(GradlePluginProvider.class);
+ try (var wr = new StringWriter()) {
+ wr.append("initscript {\n");
+ wr.append(" dependencies {\n");
+ for (GradlePluginProvider pvd : providers) {
Review Comment:
A suggestion: if a `GradlePluginProvider` had a method `boolean accepts(GradleRuntime r)`, then the providers can be filtered centrally. In the current state, each of the methods (classpath, plugins) need to accept `GradleRuntime and test for applicable version`.
Alternatively (future-compatible), suggest to have just
```
@CheckForNull GradlePluginDescriptor getPlugins(GradleRuntime r);
public final class GradlePluginDescriptor {
Collection<File> getClasspath(GradleRuntime runtime) {...}
Collection<String> getPlugins(GradleRuntime runtime) {...}
}
```
which could eventually allow to compatibly add more information in the future, if needed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Support for multiple NetBeans Gradle Tooling [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on PR #6829:
URL: https://github.com/apache/netbeans/pull/6829#issuecomment-1850644186
> Do you plan also to make the `Extractors` to be version-aware ?
Good point. Shall we? I'm thinking of that they are providing an ugly but stable serialization facade to NetBeans. If it is not necessary I would don't go into that direction.
The primary goal here is to provide plugins to have their own tooling. I'd like to have one that provides ANTLR source sets on the project UI. with the current structure, I'd need to add that as a `GradleJavaSourceSet.SourceType` which oddly fits there and I would like to avoid that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Support for multiple NetBeans Gradle Tooling [netbeans]
Posted by "lkishalmi (via GitHub)" <gi...@apache.org>.
lkishalmi commented on PR #6829:
URL: https://github.com/apache/netbeans/pull/6829#issuecomment-1850415944
There is not too much info on Gradle 9.0, besides a bunch of warnings, that things are up for a removal.
So I do not know for sure if Gradle 9.0 would break anything. I think you would agree that the tooling code is already "stretched" enough with `beforeGradle()` and `afretGradle()` phases.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Support for multiple NetBeans Gradle Tooling [netbeans]
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on PR #6829:
URL: https://github.com/apache/netbeans/pull/6829#issuecomment-1850445105
> There is not too much info on Gradle 9.0, besides a bunch of warnings, that things are up for a removal.
>
> So I do not know for sure if Gradle 9.0 would break anything. I think you would agree that the tooling code is already "stretched" enough with `beforeGradle()` and `afretGradle()` phases.
Definitely.
Do you plan also to make the `Extractors` to be version-aware ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Support for multiple NetBeans Gradle Tooling [netbeans]
Posted by "sdedic (via GitHub)" <gi...@apache.org>.
sdedic commented on PR #6829:
URL: https://github.com/apache/netbeans/pull/6829#issuecomment-1849504945
A question: I couldn't find a roadmap / tentative schedule for Gradle 9.0 ... can you share a link?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists