BUG: Include less content as input to "rule hash" computation.
- The rule hash should use only commands specified by the user. - No make output (echo and progress) rules should be included. - No outputs or dependencies need be included. The native build tool will take care of them.
This commit is contained in:
parent
4d5116c8a2
commit
e79b73d61f
@ -1943,8 +1943,8 @@ cmGlobalGenerator::GetDirectoryContent(std::string const& dir, bool needDisk)
|
|||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
|
cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
|
||||||
const std::vector<std::string>& depends,
|
std::vector<std::string>::const_iterator first,
|
||||||
const std::vector<std::string>& commands)
|
std::vector<std::string>::const_iterator last)
|
||||||
{
|
{
|
||||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||||
// Ignore if there are no outputs.
|
// Ignore if there are no outputs.
|
||||||
@ -1960,22 +1960,7 @@ cmGlobalGenerator::AddRuleHash(const std::vector<std::string>& outputs,
|
|||||||
int length;
|
int length;
|
||||||
cmsysMD5* sum = cmsysMD5_New();
|
cmsysMD5* sum = cmsysMD5_New();
|
||||||
cmsysMD5_Initialize(sum);
|
cmsysMD5_Initialize(sum);
|
||||||
for(std::vector<std::string>::const_iterator i = outputs.begin();
|
for(std::vector<std::string>::const_iterator i = first; i != last; ++i)
|
||||||
i != outputs.end(); ++i)
|
|
||||||
{
|
|
||||||
data = reinterpret_cast<unsigned char const*>(i->c_str());
|
|
||||||
length = static_cast<int>(i->length());
|
|
||||||
cmsysMD5_Append(sum, data, length);
|
|
||||||
}
|
|
||||||
for(std::vector<std::string>::const_iterator i = depends.begin();
|
|
||||||
i != depends.end(); ++i)
|
|
||||||
{
|
|
||||||
data = reinterpret_cast<unsigned char const*>(i->c_str());
|
|
||||||
length = static_cast<int>(i->length());
|
|
||||||
cmsysMD5_Append(sum, data, length);
|
|
||||||
}
|
|
||||||
for(std::vector<std::string>::const_iterator i = commands.begin();
|
|
||||||
i != commands.end(); ++i)
|
|
||||||
{
|
{
|
||||||
data = reinterpret_cast<unsigned char const*>(i->c_str());
|
data = reinterpret_cast<unsigned char const*>(i->c_str());
|
||||||
length = static_cast<int>(i->length());
|
length = static_cast<int>(i->length());
|
||||||
|
@ -246,8 +246,8 @@ public:
|
|||||||
void GetFilesReplacedDuringGenerate(std::vector<std::string>& filenames);
|
void GetFilesReplacedDuringGenerate(std::vector<std::string>& filenames);
|
||||||
|
|
||||||
void AddRuleHash(const std::vector<std::string>& outputs,
|
void AddRuleHash(const std::vector<std::string>& outputs,
|
||||||
const std::vector<std::string>& depends,
|
std::vector<std::string>::const_iterator first,
|
||||||
const std::vector<std::string>& commands);
|
std::vector<std::string>::const_iterator last);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// for a project collect all its targets by following depend
|
// for a project collect all its targets by following depend
|
||||||
|
@ -1116,6 +1116,10 @@ void cmMakefileTargetGenerator
|
|||||||
->AppendEcho(commands, comment.c_str(),
|
->AppendEcho(commands, comment.c_str(),
|
||||||
cmLocalUnixMakefileGenerator3::EchoGenerate);
|
cmLocalUnixMakefileGenerator3::EchoGenerate);
|
||||||
}
|
}
|
||||||
|
// Below we need to skip over the echo and progress commands.
|
||||||
|
unsigned int skip = static_cast<unsigned int>(commands.size());
|
||||||
|
|
||||||
|
// Now append the actual user-specified commands.
|
||||||
this->LocalGenerator->AppendCustomCommand(commands, cc);
|
this->LocalGenerator->AppendCustomCommand(commands, cc);
|
||||||
|
|
||||||
// Collect the dependencies.
|
// Collect the dependencies.
|
||||||
@ -1144,7 +1148,9 @@ void cmMakefileTargetGenerator
|
|||||||
// If the rule has changed make sure the output is rebuilt.
|
// If the rule has changed make sure the output is rebuilt.
|
||||||
if(!symbolic)
|
if(!symbolic)
|
||||||
{
|
{
|
||||||
this->GlobalGenerator->AddRuleHash(cc.GetOutputs(), depends, commands);
|
this->GlobalGenerator->AddRuleHash(cc.GetOutputs(),
|
||||||
|
commands.begin()+skip,
|
||||||
|
commands.end());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user