sdedic opened a new pull request, #4517:
URL: https://github.com/apache/netbeans/pull/4517

   This is a WIP **and will not be merged** - I'll create a new PR for the 
actual merge. This PR is meant as a heads-up or preview.
   
   The original goal was to 'find out what file(s) / artifact(s) a project 
produces". I started with JAR initially ... and then followed up by support for 
micronaut / native-image. And then things got very complicated. With all the 
Gradle convetions, defaulting from task to extension properties ...
   
   Initially I wanted to extract metadata out of the gradle build: If the IDE 
knows what tasks are there, what are properties of those tasks and - if the 
value is structured - what are the nested properties etc, the IDE might be able 
to quick-parse the buildscript, ignore closures and find out property values. 
The same for extensions.
   Then I've realized that I could eventually extract the computed values, too 
- it is possible to ask provider NOT to run tasks, but return values as they 
are computed at the start of the build. Not perfect, but sufficient.
   
   So in this PR you can find & comment the code that sucks information out of 
the gradle build. With this support, finding out the directory and filename of 
a JAR produced is a simple matter of:
   
   ```
               BuildPropertiesSupport props = 
BuildPropertiesSupport.get(project);
               Property p = props.findTaskProperty("jar", "archiveFileName");
               if (p != null && p.getStringValue() != null) {
                   filename = p.getStringValue();
               } else {
                   // Some guess based on project name and version
               }
               p = props.findTaskProperty("jar", "destinationDirectory");
               if (p != null && p.getStringValue() != null) {
                   dir = p.getStringValue();
               }
   ```
   
   ... and it WORKS !


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

Reply via email to