mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 16:32:14 -06:00
Autogen: Rename cmQtAutoGen::GeneratorT enum to cmQtAutoGen::GenT
This commit is contained in:
@@ -83,31 +83,31 @@ std::string const cmQtAutoGen::GenNameMocUpper = "AUTOMOC";
|
||||
std::string const cmQtAutoGen::GenNameUicUpper = "AUTOUIC";
|
||||
std::string const cmQtAutoGen::GenNameRccUpper = "AUTORCC";
|
||||
|
||||
std::string const& cmQtAutoGen::GeneratorName(GeneratorT genType)
|
||||
std::string const& cmQtAutoGen::GeneratorName(GenT genType)
|
||||
{
|
||||
switch (genType) {
|
||||
case GeneratorT::GEN:
|
||||
case GenT::GEN:
|
||||
return GenNameGen;
|
||||
case GeneratorT::MOC:
|
||||
case GenT::MOC:
|
||||
return GenNameMoc;
|
||||
case GeneratorT::UIC:
|
||||
case GenT::UIC:
|
||||
return GenNameUic;
|
||||
case GeneratorT::RCC:
|
||||
case GenT::RCC:
|
||||
return GenNameRcc;
|
||||
}
|
||||
return GenNameGen;
|
||||
}
|
||||
|
||||
std::string const& cmQtAutoGen::GeneratorNameUpper(GeneratorT genType)
|
||||
std::string const& cmQtAutoGen::GeneratorNameUpper(GenT genType)
|
||||
{
|
||||
switch (genType) {
|
||||
case GeneratorT::GEN:
|
||||
case GenT::GEN:
|
||||
return GenNameGenUpper;
|
||||
case GeneratorT::MOC:
|
||||
case GenT::MOC:
|
||||
return GenNameMocUpper;
|
||||
case GeneratorT::UIC:
|
||||
case GenT::UIC:
|
||||
return GenNameUicUpper;
|
||||
case GeneratorT::RCC:
|
||||
case GenT::RCC:
|
||||
return GenNameRccUpper;
|
||||
}
|
||||
return GenNameGenUpper;
|
||||
|
||||
@@ -14,18 +14,6 @@
|
||||
class cmQtAutoGen
|
||||
{
|
||||
public:
|
||||
/// @brief Maximum number of parallel threads/processes in a generator
|
||||
static unsigned int const ParallelMax;
|
||||
|
||||
/// @brief AutoGen generator type
|
||||
enum class GeneratorT
|
||||
{
|
||||
GEN, // AUTOGEN
|
||||
MOC,
|
||||
UIC,
|
||||
RCC
|
||||
};
|
||||
|
||||
/// @brief Integer version
|
||||
struct IntegerVersion
|
||||
{
|
||||
@@ -52,6 +40,15 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/// @brief AutoGen generator type
|
||||
enum class GenT
|
||||
{
|
||||
GEN, // AUTOGEN
|
||||
MOC, // AUTOMOC
|
||||
UIC, // AUTOUIC
|
||||
RCC // AUTORCC
|
||||
};
|
||||
|
||||
/// @brief Nested lists separator
|
||||
static std::string const ListSep;
|
||||
// Generator names
|
||||
@@ -63,12 +60,14 @@ public:
|
||||
static std::string const GenNameMocUpper;
|
||||
static std::string const GenNameUicUpper;
|
||||
static std::string const GenNameRccUpper;
|
||||
/// @brief Maximum number of parallel threads/processes in a generator
|
||||
static unsigned int const ParallelMax;
|
||||
|
||||
public:
|
||||
/// @brief Returns the generator name
|
||||
static std::string const& GeneratorName(GeneratorT genType);
|
||||
static std::string const& GeneratorName(GenT genType);
|
||||
/// @brief Returns the generator name in upper case
|
||||
static std::string const& GeneratorNameUpper(GeneratorT genType);
|
||||
static std::string const& GeneratorNameUpper(GenT genType);
|
||||
|
||||
/// @brief Returns a string with the requested tool names
|
||||
static std::string Tools(bool moc, bool uic, bool rcc);
|
||||
|
||||
@@ -70,7 +70,7 @@ static std::size_t GetParallelCPUCount()
|
||||
}
|
||||
|
||||
static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName,
|
||||
cmQtAutoGen::GeneratorT genType)
|
||||
cmQtAutoGen::GenT genType)
|
||||
{
|
||||
cmSourceGroup* sourceGroup = nullptr;
|
||||
// Acquire source group
|
||||
@@ -81,10 +81,10 @@ static bool AddToSourceGroup(cmMakefile* makefile, std::string const& fileName,
|
||||
std::array<std::string, 2> props;
|
||||
// Use generator specific group name
|
||||
switch (genType) {
|
||||
case cmQtAutoGen::GeneratorT::MOC:
|
||||
case cmQtAutoGen::GenT::MOC:
|
||||
props[0] = "AUTOMOC_SOURCE_GROUP";
|
||||
break;
|
||||
case cmQtAutoGen::GeneratorT::RCC:
|
||||
case cmQtAutoGen::GenT::RCC:
|
||||
props[0] = "AUTORCC_SOURCE_GROUP";
|
||||
break;
|
||||
default:
|
||||
@@ -961,7 +961,7 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
|
||||
// Files provided by the autogen target
|
||||
std::vector<std::string> autogenProvides;
|
||||
if (this->Moc.Enabled) {
|
||||
this->AddGeneratedSource(this->Moc.MocsCompilation, GeneratorT::MOC, true);
|
||||
this->AddGeneratedSource(this->Moc.MocsCompilation, GenT::MOC, true);
|
||||
autogenProvides.push_back(this->Moc.MocsCompilation);
|
||||
}
|
||||
|
||||
@@ -1115,7 +1115,7 @@ bool cmQtAutoGenInitializer::InitRccTargets()
|
||||
// Register info file as generated by CMake
|
||||
makefile->AddCMakeOutputFile(qrc.InfoFile);
|
||||
// Register file at target
|
||||
this->AddGeneratedSource(qrc.RccFile, GeneratorT::RCC);
|
||||
this->AddGeneratedSource(qrc.RccFile, GenT::RCC);
|
||||
|
||||
std::vector<std::string> ccOutput;
|
||||
ccOutput.push_back(qrc.RccFile);
|
||||
@@ -1354,8 +1354,7 @@ bool cmQtAutoGenInitializer::SetupWriteRccInfo()
|
||||
}
|
||||
|
||||
void cmQtAutoGenInitializer::AddGeneratedSource(std::string const& filename,
|
||||
GeneratorT genType,
|
||||
bool prepend)
|
||||
GenT genType, bool prepend)
|
||||
{
|
||||
// Register source file in makefile
|
||||
cmMakefile* makefile = this->Target->Target->GetMakefile();
|
||||
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
bool SetupWriteAutogenInfo();
|
||||
bool SetupWriteRccInfo();
|
||||
|
||||
void AddGeneratedSource(std::string const& filename, GeneratorT genType,
|
||||
void AddGeneratedSource(std::string const& filename, GenT genType,
|
||||
bool prepend = false);
|
||||
|
||||
bool GetMocExecutable();
|
||||
|
||||
@@ -43,8 +43,7 @@ std::string cmQtAutoGenerator::Logger::HeadLine(std::string const& title)
|
||||
return head;
|
||||
}
|
||||
|
||||
void cmQtAutoGenerator::Logger::Info(GeneratorT genType,
|
||||
std::string const& message)
|
||||
void cmQtAutoGenerator::Logger::Info(GenT genType, std::string const& message)
|
||||
{
|
||||
std::string msg = GeneratorName(genType);
|
||||
msg += ": ";
|
||||
@@ -58,7 +57,7 @@ void cmQtAutoGenerator::Logger::Info(GeneratorT genType,
|
||||
}
|
||||
}
|
||||
|
||||
void cmQtAutoGenerator::Logger::Warning(GeneratorT genType,
|
||||
void cmQtAutoGenerator::Logger::Warning(GenT genType,
|
||||
std::string const& message)
|
||||
{
|
||||
std::string msg;
|
||||
@@ -82,7 +81,7 @@ void cmQtAutoGenerator::Logger::Warning(GeneratorT genType,
|
||||
}
|
||||
}
|
||||
|
||||
void cmQtAutoGenerator::Logger::WarningFile(GeneratorT genType,
|
||||
void cmQtAutoGenerator::Logger::WarningFile(GenT genType,
|
||||
std::string const& filename,
|
||||
std::string const& message)
|
||||
{
|
||||
@@ -94,8 +93,7 @@ void cmQtAutoGenerator::Logger::WarningFile(GeneratorT genType,
|
||||
Warning(genType, msg);
|
||||
}
|
||||
|
||||
void cmQtAutoGenerator::Logger::Error(GeneratorT genType,
|
||||
std::string const& message)
|
||||
void cmQtAutoGenerator::Logger::Error(GenT genType, std::string const& message)
|
||||
{
|
||||
std::string msg;
|
||||
msg += HeadLine(GeneratorName(genType) + " error");
|
||||
@@ -111,7 +109,7 @@ void cmQtAutoGenerator::Logger::Error(GeneratorT genType,
|
||||
}
|
||||
}
|
||||
|
||||
void cmQtAutoGenerator::Logger::ErrorFile(GeneratorT genType,
|
||||
void cmQtAutoGenerator::Logger::ErrorFile(GenT genType,
|
||||
std::string const& filename,
|
||||
std::string const& message)
|
||||
{
|
||||
@@ -124,7 +122,7 @@ void cmQtAutoGenerator::Logger::ErrorFile(GeneratorT genType,
|
||||
}
|
||||
|
||||
void cmQtAutoGenerator::Logger::ErrorCommand(
|
||||
GeneratorT genType, std::string const& message,
|
||||
GenT genType, std::string const& message,
|
||||
std::vector<std::string> const& command, std::string const& output)
|
||||
{
|
||||
std::string msg;
|
||||
@@ -297,7 +295,7 @@ bool cmQtAutoGenerator::FileSystem::FileRead(std::string& content,
|
||||
return success;
|
||||
}
|
||||
|
||||
bool cmQtAutoGenerator::FileSystem::FileRead(GeneratorT genType,
|
||||
bool cmQtAutoGenerator::FileSystem::FileRead(GenT genType,
|
||||
std::string& content,
|
||||
std::string const& filename)
|
||||
{
|
||||
@@ -343,7 +341,7 @@ bool cmQtAutoGenerator::FileSystem::FileWrite(std::string const& filename,
|
||||
return success;
|
||||
}
|
||||
|
||||
bool cmQtAutoGenerator::FileSystem::FileWrite(GeneratorT genType,
|
||||
bool cmQtAutoGenerator::FileSystem::FileWrite(GenT genType,
|
||||
std::string const& filename,
|
||||
std::string const& content)
|
||||
{
|
||||
@@ -387,7 +385,7 @@ bool cmQtAutoGenerator::FileSystem::MakeDirectory(std::string const& dirname)
|
||||
return cmSystemTools::MakeDirectory(dirname);
|
||||
}
|
||||
|
||||
bool cmQtAutoGenerator::FileSystem::MakeDirectory(GeneratorT genType,
|
||||
bool cmQtAutoGenerator::FileSystem::MakeDirectory(GenT genType,
|
||||
std::string const& dirname)
|
||||
{
|
||||
if (!MakeDirectory(dirname)) {
|
||||
@@ -409,7 +407,7 @@ bool cmQtAutoGenerator::FileSystem::MakeParentDirectory(
|
||||
}
|
||||
|
||||
bool cmQtAutoGenerator::FileSystem::MakeParentDirectory(
|
||||
GeneratorT genType, std::string const& filename)
|
||||
GenT genType, std::string const& filename)
|
||||
{
|
||||
if (!MakeParentDirectory(filename)) {
|
||||
Log()->ErrorFile(genType, filename, "Could not create parent directory");
|
||||
|
||||
@@ -40,16 +40,16 @@ public:
|
||||
bool ColorOutput() const { return this->ColorOutput_; }
|
||||
void SetColorOutput(bool value);
|
||||
// -- Log info
|
||||
void Info(GeneratorT genType, std::string const& message);
|
||||
void Info(GenT genType, std::string const& message);
|
||||
// -- Log warning
|
||||
void Warning(GeneratorT genType, std::string const& message);
|
||||
void WarningFile(GeneratorT genType, std::string const& filename,
|
||||
void Warning(GenT genType, std::string const& message);
|
||||
void WarningFile(GenT genType, std::string const& filename,
|
||||
std::string const& message);
|
||||
// -- Log error
|
||||
void Error(GeneratorT genType, std::string const& message);
|
||||
void ErrorFile(GeneratorT genType, std::string const& filename,
|
||||
void Error(GenT genType, std::string const& message);
|
||||
void ErrorFile(GenT genType, std::string const& filename,
|
||||
std::string const& message);
|
||||
void ErrorCommand(GeneratorT genType, std::string const& message,
|
||||
void ErrorCommand(GenT genType, std::string const& message,
|
||||
std::vector<std::string> const& command,
|
||||
std::string const& output);
|
||||
|
||||
@@ -114,13 +114,13 @@ public:
|
||||
bool FileRead(std::string& content, std::string const& filename,
|
||||
std::string* error = nullptr);
|
||||
/// @brief Error logging version
|
||||
bool FileRead(GeneratorT genType, std::string& content,
|
||||
bool FileRead(GenT genType, std::string& content,
|
||||
std::string const& filename);
|
||||
|
||||
bool FileWrite(std::string const& filename, std::string const& content,
|
||||
std::string* error = nullptr);
|
||||
/// @brief Error logging version
|
||||
bool FileWrite(GeneratorT genType, std::string const& filename,
|
||||
bool FileWrite(GenT genType, std::string const& filename,
|
||||
std::string const& content);
|
||||
|
||||
bool FileDiffers(std::string const& filename, std::string const& content);
|
||||
@@ -131,11 +131,11 @@ public:
|
||||
// -- Directory access
|
||||
bool MakeDirectory(std::string const& dirname);
|
||||
/// @brief Error logging version
|
||||
bool MakeDirectory(GeneratorT genType, std::string const& dirname);
|
||||
bool MakeDirectory(GenT genType, std::string const& dirname);
|
||||
|
||||
bool MakeParentDirectory(std::string const& filename);
|
||||
/// @brief Error logging version
|
||||
bool MakeParentDirectory(GeneratorT genType, std::string const& filename);
|
||||
bool MakeParentDirectory(GenT genType, std::string const& filename);
|
||||
|
||||
private:
|
||||
std::mutex Mutex_;
|
||||
|
||||
@@ -184,11 +184,10 @@ void cmQtAutoGeneratorMocUic::JobParseT::Process(WorkerT& wrk)
|
||||
ParseUic(wrk, meta);
|
||||
}
|
||||
} else {
|
||||
wrk.LogFileWarning(GeneratorT::GEN, FileName,
|
||||
"The source file is empty");
|
||||
wrk.LogFileWarning(GenT::GEN, FileName, "The source file is empty");
|
||||
}
|
||||
} else {
|
||||
wrk.LogFileError(GeneratorT::GEN, FileName,
|
||||
wrk.LogFileError(GenT::GEN, FileName,
|
||||
"Could not read the file: " + error);
|
||||
}
|
||||
}
|
||||
@@ -275,7 +274,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
|
||||
emsg += ", but the header ";
|
||||
emsg += Quoted(MocStringHeaders(wrk, mocInc.Base));
|
||||
emsg += " could not be found.";
|
||||
wrk.LogFileError(GeneratorT::MOC, FileName, emsg);
|
||||
wrk.LogFileError(GenT::MOC, FileName, emsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -314,7 +313,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
|
||||
emsg += Quoted("moc_" + mocInc.Base + ".cpp");
|
||||
emsg += " for a compatibility with strict mode.\n"
|
||||
"(CMAKE_AUTOMOC_RELAXED_MODE warning)\n";
|
||||
wrk.LogFileWarning(GeneratorT::MOC, FileName, emsg);
|
||||
wrk.LogFileWarning(GenT::MOC, FileName, emsg);
|
||||
} else {
|
||||
std::string emsg = "The file includes the moc file ";
|
||||
emsg += Quoted(mocInc.Inc);
|
||||
@@ -326,7 +325,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
|
||||
emsg += Quoted("moc_" + mocInc.Base + ".cpp");
|
||||
emsg += " for compatibility with strict mode.\n"
|
||||
"(CMAKE_AUTOMOC_RELAXED_MODE warning)\n";
|
||||
wrk.LogFileWarning(GeneratorT::MOC, FileName, emsg);
|
||||
wrk.LogFileWarning(GenT::MOC, FileName, emsg);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -338,7 +337,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
|
||||
"matching header ";
|
||||
emsg += Quoted(MocStringHeaders(wrk, mocInc.Base));
|
||||
emsg += " could not be found.";
|
||||
wrk.LogFileError(GeneratorT::MOC, FileName, emsg);
|
||||
wrk.LogFileError(GenT::MOC, FileName, emsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -356,7 +355,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
|
||||
emsg += ", but does not contain a ";
|
||||
emsg += wrk.Moc().MacrosString();
|
||||
emsg += " macro.";
|
||||
wrk.LogFileWarning(GeneratorT::MOC, FileName, emsg);
|
||||
wrk.LogFileWarning(GenT::MOC, FileName, emsg);
|
||||
}
|
||||
} else {
|
||||
// Don't allow <BASE>.moc include other than self in strict mode
|
||||
@@ -367,7 +366,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
|
||||
"source file.\nThis is not supported. Include ";
|
||||
emsg += Quoted(meta.FileBase + ".moc");
|
||||
emsg += " to run moc on this source file.";
|
||||
wrk.LogFileError(GeneratorT::MOC, FileName, emsg);
|
||||
wrk.LogFileError(GenT::MOC, FileName, emsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -410,7 +409,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
|
||||
emsg += Quoted(meta.FileBase + ".moc");
|
||||
emsg += " for compatibility with strict mode.\n"
|
||||
"(CMAKE_AUTOMOC_RELAXED_MODE warning)";
|
||||
wrk.LogFileWarning(GeneratorT::MOC, FileName, emsg);
|
||||
wrk.LogFileWarning(GenT::MOC, FileName, emsg);
|
||||
}
|
||||
// Add own source job
|
||||
jobs.emplace_back(
|
||||
@@ -425,7 +424,7 @@ bool cmQtAutoGeneratorMocUic::JobParseT::ParseMocSource(WorkerT& wrk,
|
||||
emsg += "!\nConsider to\n - add #include \"";
|
||||
emsg += meta.FileBase;
|
||||
emsg += ".moc\"\n - enable SKIP_AUTOMOC for this file";
|
||||
wrk.LogFileError(GeneratorT::MOC, FileName, emsg);
|
||||
wrk.LogFileError(GenT::MOC, FileName, emsg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -586,7 +585,7 @@ std::string cmQtAutoGeneratorMocUic::JobParseT::UicFindIncludedFile(
|
||||
emsg += Quoted(testFile);
|
||||
emsg += "\n";
|
||||
}
|
||||
wrk.LogFileError(GeneratorT::UIC, FileName, emsg);
|
||||
wrk.LogFileError(GenT::UIC, FileName, emsg);
|
||||
}
|
||||
|
||||
return res;
|
||||
@@ -602,7 +601,7 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
|
||||
std::string reason = "Generating ";
|
||||
reason += Quoted(wrk.Moc().PredefsFileRel);
|
||||
reason += " because it doesn't exist";
|
||||
wrk.LogInfo(GeneratorT::MOC, reason);
|
||||
wrk.LogInfo(GenT::MOC, reason);
|
||||
}
|
||||
generate = true;
|
||||
} else if (wrk.Moc().SettingsChanged) {
|
||||
@@ -610,7 +609,7 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
|
||||
std::string reason = "Generating ";
|
||||
reason += Quoted(wrk.Moc().PredefsFileRel);
|
||||
reason += " because the settings changed.";
|
||||
wrk.LogInfo(GeneratorT::MOC, reason);
|
||||
wrk.LogInfo(GenT::MOC, reason);
|
||||
}
|
||||
generate = true;
|
||||
}
|
||||
@@ -627,12 +626,12 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
|
||||
cmd.push_back("-D" + def);
|
||||
}
|
||||
// Execute command
|
||||
if (!wrk.RunProcess(GeneratorT::MOC, result, cmd)) {
|
||||
if (!wrk.RunProcess(GenT::MOC, result, cmd)) {
|
||||
std::string emsg = "The content generation command for ";
|
||||
emsg += Quoted(wrk.Moc().PredefsFileRel);
|
||||
emsg += " failed.\n";
|
||||
emsg += result.ErrorMessage;
|
||||
wrk.LogCommandError(GeneratorT::MOC, emsg, cmd, result.StdOut);
|
||||
wrk.LogCommandError(GenT::MOC, emsg, cmd, result.StdOut);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -640,14 +639,14 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
|
||||
if (!result.error()) {
|
||||
if (!fileExists ||
|
||||
wrk.FileSys().FileDiffers(wrk.Moc().PredefsFileAbs, result.StdOut)) {
|
||||
if (wrk.FileSys().FileWrite(GeneratorT::MOC, wrk.Moc().PredefsFileAbs,
|
||||
if (wrk.FileSys().FileWrite(GenT::MOC, wrk.Moc().PredefsFileAbs,
|
||||
result.StdOut)) {
|
||||
// Success
|
||||
} else {
|
||||
std::string emsg = "Writing ";
|
||||
emsg += Quoted(wrk.Moc().PredefsFileRel);
|
||||
emsg += " failed.";
|
||||
wrk.LogFileError(GeneratorT::MOC, wrk.Moc().PredefsFileAbs, emsg);
|
||||
wrk.LogFileError(GenT::MOC, wrk.Moc().PredefsFileAbs, emsg);
|
||||
}
|
||||
} else {
|
||||
// Touch to update the time stamp
|
||||
@@ -655,7 +654,7 @@ void cmQtAutoGeneratorMocUic::JobMocPredefsT::Process(WorkerT& wrk)
|
||||
std::string msg = "Touching ";
|
||||
msg += Quoted(wrk.Moc().PredefsFileRel);
|
||||
msg += ".";
|
||||
wrk.LogInfo(GeneratorT::MOC, msg);
|
||||
wrk.LogInfo(GenT::MOC, msg);
|
||||
}
|
||||
wrk.FileSys().Touch(wrk.Moc().PredefsFileAbs);
|
||||
}
|
||||
@@ -713,7 +712,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
reason += " from its source file ";
|
||||
reason += Quoted(SourceFile);
|
||||
reason += " because it doesn't exist";
|
||||
wrk.LogInfo(GeneratorT::MOC, reason);
|
||||
wrk.LogInfo(GenT::MOC, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -726,7 +725,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
reason += " from ";
|
||||
reason += Quoted(SourceFile);
|
||||
reason += " because the MOC settings changed";
|
||||
wrk.LogInfo(GeneratorT::MOC, reason);
|
||||
wrk.LogInfo(GenT::MOC, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -739,7 +738,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
isOlder = wrk.FileSys().FileIsOlderThan(
|
||||
BuildFile, wrk.Moc().PredefsFileAbs, &error);
|
||||
if (!isOlder && !error.empty()) {
|
||||
wrk.LogError(GeneratorT::MOC, error);
|
||||
wrk.LogError(GenT::MOC, error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -749,7 +748,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
reason += Quoted(BuildFile);
|
||||
reason += " because it's older than: ";
|
||||
reason += Quoted(wrk.Moc().PredefsFileAbs);
|
||||
wrk.LogInfo(GeneratorT::MOC, reason);
|
||||
wrk.LogInfo(GenT::MOC, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -762,7 +761,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
std::string error;
|
||||
isOlder = wrk.FileSys().FileIsOlderThan(BuildFile, SourceFile, &error);
|
||||
if (!isOlder && !error.empty()) {
|
||||
wrk.LogError(GeneratorT::MOC, error);
|
||||
wrk.LogError(GenT::MOC, error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -772,7 +771,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
reason += Quoted(BuildFile);
|
||||
reason += " because it's older than its source file ";
|
||||
reason += Quoted(SourceFile);
|
||||
wrk.LogInfo(GeneratorT::MOC, reason);
|
||||
wrk.LogInfo(GenT::MOC, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -794,7 +793,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
emsg += Quoted(IncluderFile);
|
||||
emsg += ".\n";
|
||||
emsg += error;
|
||||
wrk.LogError(GeneratorT::MOC, emsg);
|
||||
wrk.LogError(GenT::MOC, emsg);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -815,18 +814,18 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
reason += Quoted(SourceFile);
|
||||
reason += " because it is older than it's dependency file ";
|
||||
reason += Quoted(depFileAbs);
|
||||
wrk.LogInfo(GeneratorT::MOC, reason);
|
||||
wrk.LogInfo(GenT::MOC, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!error.empty()) {
|
||||
wrk.LogError(GeneratorT::MOC, error);
|
||||
wrk.LogError(GenT::MOC, error);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
std::string message = "Could not find dependency file ";
|
||||
message += Quoted(depFileRel);
|
||||
wrk.LogFileWarning(GeneratorT::MOC, SourceFile, message);
|
||||
wrk.LogFileWarning(GenT::MOC, SourceFile, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -837,7 +836,7 @@ bool cmQtAutoGeneratorMocUic::JobMocT::UpdateRequired(WorkerT& wrk)
|
||||
void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk)
|
||||
{
|
||||
// Make sure the parent directory exists
|
||||
if (wrk.FileSys().MakeParentDirectory(GeneratorT::MOC, BuildFile)) {
|
||||
if (wrk.FileSys().MakeParentDirectory(GenT::MOC, BuildFile)) {
|
||||
// Compose moc command
|
||||
std::vector<std::string> cmd;
|
||||
cmd.push_back(wrk.Moc().Executable);
|
||||
@@ -855,11 +854,11 @@ void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk)
|
||||
|
||||
// Execute moc command
|
||||
ProcessResultT result;
|
||||
if (wrk.RunProcess(GeneratorT::MOC, result, cmd)) {
|
||||
if (wrk.RunProcess(GenT::MOC, result, cmd)) {
|
||||
// Moc command success
|
||||
// Print moc output
|
||||
if (!result.StdOut.empty()) {
|
||||
wrk.LogInfo(GeneratorT::MOC, result.StdOut);
|
||||
wrk.LogInfo(GenT::MOC, result.StdOut);
|
||||
}
|
||||
// Notify the generator that a not included file changed (on demand)
|
||||
if (IncludeString.empty()) {
|
||||
@@ -874,7 +873,7 @@ void cmQtAutoGeneratorMocUic::JobMocT::GenerateMoc(WorkerT& wrk)
|
||||
emsg += Quoted(BuildFile);
|
||||
emsg += ".\n";
|
||||
emsg += result.ErrorMessage;
|
||||
wrk.LogCommandError(GeneratorT::MOC, emsg, cmd, result.StdOut);
|
||||
wrk.LogCommandError(GenT::MOC, emsg, cmd, result.StdOut);
|
||||
}
|
||||
wrk.FileSys().FileRemove(BuildFile);
|
||||
}
|
||||
@@ -905,7 +904,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
|
||||
reason += " from its source file ";
|
||||
reason += Quoted(SourceFile);
|
||||
reason += " because it doesn't exist";
|
||||
wrk.LogInfo(GeneratorT::UIC, reason);
|
||||
wrk.LogInfo(GenT::UIC, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -918,7 +917,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
|
||||
reason += " from ";
|
||||
reason += Quoted(SourceFile);
|
||||
reason += " because the UIC settings changed";
|
||||
wrk.LogInfo(GeneratorT::UIC, reason);
|
||||
wrk.LogInfo(GenT::UIC, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -930,7 +929,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
|
||||
std::string error;
|
||||
isOlder = wrk.FileSys().FileIsOlderThan(BuildFile, SourceFile, &error);
|
||||
if (!isOlder && !error.empty()) {
|
||||
wrk.LogError(GeneratorT::UIC, error);
|
||||
wrk.LogError(GenT::UIC, error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -940,7 +939,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
|
||||
reason += Quoted(BuildFile);
|
||||
reason += " because it's older than its source file ";
|
||||
reason += Quoted(SourceFile);
|
||||
wrk.LogInfo(GeneratorT::UIC, reason);
|
||||
wrk.LogInfo(GenT::UIC, reason);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -952,7 +951,7 @@ bool cmQtAutoGeneratorMocUic::JobUicT::UpdateRequired(WorkerT& wrk)
|
||||
void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk)
|
||||
{
|
||||
// Make sure the parent directory exists
|
||||
if (wrk.FileSys().MakeParentDirectory(GeneratorT::UIC, BuildFile)) {
|
||||
if (wrk.FileSys().MakeParentDirectory(GenT::UIC, BuildFile)) {
|
||||
// Compose uic command
|
||||
std::vector<std::string> cmd;
|
||||
cmd.push_back(wrk.Uic().Executable);
|
||||
@@ -970,11 +969,11 @@ void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk)
|
||||
cmd.push_back(SourceFile);
|
||||
|
||||
ProcessResultT result;
|
||||
if (wrk.RunProcess(GeneratorT::UIC, result, cmd)) {
|
||||
if (wrk.RunProcess(GenT::UIC, result, cmd)) {
|
||||
// Uic command success
|
||||
// Print uic output
|
||||
if (!result.StdOut.empty()) {
|
||||
wrk.LogInfo(GeneratorT::UIC, result.StdOut);
|
||||
wrk.LogInfo(GenT::UIC, result.StdOut);
|
||||
}
|
||||
} else {
|
||||
// Uic command failed
|
||||
@@ -987,7 +986,7 @@ void cmQtAutoGeneratorMocUic::JobUicT::GenerateUic(WorkerT& wrk)
|
||||
emsg += Quoted(IncluderFile);
|
||||
emsg += ".\n";
|
||||
emsg += result.ErrorMessage;
|
||||
wrk.LogCommandError(GeneratorT::UIC, emsg, cmd, result.StdOut);
|
||||
wrk.LogCommandError(GenT::UIC, emsg, cmd, result.StdOut);
|
||||
}
|
||||
wrk.FileSys().FileRemove(BuildFile);
|
||||
}
|
||||
@@ -1018,41 +1017,39 @@ cmQtAutoGeneratorMocUic::WorkerT::~WorkerT()
|
||||
}
|
||||
|
||||
void cmQtAutoGeneratorMocUic::WorkerT::LogInfo(
|
||||
GeneratorT genType, std::string const& message) const
|
||||
GenT genType, std::string const& message) const
|
||||
{
|
||||
Log().Info(genType, message);
|
||||
}
|
||||
|
||||
void cmQtAutoGeneratorMocUic::WorkerT::LogWarning(
|
||||
GeneratorT genType, std::string const& message) const
|
||||
GenT genType, std::string const& message) const
|
||||
{
|
||||
Log().Warning(genType, message);
|
||||
}
|
||||
|
||||
void cmQtAutoGeneratorMocUic::WorkerT::LogFileWarning(
|
||||
GeneratorT genType, std::string const& filename,
|
||||
std::string const& message) const
|
||||
GenT genType, std::string const& filename, std::string const& message) const
|
||||
{
|
||||
Log().WarningFile(genType, filename, message);
|
||||
}
|
||||
|
||||
void cmQtAutoGeneratorMocUic::WorkerT::LogError(
|
||||
GeneratorT genType, std::string const& message) const
|
||||
GenT genType, std::string const& message) const
|
||||
{
|
||||
Gen().ParallelRegisterJobError();
|
||||
Log().Error(genType, message);
|
||||
}
|
||||
|
||||
void cmQtAutoGeneratorMocUic::WorkerT::LogFileError(
|
||||
GeneratorT genType, std::string const& filename,
|
||||
std::string const& message) const
|
||||
GenT genType, std::string const& filename, std::string const& message) const
|
||||
{
|
||||
Gen().ParallelRegisterJobError();
|
||||
Log().ErrorFile(genType, filename, message);
|
||||
}
|
||||
|
||||
void cmQtAutoGeneratorMocUic::WorkerT::LogCommandError(
|
||||
GeneratorT genType, std::string const& message,
|
||||
GenT genType, std::string const& message,
|
||||
std::vector<std::string> const& command, std::string const& output) const
|
||||
{
|
||||
Gen().ParallelRegisterJobError();
|
||||
@@ -1060,7 +1057,7 @@ void cmQtAutoGeneratorMocUic::WorkerT::LogCommandError(
|
||||
}
|
||||
|
||||
bool cmQtAutoGeneratorMocUic::WorkerT::RunProcess(
|
||||
GeneratorT genType, ProcessResultT& result,
|
||||
GenT genType, ProcessResultT& result,
|
||||
std::vector<std::string> const& command)
|
||||
{
|
||||
if (command.empty()) {
|
||||
@@ -1213,7 +1210,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
|
||||
|
||||
// -- Read info file
|
||||
if (!makefile->ReadListFile(InfoFile())) {
|
||||
Log().ErrorFile(GeneratorT::GEN, InfoFile(), "File processing failed");
|
||||
Log().ErrorFile(GenT::GEN, InfoFile(), "File processing failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1238,14 +1235,13 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
|
||||
InfoGetBool("AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE");
|
||||
Base_.AutogenBuildDir = InfoGet("AM_BUILD_DIR");
|
||||
if (Base_.AutogenBuildDir.empty()) {
|
||||
Log().ErrorFile(GeneratorT::GEN, InfoFile(),
|
||||
"Autogen build directory missing");
|
||||
Log().ErrorFile(GenT::GEN, InfoFile(), "Autogen build directory missing");
|
||||
return false;
|
||||
}
|
||||
// include directory
|
||||
Base_.AutogenIncludeDir = InfoGetConfig("AM_INCLUDE_DIR");
|
||||
if (Base_.AutogenIncludeDir.empty()) {
|
||||
Log().ErrorFile(GeneratorT::GEN, InfoFile(),
|
||||
Log().ErrorFile(GenT::GEN, InfoFile(),
|
||||
"Autogen include directory missing");
|
||||
return false;
|
||||
}
|
||||
@@ -1253,7 +1249,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
|
||||
// - Files
|
||||
SettingsFile_ = InfoGetConfig("AM_SETTINGS_FILE");
|
||||
if (SettingsFile_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::GEN, InfoFile(), "Settings file name missing");
|
||||
Log().ErrorFile(GenT::GEN, InfoFile(), "Settings file name missing");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1334,13 +1330,13 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
|
||||
}
|
||||
} else {
|
||||
Log().ErrorFile(
|
||||
GeneratorT::MOC, InfoFile(),
|
||||
GenT::MOC, InfoFile(),
|
||||
"AUTOMOC_DEPEND_FILTERS list size is not a multiple of 2");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!error.empty()) {
|
||||
Log().ErrorFile(GeneratorT::MOC, InfoFile(), error);
|
||||
Log().ErrorFile(GenT::MOC, InfoFile(), error);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1369,7 +1365,7 @@ bool cmQtAutoGeneratorMocUic::Init(cmMakefile* makefile)
|
||||
std::ostringstream ost;
|
||||
ost << "files/options lists sizes mismatch (" << sources.size() << "/"
|
||||
<< options.size() << ")";
|
||||
Log().ErrorFile(GeneratorT::UIC, InfoFile(), ost.str());
|
||||
Log().ErrorFile(GenT::UIC, InfoFile(), ost.str());
|
||||
return false;
|
||||
}
|
||||
auto fitEnd = sources.cend();
|
||||
@@ -1690,8 +1686,7 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite()
|
||||
// Only write if any setting changed
|
||||
if (!JobError_ && (Moc().SettingsChanged || Uic().SettingsChanged)) {
|
||||
if (Log().Verbose()) {
|
||||
Log().Info(GeneratorT::GEN,
|
||||
"Writing settings file " + Quoted(SettingsFile_));
|
||||
Log().Info(GenT::GEN, "Writing settings file " + Quoted(SettingsFile_));
|
||||
}
|
||||
// Compose settings file content
|
||||
std::string content;
|
||||
@@ -1709,8 +1704,8 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite()
|
||||
SettingAppend("uic", SettingsStringUic_);
|
||||
}
|
||||
// Write settings file
|
||||
if (!FileSys().FileWrite(GeneratorT::GEN, SettingsFile_, content)) {
|
||||
Log().ErrorFile(GeneratorT::GEN, SettingsFile_,
|
||||
if (!FileSys().FileWrite(GenT::GEN, SettingsFile_, content)) {
|
||||
Log().ErrorFile(GenT::GEN, SettingsFile_,
|
||||
"Settings file writing failed");
|
||||
// Remove old settings file to trigger a full rebuild on the next run
|
||||
FileSys().FileRemove(SettingsFile_);
|
||||
@@ -1722,7 +1717,7 @@ void cmQtAutoGeneratorMocUic::SettingsFileWrite()
|
||||
void cmQtAutoGeneratorMocUic::CreateDirectories()
|
||||
{
|
||||
// Create AUTOGEN include directory
|
||||
if (!FileSys().MakeDirectory(GeneratorT::GEN, Base().AutogenIncludeDir)) {
|
||||
if (!FileSys().MakeDirectory(GenT::GEN, Base().AutogenIncludeDir)) {
|
||||
RegisterJobError();
|
||||
}
|
||||
}
|
||||
@@ -1882,7 +1877,7 @@ bool cmQtAutoGeneratorMocUic::ParallelJobPushMoc(JobHandleT& jobHandle)
|
||||
"- add a directory prefix to a \"<NAME>.moc\" include "
|
||||
"(e.g \"sub/<NAME>.moc\")\n"
|
||||
"- rename the source file(s)\n";
|
||||
Log().Error(GeneratorT::MOC, error);
|
||||
Log().Error(GenT::MOC, error);
|
||||
RegisterJobError();
|
||||
}
|
||||
// Do not push this job in since the included moc file already
|
||||
@@ -1932,7 +1927,7 @@ bool cmQtAutoGeneratorMocUic::ParallelJobPushUic(JobHandleT& jobHandle)
|
||||
"(e.g \"sub/ui_<NAME>.h\")\n"
|
||||
"- rename the <NAME>.ui file(s) and adjust the \"ui_<NAME>.h\" "
|
||||
"include(s)\n";
|
||||
Log().Error(GeneratorT::UIC, error);
|
||||
Log().Error(GenT::UIC, error);
|
||||
RegisterJobError();
|
||||
}
|
||||
// Do not push this job in since the uic file already
|
||||
@@ -2019,10 +2014,10 @@ void cmQtAutoGeneratorMocUic::MocGenerateCompilation()
|
||||
if (FileSys().FileDiffers(compAbs, content)) {
|
||||
// Actually write mocs compilation file
|
||||
if (Log().Verbose()) {
|
||||
Log().Info(GeneratorT::MOC, "Generating MOC compilation " + compAbs);
|
||||
Log().Info(GenT::MOC, "Generating MOC compilation " + compAbs);
|
||||
}
|
||||
if (!FileSys().FileWrite(GeneratorT::MOC, compAbs, content)) {
|
||||
Log().ErrorFile(GeneratorT::MOC, compAbs,
|
||||
if (!FileSys().FileWrite(GenT::MOC, compAbs, content)) {
|
||||
Log().ErrorFile(GenT::MOC, compAbs,
|
||||
"mocs compilation file writing failed");
|
||||
RegisterJobError();
|
||||
return;
|
||||
@@ -2030,7 +2025,7 @@ void cmQtAutoGeneratorMocUic::MocGenerateCompilation()
|
||||
} else if (MocAutoFileUpdated_) {
|
||||
// Only touch mocs compilation file
|
||||
if (Log().Verbose()) {
|
||||
Log().Info(GeneratorT::MOC, "Touching mocs compilation " + compAbs);
|
||||
Log().Info(GenT::MOC, "Touching mocs compilation " + compAbs);
|
||||
}
|
||||
FileSys().Touch(compAbs);
|
||||
}
|
||||
|
||||
@@ -321,22 +321,22 @@ public:
|
||||
const UicSettingsT& Uic() const { return Gen_->Uic(); }
|
||||
|
||||
// -- Log info
|
||||
void LogInfo(GeneratorT genType, std::string const& message) const;
|
||||
void LogInfo(GenT genType, std::string const& message) const;
|
||||
// -- Log warning
|
||||
void LogWarning(GeneratorT genType, std::string const& message) const;
|
||||
void LogFileWarning(GeneratorT genType, std::string const& filename,
|
||||
void LogWarning(GenT genType, std::string const& message) const;
|
||||
void LogFileWarning(GenT genType, std::string const& filename,
|
||||
std::string const& message) const;
|
||||
// -- Log error
|
||||
void LogError(GeneratorT genType, std::string const& message) const;
|
||||
void LogFileError(GeneratorT genType, std::string const& filename,
|
||||
void LogError(GenT genType, std::string const& message) const;
|
||||
void LogFileError(GenT genType, std::string const& filename,
|
||||
std::string const& message) const;
|
||||
void LogCommandError(GeneratorT genType, std::string const& message,
|
||||
void LogCommandError(GenT genType, std::string const& message,
|
||||
std::vector<std::string> const& command,
|
||||
std::string const& output) const;
|
||||
|
||||
// -- External processes
|
||||
/// @brief Verbose logging version
|
||||
bool RunProcess(GeneratorT genType, ProcessResultT& result,
|
||||
bool RunProcess(GenT genType, ProcessResultT& result,
|
||||
std::vector<std::string> const& command);
|
||||
|
||||
private:
|
||||
|
||||
@@ -55,7 +55,7 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
|
||||
|
||||
// -- Read info file
|
||||
if (!makefile->ReadListFile(InfoFile())) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "File processing failed");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "File processing failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -66,13 +66,13 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
|
||||
// - Directories
|
||||
AutogenBuildDir_ = InfoGet("ARCC_BUILD_DIR");
|
||||
if (AutogenBuildDir_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "Build directory empty");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "Build directory empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
IncludeDir_ = InfoGetConfig("ARCC_INCLUDE_DIR");
|
||||
if (IncludeDir_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "Include directory empty");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "Include directory empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -95,28 +95,27 @@ bool cmQtAutoGeneratorRcc::Init(cmMakefile* makefile)
|
||||
|
||||
// - Validity checks
|
||||
if (LockFile_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "Lock file name missing");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "Lock file name missing");
|
||||
return false;
|
||||
}
|
||||
if (SettingsFile_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "Settings file name missing");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "Settings file name missing");
|
||||
return false;
|
||||
}
|
||||
if (AutogenBuildDir_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(),
|
||||
"Autogen build directory missing");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "Autogen build directory missing");
|
||||
return false;
|
||||
}
|
||||
if (RccExecutable_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "rcc executable missing");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "rcc executable missing");
|
||||
return false;
|
||||
}
|
||||
if (QrcFile_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "rcc input file missing");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "rcc input file missing");
|
||||
return false;
|
||||
}
|
||||
if (RccFileName_.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, InfoFile(), "rcc output file missing");
|
||||
Log().ErrorFile(GenT::RCC, InfoFile(), "rcc output file missing");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -287,8 +286,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead()
|
||||
// Make sure the lock file exists
|
||||
if (!FileSys().FileExists(LockFile_, true)) {
|
||||
if (!FileSys().Touch(LockFile_, true)) {
|
||||
Log().ErrorFile(GeneratorT::RCC, LockFile_,
|
||||
"Lock file creation failed");
|
||||
Log().ErrorFile(GenT::RCC, LockFile_, "Lock file creation failed");
|
||||
Error_ = true;
|
||||
return false;
|
||||
}
|
||||
@@ -297,7 +295,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead()
|
||||
cmFileLockResult lockResult =
|
||||
LockFileLock_.Lock(LockFile_, static_cast<unsigned long>(-1));
|
||||
if (!lockResult.IsOk()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, LockFile_,
|
||||
Log().ErrorFile(GenT::RCC, LockFile_,
|
||||
"File lock failed: " + lockResult.GetOutputMessage());
|
||||
Error_ = true;
|
||||
return false;
|
||||
@@ -313,7 +311,7 @@ bool cmQtAutoGeneratorRcc::SettingsFileRead()
|
||||
// This triggers a full rebuild on the next run if the current
|
||||
// build is aborted before writing the current settings in the end.
|
||||
if (SettingsChanged_) {
|
||||
FileSys().FileWrite(GeneratorT::RCC, SettingsFile_, "");
|
||||
FileSys().FileWrite(GenT::RCC, SettingsFile_, "");
|
||||
}
|
||||
} else {
|
||||
SettingsChanged_ = true;
|
||||
@@ -328,15 +326,14 @@ void cmQtAutoGeneratorRcc::SettingsFileWrite()
|
||||
// Only write if any setting changed
|
||||
if (SettingsChanged_) {
|
||||
if (Log().Verbose()) {
|
||||
Log().Info(GeneratorT::RCC,
|
||||
"Writing settings file " + Quoted(SettingsFile_));
|
||||
Log().Info(GenT::RCC, "Writing settings file " + Quoted(SettingsFile_));
|
||||
}
|
||||
// Write settings file
|
||||
std::string content = "rcc:";
|
||||
content += SettingsString_;
|
||||
content += '\n';
|
||||
if (!FileSys().FileWrite(GeneratorT::RCC, SettingsFile_, content)) {
|
||||
Log().ErrorFile(GeneratorT::RCC, SettingsFile_,
|
||||
if (!FileSys().FileWrite(GenT::RCC, SettingsFile_, content)) {
|
||||
Log().ErrorFile(GenT::RCC, SettingsFile_,
|
||||
"Settings file writing failed");
|
||||
// Remove old settings file to trigger a full rebuild on the next run
|
||||
FileSys().FileRemove(SettingsFile_);
|
||||
@@ -360,7 +357,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
|
||||
reason += " from its source file ";
|
||||
reason += Quoted(QrcFile_);
|
||||
reason += " because it doesn't exist";
|
||||
Log().Info(GeneratorT::RCC, reason);
|
||||
Log().Info(GenT::RCC, reason);
|
||||
}
|
||||
Generate_ = true;
|
||||
return Generate_;
|
||||
@@ -374,7 +371,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
|
||||
reason += " from ";
|
||||
reason += Quoted(QrcFile_);
|
||||
reason += " because the RCC settings changed";
|
||||
Log().Info(GeneratorT::RCC, reason);
|
||||
Log().Info(GenT::RCC, reason);
|
||||
}
|
||||
Generate_ = true;
|
||||
return Generate_;
|
||||
@@ -387,7 +384,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
|
||||
std::string error;
|
||||
isOlder = FileSys().FileIsOlderThan(RccFileOutput_, QrcFile_, &error);
|
||||
if (!error.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, QrcFile_, error);
|
||||
Log().ErrorFile(GenT::RCC, QrcFile_, error);
|
||||
Error_ = true;
|
||||
}
|
||||
}
|
||||
@@ -397,7 +394,7 @@ bool cmQtAutoGeneratorRcc::TestQrcRccFiles()
|
||||
reason += Quoted(RccFileOutput_);
|
||||
reason += " because it is older than ";
|
||||
reason += Quoted(QrcFile_);
|
||||
Log().Info(GeneratorT::RCC, reason);
|
||||
Log().Info(GenT::RCC, reason);
|
||||
}
|
||||
Generate_ = true;
|
||||
}
|
||||
@@ -424,12 +421,11 @@ bool cmQtAutoGeneratorRcc::TestResourcesRead()
|
||||
std::string parseError;
|
||||
if (!RccListParseOutput(ProcessResult_.StdOut, ProcessResult_.StdErr,
|
||||
Inputs_, parseError)) {
|
||||
Log().ErrorFile(GeneratorT::RCC, QrcFile_, parseError);
|
||||
Log().ErrorFile(GenT::RCC, QrcFile_, parseError);
|
||||
Error_ = true;
|
||||
}
|
||||
} else {
|
||||
Log().ErrorFile(GeneratorT::RCC, QrcFile_,
|
||||
ProcessResult_.ErrorMessage);
|
||||
Log().ErrorFile(GenT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
|
||||
Error_ = true;
|
||||
}
|
||||
// Clean up
|
||||
@@ -457,7 +453,7 @@ bool cmQtAutoGeneratorRcc::TestResourcesRead()
|
||||
// rcc does not support the --list command.
|
||||
// Read the qrc file content and parse it.
|
||||
std::string qrcContent;
|
||||
if (FileSys().FileRead(GeneratorT::RCC, qrcContent, QrcFile_)) {
|
||||
if (FileSys().FileRead(GenT::RCC, qrcContent, QrcFile_)) {
|
||||
RccListParseContent(qrcContent, Inputs_);
|
||||
}
|
||||
}
|
||||
@@ -483,7 +479,7 @@ bool cmQtAutoGeneratorRcc::TestResources()
|
||||
error = "Could not find the resource file\n ";
|
||||
error += Quoted(resFile);
|
||||
error += '\n';
|
||||
Log().ErrorFile(GeneratorT::RCC, QrcFile_, error);
|
||||
Log().ErrorFile(GenT::RCC, QrcFile_, error);
|
||||
Error_ = true;
|
||||
break;
|
||||
}
|
||||
@@ -496,14 +492,14 @@ bool cmQtAutoGeneratorRcc::TestResources()
|
||||
reason += Quoted(QrcFile_);
|
||||
reason += " because it is older than ";
|
||||
reason += Quoted(resFile);
|
||||
Log().Info(GeneratorT::RCC, reason);
|
||||
Log().Info(GenT::RCC, reason);
|
||||
}
|
||||
Generate_ = true;
|
||||
break;
|
||||
}
|
||||
// Print error and break on demand
|
||||
if (!error.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, QrcFile_, error);
|
||||
Log().ErrorFile(GenT::RCC, QrcFile_, error);
|
||||
Error_ = true;
|
||||
break;
|
||||
}
|
||||
@@ -522,7 +518,7 @@ void cmQtAutoGeneratorRcc::TestInfoFile()
|
||||
std::string error;
|
||||
isOlder = FileSys().FileIsOlderThan(RccFileOutput_, InfoFile(), &error);
|
||||
if (!error.empty()) {
|
||||
Log().ErrorFile(GeneratorT::RCC, QrcFile_, error);
|
||||
Log().ErrorFile(GenT::RCC, QrcFile_, error);
|
||||
Error_ = true;
|
||||
}
|
||||
}
|
||||
@@ -532,7 +528,7 @@ void cmQtAutoGeneratorRcc::TestInfoFile()
|
||||
reason += Quoted(RccFileOutput_);
|
||||
reason += " because it is older than ";
|
||||
reason += Quoted(InfoFile());
|
||||
Log().Info(GeneratorT::RCC, reason);
|
||||
Log().Info(GenT::RCC, reason);
|
||||
}
|
||||
// Touch build file
|
||||
FileSys().Touch(RccFileOutput_);
|
||||
@@ -544,7 +540,7 @@ void cmQtAutoGeneratorRcc::TestInfoFile()
|
||||
void cmQtAutoGeneratorRcc::GenerateParentDir()
|
||||
{
|
||||
// Make sure the parent directory exists
|
||||
if (!FileSys().MakeParentDirectory(GeneratorT::RCC, RccFileOutput_)) {
|
||||
if (!FileSys().MakeParentDirectory(GenT::RCC, RccFileOutput_)) {
|
||||
Error_ = true;
|
||||
}
|
||||
}
|
||||
@@ -567,7 +563,7 @@ bool cmQtAutoGeneratorRcc::GenerateRcc()
|
||||
// Rcc process success
|
||||
// Print rcc output
|
||||
if (!ProcessResult_.StdOut.empty()) {
|
||||
Log().Info(GeneratorT::RCC, ProcessResult_.StdOut);
|
||||
Log().Info(GenT::RCC, ProcessResult_.StdOut);
|
||||
}
|
||||
BuildFileChanged_ = true;
|
||||
} else {
|
||||
@@ -581,7 +577,7 @@ bool cmQtAutoGeneratorRcc::GenerateRcc()
|
||||
emsg += "\n";
|
||||
emsg += ProcessResult_.ErrorMessage;
|
||||
}
|
||||
Log().ErrorCommand(GeneratorT::RCC, emsg, Process_->Setup().Command,
|
||||
Log().ErrorCommand(GenT::RCC, emsg, Process_->Setup().Command,
|
||||
ProcessResult_.StdOut);
|
||||
}
|
||||
FileSys().FileRemove(RccFileOutput_);
|
||||
@@ -625,19 +621,17 @@ void cmQtAutoGeneratorRcc::GenerateWrapper()
|
||||
if (FileSys().FileDiffers(RccFilePublic_, content)) {
|
||||
// Write new wrapper file
|
||||
if (Log().Verbose()) {
|
||||
Log().Info(GeneratorT::RCC,
|
||||
"Generating RCC wrapper file " + RccFilePublic_);
|
||||
Log().Info(GenT::RCC, "Generating RCC wrapper file " + RccFilePublic_);
|
||||
}
|
||||
if (!FileSys().FileWrite(GeneratorT::RCC, RccFilePublic_, content)) {
|
||||
Log().ErrorFile(GeneratorT::RCC, RccFilePublic_,
|
||||
if (!FileSys().FileWrite(GenT::RCC, RccFilePublic_, content)) {
|
||||
Log().ErrorFile(GenT::RCC, RccFilePublic_,
|
||||
"RCC wrapper file writing failed");
|
||||
Error_ = true;
|
||||
}
|
||||
} else if (BuildFileChanged_) {
|
||||
// Just touch the wrapper file
|
||||
if (Log().Verbose()) {
|
||||
Log().Info(GeneratorT::RCC,
|
||||
"Touching RCC wrapper file " + RccFilePublic_);
|
||||
Log().Info(GenT::RCC, "Touching RCC wrapper file " + RccFilePublic_);
|
||||
}
|
||||
FileSys().Touch(RccFilePublic_);
|
||||
}
|
||||
@@ -653,7 +647,7 @@ bool cmQtAutoGeneratorRcc::StartProcess(
|
||||
std::string msg = "Running command:\n";
|
||||
msg += QuotedCommand(command);
|
||||
msg += '\n';
|
||||
Log().Info(GeneratorT::RCC, msg);
|
||||
Log().Info(GenT::RCC, msg);
|
||||
}
|
||||
|
||||
// Create process handler
|
||||
@@ -661,7 +655,7 @@ bool cmQtAutoGeneratorRcc::StartProcess(
|
||||
Process_->setup(&ProcessResult_, mergedOutput, command, workingDirectory);
|
||||
// Start process
|
||||
if (!Process_->start(UVLoop(), [this] { UVRequest().send(); })) {
|
||||
Log().ErrorFile(GeneratorT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
|
||||
Log().ErrorFile(GenT::RCC, QrcFile_, ProcessResult_.ErrorMessage);
|
||||
Error_ = true;
|
||||
// Clean up
|
||||
Process_.reset();
|
||||
|
||||
Reference in New Issue
Block a user