Achal1607 commented on code in PR #8897:
URL: https://github.com/apache/netbeans/pull/8897#discussion_r2425879855
##########
extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NetBeansRunSinglePlugin.java:
##########
@@ -64,6 +69,20 @@ public void apply(Project project) {
}
private void configureJavaExec(Project project, JavaExec je) {
+ Object sourceSetValue =
project.findProperty(RUN_SINGLE_SOURCE_SET_NAME);
+ if (sourceSetValue != null) {
+ SourceSetContainer sourceSets =
project.getExtensions().findByType(SourceSetContainer.class);
+ if (sourceSets != null) {
+ FileCollection additionalClassPath =
Arrays.stream(sourceSetValue.toString().split(","))
+ .map(String::trim)
+ .map(sourceSets::findByName)
+ .filter(Objects::nonNull)
+ .map(SourceSet::getRuntimeClasspath)
+ .reduce(project.getObjects().fileCollection(),
FileCollection::plus);
+
+ je.setClasspath(je.getClasspath().plus(additionalClassPath));
Review Comment:
Thanks, for the suggestion. I have updated the code accordingly. Also,
tested with independent sourceSets i.e. apart from `main` and `test`. It seems
to be working fine.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
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