Task to print artifacts for each configuration


(Mark Maxey) #1

Has anyone considered adding a Help task that will print out all the artifacts associated with each defined configuration? The dependencies task prints the dependencies for each configuration. I couldn’t find a way figuring out the artifacts per configuration without writing a task myself:

task artifacts {
 group = "Help"
 description = "Displays the artifacts associated with each configuration of " + project
 doFirst {
  configurations.findAll().each { config ->
   println "${config}:"
   config.allArtifacts.getFiles().each { file -> println "
" + file}
   println ' '
  }
 }
}

(Andrew Oberstar) #2

It’s very hard sometimes to tell where those end up mapping, I could see that being useful.


(Jon Austen) #3

Neat idea to add onto this post:

task show << {
    println "-----------------------------------"
    println "Loading build.gradle configuration..."
    println ""
    println "
 _____
             _ _
        "
    println "
/ ____|
           | | |
       "
    println " | |
__ _ __ __ _
__| | | ___
   "
    println " | | |_ | '__/ _' |/ _' | |/ _ \
  "
    println " | |__| | | | (_| | (_| | |
__/
  "
    println "
\_____|_|
\__,_|\__,_|_|\___|
  "
    println ""
    println "Build output: " + relativePath(compileJava.destinationDir)
    println "Resources output: " + relativePath(processResources.destinationDir)
    println "Version: " + projVersion
    println "Main class: " + projMain
    println "Project Name: " + projTitle
    println "-----------------------------------"
}

(Carlo Luib-Finetti) #4

Nice command line screen, but: this works for you? First, I had to mask “” chars, and next it complained “Could not find property ‘compileJava’ on task ‘:show’” and more…


(Jon Austen) #5

Strangely, I think the “code” plugin within this forum removed the escape slashes from the post. Basically, it looks like there is a bug in the code markup plugin on this forum. The code works, you just need to re-add the escape chars.


(Alex Nitavsky) #6

escaped:

println “”

println "


_ _

"

println " / ____|

| | |

"

println " | | __ _ __ __ _ __| | | ___

"

println " | | |_ | ‘__/ _’ |/ _’ | |/ _ \

"

println " | |__| | | | (| | (| | | __/

"

println " \|_| \,_|\,||\__| "