K
Kord6mo ago
Tic

Publish multiplatform library (not Discord bot)

Hello This is the list of supported platform of my lib:
iosX64()
iosArm64()
iosSimulatorArm64()
tvosX64()
tvosArm64()
tvosSimulatorArm64()
watchosArm32()
watchosArm64()
watchosX64()
watchosSimulatorArm64()
linuxX64()
linuxArm64()
macosX64()
macosArm64()
mingwX64()
jvm {
}

js {
jsAndWasmSharedConfigurationTarget()
}
wasmJs {
jsAndWasmSharedConfigurationTarget()
}
iosX64()
iosArm64()
iosSimulatorArm64()
tvosX64()
tvosArm64()
tvosSimulatorArm64()
watchosArm32()
watchosArm64()
watchosX64()
watchosSimulatorArm64()
linuxX64()
linuxArm64()
macosX64()
macosArm64()
mingwX64()
jvm {
}

js {
jsAndWasmSharedConfigurationTarget()
}
wasmJs {
jsAndWasmSharedConfigurationTarget()
}
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
igrushka otchima
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
Tic
TicOP6mo ago
Aaah maybe I need to have a mac to see the gradle command I will try it after! Probably nice catch
SchlaubiBus
SchlaubiBus6mo ago
How could you miss that the compiler yells at you
Tic
TicOP6mo ago
I didn't miss that, but that's not linked to the gradle publish plugin
SchlaubiBus
SchlaubiBus6mo ago
publishing is handled by the Kotlin Gradle plugin the other plugin just handles some specifics
Tic
TicOP6mo ago
Hum, ok on Mac I see the Tvos etc. But .. why I see MingwX64? That's not a windows target?
SchlaubiBus
SchlaubiBus6mo ago
that is the windows target yes you can compile windows on mac and linux just apple is special
Tic
TicOP6mo ago
what really? So .. to publish, I just need to start the CI with macos-latest and all target will be published?
igrushka otchima
yes
Tic
TicOP6mo ago
Ok I will try Other question, if I apply nativeTest by gettings { .. }, that will be applied for all native targets? win, linux, ios?
igrushka otchima
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 way
SchlaubiBus
SchlaubiBus6mo ago
It is when you use the hierarchy template
igrushka otchima
is it? i always had it disabled
SchlaubiBus
SchlaubiBus6mo ago
Well that's the reason
igrushka otchima
nice
Tic
TicOP6mo ago
Ok so .. If I want to target all ios platform, I just need to do: val appleTest by getting {} ?
SchlaubiBus
SchlaubiBus6mo ago
If you call "applyDefaultHierarchyTemplate"
Tic
TicOP6mo ago
Yes that works thanks!
Tic
TicOP6mo ago
Success Problem with wasm (memory) so I opened an issue
No description
Want results from more Discord servers?
Add your server