Repository navigation
Fail the build when storm-client or storm-server imports relocated packages directly - #9286
Open
dragonknightk wants to merge 2 commits into
Open
dragonknightk wants to merge 2 commits into
dragonknightk wants to merge 2 commits into
Conversation
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.
Fixes #7641
What is the purpose of the change
storm-client and storm-server now fail validate when their main code imports one of the relocated packages of storm-shaded-deps. Such an import still compiles if another dependency brings in the original jar, so the module silently depends on an unshaded copy. Six imports already did this:
They now use the shaded classes, like the other imports in the same modules.
The root pom defines the check-unshaded-imports checkstyle execution once, in pluginManagement, with an IllegalImport rule that reads the unshaded.illegalPkgs property. The shared storm_checkstyle.xml stays unchanged. The execution is bound to the phase in the unshaded.check.phase property, which defaults to none. storm-client and storm-server set it to validate and set their own unshaded.illegalPkgs. A comment next to the relocations in storm-shaded-deps/pom.xml points to these two properties.
The two lists differ:
Both lists ban org.apache.curator, so new Curator code in the main code of storm-client and storm-server has to use the shaded package. This fits the ongoing Curator decoupling.
Other modules are not checked, because storm-core, storm-webapp and the external modules declare some of the relocated packages themselves. They inherit the execution with phase none, so it never runs there. Test code is not checked, because tests use curator-test, which is not shaded. The check covers import statements only, not fully qualified class names in code.
How was the change tested
Without the fixes, storm-client reports the IOUtils import and storm-server reports the five com.google.common imports, and nothing else. A temporary class in storm-server that imports one class from each relocated package fails on the 15 banned packages and passes on the allowed ones and on auto-service. Temporary imports of the first, the last and two other banned packages fail validate in storm-client and in storm-server. The effective pom of storm-client and storm-server binds check-unshaded-imports to validate with their own package lists. The build with the examples and externals profiles passes validate in every module and runs check-unshaded-imports only in storm-client and storm-server. UtilsTest passes in storm-client. SlotTest, WorkerTokenTest, EquivalenceUtilsTest, TestCgroups, TestResourceAwareScheduler and MultitenantSchedulerTest pass in storm-server.
AI Disclosure
Human-led contribution. Grok Bot, working for dragonknightk, assisted with this change, including the code, tests, and description. All submitted content was reviewed by a human before submission.
(。•̀ᴗ-)✧