diff options
author | Sylvain Joubert <joubert.sy@gmail.com> | 2019-10-23 15:07:15 (GMT) |
---|---|---|
committer | Sylvain Joubert <joubert.sy@gmail.com> | 2019-10-25 12:58:23 (GMT) |
commit | c168e789dfeeb4e0bd5db96bb17e682a9fd92b1f (patch) | |
tree | 6111faf8f82efa36fbabf55cfefe9696412aa412 /Source/CursesDialog | |
parent | 3300070cc2e7cadcb0fe2a77d67d2099bf22e7ba (diff) | |
download | CMake-c168e789dfeeb4e0bd5db96bb17e682a9fd92b1f.zip CMake-c168e789dfeeb4e0bd5db96bb17e682a9fd92b1f.tar.gz CMake-c168e789dfeeb4e0bd5db96bb17e682a9fd92b1f.tar.bz2 |
ccmake: Use the error display for all the logs
Diffstat (limited to 'Source/CursesDialog')
-rw-r--r-- | Source/CursesDialog/cmCursesLongMessageForm.cxx | 7 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.cxx | 41 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesMainForm.h | 11 |
3 files changed, 36 insertions, 23 deletions
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx b/Source/CursesDialog/cmCursesLongMessageForm.cxx index e2d8d06..4ff3fe4 100644 --- a/Source/CursesDialog/cmCursesLongMessageForm.cxx +++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx @@ -8,6 +8,7 @@ #include "cmCursesForm.h" #include "cmCursesMainForm.h" #include "cmCursesStandardIncludes.h" +#include "cmStringAlgorithms.h" #include "cmVersion.h" inline int ctrl(int z) @@ -19,11 +20,7 @@ cmCursesLongMessageForm::cmCursesLongMessageForm( std::vector<std::string> const& messages, const char* title) { // Append all messages into on big string - for (std::string const& message : messages) { - this->Messages += message; - // Add one blank line after each message - this->Messages += "\n\n"; - } + this->Messages = cmJoin(messages, "\n"); this->Title = title; this->Fields[0] = nullptr; this->Fields[1] = nullptr; diff --git a/Source/CursesDialog/cmCursesMainForm.cxx b/Source/CursesDialog/cmCursesMainForm.cxx index 3f7ee89..c76cc42 100644 --- a/Source/CursesDialog/cmCursesMainForm.cxx +++ b/Source/CursesDialog/cmCursesMainForm.cxx @@ -34,6 +34,7 @@ cmCursesMainForm::cmCursesMainForm(std::vector<std::string> args, : Args(std::move(args)) , InitialWidth(initWidth) { + this->HasNonStatusOutputs = false; this->NumberOfPages = 0; this->AdvancedMode = false; this->NumberOfVisibleEntries = 0; @@ -480,6 +481,8 @@ void cmCursesMainForm::UpdateProgress(const std::string& msg, float prog) status.append(progressBarWidth - progressBarCompleted, ' '); status += "] " + msg + "..."; this->UpdateStatusBar(status.c_str()); + } else { + this->Outputs.emplace_back(msg); } this->PrintKeys(1); curses_move(1, 1); @@ -505,8 +508,7 @@ int cmCursesMainForm::Configure(int noconfigure) this->CMakeInstance->GetHomeOutputDirectory()); this->LoadCache(nullptr); - // Get rid of previous errors - this->Errors = std::vector<std::string>(); + this->ResetOutputs(); // run the generate process this->OkToGenerate = true; @@ -524,7 +526,7 @@ int cmCursesMainForm::Configure(int noconfigure) keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ - if (retVal != 0 || !this->Errors.empty()) { + if (retVal != 0 || this->HasNonStatusOutputs) { // see if there was an error if (cmSystemTools::GetErrorOccuredFlag()) { this->OkToGenerate = false; @@ -532,11 +534,12 @@ int cmCursesMainForm::Configure(int noconfigure) int xx; int yy; getmaxyx(stdscr, yy, xx); + const char* title = "Configure produced the following output."; + if (cmSystemTools::GetErrorOccuredFlag()) { + title = "Configure failed with the following output."; + } cmCursesLongMessageForm* msgs = - new cmCursesLongMessageForm(this->Errors, - cmSystemTools::GetErrorOccuredFlag() - ? "Errors occurred during the last pass." - : "CMake produced the following output."); + new cmCursesLongMessageForm(this->Outputs, title); // reset error condition cmSystemTools::ResetErrorOccuredFlag(); CurrentForm = msgs; @@ -569,8 +572,7 @@ int cmCursesMainForm::Generate() this->UpdateProgress(msg, prog); }); - // Get rid of previous errors - this->Errors = std::vector<std::string>(); + this->ResetOutputs(); // run the generate process int retVal = this->CMakeInstance->Generate(); @@ -578,7 +580,7 @@ int cmCursesMainForm::Generate() this->CMakeInstance->SetProgressCallback(nullptr); keypad(stdscr, true); /* Use key symbols as KEY_DOWN */ - if (retVal != 0 || !this->Errors.empty()) { + if (retVal != 0 || this->HasNonStatusOutputs) { // see if there was an error if (cmSystemTools::GetErrorOccuredFlag()) { this->OkToGenerate = false; @@ -588,12 +590,12 @@ int cmCursesMainForm::Generate() int xx; int yy; getmaxyx(stdscr, yy, xx); - const char* title = "Messages during last pass."; + const char* title = "Generate produced the following output."; if (cmSystemTools::GetErrorOccuredFlag()) { - title = "Errors occurred during the last pass."; + title = "Generate failed with the following output."; } cmCursesLongMessageForm* msgs = - new cmCursesLongMessageForm(this->Errors, title); + new cmCursesLongMessageForm(this->Outputs, title); CurrentForm = msgs; msgs->Render(1, 1, xx, yy); msgs->HandleInput(); @@ -615,7 +617,8 @@ int cmCursesMainForm::Generate() void cmCursesMainForm::AddError(const std::string& message, const char* /*unused*/) { - this->Errors.emplace_back(message); + this->Outputs.emplace_back(message); + this->HasNonStatusOutputs = true; } void cmCursesMainForm::RemoveEntry(const char* value) @@ -857,7 +860,7 @@ void cmCursesMainForm::HandleInput() else if (key == 'l') { getmaxyx(stdscr, y, x); cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm( - this->Errors, "Errors occurred during the last pass."); + this->Outputs, "CMake produced the following output."); CurrentForm = msgs; msgs->Render(1, 1, x, y); msgs->HandleInput(); @@ -1020,6 +1023,12 @@ void cmCursesMainForm::JumpToCacheEntry(const char* astr) } } +void cmCursesMainForm::ResetOutputs() +{ + this->Outputs.clear(); + this->HasNonStatusOutputs = false; +} + const char* cmCursesMainForm::s_ConstHelpMessage = "CMake is used to configure and generate build files for software projects. " "The basic steps for configuring a project with ccmake are as follows:\n\n" @@ -1076,7 +1085,7 @@ const char* cmCursesMainForm::s_ConstHelpMessage = " c : process the configuration files with the current options\n" " g : generate build files and exit, only available when there are no " "new options and no errors have been detected during last configuration.\n" - " l : shows last errors\n" + " l : shows cmake output\n" " d : delete an option\n" " t : toggles advanced mode. In normal mode, only the most important " "options are shown. In advanced mode, all options are shown. We recommend " diff --git a/Source/CursesDialog/cmCursesMainForm.h b/Source/CursesDialog/cmCursesMainForm.h index b8769b7..c6a0262 100644 --- a/Source/CursesDialog/cmCursesMainForm.h +++ b/Source/CursesDialog/cmCursesMainForm.h @@ -122,10 +122,17 @@ protected: // Jump to the cache entry whose name matches the string. void JumpToCacheEntry(const char* str); + // Clear and reset the output log and state + void ResetOutputs(); + // Copies of cache entries stored in the user interface std::vector<cmCursesCacheEntryComposite> Entries; - // Errors produced during last run of cmake - std::vector<std::string> Errors; + + // Output produced by the last pass + std::vector<std::string> Outputs; + // Did the last pass produced outputs of interest (errors, warnings, ...) + bool HasNonStatusOutputs; + // Command line arguments to be passed to cmake each time // it is run std::vector<std::string> Args; |