Преглед на файлове

AUTOUIC: Fix cyclic dependency between generated UI headers and timestamp

Once the generated UI headers are created by UIC they also are involved
into processing in next run on ninja.  Autogen adds `ui_*.h` files to
the deps file `ui_*.h` and this cause timestamp start depend on `ui_*.h`.
Meanwhile `ui_*.h` depend on timestamp because of the explicit rules
added by commit 1265c65b33 (AUTOUIC: Collect ui header files for Ninja
generator, 2021-02-18, v3.21.0-rc1~600^2).  Avoid adding `ui_*.h` to
deps file at second ninja run.

Fixes: #16776
Alexey Edelev преди 4 години
родител
ревизия
9cebdbec77
променени са 1 файла, в които са добавени 14 реда и са изтрити 6 реда
  1. 14 6
      Source/cmQtAutoMocUic.cxx

+ 14 - 6
Source/cmQtAutoMocUic.cxx

@@ -2248,12 +2248,20 @@ void cmQtAutoMocUicT::JobDepFilesMergeT::Process()
   std::for_each(this->MocEval().SourceMappings.begin(),
                 this->MocEval().SourceMappings.end(), processMappingEntry);
 
-  // Remove SKIP_AUTOMOC files
-  dependencies.erase(std::remove_if(dependencies.begin(), dependencies.end(),
-                                    [this](const std::string& dep) {
-                                      return this->MocConst().skipped(dep);
-                                    }),
-                     dependencies.end());
+  // Remove SKIP_AUTOMOC files.
+  // Also remove AUTOUIC header files to avoid cyclic dependency.
+  dependencies.erase(
+    std::remove_if(dependencies.begin(), dependencies.end(),
+                   [this](const std::string& dep) {
+                     return this->MocConst().skipped(dep) ||
+                       std::any_of(
+                              this->UicEval().Includes.begin(),
+                              this->UicEval().Includes.end(),
+                              [&dep](MappingMapT::value_type const& mapping) {
+                                return dep == mapping.second->OutputFile;
+                              });
+                   }),
+    dependencies.end());
 
   // Remove duplicates to make the depfile smaller
   std::sort(dependencies.begin(), dependencies.end());