Shay Banon wrote:
Hi,
  Is there a way to try and get this to work with 0.8?


This should work (it's not pretty) :

   task src(type: Copy) {
       from {
// Copy the compile configuration and replace the main artifact with the source artifact for each dep def conf = configurations.compile.copyRecursive { it instanceof ExternalModuleDependency }
           conf.dependencies.each { dep ->
               dep.artifact {
                   group = dep.group
                   name = dep.name
                   version = dep.version
                   classifier = 'sources'
                   type = 'jar'
               }
           }
           conf
       }
       into 'lib/source'
// Add this to clean the target dir first. For Gradle 0.9, you'd use the Sync task instead
       doFirst {
           ant.delete(dir: destinationDir)
       }
   }


Cheers,
Shay


Adam Murdoch-2 wrote:

[email protected] wrote:
On Thu, Nov 26, 2009 at 06:10, Shay Banon <[email protected]> wrote:
Hi,

Is there a way to tell Gradle to download the sources of the jar files as
well? I looked at this thread:
http://old.nabble.com/Dowloading-*-sources.jar-td22064471.html#a22064471, but it looks like Artifact is no longer there, and wondered if there is a
better way to do this.

Cheers,
Shay
--
View this message in context: http://old.nabble.com/Downloading-*-sources-tp26529227p26529227.html
Sent from the gradle-user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



You could create a new config and add the deps with the "sources" classifier. For something like this I think it would be really helpful to be able to modify deps in bulk something like

configurations {
 sources.extendsFrom compile
 sources.addClassifier 'source'
}

or
configurations {
 sources.extendsFrom compile
}

dependencies {
 ...
 sources.each { it.addClassifier 'sources' }
}

The plan is currently something like this, where you will be able to define a configuration as a transformation of another configuration. The transformation might switch transitivity off, or exclude some dependencies, or replace the main jar with the source jar, or (for project deps) replace the main jar with the classes dir, or whatever. The transformed configuration would be live, so that it tracks changes to the original configuration.

This is possibly a Gradle 0.9 feature, or more likely a Gradle 0.10
feature.

Or maybe you could just have a sources configuration that automatically looks for the 'source' classifier, that would work nicely too.

We might have some convenience transformations for common things, like getting the source jars for a configuration. We could combine them with rules, too, so you could use configurations.<configName>Source to get the source jars for the configuration, for example configurations.compileSource or configurations.runtimeSource.

--
Adam Murdoch
Gradle Developer
http://www.gradle.org


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email






--
Adam Murdoch
Gradle Developer
http://www.gradle.org

Reply via email to