Skip to content

Commit

Permalink
Limit publishing concurrency per subproject (#38)
Browse files Browse the repository at this point in the history
Only prevent parallel publications per subproject, otherwise publishing is too slow in large projects.
  • Loading branch information
aSemy authored Jul 13, 2024
1 parent a5135d9 commit 7326fd2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/kotlin/DevPublishPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ constructor(
override fun apply(project: Project) {
val devPubExtension = project.extensions.createDevPublishExtension()

val devPubService = project.gradle.sharedServices.registerDevPubService()
val devPubService = project.gradle.sharedServices.registerDevPubService(project.path)

val devPubTasks = DevPublishTasksContainer(
tasks = project.tasks,
Expand Down Expand Up @@ -109,8 +109,14 @@ constructor(
}
}

private fun BuildServiceRegistry.registerDevPubService(): Provider<DevPublishService> =
registerIfAbsent(SERVICE_NAME, DevPublishService::class) {
/**
* Register a server per subproject, to prevent parallel publications into the same
* [DevPublishPluginExtension.stagingDevMavenRepo].
*/
private fun BuildServiceRegistry.registerDevPubService(
projectPath: String
): Provider<DevPublishService> =
registerIfAbsent("${SERVICE_NAME}_$projectPath", DevPublishService::class) {
maxParallelUsages.set(1)
}

Expand Down

0 comments on commit 7326fd2

Please sign in to comment.