-
Notifications
You must be signed in to change notification settings - Fork 197
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
Comments
+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? |
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? |
Workaround which works for us until the Bintray plugin catches up.
Note that we use Gradle Kotlin Script, so for Grovvy-based |
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! |
found the answer, |
__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
__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
Finding this issue after having added a similar support to the |
Sure @ljacomet, |
This enables the upload of Gradle Module Metadata when generated. The APIs used require Gradle 4.8 at the minimum. Fixes bintray#229
Apply bintray upload workaround bintray/gradle-bintray-plugin#229
For the record, you can upload Gradle metadata with the
|
This enables the upload of Gradle Module Metadata when generated. The APIs used require Gradle 4.8 at the minimum. Fixes bintray#229
Thanks @fluidsonic for this quite sophisticated workaround! 👍 I adapted it for the Groovy DSL (probably imperfectly, but it works for me 😉): import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import org.gradle.api.publish.maven.internal.artifact.FileBasedMavenArtifact
tasks.withType(BintrayUploadTask) {
doFirst {
publishing.publications.withType(MavenPublication).forEach({ publication ->
File moduleFile = new File(project.buildDir, "publications/${publication.name}/module.json")
if (moduleFile.exists()) {
publication.artifact(new FileBasedMavenArtifact(moduleFile) {
protected String getDefaultExtension() {
return 'module';
}
})
}
})
}
} |
The workaround provided is not working for me. Locally, using Maven Local, it is being resolved automatically. For example, locally this works:
But when using bintray, even when we have the
But it seems to be not perfect because when using KScript the second version does not work as well. |
@Danilo-Araujo-Silva Replacing this plugin by Gradle's first-party |
@LouisCAD Really? How will you handle the secondary features, such as synching to Maven Central without going through their complicated workflow? |
@tsjensen You are mistaking the |
@tsjensen if you're talking about https://github.com/bintray/gradle-bintray-plugin#Maven_Central_Sync, I think (but have never tried so that'll need confirmation) that you can setup Maven Central sync from the UI at bintray.com. Once setup in the UI, bintray should sync every time you push, whether you push with the |
@martinbonnin Yes, that's what I mean. I tried hard to get this to run via their UI. It worked, but only when pushing the buttons manually. For automation, this plugin seemed like the only way. @LouisCAD No, I did not "mix up maven-publish and Maven Central". I am genuinely interested in finding out how to do the Maven Central Sync when publishing to bintray using maven-publish. If you can point us to somewhere this is resolved, then I'll switch! |
@tsjensen the |
Ah, I get it now. What Martin just wrote should work for syncing bintray to maven central. In fact, that's how the gradle-bintray-plugin/src/main/groovy/com/jfrog/bintray/gradle/tasks/BintrayPublishTask.groovy Line 107 in 67718c3
|
Bintray plugin doesn't upload module files: bintray/gradle-bintray-plugin#229 (comment) Resolves: #63
* Another workaround for bintray/gradle-bintray-plugin#229
Add a workaround for publishing to bintray with gradle metadata see bintray/gradle-bintray-plugin#229
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.
The text was updated successfully, but these errors were encountered: