This message was deleted.
# community-support
s
This message was deleted.
a
One of the use cases we have is building a kotlin multiplatform project on different hosts (e.g. jvm, windows, linux, macos, js) and then publishing everything all together after we know everything built successfully. The only alternative I see is publish to a nexus staging repo and only release it after everything succeeds but I'd like to understand if there is a way to re-use gradle maven publishing infrastructrure without going down that road.
t
Hi Aaron 👋 I don’t know specifics, but I would try to explore the tasks involved in publishing. Then I would try to create a custom task or extension that will deliver as outputs the files we need to pass to the publishing task and then configure latest to consume the inputs.
Copy code
// pseudo code
interface MyExtension {
   @get:Input
   val artifactsDir: RegularFileProperty

}

myExtension {
  artifactsDir = file("/some/path/to/local/dir")
}

val myExtension = project.extensions.findByName("myExtension")
// we need to sneak peek into impl of the publish plugin to figure out the publishing task type
val customPublications = project.register<PublishTask>(name = "republish") {
  artifactSource.set(myExtension.artifactsDir)
}
v
Or maybe it is already enough to use a build cache / remote build cache, so that results of time-consuming cacheable tasks can be reused to not "re-build the world"
âž• 1
a
Or maybe it is already enough to use a build cache / remote build cache, so that results of time-consuming cacheable tasks can be reused to not "re-build the world"
This is actually what we do now but I don't think it will work when we flip on support for other KMP targets other than JVM.
j
KGP supports build cache, and if not, it would be easier to file a bug that looking for a workaround
trying it is easy, just run assemble two times in a row, if the second one is not instant, check with a scan what is not being cached.
For those targets in 4 modules + root I am getting
Copy code
BUILD SUCCESSFUL in 5s
194 actionable tasks: 6 executed, 188 up-to-date
5 are not cacheable, as I am the owner of those, and it is expected (they print the library version in the CLI). The other one is
kotlinNpmCachesSetup
, which has taken
0.000s
to be executed, I have no idea about this one tho
no configuration cache enabled
a
thanks for chiming in, we have a few constraints to deal with. (1) We build and publish on totally separate hosts. (2) we would like to build separate KMP targets in parallel on different hosts and then combine the artifacts and publish them once all target platforms are built.
j
I am not sure then if remote build cache could help here, I haven't played with it. What is the reason of that split? Very large library?
If the remote build cache is shared on all of those machines, you should get up to date tasks on all publishing machines, as the build from the previous machine should be shared to the publishing one. Am I missing something?