-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow publishing to a pre-defined staging repository #3562
Conversation
Makes sense to me. It'd also be worth replacing the config-cache disabler here dokka/build-logic/src/main/kotlin/dokkabuild.publish-base.gradle.kts Lines 92 to 97 in 7fc9244
And instead using a build service to limit task parallelization: //region Maven Central can't handle parallel uploads, so limit parallel uploads with a service.
abstract class MavenPublishLimiter : BuildService<BuildServiceParameters.None>
val mavenPublishLimiter =
gradle.sharedServices.registerIfAbsent("mavenPublishLimiter", MavenPublishLimiter::class) {
maxParallelUsages = 1
}
tasks.withType<PublishToMavenRepository>().configureEach {
usesService(mavenPublishLimiter)
}
//endregion |
Good idea! If so, something like this could be done instead: //region Maven Central can't handle parallel uploads, so limit parallel uploads with a service.
abstract class MavenPublishLimiter : BuildService<BuildServiceParameters.None>
val mavenPublishLimiter =
gradle.sharedServices.registerIfAbsent("mavenPublishLimiter", MavenPublishLimiter::class) {
maxParallelUsages = 1
}
val repositoryId: String? = System.getenv("DOKKA_MVN_CENTRAL_REPOSITORY_ID")
tasks.withType<PublishToMavenRepository>().configureEach {
if (!repositoryId.isNullOrBlank()) usesService(mavenPublishLimiter)
}
//endregion But in the end, as we control |
In theory yes, AFAIK Maven Central is the only problematic repo. But in practice I would lean towards keeping the build scripts simpler, even if it introduces a performance hit when publishing :). Is parallel publishing important for Dokka? Would it help significantly? |
Parallel publishing is not that important, but, as I mentioned in the end, as we intend to publish to MC only from TC with |
@adam-enko @whyoleg thank you for the proposals! Indeed, it seems like the only repo struggling with parallel uploads is Maven Central, so if we start using I'll merge this PR in to unblock me with adapting TeamCity build configurations, and will create a separate PR with the removal of config-cache disabler - there might be more questions there |
Due to Gradle running publishing tasks in parallel, multiple staging repositories can be created within a couple of seconds with all artifact files scattered throughout them. Even though the publishing in done on the same build agent.
Interestingly enough, setting
-Dorg.gradle.parallel=false
didn't help, I believe it's due to us using included builds, but I'm not sure.Setting
--max-workers=1
additionally did help, but significant time was spent to find and test this solution.Given it's easy to forget to set these params (especially when adding new build steps in TC), I think it's much easier to just allow to publish to a predefined staging repo, which will be created before the publishing build is run (as a prerequisite).