Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support publications with grade metadata feature enabled #229

Open
vvlevchenko opened this issue Apr 27, 2018 · 5 comments
Open

Support publications with grade metadata feature enabled #229

vvlevchenko opened this issue Apr 27, 2018 · 5 comments

Comments

@vvlevchenko
Copy link

@vvlevchenko vvlevchenko commented Apr 27, 2018

Gradle introduced gradle metadata feature in version 4.6 for which mostly used in native publications. It generate .module file for artifact which contains information about possible variants of artifact and configuration attributes for resolving. This file skipped by current version of plugin.

PR #230 realise metadata file publishing.

@h0tk3y

This comment has been minimized.

Copy link

@h0tk3y h0tk3y commented Nov 13, 2018

+1 for this feature, as Kotlin Multiplatform projects now support publishing Gradle module metadata for simplifying dependency management. Is this going to be supported in the Bintray plugin?

@ilmat192

This comment has been minimized.

Copy link

@ilmat192 ilmat192 commented Jan 17, 2019

Hi @eyalbe4! This issue prevents publishing Kotlin multiplatform libraries to Bintray but the PR mentioned above can fix it. Do you have any plans to merge it?

@fluidsonic

This comment has been minimized.

Copy link

@fluidsonic fluidsonic commented Mar 15, 2019

Workaround which works for us until the Bintray plugin catches up.

build.gradle.kts

tasks.withType<BintrayUploadTask> {
    doFirst {
        publishing.publications
            .filterIsInstance<MavenPublication>()
            .forEach { publication ->
                val moduleFile = buildDir.resolve("publications/${publication.name}/module.json")
                if (moduleFile.exists()) {
                    publication.artifact(object : FileBasedMavenArtifact(moduleFile) {
                        override fun getDefaultExtension() = "module"
                    })
                }
            }
    }
}

Note that we use Gradle Kotlin Script, so for Grovvy-based build.gradle files the code needs to be adjusted.

@dhakehurst

This comment has been minimized.

Copy link

@dhakehurst dhakehurst commented Jul 17, 2019

This is a great workaround, though how do you 'get' the 'publishing' variable

In my multi project, multiplatform build, in the root project 'publishing' is an unresolved reference!

@dhakehurst

This comment has been minimized.

Copy link

@dhakehurst dhakehurst commented Jul 17, 2019

found the answer,
val publishing = extensions.getByType(PublishingExtension::class.java)

ddossot added a commit to apple/servicetalk that referenced this issue Sep 5, 2019
__Motivation__

An issue in the current version of the Bintray plugin prevents it from uploading the Gradle module metadata file.

__Modification__

Add the metadata files to the bintray task config.

Note that a more involved workaround is proposed in [1], this PR sends a workaround that is purely file based.

__Results__

Gradle module metadata are published.

[1] bintray/gradle-bintray-plugin#229
ddossot added a commit to apple/servicetalk that referenced this issue Sep 5, 2019
__Motivation__

The recently introduced fix for Bintray plugin's Gradle module metadata issue is not working because the Bintray plugin copy task (`_bintrayRecordingCopy`) runs before the generation of the Gradle metadata (`generateMetadataFileForMavenJavaPublication`).

This was not detected locally because the Gradle metadata was preexisting in an unclean build when `bintrayUpload` was tested.

__Modifications__

- Use the workaround suggested in [1],
- Review application of `maven-publish` plugin as it now must be done before Bintray.

__Results__

Gradle module metadata files are uploaded to Bintray (hopefully 😅).

[1] bintray/gradle-bintray-plugin#229
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.