aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Komissarov <ABBAPOH@gmail.com>2019-05-18 22:56:05 +0200
committerIvan Komissarov <ABBAPOH@gmail.com>2019-05-22 12:31:07 +0000
commiteb78330fcf98e56968ae5d436d17bc114b8a4890 (patch)
treec90f832f2da1eede2e04745fbf45d9f4f9f29a4e
parent9facadbb0e7b6032daac736f5a3084e9ea3c96ba (diff)
Use validateFunc property in protobuf modules
This allows to use more native .base property to call super class validate function. Change-Id: I0f68be8e5823796502c53d719a00825075666b43 Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/modules/protobuf/cpp/protobufcpp.qbs14
-rw-r--r--share/qbs/modules/protobuf/objc/protobufobjc.qbs16
-rw-r--r--share/qbs/modules/protobuf/protobufbase.qbs6
3 files changed, 22 insertions, 14 deletions
diff --git a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
index 5cb3257d4..2b6e94e83 100644
--- a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
+++ b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs
@@ -28,12 +28,14 @@ ProtobufBase {
prepare: HelperFunctions.doPrepare(input.protobuf.cpp, product, input, outputs, "cpp")
}
- validate: {
- baseValidate();
- if (!HelperFunctions.checkPath(includePath))
- throw "Can't find cpp protobuf include files. Please set the includePath property.";
- if (!HelperFunctions.checkPath(libraryPath))
- throw "Can't find cpp protobuf library. Please set the libraryPath property.";
+ validateFunc: {
+ return function() {
+ base();
+ if (!HelperFunctions.checkPath(includePath))
+ throw "Can't find cpp protobuf include files. Please set the includePath property.";
+ if (!HelperFunctions.checkPath(libraryPath))
+ throw "Can't find cpp protobuf library. Please set the libraryPath property.";
+ }
}
Probes.IncludeProbe {
diff --git a/share/qbs/modules/protobuf/objc/protobufobjc.qbs b/share/qbs/modules/protobuf/objc/protobufobjc.qbs
index c252d9949..e2c4b5260 100644
--- a/share/qbs/modules/protobuf/objc/protobufobjc.qbs
+++ b/share/qbs/modules/protobuf/objc/protobufobjc.qbs
@@ -43,13 +43,15 @@ ProtobufBase {
prepare: HelperFunctions.doPrepare(input.protobuf.objc, product, input, outputs, "objc")
}
- validate: {
- baseValidate();
- if (!HelperFunctions.checkPath(frameworkPath)) {
- if (!HelperFunctions.checkPath(includePath))
- throw "Can't find objective-c protobuf include files. Please set the includePath or frameworkPath property.";
- if (!HelperFunctions.checkPath(libraryPath))
- throw "Can't find objective-c protobuf library. Please set the libraryPath or frameworkPath property.";
+ validateFunc: {
+ return function() {
+ base();
+ if (!HelperFunctions.checkPath(frameworkPath)) {
+ if (!HelperFunctions.checkPath(includePath))
+ throw "Can't find objective-c protobuf include files. Please set the includePath or frameworkPath property.";
+ if (!HelperFunctions.checkPath(libraryPath))
+ throw "Can't find objective-c protobuf library. Please set the libraryPath or frameworkPath property.";
+ }
}
}
diff --git a/share/qbs/modules/protobuf/protobufbase.qbs b/share/qbs/modules/protobuf/protobufbase.qbs
index ec13eb3b5..0ac6c1949 100644
--- a/share/qbs/modules/protobuf/protobufbase.qbs
+++ b/share/qbs/modules/protobuf/protobufbase.qbs
@@ -10,7 +10,7 @@ Module {
property string outputDir: product.buildDirectory + "/protobuf"
- readonly property var baseValidate: {
+ property var validateFunc: {
return function() {
if (!File.exists(protocBinary))
throw "Can't find protoc binary. Please set the protocBinary property or make sure it is found in PATH";
@@ -26,4 +26,8 @@ Module {
id: protocProbe
names: ["protoc"]
}
+
+ validate: {
+ validateFunc();
+ }
}