Skip to content
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

Deduplicate Qt plugins deployment #175

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dantti
Copy link

@dantti dantti commented Jun 13, 2024

Sorry I added pre-commit locally to make sure clang-format was run and apparently your sources were not in sync with it

@dantti
Copy link
Author

dantti commented Jun 13, 2024

I have update with my .clang-format but still a bit different, I can manually fix it by hand :(, but I'd rather wait for your review and input about code style :)

@TheAssassin
Copy link
Member

This PR is unfortunately not acceptable because one cannot even tell what changes you implemented. You should never just run an autoformatter you like on an entire code base and the PR it.

Feel free to fix the PR and provide just the changes you want to propose. But, generally, I advise people to open issues first.

@dantti
Copy link
Author

dantti commented Jun 16, 2024

as I said I thought this project had .clang-format, it's a pain to work with projects that don't, and pre-commit just makes sure maintainers don't need to keed pointing to style issues which I have seen you pointing at on another PR.

I there was a proper style file I could just rebase and the PR would be fine.

@dantti dantti marked this pull request as draft June 18, 2024 21:19
@dantti dantti force-pushed the dantti/dedup_plugins branch 6 times, most recently from cc46109 to efacba7 Compare June 18, 2024 21:49
@dantti dantti marked this pull request as ready for review June 18, 2024 21:50
@dantti
Copy link
Author

dantti commented Jun 18, 2024

@TheAssassin done, I didn't bother to remove the using namespace .. which is not in use anymore, I can remove if you like...

@dantti
Copy link
Author

dantti commented Jun 18, 2024

Basically, most deployers had the same code that I moved into BasicPluginsDeployer::deploy() and read what was changing in each deployer with the list from qtPluginsToBeDeployed, for the corner cases where there was more logic BasicPluginsDeployer::customDeploy() is called with no need to call the base class as the code should go to BasicPluginsDeployer::deploy().

@@ -29,7 +29,21 @@ BasicPluginsDeployer::BasicPluginsDeployer(std::string moduleName,
qtDataPath(std::move(qtDataPath)) {}

bool BasicPluginsDeployer::deploy() {
// currently this is a no-op, but we might add more functionality later on, such as some kinds of default
// attempts to copy data based on the moduleName
for (const auto &pluginName : qtPluginsToBeDeployed()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a nice cleanup, but instead of introducing this code here along with the qtPluginsToBeDeployed function, I would suggest to introduce a protected BasicPluginsDeployer::deployPlugins(const std::vector<std::string> &plugins), so in each deploy() implementation one could just do for example:

    deployPlugins({"bearer"});

I think that's adding a bit less complexity overall, since it removes the need for both qtPluginsToBeDeployed and customDeploy.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while a deployStandardQtPlugins() could be nice indeed having a customDeploy() or if going with this function then maybe doDeploy() is a better naming, this is because we override methods and current code was calling the base method which makes the code slower due extra branching and is error prone as one has to remember to call that.
So I'll add a new commit and we see what is best.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's better and I do think it's nice how doDeploy allows to get rid of all the calls to the superclass. Though I would personally just have removed them, along with the base implementation, because "we might add more functionality later on" is not a good reason for all that cruft in my opinion.

Anyway, this patch is a good clean-up as-is in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants