You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/06/29 11:47:41 UTC

[GitHub] [netbeans] sdedic commented on a diff in pull request #4287: Allow to find precise output folder for each language.

sdedic commented on code in PR #4287:
URL: https://github.com/apache/netbeans/pull/4287#discussion_r909530753


##########
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:
   Fixed in 01cb17c54a



-- 
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