This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, master has been updated
       via  f63d84c37c9ee1ea686369848b5bfc22916e1551 (commit)
       via  4ea992ab3241362d3b38aaa48319d13ef2cb87c5 (commit)
       via  fc4f00cbf64c6f192b36e7b9187fc26a1f51a4b4 (commit)
       via  1bd06579a3435d82ce1146c431c582b72c18fec9 (commit)
       via  02aa03eb0a5e8551fb69b63712ef4512343cd769 (commit)
       via  88cfef0821933dfa4e840c793cdb9352d4b4423b (commit)
      from  e56e9c14c5f06341c101e8de2a4876ecf3f5514f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f63d84c37c9ee1ea686369848b5bfc22916e1551
commit f63d84c37c9ee1ea686369848b5bfc22916e1551
Merge: 4ea992ab32 fc4f00cbf6
Author:     Craig Scott <craig.sc...@crascit.com>
AuthorDate: Mon Nov 18 10:49:52 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Mon Nov 18 05:50:02 2019 -0500

    Merge branch 'release-3.16'


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4ea992ab3241362d3b38aaa48319d13ef2cb87c5
commit 4ea992ab3241362d3b38aaa48319d13ef2cb87c5
Merge: 1bd06579a3 02aa03eb0a
Author:     Craig Scott <craig.sc...@crascit.com>
AuthorDate: Mon Nov 18 10:49:52 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Mon Nov 18 05:50:02 2019 -0500

    Merge topic 'tutorial-replace-unicode-dash'
    
    02aa03eb0a Tutorial: replace Unicode EN DASH with ASCII dash
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !4058


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1bd06579a3435d82ce1146c431c582b72c18fec9
commit 1bd06579a3435d82ce1146c431c582b72c18fec9
Merge: e56e9c14c5 88cfef0821
Author:     Craig Scott <craig.sc...@crascit.com>
AuthorDate: Mon Nov 18 10:46:16 2019 +0000
Commit:     Kitware Robot <kwro...@kitware.com>
CommitDate: Mon Nov 18 05:46:31 2019 -0500

    Merge topic 'ccmake_redirect_stdstreams'
    
    88cfef0821 ccmake: redirect stdout/stderr to the displayed logs
    
    Acked-by: Kitware Robot <kwro...@kitware.com>
    Merge-request: !4005


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=88cfef0821933dfa4e840c793cdb9352d4b4423b
commit 88cfef0821933dfa4e840c793cdb9352d4b4423b
Author:     Sylvain Joubert <joubert...@gmail.com>
AuthorDate: Tue Nov 5 17:07:42 2019 +0100
Commit:     Sylvain Joubert <joubert...@gmail.com>
CommitDate: Sat Nov 16 08:27:32 2019 +0100

    ccmake: redirect stdout/stderr to the displayed logs
    
    Use cmSystemTools to report some messages.
    These should now be caught and displayed properly,
    both in ccmake and cmake-gui
    
    Avoid log display flickering during processing
    - Don't clear the screen each time the long message form is rendered.
      It always renders the whole screen again so clearing it only causes
      flickering.
    - Add scroll down capabilities to the long message form so that it can
      draw itself directly in the correct state. This removes the need to
      programatically scroll down just after that also caused flickering.
    
    Fixes #19882
    Fixes #13288

diff --git a/Source/CursesDialog/ccmake.cxx b/Source/CursesDialog/ccmake.cxx
index 7732105085..01fce85454 100644
--- a/Source/CursesDialog/ccmake.cxx
+++ b/Source/CursesDialog/ccmake.cxx
@@ -155,10 +155,28 @@ int main(int argc, char const* const* argv)
     return 1;
   }
 
+  /*
+   * The message is stored in a list by the form which will be
+   * joined by '\n' before display.
+   * Removing any trailing '\n' avoid extra empty lines in the final results
+   */
+  auto cleanMessage = [](const std::string& message) -> std::string {
+    auto msg = message;
+    if (!msg.empty() && msg.back() == '\n') {
+      msg.pop_back();
+    }
+    return msg;
+  };
   cmSystemTools::SetMessageCallback(
-    [myform](const std::string& message, const char* title) {
-      myform->AddError(message, title);
+    [&](const std::string& message, const char* title) {
+      myform->AddError(cleanMessage(message), title);
     });
+  cmSystemTools::SetStderrCallback([&](const std::string& message) {
+    myform->AddError(cleanMessage(message), "");
+  });
+  cmSystemTools::SetStdoutCallback([&](const std::string& message) {
+    myform->UpdateProgress(cleanMessage(message), -1);
+  });
 
   cmCursesForm::CurrentForm = myform;
 
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.cxx 
b/Source/CursesDialog/cmCursesLongMessageForm.cxx
index a69fdee894..806e663e9e 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.cxx
+++ b/Source/CursesDialog/cmCursesLongMessageForm.cxx
@@ -17,7 +17,9 @@ inline int ctrl(int z)
 }
 
 cmCursesLongMessageForm::cmCursesLongMessageForm(
-  std::vector<std::string> const& messages, const char* title)
+  std::vector<std::string> const& messages, const char* title,
+  ScrollBehavior scrollBehavior)
+  : Scrolling(scrollBehavior)
 {
   // Append all messages into on big string
   this->Messages = cmJoin(messages, "\n");
@@ -109,8 +111,6 @@ void cmCursesLongMessageForm::Render(int /*left*/, int 
/*top*/, int /*width*/,
 
   const char* msg = this->Messages.c_str();
 
-  curses_clear();
-
   if (this->Fields[0]) {
     free_field(this->Fields[0]);
     this->Fields[0] = nullptr;
@@ -133,7 +133,11 @@ void cmCursesLongMessageForm::Render(int /*left*/, int 
/*top*/, int /*width*/,
     }
     i++;
   }
-  form_driver(this->Form, REQ_BEG_FIELD);
+  if (this->Scrolling == ScrollBehavior::ScrollDown) {
+    form_driver(this->Form, REQ_END_FIELD);
+  } else {
+    form_driver(this->Form, REQ_BEG_FIELD);
+  }
 
   this->UpdateStatusBar();
   touchwin(stdscr);
@@ -174,13 +178,3 @@ void cmCursesLongMessageForm::HandleInput()
     wrefresh(stdscr);
   }
 }
-
-void cmCursesLongMessageForm::ScrollDown()
-{
-  if (this->Form) {
-    form_driver(this->Form, REQ_END_FIELD);
-    this->UpdateStatusBar();
-    touchwin(stdscr);
-    wrefresh(stdscr);
-  }
-}
diff --git a/Source/CursesDialog/cmCursesLongMessageForm.h 
b/Source/CursesDialog/cmCursesLongMessageForm.h
index dde5bfffaf..88efe62173 100644
--- a/Source/CursesDialog/cmCursesLongMessageForm.h
+++ b/Source/CursesDialog/cmCursesLongMessageForm.h
@@ -14,8 +14,14 @@
 class cmCursesLongMessageForm : public cmCursesForm
 {
 public:
+  enum class ScrollBehavior
+  {
+    NoScroll,
+    ScrollDown
+  };
+
   cmCursesLongMessageForm(std::vector<std::string> const& messages,
-                          const char* title);
+                          const char* title, ScrollBehavior scrollBehavior);
   ~cmCursesLongMessageForm() override;
 
   cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete;
@@ -26,10 +32,6 @@ public:
   void HandleInput() override;
 
   // Description:
-  // Scroll down to the end of the content
-  void ScrollDown();
-
-  // Description:
   // Display form. Use a window of size width x height, starting
   // at top, left.
   void Render(int left, int top, int width, int height) override;
@@ -47,6 +49,7 @@ public:
 protected:
   std::string Messages;
   std::string Title;
+  ScrollBehavior Scrolling;
 
   FIELD* Fields[2];
 };
diff --git a/Source/CursesDialog/cmCursesMainForm.cxx 
b/Source/CursesDialog/cmCursesMainForm.cxx
index ffc9528966..dff2afed61 100644
--- a/Source/CursesDialog/cmCursesMainForm.cxx
+++ b/Source/CursesDialog/cmCursesMainForm.cxx
@@ -546,13 +546,13 @@ int cmCursesMainForm::Configure(int noconfigure)
     if (cmSystemTools::GetErrorOccuredFlag()) {
       title = "Configure failed with the following output";
     }
-    cmCursesLongMessageForm* msgs =
-      new cmCursesLongMessageForm(this->Outputs, title);
+    cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
+      this->Outputs, title,
+      cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
     // reset error condition
     cmSystemTools::ResetErrorOccuredFlag();
     CurrentForm = msgs;
     msgs->Render(1, 1, xx, yy);
-    msgs->ScrollDown();
     msgs->HandleInput();
     // If they typed the wrong source directory, we report
     // an error and exit
@@ -603,11 +603,11 @@ int cmCursesMainForm::Generate()
     if (cmSystemTools::GetErrorOccuredFlag()) {
       title = "Generate failed with the following output";
     }
-    cmCursesLongMessageForm* msgs =
-      new cmCursesLongMessageForm(this->Outputs, title);
+    cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
+      this->Outputs, title,
+      cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
     CurrentForm = msgs;
     msgs->Render(1, 1, xx, yy);
-    msgs->ScrollDown();
     msgs->HandleInput();
     // If they typed the wrong source directory, we report
     // an error and exit
@@ -858,8 +858,9 @@ void cmCursesMainForm::HandleInput()
           this->HelpMessage[1] = "";
         }
 
-        cmCursesLongMessageForm* msgs =
-          new cmCursesLongMessageForm(this->HelpMessage, "Help");
+        cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
+          this->HelpMessage, "Help",
+          cmCursesLongMessageForm::ScrollBehavior::NoScroll);
         CurrentForm = msgs;
         msgs->Render(1, 1, x, y);
         msgs->HandleInput();
@@ -871,7 +872,8 @@ void cmCursesMainForm::HandleInput()
       else if (key == 'l') {
         getmaxyx(stdscr, y, x);
         cmCursesLongMessageForm* msgs = new cmCursesLongMessageForm(
-          this->Outputs, "CMake produced the following output");
+          this->Outputs, "CMake produced the following output",
+          cmCursesLongMessageForm::ScrollBehavior::NoScroll);
         CurrentForm = msgs;
         msgs->Render(1, 1, x, y);
         msgs->HandleInput();
@@ -1048,12 +1050,12 @@ void cmCursesMainForm::DisplayOutputs()
   int yi;
   getmaxyx(stdscr, yi, xi);
 
-  auto newLogForm =
-    new cmCursesLongMessageForm(this->Outputs, this->LastProgress.c_str());
+  auto newLogForm = new cmCursesLongMessageForm(
+    this->Outputs, this->LastProgress.c_str(),
+    cmCursesLongMessageForm::ScrollBehavior::ScrollDown);
   CurrentForm = newLogForm;
   this->LogForm.reset(newLogForm);
   this->LogForm->Render(1, 1, xi, yi);
-  this->LogForm->ScrollDown();
 }
 
 const char* cmCursesMainForm::s_ConstHelpMessage =
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 4a6108d9ee..b1c6e8fd7a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -330,9 +330,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& 
args)
           }
         }
       } else {
-        std::cerr << "Parse error in command line argument: " << arg << "\n"
-                  << "Should be: VAR:type=value\n";
-        cmSystemTools::Error("No cmake script provided.");
+        cmSystemTools::Error("Parse error in command line argument: " + arg +
+                             "\n" + "Should be: VAR:type=value\n");
         return false;
       }
     } else if (cmHasLiteralPrefix(arg, "-W")) {
@@ -422,7 +421,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& 
args)
           return false;
         }
       }
-      std::cout << "loading initial cache file " << path << "\n";
+      cmSystemTools::Stdout("loading initial cache file " + path + "\n");
       // Resolve script path specified on command line relative to $PWD.
       path = cmSystemTools::CollapseFullPath(path);
       this->ReadListFile(args, path);

-----------------------------------------------------------------------

Summary of changes:
 Help/guide/tutorial/index.rst                   |  4 ++--
 Source/CursesDialog/ccmake.cxx                  | 22 +++++++++++++++++++--
 Source/CursesDialog/cmCursesLongMessageForm.cxx | 22 ++++++++-------------
 Source/CursesDialog/cmCursesLongMessageForm.h   | 13 ++++++++-----
 Source/CursesDialog/cmCursesMainForm.cxx        | 26 +++++++++++++------------
 Source/cmake.cxx                                |  7 +++----
 6 files changed, 55 insertions(+), 39 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
https://cmake.org/mailman/listinfo/cmake-commits

Reply via email to