aboutsummaryrefslogtreecommitdiffstats
path: root/qbs-resources
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@qt.io>2017-05-30 18:03:13 -0700
committerJake Petroules <jake.petroules@qt.io>2017-06-02 19:41:38 +0000
commitb3e8a5c5f8dd7be8abe3a1543cfa818f6f2eee3b (patch)
treeb26358a50ac250d34a8f5e965fc7c62a34093411 /qbs-resources
parent11a08386295c1b9c9abb71899421274daea07d2c (diff)
Introduce the qbsversion module for building Qbs
Use that instead of QbsFunctions.qbsVersion() and read it in qbs_version.pri; this has the advantage that simple text processing tools can retrieve the project version without having to parse JavaScript. It's also set from only one place now. Change-Id: Icfd2a6bf12b794b55c9ba31934a96b4483224eae Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'qbs-resources')
-rw-r--r--qbs-resources/imports/QbsFunctions/functions.js1
-rw-r--r--qbs-resources/imports/QbsLibrary.qbs3
-rw-r--r--qbs-resources/imports/QbsProduct.qbs1
-rw-r--r--qbs-resources/modules/qbsversion/qbsversion.qbs24
4 files changed, 26 insertions, 3 deletions
diff --git a/qbs-resources/imports/QbsFunctions/functions.js b/qbs-resources/imports/QbsFunctions/functions.js
deleted file mode 100644
index b4f6706f7..000000000
--- a/qbs-resources/imports/QbsFunctions/functions.js
+++ /dev/null
@@ -1 +0,0 @@
-function qbsVersion() { return "1.9.0"; }
diff --git a/qbs-resources/imports/QbsLibrary.qbs b/qbs-resources/imports/QbsLibrary.qbs
index 218da8941..b459b4c8c 100644
--- a/qbs-resources/imports/QbsLibrary.qbs
+++ b/qbs-resources/imports/QbsLibrary.qbs
@@ -1,10 +1,9 @@
import qbs
-import QbsFunctions
QbsProduct {
Depends { name: "cpp" }
Depends { name: "bundle" }
- version: QbsFunctions.qbsVersion()
+ version: qbsversion.version
type: Qt.core.staticBuild ? "staticlibrary" : "dynamiclibrary"
targetName: (qbs.enableDebugCode && qbs.targetOS.contains("windows")) ? (name + 'd') : name
destinationDirectory: qbs.targetOS.contains("windows") ? "bin" : qbsbuildconfig.libDirName
diff --git a/qbs-resources/imports/QbsProduct.qbs b/qbs-resources/imports/QbsProduct.qbs
index cd4fdf437..a90037bc6 100644
--- a/qbs-resources/imports/QbsProduct.qbs
+++ b/qbs-resources/imports/QbsProduct.qbs
@@ -2,6 +2,7 @@ import qbs
Product {
Depends { name: "qbsbuildconfig" }
+ Depends { name: "qbsversion" }
Depends { name: "Qt.core"; versionAtLeast: minimumQtVersion }
property string minimumQtVersion: "5.6.0"
property bool install: true
diff --git a/qbs-resources/modules/qbsversion/qbsversion.qbs b/qbs-resources/modules/qbsversion/qbsversion.qbs
new file mode 100644
index 000000000..ff1fd18f0
--- /dev/null
+++ b/qbs-resources/modules/qbsversion/qbsversion.qbs
@@ -0,0 +1,24 @@
+import qbs
+import qbs.File
+import qbs.FileInfo
+import qbs.TextFile
+
+Module {
+ Probe {
+ id: qbsVersionProbe
+ property var lastModified: File.lastModified(versionFilePath)
+ property string versionFilePath: FileInfo.joinPaths(path, "..", "..", "..", "VERSION")
+ property string version
+ configure: {
+ var tf = new TextFile(versionFilePath, TextFile.ReadOnly);
+ try {
+ version = tf.readAll().trim();
+ found = !!version;
+ } finally {
+ tf.close();
+ }
+ }
+ }
+
+ version: qbsVersionProbe.version
+}