|[cdt-dev] MBS runs Make Target command from Make Targets View twice adding "clean" to it during the first run|
This issue is for Bug240616. The problem is below.
The resulting command "pwd clean" produced by MBS in this example looks somehow out of ordinary.
Granted, this is a contrived case, but it is hitting me trying to run Make Targets from the View in a specific configuration (bug 224640). At the very least it shows inconsistency in the current MBS implementation.
Follow the steps to the letter, it's a bit brittle to reproduce ;).
1. Disable "Build Automatically"
2. Create a new managed project (Executable Hello World C++ project is fine). It should create 2 configurations, "Debug" and "Release".
3. In Make Targets view, create a target "pwd" in the project folder. Name it pwd, uncheck "Use default", replace "make" with "pwd". Uncheck "Run all project builders".
4. Active configuration should be "Debug" at that point. Build it.
5. Go to Project menu to a clean dialog of the project. Uncheck "Start a build immediately" and press OK to run. That will clean Debug configuration built at previous step.
6. Switch to "Release" configuration. Build the project.
7. Switch back to "Debug" configuration. Now run the target "pwd' from Make Targets view. Oops, what is going on? It runs it twice and the first time outrageously adds "clean" to our "pwd" command:
**** Clean-only build of configuration Debug for project Managed ****
pwd: ignoring non-option arguments
**** Build of configuration Debug for project Managed ****
As I investigated the source code, the command for clean is from the current builder (in this situation, the current builder is for Make Target build.). And if the current builder do not have a command, it should recursively go up to get the command of its super class. But for the condition of this bug, the builder of Make target has a command "pwd". So the clean will use "pwd" as its build command. This is why the above problem happens.
Andrew, the reporter, thinks the clean should use the command that is specified in project Properties à C/C++ Build à Builder Setting à Build command, and its arguments (target) in tab Behaviour à Clean target.
However, in my opinion, as the build is for the Make target, we should use the command of Make target to clean the project, but not the command specified in Properties-->C/C++ Build -> Builder Settings -> Build command. In other words, the command used for clean should be the command for the current build, but not the command specified to general build.
Any comments to us?
Back to the top