| Summary: | Headless build always cleans active configuration | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Nobody - feel free to take it <nobody> | ||||||
| Component: | cdt-build | Assignee: | Torbjörn Svensson <torbjorn.svensson> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | Andrew Gvozdev <angvoz.dev> | ||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | cdtdoug, heamuasi, jamesblackburn+eclipse, jonah, mistria, torbjorn.svensson, torbjorn.svensson, william.riley, yevshif, zulliger | ||||||
| Version: | 8.0 | ||||||||
| Target Milestone: | 9.5.0 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| See Also: |
https://git.eclipse.org/r/119602 https://git.eclipse.org/r/119605 https://git.eclipse.org/r/119915 https://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=4881a2ecd42d20dbb5e785801b122daa27f36799 https://bugs.eclipse.org/bugs/show_bug.cgi?id=552606 https://git.eclipse.org/r/c/platform/eclipse.platform.resources/+/119602 |
||||||||
| Whiteboard: | |||||||||
| Bug Depends on: | |||||||||
| Bug Blocks: | 571134 | ||||||||
| Attachments: |
|
||||||||
|
Description
Nobody - feel free to take it
Mikhail is right: I discovered this bug too. Anybody knows how to fix this? Created attachment 265712 [details]
[Patch 1/2] Add method preserving builder specific arguments to base class
In order to clean the correct configuration, the builder specific arguments needs to be preserved when calling clean. If the builder specific arguments are lost, the active configuration will be cleaned and this is usually not what the user expects if a non-active configuration was selected for the clean operation.
Created attachment 265713 [details]
[Patch 2/2] Implement the argument preserving clean
The 2'nd part implements the clean method with builder specific arguments preserved so that the correct project/configuration is cleaned rather than the active configuration for the project.
Steps to reproduce: 1. Create a new "Hello World ANSI C Project" with default settings, call it "helloc" for simplicity. 2. Make sure "Debug" is the active build configuration for the newly created project. 3. Run the headless builder application with the following arguments: -importAll /path/to/helloc -cleanAll helloc/Debug 4. Verify that the configuration Debug in helloc is both cleaned and compiled. 5. Run the headless builder application with the following arguments: -importAll /path/to/helloc -cleanAll helloc/Release 6. Verify that the configuration Release in helloc is both cleaned and compiled. Without the attached set of patches, step 6 above will clean configuration "Debug" but build configuration "Release" and that's obviously not what the user expected to happen. New Gerrit change created: https://git.eclipse.org/r/119602 New Gerrit change created: https://git.eclipse.org/r/119605 Is there a workaround possible somewhere, such as storing in the builder state or project state what are the files to be cleaned? Couldn't/Shouldn't the clean operation perform a full clean which would be independent of args? New Gerrit change created: https://git.eclipse.org/r/119915 Thanks for the comments on both the Gerrit review and here. I've debugged this a bit further and came up with another solution that does not require an API change, but will instead rely on a race condition (nothing new since the UI is already using it) by switching the "active configuration" when invoking builder to clean a configuration. In the ManagedBuildManager.buildConfigrations method, there is a comment about clean not taking arguments and I think the solution there should be considered a workaround, but not actually a proper solution for the problem. (https://git.eclipse.org/r/plugins/gitiles/cdt/org.eclipse.cdt/+/master/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java#4591) With https://git.eclipse.org/r/119915 the HeadlessBuilder can at least reach the same functionality as the UI although not optimal. I think this is a good compromise for the short run, but I really think that the argument to clean should be considered for future releases since it is more flexible than this solution. Lets see if we can make sure this gets reviewed in time for 9.5. It looks promising, but I want to have a closer look. Gerrit change https://git.eclipse.org/r/119915 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=4881a2ecd42d20dbb5e785801b122daa27f36799 |