From 1719517834d953abb4e37be4c824854dee9795ac Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 19 Oct 2018 16:16:37 +0200 Subject: Stop updating timestamps of generated files that haven't changed This is a change in preparation for improved incremental builds, where modifying one typesystem XML file will not force rebuilding all generated cpp files. The previous logic was incorrect, file timestamps should not be updated if the generated files are unchanged, instead the build rules need to be adapted to prevent unnecessary rebuilds. Change-Id: Ia47f8ff1970e974d0e617b6891ab58666da3b1ff Reviewed-by: Friedemann Kleint Reviewed-by: Christian Tismer --- sources/shiboken2/generator/generator.cpp | 15 +-------------- sources/shiboken2/generator/shiboken2/cppgenerator.cpp | 14 +------------- 2 files changed, 2 insertions(+), 27 deletions(-) (limited to 'sources/shiboken2') diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp index 85a8c4769..8b37b44e0 100644 --- a/sources/shiboken2/generator/generator.cpp +++ b/sources/shiboken2/generator/generator.cpp @@ -395,20 +395,7 @@ bool Generator::generateFileForContext(GeneratorContext &context) generateClass(fileOut.stream, context); - FileOut::State state = fileOut.done(); - switch (state) { - case FileOut::Failure: - return false; - case FileOut::Unchanged: - // Even if contents is unchanged, the last file modification time should be updated, - // so that the build system can rely on the fact the generated file is up-to-date. - fileOut.touch(); - break; - case FileOut::Success: - break; - } - - return true; + return fileOut.done() != FileOut::Failure; } QString Generator::getFileNameBaseForSmartPointer(const AbstractMetaType *smartPointerType, diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp index 6d16e1bfb..29f28a1a7 100644 --- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp +++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp @@ -5732,19 +5732,7 @@ bool CppGenerator::finishGeneration() s << "SBK_MODULE_INIT_FUNCTION_END" << endl; - switch (file.done()) { - case FileOut::Failure: - return false; - case FileOut::Unchanged: - // Even if contents is unchanged, the last file modification time should be updated, - // so that the build system can rely on the fact the generated file is up-to-date. - file.touch(); - break; - case FileOut::Success: - break; - } - - return true; + return file.done() != FileOut::Failure; } static ArgumentOwner getArgumentOwner(const AbstractMetaFunction* func, int argIndex) -- cgit v1.2.3