Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

SourceSets should be lazily referenced #8

Closed
quidryan opened this issue Sep 27, 2013 · 2 comments
Closed

SourceSets should be lazily referenced #8

quidryan opened this issue Sep 27, 2013 · 2 comments
Assignees
Labels
Milestone

Comments

@quidryan
Copy link

In https://github.com/bmuschko/gradle-nexus-plugin/blob/master/src/main/groovy/org/gradle/api/plugins/nexus/NexusPlugin.groovy#L62 it's referencing sourceSets directly. It should be using a form of matching:

JavaPluginConvention javaConvention = project.getConvention().getPlugin(JavaPluginConvention)
javaConvention.sourceSets.matching {it.name == 'main'}.all { SourceSet set ->
    Jar sourcesJarTask = project.tasks.create(SOURCES_JAR_TASK_NAME, Jar)
     sourcesJarTask.classifier = 'sources'
     sourcesJarTask.from set.allSource
}

This will let the nexus plugin be applied in any order, right now it requires being applied after the java-base plugin, which makes it a little hard to reference via an init script.

Though, in the end this plugin shouldn't be generating source jars implicitly, that should be the job of another plugin.

@bmuschko
Copy link
Owner

In hindsight it would have been better to have a separate plugin for the defining the archive tasks. It shouldn't really be the concern of a publishing plugin. Would you be interested in working on a pull request for lazily applying the source sets?

@quidryan
Copy link
Author

Lucky for me, bintray is now out. And the gradle-bintray-plugin doesn't have this problem, hence I don't really need this plugin any more. So, it's unlucky for me to contribute. Sorry.

I'm working on my own plugin to create source, javadoc, test jars: https://github.com/nebula-plugins/nebula-publishing-plugin, so that other developers don't have to worry about doing what you had to in this plugin, as far as packaging goes.

@bmuschko bmuschko added this to the v2.1.1 milestone Nov 2, 2014
@bmuschko bmuschko self-assigned this Nov 2, 2014
@bmuschko bmuschko closed this as completed Nov 2, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants