From be550a2b9dcd13fa9cefecfcccdfa3fc84abe4b4 Mon Sep 17 00:00:00 2001
From: Andras Becsi <andras.becsi@digia.com>
Date: Thu, 5 Sep 2013 15:37:27 +0200
Subject: [PATCH] Rename findNinja to findOrBuildNinja and fail early if gyp
 fails

We should not not use the $$ syntax to collect the output of the gyp
call instead we should just fail with an error in case gyp_qtwebengine
fails.

Change-Id: Ib6218bdfb998100a3717470713ed5bf5f30db339
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
---
 build/build.pro                            | 5 ++---
 build/qmake/mkspecs/features/functions.prf | 2 +-
 qtwebengine.pro                            | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/build/build.pro b/build/build.pro
index f3da119a7..4fcd5c546 100644
--- a/build/build.pro
+++ b/build/build.pro
@@ -5,11 +5,10 @@
 TEMPLATE = aux
 
 message(Running Gyp...)
-GYP_OUTPUT = $$system(python ./gyp_qtwebengine)
-message($$GYP_OUTPUT)
+!system(python ./gyp_qtwebengine): error("-- running gyp_qtwebengine failed --")
 
 ninja.target = invoke_ninja
-ninja.commands = $$findNinja() $$(NINJAFLAGS) -C $$getOutDir()/$$getConfigDir()
+ninja.commands = $$findOrBuildNinja() $$(NINJAFLAGS) -C $$getOutDir()/$$getConfigDir()
 ninja.depends: qmake
 QMAKE_EXTRA_TARGETS += ninja
 
diff --git a/build/qmake/mkspecs/features/functions.prf b/build/qmake/mkspecs/features/functions.prf
index 17e54cfe1..9a98852b9 100644
--- a/build/qmake/mkspecs/features/functions.prf
+++ b/build/qmake/mkspecs/features/functions.prf
@@ -71,7 +71,7 @@ defineReplace(which) {
   return($$out)
 }
 
-defineReplace(findNinja) {
+defineReplace(findOrBuildNinja) {
   !isEmpty(CACHED_NINJA_EXECUTABLE):exists($$CACHED_NINJA_EXECUTABLE): return($$CACHED_NINJA_EXECUTABLE)
   out = $$which(ninja)
   # Try to be smart about it if we know where the chromium sources are located
diff --git a/qtwebengine.pro b/qtwebengine.pro
index 5a54df17e..5db155c26 100644
--- a/qtwebengine.pro
+++ b/qtwebengine.pro
@@ -22,7 +22,7 @@ qtHaveModule(widgets) {
 SUBDIRS += examples
 
 # Ninja executable location needs to be determined early for extra targets. Should be fetched from cache most of the time anyway.
-NINJA_EXECUTABLE = $$findNinja()
+NINJA_EXECUTABLE = $$findOrBuildNinja()
 
 # Extra targets that invoke ninja on the desired configuration added for convenience
 release.target = release
-- 
GitLab