`publish` and `publishAndroid` are helpers that I wrote and internally do: ```apply(plugin = "com.jf...
d
publish
 and 
publishAndroid
 are helpers that I wrote and internally do:
Copy code
apply(plugin = "com.jfrog.bintray")
apply(plugin = "maven-publish")

group = ...
version = ...

afterEvaluate {
  publishing { ... }
  configure<BintrayExtension> { ... }
}
j
With maven publish plugin do you doesn't need bintray plugin
d
Thanks, but I think that doesn’t make much differenec
j
I don't know, the setup is simpler and maybe fix the problem you have if it is caused by the bintray plugin
d
Oh, so you’re talking about the
configure
block, I though only about the
apply(plugin
Have you got any example of doc about that? I always found different parts of examples in different places
d
Oh, look awesome 🤩 Thank you so much. But I notice you’re not publishing on Android, which requires to be in the
afterEvaluate
block, that would make some more complication
Hey @Javier could I bother you 10 mins? Just wanna check if my config is fine + a question about Android vs plain java vs multiplatfom publications
j
I am working, I can reply here when I can read you
BTW here you can see my settings for a jvm+Android library
d
Thank you, I’m looking into it and I’ll get back to you only if I have further questions
2 questions: • cannot find out where you set the sources, in my script ( only Java / Android ) I had
Copy code
val bundle = c.publicationsBundleBuilder(this@publishBlock)
val sourcesJar = tasks.create<Jar>("sourcesJar") {
    archiveClassifier.set("sources")
    from(bundle.sources)
}
afterEvaluate {
  artifact(javaDocsJar)
  artifact(tasks[if (isAndroid) "bundleReleaseAar" else "jar"])
  artifact(sourcesJar)
}
Where the pubBundleBuilder would return
sourceSets["main"].allSource
from java and
android.sourceSets["main"].java.srcDirs
on Android ( so ofc I needed 2 different methods to call for that and was not MultiPlatform ready I guess ) • How should I implement that commented part?
Copy code
private fun Project.publish(lazy: Boolean, c: PublishConfig) {
    apply(plugin = "maven-publish")
    // apply(plugin = "signing")

    // signing {
    //     useGpgCmd()
    //     sign(publishing.publications)
    // }
j
I don't add the sources bundle manually because they are detected automatically, so I don't know why it is not working. Why do you need to add them manually? For Android the only things I do is to add a snippet to the
kotlin
block as you can see here https://github.com/JavierSegoviaCordoba/Core/blob/develop/core/build.gradle.kts
Copy code
android {
   publishLibraryVariants("release", "debug")
}
d
IDK whether it’s needed, I just see it being done in all the project, but differently 😅 Is there any way I can include it in a
kotlin-dsl
module without the Android plugin?
j
Do you say a multiplatform library without Android?
d
No, I have a library with this publishing stuff, but I need 2 modules now: one with android and one without
publish
/
publishAndroid
and in the one without Android I’m not applying the plugin ( and neither the dependency from the Android plugin, so I don’t have access to
LibraryExtension
for example )
Sorry, I mean a library I include in the buildSrc of other project, to be more clear
Would love to unify in a single module everything I can
j
Ah, the setup is different if it is multiplatform vs only Android. The Android dev web has the setup for it.
You can unify it but you will have to contact to bintray because they doesn't support add new target artifacts for released library
Because of this I moved to sonatype indeed
d
So, sorry to iterate over that: what would be different to publish for Android only? I think I have kinda clear for multiplatform now
j
For multiplatform maven-publish is automatic (including android), for solo android no. https://developer.android.com/studio/build/maven-publish-plugin
I think is even easier to change the solo android library to multiplatform even only having code in commonMain and androidMain and publish so
d
But that’s not up to me, it’s for public use 🙂
Good, I just finished, but my publish task completes in 2 seconds without doin anything 😆😆
Skipping task ‘:publish’ as it has no actions.