Skip to content

Commit

Permalink
[gradle-4.10.2] support publishing module metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
vvlevchenko committed Dec 14, 2018
1 parent 6d11540 commit 72bc6ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.gradle.api.file.CopySpec
import org.gradle.api.publish.Publication
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.TaskAction
Expand Down Expand Up @@ -218,7 +219,7 @@ class BintrayUploadTask extends DefaultTask {
} else {
logger.error("{}: Could not find publication: {}.", path, it);
}
} else if (it instanceof MavenPublication) {
} else if (it instanceof MavenPublicationInternal) {
return collectArtifacts((Configuration) it)
} else {
logger.error("{}: Unsupported publication type: {}.", path, it.class)
Expand Down Expand Up @@ -539,7 +540,7 @@ class BintrayUploadTask extends DefaultTask {
}

Artifact[] collectArtifacts(Publication publication) {
if (!publication instanceof MavenPublication) {
if (!publication instanceof MavenPublicationInternal) {
logger.info "{} can only use maven publications - skipping {}.", path, publication.name
return []
}
Expand All @@ -558,6 +559,22 @@ class BintrayUploadTask extends DefaultTask {
)
}

def mavenPublication = (MavenPublicationInternal)publication
if (mavenPublication.canPublishModuleMetadata()) {
def moduleFile = mavenPublication.publishableFiles.find{ it.name == 'module.json'}
if (moduleFile != null) {
artifacts << new Artifact(
name: identity.artifactId,
groupId: identity.groupId,
version: identity.version,
extension: 'module',
type: 'module',
file: moduleFile
)
}
}


// Add the pom file
artifacts << new Artifact(
name: publication.artifactId,
Expand Down

0 comments on commit 72bc6ca

Please sign in to comment.