aboutsummaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2023-06-26 10:55:09 +0200
committerEike Ziller <eike.ziller@qt.io>2023-06-26 11:32:22 +0000
commitac32f790f38eb91412183d5ced8caebdfd721a23 (patch)
tree8bfe0bb746b4118266fa0a187e65025e57f5194b /src/app
parent68bc2136444f4b940a142c9a650a69c15d496c02 (diff)
Qbs build: Fix app_version generation
Amends 6836caa14c247829bfd4edf47d31c87310d56211 which added a variable to app_version.h.cmake, but not to app_version.h.in. Fix by porting qbs to use app_version.h.cmake, which is the truth nowadays, instead of the app_version.h.in which originated from the qmake build. Change-Id: Ia9be53377a0bfded91ccd6ea1637eeda7fe9d5c8 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/app')
-rw-r--r--src/app/app_version.h.in54
-rw-r--r--src/app/app_version_header.qbs46
2 files changed, 21 insertions, 79 deletions
diff --git a/src/app/app_version.h.in b/src/app/app_version.h.in
deleted file mode 100644
index 605016b376..0000000000
--- a/src/app/app_version.h.in
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
-#pragma once
-
-namespace Core {
-namespace Constants {
-
-#define STRINGIFY_INTERNAL(x) #x
-#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
-
-const char IDE_DISPLAY_NAME[] = \"$${IDE_DISPLAY_NAME}\";
-const char IDE_ID[] = \"$${IDE_ID}\";
-const char IDE_CASED_ID[] = \"$${IDE_CASED_ID}\";
-
-#define IDE_VERSION $${QTCREATOR_VERSION}
-#define IDE_VERSION_STR STRINGIFY(IDE_VERSION)
-#define IDE_VERSION_DISPLAY_DEF $${QTCREATOR_DISPLAY_VERSION}
-#define IDE_VERSION_COMPAT_DEF $${QTCREATOR_COMPAT_VERSION}
-
-#define IDE_VERSION_MAJOR $$replace(QTCREATOR_VERSION, "^(\\d+)\\.\\d+\\.\\d+(-.*)?$", \\1)
-#define IDE_VERSION_MINOR $$replace(QTCREATOR_VERSION, "^\\d+\\.(\\d+)\\.\\d+(-.*)?$", \\1)
-#define IDE_VERSION_RELEASE $$replace(QTCREATOR_VERSION, "^\\d+\\.\\d+\\.(\\d+)(-.*)?$", \\1)
-
-const char IDE_VERSION_LONG[] = IDE_VERSION_STR;
-const char IDE_VERSION_DISPLAY[] = STRINGIFY(IDE_VERSION_DISPLAY_DEF);
-const char IDE_VERSION_COMPAT[] = STRINGIFY(IDE_VERSION_COMPAT_DEF);
-const char IDE_AUTHOR[] = \"The Qt Company Ltd\";
-const char IDE_YEAR[] = \"$${QTCREATOR_COPYRIGHT_YEAR}\";
-
-#ifdef IDE_REVISION
-const char IDE_REVISION_STR[] = STRINGIFY(IDE_REVISION);
-#else
-const char IDE_REVISION_STR[] = \"\";
-#endif
-
-const char IDE_REVISION_URL[] = \"$${IDE_REVISION_URL}\";
-
-// changes the path where the settings are saved to
-#ifdef IDE_SETTINGSVARIANT
-const char IDE_SETTINGSVARIANT_STR[] = STRINGIFY(IDE_SETTINGSVARIANT);
-#else
-const char IDE_SETTINGSVARIANT_STR[] = \"QtProject\";
-#endif
-
-#undef IDE_VERSION_COMPAT_DEF
-#undef IDE_VERSION_DISPLAY_DEF
-#undef IDE_VERSION
-#undef IDE_VERSION_STR
-#undef STRINGIFY
-#undef STRINGIFY_INTERNAL
-
-} // Constants
-} // Core
diff --git a/src/app/app_version_header.qbs b/src/app/app_version_header.qbs
index 110ec34540..4109f55f84 100644
--- a/src/app/app_version_header.qbs
+++ b/src/app/app_version_header.qbs
@@ -6,15 +6,10 @@ Product {
type: "hpp"
Group {
- files: ["app_version.h.in"]
+ files: ["app_version.h.cmakein"]
fileTags: ["hpp.in"]
}
- Group {
- name: "other"
- files: "app_version.h.cmakein"
- }
-
Depends { name: "qtc" }
Rule {
@@ -31,33 +26,34 @@ Product {
cmd.sourceCode = function() {
var file = new TextFile(input.filePath);
var content = file.readAll();
- // replace quoted quotes
- content = content.replace(/\\\"/g, '"');
// replace Windows line endings
if (onWindows)
content = content.replace(/\r\n/g, "\n");
// replace the magic qmake incantations
- content = content.replace(/(\n#define IDE_VERSION_DISPLAY_DEF) .+\n/, "$1 "
- + product.moduleProperty("qtc", "qtcreator_display_version") + "\n");
- content = content.replace(/(\n#define IDE_VERSION_COMPAT_DEF) .+\n/, "$1 "
- + product.moduleProperty("qtc", "qtcreator_compat_version") + "\n");
- content = content.replace(/(\n#define IDE_VERSION) .+\n/, "$1 "
- + product.moduleProperty("qtc", "qtcreator_version") + "\n");
- content = content.replace(/(\n#define IDE_VERSION_MAJOR) .+\n/, "$1 "
- + product.moduleProperty("qtc", "ide_version_major") + "\n");
- content = content.replace(/(\n#define IDE_VERSION_MINOR) .+\n/, "$1 "
- + product.moduleProperty("qtc", "ide_version_minor") + "\n");
- content = content.replace(/(\n#define IDE_VERSION_RELEASE) .+\n/, "$1 "
- + product.moduleProperty("qtc", "ide_version_release") + "\n");
- content = content.replace("$${QTCREATOR_COPYRIGHT_YEAR}",
+ content = content.replace("${IDE_VERSION_DISPLAY}",
+ product.moduleProperty("qtc", "qtcreator_display_version"));
+ content = content.replace("${IDE_VERSION_COMPAT}",
+ product.moduleProperty("qtc", "qtcreator_compat_version"));
+ content = content.replace("${PROJECT_VERSION}",
+ product.moduleProperty("qtc", "qtcreator_version"));
+ content = content.replace("${PROJECT_VERSION_MAJOR}",
+ product.moduleProperty("qtc", "ide_version_major"));
+ content = content.replace("${PROJECT_VERSION_MINOR}",
+ product.moduleProperty("qtc", "ide_version_minor"));
+ content = content.replace("${PROJECT_VERSION_PATCH}",
+ product.moduleProperty("qtc", "ide_version_release"));
+ content = content.replace("${IDE_COPYRIGHT_YEAR}",
product.moduleProperty("qtc", "qtcreator_copyright_year"));
- content = content.replace("$${IDE_DISPLAY_NAME}",
+ content = content.replace("${IDE_DISPLAY_NAME}",
product.moduleProperty("qtc", "ide_display_name"));
- content = content.replace("$${IDE_ID}",
+ content = content.replace("${IDE_ID}",
product.moduleProperty("qtc", "ide_id"));
- content = content.replace("$${IDE_CASED_ID}",
+ content = content.replace("${IDE_CASED_ID}",
product.moduleProperty("qtc", "ide_cased_id"));
- content = content.replace("$${PROJECT_USER_FILE_EXTENSION}",
+ content = content.replace(/\n#cmakedefine IDE_REVISION\n/, "");
+ content = content.replace("${IDE_REVISION_STR}", "");
+ content = content.replace("${IDE_REVISION_URL}", "");
+ content = content.replace("${PROJECT_USER_FILE_EXTENSION}",
product.moduleProperty("qtc", "ide_user_file_extension"));
file = new TextFile(output.filePath, TextFile.WriteOnly);
file.truncate();