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

Please consider an option to always "Clean Configure" when setting the Configuration #534

Open
b-spencer opened this issue Nov 23, 2023 · 1 comment
Labels
enhancement New feature or request
Milestone

Comments

@b-spencer
Copy link

First up, thanks for the extension. I use it constantly to generate a compilation database (CDB).

I think that the following Makefile Tools commands behave as I describe below:

  1. "Makefile: Configure" generates a build log by running make with flags including --dry-run that cause it to print the commands needed to build all out-of-date targets. Makefile Tools then parses this to produce compile_commands.json.
  2. "Makefile: Clean Configure" generates a build log by running make with the same flags, plus --always-make so that it prints the commands needed to build all targets.

I also think that whenever I change the "Configuration" on the Makefile Tools section of the Primary Sidebar, the extension automatically runs "Makefile: Configure". Thus, when I switch configuration, the CDB is updated, but only with information about the commands needed to build the out-of-date targets.

(BTW, I learned the above by examining the diagnostics output of Makefile Tools. This wasn't at all obvious to me, and it took a great deal of experimentation to figure this out. I suggest expanding the documentation to talk about these commands and why and when you should use them.)

When I am working on a project, I almost always have all of it already built. So, most of my targets are already up-to-date. This means that when "Makefile: Configure" runs, there are usually zero or very few commands printed by make to the build log, which means that Makefile Tools does not update very much of the CDB.

So, when I change the Configuration in the Makefile Tools section of the Primary Sidebar, I always want to regenerate all of the commands in the CDB. At least for all of my projects, changing the configuration means changing every compile command. Note that I am talking about the Configuration, not the Build target. Note that I do not make clean when I switch configurations. In my projects, different configurations actually generate completely different artefacts to different build output directories, or have other automatic rules that do not require cleaning the workspace. I think this is common even for less complex projects with, for example, release vs. debug configurations.

Thus, every time I change the Configuration:

  1. Makefile Tools runs "Makefile: Configure". It often finds no targets needing rebuilt for the new configuration or some arbitrary small subset and makes no or minimal updates to the CDB.
  2. I wait for that to finish, and then I immediately run "Makefile: Clean Configure" manually in order to regenerate the full CDB for the new configuration.

Therefore, I ask:

  1. Should Makefile Tools have an option to run "Makefile: Clean Configure" whenever you switch targets instead of running "Makefile: Configure"?
  2. Should such an option be enabled by default? (I would think this is the typical case. I can't think of when I'd change configuration and not want to regenerate the whole CDB. Maybe my understanding of how Makefile Tools works is wrong?)

Thanks for considering the questions.

@gcampbell-msft
Copy link
Collaborator

@b-spencer Thank you for the detailed issue and request! Updating the docs as well as your suggestions for running clean configure upon switching targets is a reasonable thing to consider, I will mark it as a request and put it on our backlog to investigate and consider! Thanks.

@gcampbell-msft gcampbell-msft added enhancement New feature or request and removed triage labels Nov 30, 2023
@gcampbell-msft gcampbell-msft added this to the On Deck milestone Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants