mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 06:09:52 -06:00
Make use of std::chrono throughout every component
This commit continues the changes made in CTest to support std::chrono by applying it throughout every component where a duration was used. No functional change intended.
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include "cmCPackIFWPackage.h"
|
#include "cmCPackIFWPackage.h"
|
||||||
#include "cmCPackIFWRepository.h"
|
#include "cmCPackIFWRepository.h"
|
||||||
#include "cmCPackLog.h" // IWYU pragma: keep
|
#include "cmCPackLog.h" // IWYU pragma: keep
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
@@ -84,9 +85,9 @@ int cmCPackIFWGenerator::PackageFiles()
|
|||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
|
cmCPackIFWLogger(OUTPUT, "- Generate repository" << std::endl);
|
||||||
bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
|
bool res = cmSystemTools::RunSingleCommand(
|
||||||
&output, &retVal, nullptr,
|
ifwCmd.c_str(), &output, &output, &retVal, nullptr,
|
||||||
this->GeneratorVerbose, 0);
|
this->GeneratorVerbose, cmDuration::zero());
|
||||||
if (!res || retVal) {
|
if (!res || retVal) {
|
||||||
cmGeneratedFileStream ofs(ifwTmpFile.c_str());
|
cmGeneratedFileStream ofs(ifwTmpFile.c_str());
|
||||||
ofs << "# Run command: " << ifwCmd << std::endl
|
ofs << "# Run command: " << ifwCmd << std::endl
|
||||||
@@ -194,9 +195,9 @@ int cmCPackIFWGenerator::PackageFiles()
|
|||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
|
cmCPackIFWLogger(OUTPUT, "- Generate package" << std::endl);
|
||||||
bool res = cmSystemTools::RunSingleCommand(ifwCmd.c_str(), &output,
|
bool res = cmSystemTools::RunSingleCommand(
|
||||||
&output, &retVal, nullptr,
|
ifwCmd.c_str(), &output, &output, &retVal, nullptr,
|
||||||
this->GeneratorVerbose, 0);
|
this->GeneratorVerbose, cmDuration::zero());
|
||||||
if (!res || retVal) {
|
if (!res || retVal) {
|
||||||
cmGeneratedFileStream ofs(ifwTmpFile.c_str());
|
cmGeneratedFileStream ofs(ifwTmpFile.c_str());
|
||||||
ofs << "# Run command: " << ifwCmd << std::endl
|
ofs << "# Run command: " << ifwCmd << std::endl
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "cmCPackGenerator.h"
|
#include "cmCPackGenerator.h"
|
||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
@@ -242,9 +243,9 @@ bool cmCPackDragNDropGenerator::RunCommand(std::ostringstream& command,
|
|||||||
{
|
{
|
||||||
int exit_code = 1;
|
int exit_code = 1;
|
||||||
|
|
||||||
bool result = cmSystemTools::RunSingleCommand(command.str().c_str(), output,
|
bool result = cmSystemTools::RunSingleCommand(
|
||||||
output, &exit_code, nullptr,
|
command.str().c_str(), output, output, &exit_code, nullptr,
|
||||||
this->GeneratorVerbose, 0);
|
this->GeneratorVerbose, cmDuration::zero());
|
||||||
|
|
||||||
if (!result || exit_code) {
|
if (!result || exit_code) {
|
||||||
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error executing: " << command.str()
|
cmCPackLogger(cmCPackLog::LOG_ERROR, "Error executing: " << command.str()
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "cmCPackComponentGroup.h"
|
#include "cmCPackComponentGroup.h"
|
||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
#include "cmCryptoHash.h"
|
#include "cmCryptoHash.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmFSPermissions.h"
|
#include "cmFSPermissions.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
@@ -277,9 +278,9 @@ int cmCPackGenerator::InstallProjectViaInstallCommands(
|
|||||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ic << std::endl);
|
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ic << std::endl);
|
||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
bool resB =
|
bool resB = cmSystemTools::RunSingleCommand(
|
||||||
cmSystemTools::RunSingleCommand(ic.c_str(), &output, &output, &retVal,
|
ic.c_str(), &output, &output, &retVal, nullptr, this->GeneratorVerbose,
|
||||||
nullptr, this->GeneratorVerbose, 0);
|
cmDuration::zero());
|
||||||
if (!resB || retVal) {
|
if (!resB || retVal) {
|
||||||
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
||||||
tmpFile += "/InstallOutput.log";
|
tmpFile += "/InstallOutput.log";
|
||||||
@@ -601,7 +602,8 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
|||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
bool resB = cmSystemTools::RunSingleCommand(
|
bool resB = cmSystemTools::RunSingleCommand(
|
||||||
buildCommand.c_str(), &output, &output, &retVal,
|
buildCommand.c_str(), &output, &output, &retVal,
|
||||||
installDirectory.c_str(), this->GeneratorVerbose, 0);
|
installDirectory.c_str(), this->GeneratorVerbose,
|
||||||
|
cmDuration::zero());
|
||||||
if (!resB || retVal) {
|
if (!resB || retVal) {
|
||||||
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
||||||
tmpFile += "/PreinstallOutput.log";
|
tmpFile += "/PreinstallOutput.log";
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "cmCPackComponentGroup.h"
|
#include "cmCPackComponentGroup.h"
|
||||||
#include "cmCPackGenerator.h"
|
#include "cmCPackGenerator.h"
|
||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
@@ -301,9 +302,9 @@ int cmCPackNSISGenerator::PackageFiles()
|
|||||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl);
|
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << nsisCmd << std::endl);
|
||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
bool res =
|
bool res = cmSystemTools::RunSingleCommand(
|
||||||
cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal,
|
nsisCmd.c_str(), &output, &output, &retVal, nullptr,
|
||||||
nullptr, this->GeneratorVerbose, 0);
|
this->GeneratorVerbose, cmDuration::zero());
|
||||||
if (!res || retVal) {
|
if (!res || retVal) {
|
||||||
cmGeneratedFileStream ofs(tmpFile.c_str());
|
cmGeneratedFileStream ofs(tmpFile.c_str());
|
||||||
ofs << "# Run command: " << nsisCmd << std::endl
|
ofs << "# Run command: " << nsisCmd << std::endl
|
||||||
@@ -400,9 +401,9 @@ int cmCPackNSISGenerator::InitializeInternal()
|
|||||||
<< std::endl);
|
<< std::endl);
|
||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
bool resS =
|
bool resS = cmSystemTools::RunSingleCommand(
|
||||||
cmSystemTools::RunSingleCommand(nsisCmd.c_str(), &output, &output, &retVal,
|
nsisCmd.c_str(), &output, &output, &retVal, nullptr,
|
||||||
nullptr, this->GeneratorVerbose, 0);
|
this->GeneratorVerbose, cmDuration::zero());
|
||||||
cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
|
cmsys::RegularExpression versionRex("v([0-9]+.[0-9]+)");
|
||||||
cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs");
|
cmsys::RegularExpression versionRexCVS("v(.*)\\.cvs");
|
||||||
if (!resS || retVal ||
|
if (!resS || retVal ||
|
||||||
@@ -737,9 +738,9 @@ std::string cmCPackNSISGenerator::CreateComponentDescription(
|
|||||||
zipListFileName.c_str());
|
zipListFileName.c_str());
|
||||||
std::string output;
|
std::string output;
|
||||||
int retVal = -1;
|
int retVal = -1;
|
||||||
int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output,
|
int res = cmSystemTools::RunSingleCommand(
|
||||||
&retVal, dirName.c_str(),
|
cmd.c_str(), &output, &output, &retVal, dirName.c_str(),
|
||||||
cmSystemTools::OUTPUT_NONE, 0);
|
cmSystemTools::OUTPUT_NONE, cmDuration::zero());
|
||||||
if (!res || retVal) {
|
if (!res || retVal) {
|
||||||
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
std::string tmpFile = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
|
||||||
tmpFile += "/CompressZip.log";
|
tmpFile += "/CompressZip.log";
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "cmCPackGenerator.h"
|
#include "cmCPackGenerator.h"
|
||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cm_sys_stat.h"
|
#include "cm_sys_stat.h"
|
||||||
@@ -154,9 +155,9 @@ int cmCPackOSXX11Generator::PackageFiles()
|
|||||||
int numTries = 10;
|
int numTries = 10;
|
||||||
bool res = false;
|
bool res = false;
|
||||||
while (numTries > 0) {
|
while (numTries > 0) {
|
||||||
res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
|
res = cmSystemTools::RunSingleCommand(
|
||||||
&output, &retVal, nullptr,
|
dmgCmd.str().c_str(), &output, &output, &retVal, nullptr,
|
||||||
this->GeneratorVerbose, 0);
|
this->GeneratorVerbose, cmDuration::zero());
|
||||||
if (res && !retVal) {
|
if (res && !retVal) {
|
||||||
numTries = -1;
|
numTries = -1;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include "cmCPackComponentGroup.h"
|
#include "cmCPackComponentGroup.h"
|
||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
#include "cmXMLWriter.h"
|
#include "cmXMLWriter.h"
|
||||||
@@ -295,9 +296,9 @@ int cmCPackPackageMakerGenerator::PackageFiles()
|
|||||||
int numTries = 10;
|
int numTries = 10;
|
||||||
bool res = false;
|
bool res = false;
|
||||||
while (numTries > 0) {
|
while (numTries > 0) {
|
||||||
res = cmSystemTools::RunSingleCommand(dmgCmd.str().c_str(), &output,
|
res = cmSystemTools::RunSingleCommand(
|
||||||
&output, &retVal, nullptr,
|
dmgCmd.str().c_str(), &output, &output, &retVal, nullptr,
|
||||||
this->GeneratorVerbose, 0);
|
this->GeneratorVerbose, cmDuration::zero());
|
||||||
if (res && !retVal) {
|
if (res && !retVal) {
|
||||||
numTries = -1;
|
numTries = -1;
|
||||||
break;
|
break;
|
||||||
@@ -467,7 +468,8 @@ bool cmCPackPackageMakerGenerator::RunPackageMaker(const char* command,
|
|||||||
std::string output;
|
std::string output;
|
||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
bool res = cmSystemTools::RunSingleCommand(
|
bool res = cmSystemTools::RunSingleCommand(
|
||||||
command, &output, &output, &retVal, nullptr, this->GeneratorVerbose, 0);
|
command, &output, &output, &retVal, nullptr, this->GeneratorVerbose,
|
||||||
|
cmDuration::zero());
|
||||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker"
|
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running package maker"
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
if (!res || retVal) {
|
if (!res || retVal) {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "cmCPackComponentGroup.h"
|
#include "cmCPackComponentGroup.h"
|
||||||
#include "cmCPackLog.h"
|
#include "cmCPackLog.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
@@ -145,9 +146,9 @@ bool cmCPackProductBuildGenerator::RunProductBuild(const std::string& command)
|
|||||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl);
|
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << command << std::endl);
|
||||||
std::string output, error_output;
|
std::string output, error_output;
|
||||||
int retVal = 1;
|
int retVal = 1;
|
||||||
bool res = cmSystemTools::RunSingleCommand(command.c_str(), &output,
|
bool res = cmSystemTools::RunSingleCommand(
|
||||||
&error_output, &retVal, nullptr,
|
command.c_str(), &output, &error_output, &retVal, nullptr,
|
||||||
this->GeneratorVerbose, 0);
|
this->GeneratorVerbose, cmDuration::zero());
|
||||||
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl);
|
cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Done running command" << std::endl);
|
||||||
if (!res || retVal) {
|
if (!res || retVal) {
|
||||||
cmGeneratedFileStream ofs(tmpFile.c_str());
|
cmGeneratedFileStream ofs(tmpFile.c_str());
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
|
|||||||
int retVal = cm.GetGlobalGenerator()->Build(
|
int retVal = cm.GetGlobalGenerator()->Build(
|
||||||
this->SourceDir, this->BinaryDir, this->BuildProject, tar, output,
|
this->SourceDir, this->BinaryDir, this->BuildProject, tar, output,
|
||||||
this->BuildMakeProgram, config, !this->BuildNoClean, false, false,
|
this->BuildMakeProgram, config, !this->BuildNoClean, false, false,
|
||||||
remainingTime.count());
|
remainingTime);
|
||||||
out << output;
|
out << output;
|
||||||
// if the build failed then return
|
// if the build failed then return
|
||||||
if (retVal) {
|
if (retVal) {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "cmCTestTestCommand.h"
|
#include "cmCTestTestCommand.h"
|
||||||
#include "cmCTestUpdateCommand.h"
|
#include "cmCTestUpdateCommand.h"
|
||||||
#include "cmCTestUploadCommand.h"
|
#include "cmCTestUploadCommand.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmFunctionBlocker.h"
|
#include "cmFunctionBlocker.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
@@ -206,7 +207,8 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
|
|||||||
std::vector<char> out;
|
std::vector<char> out;
|
||||||
std::vector<char> err;
|
std::vector<char> err;
|
||||||
std::string line;
|
std::string line;
|
||||||
int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err);
|
int pipe =
|
||||||
|
cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out, err);
|
||||||
while (pipe != cmsysProcess_Pipe_None) {
|
while (pipe != cmsysProcess_Pipe_None) {
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Output: " << line
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Output: " << line
|
||||||
<< "\n");
|
<< "\n");
|
||||||
@@ -215,7 +217,8 @@ int cmCTestScriptHandler::ExecuteScript(const std::string& total_script_arg)
|
|||||||
} else if (pipe == cmsysProcess_Pipe_STDOUT) {
|
} else if (pipe == cmsysProcess_Pipe_STDOUT) {
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, line << "\n");
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, line << "\n");
|
||||||
}
|
}
|
||||||
pipe = cmSystemTools::WaitForLine(cp, line, 100, out, err);
|
pipe = cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out,
|
||||||
|
err);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Properly handle output of the build command
|
// Properly handle output of the build command
|
||||||
@@ -601,7 +604,8 @@ int cmCTestScriptHandler::CheckOutSourceDir()
|
|||||||
"Run cvs: " << this->CVSCheckOut << std::endl);
|
"Run cvs: " << this->CVSCheckOut << std::endl);
|
||||||
res = cmSystemTools::RunSingleCommand(
|
res = cmSystemTools::RunSingleCommand(
|
||||||
this->CVSCheckOut.c_str(), &output, &output, &retVal,
|
this->CVSCheckOut.c_str(), &output, &output, &retVal,
|
||||||
this->CTestRoot.c_str(), this->HandlerVerbose, 0 /*this->TimeOut*/);
|
this->CTestRoot.c_str(), this->HandlerVerbose,
|
||||||
|
cmDuration::zero() /*this->TimeOut*/);
|
||||||
if (!res || retVal != 0) {
|
if (!res || retVal != 0) {
|
||||||
cmSystemTools::Error("Unable to perform cvs checkout:\n",
|
cmSystemTools::Error("Unable to perform cvs checkout:\n",
|
||||||
output.c_str());
|
output.c_str());
|
||||||
@@ -668,7 +672,7 @@ int cmCTestScriptHandler::PerformExtraUpdates()
|
|||||||
"Run Update: " << fullCommand << std::endl);
|
"Run Update: " << fullCommand << std::endl);
|
||||||
res = cmSystemTools::RunSingleCommand(
|
res = cmSystemTools::RunSingleCommand(
|
||||||
fullCommand.c_str(), &output, &output, &retVal, cvsArgs[0].c_str(),
|
fullCommand.c_str(), &output, &output, &retVal, cvsArgs[0].c_str(),
|
||||||
this->HandlerVerbose, 0 /*this->TimeOut*/);
|
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
|
||||||
if (!res || retVal != 0) {
|
if (!res || retVal != 0) {
|
||||||
cmSystemTools::Error("Unable to perform extra updates:\n", eu.c_str(),
|
cmSystemTools::Error("Unable to perform extra updates:\n", eu.c_str(),
|
||||||
"\nWith output:\n", output.c_str());
|
"\nWith output:\n", output.c_str());
|
||||||
@@ -772,7 +776,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
|
|||||||
"Run cmake command: " << command << std::endl);
|
"Run cmake command: " << command << std::endl);
|
||||||
res = cmSystemTools::RunSingleCommand(
|
res = cmSystemTools::RunSingleCommand(
|
||||||
command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(),
|
command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(),
|
||||||
this->HandlerVerbose, 0 /*this->TimeOut*/);
|
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
|
||||||
|
|
||||||
if (!this->CMOutFile.empty()) {
|
if (!this->CMOutFile.empty()) {
|
||||||
std::string cmakeOutputFile = this->CMOutFile;
|
std::string cmakeOutputFile = this->CMOutFile;
|
||||||
@@ -811,7 +815,7 @@ int cmCTestScriptHandler::RunConfigurationDashboard()
|
|||||||
"Run ctest command: " << command << std::endl);
|
"Run ctest command: " << command << std::endl);
|
||||||
res = cmSystemTools::RunSingleCommand(
|
res = cmSystemTools::RunSingleCommand(
|
||||||
command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(),
|
command.c_str(), &output, &output, &retVal, this->BinaryDir.c_str(),
|
||||||
this->HandlerVerbose, 0 /*this->TimeOut*/);
|
this->HandlerVerbose, cmDuration::zero() /*this->TimeOut*/);
|
||||||
|
|
||||||
// did something critical fail in ctest
|
// did something critical fail in ctest
|
||||||
if (!res || cmakeFailed || retVal & cmCTest::BUILD_ERRORS) {
|
if (!res || cmakeFailed || retVal & cmCTest::BUILD_ERRORS) {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "cmComputeTargetDepends.h"
|
#include "cmComputeTargetDepends.h"
|
||||||
#include "cmCustomCommand.h"
|
#include "cmCustomCommand.h"
|
||||||
#include "cmCustomCommandLines.h"
|
#include "cmCustomCommandLines.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmExportBuildFileGenerator.h"
|
#include "cmExportBuildFileGenerator.h"
|
||||||
#include "cmExternalMakefileProjectGenerator.h"
|
#include "cmExternalMakefileProjectGenerator.h"
|
||||||
#include "cmGeneratedFileStream.h"
|
#include "cmGeneratedFileStream.h"
|
||||||
@@ -87,7 +88,7 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm)
|
|||||||
this->InstallTargetEnabled = false;
|
this->InstallTargetEnabled = false;
|
||||||
|
|
||||||
// how long to let try compiles run
|
// how long to let try compiles run
|
||||||
this->TryCompileTimeout = 0;
|
this->TryCompileTimeout = cmDuration::zero();
|
||||||
|
|
||||||
this->ExtraGenerator = nullptr;
|
this->ExtraGenerator = nullptr;
|
||||||
this->CurrentConfigureMakefile = nullptr;
|
this->CurrentConfigureMakefile = nullptr;
|
||||||
@@ -1801,7 +1802,7 @@ int cmGlobalGenerator::Build(const std::string& /*unused*/,
|
|||||||
const std::string& target, std::string& output,
|
const std::string& target, std::string& output,
|
||||||
const std::string& makeCommandCSTR,
|
const std::string& makeCommandCSTR,
|
||||||
const std::string& config, bool clean, bool fast,
|
const std::string& config, bool clean, bool fast,
|
||||||
bool verbose, double timeout,
|
bool verbose, cmDuration timeout,
|
||||||
cmSystemTools::OutputOption outputflag,
|
cmSystemTools::OutputOption outputflag,
|
||||||
std::vector<std::string> const& nativeOptions)
|
std::vector<std::string> const& nativeOptions)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "cmCustomCommandLines.h"
|
#include "cmCustomCommandLines.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmExportSetMap.h"
|
#include "cmExportSetMap.h"
|
||||||
#include "cmStateSnapshot.h"
|
#include "cmStateSnapshot.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
@@ -160,8 +161,8 @@ public:
|
|||||||
const std::string& projectName, const std::string& targetName,
|
const std::string& projectName, const std::string& targetName,
|
||||||
std::string& output, const std::string& makeProgram,
|
std::string& output, const std::string& makeProgram,
|
||||||
const std::string& config, bool clean, bool fast, bool verbose,
|
const std::string& config, bool clean, bool fast, bool verbose,
|
||||||
double timeout, cmSystemTools::OutputOption outputflag =
|
cmDuration timeout, cmSystemTools::OutputOption outputflag =
|
||||||
cmSystemTools::OUTPUT_NONE,
|
cmSystemTools::OUTPUT_NONE,
|
||||||
std::vector<std::string> const& nativeOptions =
|
std::vector<std::string> const& nativeOptions =
|
||||||
std::vector<std::string>());
|
std::vector<std::string>());
|
||||||
|
|
||||||
@@ -233,7 +234,7 @@ public:
|
|||||||
|
|
||||||
void EnableInstallTarget();
|
void EnableInstallTarget();
|
||||||
|
|
||||||
int TryCompileTimeout;
|
cmDuration TryCompileTimeout;
|
||||||
|
|
||||||
bool GetForceUnixPaths() const { return this->ForceUnixPaths; }
|
bool GetForceUnixPaths() const { return this->ForceUnixPaths; }
|
||||||
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
|
bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
#include "cmCustomCommand.h"
|
#include "cmCustomCommand.h"
|
||||||
#include "cmCustomCommandLines.h"
|
#include "cmCustomCommandLines.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmFilePathChecksum.h"
|
#include "cmFilePathChecksum.h"
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
@@ -410,7 +411,7 @@ void cmQtAutoGenInitializer::InitCustomTargets()
|
|||||||
int retVal = 0;
|
int retVal = 0;
|
||||||
bool result = cmSystemTools::RunSingleCommand(
|
bool result = cmSystemTools::RunSingleCommand(
|
||||||
command, &rccStdOut, &rccStdErr, &retVal, nullptr,
|
command, &rccStdOut, &rccStdErr, &retVal, nullptr,
|
||||||
cmSystemTools::OUTPUT_NONE, 0.0, cmProcessOutput::Auto);
|
cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
|
||||||
if (result && retVal == 0 &&
|
if (result && retVal == 0 &&
|
||||||
rccStdOut.find("--list") != std::string::npos) {
|
rccStdOut.find("--list") != std::string::npos) {
|
||||||
this->RccListOptions.push_back("--list");
|
this->RccListOptions.push_back("--list");
|
||||||
@@ -1417,7 +1418,7 @@ bool cmQtAutoGenInitializer::RccListInputs(std::string const& fileName,
|
|||||||
cmd.push_back(fileNameName);
|
cmd.push_back(fileNameName);
|
||||||
result = cmSystemTools::RunSingleCommand(
|
result = cmSystemTools::RunSingleCommand(
|
||||||
cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
|
cmd, &rccStdOut, &rccStdErr, &retVal, fileDir.c_str(),
|
||||||
cmSystemTools::OUTPUT_NONE, 0.0, cmProcessOutput::Auto);
|
cmSystemTools::OUTPUT_NONE, cmDuration::zero(), cmProcessOutput::Auto);
|
||||||
}
|
}
|
||||||
if (!result || retVal) {
|
if (!result || retVal) {
|
||||||
error = "rcc list process failed for:\n ";
|
error = "rcc list process failed for:\n ";
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmProcessOutput.h"
|
#include "cmProcessOutput.h"
|
||||||
#include "cm_sys_stat.h"
|
#include "cm_sys_stat.h"
|
||||||
|
|
||||||
@@ -699,7 +700,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
|
|||||||
std::string* captureStdOut,
|
std::string* captureStdOut,
|
||||||
std::string* captureStdErr, int* retVal,
|
std::string* captureStdErr, int* retVal,
|
||||||
const char* dir, OutputOption outputflag,
|
const char* dir, OutputOption outputflag,
|
||||||
double timeout, Encoding encoding)
|
cmDuration timeout, Encoding encoding)
|
||||||
{
|
{
|
||||||
std::vector<const char*> argv;
|
std::vector<const char*> argv;
|
||||||
argv.reserve(command.size() + 1);
|
argv.reserve(command.size() + 1);
|
||||||
@@ -727,7 +728,7 @@ bool cmSystemTools::RunSingleCommand(std::vector<std::string> const& command,
|
|||||||
}
|
}
|
||||||
assert(!captureStdErr || captureStdErr != captureStdOut);
|
assert(!captureStdErr || captureStdErr != captureStdOut);
|
||||||
|
|
||||||
cmsysProcess_SetTimeout(cp, timeout);
|
cmsysProcess_SetTimeout(cp, timeout.count());
|
||||||
cmsysProcess_Execute(cp);
|
cmsysProcess_Execute(cp);
|
||||||
|
|
||||||
std::vector<char> tempStdOut;
|
std::vector<char> tempStdOut;
|
||||||
@@ -840,7 +841,7 @@ bool cmSystemTools::RunSingleCommand(const char* command,
|
|||||||
std::string* captureStdOut,
|
std::string* captureStdOut,
|
||||||
std::string* captureStdErr, int* retVal,
|
std::string* captureStdErr, int* retVal,
|
||||||
const char* dir, OutputOption outputflag,
|
const char* dir, OutputOption outputflag,
|
||||||
double timeout)
|
cmDuration timeout)
|
||||||
{
|
{
|
||||||
if (s_DisableRunCommandOutput) {
|
if (s_DisableRunCommandOutput) {
|
||||||
outputflag = OUTPUT_NONE;
|
outputflag = OUTPUT_NONE;
|
||||||
@@ -1811,7 +1812,7 @@ bool cmSystemTools::ListTar(const char* outFileName, bool verbose)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
|
int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
|
||||||
double timeout, std::vector<char>& out,
|
cmDuration timeout, std::vector<char>& out,
|
||||||
std::vector<char>& err)
|
std::vector<char>& err)
|
||||||
{
|
{
|
||||||
line.clear();
|
line.clear();
|
||||||
@@ -1859,7 +1860,9 @@ int cmSystemTools::WaitForLine(cmsysProcess* process, std::string& line,
|
|||||||
// No newlines found. Wait for more data from the process.
|
// No newlines found. Wait for more data from the process.
|
||||||
int length;
|
int length;
|
||||||
char* data;
|
char* data;
|
||||||
int pipe = cmsysProcess_WaitForData(process, &data, &length, &timeout);
|
double timeoutAsDbl = timeout.count();
|
||||||
|
int pipe =
|
||||||
|
cmsysProcess_WaitForData(process, &data, &length, &timeoutAsDbl);
|
||||||
if (pipe == cmsysProcess_Pipe_Timeout) {
|
if (pipe == cmsysProcess_Pipe_Timeout) {
|
||||||
// Timeout has been exceeded.
|
// Timeout has been exceeded.
|
||||||
return pipe;
|
return pipe;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "cmConfigure.h" // IWYU pragma: keep
|
#include "cmConfigure.h" // IWYU pragma: keep
|
||||||
|
|
||||||
#include "cmCryptoHash.h"
|
#include "cmCryptoHash.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmProcessOutput.h"
|
#include "cmProcessOutput.h"
|
||||||
#include "cmsys/Process.h"
|
#include "cmsys/Process.h"
|
||||||
#include "cmsys/SystemTools.hxx" // IWYU pragma: export
|
#include "cmsys/SystemTools.hxx" // IWYU pragma: export
|
||||||
@@ -225,7 +226,7 @@ public:
|
|||||||
int* retVal = nullptr,
|
int* retVal = nullptr,
|
||||||
const char* dir = nullptr,
|
const char* dir = nullptr,
|
||||||
OutputOption outputflag = OUTPUT_MERGE,
|
OutputOption outputflag = OUTPUT_MERGE,
|
||||||
double timeout = 0.0);
|
cmDuration timeout = cmDuration::zero());
|
||||||
/**
|
/**
|
||||||
* In this version of RunSingleCommand, command[0] should be
|
* In this version of RunSingleCommand, command[0] should be
|
||||||
* the command to run, and each argument to the command should
|
* the command to run, and each argument to the command should
|
||||||
@@ -237,7 +238,7 @@ public:
|
|||||||
int* retVal = nullptr,
|
int* retVal = nullptr,
|
||||||
const char* dir = nullptr,
|
const char* dir = nullptr,
|
||||||
OutputOption outputflag = OUTPUT_MERGE,
|
OutputOption outputflag = OUTPUT_MERGE,
|
||||||
double timeout = 0.0,
|
cmDuration timeout = cmDuration::zero(),
|
||||||
Encoding encoding = cmProcessOutput::Auto);
|
Encoding encoding = cmProcessOutput::Auto);
|
||||||
|
|
||||||
static std::string PrintSingleCommand(std::vector<std::string> const&);
|
static std::string PrintSingleCommand(std::vector<std::string> const&);
|
||||||
@@ -343,7 +344,7 @@ public:
|
|||||||
|
|
||||||
/** a general output handler for cmsysProcess */
|
/** a general output handler for cmsysProcess */
|
||||||
static int WaitForLine(cmsysProcess* process, std::string& line,
|
static int WaitForLine(cmsysProcess* process, std::string& line,
|
||||||
double timeout, std::vector<char>& out,
|
cmDuration timeout, std::vector<char>& out,
|
||||||
std::vector<char>& err);
|
std::vector<char>& err);
|
||||||
|
|
||||||
/** Split a string on its newlines into multiple lines. Returns
|
/** Split a string on its newlines into multiple lines. Returns
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "cmsys/FStream.hxx"
|
#include "cmsys/FStream.hxx"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
#include "cmState.h"
|
#include "cmState.h"
|
||||||
#include "cmStateTypes.h"
|
#include "cmStateTypes.h"
|
||||||
@@ -185,10 +186,9 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
|
|||||||
if (!runArgs.empty()) {
|
if (!runArgs.empty()) {
|
||||||
finalCommand += runArgs;
|
finalCommand += runArgs;
|
||||||
}
|
}
|
||||||
int timeout = 0;
|
|
||||||
bool worked = cmSystemTools::RunSingleCommand(
|
bool worked = cmSystemTools::RunSingleCommand(
|
||||||
finalCommand.c_str(), out, out, &retVal, nullptr,
|
finalCommand.c_str(), out, out, &retVal, nullptr,
|
||||||
cmSystemTools::OUTPUT_NONE, timeout);
|
cmSystemTools::OUTPUT_NONE, cmDuration::zero());
|
||||||
// set the run var
|
// set the run var
|
||||||
char retChar[16];
|
char retChar[16];
|
||||||
const char* retStr;
|
const char* retStr;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "cmDocumentation.h"
|
#include "cmDocumentation.h"
|
||||||
#include "cmDocumentationEntry.h"
|
#include "cmDocumentationEntry.h"
|
||||||
#include "cmDocumentationFormatter.h"
|
#include "cmDocumentationFormatter.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmExternalMakefileProjectGenerator.h"
|
#include "cmExternalMakefileProjectGenerator.h"
|
||||||
#include "cmFileTimeComparison.h"
|
#include "cmFileTimeComparison.h"
|
||||||
#include "cmGeneratorTarget.h"
|
#include "cmGeneratorTarget.h"
|
||||||
@@ -2475,8 +2476,8 @@ int cmake::Build(const std::string& dir, const std::string& target,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
return gen->Build("", dir, projName, target, output, "", config, clean,
|
return gen->Build("", dir, projName, target, output, "", config, clean,
|
||||||
false, verbose, 0, cmSystemTools::OUTPUT_PASSTHROUGH,
|
false, verbose, cmDuration::zero(),
|
||||||
nativeOptions);
|
cmSystemTools::OUTPUT_PASSTHROUGH, nativeOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmake::Open(const std::string& dir, bool dryRun)
|
bool cmake::Open(const std::string& dir, bool dryRun)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmSystemTools.h"
|
#include "cmSystemTools.h"
|
||||||
|
|
||||||
// This is a wrapper program for xcodebuild
|
// This is a wrapper program for xcodebuild
|
||||||
@@ -27,7 +28,8 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
|
|||||||
std::vector<char> out;
|
std::vector<char> out;
|
||||||
std::vector<char> err;
|
std::vector<char> err;
|
||||||
std::string line;
|
std::string line;
|
||||||
int pipe = cmSystemTools::WaitForLine(cp, line, 100.0, out, err);
|
int pipe =
|
||||||
|
cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out, err);
|
||||||
while (pipe != cmsysProcess_Pipe_None) {
|
while (pipe != cmsysProcess_Pipe_None) {
|
||||||
if (line.find("/bin/sh: bad interpreter: Text file busy") !=
|
if (line.find("/bin/sh: bad interpreter: Text file busy") !=
|
||||||
std::string::npos) {
|
std::string::npos) {
|
||||||
@@ -45,7 +47,8 @@ int RunXCode(std::vector<const char*>& argv, bool& hitbug)
|
|||||||
std::cout << line << "\n";
|
std::cout << line << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pipe = cmSystemTools::WaitForLine(cp, line, 100, out, err);
|
pipe = cmSystemTools::WaitForLine(cp, line, std::chrono::seconds(100), out,
|
||||||
|
err);
|
||||||
}
|
}
|
||||||
cmsysProcess_WaitForExit(cp, nullptr);
|
cmsysProcess_WaitForExit(cp, nullptr);
|
||||||
if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) {
|
if (cmsysProcess_GetState(cp) == cmsysProcess_State_Exited) {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include "cmcmd.h"
|
#include "cmcmd.h"
|
||||||
|
|
||||||
#include "cmAlgorithms.h"
|
#include "cmAlgorithms.h"
|
||||||
|
#include "cmDuration.h"
|
||||||
#include "cmGlobalGenerator.h"
|
#include "cmGlobalGenerator.h"
|
||||||
#include "cmLocalGenerator.h"
|
#include "cmLocalGenerator.h"
|
||||||
#include "cmMakefile.h"
|
#include "cmMakefile.h"
|
||||||
@@ -797,10 +798,9 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
|
|||||||
std::string command =
|
std::string command =
|
||||||
cmWrap('"', cmMakeRange(args).advance(3), '"', " ");
|
cmWrap('"', cmMakeRange(args).advance(3), '"', " ");
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
int timeout = 0;
|
|
||||||
if (cmSystemTools::RunSingleCommand(
|
if (cmSystemTools::RunSingleCommand(
|
||||||
command.c_str(), nullptr, nullptr, &retval, directory.c_str(),
|
command.c_str(), nullptr, nullptr, &retval, directory.c_str(),
|
||||||
cmSystemTools::OUTPUT_PASSTHROUGH, timeout)) {
|
cmSystemTools::OUTPUT_PASSTHROUGH, cmDuration::zero())) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user