Browse Source

Merge topic 'ninja-regen-metadata'

73d1c78bf4 ci: update to use ninja 1.10.2
11f4259362 Ninja: Clean metadata after regen during build on Windows with 1.10.2+

Acked-by: Kitware Robot <[email protected]>
Merge-request: !5555
Brad King 4 years ago
parent
commit
5d49943504

+ 2 - 2
.gitlab/ci/ninja.ps1

@@ -1,7 +1,7 @@
 $erroractionpreference = "stop"
 
-$version = "1.10.0"
-$sha256sum = "919FD158C16BF135E8A850BB4046EC1CE28A7439EE08B977CD0B7F6B3463D178"
+$version = "1.10.2"
+$sha256sum = "BBDE850D247D2737C5764C927D1071CBB1F1957DCABDA4A130FA8547C12C695F"
 $filename = "ninja-win"
 $tarball = "$filename.zip"
 

+ 3 - 3
.gitlab/ci/ninja.sh

@@ -2,17 +2,17 @@
 
 set -e
 
-readonly version="1.10.0"
+readonly version="1.10.2"
 
 case "$( uname -s )" in
     Linux)
         shatool="sha256sum"
-        sha256sum="6566836ddf3d72ca06685b34814e0c6fa0f0943542d651d0dab3150f10307c82"
+        sha256sum="763464859c7ef2ea3a0a10f4df40d2025d3bb9438fcb1228404640410c0ec22d"
         platform="linux"
         ;;
     Darwin)
         shatool="shasum -a 256"
-        sha256sum="2ee405c0e205d55666c60cc9c0d8d04c8ede06d3ef2e2c2aabe08fd81c17d22e"
+        sha256sum="6fa359f491fac7e5185273c6421a000eea6a2f0febf0ac03ac900bd4d80ed2a5"
         platform="mac"
         ;;
     *)

+ 6 - 2
Source/cmGlobalNinjaGenerator.cxx

@@ -540,10 +540,11 @@ void cmGlobalNinjaGenerator::Generate()
   this->CloseBuildFileStreams();
 
 #ifdef _WIN32
-  // The ninja tools will not be able to update metadata on Windows
+  // Older ninja tools will not be able to update metadata on Windows
   // when we are re-generating inside an existing 'ninja' invocation
   // because the outer tool has the files open for write.
-  if (!this->GetCMakeInstance()->GetRegenerateDuringBuild())
+  if (this->NinjaSupportsMetadataOnRegeneration ||
+      !this->GetCMakeInstance()->GetRegenerateDuringBuild())
 #endif
   {
     this->CleanMetaData();
@@ -692,6 +693,9 @@ void cmGlobalNinjaGenerator::CheckNinjaFeatures()
   this->NinjaSupportsMultipleOutputs = !cmSystemTools::VersionCompare(
     cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
     RequiredNinjaVersionForMultipleOutputs().c_str());
+  this->NinjaSupportsMetadataOnRegeneration = !cmSystemTools::VersionCompare(
+    cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
+    RequiredNinjaVersionForMetadataOnRegeneration().c_str());
 }
 
 bool cmGlobalNinjaGenerator::CheckLanguages(

+ 5 - 0
Source/cmGlobalNinjaGenerator.h

@@ -377,6 +377,10 @@ public:
   {
     return "1.10";
   }
+  static std::string RequiredNinjaVersionForMetadataOnRegeneration()
+  {
+    return "1.10.2";
+  }
   bool SupportsConsolePool() const;
   bool SupportsImplicitOuts() const;
   bool SupportsManifestRestat() const;
@@ -542,6 +546,7 @@ private:
   bool NinjaSupportsUnconditionalRecompactTool = false;
   bool NinjaSupportsCleanDeadTool = false;
   bool NinjaSupportsMultipleOutputs = false;
+  bool NinjaSupportsMetadataOnRegeneration = false;
 
 private:
   void InitOutputPathPrefix();