lbownik commented on code in PR #4287:
URL: https://github.com/apache/netbeans/pull/4287#discussion_r908805056
##########
extide/gradle/netbeans-gradle-tooling/src/main/java/org/netbeans/modules/gradle/tooling/NbProjectInfoBuilder.java:
##########
@@ -307,6 +354,43 @@ private void detectSources(NbProjectInfoModel model) {
}
model.getInfo().put(propBase + lang +
"_compiler_args", new ArrayList<>(compilerArgs));
}
+ if (Boolean.TRUE.equals(available.get(langId))) {
+ model.getInfo().put(propBase + lang,
storeSet(getProperty(sourceSet, langId, "srcDirs")));
+ DirectoryProperty dirProp =
(DirectoryProperty)getProperty(sourceSet, langId, "classesDirectory");
+ if (dirProp != null) {
+ File outDir;
+
+ if (dirProp.isPresent()) {
+ outDir = dirProp.get().getAsFile();
+ } else {
+ // kotlin plugin uses some weird late
binding, so it has the output item, but it cannot be resolved to a
+ // concrete file path at this time. Let's
make an approximation from
+ Path candidate = null;
+ if (base != null) {
+ Path prefix = base.resolve(langId);
+ // assume the language has just one
output dir in the source set:
+ for (int i = 0; i < outPaths.size();
i++) {
+ Path p = outPaths.get(i);
+ if (p.startsWith(prefix)) {
+ if (candidate != null) {
+ candidate = null;
+ break;
+ } else {
+ candidate = p;
+ }
+ }
+ }
+ }
+ if (candidate != null) {
Review Comment:
how about ternary operator here?
--
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