Skip to content

Commit

Permalink
Bugfix to add conf and type to source and javadoc jar artifacts publi…
Browse files Browse the repository at this point in the history
…shed to Ivy repositories
  • Loading branch information
jkschneider committed Nov 18, 2015
1 parent c5e775e commit 3e79657
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
4.4.3 / 2015-11-18
==================

* Bugfix to add conf and type to source and javadoc jar artifacts published to Ivy repositories

4.4.2 / 2015-11-12
==================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
* limitations under the License.
*/
package nebula.plugin.publishing.publications

import nebula.plugin.publishing.ivy.IvyBasePublishPlugin
import nebula.plugin.publishing.maven.MavenBasePublishPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
Expand All @@ -37,6 +38,8 @@ class JavadocJarPlugin implements Plugin<Project> {
}

project.plugins.withType(org.gradle.api.publish.maven.plugins.MavenPublishPlugin) {
project.plugins.apply(MavenBasePublishPlugin)

project.publishing {
publications {
nebula(MavenPublication) {
Expand All @@ -47,10 +50,15 @@ class JavadocJarPlugin implements Plugin<Project> {
}

project.plugins.withType(org.gradle.api.publish.ivy.plugins.IvyPublishPlugin) {
project.plugins.apply(IvyBasePublishPlugin)

project.publishing {
publications {
nebulaIvy(IvyPublication) {
artifact project.tasks.javadocJar
artifact(project.tasks.javadocJar) {
type 'javadoc'
conf 'javadoc'
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package nebula.plugin.publishing.publications

import nebula.plugin.publishing.ivy.IvyBasePublishPlugin
import nebula.plugin.publishing.maven.MavenBasePublishPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPlugin
Expand All @@ -35,6 +37,8 @@ class SourceJarPlugin implements Plugin<Project> {
}

project.plugins.withType(org.gradle.api.publish.maven.plugins.MavenPublishPlugin) {
project.plugins.apply(MavenBasePublishPlugin)

project.publishing {
publications {
nebula(MavenPublication) {
Expand All @@ -45,10 +49,15 @@ class SourceJarPlugin implements Plugin<Project> {
}

project.plugins.withType(org.gradle.api.publish.ivy.plugins.IvyPublishPlugin) {
project.plugins.apply(IvyBasePublishPlugin)

project.publishing {
publications {
nebulaIvy(IvyPublication) {
artifact project.tasks.sourceJar
artifact(project.tasks.sourceJar) {
type 'sources'
conf 'sources'
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,17 @@ class JavadocJarPluginIntegrationSpec extends IntegrationSpec {
when:
runTasksSuccessfully('publishNebulaIvyPublicationToTestIvyRepository')

def ivyXmlFile = new File(ivyPublishDir, 'ivy-0.1.0.xml')

then:
new File(ivyPublishDir, 'javadoctest-0.1.0-javadoc.jar').exists()
ivyXmlFile.exists()

when:
def ivyXml = new XmlSlurper().parse(ivyXmlFile)

then:
ivyXml.publications[0].artifact.find { it.@type == 'javadoc' && it.@conf == 'javadoc' }
}

def 'javadoc jar has content for ivy'() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,17 @@ class SourceJarPluginIntegrationSpec extends IntegrationSpec {
when:
runTasksSuccessfully('publishNebulaIvyPublicationToTestIvyRepository')

def ivyXmlFile = new File(ivyPublishDir, 'ivy-0.1.0.xml')

then:
new File(ivyPublishDir, 'sourcetest-0.1.0-sources.jar').exists()
ivyXmlFile.exists()

when:
def ivyXml = new XmlSlurper().parse(ivyXmlFile)

then:
ivyXml.publications[0].artifact.find { it.@type == 'sources' && it.@conf == 'sources' }
}

def 'source jar contains java sources for maven publication'() {
Expand Down

0 comments on commit 3e79657

Please sign in to comment.