Fix duplicated publishing#128
Merged
alexander-yevsyukov merged 13 commits intomasterfrom Apr 25, 2025
Merged
Conversation
armiol
approved these changes
Apr 25, 2025
... thus addressing #119.
... because the task is not yet available, and the build fails. This is related to the changes in the mechanism of applying publication handlers we've introduced.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is yet another one in the chain of requests handling the duplicated repositories issue for custom publications. There's much hope that this time we finally fixed it.
Unlike we suggested in the previous PR the problem was not because
afterEvaluatewas executed twice. The problem was that we asked to run it twice for two different custom publication handlers that (surprise!) got the same publishing destination repositories.How it worked
The
spinePublishingextension applied to the root project handles the "sorting" of publications. Those projects who are not listed amongmodulesWithCustomPublishinggotStandardPublicationHandler, which does a lot of automated publishing work.If a module goes its own publishing way via enrolling to the
modulesWithCustomPublishinglist, it getsCustomPublicationHandler.This all works fine if a subproject does not have its own
spinePublishingextension, which is the case for the modules packing IntelliJ IDEA into fat JARs. These modules get ownspinePublishingextensions viaintellij-platform-jarconventions plugin. Because of this,SpinePublishingextension in those subprojects also arranges the publishing with the same destinations, which it gets from therootProject's extension.This, in turn, creates own
CustomPublicationHandlerwhich runs itsapply()onafterEvaluate.How we fixed it
apply()onafterEvaluatetwice — because we have two levels ofspinePublishingin the project hierarchy — does not do any harm. The real "meat" of theapply()function is done once.Other notable changes
io.spine.tools.gradle.task.ProtobufTaskNameunder theprotobufpackage #119 has been addressed by introducing an open base class in the proper package and making the deprecated class extend the new open base.