Groovy. Much thanks Rene.

Yes, this does work.

Just for some (maybe) helpful, and searchable info. I integrated this into
my plugin by first creating a "javascript" configuration:
[code src="JavascriptLibPlugin.groovy"]
project.configurations.add("javascript").setVisible(false).setDescription("Javascript
configuration.");
[/code]

Then by adding artifacts for the default files:
[code src="JavascriptLibPlugin.groovy"]
   project.configurations.javascript.addArtifact(
      createArtifact(project.name, "build/classes/main")
   )
   // and one for each sourceSet.name
[/code]

And, finally by adding a helper method to my JavascriptPluginConvention:
[code src="JavascriptPluginConvention.groovy"]
   PublishArtifact jsArtifact(String path, String name) {
      if(name.endsWith(".js")) {
         name = name.substring(0, name.size() - 3)
      }
      // new DefaultPublishArtifact(String name, String extension, String
type, String classifier, Date date, File file)
      new DefaultPublishArtifact(
            name,
            "js",
            "javascript",
            null,
            new Date(),
            new File("${path}/${name}.js")
      )
   }
[/code]

This allows me to access the artifacts from my JavascriptVersion task like
so:
[code src="JavascriptVersion.groovy"]
def artifacts = project.configurations?.javascript?.artifacts
[/code]

And allows users to add artifacts using the helper method:
[code src="build.gradle"]
artifacts {
   javascript jsArtifact("build/classes/main", "test1.js")
   javascript jsArtifact("build/classes/main", "test2.js")
}
[/code]

Cheers, and thanks very much for the help.
Eric
-- 
Learn from the past. Live in the present. Plan for the future.
Blog: http://www.townsfolkdesigns.com/blogs/elberry
jEdit <http://www.jedit.org> - Programmer's Text Editor
Bazaar <http://bazaar.canonical.com> - Version Control for Humans

Reply via email to