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

Is there a way to specify source code publish flag according to the targets? #743

Closed
yashctn88 opened this issue Mar 22, 2024 · 5 comments
Closed

Comments

@yashctn88
Copy link

Is there a way to specify source code publish flag according to the targets? Like for example i am publishing kotlin multi platform library and i want for some specific target only to generated source jars not for all. Can this be configured ?

Here is my configuration, because

configure(
com.vanniktech.maven.publish.KotlinMultiplatform(
javadocJar = com.vanniktech.maven.publish.JavadocJar.Javadoc(),
sourcesJar = false,
androidVariantsToPublish = listOf("release")
)
)

The reason that i want to publish sources for specific target os that if i dont publish the source jar its getting rejected in the central.sonatype publish validation the sources are required

publish
@rvenky125
Copy link

rvenky125 commented Apr 17, 2024

how it's worked for you, I mean for me the ios and android targets are not uploading. It's uploading only the library only. Thank's for your time.
image

@rvenky125
Copy link

please help me

@gabrielittner
Copy link
Collaborator

@yashctn88 What is your reason for only wanting to publish sources only for some targets? Having a sources jar is a requirement of maven central so there isn't much that can be done. The Kotlin Multiplatform plugin does have an API to disable the sources publication on a per target basis. You can try calling that after your configure(com.vanniktech.maven.publish.KotlinMultiplatform(...)) call but the maven central requirement should still fail in that case.

@rvenky125 Please open a separate issue and include more information like your build configuration or a link to your project.

@rvenky125
Copy link

rvenky125 commented Apr 19, 2024

@gabrielittner Thanks for the reply, my issues is not related to this issue(#743). I just asked him because for him all of components are uploading, for me it's not like that.

my issue resolved by using below command to publish.
./gradlew clean publish --no-daemon --no-parallel --no-configuration-cache

the android and ios components are not uploading with the below command.
./gradlew publishKotlinMultiplatformPublicationToMavenCentralRepository --no-configuration-cache.
if it's not intented then I'll create new issue, please let me know. Thank you.

@gabrielittner
Copy link
Collaborator

@rvenky125 This is intended. Kotlin Multiplatform creates one publication for each target. If you're using the second command then you're just publishing the publication for the common source set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants