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

louiscad

07/21/2019, 1:32 PM
Is the process of publishing a MPP library that supports both macOS and Windows documented somewhere? I know its something kotlinx.coroutines does, but the gradle setup there is quite complicated to me, plus I'm less and less familiar with Groovy based gradle as I use almost only Gradle Kotlin DSL since last year. I'd like to ensure my multiplatform publication can resolve using gradle metadata in the consumer projects dependeing on the targets, but I can't run the usual publishing task since I won't be able to compile for Windows on my Mac. A clear guidance or an example I can test with a dummy bintray repo, would be helpful.
d

Dominaezzz

07/21/2019, 1:35 PM
Sadly this isn't documented. It's like a secret that's passed around.
You have to run the publication multiple times on different hosts.
As long as you enable the same targets on each, then you're good to go.
You'll probably want to disable cross-compilation too.
l

louiscad

07/21/2019, 1:37 PM
Yes, but how does the multiplatform publication gets all the targets? The last host to publish would miss the previous ones?
You'll probably want to disable cross-compilation too.
How?
What do you mean about the last host missing the previous ones?
It'll be order independent.
l

louiscad

07/21/2019, 1:40 PM
The kotlinMultiplatform publication has gradle metadat for all the targets. If I disable a target to build from one host, it will be missing in it? Or is there a way to circumvent this or not have the problem in the first place?
d

Dominaezzz

07/21/2019, 1:41 PM
You don't disable the entire target, just it's publication and compilation.
l

louiscad

07/21/2019, 1:43 PM
Alright, so the snippet you linked disables those gradle tasks, right?
d

Dominaezzz

07/21/2019, 1:43 PM
Yup but metadata is still configured as one would expect.
l

louiscad

07/21/2019, 1:44 PM
And you can choose to disable it too if you want to run it only from your last building host, right?
Although they should result in exactly the same result, am I right?
d

Dominaezzz

07/21/2019, 1:45 PM
Yes. As long as the target is declared, the result will be the same.
l

louiscad

07/21/2019, 1:57 PM
Thank you very mich for the help! I'll setup a CI soon™ and try it!
d

Dominaezzz

07/21/2019, 1:58 PM
Sweet. Which CI are you using btw?
k

kpgalligan

07/21/2019, 2:27 PM
Also curious about the ci choice. I think we’re moving everything to azure. I know @basher has that set up for native ios/mac, windows, and linux, so might be a good reference https://github.com/benasher44/uuid/blob/master/azure-pipelines.yml
I have a far more manual process for mavenCentral deploy. After you publish you need to go into the web console and make everything public. After the windows push I just remove anything that isn’t the windows artifact. The metadata built on a mac will have windows in there, but won’t ship the artifact. So, I publish from the mac, make that public, then fire up Parallels, publish, trim the duplicates (metadata, etc), then make the windows part public. Tedious but I can’t quite bring myself to try setting up a CI for that.
😅 1
b

basher

07/21/2019, 2:49 PM
Yup azure has worked well so far. I split up my publish tasks by platform w/ custom tasks. https://github.com/benasher44/uuid/blob/master/publish.gradle#L158
d

Dominaezzz

07/21/2019, 2:50 PM
About that. Why'd you split up your publish tasks?
b

basher

07/21/2019, 3:24 PM
To avoid rerunning publish tasks on multiple platforms. Metadata and jvm for example can run on multiple
l

louiscad

07/21/2019, 4:14 PM
For CI, I am planning to use Azure, per Ben and Jake recommendations: https://kotlinlang.slack.com/archives/C3PQML5NU/p1561941488046500?thread_ts=1561933774.044100&cid=C3PQML5NU Removing duplicates manually is a no go for me as I have dozens of modules. When I set up publish to mavenCentral, it'll be either without duplicates, as Ben seems to be doing, or using bintray sync.
d

Dico

07/21/2019, 5:34 PM
I actually use vultr for ci
Cheap