https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
r

ribesg

04/10/2019, 8:29 AM
Is there an easy way to publish the sources of a MPP project for Android? The sources are available in IntelliJ when using the iOS lib but not when using the Android one
I don’t know much about this kind of thing, do I need to publish the sources twice for
-android
and
android-debug
? How does the IDE decides what it uses?
Should I include the sources in
-android-debug
instead? Is that even possible?
l

louiscad

04/10/2019, 7:27 PM
In Splitties, the sources are automatically published and available from the IDE for the Android modules.
r

ribesg

04/11/2019, 8:09 AM
Well I just see that I don’t have them and I want to change that, that’s all. I don’t see anything specific about sources in Splitties’ build process
l

louiscad

04/11/2019, 8:26 AM
Can you see common sources? And Android sources?
r

ribesg

04/11/2019, 8:55 AM
Neither. I managed to create a sources artifact. I didn’t test to see if the IDE can see it, but I already encounter a problem: I can’t have both
common
and
android
sources in one sources jar, as they override each over (Because of
expect
and
actual)
.
Here’s my current code:```val androidSources = tasks.create<Jar>("androidSources") { archiveClassifier.set("sources") from(kotlin.sourceSets.getByName("commonMain").kotlin.srcDirs) from(kotlin.sourceSets.getByName("androidMain").kotlin.srcDirs) } publishing { publications { create<MavenPublication>("androidSources") { artifactId = "${project.name}-android-sources" artifact(androidSources) } } }```
I guess I should publish 2 artifacts but I doubt the IDE will see them. EDIT: So the IDE does not see the artifact produced there.
So I think I’ve got a sources artifact with acceptable content (just need to make sure I’m not having additional code in files that contain `expect`/`actual`) but I don’t see it in IDEA
When looking at a
.class
of one of my libs, there’s the
Download Sources
option available, but it does nothing
l

louiscad

04/11/2019, 10:58 AM
Maybe report it on kotl.in/issue with Kotlin version and IDE info? And link it here of course
r

ribesg

04/11/2019, 11:00 AM
I’ve been trying to see if I could reproduce it with an existing Android library built as part of a MPP project, but I can’t find any