Publish multiplatform library (not Discord bot)
Hello
This is the list of supported platform of my lib:
I'm using the plugin https://github.com/gradle-nexus/publish-plugin to publish my lib in maven central
However, when I check the availabled action, I can publish for:
JVM
JS
WasmJS
MingwX64
LinuxX64
LinuxArm64
But as you can see, the targets:
Macos
TvOsSimulatorArm64
TsosX64
WatchosArm32
etc.
Are not avaiabled in the commands list.
For your lib, how do you publish it with these missing targets? Should I change the plugin used?
GitHub
GitHub - gradle-nexus/publish-plugin: Gradle plugin for publishing ...
Gradle plugin for publishing to Nexus repositories - gradle-nexus/publish-plugin
20 Replies
apple targets can only be compiled on apple devices
you can either create a ci that runs on a mac to compile for all targets, or cross compile which is a pain to setup
Aaah maybe I need to have a mac to see the gradle command
I will try it after! Probably nice catch
How could you miss that the compiler yells at you
I didn't miss that, but that's not linked to the gradle publish plugin
publishing is handled by the Kotlin Gradle plugin
the other plugin just handles some specifics
Hum, ok on Mac I see the Tvos etc.
But .. why I see MingwX64? That's not a windows target?
that is the windows target yes
you can compile windows on mac and linux
just apple is special
what really?
So .. to publish, I just need to start the CI with macos-latest and all target will be published?
yes
Ok I will try
Other question, if I apply
nativeTest by gettings { .. }
, that will be applied for all native targets? win, linux, ios?afaik,
nativeTest
is not a built-in name of a source set, so you need to use by creating {}
instead, and then manually have each native target's relevant source set depend on nativeTest
and as long as you have that dependency, whatever you put in nativeTest
should be applied to other targets
just keep in mind that you won't be able to use os-specific code this wayIt is when you use the hierarchy template
is it? i always had it disabled
Well that's the reason
nice
Ok so .. If I want to target all ios platform, I just need to do:
val appleTest by getting {}
?If you call "applyDefaultHierarchyTemplate"
Yes that works thanks!
Success
Problem with wasm (memory) so I opened an issue