@@ -10,6 +10,7 @@ import org.gradle.api.file.CopySpec
10
10
import org.gradle.api.publish.Publication
11
11
import org.gradle.api.publish.PublishingExtension
12
12
import org.gradle.api.publish.maven.MavenPublication
13
+ import org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal
13
14
import org.gradle.api.tasks.Input
14
15
import org.gradle.api.tasks.Optional
15
16
import org.gradle.api.tasks.TaskAction
@@ -214,8 +215,8 @@ class BintrayUploadTask extends DefaultTask {
214
215
} else {
215
216
logger. error(" {}: Could not find publication: {}." , path, it);
216
217
}
217
- } else if (it instanceof MavenPublication ) {
218
- return collectArtifacts((MavenPublication ) it)
218
+ } else if (it instanceof MavenPublicationInternal ) {
219
+ return collectArtifacts((MavenPublicationInternal ) it)
219
220
} else {
220
221
logger. error(" {}: Unsupported publication type: {}." , path, it. class)
221
222
}
@@ -627,7 +628,7 @@ class BintrayUploadTask extends DefaultTask {
627
628
}
628
629
629
630
Artifact [] collectArtifacts (Publication publication ) {
630
- if (! publication instanceof MavenPublication ) {
631
+ if (! publication instanceof MavenPublicationInternal ) {
631
632
logger. info " {} can only use maven publications - skipping {}." , path, publication. name
632
633
return []
633
634
}
@@ -647,6 +648,22 @@ class BintrayUploadTask extends DefaultTask {
647
648
)
648
649
}
649
650
651
+ def mavenPublication = (MavenPublicationInternal )publication
652
+ if (mavenPublication. canPublishModuleMetadata()) {
653
+ def moduleFile = mavenPublication. publishableFiles. find{ it. name == ' module.json' }
654
+ if (moduleFile != null ) {
655
+ artifacts << new Artifact (
656
+ name : identity. artifactId,
657
+ groupId : identity. groupId,
658
+ version : identity. version,
659
+ extension : ' module' ,
660
+ type : ' module' ,
661
+ file : moduleFile
662
+ )
663
+ }
664
+ }
665
+
666
+
650
667
// Add the pom file
651
668
artifacts << new Artifact (
652
669
name : identity. artifactId,
0 commit comments