[Cmake-commits] CMake branch, next, updated. v2.8.12-4641-g8cf25c7

Nils Gladitz nilsgladitz at gmail.com
Tue Oct 29 18:20:32 EDT 2013


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, next has been updated
       via  8cf25c725f97fd1a78b3453d0f10209b5a071a4e (commit)
       via  e6961fc0a36fed6a9d2fc52984dba4b1c7c3b243 (commit)
       via  0a8947fe7f96430defa70e0a1204f13ffdd107a3 (commit)
      from  3b6beab43f1fdfce3329fb205aa8e0b890580b5a (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 -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8cf25c725f97fd1a78b3453d0f10209b5a071a4e
commit 8cf25c725f97fd1a78b3453d0f10209b5a071a4e
Merge: 3b6beab e6961fc
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Tue Oct 29 18:20:24 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 29 18:20:24 2013 -0400

    Merge topic 'fix-ninja-launcher-errors-from-custom' into next
    
    e6961fc Ninja: run custom commands through launcher if available
    0a8947f Tests: new test detects if custom command failures are detected with launchers


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6961fc0a36fed6a9d2fc52984dba4b1c7c3b243
commit e6961fc0a36fed6a9d2fc52984dba4b1c7c3b243
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Tue Oct 29 22:56:23 2013 +0100
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Tue Oct 29 22:56:23 2013 +0100

    Ninja: run custom commands through launcher if available

diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index d95a213..f1d5e2c 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -318,9 +318,13 @@ void cmLocalNinjaGenerator::AppendCustomCommandLines(const cmCustomCommand *cc,
     cdCmd << cdStr << this->ConvertToOutputFormat(wd, SHELL);
     cmdLines.push_back(cdCmd.str());
   }
+
+  std::string launcher = this->MakeCustomLauncher(*cc);
+
   for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) {
-    cmdLines.push_back(this->ConvertToOutputFormat(ccg.GetCommand(i).c_str(),
-                                                   SHELL));
+    cmdLines.push_back(launcher +
+      this->ConvertToOutputFormat(ccg.GetCommand(i).c_str(), SHELL));
+
     std::string& cmd = cmdLines.back();
     ccg.AppendArguments(i, cmd);
   }
@@ -407,3 +411,39 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatements()
     this->WriteCustomCommandBuildStatement(i->first, ccTargetDeps);
   }
 }
+
+std::string cmLocalNinjaGenerator::MakeCustomLauncher(
+  const cmCustomCommand& cc)
+{
+  const char* property = "RULE_LAUNCH_CUSTOM";
+  const char* property_value = this->Makefile->GetProperty(property);
+
+  if(!property_value || !*property_value)
+  {
+    return std::string();
+  }
+
+  // Expand rules in the empty string.  It may insert the launcher and
+  // perform replacements.
+  RuleVariables vars;
+  vars.RuleLauncher = property;
+  std::string output;
+  const std::vector<std::string>& outputs = cc.GetOutputs();
+  if(!outputs.empty())
+  {
+    RelativeRoot relative_root =
+      cc.GetWorkingDirectory() ? NONE : START_OUTPUT;
+
+    output = this->Convert(outputs[0].c_str(), relative_root, SHELL);
+  }
+  vars.Output = output.c_str();
+
+  std::string launcher;
+  this->ExpandRuleVariables(launcher, vars);
+  if(!launcher.empty())
+  {
+    launcher += " ";
+  }
+
+  return launcher;
+}
diff --git a/Source/cmLocalNinjaGenerator.h b/Source/cmLocalNinjaGenerator.h
index c450841..8eb63c5 100644
--- a/Source/cmLocalNinjaGenerator.h
+++ b/Source/cmLocalNinjaGenerator.h
@@ -121,6 +121,7 @@ private:
 
   void WriteCustomCommandBuildStatements();
 
+  std::string MakeCustomLauncher(const cmCustomCommand& cc);
 
   std::string ConfigName;
   std::string HomeRelativeOutputPath;

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0a8947fe7f96430defa70e0a1204f13ffdd107a3
commit 0a8947fe7f96430defa70e0a1204f13ffdd107a3
Author:     Nils Gladitz <nilsgladitz at gmail.com>
AuthorDate: Tue Oct 29 22:29:27 2013 +0100
Commit:     Nils Gladitz <nilsgladitz at gmail.com>
CommitDate: Tue Oct 29 22:29:27 2013 +0100

    Tests: new test detects if custom command failures are detected with launchers

diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 4b08c88..fe504b8 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -2344,6 +2344,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
       --output-log "${CMake_BINARY_DIR}/Tests/CTestTest2/testOutput.log"
       )
 
+    configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestLaunchers/test.cmake.in"
+      "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" @ONLY ESCAPE_QUOTES)
+    add_test(CTestTestLaunchers ${CMAKE_CTEST_COMMAND}
+      -S "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/test.cmake" -V
+      --output-log "${CMake_BINARY_DIR}/Tests/CTestTestLaunchers/testOutput.log"
+      )
+    set_tests_properties(CTestTestLaunchers PROPERTIES
+      PASS_REGULAR_EXPRESSION "CTEST_TEST_LAUNCHER_SUCCESS")
+
     configure_file("${CMake_SOURCE_DIR}/Tests/CTestTestChecksum/test.cmake.in"
       "${CMake_BINARY_DIR}/Tests/CTestTestChecksum/test.cmake" @ONLY
       ESCAPE_QUOTES)
diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt b/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt
new file mode 100644
index 0000000..06c5725
--- /dev/null
+++ b/Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+project(launcher_test_project)
+
+include(CTest)
+
+add_custom_command(
+  OUTPUT test1.txt
+  COMMAND ${CMAKE_COMMAND}
+  ARGS -DTESTID=1 -P "${CMAKE_CURRENT_SOURCE_DIR}/command.cmake"
+)
+
+add_custom_command(
+  OUTPUT test2.txt
+  COMMAND ${CMAKE_COMMAND}
+  ARGS -DTESTID=2 -P "${CMAKE_CURRENT_SOURCE_DIR}/command.cmake"
+)
+
+add_custom_target(mytarget ALL DEPENDS test1.txt test2.txt)
diff --git a/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake
new file mode 100644
index 0000000..bf404ab
--- /dev/null
+++ b/Tests/CTestTestLaunchers/launcher_test_project/CTestConfig.cmake
@@ -0,0 +1,8 @@
+set(CTEST_USE_LAUNCHERS 1)
+set(CTEST_PROJECT_NAME "CTestTestLaunchers")
+set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
+set(CTEST_DART_SERVER_VERSION "2")
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "www.cdash.org")
+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard")
+set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/Tests/CTestTestLaunchers/launcher_test_project/command.cmake b/Tests/CTestTestLaunchers/launcher_test_project/command.cmake
new file mode 100644
index 0000000..7f31af9
--- /dev/null
+++ b/Tests/CTestTestLaunchers/launcher_test_project/command.cmake
@@ -0,0 +1,5 @@
+if("${TESTID}" STREQUAL "1")
+  message("success")
+elseif("${TESTID}" STREQUAL "2")
+  message(FATAL_ERROR "failure")
+endif()
diff --git a/Tests/CTestTestLaunchers/test.cmake.in b/Tests/CTestTestLaunchers/test.cmake.in
new file mode 100644
index 0000000..43a6533
--- /dev/null
+++ b/Tests/CTestTestLaunchers/test.cmake.in
@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 2.8.12)
+
+# Settings:
+set(CTEST_DASHBOARD_SOURCE              "@CMake_SOURCE_DIR@/Tests/CTestTestLaunchers")
+set(CTEST_DASHBOARD_ROOT                "@CMake_BINARY_DIR@/Tests/CTestTestLaunchers")
+set(CTEST_SITE                          "@SITE@")
+set(CTEST_BUILD_NAME                    "Launchers- at BUILDNAME@-CTestTestLaunchers")
+
+set(CTEST_SOURCE_DIRECTORY              "${CTEST_DASHBOARD_SOURCE}/launcher_test_project")
+set(CTEST_BINARY_DIRECTORY              "${CTEST_DASHBOARD_ROOT}/launcher_test_project-bin")
+set(CTEST_CMAKE_GENERATOR               "@CMAKE_GENERATOR@")
+set(CTEST_CMAKE_GENERATOR_TOOLSET       "@CMAKE_GENERATOR_TOOLSET@")
+set(CTEST_BUILD_CONFIGURATION           "$ENV{CMAKE_CONFIG_TYPE}")
+set(CTEST_NOTES_FILES                   "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
+
+ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
+
+file(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
+CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@
+CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@
+CMAKE_C_COMPILER:STRING=@CMAKE_C_COMPILER@
+CMAKE_CXX_COMPILER:STRING=@CMAKE_CXX_COMPILER@
+CMAKE_C_COMPILER_ARG1:STRING=@CMAKE_C_COMPILER_ARG1@
+CMAKE_CXX_COMPILER_ARG1:STRING=@CMAKE_CXX_COMPILER_ARG1@
+")
+
+set(TEST_SUCCESS FALSE)
+
+ctest_start(Experimental)
+ctest_configure(OPTIONS "-DCTEST_USE_LAUNCHERS=1")
+ctest_build(NUMBER_ERRORS error_count)
+
+if("${error_count}" STREQUAL "1")
+  set(TEST_SUCCESS TRUE)
+endif()
+
+if(TEST_SUCCESS)
+  message("CTEST_TEST_LAUNCHER_SUCCESS")
+endif()

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

Summary of changes:
 Source/cmLocalNinjaGenerator.cxx                   |   44 +++++++++++++++++++-
 Source/cmLocalNinjaGenerator.h                     |    1 +
 Tests/CMakeLists.txt                               |    9 ++++
 .../launcher_test_project/CMakeLists.txt           |   19 ++++++++
 .../launcher_test_project}/CTestConfig.cmake       |    3 +-
 .../launcher_test_project/command.cmake            |    5 ++
 Tests/CTestTestLaunchers/test.cmake.in             |   39 +++++++++++++++++
 7 files changed, 117 insertions(+), 3 deletions(-)
 create mode 100644 Tests/CTestTestLaunchers/launcher_test_project/CMakeLists.txt
 copy Tests/{CTestTestScheduler => CTestTestLaunchers/launcher_test_project}/CTestConfig.cmake (77%)
 create mode 100644 Tests/CTestTestLaunchers/launcher_test_project/command.cmake
 create mode 100644 Tests/CTestTestLaunchers/test.cmake.in


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list