qbs-src-2.6.1/ 0000755 0001751 0000166 00000000000 14776170045 012450 5 ustar runner docker qbs-src-2.6.1/LICENSE.LGPLv3 0000644 0001751 0000166 00000017560 14776170045 014474 0 ustar runner docker GNU LESSER GENERAL PUBLIC LICENSE
The Qt Toolkit is Copyright (C) 2015 The Qt Company Ltd.
Contact: http://www.qt.io/licensing
You may use, distribute and copy the Qt GUI Toolkit under the terms of
GNU Lesser General Public License version 3, which is displayed below.
-------------------------------------------------------------------------
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies of this
licensedocument, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, “this License” refers to version 3 of the GNU Lesser
General Public License, and the “GNU GPL” refers to version 3 of the
GNU General Public License.
“The Library” refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An “Application” is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A “Combined Work” is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the “Linked
Version”.
The “Minimal Corresponding Source” for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The “Corresponding Application Code” for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort
to ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this
license document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that, taken
together, effectively do not restrict modification of the portions of
the Library contained in the Combined Work and reverse engineering for
debugging such modifications, if you also do each of the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this
license document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of
this License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with
the Library. A suitable mechanism is one that (a) uses at run
time a copy of the Library already present on the user's
computer system, and (b) will operate properly with a modified
version of the Library that is interface-compatible with the
Linked Version.
e) Provide Installation Information, but only if you would
otherwise be required to provide such information under section 6
of the GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the Application
with a modified version of the Linked Version. (If you use option
4d0, the Installation Information must accompany the Minimal
Corresponding Source and Corresponding Application Code. If you
use option 4d1, you must provide the Installation Information in
the manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the Library
side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities, conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of
it is a work based on the Library, and explaining where to find
the accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
as you received it specifies that a certain numbered version of the
GNU Lesser General Public License “or any later version” applies to
it, you have the option of following the terms and conditions either
of that published version or of any later version published by the
Free Software Foundation. If the Library as you received it does not
specify a version number of the GNU Lesser General Public License,
you may choose any version of the GNU Lesser General Public License
ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the Library.
qbs-src-2.6.1/docker-compose.yml 0000644 0001751 0000166 00000006035 14776170045 016111 0 ustar runner docker version: "3.7"
x-default-service: &linux
working_dir: /qbs
environment:
- BUILD_OPTIONS
- QTEST_FUNCTION_TIMEOUT
- QBS_AUTOTEST_PROFILE
- QBS_TEST_SOURCE_ROOT
- WITH_ARCHIVE
- WITH_TESTS
- CLCACHE_DIR
volumes:
- .:/qbs
- ~/.ccache:/home/devel/.ccache
- /cores:/cores
network_mode: bridge
cap_add:
- SYS_PTRACE
ulimits:
core:
soft: -1
hard: -1
services:
noble-qt6: &noble-qt6
<< : *linux
hostname: noble-qt6
image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-qt6-6.5.3_2.3.2-0
build:
dockerfile: docker/noble/Dockerfile
context: .
args:
QT_VERSION: 6.5.3
QTCREATOR_VERSION: 13.0.2
noble:
<< : *noble-qt6
noble-qt5:
<< : *linux
hostname: noble-qt5
image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-5.15.2_2.3.2-0
build:
dockerfile: docker/noble/Dockerfile
context: .
args:
QT_VERSION: 5.15.2
QTCREATOR_VERSION: 13.0.2
noble-android-65:
<< : *linux
hostname: noble-android
image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-android-6.5.0-0
build:
dockerfile: docker/noble/test-android.Dockerfile
context: .
args:
QT_VERSION: 6.5.0
ANDROID_NDK_VERSION: 25.1.8937393
noble-android-515:
<< : *linux
hostname: noble-android
image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-android-5.15.2-0
build:
dockerfile: docker/noble/test-android.Dockerfile
context: .
args:
QT_VERSION: 5.15.2
ANDROID_NDK_VERSION: 23.0.7599858
noble-android-ndk-r25:
<< : *linux
hostname: noble-android
image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-android-ndk-r25-0
build:
dockerfile: docker/noble/test-android-no-qt.Dockerfile
context: .
args:
ANDROID_NDK_VERSION: 25.1.8937393
noble-baremetal:
<< : *linux
hostname: noble-baremetal
image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-baremetal-0
build:
dockerfile: docker/noble/test-baremetal.Dockerfile
context: .
noble-qt6-wasm:
<< : *linux
hostname: noble-qt6-wasm
image: ${DOCKER_USER:-qbsbuild}/qbsdev:noble-qt6-wasm-6.7.0-0
build:
dockerfile: docker/noble/test-qt6-wasm.Dockerfile
context: .
args:
QT_VERSION: 6.7.0
EMSCRIPTEN_VERSION: 3.1.50
leap:
<< : *linux
hostname: leap
image: ${DOCKER_USER:-qbsbuild}/qbsdev:leap-5.15.2_1.20.1-1
build:
dockerfile: docker/leap/Dockerfile
context: .
args:
QT_VERSION: 5.15.2
QTCREATOR_VERSION: 5.0.3
windows:
image: ${DOCKER_USER:-qbsbuild}/qbsdev:windowsservercore-6.6.0_1.24.0-0
build:
dockerfile: docker/windowsservercore/Dockerfile
context: .
args:
QT_VERSION: 6.6.0
QTCREATOR_VERSION: 9.0.1
working_dir: 'C:/qbs'
environment:
- BUILD_OPTIONS
- WITH_DOCS
volumes:
- type: bind
source: .
target: C:\qbs
- type: bind
source: ~/.ccache
target: C:\.ccache
network_mode: nat
qbs-src-2.6.1/CONTRIBUTING.md 0000644 0001751 0000166 00000007411 14776170045 014704 0 ustar runner docker # Contributing to Qbs
The main source code repository is hosted at
[codereview.qt-project.org](https://codereview.qt-project.org/q/project:qbs/qbs).
The Qbs source code is also mirrored on [code.qt.io](https://code.qt.io/cgit/qbs/qbs.git/)
and on [GitHub](https://github.com/qbs/qbs). Please note that those mirrors
are read-only and we do not accept pull-requests on GitHub. However, we gladly
accept contributions via [Gerrit](https://codereview.qt-project.org/q/project:qbs/qbs).
This document briefly describes steps required to be able to propose changes
to the Qbs project.
See the [Qt Contribution Guidelines](https://wiki.qt.io/Qt_Contribution_Guidelines)
page, [Setting up Gerrit](https://wiki.qt.io/Setting_up_Gerrit) and
[Gerrit Introduction](https://wiki.qt.io/Gerrit_Introduction) for more
details about how to upload patches to Gerrit.
## Preparations
* [Set up](https://wiki.qt.io/Setting_up_Gerrit#How_to_get_started_-_Gerrit_registration)
a Gerrit account
* Tweak your SSH config as instructed [here](https://wiki.qt.io/Setting_up_Gerrit#Local_Setup)
* Use the recommended Git settings, defined [here](https://wiki.qt.io/Setting_up_Gerrit#Configuring_Git)
* Get the source code as described below
## Cloning Qbs
Clone Qbs from the [code.qt.io](https://code.qt.io/cgit/qbs/qbs.git/) mirror
```
git clone git://code.qt.io/qbs/qbs.git
```
Alternatively, you can clone from the mirror on the [GitHub](https://github.com/qbs/qbs)
```
git clone https://github.com/qbs/qbs.git
```
Set up the Gerrit remote
```
git remote add gerrit ssh://@codereview.qt-project.org:29418/qbs/qbs
```
## Setting up git hooks
Install the hook generating Commit-Id files into your top level project directory:
```
gitdir=$(git rev-parse --git-dir); scp -p -P 29418 codereview.qt-project.org:hooks/commit-msg "${gitdir}/hooks/"
```
This hook automatically adds a "Change-Id: …" line to the commit message. Change-Id is used
to identify new Patch Sets for existing
[Changes](https://wiki.qt.io/Gerrit_Introduction#Terminology).
## Making changes
Commit your changes in the usual way you do in Git.
After making changes, you might want to ensure that Qbs can be built and autotests pass:
```
qbs build -p autotest-runner
```
See ["Appendix A: Building Qbs"](http://doc.qt.io/qbs/building-qbs.html) for details.
In case your changes might significantly affect performance (in either way), the
'qbs_benchmarker' tool can be used (Linux only, requires Valgrind to be installed):
```
qbs_benchmarker -r -o -n -a -p
```
Use 'qbs_benchmarker --help' for details.
## Pushing your changes to Gerrit
After committing your changes locally, push them to Gerrit
```
git push gerrit HEAD:refs/for/master
```
Gerrit will print a URL that can be used to access the newly created Change.
## Adding reviewers
Use the "ADD REVIEWER" button on the Change's web page to ask people to do the
review. To find possible reviewers, you can examine the Git history with
'git log' and/or 'git blame' or ask on the mailing list: qbs@qt-project.org
## Modifying Commits
During the review process, it might be necessary to do some changes to the commit.
To include you changes in the last commit, use
```
git commit --amend
```
This will edit the last commit instead of creating a new one. Make sure to preserve the
Change-Id footer when amending commits. For details, see
[Updating a Contribution With New Code](https://wiki.qt.io/Gerrit_Introduction#Updating_a_Contribution_With_New_Code)
## Abandoning changes
Changes which are inherently flawed or became inapplicable should be abandoned. You can do that
on the Change's web page with the "ABANDON" button. Make sure to remove the abandoned commit
from your working copy by using '[git reset](https://git-scm.com/docs/git-reset)'.
qbs-src-2.6.1/share/ 0000755 0001751 0000166 00000000000 14776170045 013552 5 ustar runner docker qbs-src-2.6.1/share/qbs/ 0000755 0001751 0000166 00000000000 14776170045 014337 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/ 0000755 0001751 0000166 00000000000 14776170045 016034 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/ 0000755 0001751 0000166 00000000000 14776170045 016621 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/WindowsUtils/ 0000755 0001751 0000166 00000000000 14776170045 021274 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/WindowsUtils/windows-utils.js 0000644 0001751 0000166 00000006624 14776170045 024472 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
function winapiFamilyDefine(name) {
return {
"desktop": "DESKTOP_APP",
"phone": "PHONE_APP",
"pc": "PC_APP",
"server": "SERVER",
"system": "SYSTEM"
}[name];
}
function winapiPartitionDefine(name) {
return {
"app": "APP",
"desktop": "DESKTOP",
"phone": "PHONE_APP",
"pc": "PC_APP",
"server": "SERVER",
"system": "SYSTEM"
}[name];
}
function characterSetDefines(charset) {
var defines = [];
if (charset === "unicode")
defines.push("UNICODE", "_UNICODE");
else if (charset === "mbcs")
defines.push("_MBCS");
return defines;
}
function canonicalizeVersion(version) {
switch (version) {
case "7":
return "6.1";
case "8":
return "6.2";
case "8.1":
return "6.3";
default:
return version;
}
}
function knownWindowsVersions() {
// Add new Windows versions to this list when they are released
return ['10.0', '6.3', '6.2', '6.1', '6.0', '5.2', '5.1', '5.0', '4.0'];
}
function isValidWindowsVersion(systemVersion) {
var realVersions = knownWindowsVersions();
for (i in realVersions)
if (systemVersion === realVersions[i])
return true;
return false;
}
function getWindowsVersionInFormat(systemVersion, format) {
if (!systemVersion)
return undefined;
var major = parseInt(systemVersion.split('.')[0], 10);
var minor = parseInt(systemVersion.split('.')[1], 10);
switch (format) {
case "hex":
// https://msdn.microsoft.com/en-us/library/6sehtctf.aspx
return "0x" + ("0000" + ((major << 8) | minor).toString(16)).slice(-4);
case "subsystem":
// https://msdn.microsoft.com/en-us/library/fcc1zstk.aspx
return major + '.' + (minor < 10 ? '0' : '') + minor;
default:
throw ("Unrecognized Windows version format " + format + ". Must be in {hex, subsystem}.");
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/DarwinTools/ 0000755 0001751 0000166 00000000000 14776170045 021066 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/DarwinTools/darwin-tools.js 0000644 0001751 0000166 00000023552 14776170045 024055 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var Utilities = require("qbs.Utilities");
var _deviceMap = {
"mac": undefined, // only devices have an ID
"iphone": 1,
"ipad": 2,
"tv": 3,
"watch": 4,
"car": 5
};
var _platformMap = {
"ios": "iPhone",
"macos": "MacOSX",
"tvos": "AppleTV",
"watchos": "Watch"
};
var _platformDeviceMap = {
"ios": ["iphone", "ipad"],
"macos": ["mac"],
"tvos": ["tv"],
"watchos": ["watch"]
}
/**
* Returns the numeric identifier corresponding to an Apple device name
* (i.e. for use by TARGETED_DEVICE_FAMILY).
*/
function appleDeviceNumber(deviceName) {
return _deviceMap[deviceName];
}
/**
* Returns the list of target devices available for the given qbs target OS list.
*/
function targetDevices(targetOS) {
for (var key in _platformDeviceMap) {
if (targetOS.contains(key))
return _platformDeviceMap[key];
}
}
/**
* Returns the TARGETED_DEVICE_FAMILY string given a list of target device names.
*/
function targetedDeviceFamily(deviceNames) {
return deviceNames.map(function (deviceName) {
return appleDeviceNumber(deviceName);
});
}
/**
* Returns the most appropriate Apple platform name given a targetOS list.
*/
function applePlatformName(targetOSList, platformType) {
return applePlatformDirectoryName(targetOSList, platformType).toLowerCase();
}
/**
* Returns the most appropriate Apple platform directory name given a targetOS list and version.
*/
function applePlatformDirectoryName(targetOSList, platformType, version, throwOnError) {
var suffixMap = {
"device": "OS",
"simulator": "Simulator"
};
for (var key in _platformMap) {
if (targetOSList.contains(key)) {
// there are no MacOSXOS or MacOSXSimulator platforms
var suffix = (key !== "macos") ? (suffixMap[platformType] || "") : "";
return _platformMap[key] + suffix + (version || "");
}
}
if (throwOnError || throwOnError === undefined)
throw("No Apple platform corresponds to target OS list: " + targetOSList);
}
/**
* Returns the localization of the resource at the given path,
* or undefined if the path does not contain an {xx}.lproj path segment.
*/
function localizationKey(path) {
return _resourceFileProperties(path)[0];
}
/**
* Returns the path of a localized resource at the given path,
* relative to its containing {xx}.lproj directory, or '.'
* if the resource is unlocalized (not contained in an lproj directory).
*/
function relativeResourcePath(path) {
return _resourceFileProperties(path)[1];
}
function _resourceFileProperties(path) {
var lprojKey = ".lproj/";
var lproj = path.indexOf(lprojKey);
if (lproj >= 0) {
// The slash preceding XX.lproj
var slashIndex = path.slice(0, lproj).lastIndexOf('/');
if (slashIndex >= 0) {
var localizationKey = path.slice(slashIndex + 1, lproj);
var relativeResourcePath = FileInfo.path(path.slice(lproj + lprojKey.length));
return [ localizationKey, relativeResourcePath ];
}
}
return [ undefined, '.' ];
}
var PropertyListVariableExpander = (function () {
function PropertyListVariableExpander() {
}
/**
* Recursively perform variable replacements in an environment dictionary.
*/
PropertyListVariableExpander.prototype.expand = function (obj, env) {
var $this = this;
// Possible syntaxes for wrapping an environment variable name
var syntaxes = [
{"open": "${", "close": "}"},
{"open": "$(", "close": ")"},
{"open": "@", "close": "@"}
];
/**
* Finds the first index of a replacement starting with one of the supported syntaxes
* This is needed so we don't do recursive substitutions
*/
function indexOfReplacementStart(syntaxes, str) {
var syntax;
var idx = -1;
for (var i in syntaxes) {
var j;
// normal case - we search for the last occurrence to do a correct replacement
// for nested variables, e.g. ${VAR1_${VAR2}}. This doesn't work in case
// when start == end, e.g. @VAR@ - in that case we search from the start
if (syntaxes[i].open !== syntaxes[i].close)
j = str.lastIndexOf(syntaxes[i].open);
else
j = str.indexOf(syntaxes[i].open);
if (j > idx) {
syntax = syntaxes[i];
idx = j;
}
}
return { "syntax": syntax, "index": idx };
}
function expandString(key, str, env, seenVars) {
if (!str)
return str;
var repl = indexOfReplacementStart(syntaxes, str);
var i = repl.index;
while (i !== -1) {
var j = str.indexOf(repl.syntax.close, i + repl.syntax.open.length);
if (j === -1)
return str;
var varParts = str.slice(i + repl.syntax.open.length, j).split(':');
var varName = varParts[0];
var varFormatter = varParts[1];
var envValue = env[varName];
// if we end up expanding the same variable again, break the recursion
if (seenVars.indexOf(varName) !== -1)
envValue = "";
else
seenVars.push(varName);
var varValue = expandString(key, envValue, env, seenVars);
seenVars.pop();
if (undefined === varValue) {
// skip replacement
if ($this.undefinedVariableFunction)
$this.undefinedVariableFunction(key, varName);
varValue = "";
}
varValue = String(varValue);
if (varFormatter !== undefined) {
// TODO: XCode supports multiple formatters separated by a comma
var varFormatterLower = varFormatter.toLowerCase();
if (varFormatterLower === "rfc1034identifier" || varFormatterLower === "identifier")
varValue = Utilities.rfc1034Identifier(varValue);
if (varValue === "" && varFormatterLower.startsWith("default="))
varValue = varFormatter.split("=")[1];
}
str = str.slice(0, i) + varValue + str.slice(j + repl.syntax.close.length);
repl = indexOfReplacementStart(syntaxes, str);
i = repl.index;
}
return str;
}
function expandRecursive(obj, env, checked) {
checked.push(obj);
for (var key in obj) {
var value = obj[key];
var type = typeof(value);
if (type === "object") {
if (checked.indexOf(value) !== -1)
continue;
expandRecursive(value, env, checked);
}
if (type !== "string")
continue;
var expandedValue = expandString(key, value, env, []);
if (expandedValue !== value)
obj[key] = expandedValue;
}
}
expandRecursive(obj, env, []);
return obj;
};
return PropertyListVariableExpander;
}());
/**
* JSON.stringify(expandPlistEnvironmentVariables({a:"$(x)3$$(y)",b:{t:"%$(y) $(k)"}},
* {x:"X",y:"Y"}, true))
* Warning undefined variable k in variable expansion
* => {"a":"X3$Y","b":{"t":"%Y $(k)"}}
*/
function expandPlistEnvironmentVariables(obj, env, warn) {
var expander = new PropertyListVariableExpander();
expander.undefinedVariableFunction = function (key, varName) {
if (warn)
console.warn("undefined variable " + varName + " in variable expansion");
};
return expander.expand(obj, env);
}
/**
* Recursively removes any undefined, null, or empty string values from the property list.
*/
function cleanPropertyList(plist) {
if (typeof(plist) !== "object")
return;
for (var key in plist) {
if (plist[key] === undefined || plist[key] === null || plist[key] === "")
delete plist[key];
else
cleanPropertyList(plist[key]);
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/PathTools/ 0000755 0001751 0000166 00000000000 14776170045 020536 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/PathTools/path-tools.js 0000644 0001751 0000166 00000024731 14776170045 023175 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
function _bundleExecutableTemporaryFilePath(product, variantSuffix) {
if (variantSuffix === undefined)
variantSuffix = product.cpp.variantSuffix;
return ".tmp/" + FileInfo.fileName(bundleExecutableFilePath(product, variantSuffix));
}
function bundleExecutableFilePath(product, variantSuffix) {
if (variantSuffix === undefined)
variantSuffix = product.cpp.variantSuffix;
return product.moduleProperty("bundle", "executablePath") + (variantSuffix || "");
}
function applicationFilePath(product, variantSuffix) {
if (variantSuffix === undefined)
variantSuffix = product.cpp.variantSuffix;
if (product.moduleProperty("bundle", "isBundle"))
return _bundleExecutableTemporaryFilePath(product, variantSuffix);
return product.moduleProperty("cpp", "executablePrefix")
+ product.targetName + (variantSuffix || "")
+ product.moduleProperty("cpp", "executableSuffix");
}
function loadableModuleFilePath(product, variantSuffix) {
if (variantSuffix === undefined)
variantSuffix = product.cpp.variantSuffix;
if (product.moduleProperty("bundle", "isBundle"))
return _bundleExecutableTemporaryFilePath(product, variantSuffix);
return product.moduleProperty("cpp", "loadableModulePrefix")
+ product.targetName + (variantSuffix || "")
+ product.moduleProperty("cpp", "loadableModuleSuffix");
}
function staticLibraryFilePath(product, variantSuffix) {
if (variantSuffix === undefined)
variantSuffix = product.cpp.variantSuffix;
if (product.moduleProperty("bundle", "isBundle"))
return _bundleExecutableTemporaryFilePath(product, variantSuffix);
return product.moduleProperty("cpp", "staticLibraryPrefix")
+ product.targetName + (variantSuffix || "")
+ product.moduleProperty("cpp", "staticLibrarySuffix");
}
function dynamicLibraryFilePath(product, variantSuffix, version, maxParts) {
if (variantSuffix === undefined)
variantSuffix = product.cpp.variantSuffix;
if (product.moduleProperty("bundle", "isBundle"))
return _bundleExecutableTemporaryFilePath(product, variantSuffix);
// If no override version was given, use the product's version
// We specifically want to differentiate between undefined and i.e.
// empty string as empty string should be taken to mean "no version"
// and undefined should be taken to mean "use the product's version"
// (which could still end up being "no version")
if (version === undefined)
version = product.moduleProperty("cpp", "internalVersion");
// If we have a version number, potentially strip off some components
if (maxParts === 0)
version = undefined;
else if (maxParts && version)
version = version.split('.').slice(0, maxParts).join('.');
// Start with prefix + name (i.e. libqbs, qbs)
var fileName = product.moduleProperty("cpp", "dynamicLibraryPrefix")
+ product.targetName
+ (variantSuffix || "");
// For Mach-O images, append the version number if there is one (i.e. libqbs.1.0.0)
var imageFormat = product.moduleProperty("cpp", "imageFormat");
if (version && imageFormat === "macho") {
fileName += "." + version;
version = undefined;
}
fileName += product.moduleProperty("cpp", "archSuffix");
// Append the suffix (i.e. libqbs.1.0.0.dylib, libqbs.so, qbs.dll)
fileName += product.moduleProperty("cpp", "dynamicLibrarySuffix");
// For ELF images, append the version number if there is one (i.e. libqbs.so.1.0.0)
if (version && (imageFormat === "elf" || imageFormat === "wasm"))
fileName += "." + version;
return fileName;
}
function linkerOutputFilePath(fileTag, product, variantSuffix, version, maxParts) {
switch (fileTag) {
case "application":
return applicationFilePath(product, variantSuffix);
case "loadablemodule":
return loadableModuleFilePath(product, variantSuffix);
case "staticlibrary":
return staticLibraryFilePath(product, variantSuffix);
case "dynamiclibrary":
return dynamicLibraryFilePath(product, variantSuffix, version, maxParts);
default:
throw new Error("Unknown linker output file tag: " + fileTag);
}
}
function importLibraryFilePath(product) {
return product.moduleProperty("cpp", "dynamicLibraryPrefix")
+ product.targetName
+ (product.cpp.variantSuffix || "")
+ product.moduleProperty("cpp", "dynamicLibraryImportSuffix");
}
function debugInfoIsBundle(product) {
if (!product.moduleProperty("qbs", "targetOS").contains("darwin"))
return false;
var flags = product.moduleProperty("cpp", "dsymutilFlags") || [];
return !flags.contains("-f") && !flags.contains("--flat");
}
function debugInfoFileName(product, variantSuffix, fileTag) {
var suffix = "";
// For dSYM bundles, the DWARF debug info file has no suffix
if (!product.moduleProperty("qbs", "targetOS").contains("darwin")
|| !debugInfoIsBundle(product))
suffix = product.moduleProperty("cpp", "debugInfoSuffix");
if (product.qbs.toolchain.includes("emscripten"))
return product.targetName + ".wasm.debug.wasm";
if (product.moduleProperty("bundle", "isBundle")) {
return FileInfo.fileName(bundleExecutableFilePath(product, variantSuffix)) + suffix;
} else {
switch (fileTag) {
case "application":
return applicationFilePath(product, variantSuffix) + suffix;
case "dynamiclibrary":
return dynamicLibraryFilePath(product, variantSuffix) + suffix;
case "loadablemodule":
return loadableModuleFilePath(product, variantSuffix) + suffix;
case "staticlibrary":
return staticLibraryFilePath(product, variantSuffix) + suffix;
default:
return product.targetName + (variantSuffix || "") + suffix;
}
}
}
function debugInfoBundlePath(product, fileTag) {
if (!debugInfoIsBundle(product))
return undefined;
var suffix = product.moduleProperty("cpp", "debugInfoBundleSuffix");
if (product.moduleProperty("qbs", "targetOS").contains("darwin")
&& product.moduleProperty("bundle", "isBundle"))
return product.moduleProperty("bundle", "bundleName") + suffix;
return debugInfoFileName(product, undefined, fileTag) + suffix;
}
function debugInfoFilePath(product, variantSuffix, fileTag) {
var name = debugInfoFileName(product, variantSuffix, fileTag);
if (product.moduleProperty("qbs", "targetOS").contains("darwin") && debugInfoIsBundle(product)) {
return FileInfo.joinPaths(debugInfoBundlePath(product, fileTag),
"Contents", "Resources", "DWARF", name);
} else if (product.moduleProperty("bundle", "isBundle")) {
return FileInfo.joinPaths(product.moduleProperty("bundle", "executableFolderPath"), name);
}
return name;
}
function debugInfoPlistFilePath(product, fileTag) {
if (!debugInfoIsBundle(product))
return undefined;
return FileInfo.joinPaths(debugInfoBundlePath(product, fileTag), "Contents", "Info.plist");
}
// Returns whether the string looks like a library filename
function isLibraryFileName(product, fileName, prefix, suffixes, isShared) {
var suffix, i;
var os = product.moduleProperty("qbs", "targetOS");
for (i = 0; i < suffixes.length; ++i) {
suffix = suffixes[i];
if (isShared && os.contains("unix") && !os.contains("darwin"))
suffix += "(\\.[0-9]+){0,3}";
if (fileName.match("^" + prefix + ".+?\\" + suffix + "$"))
return true;
}
return false;
}
function frameworkExecutablePath(frameworkPath) {
var suffix = ".framework";
var isAbsoluteFrameworkPath = frameworkPath.slice(-suffix.length) === suffix;
if (isAbsoluteFrameworkPath) {
var frameworkName = FileInfo.fileName(frameworkPath).slice(0, -suffix.length);
return FileInfo.joinPaths(frameworkPath, frameworkName);
}
return undefined;
}
// pathList is also a string, using the respective separator
function prependOrSetPath(path, pathList, separator) {
if (!pathList || pathList.length === 0)
return path;
return path + separator + pathList;
}
function librarySuffixes(targetOS, types, forImport) {
if (targetOS.includes("windows")) {
if (forImport) {
return []
.concat(types.includes("shared") ? [".lib"] : [])
// mingw uses .a for static libs
.concat(types.includes("static") ? [".lib", ".a"] : []);
}
return [].concat(types.includes("shared") ? [".dll"] : []);
}
if (targetOS.includes("darwin")) {
return []
.concat(types.includes("shared") ? [".dylib"] : [])
.concat(types.includes("static") ? [".a"] : []);
}
return []
.concat(types.includes("shared") ? [".so"] : [])
.concat(types.includes("static") ? [".a"] : []);
}
function libraryNameFilter() {
return function(name) { return [name, "lib" + name]; }
}
qbs-src-2.6.1/share/qbs/imports/qbs/ModUtils/ 0000755 0001751 0000166 00000000000 14776170045 020361 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/ModUtils/utils.js 0000644 0001751 0000166 00000062445 14776170045 022072 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Process = require("qbs.Process");
var TemporaryDir = require("qbs.TemporaryDir");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function mergeCFiles(inputs, outputFilePath)
{
var f = new TextFile(outputFilePath, TextFile.WriteOnly);
try {
for (var i = 0; i < inputs.length; ++i)
f.writeLine('#include ' + Utilities.cStringQuote(inputs[i].filePath));
} finally {
f.close();
}
}
function sanitizedList(list, product, fullPropertyName) {
if (!(list instanceof Array))
return list;
var filterFunc = function(elem) {
if (typeof elem === "string" && elem.length === 0) {
var msg = "Removing empty string from value of property '" + fullPropertyName + "'";
// product might actually be a module
if (product.name)
msg += " in product '" + product.name + "'.";
console.warn(msg);
return false;
}
return true;
}
return list.filter(filterFunc);
}
function checkCompatibilityMode(project, minimumQbsVersion, message) {
if (Utilities.versionCompare(project.minimumQbsVersion || "1.3", minimumQbsVersion) < 0) {
console.warn([message || "",
"This message can be silenced by setting your Project's " +
"minimumQbsVersion to " + minimumQbsVersion +
" (and the new behavior will take effect)."].join(" "));
return true;
}
return false;
}
function artifactInstalledFilePath(artifact) {
var relativeInstallDir = artifact.moduleProperty("qbs", "installDir");
var installPrefix = artifact.moduleProperty("qbs", "installPrefix");
var installSourceBase = artifact.moduleProperty("qbs", "installSourceBase");
var targetDir = FileInfo.joinPaths(artifact.moduleProperty("qbs", "installRoot"),
installPrefix, relativeInstallDir);
if (installSourceBase) {
if (!FileInfo.isAbsolutePath(installSourceBase))
throw "installSourceBase is not an absolute path";
if (!artifact.filePath.startsWith(installSourceBase))
throw "artifact file path doesn't start with the value of qbs.installSourceBase";
return FileInfo.joinPaths(targetDir, artifact.filePath.substr(installSourceBase.length));
}
return FileInfo.joinPaths(targetDir, artifact.fileName);
}
/**
* Given a list of file tags, returns the file tag (one of [c, cpp, objc, objcpp])
* corresponding to the C-family language the file should be compiled as.
*
* If no such tag is found, undefined is returned. If more than one match is
* found, an exception is thrown.
*/
function fileTagForTargetLanguage(fileTags) {
var srcTags = ["c", "cpp", "objc", "objcpp", "asm", "asm_cpp", "cppm"];
var pchTags = ["c_pch", "cpp_pch", "objc_pch", "objcpp_pch"];
var canonicalTag = undefined;
var foundTagCount = 0;
for (var i = 0; i < fileTags.length; ++i) {
var idx = srcTags.indexOf(fileTags[i]);
if (idx === -1)
idx = pchTags.indexOf(fileTags[i]);
if (idx !== -1) {
canonicalTag = srcTags[idx];
if (++foundTagCount > 1)
break;
}
}
if (foundTagCount > 1)
throw ("source files cannot be identified as more than one language");
return foundTagCount == 1 ? canonicalTag : undefined;
}
/**
* Returns the name of a language-specific property given the file tag
* for that property, and the base property name.
*
* If \a fileTag is undefined, the language-agnostic property name is returned.
*/
function languagePropertyName(propertyName, fileTag) {
if (!fileTag)
fileTag = "common";
var asm = {
"flags": "assemblerFlags",
"platformFlags": "platformAssemblerFlags"
};
var map = {
"c": {
"flags": "cFlags",
"platformFlags": "platformCFlags",
"usePrecompiledHeader": "useCPrecompiledHeader"
},
"cpp": {
"flags": "cxxFlags",
"platformFlags": "platformCxxFlags",
"usePrecompiledHeader": "useCxxPrecompiledHeader"
},
"objc": {
"flags": "objcFlags",
"platformFlags": "platformObjcFlags",
"usePrecompiledHeader": "useObjcPrecompiledHeader"
},
"objcpp": {
"flags": "objcxxFlags",
"platformFlags": "platformObjcxxFlags",
"usePrecompiledHeader": "useObjcxxPrecompiledHeader"
},
"common": {
"flags": "commonCompilerFlags",
"platformFlags": "platformCommonCompilerFlags"
},
"asm": asm,
"asm_cpp": asm
};
var lang = map[fileTag];
if (!lang)
return propertyName;
return lang[propertyName] || propertyName;
}
function modulePropertiesFromArtifacts(product, artifacts, moduleName, propertyName, langFilter) {
var result = product.moduleProperty(
moduleName, languagePropertyName(propertyName, langFilter)) || [];
for (var i in artifacts) {
var artifactProp = artifacts[i].moduleProperty(
moduleName, languagePropertyName(propertyName, langFilter));
if (artifactProp)
result = result.concat(artifactProp);
}
return sanitizedList(result, product, moduleName + "." + propertyName);
}
function moduleProperty(product, propertyName, langFilter)
{
return sanitizedModuleProperty(product, product.moduleName, propertyName, langFilter);
}
function sanitizedModuleProperty(obj, moduleName, propertyName, langFilter) {
return sanitizedList(obj.moduleProperty(moduleName,
languagePropertyName(propertyName, langFilter)),
obj, moduleName + "." + propertyName);
}
/**
* Returns roughly the same value as moduleProperty for a product, but ensures that all of the
* given input artifacts share the same value of said property, as a sort of sanity check.
*
* This allows us to verify that users do not, for example, try to set different values on input
* artifacts for which the value is input specific (not product specific), but which must be the
* same for all inputs.
*/
function modulePropertyFromArtifacts(product, artifacts, moduleName, propertyName, langFilter) {
var values = [product.moduleProperty(moduleName, languagePropertyName(propertyName, langFilter))];
for (var i in artifacts) {
var value = artifacts[i].moduleProperty(moduleName, languagePropertyName(propertyName, langFilter));
if (!values.contains(value)) {
values.push(value);
}
}
if (values.length !== 1) {
throw "The value of " + [moduleName, propertyName].join(".")
+ " must be identical for the following input artifacts: "
+ artifacts.map(function (artifact) { return artifact.filePath; });
}
return values[0];
}
function concatAll() {
var result = [];
for (var i = 0; i < arguments.length; ++i) {
var arg = arguments[i];
if (arg === undefined)
continue;
else if (arg instanceof Array)
result = result.concat(arg);
else
result.push(arg);
}
return result;
}
function allFileTags(fileTaggers) {
var tags = [];
for (var ext in fileTaggers)
tags = tags.uniqueConcat(fileTaggers[ext]);
return tags;
}
/**
* Flattens a dictionary (string keys to strings)
* into a string list containing items like \c key=value1
*/
function flattenDictionary(dict, separator) {
separator = separator || "=";
var list = [];
for (var i in dict) {
var value = i;
if (dict[i] !== undefined) // allow differentiation between undefined and empty string
value += separator + dict[i];
list.push(value);
}
return list;
}
function ModuleError(message) {
var e = new Error(message);
e.fileName = "";
return e;
}
var EnvironmentVariable = (function () {
function EnvironmentVariable(name, separator, convertPathSeparators) {
if (!name)
throw "EnvironmentVariable c'tor needs a name as first argument.";
this.name = name;
this.value = Environment.getEnv(name) || "";
this.separator = separator || "";
this.convertPathSeparators = convertPathSeparators || false;
}
EnvironmentVariable.prototype.prepend = function (v) {
if (this.value.length > 0 && this.value.charAt(0) !== this.separator)
this.value = this.separator + this.value;
if (this.convertPathSeparators)
v = FileInfo.toWindowsSeparators(v);
this.value = v + this.value;
};
EnvironmentVariable.prototype.append = function (v) {
if (this.value.length > 0)
this.value += this.separator;
if (this.convertPathSeparators)
v = FileInfo.toWindowsSeparators(v);
this.value += v;
};
EnvironmentVariable.prototype.set = function () {
Environment.putEnv(this.name, this.value);
};
EnvironmentVariable.prototype.unset = function () {
Environment.unsetEnv(this.name);
};
return EnvironmentVariable;
})();
var PropertyValidator = (function () {
function PropertyValidator(moduleName) {
this.requiredProperties = {};
this.propertyValidators = [];
if (!moduleName)
throw "PropertyValidator c'tor needs a module name as a first argument.";
this.moduleName = moduleName;
}
PropertyValidator.prototype.setRequiredProperty = function (propertyName, propertyValue, message) {
this.requiredProperties[propertyName] = { propertyValue: propertyValue, message: message };
};
PropertyValidator.prototype.addRangeValidator = function (propertyName, propertyValue, min, max, allowFloats) {
var message = [];
if (min !== undefined)
message.push(">= " + min);
if (max !== undefined)
message.push("<= " + max);
this.addCustomValidator(propertyName, propertyValue, function (value) {
if (typeof value !== "number")
return false;
if (!allowFloats && value % 1 !== 0)
return false;
if (min !== undefined && value < min)
return false;
if (max !== undefined && value > max)
return false;
return true;
}, "must be " + (!allowFloats ? "an integer " : "") + message.join(" and ")
+ ", actual value: " + propertyValue);
};
PropertyValidator.prototype.addVersionValidator = function (propertyName, propertyValue, minComponents, maxComponents, allowSuffixes) {
if (minComponents !== undefined && (typeof minComponents !== "number" || minComponents % 1 !== 0 || minComponents < 1))
throw "minComponents must be at least 1";
if (maxComponents !== undefined && (typeof maxComponents !== "number" || maxComponents % 1 !== 0 || maxComponents < minComponents))
throw "maxComponents must be >= minComponents";
this.addCustomValidator(propertyName, propertyValue, function (value) {
if (typeof value !== "string")
return false;
return value && value.match("^[0-9]+(\\.[0-9]+){" + ((minComponents - 1) || 0) + "," + ((maxComponents - 1) || "") + "}" + (!allowSuffixes ? "$" : "")) !== null;
}, "must be a version number with " + (minComponents === maxComponents
? minComponents : (minComponents + " to " + maxComponents))
+ (minComponents === maxComponents && minComponents === 1
? " component" : " components") + ", actual value: " + propertyValue);
};
PropertyValidator.prototype.addFileNameValidator = function (propertyName, propertyValue) {
this.addCustomValidator(propertyName, propertyValue, function (value) {
return !/[/?<>\\:*|"\u0000-\u001f\u0080-\u009f]/.test(propertyValue)
&& propertyValue !== "." && propertyValue !== "..";
}, "cannot contain reserved or control characters and cannot be \".\" or \"..\"");
};
PropertyValidator.prototype.addCustomValidator = function (propertyName, propertyValue, validator, message) {
this.propertyValidators.push({
propertyName: propertyName,
propertyValue: propertyValue,
validator: validator,
message: message
});
};
PropertyValidator.prototype.validate = function (throwOnError) {
var i;
var lines;
// Find any missing properties
var missingProperties = {};
for (i in this.requiredProperties) {
var propValue = this.requiredProperties[i].propertyValue;
if (propValue === undefined || propValue === null || propValue === "") {
missingProperties[i] = this.requiredProperties[i];
}
}
// Find any properties that don't satisfy their validator function
var invalidProperties = {};
for (var j = 0; j < this.propertyValidators.length; ++j) {
var v = this.propertyValidators[j];
if (!v.validator(v.propertyValue)) {
var messages = invalidProperties[v.propertyName] || [];
messages.push(v.message);
invalidProperties[v.propertyName] = messages;
}
}
var errorMessage = "";
if (Object.keys(missingProperties).length > 0) {
errorMessage += "The following properties are not set. Set them in your profile or product:\n";
lines = [];
for (i in missingProperties) {
var obj = missingProperties[i];
lines.push(this.moduleName + "." + i + ((obj && obj.message) ? (": " + obj.message) : ""));
}
errorMessage += lines.join("\n");
}
if (Object.keys(invalidProperties).length > 0) {
if (errorMessage)
errorMessage += "\n";
errorMessage += "The following properties have invalid values:\n";
lines = [];
for (i in invalidProperties) {
for (j = 0; j < invalidProperties[i].length; ++j) {
lines.push(this.moduleName + "." + i + ": " + invalidProperties[i][j]);
}
}
errorMessage += lines.join("\n");
}
if (throwOnError !== false && errorMessage.length > 0)
throw errorMessage;
return errorMessage.length == 0;
};
return PropertyValidator;
})();
var BlackboxOutputArtifactTracker = (function () {
function BlackboxOutputArtifactTracker() {
}
BlackboxOutputArtifactTracker.prototype.artifacts = function (outputDirectory) {
var process;
var fakeOutputDirectory;
try {
fakeOutputDirectory = new TemporaryDir();
if (!fakeOutputDirectory.isValid())
throw "could not create temporary directory";
process = new Process();
if (this.commandEnvironmentFunction) {
var env = this.commandEnvironmentFunction(fakeOutputDirectory.path());
for (var key in env)
process.setEnv(key, env[key]);
}
process.exec(this.command, this.commandArgsFunction(fakeOutputDirectory.path()), true);
var artifacts = [];
if (this.fileTaggers) {
var files = this.findFiles(fakeOutputDirectory.path());
for (var i = 0; i < files.length; ++i)
artifacts.push(this.createArtifact(fakeOutputDirectory.path(), files[i]));
}
if (this.processStdOutFunction)
artifacts = artifacts.concat(this.processStdOutFunction(process.readStdOut()));
artifacts = this.fixArtifactPaths(artifacts, outputDirectory, fakeOutputDirectory.path());
return artifacts;
}
finally {
if (process)
process.close();
if (fakeOutputDirectory)
fakeOutputDirectory.remove();
}
};
BlackboxOutputArtifactTracker.prototype.createArtifact = function (root, filePath) {
for (var ext in this.fileTaggers) {
if (filePath.endsWith(ext)) {
return {
filePath: filePath,
fileTags: this.fileTaggers[ext]
};
}
}
if (!this.defaultFileTags) {
var relFilePath = (filePath.startsWith(root + '/') || filePath.startsWith(root + '\\'))
? filePath.substring(root.length + 1)
: filePath;
throw "BlackboxOutputArtifactTracker: no matching file taggers for path '"
+ relFilePath + "'. Set defaultFileTags to an array of file tags to "
+ "apply to files not tagged by the fileTaggers map, which was:\n"
+ JSON.stringify(this.fileTaggers, undefined, 4);
}
return {
filePath: filePath,
fileTags: this.defaultFileTags
};
};
BlackboxOutputArtifactTracker.prototype.findFiles = function (dir) {
var fileList = File.directoryEntries(dir, File.Files).map(function (p) {
return FileInfo.joinPaths(dir, p); });
var dirList = File.directoryEntries(dir, File.Dirs | File.NoDotAndDotDot).map(function (p) {
return FileInfo.joinPaths(dir, p); });
for (var i = 0; i < dirList.length; ++i)
fileList = fileList.concat(this.findFiles(dirList[i]));
return fileList;
};
BlackboxOutputArtifactTracker.prototype.fixArtifactPaths = function (artifacts, realBasePath, fakeBasePath) {
for (var i = 0; i < artifacts.length; ++i)
artifacts[i].filePath = realBasePath
+ artifacts[i].filePath.substr(fakeBasePath.length);
return artifacts;
};
return BlackboxOutputArtifactTracker;
})();
function hasAnyOf(m, tokens) {
for (var i = 0; i < tokens.length; ++i) {
if (m[tokens[i]] !== undefined)
return true;
}
}
function guessArchitecture(m) {
var architecture;
if (m) {
// based on the search algorithm from qprocessordetection.h in qtbase
var arm64Defs = ["_M_ARM64", "__aarch64__", "__ARM64__"];
if (hasAnyOf(m, ["__arm__", "__TARGET_ARCH_ARM", "_M_ARM"].concat(arm64Defs))) {
if (hasAnyOf(m, arm64Defs)) {
architecture = "arm64";
} else {
architecture = "arm";
var foundSubarch = false;
for (var i = 8; i >= 4; --i) {
var codes = ["zk", "tej", "te", "t2"].concat([].concat.apply([],
new Array(26)).map(function(_, i) { return String.fromCharCode(122 - i); }));
for (var j = 0; j < codes.length; ++j) {
if (m["__ARM_ARCH_" + i + codes[j].toUpperCase() + "__"] !== undefined) {
architecture += "v" + i + codes[j].toLowerCase();
foundSubarch = true;
break;
}
}
if (i === 7 && m["_ARM_ARCH_7"] !== undefined) {
architecture += "v7";
foundSubarch = true;
}
if (foundSubarch)
break;
}
}
} else if (hasAnyOf(m, ["__i386", "__i386__", "__386__"])) {
architecture = "x86";
} else if (hasAnyOf(m, ["_M_IX86"])) {
var code = parseInt(m["_M_IX86"]);
architecture = (code < 300) ? "x86_16" : "x86";
} else if (hasAnyOf(m, ["_M_I86"])) {
architecture = "x86_16";
} else if (hasAnyOf(m, ["__x86_64", "__x86_64__", "__amd64", "_M_X64", "_M_AMD64"])) {
architecture = "x86_64";
if (hasAnyOf(m, ["__x86_64h", "__x86_64h__"]))
architecture = "x86_64h";
} else if (hasAnyOf(m, ["__ia64", "__ia64__", "_M_IA64"])) {
architecture = "ia64";
} else if (hasAnyOf(m, ["__mips", "__mips__", "_M_MRX000"])) {
architecture = "mips";
if (hasAnyOf(m, ["_MIPS_ARCH_MIPS64", "__mips64"]))
architecture += "64";
} else if (hasAnyOf(m, ["__ppc__", "__ppc", "__powerpc__",
"_ARCH_COM", "_ARCH_PWR", "_ARCH_PPC", "_M_MPPC", "_M_PPC"])) {
architecture = "ppc";
if (hasAnyOf(m, ["__ppc64__", "__powerpc64__", "__64BIT__"]))
architecture += "64";
} else if (hasAnyOf(m, ["__s390__"])) {
if (hasAnyOf(m, ["__s390x__"]))
architecture = "s390x";
} else if (hasAnyOf(m, ["__sparc__"])) {
architecture = "sparc";
if (hasAnyOf(m, ["__sparc64__"]))
architecture += "64";
} else if (hasAnyOf(m, ["__AVR__"])) {
architecture = "avr";
} else if (hasAnyOf(m, ["__AVR32__"])) {
architecture = "avr32";
} else if (hasAnyOf(m, ["__MSP430__"])) {
architecture = "msp430";
} else if (hasAnyOf(m, ["__RL78__"])) {
architecture = "rl78";
} else if (hasAnyOf(m, ["__RX__"])) {
architecture = "rx";
} else if (hasAnyOf(m, ["__v850__"])) {
architecture = "v850";
} else if (hasAnyOf(m, ["__riscv"])) {
architecture = "riscv";
} else if (hasAnyOf(m, ["__xtensa__", "__XTENSA__"])) {
architecture = "xtensa";
} else if (hasAnyOf(m, ["__m68k__"])) {
architecture = "m68k";
} else if (hasAnyOf(m, ["__m32c__"])) {
architecture = "m32c";
} else if (hasAnyOf(m, ["__m32r__", "__M32R__"])) {
architecture = "m32r";
} else if (hasAnyOf(m, ["__sh__", "__SH__"])) {
architecture = "sh";
} else if (hasAnyOf(m, ["__CR16__"])) {
architecture = "cr16";
} else if (hasAnyOf(m, ["__mc68hc1x__", "__mc68hc1x"])) {
architecture = "hcs12";
} else if (hasAnyOf(m, ["__e2k__"])) {
architecture = "e2k";
} else if (hasAnyOf(m, ["__hppa__"])) {
architecture = "hppa";
}
}
return Utilities.canonicalArchitecture(architecture);
}
function guessTargetPlatform(m) {
if (m) {
if (hasAnyOf(m, ["__ANDROID__", "ANDROID"]))
return "android";
if (hasAnyOf(m, ["__QNXNTO__"]))
return "qnx";
if (hasAnyOf(m, ["__INTEGRITY"]))
return "integrity";
if (hasAnyOf(m, ["__vxworks"]))
return "vxworks";
if (hasAnyOf(m, ["__APPLE__"]))
return "darwin";
if (hasAnyOf(m, ["WIN32", "_WIN32", "__WIN32__", "__NT__", "__WINDOWS__", "_WINDOWS"]))
return "windows";
if (hasAnyOf(m, ["MSDOS", "__DOS__", "DOS386"]))
return "dos";
if (hasAnyOf(m, ["__OS2__"]))
return "os2";
if (hasAnyOf(m, ["_AIX"]))
return "aix";
if (hasAnyOf(m, ["hpux", "__hpux"]))
return "hpux";
if (hasAnyOf(m, ["__sun", "sun"]))
return "solaris";
if (hasAnyOf(m, ["__linux__", "__linux", "__LINUX__"]))
return "linux";
if (hasAnyOf(m, ["__FreeBSD__", "__DragonFly__", "__FreeBSD_kernel__"]))
return "freebsd";
if (hasAnyOf(m, ["__NetBSD__"]))
return "netbsd";
if (hasAnyOf(m, ["__OpenBSD__"]))
return "openbsd";
if (hasAnyOf(m, ["__GNU__"]))
return "hurd";
if (hasAnyOf(m, ["__HAIKU__"]))
return "haiku";
if (hasAnyOf(m, ["__wasm__"]))
return "wasm-emscripten"
}
}
function toJSLiteral(v) {
if (v === undefined)
return "undefined";
return JSON.stringify(v);
}
qbs-src-2.6.1/share/qbs/imports/qbs/BundleTools/ 0000755 0001751 0000166 00000000000 14776170045 021053 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/BundleTools/bundle-tools.js 0000644 0001751 0000166 00000006035 14776170045 024024 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var DarwinTools = require("qbs.DarwinTools");
var PropertyList = require("qbs.PropertyList");
function destinationDirectoryForResource(product, input) {
var path = product.destinationDirectory;
var inputFilePath = FileInfo.joinPaths(input.baseDir, input.fileName);
var key = DarwinTools.localizationKey(inputFilePath);
if (key) {
path = FileInfo.joinPaths(path, localizedResourcesFolderPath(product, key));
var subPath = DarwinTools.relativeResourcePath(inputFilePath);
if (subPath && subPath !== '.')
path = FileInfo.joinPaths(path, subPath);
} else {
path = FileInfo.joinPaths(path, product.moduleProperty("bundle", "unlocalizedResourcesFolderPath"));
}
return path;
}
function localizedResourcesFolderPath(product, key) {
return FileInfo.joinPaths(product.moduleProperty("bundle", "unlocalizedResourcesFolderPath"), key + product.moduleProperty("bundle", "localizedResourcesFolderSuffix"));
}
function infoPlistContents(infoPlistFilePath) {
if (infoPlistFilePath === undefined)
return undefined;
var plist = new PropertyList();
try {
plist.readFromFile(infoPlistFilePath);
return plist.toObject();
} finally {
plist.clear();
}
}
function infoPlistFormat(infoPlistFilePath) {
if (infoPlistFilePath === undefined)
return undefined;
var plist = new PropertyList();
try {
plist.readFromFile(infoPlistFilePath);
return plist.format();
} finally {
plist.clear();
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/ 0000755 0001751 0000166 00000000000 14776170045 017533 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/base/LoadableModule.qbs 0000644 0001751 0000166 00000003054 14776170045 023115 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
DynamicLibrary {
type: isForDarwin ? ["loadablemodule"] : base
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/DynamicLibrary.qbs 0000644 0001751 0000166 00000003106 14776170045 023153 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Library {
type: ["dynamiclibrary"].concat(isForAndroid ? ["android.nativelibrary"] : [])
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/NetModule.qbs 0000644 0001751 0000166 00000000104 14776170045 022131 0 ustar runner docker Product {
Depends { name: "cli" }
type: ["cli.netmodule"]
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/StaticLibrary.qbs 0000644 0001751 0000166 00000003017 14776170045 023017 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Library {
type: ["staticlibrary"]
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/QtGuiApplication.qbs 0000644 0001751 0000166 00000003030 14776170045 023453 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
QtApplication {
Depends { name: "Qt.gui" }
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/WindowsSetupPackage.qbs 0000644 0001751 0000166 00000003123 14776170045 024170 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
Depends { name: "wix"; condition: qbs.targetOS.contains("windows") }
type: ["wixsetup"]
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/JavaClassCollection.qbs 0000644 0001751 0000166 00000003051 14776170045 024124 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
Depends { name: "java" }
type: ["java.class"]
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/NativeBinary.qbs 0000644 0001751 0000166 00000005621 14776170045 022641 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
property bool isForAndroid: qbs.targetOS.contains("android")
property bool isForDarwin: qbs.targetOS.contains("darwin")
property bool isBundle: isForDarwin && bundle.isBundle
property bool install: false
property string installDir
// Product artifacts should be installed if it's not multiplexed or aggregated,
// or if it is multiplexed and it's the aggregate product
readonly property bool _installable: !multiplexed || !aggregate || !multiplexConfigurationId
property bool installDebugInformation: install
property string debugInformationInstallDir: installDir
Depends { name: "bundle"; condition: isForDarwin }
aggregate: {
if (!isForDarwin)
return false;
var multiplexProps = multiplexByQbsProperties;
if (!multiplexProps)
return false;
if (multiplexProps.contains("architectures")) {
var archs = qbs.architectures;
if (archs && archs.length > 1)
return true;
}
if (multiplexProps.contains("buildVariants")) {
var variants = qbs.buildVariants;
return variants && variants.length > 1;
}
return false;
}
multiplexByQbsProperties: {
if (isForDarwin)
return ["profiles", "architectures", "buildVariants"];
if (isForAndroid)
return ["architectures"]
return ["profiles"];
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/JavaJarFile.qbs 0000644 0001751 0000166 00000003106 14776170045 022360 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
Depends { name: "java" }
type: ["java.jar"]
property string entryPoint
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/NSISSetup.qbs 0000644 0001751 0000166 00000003125 14776170045 022040 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
Depends { name: "nsis"; condition: qbs.targetOS.contains("windows") }
type: ["nsissetup"]
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/QtModule.qbs 0000644 0001751 0000166 00000007355 14776170045 022006 0 ustar runner docker import qbs.FileInfo
Module {
condition: (qbs.targetPlatform === targetPlatform || isCombinedUIKitBuild)
&& (!qbs.architecture
|| architectures.length === 0
|| architectures.contains(qbs.architecture))
readonly property bool isCombinedUIKitBuild: ["ios", "tvos", "watchos"].contains(targetPlatform)
&& ["x86", "x86_64"].contains(qbs.architecture)
&& qbs.targetPlatform === targetPlatform + "-simulator"
Depends { name: "cpp" }
Depends { name: "Qt.core" }
Depends { name: "Qt.plugin_support" }
property stringList pluginTypes
Qt.plugin_support.pluginTypes: pluginTypes
Depends {
condition: Qt.core.staticBuild && !isPlugin
name: "Qt";
submodules: {
// We have to pull in all plugins here, because dependency resolving happens
// before module merging, and we don't know yet if someone set
// Qt.pluginSupport.pluginsByType in the product.
// TODO: We might be able to use Qt.pluginSupport.pluginsByType now.
// The real filtering is done later by the plugin module files themselves.
var list = [];
var allPlugins = Qt.plugin_support.allPluginsByType;
for (var i = 0; i < (pluginTypes || []).length; ++i)
Array.prototype.push.apply(list, allPlugins[pluginTypes[i]])
return list;
}
}
property string qtModuleName
property path binPath: Qt.core.binPath
property path incPath: Qt.core.incPath
property path libPath: Qt.core.libPath
property string qtLibInfix: Qt.core.libInfix
property string libNameForLinkerDebug
property string libNameForLinkerRelease
property string libNameForLinker: Qt.core.qtBuildVariant === "debug"
? libNameForLinkerDebug : libNameForLinkerRelease
property string libFilePathDebug
property string libFilePathRelease
property string libFilePath: Qt.core.qtBuildVariant === "debug"
? libFilePathDebug : libFilePathRelease
property bool hasLibrary: true
property bool isStaticLibrary: false
property bool isPlugin: false
property stringList architectures
property string targetPlatform
property stringList staticLibsDebug
property stringList staticLibsRelease
property stringList dynamicLibsDebug
property stringList dynamicLibsRelease
property stringList linkerFlagsDebug
property stringList linkerFlagsRelease
property stringList staticLibs: Qt.core.qtBuildVariant === "debug"
? staticLibsDebug : staticLibsRelease
property stringList dynamicLibs: Qt.core.qtBuildVariant === "debug"
? dynamicLibsDebug : dynamicLibsRelease
property stringList frameworksDebug
property stringList frameworksRelease
property stringList frameworkPathsDebug
property stringList frameworkPathsRelease
property stringList mFrameworks: Qt.core.qtBuildVariant === "debug"
? frameworksDebug : frameworksRelease
property stringList mFrameworkPaths: Qt.core.qtBuildVariant === "debug"
? frameworkPathsDebug: frameworkPathsRelease
cpp.linkerFlags: Qt.core.qtBuildVariant === "debug"
? linkerFlagsDebug : linkerFlagsRelease
property bool enableLinking: qtModuleName != undefined && hasLibrary
property stringList moduleConfig
Properties {
condition: enableLinking
cpp.staticLibraries: staticLibs
cpp.dynamicLibraries: dynamicLibs
cpp.frameworks: mFrameworks.concat(!isStaticLibrary && Qt.core.frameworkBuild
? [libNameForLinker] : [])
cpp.systemFrameworkPaths: mFrameworkPaths
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/AppleApplicationDiskImage.qbs 0000644 0001751 0000166 00000011707 14776170045 025253 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
AppleDiskImage {
property string sourceBase: "/Applications"
readonly property string absoluteSourceBase:
FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix, sourceBase)
property stringList symlinks: ["/Applications:Applications"]
readonly property string stageDirectory: FileInfo.joinPaths(destinationDirectory, "Volumes", dmg.volumeName)
Rule {
multiplex: true
outputFileTags: ["dmg.input", "dmg.input.symlink"]
outputArtifacts: Array.prototype.map.call(product.symlinks, function (symlink) {
var symlinkTarget = symlink.split(':')[0];
var symlinkName = symlink.split(':')[1] || symlinkTarget;
if (FileInfo.isAbsolutePath(symlinkName))
throw(symlink + " is an invalid symlink; the destination must be a relative path");
return {
filePath: FileInfo.joinPaths(product.stageDirectory, symlinkName),
fileTags: ["dmg.input", "dmg.input.symlink"],
dmg: { symlinkTarget: symlinkTarget, sourceBase: product.stageDirectory },
};
})
prepare: Array.prototype.map.call(outputs["dmg.input"], function (symlink) {
var cmd = new Command("ln", ["-sfn", symlink.dmg.symlinkTarget, symlink.filePath]);
cmd.workingDirectory = product.stageDirectory;
cmd.description = "symlinking " + symlink.fileName + " to " + symlink.dmg.symlinkTarget;
return cmd;
});
}
Rule {
multiplex: true
inputs: ["dmg.input.symlink"]
inputsFromDependencies: ["installable"]
outputFileTags: ["dmg.input"]
outputArtifacts: {
var absSourceBase = product.absoluteSourceBase;
var symlinkPaths = (inputs["dmg.input.symlink"] || []).map(function (s) { return s.filePath; });
return Array.prototype.map.call(inputs["installable"], function (a) {
var fp = ModUtils.artifactInstalledFilePath(a);
if (fp.startsWith(absSourceBase)) {
var outputFilePath = fp.replace(absSourceBase, product.stageDirectory);
// Check for symlink conflicts
for (var i in symlinkPaths) {
if (outputFilePath.startsWith(symlinkPaths[i]))
throw new Error("Cannot install '" + a.filePath
+ "' to '" + outputFilePath + "' because it "
+ "would conflict with the symlink at '"
+ symlinkPaths[i] + "'");
}
return {
filePath: outputFilePath,
fileTags: ["dmg.input"],
dmg: { sourceBase: product.stageDirectory }
}
}
}).filter(function (a) { return !!a; });
}
prepare: {
var absSourceBase = product.absoluteSourceBase;
var cmds = [], dmgs = outputs["dmg.input"];
for (var i in dmgs) {
var a = dmgs[i];
var cmd = new JavaScriptCommand();
cmd.src = a.filePath.replace(product.stageDirectory, absSourceBase);
cmd.dst = a.filePath;
cmd.silent = true;
cmd.sourceCode = function () { File.copy(src, dst); };
cmds.push(cmd);
}
return cmds;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/QtPlugin.qbs 0000644 0001751 0000166 00000003243 14776170045 022007 0 ustar runner docker import qbs.FileInfo
import qbs.TextFile
QtModule {
isPlugin: true
property string className
property stringList extendsModules
enableLinking: {
if (!base)
return false;
if (!isStaticLibrary)
return false;
if (!Qt.plugin_support.linkPlugins)
return false;
if (!(Qt.plugin_support.enabledPlugins || []).contains(qtModuleName))
return false;
if (!extendsModules || extendsModules.length === 0)
return true;
for (var i = 0; i < extendsModules.length; ++i) {
var moduleName = extendsModules[i];
if (product.Qt[moduleName] && product.Qt[moduleName].present)
return true;
}
return false;
}
Rule {
condition: enableLinking
multiplex: true
Artifact {
filePath: product.targetName + "_qt_plugin_import_"
+ product.moduleProperty(product.moduleName, "qtModuleName") + ".cpp"
fileTags: ["cpp", "qt.untranslatable"]
}
prepare: {
var cmd = new JavaScriptCommand();
var pluginName = product.moduleProperty(product.moduleName, "qtModuleName");
cmd.description = "creating static import for plugin '" + pluginName + "'";
cmd.sourceCode = function() {
var f = new TextFile(output.filePath, TextFile.WriteOnly);
var className = product.moduleProperty(product.moduleName, "className");
f.writeLine("#include \n\nQ_IMPORT_PLUGIN(" + className + ")");
f.close();
};
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/XPCService.qbs 0000644 0001751 0000166 00000003544 14776170045 022223 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Application {
type: base.concat(["xpcservice"])
condition: qbs.targetOS.contains("darwin")
property string xpcServiceType: "Application"
bundle.infoPlist: {
var infoPlist = base;
if (xpcServiceType) {
infoPlist["XPCService"] = {
"ServiceType": xpcServiceType
};
}
return infoPlist;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/InstallPackage.qbs 0000644 0001751 0000166 00000005306 14776170045 023130 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
import qbs.ModUtils
import qbs.TextFile
Product {
type: ["archiver.archive"]
builtByDefault: false
Depends { name: "archiver" }
archiver.type: "tar"
archiver.workingDirectory: qbs.installRoot
Rule {
multiplex: true
inputsFromDependencies: ["installable"]
Artifact {
filePath: product.name + ".tarlist"
fileTags: ["archiver.input-list"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode =function() {
var ofile = new TextFile(output.filePath, TextFile.WriteOnly);
try {
for (var i = 0; i < inputs["installable"].length; ++i) {
var inp = inputs["installable"][i];
var installRoot = inp.moduleProperty("qbs", "installRoot");
var installedFilePath = ModUtils.artifactInstalledFilePath(inp);
ofile.writeLine(FileInfo.relativePath(installRoot, installedFilePath));
}
} finally {
ofile.close();
}
};
return [cmd];
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/QtApplication.qbs 0000644 0001751 0000166 00000003032 14776170045 023010 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
CppApplication {
Depends { name: "Qt.core" }
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/NodeJSApplication.qbs 0000644 0001751 0000166 00000003022 14776170045 023545 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
Depends { name: "nodejs" }
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/WindowsInstallerPackage.qbs 0000644 0001751 0000166 00000003116 14776170045 025027 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
Depends { name: "wix"; condition: qbs.targetOS.contains("windows") }
type: ["msi"]
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/CppApplication.qbs 0000644 0001751 0000166 00000003055 14776170045 023153 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Application {
Depends { name: "cpp" }
usesNativeCode: true
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/AppleDiskImage.qbs 0000644 0001751 0000166 00000003045 14776170045 023063 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
Depends { name: "dmg" }
type: ["dmg.dmg"]
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/ApplicationExtension.qbs 0000644 0001751 0000166 00000005500 14776170045 024402 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
XPCService {
Depends { name: "xcode" }
type: base.concat(["applicationextension"])
property bool _useLegacyExtensionLibraries:
qbs.targetOS.contains("macos")
&& xcode.present
&& parseInt(xcode.sdkVersion.split(".")[1], 10) < 11
|| qbs.targetOS.contains("ios")
&& xcode.present
&& parseInt(xcode.sdkVersion.split(".")[0], 10) < 9
cpp.entryPoint: "_NSExtensionMain"
cpp.frameworkPaths: base.concat(_useLegacyExtensionLibraries
? qbs.sysroot + "/System/Library/PrivateFrameworks/"
: [])
cpp.frameworks: {
var frameworks = base.concat(["Foundation"]);
if (_useLegacyExtensionLibraries)
frameworks.push("PlugInKit");
return frameworks;
}
cpp.requireAppExtensionSafeApi: true
xpcServiceType: undefined
property var extensionAttributes
property string extensionPointIdentifier
property string extensionPrincipalClass
bundle.infoPlist: {
var infoPlist = base;
infoPlist["NSExtension"] = {
"NSExtensionAttributes": extensionAttributes || {},
"NSExtensionPointIdentifier": extensionPointIdentifier,
"NSExtensionPrincipalClass": extensionPrincipalClass
};
return infoPlist;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/InnoSetup.qbs 0000644 0001751 0000166 00000003264 14776170045 022173 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
Product {
condition: qbs.targetOS.contains("windows") && innosetup.present
Depends { name: "innosetup"; condition: qbs.targetOS.contains("windows"); required: false }
type: ["innosetup.exe"]
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/Library.qbs 0000644 0001751 0000166 00000007011 14776170045 021645 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
NativeBinary {
type: {
if (qbs.targetOS.contains("ios") && parseInt(cpp.minimumIosVersion, 10) < 8)
return ["staticlibrary"];
return ["dynamiclibrary"].concat(isForAndroid ? ["android.nativelibrary"] : []);
}
readonly property bool isDynamicLibrary: type.contains("dynamiclibrary")
readonly property bool isStaticLibrary: type.contains("staticlibrary")
readonly property bool isLoadableModule: type.contains("loadablemodule")
installDir: {
if (isBundle)
return "Library/Frameworks";
if (isDynamicLibrary)
return qbs.targetOS.contains("windows") ? "bin" : "lib";
if (isStaticLibrary)
return "lib";
}
property bool installImportLib: false
property string importLibInstallDir: "lib"
Group {
condition: install && _installable
fileTagsFilter: {
if (isBundle)
return ["bundle.content"];
if (isDynamicLibrary)
return ["dynamiclibrary", "dynamiclibrary_symlink"];
if (isStaticLibrary)
return ["staticlibrary"];
if (isLoadableModule)
return ["loadablemodule"];
return [];
}
qbs.install: true
qbs.installDir: installDir
qbs.installSourceBase: isBundle ? destinationDirectory : outer
}
Group {
condition: installImportLib
&& type.contains("dynamiclibrary")
&& _installable
fileTagsFilter: "dynamiclibrary_import"
qbs.install: true
qbs.installDir: importLibInstallDir
}
Group {
condition: installDebugInformation && _installable
fileTagsFilter: {
if (isDynamicLibrary)
return ["debuginfo_dll"];
else if (isLoadableModule)
return ["debuginfo_loadablemodule"];
return [];
}
qbs.install: true
qbs.installDir: debugInformationInstallDir
qbs.installSourceBase: destinationDirectory
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/QtLupdateRunner.qbs 0000644 0001751 0000166 00000014332 14776170045 023342 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.TextFile
import qbs.Utilities
Product {
condition: Utilities.versionCompare(Qt.core.version, "5.13") >= 0
name: "lupdate-runner"
type: "lupdate-result"
builtByDefault: false
property bool limitToSubProject: true
property stringList extraArguments
Depends { name: "Qt.core" }
Depends { productTypes: "qm"; limitToSubProject: product.limitToSubProject }
Rule {
multiplex: true
auxiliaryInputsFromDependencies: ["cpp", "objcpp", "qt.qml.qml", "qt.qml.js", "ui"]
excludedInputs: "qt.untranslatable"
Artifact {
filePath: "lupdate.json"
fileTags: "lupdate_json"
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "creating lupdate project file";
cmd.highlight = "filegen";
cmd.sourceCode = function() {
/*
* From the original commit message in qttools:
* Project ::= {
* string projectFile // Name of the project file.
* string codec // Source code codec. Valid values are
* // currently "utf-16" or "utf-8" (default).
* string[] translations // List of .ts files of the project.
* string[] includePaths // List of include paths.
* string[] sources // List of source files.
* string[] excluded // List of source files, which are
* // excluded for translation.
* Project[] subProjects // List of sub-projects.
* }
*/
var mainProject = {
projectFile: "main",
sources: [],
translations: [],
subProjects: []
};
var cxxArtifactsByIncludePaths = {};
function handleProduct(product) {
(product.artifacts["ts"] || []).forEach(function(artifact) {
mainProject.translations.push(artifact.filePath);
});
["qt.qml.qml", "qt.qml.js", "ui"].forEach(function(tag) {
(product.artifacts[tag] || []).forEach(function(artifact) {
mainProject.sources.push(artifact.filePath);
});
});
["cpp", "objcpp"].forEach(function(tag) {
(product.artifacts[tag] || []).forEach(function(artifact) {
if (!artifact.cpp || artifact.fileTags.contains("qt.untranslatable"))
return;
var key = (artifact.cpp.includePaths || []).join("");
var current = cxxArtifactsByIncludePaths[key] || [];
current.push(artifact);
cxxArtifactsByIncludePaths[key] = current;
});
});
};
product.dependencies.forEach(function(dep) {
if (!dep.present)
handleProduct(dep);
});
var cxxProductNr = 0;
for (key in cxxArtifactsByIncludePaths) {
var artifactList = cxxArtifactsByIncludePaths[key];
var cxxProject = {
projectFile: "cxx " + ++cxxProductNr,
includePaths: artifactList[0].cpp.includePaths,
sources: []
};
artifactList.forEach(function(artifact) {
cxxProject.sources.push(artifact.filePath);
});
mainProject.subProjects.push(cxxProject);
}
(new TextFile(output.filePath, TextFile.WriteOnly)).write(
JSON.stringify(mainProject));
}
return cmd;
}
}
// This is a pure action target that intentionally does not do any change tracking.
// It is implemented this way because it writes source files and therefore needs to be able
// to overwrite user edits (e.g. accidental removal of a source string).
Rule {
inputs: "lupdate_json"
outputFileTags: "lupdate-result"
prepare: {
var tool = product.Qt.core.binPath + '/' + product.Qt.core.lupdateName;
var args = ["-project", inputs.lupdate_json[0].filePath]
.concat(product.extraArguments || []);
var cmd = new Command(tool, args);
cmd.description = "updating translation files";
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/Application.qbs 0000644 0001751 0000166 00000006355 14776170045 022516 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
NativeBinary {
type: isForAndroid && !consoleApplication ? ["android.package"] : ["application"]
property bool usesNativeCode
Depends {
// Note: If we are multiplexing, then this dependency is technically only needed in
// the aggregate. However, the user should not have to write the respective
// condition when assigning to properties of this module, so we load it
// regardless and turn off its rules for the native part of the build.
name: "Android.sdk"
condition: isForAndroid && !consoleApplication
}
Properties {
condition: isForAndroid && !consoleApplication && !usesNativeCode
multiplexByQbsProperties: []
aggregate: false
}
Properties {
condition: isForAndroid && !consoleApplication && usesNativeCode
&& multiplexByQbsProperties && multiplexByQbsProperties.contains("architectures")
&& qbs.architectures && qbs.architectures.length > 1
aggregate: true
multiplexedType: "android.nativelibrary"
}
Properties {
condition: undefined
multiplexByQbsProperties: base
multiplexedType: base
}
aggregate: base
installDir: isBundle ? "Applications" : "bin"
Group {
condition: install && _installable
fileTagsFilter: isBundle ? "bundle.content" : "application"
qbs.install: true
qbs.installDir: installDir
qbs.installSourceBase: isBundle ? destinationDirectory : outer
}
Group {
condition: installDebugInformation && _installable
fileTagsFilter: ["debuginfo_app"]
qbs.install: true
qbs.installDir: debugInformationInstallDir
qbs.installSourceBase: destinationDirectory
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/AndroidApk.qbs 0000644 0001751 0000166 00000003174 14776170045 022263 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
Product {
type: ["android.package"]
qbs.targetPlatform: "android"
Depends { name: "Android.sdk" }
}
qbs-src-2.6.1/share/qbs/imports/qbs/base/AutotestRunner.qbs 0000644 0001751 0000166 00000011010 14776170045 023235 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2019 Jochen Ulrich
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
Product {
name: "autotest-runner"
type: ["autotest-result"]
builtByDefault: false
property stringList arguments: []
property stringList environment: ModUtils.flattenDictionary(qbs.commonRunEnvironment)
property bool limitToSubProject: true
property stringList wrapper: []
property string workingDir
property stringList auxiliaryInputs
property int timeout: -1
Depends {
productTypes: "autotest"
limitToSubProject: product.limitToSubProject
}
Depends {
productTypes: auxiliaryInputs
limitToSubProject: product.limitToSubProject
}
Rule {
inputsFromDependencies: "application"
auxiliaryInputsFromDependencies: product.auxiliaryInputs
outputFileTags: "autotest-result"
prepare: {
// TODO: This is hacky. Possible solution: Add autotest tag to application
// in autotest module and have that as inputsFromDependencies instead of application.
if (!input.product.type.contains("autotest")) {
var cmd = new JavaScriptCommand();
cmd.silent = true;
return cmd;
}
var commandFilePath;
var installed = input.moduleProperty("qbs", "install");
if (installed)
commandFilePath = ModUtils.artifactInstalledFilePath(input);
if (!commandFilePath || !File.exists(commandFilePath))
commandFilePath = input.filePath;
var workingDir = product.workingDir ? product.workingDir
: FileInfo.path(commandFilePath);
var arguments = product.arguments;
var allowFailure = false;
var timeout = product.timeout;
if (input.autotest) {
// FIXME: We'd like to let the user override with an empty list, but
// qbscore turns undefined lists into empty ones at the moment.
if (input.autotest.arguments && input.autotest.arguments.length > 0)
arguments = input.autotest.arguments;
if (input.autotest.workingDir)
workingDir = input.autotest.workingDir;
allowFailure = input.autotest.allowFailure;
if (input.autotest.timeout !== undefined)
timeout = input.autotest.timeout;
}
var fullCommandLine = product.wrapper
.concat([commandFilePath])
.concat(arguments);
var cmd = new Command(fullCommandLine[0], fullCommandLine.slice(1));
cmd.description = "running test " + input.fileName;
cmd.environment = product.environment;
cmd.workingDirectory = workingDir;
cmd.timeout = timeout;
cmd.jobPool = "autotest-runner";
if (allowFailure)
cmd.maxExitCode = 32767;
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/UnixUtils/ 0000755 0001751 0000166 00000000000 14776170045 020565 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/UnixUtils/unix-utils.js 0000644 0001751 0000166 00000005330 14776170045 023245 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
function soname(product, outputFileName) {
var soVersion = product.moduleProperty("cpp", "soVersion");
if (product.moduleProperty("qbs", "targetOS").contains("darwin")) {
// If this is a bundle, ignore the parameter and use the relative path to the bundle binary
// For example: qbs.framework/Versions/1/qbs
if (product.moduleProperty("bundle", "isBundle"))
outputFileName = product.moduleProperty("bundle", "executablePath");
} else if (soVersion) {
// For non-Darwin platforms, append the shared library major version number to the soname
// For example: libqbscore.so.1
var version = product.moduleProperty("cpp", "internalVersion");
if (version) {
outputFileName = outputFileName.substr(0, outputFileName.length - version.length)
+ soVersion;
} else {
outputFileName += "." + soVersion;
}
}
// Prepend the soname prefix
// For example, @rpath/libqbscore.dylib or /usr/lib/libqbscore.so.1
var prefix = product.moduleProperty("cpp", "sonamePrefix");
if (prefix)
outputFileName = FileInfo.joinPaths(prefix, outputFileName);
return outputFileName;
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/ 0000755 0001751 0000166 00000000000 14776170045 020053 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/Probes/ClangClProbe.qbs 0000644 0001751 0000166 00000010014 14776170045 023051 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Utilities
import "../../../modules/cpp/gcc.js" as Gcc
PathProbe {
// Inputs
property string compilerFilePath
property string vcvarsallFilePath
property stringList enableDefinesByLanguage
property string preferredArchitecture
property string winSdkVersion
// Outputs
property int versionMajor
property int versionMinor
property int versionPatch
property stringList includePaths
property string architecture
property var buildEnv
property var compilerDefinesByLanguage
configure: {
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
var info = languages.contains("c")
? Utilities.clangClCompilerInfo(
compilerFilePath,
preferredArchitecture,
vcvarsallFilePath,
"c",
winSdkVersion)
: {};
var infoCpp = languages.contains("cpp")
? Utilities.clangClCompilerInfo(
compilerFilePath,
preferredArchitecture,
vcvarsallFilePath,
"cpp",
winSdkVersion)
: {};
found = (!languages.contains("c") ||
(!!info && !!info.macros && !!info.buildEnvironment))
&& (!languages.contains("cpp") ||
(!!infoCpp && !!infoCpp.macros && !!infoCpp.buildEnvironment));
compilerDefinesByLanguage = {
"c": info.macros,
"cpp": infoCpp.macros,
};
var macros = info.macros || infoCpp.macros;
versionMajor = parseInt(macros["__clang_major__"], 10);
versionMinor = parseInt(macros["__clang_minor__"], 10);
versionPatch = parseInt(macros["__clang_patchlevel__"], 10);
buildEnv = info.buildEnvironment || infoCpp.buildEnvironment;
// clang-cl is just a wrapper around clang.exe, so the includes *should be* the same
var clangPath = FileInfo.joinPaths(FileInfo.path(compilerFilePath), "clang.exe");
var defaultPaths = Gcc.dumpDefaultPaths(buildEnv, clangPath,
[], Host.nullDevice(),
FileInfo.pathListSeparator(), "", "");
includePaths = defaultPaths.includePaths;
architecture = ModUtils.guessArchitecture(macros);
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/MsvcProbe.qbs 0000644 0001751 0000166 00000007634 14776170045 022474 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.Utilities
PathProbe {
// Inputs
property string compilerFilePath
property stringList enableDefinesByLanguage
property string preferredArchitecture
property string winSdkVersion
// Outputs
property string architecture
property int versionMajor
property int versionMinor
property int versionPatch
property stringList includePaths
property var buildEnv
property var compilerDefinesByLanguage
configure: {
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
var info = languages.contains("c")
? Utilities.msvcCompilerInfo(compilerFilePath, "c", winSdkVersion) : {};
var infoCpp = languages.contains("cpp")
? Utilities.msvcCompilerInfo(compilerFilePath, "cpp", winSdkVersion) : {};
found = (!languages.contains("c") ||
(!!info && !!info.macros && !!info.buildEnvironment))
&& (!languages.contains("cpp") ||
(!!infoCpp && !!infoCpp.macros && !!infoCpp.buildEnvironment));
compilerDefinesByLanguage = {
"c": info.macros,
"cpp": infoCpp.macros,
};
var macros = info.macros || infoCpp.macros;
architecture = ModUtils.guessArchitecture(macros);
var ver = macros["_MSC_FULL_VER"];
versionMajor = parseInt(ver.substr(0, 2), 10);
versionMinor = parseInt(ver.substr(2, 2), 10);
versionPatch = parseInt(ver.substr(4), 10);
buildEnv = info.buildEnvironment || infoCpp.buildEnvironment;
var clParentDir = FileInfo.joinPaths(FileInfo.path(compilerFilePath), "..");
var inclPath = FileInfo.joinPaths(clParentDir, "INCLUDE");
if (!File.exists(inclPath))
inclPath = FileInfo.joinPaths(clParentDir, "..", "INCLUDE");
if (!File.exists(inclPath))
inclPath = FileInfo.joinPaths(clParentDir, "..", "..", "INCLUDE");
if (File.exists(inclPath))
includePaths = [inclPath];
if (preferredArchitecture && Utilities.canonicalArchitecture(preferredArchitecture)
!== Utilities.canonicalArchitecture(architecture)) {
throw "'" + preferredArchitecture +
"' differs from the architecture produced by this compiler (" +
architecture + ")";
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/IarProbe.qbs 0000644 0001751 0000166 00000006261 14776170045 022272 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import "../../../modules/cpp/iar.js" as IAR
PathProbe {
// Inputs
property string compilerFilePath
property stringList enableDefinesByLanguage
// Outputs
property string architecture
property string endianness
property int versionMajor
property int versionMinor
property int versionPatch
property stringList includePaths
property var compilerDefinesByLanguage
configure: {
compilerDefinesByLanguage = {};
if (!File.exists(compilerFilePath)) {
found = false;
return;
}
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
var defaultPathsByLanguage = {};
for (var i = 0; i < languages.length; ++i) {
var tag = languages[i];
compilerDefinesByLanguage[tag] = IAR.dumpMacros(
compilerFilePath, tag);
var paths = IAR.dumpDefaultPaths(compilerFilePath, tag);
defaultPathsByLanguage[tag] = paths;
}
var macros = compilerDefinesByLanguage["c"]
|| compilerDefinesByLanguage["cpp"];
architecture = IAR.guessArchitecture(macros);
endianness = IAR.guessEndianness(macros);
var defaultPaths = defaultPathsByLanguage["cpp"]
|| defaultPathsByLanguage["c"];
includePaths = defaultPaths.includePaths;
var version = IAR.guessVersion(macros, architecture);
if (version) {
versionMajor = version.major;
versionMinor = version.minor;
versionPatch = version.patch;
found = !!architecture && !!endianness;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/IcoUtilsVersionProbe.qbs 0000644 0001751 0000166 00000003354 14776170045 024660 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import "../../../modules/ico/ico.js" as IcoUtils
Probe {
// Inputs
property string toolFilePath
// Outputs
property var version
configure: {
version = IcoUtils.findIcoUtilsVersion(toolFilePath);
found = !!version;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/JdkProbe.qbs 0000644 0001751 0000166 00000004436 14776170045 022271 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.Host
import "../../../modules/java/utils.js" as JavaUtils
PathProbe {
// Inputs
property string architecture: !_androidCrossCompiling ? qbs.architecture : undefined
property bool _androidCrossCompiling: qbs.targetOS.contains("android")
&& !Host.os().contains("android")
environmentPaths: Environment.getEnv("JAVA_HOME")
platformSearchPaths: [
"/usr/lib/jvm/default-java", // Debian/Ubuntu
"/etc/alternatives/java_sdk_openjdk", // Fedora
"/usr/lib/jvm/default" // Arch
]
configure: {
path = JavaUtils.findJdkPath(Host.os(), architecture, environmentPaths,
platformSearchPaths);
found = !!path;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/AndroidSdkProbe.qbs 0000644 0001751 0000166 00000005770 14776170045 023605 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Host
import "../../../modules/Android/sdk/utils.js" as SdkUtils
import "../../../modules/Android/android-utils.js" as AndroidUtils
PathProbe {
environmentPaths: Environment.getEnv("ANDROID_HOME")
platformSearchPaths: {
if (Host.os().contains("windows"))
return [FileInfo.joinPaths(Environment.getEnv("LOCALAPPDATA"), "Android", "sdk")];
if (Host.os().contains("macos"))
return [FileInfo.joinPaths(Environment.getEnv("HOME"), "Library", "Android", "sdk")];
if (Host.os().contains("linux"))
return [FileInfo.joinPaths(Environment.getEnv("HOME"), "Android", "Sdk")];
}
// Outputs
property stringList candidatePaths
property var buildToolsVersions
property string buildToolsVersion
property var platforms
property string platform
configure: {
var i, allPaths = (environmentPaths || []).concat(platformSearchPaths || []);
candidatePaths = allPaths;
for (i in allPaths) {
if (File.exists(FileInfo.joinPaths(allPaths[i], "build-tools"))) {
path = allPaths[i];
buildToolsVersions = SdkUtils.availableBuildToolsVersions(path)
buildToolsVersion = buildToolsVersions[buildToolsVersions.length - 1];
platforms = AndroidUtils.availablePlatforms(path)
platform = platforms[platforms.length - 1];
found = true;
return;
}
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/ClangClBinaryProbe.qbs 0000644 0001751 0000166 00000006036 14776170045 024227 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
import qbs.ModUtils
import qbs.Utilities
import "path-probe.js" as PathProbeConfigure
BinaryProbe {
// output
property string vcvarsallPath
configure: {
var _selectors;
var results = PathProbeConfigure.configure(_selectors, names, nameSuffixes, nameFilter,
candidateFilter, searchPaths, pathSuffixes,
platformSearchPaths, environmentPaths,
platformEnvironmentPaths);
var compilerPath;
if (results.found)
compilerPath = results.files[0].filePath;
var compilers = Utilities.installedClangCls(compilerPath);
if (compilers.length >= 1) {
var result = {};
result.fileName = "clang-cl.exe";
result.path = compilers[0].toolchainInstallPath;
result.filePath = FileInfo.joinPaths(result.path, result.fileName);
result.candidatePaths = result.filePath;
result.vcvarsallPath = compilers[0].vcvarsallPath;
results.found = true;
results.files = [result];
}
found = results.found;
allResults = results.files;
if (allResults.length === 1) {
var result = allResults[0];
candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
vcvarsallPath = result.vcvarsallPath;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/GccBinaryProbe.qbs 0000644 0001751 0000166 00000005261 14776170045 023417 0 ustar runner docker import qbs.Environment
import qbs.FileInfo
import qbs.Host
import "path-probe.js" as PathProbeConfigure
BinaryProbe {
nameSuffixes: undefined // _compilerName already contains ".exe" suffix on Windows
// Inputs
property string _compilerName
property string _toolchainPrefix
// Outputs
property string tcPrefix
platformSearchPaths: {
var paths = base;
if (qbs.targetOS.contains("windows") && Host.os().contains("windows"))
paths.push(FileInfo.joinPaths(
Environment.getEnv("SystemDrive"), "MinGW", "bin"));
return paths;
}
names: {
var prefixes = [];
if (_toolchainPrefix) {
prefixes.push(_toolchainPrefix);
} else {
var arch = qbs.architecture;
if (qbs.targetOS.contains("windows")) {
if (!arch || arch === "x86") {
prefixes.push("mingw32-",
"i686-w64-mingw32-",
"i686-w64-mingw32.shared-",
"i686-w64-mingw32.static-",
"i686-mingw32-",
"i586-mingw32msvc-");
}
if (!arch || arch === "x86_64") {
prefixes.push("x86_64-w64-mingw32-",
"x86_64-w64-mingw32.shared-",
"x86_64-w64-mingw32.static-",
"amd64-mingw32msvc-");
}
}
}
return prefixes.map(function(prefix) {
return prefix + _compilerName;
}).concat([_compilerName]);
}
configure: {
var selectors;
var results = PathProbeConfigure.configure(
selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths,
pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths);
found = results.found;
if (!found)
return;
var resultsMapper = function(result) {
(nameSuffixes || [""]).forEach(function(suffix) {
var end = _compilerName + suffix;
if (result.fileName.endsWith(end))
result.tcPrefix = result.fileName.slice(0, -end.length);
});
return result;
};
results.files = results.files.map(resultsMapper);
allResults = results.files;
var result = results.files[0];
candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
tcPrefix = result.tcPrefix;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/ClBinaryProbe.qbs 0000644 0001751 0000166 00000005563 14776170045 023266 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
import qbs.ModUtils
import qbs.Utilities
import "path-probe.js" as PathProbeConfigure
BinaryProbe {
// input
property string preferredArchitecture
configure: {
var _selectors;
var results = PathProbeConfigure.configure(_selectors, names, nameSuffixes, nameFilter,
candidateFilter, searchPaths, pathSuffixes,
platformSearchPaths, environmentPaths,
platformEnvironmentPaths);
if (!results.found) {
var msvcs = Utilities.installedMSVCs(preferredArchitecture);
if (msvcs.length >= 1) {
var result = {};
result.fileName = "cl.exe";
result.path = msvcs[0].binPath;
result.filePath = FileInfo.joinPaths(path, fileName);
result.candidatePaths = result.filePath;
results.found = true;
results.files = [result];
}
}
found = results.found;
allResults = results.files;
if (allResults.length === 1) {
var result = allResults[0];
candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/QmakeProbe.qbs 0000644 0001751 0000166 00000003353 14776170045 022614 0 ustar runner docker
/****************************************************************************
**
** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import "qmake-probe.js" as QmakeProbeConfigure
Probe {
property stringList qmakePaths
property varList qtInfos
configure: {
qtInfos = QmakeProbeConfigure.configure(qmakePaths);
found = qtInfos.length > 0;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/DmcProbe.qbs 0000644 0001751 0000166 00000006750 14776170045 022265 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.ModUtils
import "../../../modules/cpp/dmc.js" as DMC
PathProbe {
// Inputs
property string compilerFilePath
property stringList enableDefinesByLanguage
property string _targetPlatform
property string _targetArchitecture
property string _targetExtender // Only for DOS 16/32 bit.
// Outputs
property string architecture
property string targetPlatform
property int versionMajor
property int versionMinor
property int versionPatch
property stringList includePaths
property var compilerDefinesByLanguage
configure: {
compilerDefinesByLanguage = {};
if (!File.exists(compilerFilePath)) {
found = false;
return;
}
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
var defaultPathsByLanguage = {};
for (var i = 0; i < languages.length; ++i) {
var tag = languages[i];
compilerDefinesByLanguage[tag] = DMC.dumpMacros(
compilerFilePath,
_targetPlatform,
_targetArchitecture,
_targetExtender,
tag);
var paths = DMC.dumpDefaultPaths(compilerFilePath, tag);
defaultPathsByLanguage[tag] = paths;
}
var macros = compilerDefinesByLanguage["c"]
|| compilerDefinesByLanguage["cpp"];
architecture = ModUtils.guessArchitecture(macros);
targetPlatform = ModUtils.guessTargetPlatform(macros);
var defaultPaths = defaultPathsByLanguage["cpp"]
|| defaultPathsByLanguage["c"];
includePaths = defaultPaths.includePaths;
var version = DMC.guessVersion(macros);
if (version) {
versionMajor = version.major;
versionMinor = version.minor;
versionPatch = version.patch;
found = !!architecture;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/IncludeProbe.qbs 0000644 0001751 0000166 00000003453 14776170045 023142 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
PathProbe {
platformSearchPaths: qbs.targetOS.contains("unix") ? [
"/usr/include",
"/usr/local/include",
"/include",
"/app/include",
] : []
platformEnvironmentPaths: {
if (qbs.toolchain.contains('msvc'))
return [ "INCLUDE" ];
return undefined;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/GccVersionProbe.qbs 0000644 0001751 0000166 00000005046 14776170045 023621 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.Host
import "../../../modules/cpp/gcc.js" as Gcc
PathProbe {
// Inputs
property string compilerFilePath
property var environment
property stringList _toolchain: qbs.toolchain
// Outputs
property int versionMajor
property int versionMinor
property int versionPatch
configure: {
if (!File.exists(compilerFilePath)) {
found = false;
return;
}
var macros = Gcc.dumpMacros(environment, compilerFilePath, undefined, Host.nullDevice());
if (_toolchain.contains("clang")) {
versionMajor = parseInt(macros["__clang_major__"], 10);
versionMinor = parseInt(macros["__clang_minor__"], 10);
versionPatch = parseInt(macros["__clang_patchlevel__"], 10);
found = true;
} else {
versionMajor = parseInt(macros["__GNUC__"], 10);
versionMinor = parseInt(macros["__GNUC_MINOR__"], 10);
versionPatch = parseInt(macros["__GNUC_PATCHLEVEL__"], 10);
found = true;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/path-probe.js 0000644 0001751 0000166 00000013702 14776170045 022455 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
function asStringList(key, value) {
if (typeof(value) === "string")
return [value];
if (value instanceof Array)
return value;
throw key + " must be a string or a stringList";
}
function canonicalSelectors(selectors, nameSuffixes) {
var mapper = function(selector) {
if (typeof(selector) === "string")
return {names : [selector]};
if (selector instanceof Array)
return {names : selector};
// dict
if (!selector.names)
throw '"names" must be specified';
selector.names = asStringList("names", selector.names);
if (selector.nameSuffixes)
selector.nameSuffixes = asStringList("nameSuffixes", selector.nameSuffixes);
else
selector.nameSuffixes = nameSuffixes;
return selector;
};
return selectors.map(mapper);
}
function pathsFromEnvs(envs, pathListSeparator) {
envs = envs || [];
var result = [];
for (var i = 0; i < envs.length; ++i) {
var value = Environment.getEnv(envs[i]) || '';
if (value.length > 0)
result = result.concat(value.split(pathListSeparator));
}
return result;
}
function configure(selectors, names, nameSuffixes, nameFilter, candidateFilter,
searchPaths, pathSuffixes, platformSearchPaths, environmentPaths,
platformEnvironmentPaths) {
var result = { found: false, files: [] };
if (!selectors && !names)
throw '"names" or "selectors" must be specified';
if (!selectors) {
selectors = [
{names: names, nameSuffixes: nameSuffixes}
];
} else {
selectors = canonicalSelectors(selectors, nameSuffixes);
}
if (nameFilter) {
selectors.forEach(function(selector) {
selector.names = ModUtils.concatAll.apply(undefined, selector.names.map(nameFilter));
});
}
selectors.forEach(function(selector) {
selector.names = ModUtils.concatAll.apply(undefined, selector.names.map(function(name) {
return (selector.nameSuffixes || [""]).map(function(suffix) {
return name + suffix;
});
}));
});
// FIXME: Suggest how to obtain paths from system
var _paths = ModUtils.concatAll(
pathsFromEnvs(environmentPaths, FileInfo.pathListSeparator()),
searchPaths,
pathsFromEnvs(platformEnvironmentPaths, FileInfo.pathListSeparator()),
platformSearchPaths);
var _suffixes = ModUtils.concatAll('', pathSuffixes);
_paths = _paths.map(function(p) { return FileInfo.fromNativeSeparators(p); });
_suffixes = _suffixes.map(function(p) { return FileInfo.fromNativeSeparators(p); });
var findFile = function(selector) {
var file = { found: false, candidatePaths: [] };
for (var i = 0; i < selector.names.length; ++i) {
for (var j = 0; j < _paths.length; ++j) {
for (var k = 0; k < _suffixes.length; ++k) {
var _filePath = FileInfo.joinPaths(_paths[j], _suffixes[k], selector.names[i]);
file.candidatePaths.push(_filePath);
if (File.exists(_filePath)
&& (!candidateFilter || candidateFilter(_filePath))) {
file.found = true;
file.filePath = _filePath;
// Manually specify the path components that constitute _filePath rather
// than using the FileInfo.path and FileInfo.fileName functions because we
// want to break _filePath into its constituent parts based on the input
// originally given by the user. For example, the FileInfo functions would
// produce a different result if any of the items in the names property
// contained more than a single path component.
file.fileName = selector.names[i];
file.path = FileInfo.joinPaths(_paths[j], _suffixes[k]);
return file;
}
}
}
}
return file;
};
result.files = selectors.map(findFile);
result.found = result.files.reduce(function(acc, value) { return acc && value.found }, true);
return result;
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/NpmProbe.qbs 0000644 0001751 0000166 00000006500 14776170045 022305 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import "path-probe.js" as PathProbeConfigure
import "../../../modules/nodejs/nodejs.js" as NodeJs
NodeJsProbe {
names: ["npm"]
// Inputs
property string interpreterPath
// Outputs
property path npmBin
property path npmRoot
property path npmPrefix
configure: {
if (!interpreterPath)
throw '"interpreterPath" must be specified';
var selectors;
var results = PathProbeConfigure.configure(
selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths,
pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths);
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(),
Host.os().contains("windows"));
v.prepend(interpreterPath);
var resultsMapper = function(result) {
result.npmBin = result.found
? NodeJs.findLocation(result.filePath, "bin", v.value)
: undefined;
result.npmRoot = result.found
? NodeJs.findLocation(result.filePath, "root", v.value)
: undefined;
result.npmPrefix = result.found
? NodeJs.findLocation(result.filePath, "prefix", v.value)
: undefined;
return result;
};
results.files = results.files.map(resultsMapper);
found = results.found;
allResults = results.files;
var result = results.files[0];
candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
npmBin = result.npmBin;
npmRoot = result.npmRoot;
npmPrefix = result.npmPrefix;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/qmake-probe.js 0000644 0001751 0000166 00000161701 14776170045 022622 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Host = require("qbs.Host");
var Process = require("qbs.Process");
var ProviderUtils = require("qbs.ProviderUtils");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function splitNonEmpty(s, c) { return s.split(c).filter(function(e) { return e; }); }
function getQmakeFilePaths(qmakeFilePaths) {
if (qmakeFilePaths && qmakeFilePaths.length > 0)
return qmakeFilePaths;
console.info("Detecting Qt installations...");
var filePaths = [];
var pathValue = Environment.getEnv("PATH");
if (pathValue) {
var dirs = splitNonEmpty(pathValue, FileInfo.pathListSeparator());
for (var i = 0; i < dirs.length; ++i) {
var candidate = FileInfo.joinPaths(dirs[i], "qmake" + FileInfo.executableSuffix());
var canonicalCandidate = FileInfo.canonicalPath(candidate);
if (!canonicalCandidate || !File.exists(canonicalCandidate))
continue;
if (FileInfo.completeBaseName(canonicalCandidate) !== "qtchooser")
candidate = canonicalCandidate;
if (!filePaths.contains(candidate)) {
console.info("Found Qt at '" + FileInfo.toNativeSeparators(candidate) + "'.");
filePaths.push(candidate);
}
}
}
if (filePaths.length === 0) {
console.warn("Could not find any qmake executables in PATH. Either make sure a qmake "
+ "executable is present in PATH or set the moduleProviders.Qt.qmakeFilePaths property "
+ "to point to a qmake executable.");
}
return filePaths;
}
function queryQmake(qmakeFilePath) {
var qmakeProcess = new Process;
qmakeProcess.exec(qmakeFilePath, ["-query"]);
if (qmakeProcess.exitCode() !== 0) {
throw "The qmake executable '" + FileInfo.toNativeSeparators(qmakeFilePath)
+ "' failed with exit code " + qmakeProcess.exitCode() + ".";
}
var queryResult = {};
while (!qmakeProcess.atEnd()) {
var line = qmakeProcess.readLine();
var index = (line || "").indexOf(":");
if (index !== -1)
queryResult[line.slice(0, index)] = line.slice(index + 1).trim();
}
return queryResult;
}
function pathQueryValue(queryResult, key) {
var p = queryResult[key];
if (p)
return FileInfo.fromNativeSeparators(p);
}
function readFileContent(filePath) {
var f = new TextFile(filePath, TextFile.ReadOnly);
var content = f.readAll();
f.close();
return content;
}
// TODO: Don't do the split every time...
function configVariable(configContent, key) {
var configContentLines = configContent.split('\n');
var regexp = new RegExp("^\\s*" + key + "\\s*\\+{0,1}=(.*)");
for (var i = 0; i < configContentLines.length; ++i) {
var line = configContentLines[i];
var match = regexp.exec(line);
if (match)
return match[1].trim();
}
}
function configVariableItems(configContent, key) {
var list = [];
var configContentLines = configContent.split('\n');
var regexp = new RegExp("^\\s*" + key + "\\s*([+-]?=)(.*)");
for (var i = 0; i < configContentLines.length; ++i) {
var line = configContentLines[i];
var match = regexp.exec(line);
if (!match)
continue;
var op = match[1];
var lineList = splitNonEmpty(match[2], ' ');
if (op === '=') {
list = lineList;
continue;
}
if (op === '+=') {
list = list.concat(lineList);
continue;
}
if (op === '-=') {
for (var j = 0; j < lineList.length; ++j) {
var idx = list.indexOf(lineList[j]);
if (idx !== -1)
list.splice(idx, 1);
}
}
}
return list;
}
function msvcCompilerVersionForYear(year) {
var mapping = {
"2005": "14", "2008": "15", "2010": "16", "2012": "17", "2013": "18", "2015": "19",
"2017": "19.1", "2019": "19.2"
};
return mapping[year];
}
function msvcCompilerVersionFromMkspecName(mkspecName) {
return msvcCompilerVersionForYear(mkspecName.slice(msvcPrefix().length));
}
function addQtBuildVariant(qtProps, buildVariantName) {
if (qtProps.qtConfigItems.contains(buildVariantName))
qtProps.buildVariant.push(buildVariantName);
}
function checkForStaticBuild(qtProps) {
if (qtProps.qtMajorVersion >= 5)
return qtProps.qtConfigItems.contains("static");
if (qtProps.frameworkBuild)
return false; // there are no Qt4 static frameworks
var isWin = qtProps.mkspecName.startsWith("win");
var libDir = isWin ? qtProps.binaryPath : qtProps.libraryPath;
var coreLibFiles = File.directoryEntries(libDir, File.Files)
.filter(function(fp) { return fp.contains("Core"); });
if (coreLibFiles.length === 0)
throw "Could not determine whether Qt is a static build.";
for (var i = 0; i < coreLibFiles.length; ++i) {
if (Utilities.isSharedLibrary(coreLibFiles[i]))
return false;
}
return true;
}
function guessMinimumWindowsVersion(qtProps) {
if (qtProps.mkspecName.startsWith("winrt-"))
return "10.0";
if (!ProviderUtils.isDesktopWindowsQt(qtProps))
return "";
if (qtProps.qtMajorVersion >= 6)
return "10.0";
if (qtProps.architecture === "x86_64" || qtProps.architecture === "ia64")
return "5.2"
var match = qtProps.mkspecName.match(/^win32-msvc(\d+)$/);
if (match) {
var msvcVersion = match[1];
if (msvcVersion < 2012)
return "5.0";
return "5.1";
}
return qtProps.qtMajorVersion < 5 ? "5.0" : "5.1";
}
function fillEntryPointLibs(qtProps, debug) {
result = [];
var isMinGW = ProviderUtils.isMinGwQt(qtProps);
// Some Linux distributions rename the qtmain library.
var qtMainCandidates = ["qtmain"];
if (isMinGW && qtProps.qtMajorVersion === 5)
qtMainCandidates.push("qt5main");
if (qtProps.qtMajorVersion === 6)
qtMainCandidates.push("Qt6EntryPoint");
for (var i = 0; i < qtMainCandidates.length; ++i) {
var baseNameCandidate = qtMainCandidates[i];
var qtmain = qtProps.libraryPath + '/';
if (isMinGW)
qtmain += "lib";
qtmain += baseNameCandidate + qtProps.qtLibInfix;
if (debug && ProviderUtils.qtNeedsDSuffix(qtProps))
qtmain += 'd';
if (isMinGW) {
qtmain += ".a";
} else {
qtmain += ".lib";
if (Utilities.versionCompare(qtProps.qtVersion, "5.4.0") >= 0)
result.push("Shell32.lib");
}
if (File.exists(qtmain)) {
result.push(qtmain);
break;
}
}
if (result.length === 0) {
console.warn("Could not find the qtmain library at '"
+ FileInfo.toNativeSeparators(qtProps.libraryPath)
+ "'. You will not be able to link Qt applications.");
}
return result;
}
function getQtProperties(qmakeFilePath) {
var queryResult = queryQmake(qmakeFilePath);
var qtProps = {};
qtProps.installPrefixPath = pathQueryValue(queryResult, "QT_INSTALL_PREFIX");
qtProps.documentationPath = pathQueryValue(queryResult, "QT_INSTALL_DOCS");
qtProps.translationsPath = pathQueryValue(queryResult, "QT_INSTALL_TRANSLATIONS");
qtProps.includePath = pathQueryValue(queryResult, "QT_INSTALL_HEADERS");
qtProps.libraryPath = pathQueryValue(queryResult, "QT_INSTALL_LIBS");
qtProps.hostLibraryPath = pathQueryValue(queryResult, "QT_HOST_LIBS");
qtProps.binaryPath = pathQueryValue(queryResult, "QT_HOST_BINS")
|| pathQueryValue(queryResult, "QT_INSTALL_BINS");
qtProps.installPath = pathQueryValue(queryResult, "QT_INSTALL_BINS");
qtProps.pluginPath = pathQueryValue(queryResult, "QT_INSTALL_PLUGINS");
qtProps.qmlPath = pathQueryValue(queryResult, "QT_INSTALL_QML");
qtProps.qmlImportPath = pathQueryValue(queryResult, "QT_INSTALL_IMPORTS");
qtProps.qtVersion = queryResult.QT_VERSION;
var mkspecsBaseSrcPath;
if (Utilities.versionCompare(qtProps.qtVersion, "5") >= 0) {
qtProps.mkspecBasePath = FileInfo.joinPaths(pathQueryValue(queryResult, "QT_HOST_DATA"),
"mkspecs");
mkspecsBaseSrcPath = FileInfo.joinPaths(pathQueryValue(queryResult, "QT_HOST_DATA/src"),
"mkspecs");
} else {
qtProps.mkspecBasePath = FileInfo.joinPaths
(pathQueryValue(queryResult, "QT_INSTALL_DATA"), "mkspecs");
}
if (Utilities.versionCompare(qtProps.qtVersion, "6") >= 0) {
qtProps.libExecPath = pathQueryValue(queryResult, "QT_HOST_LIBEXECS")
|| pathQueryValue(queryResult, "QT_INSTALL_LIBEXECS");
}
// QML tools were only moved in Qt 6.2.
qtProps.qmlLibExecPath = Utilities.versionCompare(qtProps.qtVersion, "6.2") >= 0
? qtProps.libExecPath : qtProps.binaryPath;
// qhelpgenerator was only moved in Qt 6.3.
qtProps.helpGeneratorLibExecPath = Utilities.versionCompare(qtProps.qtVersion, "6.3") >= 0
? qtProps.libExecPath : qtProps.binaryPath;
if (!File.exists(qtProps.mkspecBasePath))
throw "Cannot extract the mkspecs directory.";
var qconfigContent = readFileContent(FileInfo.joinPaths(qtProps.mkspecBasePath,
"qconfig.pri"));
qtProps.qtMajorVersion = parseInt(configVariable(qconfigContent, "QT_MAJOR_VERSION"));
qtProps.qtMinorVersion = parseInt(configVariable(qconfigContent, "QT_MINOR_VERSION"));
qtProps.qtPatchVersion = parseInt(configVariable(qconfigContent, "QT_PATCH_VERSION"));
qtProps.qtNameSpace = configVariable(qconfigContent, "QT_NAMESPACE");
qtProps.qtLibInfix = configVariable(qconfigContent, "QT_LIBINFIX") || "";
qtProps.architecture = configVariable(qconfigContent, "QT_TARGET_ARCH")
|| configVariable(qconfigContent, "QT_ARCH") || "x86";
qtProps.configItems = configVariableItems(qconfigContent, "CONFIG");
qtProps.qtConfigItems = configVariableItems(qconfigContent, "QT_CONFIG");
qtProps.enabledFeatures = configVariableItems(qconfigContent, "QT.global.enabled_features");
qtProps.disabledFeatures = configVariableItems(qconfigContent, "QT.global.disabled_features");
// retrieve the mkspec
if (qtProps.qtMajorVersion >= 5) {
qtProps.mkspecName = queryResult.QMAKE_XSPEC;
qtProps.mkspecPath = FileInfo.joinPaths(qtProps.mkspecBasePath, qtProps.mkspecName);
if (mkspecsBaseSrcPath && !File.exists(qtProps.mkspecPath))
qtProps.mkspecPath = FileInfo.joinPaths(mkspecsBaseSrcPath, qtProps.mkspecName);
} else {
if (Host.os().contains("windows")) {
var baseDirPath = FileInfo.joinPaths(qtProps.mkspecBasePath, "default");
var fileContent = readFileContent(FileInfo.joinPaths(baseDirPath, "qmake.conf"));
qtProps.mkspecPath = configVariable(fileContent, "QMAKESPEC_ORIGINAL");
if (!File.exists(qtProps.mkspecPath)) {
// Work around QTBUG-28792.
// The value of QMAKESPEC_ORIGINAL is wrong for MinGW packages. Y u h8 me?
var match = fileContent.exec(/\binclude\(([^)]+)\/qmake\.conf\)/m);
if (match) {
qtProps.mkspecPath = FileInfo.cleanPath(FileInfo.joinPaths(
baseDirPath, match[1]));
}
}
} else {
qtProps.mkspecPath = FileInfo.canonicalPath(
FileInfo.joinPaths(qtProps.mkspecBasePath, "default"));
}
// E.g. in qmake.conf for Qt 4.8/mingw we find this gem:
// QMAKESPEC_ORIGINAL=C:\\Qt\\Qt\\4.8\\mingw482\\mkspecs\\win32-g++
qtProps.mkspecPath = FileInfo.cleanPath(qtProps.mkspecPath);
qtProps.mkspecName = qtProps.mkspecPath;
var idx = qtProps.mkspecName.lastIndexOf('/');
if (idx !== -1)
qtProps.mkspecName = qtProps.mkspecName.slice(idx + 1);
}
if (!File.exists(qtProps.mkspecPath))
throw "mkspec '" + FileInfo.toNativeSeparators(qtProps.mkspecPath) + "' does not exist";
// Starting with qt 5.14, android sdk provides multi-abi
if (Utilities.versionCompare(qtProps.qtVersion, "5.14.0") >= 0
&& qtProps.mkspecPath.contains("android")) {
var qdeviceContent = readFileContent(FileInfo.joinPaths(qtProps.mkspecBasePath,
"qdevice.pri"));
qtProps.androidAbis = configVariable(qdeviceContent, "DEFAULT_ANDROID_ABIS").split(' ');
}
// determine MSVC version
if (ProviderUtils.isMsvcQt(qtProps)) {
var msvcMajor = configVariable(qconfigContent, "QT_MSVC_MAJOR_VERSION");
var msvcMinor = configVariable(qconfigContent, "QT_MSVC_MINOR_VERSION");
var msvcPatch = configVariable(qconfigContent, "QT_MSVC_PATCH_VERSION");
if (msvcMajor && msvcMinor && msvcPatch)
qtProps.msvcVersion = msvcMajor + "." + msvcMinor + "." + msvcPatch;
else
qtProps.msvcVersion = msvcCompilerVersionFromMkspecName(qtProps.mkspecName);
}
// determine whether we have a framework build
qtProps.frameworkBuild = qtProps.mkspecPath.contains("macx")
&& qtProps.configItems.contains("qt_framework");
// determine whether Qt is built with debug, release or both
qtProps.buildVariant = [];
addQtBuildVariant(qtProps, "debug");
addQtBuildVariant(qtProps, "release");
qtProps.staticBuild = checkForStaticBuild(qtProps);
qtProps.multiThreading = qtProps.enabledFeatures.contains("thread");
// determine whether user apps require C++11
if (qtProps.qtConfigItems.contains("c++11") && qtProps.staticBuild)
qtProps.configItems.push("c++11");
// Set the minimum operating system versions appropriate for this Qt version
qtProps.windowsVersion = guessMinimumWindowsVersion(qtProps);
if (qtProps.windowsVersion) { // Is target OS Windows?
if (qtProps.buildVariant.contains("debug"))
qtProps.entryPointLibsDebug = fillEntryPointLibs(qtProps, true);
if (qtProps.buildVariant.contains("release"))
qtProps.entryPointLibsRelease = fillEntryPointLibs(qtProps, false);
} else if (qtProps.mkspecPath.contains("macx")) {
if (qtProps.qtMajorVersion >= 5) {
// Since Qt 6.7.1, QMAKE_MACOSX|IOS_DEPLOYMENT_TARGET is no longer present in
// qmake.conf. But it is also present in qconfig.pri, so first try to read it from there
qtProps.macosVersion = configVariable(qconfigContent, "QMAKE_MACOSX_DEPLOYMENT_TARGET");
qtProps.iosVersion = configVariable(qconfigContent, "QMAKE_IOS_DEPLOYMENT_TARGET");
// Next, we override the value from qmake.conf, if present there
// Note, that TVOS/WATCHOS variables are only present in qmake.conf (as of Qt 6.7.1)
var lines = getFileContentsRecursively(FileInfo.joinPaths(qtProps.mkspecPath,
"qmake.conf"));
for (var i = 0; i < lines.length; ++i) {
var line = lines[i].trim();
match = line.match
(/^QMAKE_(MACOSX|IOS|TVOS|WATCHOS)_DEPLOYMENT_TARGET\s*=\s*(.*)\s*$/);
if (match) {
var platform = match[1];
var version = match[2];
if (platform === "MACOSX")
qtProps.macosVersion = version;
else if (platform === "IOS")
qtProps.iosVersion = version;
else if (platform === "TVOS")
qtProps.tvosVersion = version;
else if (platform === "WATCHOS")
qtProps.watchosVersion = version;
}
}
var isMac = qtProps.mkspecName !== "macx-ios-clang"
&& qtProps.mkspecName !== "macx-tvos-clang"
&& qtProps.mkspecName !== "macx-watchos-clang";
if (isMac) {
// Qt 5.0.x placed the minimum version in a different file
if (!qtProps.macosVersion)
qtProps.macosVersion = "10.6";
// If we're using C++11 with libc++, make sure the deployment target is >= 10.7
if (Utilities.versionCompare(qtProps.macosVersion, "10, 7") < 0
&& qtProps.qtConfigItems.contains("c++11")) {
qtProps.macosVersion = "10.7";
}
}
} else if (qtProps.qtMajorVersion === 4 && qtProps.qtMinorVersion >= 6) {
var qconfigDir = qtProps.frameworkBuild
? FileInfo.joinPaths(qtProps.libraryPath, "QtCore.framework", "Headers")
: FileInfo.joinPaths(qtProps.includePath, "Qt");
try {
var qconfig = new TextFile(FileInfo.joinPaths(qconfigDir, "qconfig.h"),
TextFile.ReadOnly);
var qtCocoaBuild = false;
var ok = true;
do {
line = qconfig.readLine();
if (line.match(/\s*#define\s+QT_MAC_USE_COCOA\s+1\s*/)) {
qtCocoaBuild = true;
break;
}
} while (!qconfig.atEof());
qtProps.macosVersion = qtCocoaBuild ? "10.5" : "10.4";
}
catch (e) {}
finally {
if (qconfig)
qconfig.close();
}
if (!qtProps.macosVersion) {
throw "Could not determine whether Qt is using Cocoa or Carbon from '"
+ FileInfo.toNativeSeparators(qconfig.filePath()) + "'.";
}
}
} else if (qtProps.mkspecPath.contains("android")) {
if (qtProps.qtMajorVersion >= 5)
qtProps.androidVersion = "2.3";
else if (qtProps.qtMajorVersion === 4 && qtProps.qtMinorVersion >= 8)
qtProps.androidVersion = "1.6"; // Necessitas
}
return qtProps;
}
function makePluginData() {
var pluginData = {};
pluginData.type = undefined;
pluginData.className = undefined;
pluginData.autoLoad = true;
pluginData["extends"] = [];
return pluginData;
}
function makeQtModuleInfo(name, qbsName, deps) {
var moduleInfo = {};
moduleInfo.name = name; // As in the path to the headers and ".name" in the pri files.
if (moduleInfo.name === undefined)
moduleInfo.name = "";
moduleInfo.qbsName = qbsName; // Lower-case version without "qt" prefix.
moduleInfo.dependencies = deps || []; // qbs names.
if (moduleInfo.qbsName && moduleInfo.qbsName !== "core"
&& !moduleInfo.dependencies.contains("core")) {
moduleInfo.dependencies.unshift("core");
}
moduleInfo.isPrivate = qbsName && qbsName.endsWith("-private");
moduleInfo.hasLibrary = !moduleInfo.isPrivate;
moduleInfo.isStaticLibrary = false;
moduleInfo.isPlugin = false;
moduleInfo.mustExist = true;
moduleInfo.modulePrefix = ""; // empty value means "Qt".
moduleInfo.version = undefined;
moduleInfo.includePaths = [];
moduleInfo.compilerDefines = [];
moduleInfo.staticLibrariesDebug = [];
moduleInfo.staticLibrariesRelease = [];
moduleInfo.dynamicLibrariesDebug = [];
moduleInfo.dynamicLibrariesRelease = [];
moduleInfo.linkerFlagsDebug = [];
moduleInfo.linkerFlagsRelease = [];
moduleInfo.libFilePathDebug = undefined;
moduleInfo.libFilePathRelease = undefined;
moduleInfo.frameworksDebug = [];
moduleInfo.frameworksRelease = [];
moduleInfo.frameworkPathsDebug = [];
moduleInfo.frameworkPathsRelease = [];
moduleInfo.libraryPaths = [];
moduleInfo.libDir = "";
moduleInfo.config = [];
moduleInfo.supportedPluginTypes = [];
moduleInfo.pluginData = makePluginData();
return moduleInfo;
}
function frameworkHeadersPath(qtModuleInfo, qtProps) {
return FileInfo.joinPaths(qtProps.libraryPath, qtModuleInfo.name + ".framework", "Headers");
}
function qt4ModuleIncludePaths(qtModuleInfo, qtProps) {
var paths = [];
if (ProviderUtils.qtIsFramework(qtModuleInfo, qtProps))
paths.push(frameworkHeadersPath(qtModuleInfo, qtProps));
else
paths.push(qtProps.includePath, FileInfo.joinPaths(qtProps.includePath, qtModuleInfo.name));
return paths;
}
// We erroneously called the "testlib" module "test" for quite a while. Let's not punish users
// for that.
function addTestModule(modules) {
var testModule = makeQtModuleInfo("QtTest", "test", ["testlib"]);
testModule.hasLibrary = false;
modules.push(testModule);
}
// See above.
function addDesignerComponentsModule(modules) {
var module = makeQtModuleInfo("QtDesignerComponents", "designercomponents",
["designercomponents-private"]);
module.hasLibrary = false;
modules.push(module);
}
function guessLibraryFilePath(prlFilePath, libDir, qtProps) {
var baseName = FileInfo.baseName(prlFilePath);
var prefixCandidates = ["", "lib"];
var suffixCandidates = ["so." + qtProps.qtVersion, "so", "a", "lib", "dll.a"];
for (var i = 0; i < prefixCandidates.length; ++i) {
var prefix = prefixCandidates[i];
for (var j = 0; j < suffixCandidates.length; ++j) {
var suffix = suffixCandidates[j];
var candidate = FileInfo.joinPaths(libDir, prefix + baseName + '.' + suffix);
if (File.exists(candidate))
return candidate;
}
}
}
function doReplaceQtLibNamesWithFilePath(namePathMap, libList) {
for (var i = 0; i < libList.length; ++i) {
var lib = libList[i];
var path = namePathMap[lib];
if (path)
libList[i] = path;
}
}
function replaceQtLibNamesWithFilePath(modules, qtProps) {
// We don't want to add the libraries for Qt modules via "-l", because of the
// danger that a wrong one will be picked up, e.g. from /usr/lib. Instead,
// we pull them in using the full file path.
var linkerNamesToFilePathsDebug = {};
var linkerNamesToFilePathsRelease = {};
for (var i = 0; i < modules.length; ++i) {
var m = modules[i];
linkerNamesToFilePathsDebug[
ProviderUtils.qtLibNameForLinker(m, qtProps, true)] = m.libFilePathDebug;
linkerNamesToFilePathsRelease[
ProviderUtils.qtLibNameForLinker(m, qtProps, false)] = m.libFilePathRelease;
}
for (i = 0; i < modules.length; ++i) {
var module = modules[i];
doReplaceQtLibNamesWithFilePath(linkerNamesToFilePathsDebug, module.dynamicLibrariesDebug);
doReplaceQtLibNamesWithFilePath(linkerNamesToFilePathsDebug, module.staticLibrariesDebug);
doReplaceQtLibNamesWithFilePath(linkerNamesToFilePathsRelease,
module.dynamicLibrariesRelease);
doReplaceQtLibNamesWithFilePath(linkerNamesToFilePathsRelease,
module.staticLibrariesRelease);
}
}
function doSetupLibraries(modInfo, qtProps, debugBuild, nonExistingPrlFiles, androidAbi) {
if (!modInfo.hasLibrary)
return; // Can happen for Qt4 convenience modules, like "widgets".
if (debugBuild) {
if (!qtProps.buildVariant.contains("debug"))
return;
var modulesNeverBuiltAsDebug = ["bootstrap", "qmldevtools"];
for (var i = 0; i < modulesNeverBuiltAsDebug.length; ++i) {
var m = modulesNeverBuiltAsDebug[i];
if (modInfo.qbsName === m || modInfo.qbsName === m + "-private")
return;
}
} else if (!qtProps.buildVariant.contains("release")) {
return;
}
var libs = modInfo.isStaticLibrary
? (debugBuild ? modInfo.staticLibrariesDebug : modInfo.staticLibrariesRelease)
: (debugBuild ? modInfo.dynamicLibrariesDebug : modInfo.dynamicLibrariesRelease);
var frameworks = debugBuild ? modInfo.frameworksDebug : modInfo.frameworksRelease;
var frameworkPaths = debugBuild ? modInfo.frameworkPathsDebug : modInfo.frameworkPathsRelease;
var flags = debugBuild ? modInfo.linkerFlagsDebug : modInfo.linkerFlagsRelease;
var libFilePath;
if (qtProps.mkspecName.contains("ios") && modInfo.isStaticLibrary) {
libs.push("z", "m");
if (qtProps.qtMajorVersion === 5 && qtProps.qtMinorVersion < 8) {
var platformSupportModule = makeQtModuleInfo("QtPlatformSupport", "platformsupport");
libs.push(ProviderUtils.qtLibNameForLinker(platformSupportModule, qtProps, debugBuild));
}
if (modInfo.name === "qios") {
flags.push("-force_load", FileInfo.joinPaths(
qtProps.pluginPath, "platforms",
ProviderUtils.qtLibBaseName(
modInfo, "libqios", debugBuild, qtProps) + ".a"));
}
}
var prlFilePath = modInfo.isPlugin
? FileInfo.joinPaths(qtProps.pluginPath, modInfo.pluginData.type)
: (modInfo.libDir ? modInfo.libDir : qtProps.libraryPath);
var libDir = prlFilePath;
if (ProviderUtils.qtIsFramework(modInfo, qtProps)) {
prlFilePath = FileInfo.joinPaths(
prlFilePath,
ProviderUtils.qtLibraryBaseName(modInfo, qtProps, false) + ".framework");
libDir = prlFilePath;
if (Utilities.versionCompare(qtProps.qtVersion, "5.14") >= 0) {
var candidates = [
FileInfo.joinPaths(prlFilePath, "Resources"), // E.g. 5.15.9, 6.8.0/macOS
FileInfo.joinPaths(prlFilePath, "Versions/A/Resources") // E.g. 6.8.0/iOS
];
for (i = 0; i < candidates.length; ++i) {
if (File.exists(candidates[i])) {
prlFilePath = candidates[i];
break;
}
}
}
}
var baseName = ProviderUtils.qtLibraryBaseName(modInfo, qtProps, debugBuild);
if (!qtProps.mkspecName.startsWith("win") && !ProviderUtils.qtIsFramework(modInfo, qtProps))
baseName = "lib" + baseName;
prlFilePath = FileInfo.joinPaths(prlFilePath, baseName);
var isNonStaticQt4OnWindows = qtProps.mkspecName.startsWith("win")
&& !modInfo.isStaticLibrary && qtProps.qtMajorVersion < 5;
if (isNonStaticQt4OnWindows)
prlFilePath = prlFilePath.slice(0, prlFilePath.length - 1); // The prl file base name does *not* contain the version number...
// qt for android versions 6.0 and 6.1 don't have the architecture suffix in the prl file
if (androidAbi.length > 0
&& modInfo.name !== "QtBootstrap"
&& (modInfo.name !== "QtQmlDevTools" || modInfo.name === "QtQmlDevTools"
&& Utilities.versionCompare(qtProps.qtVersion, "6.2") >= 0)
&& (Utilities.versionCompare(qtProps.qtVersion, "6.0") < 0
|| Utilities.versionCompare(qtProps.qtVersion, "6.2") >= 0)) {
prlFilePath += "_";
prlFilePath += androidAbi;
}
prlFilePath += ".prl";
try {
var prlFile = new TextFile(prlFilePath, TextFile.ReadOnly);
while (!prlFile.atEof()) {
var line = prlFile.readLine().trim();
var equalsOffset = line.indexOf('=');
if (equalsOffset === -1)
continue;
if (line.startsWith("QMAKE_PRL_TARGET")) {
var isMingw = qtProps.mkspecName.startsWith("win")
&& qtProps.mkspecName.contains("g++");
var isQtVersionBefore56 = qtProps.qtMajorVersion < 5
|| (qtProps.qtMajorVersion === 5 && qtProps.qtMinorVersion < 6);
// QMAKE_PRL_TARGET has a "lib" prefix, except for mingw.
// Of course, the exception has an exception too: For static libs, mingw *does*
// have the "lib" prefix.
var libFileName = "";
if (isQtVersionBefore56 && qtProps.qtMajorVersion === 5 && isMingw
&& !modInfo.isStaticLibrary) {
libFileName += "lib";
}
libFileName += line.slice(equalsOffset + 1).trim();
if (isNonStaticQt4OnWindows)
libFileName += 4; // This is *not* part of QMAKE_PRL_TARGET...
if (isQtVersionBefore56) {
if (qtProps.mkspecName.contains("msvc")) {
libFileName += ".lib";
} else if (isMingw) {
libFileName += ".a";
if (!File.exists(FileInfo.joinPaths(libDir, libFileName)))
libFileName = libFileName.slice(0, -2) + ".dll";
}
}
libFilePath = FileInfo.joinPaths(libDir, libFileName);
continue;
}
if (line.startsWith("QMAKE_PRL_CONFIG")) {
modInfo.config = splitNonEmpty(line.slice(equalsOffset + 1).trim(), ' ');
continue;
}
if (!line.startsWith("QMAKE_PRL_LIBS ="))
continue;
var parts = extractPaths(line.slice(equalsOffset + 1).trim(), prlFilePath);
for (i = 0; i < parts.length; ++i) {
var part = parts[i];
part = part.replace("$$[QT_INSTALL_LIBS]", qtProps.libraryPath);
part = part.replace("$$[QT_INSTALL_PLUGINS]", qtProps.pluginPath);
part = part.replace("$$[QT_INSTALL_PREFIX]", qtProps.installPrefixPath);
if (part.startsWith("-l")) {
libs.push(part.slice(2));
} else if (part.startsWith("-L")) {
modInfo.libraryPaths.push(part.slice(2));
} else if (part.startsWith("-F")) {
frameworkPaths.push(part.slice(2));
} else if (part === "-framework") {
if (++i < parts.length)
frameworks.push(parts[i]);
} else if (part === "-pthread") {
// prl files for android have QMAKE_PRL_LIBS = -llog -pthread but the pthread
// functionality is included in libc.
if (androidAbi.length === 0)
libs.push("pthread");
} else if (part.startsWith('-')) { // Some other option
console.debug("QMAKE_PRL_LIBS contains non-library option '" + part
+ "' in file '" + prlFilePath + "'");
flags.push(part);
} else if (part.startsWith("/LIBPATH:")) {
libraryPaths.push(part.slice(9).replace(/\\/g, '/'));
} else { // Assume it's a file path/name.
libs.push(part.replace(/\\/g, '/'));
}
}
}
} catch (e) {
// qt_ext_lib_extX.pri (usually) don't have a corresponding prl file.
// So the pri file variable QMAKE_LIBS_LIBX points to the library
if (modInfo.isExternal) {
libFilePath = debugBuild ? modInfo.staticLibrariesDebug[0] :
modInfo.staticLibrariesRelease[0];
}
if (!libFilePath || !File.exists(libFilePath))
libFilePath = guessLibraryFilePath(prlFilePath, libDir, qtProps);
if (nonExistingPrlFiles.contains(prlFilePath))
return;
nonExistingPrlFiles.push(prlFilePath);
if (modInfo.mustExist) {
console.warn("Could not open prl file '"
+ FileInfo.toNativeSeparators(prlFilePath) + "' for module '"
+ modInfo.name
+ "' (" + e + "), and failed to deduce the library file path. "
+ " This module will likely not be usable by qbs.");
}
}
finally {
if (prlFile)
prlFile.close();
}
if (debugBuild)
modInfo.libFilePathDebug = libFilePath;
else
modInfo.libFilePathRelease = libFilePath;
}
function setupLibraries(qtModuleInfo, qtProps, nonExistingPrlFiles, androidAbi) {
doSetupLibraries(qtModuleInfo, qtProps, true, nonExistingPrlFiles, androidAbi);
doSetupLibraries(qtModuleInfo, qtProps, false, nonExistingPrlFiles, androidAbi);
}
function allQt4Modules(qtProps) {
// as per http://doc.qt.io/qt-4.8/modules.html + private stuff.
var modules = [];
var core = makeQtModuleInfo("QtCore", "core");
core.compilerDefines.push("QT_CORE_LIB");
if (qtProps.qtNameSpace)
core.compilerDefines.push("QT_NAMESPACE=" + qtProps.qtNameSpace);
modules.push(core,
makeQtModuleInfo("QtCore", "core-private", ["core"]),
makeQtModuleInfo("QtGui", "gui"),
makeQtModuleInfo("QtGui", "gui-private", ["gui"]),
makeQtModuleInfo("QtMultimedia", "multimedia", ["gui", "network"]),
makeQtModuleInfo("QtMultimedia", "multimedia-private", ["multimedia"]),
makeQtModuleInfo("QtNetwork", "network"),
makeQtModuleInfo("QtNetwork", "network-private", ["network"]),
makeQtModuleInfo("QtOpenGL", "opengl", ["gui"]),
makeQtModuleInfo("QtOpenGL", "opengl-private", ["opengl"]),
makeQtModuleInfo("QtOpenVG", "openvg", ["gui"]),
makeQtModuleInfo("QtScript", "script"),
makeQtModuleInfo("QtScript", "script-private", ["script"]),
makeQtModuleInfo("QtScriptTools", "scripttools", ["script", "gui"]),
makeQtModuleInfo("QtScriptTools", "scripttools-private", ["scripttools"]),
makeQtModuleInfo("QtSql", "sql"),
makeQtModuleInfo("QtSql", "sql-private", ["sql"]),
makeQtModuleInfo("QtSvg", "svg", ["gui"]),
makeQtModuleInfo("QtSvg", "svg-private", ["svg"]),
makeQtModuleInfo("QtWebKit", "webkit", ["gui", "network"]),
makeQtModuleInfo("QtWebKit", "webkit-private", ["webkit"]),
makeQtModuleInfo("QtXml", "xml"),
makeQtModuleInfo("QtXml", "xml-private", ["xml"]),
makeQtModuleInfo("QtXmlPatterns", "xmlpatterns", ["network"]),
makeQtModuleInfo("QtXmlPatterns", "xmlpatterns-private", ["xmlpatterns"]),
makeQtModuleInfo("QtDeclarative", "declarative", ["gui", "script"]),
makeQtModuleInfo("QtDeclarative", "declarative-private", ["declarative"]),
makeQtModuleInfo("QtDesigner", "designer", ["gui", "xml"]),
makeQtModuleInfo("QtDesigner", "designer-private", ["designer"]),
makeQtModuleInfo("QtUiTools", "uitools"),
makeQtModuleInfo("QtUiTools", "uitools-private", ["uitools"]),
makeQtModuleInfo("QtHelp", "help", ["network", "sql"]),
makeQtModuleInfo("QtHelp", "help-private", ["help"]),
makeQtModuleInfo("QtTest", "testlib"),
makeQtModuleInfo("QtTest", "testlib-private", ["testlib"]));
if (qtProps.mkspecName.startsWith("win")) {
var axcontainer = makeQtModuleInfo("QAxContainer", "axcontainer");
axcontainer.modulePrefix = "Q";
axcontainer.isStaticLibrary = true;
axcontainer.includePaths.push(FileInfo.joinPaths(qtProps.includePath, "ActiveQt"));
modules.push(axcontainer);
var axserver = makeQtModuleInfo("QAxServer", "axserver");
axserver.modulePrefix = "Q";
axserver.isStaticLibrary = true;
axserver.compilerDefines.push("QAXSERVER");
axserver.includePaths.push(FileInfo.joinPaths(qtProps.includePath, "ActiveQt"));
modules.push(axserver);
} else {
modules.push(makeQtModuleInfo("QtDBus", "dbus"));
modules.push(makeQtModuleInfo("QtDBus", "dbus-private", ["dbus"]));
}
var designerComponentsPrivate = makeQtModuleInfo(
"QtDesignerComponents", "designercomponents-private",
["gui-private", "designer-private"]);
designerComponentsPrivate.hasLibrary = true;
modules.push(designerComponentsPrivate);
var phonon = makeQtModuleInfo("Phonon", "phonon");
phonon.includePaths = qt4ModuleIncludePaths(phonon, qtProps);
modules.push(phonon);
// Set up include paths that haven't been set up before this point.
for (i = 0; i < modules.length; ++i) {
var module = modules[i];
if (module.includePaths.length > 0)
continue;
module.includePaths = qt4ModuleIncludePaths(module, qtProps);
}
// Set up compiler defines haven't been set up before this point.
for (i = 0; i < modules.length; ++i) {
module = modules[i];
if (module.compilerDefines.length > 0)
continue;
module.compilerDefines.push("QT_" + module.qbsName.toUpperCase() + "_LIB");
}
// These are for the convenience of project file authors. It allows them
// to add a dependency to e.g. "Qt.widgets" without a version check.
var virtualModule = makeQtModuleInfo(undefined, "widgets", ["core", "gui"]);
virtualModule.hasLibrary = false;
modules.push(virtualModule);
virtualModule = makeQtModuleInfo(undefined, "quick", ["declarative"]);
virtualModule.hasLibrary = false;
modules.push(virtualModule);
virtualModule = makeQtModuleInfo(undefined, "concurrent");
virtualModule.hasLibrary = false;
modules.push(virtualModule);
virtualModule = makeQtModuleInfo(undefined, "printsupport", ["core", "gui"]);
virtualModule.hasLibrary = false;
modules.push(virtualModule);
addTestModule(modules);
addDesignerComponentsModule(modules);
var modulesThatCanBeDisabled = [
"xmlpatterns", "multimedia", "phonon", "svg", "webkit", "script", "scripttools",
"declarative", "gui", "dbus", "opengl", "openvg"];
var nonExistingPrlFiles = [];
for (i = 0; i < modules.length; ++i) {
module = modules[i];
var name = module.qbsName;
var privateIndex = name.indexOf("-private");
if (privateIndex !== -1)
name = name.slice(0, privateIndex);
if (modulesThatCanBeDisabled.contains(name))
module.mustExist = false;
if (qtProps.staticBuild)
module.isStaticLibrary = true;
setupLibraries(module, qtProps, nonExistingPrlFiles, "");
}
replaceQtLibNamesWithFilePath(modules, qtProps);
return modules;
}
function getFileContentsRecursively(filePath) {
var file = new TextFile(filePath, TextFile.ReadOnly);
var lines = splitNonEmpty(file.readAll(), '\n');
for (var i = 0; i < lines.length; ++i) {
var includeString = "include(";
var line = lines[i].trim();
if (!line.startsWith(includeString))
continue;
var offset = includeString.length;
var closingParenPos = line.indexOf(')', offset);
if (closingParenPos === -1) {
console.warn("Invalid include statement in '"
+ FileInfo.toNativeSeparators(filePath) + "'");
continue;
}
var includedFilePath = line.slice(offset, closingParenPos);
if (!FileInfo.isAbsolutePath(includedFilePath))
includedFilePath = FileInfo.joinPaths(FileInfo.path(filePath), includedFilePath);
var includedContents = getFileContentsRecursively(includedFilePath);
var j = i;
for (var k = 0; k < includedContents.length; ++k)
lines.splice(++j, 0, includedContents[k]);
lines.splice(i--, 1);
}
file.close();
return lines;
}
function extractPaths(rhs, filePath) {
var paths = [];
var startIndex = 0;
for (;;) {
while (startIndex < rhs.length && rhs.charAt(startIndex) === ' ')
++startIndex;
if (startIndex >= rhs.length)
break;
var endIndex;
if (rhs.charAt(startIndex) === '"') {
++startIndex;
endIndex = rhs.indexOf('"', startIndex);
if (endIndex === -1) {
console.warn("Unmatched quote in file '"
+ FileInfo.toNativeSeparators(filePath) + "'");
break;
}
} else {
endIndex = rhs.indexOf(' ', startIndex + 1);
if (endIndex === -1)
endIndex = rhs.length;
}
paths.push(FileInfo.cleanPath(rhs.slice(startIndex, endIndex)
.replace("$$PWD", FileInfo.path(filePath))));
startIndex = endIndex + 1;
}
return paths;
}
function removeDuplicatedDependencyLibs(modules) {
var revDeps = {};
var currentPath = [];
var getLibraries;
var getLibFilePath;
function setupReverseDependencies(modules) {
var moduleByName = {};
for (var i = 0; i < modules.length; ++i)
moduleByName[modules[i].qbsName] = modules[i];
for (i = 0; i < modules.length; ++i) {
var module = modules[i];
for (var j = 0; j < module.dependencies.length; ++j) {
var depmod = moduleByName[module.dependencies[j]];
if (!depmod)
continue;
if (!revDeps[depmod.qbsName])
revDeps[depmod.qbsName] = [];
revDeps[depmod.qbsName].push(module);
}
}
}
function roots(modules) {
var result = [];
for (i = 0; i < modules.length; ++i) {
var module = modules[i]
if (module.dependencies.length === 0)
result.push(module);
}
return result;
}
function traverse(module, libs) {
if (currentPath.contains(module))
return;
currentPath.push(module);
var moduleLibraryLists = getLibraries(module);
for (var i = 0; i < moduleLibraryLists.length; ++i) {
var modLibList = moduleLibraryLists[i];
for (j = modLibList.length - 1; j >= 0; --j) {
if (libs.contains(modLibList[j]))
modLibList.splice(j, 1);
}
}
var libFilePath = getLibFilePath(module);
if (libFilePath)
libs.push(libFilePath);
for (i = 0; i < moduleLibraryLists.length; ++i)
libs = libs.concat(moduleLibraryLists[i]);
libs.sort();
var deps = revDeps[module.qbsName];
for (i = 0; i < (deps || []).length; ++i)
traverse(deps[i], libs);
currentPath.pop();
}
setupReverseDependencies(modules);
// Traverse the debug variants of modules.
getLibraries = function(module) {
return [module.dynamicLibrariesDebug, module.staticLibrariesDebug];
};
getLibFilePath = function(module) { return module.libFilePathDebug; };
var rootModules = roots(modules);
for (var i = 0; i < rootModules.length; ++i)
traverse(rootModules[i], []);
// Traverse the release variants of modules.
getLibraries = function(module) {
return [module.dynamicLibrariesRelease, module.staticLibrariesRelease];
};
getLibFilePath = function(module) { return module.libFilePathRelease; };
for (i = 0; i < rootModules.length; ++i)
traverse(rootModules[i], []);
}
function allQt5Modules(qtProps, androidAbi) {
var nonExistingPrlFiles = [];
var modules = [];
var modulesDir = FileInfo.joinPaths(qtProps.mkspecBasePath, "modules");
var modulePriFiles = File.directoryEntries(modulesDir, File.Files);
for (var i = 0; i < modulePriFiles.length; ++i) {
var priFileName = modulePriFiles[i];
var priFilePath = FileInfo.joinPaths(modulesDir, priFileName);
var externalFileNamePrefix = "qt_ext_";
var moduleFileNamePrefix = "qt_lib_";
var pluginFileNamePrefix = "qt_plugin_";
var moduleFileNameSuffix = ".pri";
var fileHasExternalPrefix = priFileName.startsWith(externalFileNamePrefix);
var fileHasModulePrefix = priFileName.startsWith(moduleFileNamePrefix);
var fileHasPluginPrefix = priFileName.startsWith(pluginFileNamePrefix);
if (!fileHasPluginPrefix && !fileHasModulePrefix && !fileHasExternalPrefix
|| !priFileName.endsWith(moduleFileNameSuffix)) {
continue;
}
var moduleInfo = makeQtModuleInfo();
moduleInfo.isPlugin = fileHasPluginPrefix;
moduleInfo.isExternal = !moduleInfo.isPlugin && !fileHasModulePrefix;
var fileNamePrefix = moduleInfo.isPlugin ? pluginFileNamePrefix : moduleInfo.isExternal
? externalFileNamePrefix : moduleFileNamePrefix;
moduleInfo.qbsName = priFileName.slice(fileNamePrefix.length, -moduleFileNameSuffix.length);
if (moduleInfo.isPlugin) {
moduleInfo.name = moduleInfo.qbsName;
moduleInfo.isStaticLibrary = true;
}
var moduleKeyPrefix = (moduleInfo.isPlugin ? "QT_PLUGIN" : "QT")
+ '.' + moduleInfo.qbsName + '.';
moduleInfo.qbsName = moduleInfo.qbsName.replace("_private", "-private");
var hasV2 = false;
var hasModuleEntry = false;
var lines = getFileContentsRecursively(priFilePath);
if (moduleInfo.isExternal) {
moduleInfo.name = "qt" + moduleInfo.qbsName;
moduleInfo.isStaticLibrary = true;
for (var k = 0; k < lines.length; ++k) {
var extLine = lines[k].trim();
var extFirstEqualsOffset = extLine.indexOf('=');
if (extFirstEqualsOffset === -1)
continue;
var extKey = extLine.slice(0, extFirstEqualsOffset).trim();
var extValue = extLine.slice(extFirstEqualsOffset + 1).trim();
if (!extKey.startsWith("QMAKE_") || !extValue)
continue;
var elements = extKey.split('_');
if (elements.length >= 3) {
if (elements[1] === "LIBS") {
extValue = extValue.replace("/home/qt/work/qt/qtbase/lib",
qtProps.libraryPath);
extValue = extValue.replace("$$[QT_INSTALL_LIBS]", qtProps.libraryPath);
extValue = extValue.replace("$$[QT_INSTALL_LIBS/get]", qtProps.libraryPath);
if (elements.length === 4 ) {
if (elements[3] === androidAbi) {
moduleInfo.staticLibrariesRelease.push(extValue);
moduleInfo.staticLibrariesDebug.push(extValue);
}
} else if (elements.length === 5 ) {
// That's for "x86_64"
var abi = elements[3] + '_' + elements[4];
if (abi === androidAbi) {
moduleInfo.staticLibrariesRelease.push(extValue);
moduleInfo.staticLibrariesDebug.push(extValue);
}
} else {
moduleInfo.staticLibrariesRelease.push(extValue);
moduleInfo.staticLibrariesDebug.push(extValue);
}
} else if (elements[1] === "INCDIR") {
moduleInfo.includePaths.push(extValue.replace("$$[QT_INSTALL_HEADERS]",
qtProps.includePath));
}
}
}
moduleInfo.compilerDefines.push("QT_" + moduleInfo.qbsName.toUpperCase() + "_LIB");
moduleInfo.mustExist = false;
} else {
for (var j = 0; j < lines.length; ++j) {
var line = lines[j].trim();
var firstEqualsOffset = line.indexOf('=');
if (firstEqualsOffset === -1)
continue;
var key = line.slice(0, firstEqualsOffset).trim();
var value = line.slice(firstEqualsOffset + 1).trim();
if (!key.startsWith(moduleKeyPrefix) || !value)
continue;
if (key.endsWith(".name")) {
moduleInfo.name = value;
} else if (key.endsWith(".module")) {
hasModuleEntry = true;
} else if (key.endsWith(".depends")) {
moduleInfo.dependencies = splitNonEmpty(value, ' ');
for (var k = 0; k < moduleInfo.dependencies.length; ++k) {
moduleInfo.dependencies[k]
= moduleInfo.dependencies[k].replace("_private", "-private");
}
} else if (key.endsWith(".module_config")) {
var elems = splitNonEmpty(value, ' ');
for (k = 0; k < elems.length; ++k) {
var elem = elems[k];
if (elem === "no_link")
moduleInfo.hasLibrary = false;
else if (elem === "staticlib")
moduleInfo.isStaticLibrary = true;
else if (elem === "internal_module")
moduleInfo.isPrivate = true;
else if (elem === "v2")
hasV2 = true;
else if (elem === "lib_bundle")
moduleInfo.isFramework = true;
}
} else if (key.endsWith(".includes")) {
moduleInfo.includePaths = extractPaths(value, priFilePath);
for (k = 0; k < moduleInfo.includePaths.length; ++k) {
moduleInfo.includePaths[k] = moduleInfo.includePaths[k]
.replace("$$QT_MODULE_INCLUDE_BASE", qtProps.includePath)
.replace("$$QT_MODULE_HOST_LIB_BASE", qtProps.hostLibraryPath)
.replace("$$QT_MODULE_LIB_BASE", qtProps.libraryPath);
}
} else if (key.endsWith(".libs")) {
var libDirs = extractPaths(value, priFilePath);
if (libDirs.length === 1) {
moduleInfo.libDir = libDirs[0]
.replace("$$QT_MODULE_HOST_LIB_BASE", qtProps.hostLibraryPath)
.replace("$$QT_MODULE_LIB_BASE", qtProps.libraryPath);
} else {
moduleInfo.libDir = qtProps.libraryPath;
}
} else if (key.endsWith(".DEFINES")) {
moduleInfo.compilerDefines = splitNonEmpty(value, ' ');
} else if (key.endsWith(".VERSION")) {
moduleInfo.version = value;
} else if (key.endsWith(".plugin_types")) {
moduleInfo.supportedPluginTypes = splitNonEmpty(value, ' ');
} else if (key.endsWith(".TYPE")) {
moduleInfo.pluginData.type = value;
} else if (key.endsWith(".EXTENDS")) {
moduleInfo.pluginData["extends"] = splitNonEmpty(value, ' ');
for (k = 0; k < moduleInfo.pluginData["extends"].length; ++k) {
if (moduleInfo.pluginData["extends"][k] === "-") {
moduleInfo.pluginData["extends"].splice(k, 1);
moduleInfo.pluginData.autoLoad = false;
break;
}
}
} else if (key.endsWith(".CLASS_NAME")) {
moduleInfo.pluginData.className = value;
}
}
}
if (hasV2 && !hasModuleEntry && !moduleInfo.isStaticLibrary)
moduleInfo.hasLibrary = false;
// Fix include paths for Apple frameworks.
// The qt_lib_XXX.pri files contain wrong values for versions < 5.6.
if (!hasV2 && ProviderUtils.qtIsFramework(moduleInfo, qtProps)) {
moduleInfo.includePaths = [];
var baseIncDir = frameworkHeadersPath(moduleInfo, qtProps);
if (moduleInfo.isPrivate) {
baseIncDir = FileInfo.joinPaths(baseIncDir, moduleInfo.version);
moduleInfo.includePaths.push(baseIncDir,
FileInfo.joinPaths(baseIncDir, moduleInfo.name));
} else {
moduleInfo.includePaths.push(baseIncDir);
}
}
setupLibraries(moduleInfo, qtProps, nonExistingPrlFiles, androidAbi);
modules.push(moduleInfo);
if (moduleInfo.qbsName === "testlib")
addTestModule(modules);
if (moduleInfo.qbsName === "designercomponents-private")
addDesignerComponentsModule(modules);
}
replaceQtLibNamesWithFilePath(modules, qtProps);
removeDuplicatedDependencyLibs(modules);
return modules;
}
function getQtInfo(qmakeFilePath) {
if (!File.exists(qmakeFilePath)) {
throw "The specified qmake file path '"
+ FileInfo.toNativeSeparators(qmakeFilePath) + "' does not exist.";
}
var qtProps = getQtProperties(qmakeFilePath);
var androidAbis = [];
if (qtProps.androidAbis !== undefined) {
// Multiple androidAbis detected: Qt >= 5.14
androidAbis = qtProps.androidAbis;
} else {
// Single abi detected: Qt < 5.14
androidAbis.push('');
}
if (androidAbis.length > 1)
console.info("Qt with multiple abi detected: '" + androidAbis + "'");
var result = {};
result.qtProps = qtProps;
result.abiInfos = [];
result.qmakeFilePath = qmakeFilePath;
for (a = 0; a < androidAbis.length; ++a) {
var abiInfo = {};
if (androidAbis.length > 1)
console.info("Found abi '" + androidAbis[a] + "'...");
abiInfo.androidAbi = androidAbis[a];
var allModules = qtProps.qtMajorVersion < 5
? allQt4Modules(qtProps) : allQt5Modules(qtProps, androidAbis[a]);;
abiInfo.modules = {};
for (var i = 0; i < allModules.length; ++i) {
var module = allModules[i];
abiInfo.modules[module.qbsName] = module;
}
abiInfo.pluginsByType = {};
abiInfo.nonEssentialPlugins = [];
for (var moduleName in abiInfo.modules) {
var m = abiInfo.modules[moduleName];
if (m.isPlugin) {
if (!abiInfo.pluginsByType[m.pluginData.type])
abiInfo.pluginsByType[m.pluginData.type] = [];
abiInfo.pluginsByType[m.pluginData.type].push(m.name);
if (!m.pluginData.autoLoad)
abiInfo.nonEssentialPlugins.push(m.name);
}
}
result.abiInfos.push(abiInfo);
}
return result;
}
function configure(qmakeFilePaths) {
var result = [];
qmakeFilePaths = getQmakeFilePaths(qmakeFilePaths);
if (!qmakeFilePaths || qmakeFilePaths.length === 0)
return result;
for (var i = 0; i < qmakeFilePaths.length; ++i) {
var qtInfo = {};
try {
console.info("Getting info about Qt at '"
+ FileInfo.toNativeSeparators(qmakeFilePaths[i]) + "'...");
qtInfo = getQtInfo(qmakeFilePaths[i]);
result.push(qtInfo);
} catch (e) {
console.warn("Error getting info about Qt for '"
+ FileInfo.toNativeSeparators(qmakeFilePaths[i]) + "': " + e);
throw e;
}
}
return result;
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/JdkVersionProbe.qbs 0000644 0001751 0000166 00000003336 14776170045 023635 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import "../../../modules/java/utils.js" as JavaUtils
Probe {
// Inputs
property string javac
// Outputs
property var version
configure: {
version = JavaUtils.findJdkVersion(javac);
found = !!version;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/CosmicProbe.qbs 0000644 0001751 0000166 00000006101 14776170045 022765 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import "../../../modules/cpp/cosmic.js" as COSMIC
PathProbe {
// Inputs
property string compilerFilePath
property stringList enableDefinesByLanguage
// Outputs
property string architecture
property string endianness
property int versionMajor
property int versionMinor
property int versionPatch
property stringList includePaths
property var compilerDefinesByLanguage
configure: {
compilerDefinesByLanguage = {};
if (!File.exists(compilerFilePath)) {
found = false;
return;
}
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
// COSMIC compiler support only the C-language.
if (!languages.contains("c")) {
found = false;
return;
}
var macros = COSMIC.dumpMacros(compilerFilePath);
if (!macros) {
found = false;
return;
}
compilerDefinesByLanguage["c"] = macros;
architecture = COSMIC.guessArchitecture(compilerFilePath);
endianness = COSMIC.guessEndianness(architecture);
var defaultPaths = COSMIC.dumpDefaultPaths(compilerFilePath, architecture);
includePaths = defaultPaths.includePaths;
var version = COSMIC.dumpVersion(compilerFilePath);
if (version) {
versionMajor = version.major;
versionMinor = version.minor;
versionPatch = version.patch;
found = !!architecture && !!endianness;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/PkgConfigProbe.qbs 0000644 0001751 0000166 00000013657 14776170045 023435 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Host
import qbs.Process
import qbs.FileInfo
Probe {
// Inputs
property string sysroot: qbs.sysroot
property string executable: 'pkg-config'
property string name
property stringList packageNames: [name]
property string minVersion
property string exactVersion
property string maxVersion
property bool forStaticBuild: false
property stringList libDirs // Full, non-sysrooted paths, mirroring the environment variable
// Output
property stringList cflags // Unmodified --cflags output
property stringList libs // Unmodified --libs output
property stringList defines
property stringList libraries
property stringList libraryPaths
property stringList includePaths
property stringList compilerFlags
property stringList linkerFlags
property string modversion
configure: {
if (!packageNames || packageNames.length === 0)
throw 'PkgConfigProbe.packageNames must be specified.';
var p = new Process();
var stdout;
try {
var libDirsToSet = libDirs;
if (sysroot) {
p.setEnv("PKG_CONFIG_SYSROOT_DIR", sysroot);
if (!libDirsToSet) {
libDirsToSet = [
sysroot + "/usr/lib/pkgconfig",
sysroot + "/usr/share/pkgconfig"
];
}
}
if (libDirsToSet)
p.setEnv("PKG_CONFIG_LIBDIR", libDirsToSet.join(FileInfo.pathListSeparator()));
var versionArgs = [];
if (minVersion !== undefined)
versionArgs.push("--atleast-version=" + minVersion);
if (exactVersion !== undefined)
versionArgs.push("--exact-version=" + exactVersion);
if (maxVersion !== undefined)
versionArgs.push("--max-version=" + maxVersion);
if (versionArgs.length !== 0
&& p.exec(executable, versionArgs.concat(packageNames)) !== 0) {
return;
}
// protobuf is reserved as qbs module name, which depends on the protobuflib module
packageNames = packageNames.map(function(name) {
return name === "protobuflib" ? "protobuf" : name;
});
var args = packageNames;
if (p.exec(executable, args.concat([ '--cflags' ])) === 0) {
stdout = p.readStdOut().trim();
cflags = stdout ? stdout.split(/\s/): [];
var libsArgs = args.concat("--libs");
if (forStaticBuild)
libsArgs.push("--static");
if (p.exec(executable, libsArgs) === 0) {
stdout = p.readStdOut().trim();
libs = stdout ? stdout.split(/\s/): [];
if (p.exec(executable, [packageNames[0]].concat([ '--modversion' ])) === 0) {
modversion = p.readStdOut().trim();
found = true;
includePaths = [];
defines = []
compilerFlags = [];
for (var i = 0; i < cflags.length; ++i) {
var flag = cflags[i];
if (flag.startsWith("-I"))
includePaths.push(flag.slice(2));
else if (flag.startsWith("-D"))
defines.push(flag.slice(2));
else
compilerFlags.push(flag);
}
libraries = [];
libraryPaths = [];
linkerFlags = [];
for (i = 0; i < libs.length; ++i) {
flag = libs[i];
if (flag.startsWith("-l"))
libraries.push(flag.slice(2));
else if (flag.startsWith("-L"))
libraryPaths.push(flag.slice(2));
else
linkerFlags.push(flag);
}
console.debug("PkgConfigProbe: found packages " + packageNames);
return;
}
}
}
found = false;
cflags = undefined;
libs = undefined;
} finally {
p.close();
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/SdccProbe.qbs 0000644 0001751 0000166 00000006132 14776170045 022430 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import "../../../modules/cpp/sdcc.js" as SDCC
PathProbe {
// Inputs
property string compilerFilePath
property stringList enableDefinesByLanguage
property string preferredArchitecture
// Outputs
property string architecture
property string endianness
property int versionMajor
property int versionMinor
property int versionPatch
property stringList includePaths
property var compilerDefinesByLanguage
configure: {
compilerDefinesByLanguage = {};
if (!File.exists(compilerFilePath)) {
found = false;
return;
}
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
// SDCC compiler support only the C-language.
if (!languages.contains("c")) {
found = false;
return;
}
var macros = SDCC.dumpMacros(compilerFilePath, preferredArchitecture);
if (!macros) {
found = false;
return;
}
compilerDefinesByLanguage["c"] = macros;
architecture = SDCC.guessArchitecture(macros);
endianness = SDCC.guessEndianness(macros);
var defaultPaths = SDCC.dumpDefaultPaths(compilerFilePath, architecture);
includePaths = defaultPaths.includePaths;
var version = SDCC.guessVersion(macros);
if (version) {
versionMajor = version.major;
versionMinor = version.minor;
versionPatch = version.patch;
found = !!architecture && !!endianness;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/qbs-pkg-config-probe.js 0000644 0001751 0000166 00000011361 14776170045 024327 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var PkgConfig = require("qbs.PkgConfig");
var ProviderUtils = require("qbs.ProviderUtils");
var Process = require("qbs.Process");
function getQmakePaths(pkg) {
var packageName = pkg.baseFileName;
if (packageName === "QtCore"
|| packageName === "Qt5Core"
|| packageName === "Qt6Core") {
var binDir = pkg.variables["bindir"] || pkg.variables["host_bins"];
if (!binDir) {
if (packageName === "QtCore") { // Qt4 does not have host_bins
var mocLocation = pkg.variables["moc_location"];
if (!mocLocation) {
console.warn("No moc_location variable in " + packageName);
return;
}
binDir = FileInfo.path(mocLocation);
} else {
console.warn("No 'bindir' or 'host_bins' variable in " + packageName);
return;
}
}
var suffix = FileInfo.executableSuffix();
return [FileInfo.joinPaths(binDir, "qmake" + suffix)];
}
}
function configure(
executableFilePath, extraPaths, libDirs, staticMode, definePrefix, sysroot) {
var result = {};
result.packages = [];
result.packagesByModuleName = {};
result.brokenPackages = [];
result.qtInfos = [];
var options = {};
options.libDirs = libDirs;
options.sysroot = sysroot;
options.definePrefix = definePrefix;
if (options.sysroot)
options.allowSystemLibraryPaths = true;
options.staticMode = staticMode;
options.extraPaths = extraPaths;
if (options.sysroot && !options.libDirs) {
options.libDirs = [
options.sysroot + "/usr/lib/pkgconfig",
options.sysroot + "/usr/share/pkgconfig"
];
}
if (!options.libDirs) {
// if we have pkg-config/pkgconf installed, let's ask it for its search paths (since
// built-in search paths can differ between platforms)
if (executableFilePath) {
var p = new Process()
if (p.exec(executableFilePath, ['pkg-config', '--variable=pc_path']) === 0) {
var stdout = p.readStdOut().trim();
options.libDirs = stdout ? stdout.split(FileInfo.pathListSeparator()): [];
var installDir = FileInfo.path(executableFilePath);
options.libDirs = options.libDirs.map(function(path){
if (FileInfo.isAbsolutePath(path))
return path;
return FileInfo.cleanPath(FileInfo.joinPaths(installDir, path));
});
}
}
}
var pkgConfig = new PkgConfig(options);
result.packages = pkgConfig.packages();
for (var packageName in result.packages) {
var pkg = result.packages[packageName];
var moduleName = ProviderUtils.pkgConfigToModuleName(packageName);
result.packagesByModuleName[moduleName] = pkg;
if (packageName.startsWith("Qt")) {
if (!sysroot) {
var qmakePaths = getQmakePaths(pkg);
if (qmakePaths !== undefined)
result.qmakePaths = qmakePaths;
}
}
}
return result;
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/GccProbe.qbs 0000644 0001751 0000166 00000011312 14776170045 022244 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import "../../../modules/cpp/gcc.js" as Gcc
PathProbe {
// Inputs
property var compilerFilePathByLanguage
property stringList enableDefinesByLanguage
property stringList flags: []
property var environment
property string _sysroot: qbs.sysroot
property stringList _targetOS: qbs.targetOS
// Outputs
property string architecture
property string endianness
property string targetPlatform
property stringList includePaths
property stringList libraryPaths
property stringList frameworkPaths
property var compilerDefinesByLanguage
configure: {
compilerDefinesByLanguage = {};
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
for (var i = 0; i < languages.length; ++i) {
var fp = compilerFilePathByLanguage[languages[i]];
if (fp && File.exists(fp)) {
try {
compilerDefinesByLanguage[languages[i]] = Gcc.dumpMacros(environment, fp,
flags,
Host.nullDevice(),
languages[i]);
} catch (e) {
// Only throw errors when determining the compiler defines for the C language;
// for other languages we presume it is an indication that the language is not
// installed (as is typically the case for Objective-C/C++ on non-Apple systems)
if (languages[i] === "c")
throw e;
}
} else if (languages[i] === "c") {
found = false;
return;
}
}
var macros = compilerDefinesByLanguage["c"]
|| compilerDefinesByLanguage["cpp"]
|| compilerDefinesByLanguage["objc"]
|| compilerDefinesByLanguage["objcpp"];
var defaultPaths = Gcc.dumpDefaultPaths(environment, compilerFilePathByLanguage["cpp"] ||
compilerFilePathByLanguage["c"],
flags, Host.nullDevice(),
FileInfo.pathListSeparator(), _sysroot, _targetOS);
found = !!macros && !!defaultPaths;
includePaths = defaultPaths.includePaths;
libraryPaths = defaultPaths.libraryPaths;
frameworkPaths = defaultPaths.frameworkPaths;
// We have to dump the compiler's macros; -dumpmachine is not suitable because it is not
// always complete (for example, the subarch is not included for arm architectures).
architecture = ModUtils.guessArchitecture(macros);
targetPlatform = ModUtils.guessTargetPlatform(macros);
switch (macros["__BYTE_ORDER__"]) {
case "__ORDER_BIG_ENDIAN__":
endianness = "big";
break;
case "__ORDER_LITTLE_ENDIAN__":
endianness = "little";
break;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/BinaryProbe.qbs 0000644 0001751 0000166 00000003350 14776170045 022777 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Host
PathProbe {
nameSuffixes: Host.os().contains("windows") ? [".com", ".exe", ".bat", ".cmd"] : undefined
platformSearchPaths: Host.os().contains("unix") ? ["/usr/bin", "/usr/local/bin"] : []
platformEnvironmentPaths: [ "PATH" ]
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/XcodeLocationProbe.qbs 0000644 0001751 0000166 00000003640 14776170045 024310 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Process
Probe {
property path developerPath
configure: {
var p = new Process();
try {
p.exec("/usr/bin/xcode-select", ["--print-path"], true);
developerPath = p.readStdOut().trim();
} catch (e) {
developerPath = "/Applications/Xcode.app/Contents/Developer";
} finally {
p.close();
found = true;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/KeilProbe.qbs 0000644 0001751 0000166 00000006075 14776170045 022446 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.Host
import "../../../modules/cpp/keil.js" as KEIL
PathProbe {
// Inputs
property string compilerFilePath
property stringList enableDefinesByLanguage
// Outputs
property string architecture
property string endianness
property int versionMajor
property int versionMinor
property int versionPatch
property stringList includePaths
property var compilerDefinesByLanguage
configure: {
compilerDefinesByLanguage = {};
if (!File.exists(compilerFilePath)) {
found = false;
return;
}
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
for (var i = 0; i < languages.length; ++i) {
var tag = languages[i];
compilerDefinesByLanguage[tag] = KEIL.dumpMacros(
compilerFilePath, tag, Host.nullDevice());
}
var macros = compilerDefinesByLanguage["c"]
|| compilerDefinesByLanguage["cpp"];
architecture = KEIL.guessArchitecture(macros);
endianness = KEIL.guessEndianness(macros);
var defaultPaths = KEIL.dumpDefaultPaths(
compilerFilePath, Host.nullDevice());
includePaths = defaultPaths.includePaths;
var version = KEIL.guessVersion(macros);
if (version) {
versionMajor = version.major;
versionMinor = version.minor;
versionPatch = version.patch;
found = !!architecture && !!endianness;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/WatcomProbe.qbs 0000644 0001751 0000166 00000007164 14776170045 023014 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2022 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.Host
import qbs.ModUtils
import "../../../modules/cpp/watcom.js" as WATCOM
PathProbe {
// Inputs
property string compilerFilePath
property stringList enableDefinesByLanguage
property string _pathListSeparator
property string _toolchainInstallPath
property string _targetPlatform
property string _targetArchitecture
// Outputs
property string architecture
property string endianness
property string targetPlatform
property int versionMajor
property int versionMinor
property int versionPatch
property stringList includePaths
property var compilerDefinesByLanguage
property var environment
configure: {
compilerDefinesByLanguage = {};
if (!File.exists(compilerFilePath)) {
found = false;
return;
}
var languages = enableDefinesByLanguage;
if (!languages || languages.length === 0)
languages = ["c"];
environment = WATCOM.guessEnvironment(Host.os(), _targetPlatform, _targetArchitecture,
_toolchainInstallPath, _pathListSeparator);
includePaths = environment["INCLUDE"].split(_pathListSeparator).filter(function(path) {
return File.exists(path);
});
for (var i = 0; i < languages.length; ++i) {
var tag = languages[i];
compilerDefinesByLanguage[tag] = WATCOM.dumpMacros(
environment, compilerFilePath,
_targetPlatform, _targetArchitecture, tag);
}
var macros = compilerDefinesByLanguage["c"]
|| compilerDefinesByLanguage["cpp"];
endianness = macros["__BIG_ENDIAN"] ? "big" : "little";
architecture = ModUtils.guessArchitecture(macros);
targetPlatform = ModUtils.guessTargetPlatform(macros);
var version = WATCOM.guessVersion(macros);
if (version) {
versionMajor = version.major;
versionMinor = version.minor;
versionPatch = version.patch;
found = !!architecture && !!targetPlatform;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/FrameworkProbe.qbs 0000644 0001751 0000166 00000003421 14776170045 023507 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
PathProbe {
platformSearchPaths: (qbs.sysroot ? [qbs.sysroot + "/System/Library/Frameworks"] : []).concat([
"~/Library/Frameworks",
"/usr/local/lib",
"/Library/Frameworks",
"/System/Library/Frameworks"
])
nameSuffixes: ".framework"
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/TypeScriptProbe.qbs 0000644 0001751 0000166 00000007122 14776170045 023662 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import "path-probe.js" as PathProbeConfigure
import "../../../modules/typescript/typescript.js" as TypeScript
BinaryProbe {
id: tsc
names: ["tsc"]
searchPaths: packageManagerBinPath ? [packageManagerBinPath] : []
// Inputs
property path interpreterPath
property path packageManagerBinPath
property path packageManagerRootPath
// Outputs
property var version
configure: {
if (!condition)
return;
if (!interpreterPath)
throw '"interpreterPath" must be specified';
if (!packageManagerBinPath)
throw '"packageManagerBinPath" must be specified';
if (!packageManagerRootPath)
throw '"packageManagerRootPath" must be specified';
var selectors;
var results = PathProbeConfigure.configure(
selectors, names, nameSuffixes, nameFilter, candidateFilter, searchPaths,
pathSuffixes, platformSearchPaths, environmentPaths, platformEnvironmentPaths);
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(),
Host.os().contains("windows"));
v.prepend(interpreterPath);
var resultsMapper = function(result) {
result.version = result.found
? TypeScript.findTscVersion(result.filePath, v.value)
: undefined;
if (FileInfo.fromNativeSeparators(packageManagerBinPath) !== result.path ||
!File.exists(
FileInfo.fromNativeSeparators(packageManagerRootPath, "typescript"))) {
result = { found: false };
}
return result;
};
results.files = results.files.map(resultsMapper);
found = results.found;
allResults = results.files;
var result = results.files[0];
candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
version = result.version;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/LibraryProbe.qbs 0000644 0001751 0000166 00000006357 14776170045 023171 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.PathTools
PathProbe {
property string endianness
nameSuffixes: PathTools.librarySuffixes(qbs.targetOS, ["shared", "static"], true)
platformSearchPaths: {
var result = [];
if (qbs.targetOS.contains("unix")) {
if (qbs.targetOS.contains("linux") && qbs.architecture) {
if (qbs.architecture === "armv7")
result = ["/usr/lib/arm-linux-gnueabihf"]
else if (qbs.architecture === "arm64")
result = ["/usr/lib/aarch64-linux-gnu"]
else if (qbs.architecture === "mips" && endianness === "big")
result = ["/usr/lib/mips-linux-gnu"]
else if (qbs.architecture === "mips" && endianness === "little")
result = ["/usr/lib/mipsel-linux-gnu"]
else if (qbs.architecture === "mips64")
result = ["/usr/lib/mips64el-linux-gnuabi64"]
else if (qbs.architecture === "ppc")
result = ["/usr/lib/powerpc-linux-gnu"]
else if (qbs.architecture === "ppc64")
result = ["/usr/lib/powerpc64le-linux-gnu"]
else if (qbs.architecture === "x86_64")
result = ["/usr/lib64", "/usr/lib/x86_64-linux-gnu"]
else if (qbs.architecture === "x86")
result = ["/usr/lib32", "/usr/lib/i386-linux-gnu"]
}
result = result.concat(["/usr/lib", "/usr/local/lib", "/lib", "/app/lib"]);
}
return result;
}
nameFilter: PathTools.libraryNameFilter()
platformEnvironmentPaths: {
if (qbs.targetOS.contains("windows"))
return [ "PATH" ];
else
return [ "LIBRARY_PATH" ];
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/PathProbe.qbs 0000644 0001751 0000166 00000005536 14776170045 022457 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import "path-probe.js" as PathProbeConfigure
import qbs.Host
import qbs.ModUtils
Probe {
// Inputs
property stringList names
property stringList nameSuffixes
property var nameFilter
property var candidateFilter
property varList selectors
property pathList searchPaths
property stringList pathSuffixes
property pathList platformSearchPaths: Host.os().contains("unix") ? ['/usr', '/usr/local'] : []
property stringList environmentPaths
property stringList platformEnvironmentPaths
// Output
property stringList candidatePaths
property string path
property string filePath
property string fileName
property varList allResults
configure: {
var results = PathProbeConfigure.configure(selectors, names, nameSuffixes, nameFilter,
candidateFilter, searchPaths, pathSuffixes,
platformSearchPaths, environmentPaths,
platformEnvironmentPaths);
found = results.found;
allResults = results.files;
if (allResults.length === 1) {
var result = allResults[0];
candidatePaths = result.candidatePaths;
path = result.path;
filePath = result.filePath;
fileName = result.fileName;
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/WiXProbe.qbs 0000644 0001751 0000166 00000005637 14776170045 022274 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Utilities
PathProbe {
// Inputs
property string registryKey: {
var keys = [
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Installer XML",
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows Installer XML"
];
for (var i in keys) {
var groups = Utilities.nativeSettingGroups(keys[i]).filter(function (v) {
return v.match(/^([0-9]+)\.([0-9]+)$/);
});
groups.sort(function (a, b) {
var re = /^([0-9]+)\.([0-9]+)$/;
a = a.match(re);
b = b.match(re);
a = {major: a[1], minor: a[2]};
b = {major: b[1], minor: b[2]};
if (a.major === b.major)
return b.minor - a.minor;
return b.major - a.major;
});
for (var j in groups) {
var fullKey = keys[i] + "\\" + groups[j];
if (Utilities.getNativeSetting(fullKey, "ProductVersion"))
return fullKey;
}
}
}
// Outputs
property var root
property var version
configure: {
var key = registryKey;
path = Utilities.getNativeSetting(key, "InstallFolder");
root = Utilities.getNativeSetting(key, "InstallRoot");
version = Utilities.getNativeSetting(key, "ProductVersion");
found = path && root && version;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/NodeJsProbe.qbs 0000644 0001751 0000166 00000004123 14776170045 022734 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.FileInfo
import qbs.Host
BinaryProbe {
names: ["node", "nodejs"]
platformSearchPaths: {
var paths = base;
if (Host.os().contains("windows")) {
var env32 = Environment.getEnv("PROGRAMFILES(X86)");
var env64 = Environment.getEnv("PROGRAMFILES");
if (env64 === env32 && env64.endsWith(" (x86)"))
env64 = env64.slice(0, -(" (x86)".length)); // QTBUG-3845
paths.push(FileInfo.joinPaths(env64, "nodejs"));
paths.push(FileInfo.joinPaths(env32, "nodejs"));
}
return paths;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/AndroidNdkProbe.qbs 0000644 0001751 0000166 00000013201 14776170045 023564 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.TextFile
import "../../../modules/Android/android-utils.js" as AndroidUtils
PathProbe {
// Inputs
property path sdkPath
environmentPaths: Environment.getEnv("ANDROID_NDK_ROOT")
platformSearchPaths: {
var paths = [];
if (sdkPath)
paths.push(FileInfo.joinPaths(sdkPath, "ndk-bundle"));
if (Host.os().contains("windows"))
paths.push(FileInfo.joinPaths(Environment.getEnv("LOCALAPPDATA"),
"Android", "sdk", "ndk-bundle"));
if (Host.os().contains("macos"))
paths.push(FileInfo.joinPaths(Environment.getEnv("HOME"),
"Library", "Android", "sdk", "ndk-bundle"));
if (Host.os().contains("linux"))
paths.push(FileInfo.joinPaths(Environment.getEnv("HOME"),
"Android", "Sdk", "ndk-bundle"));
return paths;
}
// Outputs
property stringList candidatePaths
property string samplesDir
property var hostArch
property stringList toolchains: []
property string ndkVersion
configure: {
function readFileContent(filePath) {
var result = null;
if (!File.exists(filePath))
return result;
try {
var tf = new TextFile(filePath, TextFile.ReadOnly);
result = tf.readAll();
} finally {
if (tf)
tf.close();
}
return result;
}
var i, j, allPaths = (environmentPaths || []).concat(platformSearchPaths || []);
candidatePaths = allPaths;
for (i in allPaths) {
var platforms = [];
if (Host.os().contains("windows"))
platforms.push("windows-x86_64", "windows");
if (Host.os().contains("darwin"))
platforms.push("darwin-x86_64", "darwin-x86");
if (Host.os().contains("linux"))
platforms.push("linux-x86_64", "linux-x86");
for (j in platforms) {
if (File.exists(FileInfo.joinPaths(allPaths[i], "prebuilt", platforms[j]))) {
path = allPaths[i];
if (File.exists(FileInfo.joinPaths(path, "samples")))
samplesDir = FileInfo.joinPaths(path, "samples"); // removed in r11
hostArch = platforms[j];
toolchains = File.directoryEntries(FileInfo.joinPaths(path, "toolchains"),
File.Dirs | File.NoDotAndDotDot);
// NDK r11 and above
var content = readFileContent(path + "/source.properties");
if (content) {
var lines = content.trim().split(/\r?\n/g).filter(function (line) {
return line.length > 0;
});
for (var l = 0; l < lines.length; ++l) {
var m = lines[l].match(/^Pkg\.Revision\s*=\s*([0-9\.]+)$/);
if (m) {
ndkVersion = m[1];
found = true;
return;
}
}
}
// NDK r10 and below
var releaseTextFileCandidates = ["RELEASE.txt", "RELEASE.TXT"]
.map(function(v) { return FileInfo.joinPaths(path, v); })
.filter(File.exists);
content = releaseTextFileCandidates.length
? readFileContent(releaseTextFileCandidates[0]) : null;
if (content) {
var m = content.trim().match(/^r([0-9]+[a-z]?).*/);
if (m) {
ndkVersion = m[1];
found = true;
return;
}
}
}
}
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/ConanfileProbe.qbs 0000644 0001751 0000166 00000013634 14776170045 023457 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2020 Richard Weickelt
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Process
import qbs.File
import qbs.FileInfo
import qbs.TextFile
import qbs.Utilities
Probe {
// Inputs
property stringList additionalArguments: []
property path conanfilePath
property path packageReference
property path executable: "conan" + FileInfo.executableSuffix()
property stringList generators
property var options
property var settings
property string profileAll
property bool verbose: false
// Output
property path generatedFilesPath
property var dependencies
property var json
// Internal
// Ensure that the probe is re-run automatically whenever conanfile changes
// by making a file system property part of the probe's signature.
property int _conanfileLastModified: conanfilePath ? File.lastModified(conanfilePath) : 0
property path _projectBuildDirectory: project.buildDirectory
configure: {
if (conanfilePath && packageReference)
throw("conanfilePath and packageReference must not be defined at the same time.");
if (!conanfilePath && !packageReference)
throw("Either conanfilePath or packageReference must be defined.");
var reference = packageReference || FileInfo.cleanPath(conanfilePath);
console.info("Probing '" + reference + "'. This might take a while...");
if (conanfilePath && !File.exists(reference))
throw("The conanfile '" + reference + "' does not exist.");
function getConanVersion() {
var p = new Process();
p.exec(executable, ["--version"], true);
return p.readStdOut().trim().replace("Conan version", "").trim();
}
const isConan2 = Utilities.versionCompare(getConanVersion(), "2.0.0") >= 0;
var args = [
"install", reference,
];
if (options) {
if (typeof options !== "object")
throw("The property 'options' must be an object.");
Object.keys(options).forEach(function(key,index) {
args.push("-o");
args.push(key + "=" + options[key]);
});
}
if (settings) {
if (typeof settings !== "object")
throw("The property 'settings' must be an object.");
Object.keys(settings).forEach(function(key,index) {
args.push("-s");
args.push(key + "=" + settings[key]);
});
}
if (generators === undefined) {
if (isConan2)
generators = ["QbsDeps"];
else
generators = ["json"];
}
if (!isConan2 && !generators.contains("json"))
generators.push("json");
for (var i = 0; i < generators.length; i++)
args = args.concat(["-g", generators[i]]);
for (var i = 0; i < additionalArguments.length; i++)
args.push(additionalArguments[i]);
generatedFilesPath = FileInfo.cleanPath(_projectBuildDirectory +
"/genconan/" +
Utilities.getHash(args.join()));
const outputFolderOption = isConan2 ? "--output-folder" : "--install-folder";
args = args.concat([outputFolderOption, generatedFilesPath]);
var p = new Process();
p.start(executable, args);
while (!p.waitForFinished(500)) {
const output = p.readStdOut();
if (verbose && output) {
console.info(output);
}
}
while (!p.atEnd()) {
const output = p.readStdOut();
if (verbose && output) {
console.info(output);
}
}
if (p.exitCode()) {
const errorOutput = p.readStdErr();
p.close();
throw errorOutput;
}
p.close();
if (!isConan2 && generators.contains("json")) {
if (!File.exists(generatedFilesPath + "/conanbuildinfo.json"))
throw("No conanbuildinfo.json has been generated.");
var jsonFile = new TextFile(generatedFilesPath + "/conanbuildinfo.json", TextFile.ReadOnly);
json = JSON.parse(jsonFile.readAll());
jsonFile.close();
dependencies = {};
for (var i = 0; i < json.dependencies.length; ++i) {
var dep = json.dependencies[i];
dependencies[dep.name] = dep;
}
}
found = true;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/QbsPkgConfigProbe.qbs 0000644 0001751 0000166 00000004555 14776170045 024100 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import "qbs-pkg-config-probe.js" as PkgConfigProbeConfigure
Probe {
// Inputs
property string _executableFilePath
property stringList _extraPaths
property stringList _libDirs
property bool _staticMode: false
property bool _definePrefix: false
property path _sysroot
// Output
property var packages
property var packagesByModuleName
property var brokenPackages
property stringList qmakePaths
configure: {
var result = PkgConfigProbeConfigure.configure(
_executableFilePath,
_extraPaths,
_libDirs,
_staticMode,
_definePrefix,
_sysroot);
packages = result.packages;
packagesByModuleName = result.packagesByModuleName;
brokenPackages = result.brokenPackages;
qmakePaths = result.qmakePaths;
found = true;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/InnoSetupProbe.qbs 0000644 0001751 0000166 00000004576 14776170045 023512 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Utilities
PathProbe {
// Outputs
property var version
configure: {
var keys = [
"HKEY_LOCAL_MACHINE\\SOFTWARE\\",
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\"
];
var keySuffixes = [
"Microsoft\\Windows\\CurrentVersion\\Uninstall\\Inno Setup 5_is1",
"Microsoft\\Windows\\CurrentVersion\\Uninstall\\Inno Setup 6_is1"
];
for (var i = 0; i < keys.length; ++i) {
for (var j = 0; j < keySuffixes.length; ++j) {
var key = keys[i] + keySuffixes[j];
var v = Utilities.getNativeSetting(key, "DisplayVersion");
if (v) {
path = Utilities.getNativeSetting(key, "InstallLocation");
version = v;
found = path && version;
return;
}
}
}
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/Probes/XcodeProbe.qbs 0000644 0001751 0000166 00000010345 14776170045 022617 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Process
import qbs.PropertyList
import "../../../modules/xcode/xcode.js" as Xcode
Probe {
// Inputs
property string sdksPath
property string developerPath
property string xcodebuildPath
property stringList targetOS: qbs.targetOS
property string platformType
property string platformPath
property string devicePlatformPath
property string _xcodeInfoPlist: FileInfo.joinPaths(developerPath, "..", "Info.plist")
// Outputs
property var architectureSettings
property var availableSdks
property var platformSettings
property string xcodeVersion
configure: {
if (File.exists(_xcodeInfoPlist)) {
// Optimized case (no forking): reads CFBundleShortVersionString from
// Xcode.app/Contents/Info.plist
var propertyList = new PropertyList();
try {
propertyList.readFromFile(_xcodeInfoPlist);
var plist = propertyList.toObject();
if (plist)
xcodeVersion = plist["CFBundleShortVersionString"];
} finally {
propertyList.clear();
}
} else {
// Fallback case: execute xcodebuild -version if Xcode.app/Contents/Info.plist is
// missing; this can happen if developerPath is /, for example
var process;
try {
process = new Process();
process.exec(xcodebuildPath, ["-version"], true);
var lines = process.readStdOut().trim().split(/\r?\n/g).filter(function (line) {
return line.length > 0;
});
for (var l = 0; l < lines.length; ++l) {
var m = lines[l].match(/^Xcode ([0-9\.]+)$/);
if (m) {
xcodeVersion = m[1];
break;
}
}
} finally {
process.close();
}
}
architectureSettings = {};
var archSpecsPath = Xcode.archsSpecsPath(xcodeVersion, targetOS, platformType,
platformPath, devicePlatformPath, developerPath);
var archSpecsReader = new Xcode.XcodeArchSpecsReader(archSpecsPath);
archSpecsReader.getArchitectureSettings().map(function (setting) {
var val = archSpecsReader.getArchitectureSettingValue(setting);
if (val)
architectureSettings[setting] = val;
});
availableSdks = Xcode.sdkInfoList(sdksPath);
var platformInfoPlist = FileInfo.joinPaths(platformPath, "Info.plist");
platformSettings = Xcode.platformInfo(platformInfoPlist);
found = !!xcodeVersion;
}
}
qbs-src-2.6.1/share/qbs/imports/qbs/ProviderUtils/ 0000755 0001751 0000166 00000000000 14776170045 021434 5 ustar runner docker qbs-src-2.6.1/share/qbs/imports/qbs/ProviderUtils/provider-utils.js 0000644 0001751 0000166 00000011663 14776170045 024771 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Copyright (C) 2023 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Utilities = require("qbs.Utilities");
function pkgConfigToModuleName(packageName) {
return packageName.replace(/\./g, '-');
}
function msvcPrefix() { return "win32-msvc"; }
function isMsvcQt(qtProps) { return qtProps.mkspecName.startsWith(msvcPrefix()); }
function isMinGwQt(qtProps) {
return qtProps.mkspecName.startsWith("win32-g++") || qtProps.mkspecName.startsWith("mingw");
}
function isDesktopWindowsQt(qtProps) {
return qtProps.mkspecName.startsWith("win32-") || isMinGwQt(qtProps);
}
function qtNeedsDSuffix(qtProps) {
return !isMinGwQt(qtProps)
|| Utilities.versionCompare(qtProps.qtVersion, "5.14.0") < 0
|| qtProps.configItems.contains("debug_and_release");
}
function qtIsFramework(modInfo, qtProps) {
if (modInfo.isFramework)
return true;
if (!qtProps.frameworkBuild || modInfo.isStaticLibrary)
return false;
var modulesNeverBuiltAsFrameworks = [
"bootstrap", "openglextensions", "platformsupport", "qmldevtools", "harfbuzzng"
];
if (qtProps.qtMajorVersion <= 5) {
modulesNeverBuiltAsFrameworks.push("uitools"); // is framework since qt6
}
return !modulesNeverBuiltAsFrameworks.contains(modInfo.qbsName);
}
function qtLibBaseName(modInfo, libName, debugBuild, qtProps) {
var name = libName;
if (qtProps.mkspecName.startsWith("win")) {
if (debugBuild && qtNeedsDSuffix(qtProps))
name += 'd';
if (!modInfo.isStaticLibrary && qtProps.qtMajorVersion < 5)
name += qtProps.qtMajorVersion;
}
if (qtProps.mkspecName.contains("macx")
|| qtProps.mkspecName.contains("ios")
|| qtProps.mkspecName.contains("darwin")) {
if (!qtIsFramework(modInfo, qtProps)
&& qtProps.buildVariant.contains("debug")
&& (!qtProps.buildVariant.contains("release") || debugBuild)) {
name += "_debug";
}
}
return name;
}
function qtModuleNameWithoutPrefix(modInfo) {
if (modInfo.name === "Phonon")
return "phonon";
if (!modInfo.modulePrefix && modInfo.name.startsWith("Qt"))
return modInfo.name.slice(2); // Strip off "Qt".
if (modInfo.name.startsWith(modInfo.modulePrefix))
return modInfo.name.slice(modInfo.modulePrefix.length);
return modInfo.name;
}
function qtLibraryBaseName(modInfo, qtProps, debugBuild) {
if (modInfo.isPlugin)
return qtLibBaseName(modInfo, modInfo.name, debugBuild, qtProps);
// Some modules use a different naming scheme, so it doesn't get boring.
var libNameBroken = modInfo.name === "Enginio"
|| modInfo.name === "DataVisualization"
|| modInfo.name === "Phonon";
var libName = "";
if (!modInfo.isExternal) {
libName += !modInfo.modulePrefix && !libNameBroken ? "Qt" : modInfo.modulePrefix;
if (qtProps.qtMajorVersion >= 5 && !qtIsFramework(modInfo, qtProps) && !libNameBroken)
libName += qtProps.qtMajorVersion;
}
libName += qtModuleNameWithoutPrefix(modInfo);
if (!modInfo.isExternal)
libName += qtProps.qtLibInfix;
return qtLibBaseName(modInfo, libName, debugBuild, qtProps);
}
function qtLibNameForLinker(modInfo, qtProps, debugBuild) {
if (!modInfo.hasLibrary)
return undefined;
var libName = qtLibraryBaseName(modInfo, qtProps, debugBuild);
if (qtProps.mkspecName.contains("msvc"))
libName += ".lib";
return libName;
}
qbs-src-2.6.1/share/qbs/modules/ 0000755 0001751 0000166 00000000000 14776170045 016007 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/qnx/ 0000755 0001751 0000166 00000000000 14776170045 016615 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/qnx/qnx.qbs 0000644 0001751 0000166 00000012062 14776170045 020133 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Probes
import qbs.Utilities
Module {
Probes.PathProbe {
id: qnxSdkProbe
names: ["qnx700", "qnx660", "qnx650"]
searchPaths: Host.os().includes("windows")
? [Environment.getEnv("USERPROFILE"), Environment.getEnv("SystemDrive")]
: [Environment.getEnv("HOME"), "/opt"]
}
Probe {
id: qnxTargetOsProbe
property string qnxSdkDir: sdkDir
property stringList targets: []
configure: {
if (qnxSdkDir) {
var validEntries = [];
var entries = File.directoryEntries(
FileInfo.joinPaths(qnxSdkDir, "target"),
File.Dirs | File.NoDotAndDotDot);
for (var i = 0; i < entries.length; ++i) {
if (/^qnx[0-9]$/.test(entries[i]))
validEntries.push(entries[i]);
}
validEntries.sort();
validEntries.reverse();
targets = validEntries;
found = targets.length > 0;
} else {
found = false;
}
}
}
version: qnxSdkProbe.found ? qnxSdkProbe.fileName.substr(3, 3).split("").join(".") : undefined
readonly property bool qnx7: version ? Utilities.versionCompare(version, "7") >= 0 : false
property string sdkDir: qnxSdkProbe.filePath
property string hostArch: qnx7 ? "x86_64" : "x86"
property string hostOs: {
if (Host.os().includes("linux"))
return "linux";
if (Host.os().includes("macos"))
return "darwin";
if (Host.os().includes("windows"))
return qnx7 ? "win64" : "win32";
}
property string targetOs: qnxTargetOsProbe.targets[0]
property string compilerName: "gcc"
property string configurationDir: FileInfo.joinPaths(Environment.getEnv("HOME"), ".qnx")
property string hostDir: FileInfo.joinPaths(sdkDir, "host", hostOs, hostArch)
property string targetDir: FileInfo.joinPaths(sdkDir, "target", targetOs)
property var buildEnv: ({
"QNX_HOST": hostDir,
"QNX_TARGET": targetDir,
"QNX_CONFIGURATION": configurationDir
})
qbs.sysroot: targetDir
validate: {
if (!sdkDir) {
throw ModUtils.ModuleError("Could not find a QNX SDK in any of the following "
+ "locations:\n\t" + qnxSdkProbe.candidatePaths.join("\n\t")
+ "\nInstall the QNX SDK to one of the above locations, "
+ "or set the qnx.sdkDir property to a valid QNX SDK "
+ "location.");
}
if (!hostOs) {
throw ModUtils.ModuleError("Host operating system '" + Host.os()
+ "' is not supported by the QNX SDK.");
} else if (!File.exists(hostDir)) {
throw ModUtils.ModuleError("Detected host tools operating system '" + hostOs
+ "' and architecture '" + hostArch + "' directory is not "
+ "present in the QNX SDK installed at '" + sdkDir
+ "' in the expected location '" + hostDir
+ "'; did you forget to install it?");
}
if (!targetOs)
throw ModUtils.ModuleError("Could not find any QNX targets in '" + targetDir + "'");
}
}
qbs-src-2.6.1/share/qbs/modules/cli/ 0000755 0001751 0000166 00000000000 14776170045 016556 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/cli/CLIModule.qbs 0000644 0001751 0000166 00000015537 14776170045 021055 0 ustar runner docker // base for Common Language Infrastructure modules
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import "cli.js" as CLI
Module {
Group {
condition: qbs.targetOS.includes("darwin")
Depends { name: "bundle" }
product.bundle.isBundle: false
}
condition: false
property string warningLevel: 'all' // 'none', 'all'
property bool treatWarningsAsErrors: false
property string architecture: "anycpu" // for the CLI this is a much better default than qbs.architecture
property string optimization: qbs.optimization
property bool debugInformation: qbs.debugInformation
property stringList defines
property stringList platformDefines: qbs.enableDebugCode ? [] : ["NDEBUG"]
property stringList compilerDefines
PropertyOptions {
name: "compilerDefines"
description: "preprocessor macros that are defined when using this particular compiler"
}
property pathList libraryPaths
property string csharpCompilerName
property string csharpCompilerPath: FileInfo.joinPaths(toolchainInstallPath, csharpCompilerName)
property string vbCompilerName
property string vbCompilerPath: FileInfo.joinPaths(toolchainInstallPath, vbCompilerName)
property string fsharpCompilerName
property string fsharpCompilerPath: FileInfo.joinPaths(toolchainInstallPath, fsharpCompilerName)
property string resgenName: "resgen"
property string resgenPath: FileInfo.joinPaths(toolchainInstallPath, resgenName)
property string dynamicLibrarySuffix: ".dll"
property string executableSuffix: ".exe"
property string netmoduleSuffix: ".netmodule"
property string debugInfoSuffix
property stringList dynamicLibraries // list of names, will be linked with /reference:name
property stringList netmodules // list of netmodule files, will be linked with /addmodule:name
property bool generateManifestFile: true
property string toolchainInstallPath
property stringList compilerFlags
PropertyOptions {
name: "compilerFlags"
description: "additional compiler flags"
}
// Platform properties. Those are intended to be set by the toolchain setup
// and are prepended to the corresponding user properties.
property stringList platformCompilerFlags
FileTagger {
patterns: ["*.cs", "*.CS"]
fileTags: ["cli.csharp"]
}
FileTagger {
patterns: ["*.vb", "*.VB"]
fileTags: ["cli.vb"]
}
FileTagger {
patterns: ["*.fs", "*.FS"]
fileTags: ["cli.fsharp"]
}
FileTagger {
patterns: ["*.fsi", "*.FSI"]
fileTags: ["cli.fsharp_signature"]
}
FileTagger {
patterns: ["*.resx", "*.RESX"]
fileTags: ["cli.resx"]
}
validate: {
var validator = new ModUtils.PropertyValidator("cli");
validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath);
validator.validate();
}
setupBuildEnvironment: {
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(),
Host.os().includes("windows"));
v.prepend(product.cli.toolchainInstallPath);
v.set();
}
Rule {
id: cliApplication
multiplex: true
inputs: ["cli.csharp", "cli.vb", "cli.fsharp"]
inputsFromDependencies: ["cli.netmodule", "dynamiclibrary", "cli.resources"]
Artifact {
fileTags: ["application"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ product.moduleProperty(product.moduleName,
"executableSuffix"))
}
Artifact {
fileTags: ["debuginfo_app"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ product.moduleProperty(product.moduleName,
"debugInfoSuffix"))
}
prepare: CLI.prepareCompiler(product, inputs, outputs.application[0])
}
Rule {
id: cliDynamicLibrary
multiplex: true
inputs: ["cli.csharp", "cli.vb", "cli.fsharp"]
inputsFromDependencies: ["cli.netmodule", "dynamiclibrary", "cli.resources"]
Artifact {
fileTags: ["dynamiclibrary"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ product.moduleProperty(product.moduleName,
"dynamicLibrarySuffix"))
}
Artifact {
fileTags: ["debuginfo_dll"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ product.moduleProperty(product.moduleName,
"debugInfoSuffix"))
}
prepare: CLI.prepareCompiler(product, inputs, outputs.dynamiclibrary[0])
}
Rule {
id: netmodule
multiplex: true
inputs: ["cli.csharp", "cli.vb", "cli.fsharp"]
inputsFromDependencies: ["cli.netmodule", "dynamiclibrary", "cli.resources"]
Artifact {
fileTags: ["cli.netmodule"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ product.moduleProperty(product.moduleName,
"netmoduleSuffix"))
}
Artifact {
fileTags: ["debuginfo_netmodule"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ product.moduleProperty(product.moduleName,
"debugInfoSuffix"))
}
prepare: CLI.prepareCompiler(product, inputs, outputs["cli.netmodule"][0])
}
Rule {
inputs: ["cli.resx"]
Artifact {
fileTags: ["cli.resources"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
input.completeBaseName + ".resources")
}
prepare: {
var args = [ input.filePath, output.filePath ];
var cmd = new Command(ModUtils.moduleProperty(product, "resgenPath"), args);
cmd.description = "building " + input.fileName;
cmd.highlight = "compiler";
cmd.workingDirectory = FileInfo.path(output.filePath);
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/modules/cli/mono.qbs 0000644 0001751 0000166 00000001231 14776170045 020232 0 ustar runner docker import qbs.File
import qbs.Host
import qbs.Probes
CLIModule {
condition: qbs.toolchain && qbs.toolchain.includes("mono")
debugInfoSuffix: ".mdb"
csharpCompilerName: "mcs"
vbCompilerName: "vbnc"
fsharpCompilerName: "fsharpc"
Probes.PathProbe {
id: monoProbe
names: ["mono"]
platformSearchPaths: {
var paths = [];
if (Host.os().includes("macos"))
paths.push("/Library/Frameworks/Mono.framework/Commands");
if (Host.os().includes("unix"))
paths.push("/usr/bin");
return paths;
}
}
toolchainInstallPath: monoProbe.path
}
qbs-src-2.6.1/share/qbs/modules/cli/windows-dotnet.qbs 0000644 0001751 0000166 00000002007 14776170045 022251 0 ustar runner docker import qbs.Utilities
CLIModule {
condition: qbs.toolchain && qbs.toolchain.includes("dotnet")
debugInfoSuffix: ".pdb"
csharpCompilerName: "csc"
vbCompilerName: "vbc"
fsharpCompilerName: "fsc"
Probe {
id: dotnetProbe
property string toolchainInstallPath // Output
configure: {
// https://msdn.microsoft.com/en-us/library/hh925568.aspx
var keys = [
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP",
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\NET Framework Setup\\NDP"
];
for (var i in keys) {
var key = keys[i] + "\\v4\\Full";
var value = Utilities.getNativeSetting(key, "InstallPath");
if (value) {
toolchainInstallPath = value;
found = true;
break;
}
}
}
}
toolchainInstallPath: dotnetProbe.toolchainInstallPath
}
qbs-src-2.6.1/share/qbs/modules/cli/cli.js 0000644 0001751 0000166 00000016213 14776170045 017666 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
function prepareCompiler(product, inputs, output) {
var i;
var args = ["/nologo"];
var platformDefines = product.moduleProperty("cli", "platformDefines");
var compilerDefines = product.moduleProperty("cli", "compilerDefines");
var defines = product.moduleProperty("cli", "defines");
var platformCompilerFlags = product.moduleProperty("cli", "platformCompilerFlags");
var compilerFlags = product.moduleProperty("cli", "compilerFlags")
var libraryPaths = product.moduleProperty("cli", "libraryPaths");
var dynamicLibraries = product.moduleProperty("cli", "dynamicLibraries");
var netmodules = product.moduleProperty("cli", "netmodules");
var warnAsError = product.moduleProperty("cli", "treatWarningsAsErrors");
var warningLevel = product.moduleProperty("cli", "warningLevel");
var debugInformation = product.moduleProperty("cli", "debugInformation");
var optimization = product.moduleProperty("cli", "optimization");
var architecture = product.moduleProperty("cli", "architecture");
var csharpCompilerPath = product.moduleProperty("cli", "csharpCompilerPath");
var vbCompilerPath = product.moduleProperty("cli", "vbCompilerPath");
var fsharpCompilerPath = product.moduleProperty("cli", "fsharpCompilerPath");
var compilers = {
"cli.csharp": csharpCompilerPath,
"cli.vb": vbCompilerPath,
"cli.fsharp": fsharpCompilerPath
};
var pathFunction = product.moduleProperty("qbs", "hostOS").includes("windows")
? FileInfo.toWindowsSeparators
: function (path) { return path; };
var outputDescription = "assembly";
if (output.fileTags.includes("application")) {
args.push("/target:" + (product.consoleApplication === false ? "winexe" : "exe"));
} else if (output.fileTags.includes("dynamiclibrary")) {
args.push("/target:library");
} else if (output.fileTags.includes("cli.netmodule")) {
args.push("/target:module");
outputDescription = "netmodule";
}
// Make sure our input files are all the same language
var keys = Object.keys(inputs);
var language;
for (i in keys) {
if (Object.keys(compilers).includes(keys[i])) {
if (language)
throw("You cannot compile source files in more than one CLI language into a single " + outputDescription + ".");
language = keys[i];
}
}
if (!compilers[language]) {
throw("No CLI compiler available to compile " + language + " files.");
}
// docs state "/platform is not available in the development environment in Visual C# Express"
// does this mean from the IDE or the compiler itself shipped with Express does not support it?
if (architecture !== undefined) {
if (architecture === "x86" ||
architecture === "anycpu" ||
architecture === "anycpu32bitpreferred") // requires .NET 4.5
;
else if (architecture === "x86_64")
architecture = "x64";
else if (architecture === "ia64")
architecture = "Itanium";
else if (architecture === "arm")
architecture = "ARM";
else
throw("Invalid CLI architecture: " + architecture);
args.push("/platform:" + architecture);
}
if (debugInformation !== undefined)
args.push("/debug" + (debugInformation ? "+" : "-"));
if (optimization !== undefined)
args.push("/optimize" + (optimization !== "none" ? "+" : "-"));
if (warnAsError !== undefined)
args.push("/warnaserror" + (warnAsError ? "+" : "-"));
if (warningLevel !== undefined) {
if (language === "cli.vb") {
if (warningLevel === "none" || warningLevel === "0")
args.push("/quiet");
} else {
if (warningLevel === "all")
warningLevel = "4";
else if (warningLevel === "none")
warningLevel = "0";
args.push("/warn:" + warningLevel);
}
}
// Preprocessor defines
var allDefines = (platformDefines || []).concat(compilerDefines || []).concat(defines || []);
if (allDefines.length > 0)
args.push("/define:" + allDefines.join(";"));
// Library search paths
for (i in libraryPaths)
args.push("/lib:" + libraryPaths.join(","));
// Dependent libraries
for (i in dynamicLibraries) {
args.push("/reference:"
+ dynamicLibraries[i]
+ product.moduleProperty("cli", "dynamicLibrarySuffix"));
}
for (i in inputs.dynamiclibrary)
args.push("/reference:" + inputs.dynamiclibrary[i].filePath);
// Dependent netmodules
for (i in netmodules) {
args.push("/addmodule:" + netmodules.map(function (f) {
return f + product.moduleProperty("cli", "netmoduleSuffix");
}).join(";"));
}
if (inputs["cli.netmodule"]) {
args.push("/addmodule:" + inputs["cli.netmodule"].map(function (f) {
return f.filePath;
}).join(";"));
}
// Dependent resources
for (i in inputs["cli.resources"])
args.push("/resource:" + pathFunction(inputs["cli.resources"][i].filePath));
// Additional compiler flags
args = args.concat((platformCompilerFlags || []).concat(compilerFlags || []));
args.push("/out:" + pathFunction(output.filePath));
for (i in inputs[keys[0]])
args.push(pathFunction(inputs[keys[0]][i].filePath));
var cmd = new Command(compilers[language], args);
cmd.description = "linking " + output.fileName;
cmd.highlight = "linker";
cmd.workingDirectory = FileInfo.path(output.filePath);
return cmd;
}
qbs-src-2.6.1/share/qbs/modules/nodejs/ 0000755 0001751 0000166 00000000000 14776170045 017271 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/nodejs/NodeJS.qbs 0000644 0001751 0000166 00000014164 14776170045 021130 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Probes
Module {
// JavaScript files which have been "processed" - currently this simply means "copied to output
// directory" but might later include minification and obfuscation processing
additionalProductTypes: ["nodejs_processed_js"].concat(applicationFile ? ["application"] : [])
Probes.NodeJsProbe {
id: nodejs
searchPaths: toolchainInstallPath ? [toolchainInstallPath] : []
}
Probes.NpmProbe {
id: npm
searchPaths: toolchainInstallPath ? [toolchainInstallPath] : []
interpreterPath: FileInfo.path(nodejs.filePath)
}
property path applicationFile
PropertyOptions {
name: "applicationFile"
description: "file whose corresponding output will be executed when running the Node.js app"
}
Group {
name: "Application file";
files: nodejs.applicationFile ? [nodejs.applicationFile] : []
}
property path toolchainInstallPath: {
if (nodejs.path && npm.path && nodejs.path !== npm.path)
throw("node and npm binaries do not belong to the same installation ("
+ nodejs.path + " vs " + npm.path + ")");
return nodejs.path || npm.path;
}
property path interpreterFileName: nodejs.fileName
property path interpreterFilePath: nodejs.filePath
property path packageManagerFileName: npm.fileName
property path packageManagerFilePath: npm.filePath
property path packageManagerBinPath: npm.npmBin
property path packageManagerRootPath: npm.npmRoot
property path packageManagerPrefixPath: npm.npmPrefix
// private properties
readonly property path compiledIntermediateDir: FileInfo.joinPaths(product.buildDirectory,
"tmp", "nodejs.intermediate")
setupBuildEnvironment: {
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), Host.os().includes("windows"));
v.prepend(product.nodejs.toolchainInstallPath);
v.set();
}
setupRunEnvironment: {
var v = new ModUtils.EnvironmentVariable("NODE_PATH", FileInfo.pathListSeparator(), Host.os().includes("windows"));
v.prepend(FileInfo.path(Environment.getEnv("QBS_RUN_FILE_PATH")));
v.set();
}
FileTagger {
patterns: ["*.js"]
fileTags: ["js"]
}
validate: {
var validator = new ModUtils.PropertyValidator("nodejs");
validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath);
validator.setRequiredProperty("interpreterFileName", interpreterFileName);
validator.setRequiredProperty("interpreterFilePath", interpreterFilePath);
validator.setRequiredProperty("packageManagerFileName", packageManagerFileName);
validator.setRequiredProperty("packageManagerFilePath", packageManagerFilePath);
validator.setRequiredProperty("packageManagerBinPath", packageManagerBinPath);
validator.setRequiredProperty("packageManagerRootPath", packageManagerRootPath);
validator.setRequiredProperty("packageManagerPrefixPath", packageManagerPrefixPath);
validator.validate();
}
Rule {
inputs: ["js"]
outputArtifacts: {
var tags = ["nodejs_processed_js"];
if (input.fileTags.includes("application_js") ||
product.moduleProperty("nodejs", "applicationFile") === input.filePath)
tags.push("application");
// Preserve directory structure of input files
var intermediatePath = product.sourceDirectory;
// Handle nodejs.compiledIntermediateDir (QBS-5 workaround)
var compiled = product.moduleProperty("nodejs", "compiledIntermediateDir");
if (input.filePath.startsWith(compiled)) {
intermediatePath = compiled;
}
intermediatePath = FileInfo.path(FileInfo.relativePath(intermediatePath,
input.filePath));
return [{
filePath: FileInfo.joinPaths(product.destinationDirectory, intermediatePath,
input.fileName),
fileTags: tags
}];
}
outputFileTags: ["nodejs_processed_js", "application"]
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "copying " + input.fileName;
cmd.sourceCode = function() {
File.copy(input.filePath, output.filePath);
};
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/modules/nodejs/nodejs.js 0000644 0001751 0000166 00000003602 14776170045 021112 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Process = require("qbs.Process");
function findLocation(packageManagerFilePath, location, nodejsPath) {
var p = new Process();
try {
if (nodejsPath)
p.setEnv("PATH", nodejsPath);
if (p.exec(packageManagerFilePath, [location, "-g"]) !== 0)
console.error(p.readStdErr().trim());
return p.readStdOut().trim();
} finally {
p.close();
}
}
qbs-src-2.6.1/share/qbs/modules/lex_yacc/ 0000755 0001751 0000166 00000000000 14776170045 017576 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/lex_yacc/lexyacc.js 0000644 0001751 0000166 00000011730 14776170045 021566 0 ustar runner docker var FileInfo = require("qbs.FileInfo");
var TextFile = require("qbs.TextFile");
function unquote(s)
{
return s.startsWith('"') && s.endsWith('"') ? s.substr(1, s.length - 2) : s;
}
function readLexOptions(filePath) {
var result = {};
var f = new TextFile(filePath, TextFile.ReadOnly);
var regex = /^%option\s+([^ \t=]+)(?:\s*=\s*(\S+))?/;
while (!f.atEof()) {
var line = f.readLine();
var m = regex.exec(line);
if (!m) {
if (line === "%%")
break;
continue;
}
result[m[1]] = m[2] || true;
}
f.close();
return result;
}
function lexOutputFilePath(input, posixFileName, options)
{
var outDir = input.lex_yacc.outputDir;
var fileName;
if (options.outfile) {
fileName = unquote(options.outfile);
} else if (options.prefix) {
fileName = FileInfo.baseName(posixFileName) + '.'
+ unquote(options.prefix) + '.'
+ FileInfo.suffix(posixFileName);
} else if (input.lex_yacc.uniqueSymbolPrefix) {
fileName = input.baseName;
fileName += posixFileName;
} else {
fileName = posixFileName;
}
return FileInfo.joinPaths(outDir, fileName);
}
function readYaccOptions(filePath) {
var result = {};
var f = new TextFile(filePath, TextFile.ReadOnly);
var regex = /^%output\s+(.+)/;
while (!f.atEof()) {
var line = f.readLine();
var m = regex.exec(line);
if (!m) {
if (line === "%%")
break;
continue;
}
result.output = m[1];
break;
}
f.close();
return result;
}
function yaccOutputFilePath(input, posixFileName, options)
{
var outDir = input.lex_yacc.outputDir;
var fileName;
if (options.output) {
var outputFileName = unquote(options.output);
var suffix = FileInfo.suffix(posixFileName);
if (suffix === "c") {
fileName = outputFileName;
} else {
fileName = FileInfo.completeBaseName(outputFileName)
+ '.' + suffix + FileInfo.suffix(outputFileName).slice(1);
}
} else if (input.lex_yacc.uniqueSymbolPrefix) {
fileName = input.baseName + posixFileName.slice(1);
} else {
fileName = posixFileName;
}
return FileInfo.joinPaths(outDir, fileName);
}
function yaccOutputArtifacts(product, input)
{
var src = {
fileTags: [product.lex_yacc.outputTag],
lex_yacc: {},
};
var options = readYaccOptions(input.filePath);
if (!options.output && input.lex_yacc.yaccOutputFilePath) {
options.output = input.lex_yacc.yaccOutputFilePath;
src.lex_yacc.useOutputFromModule = true;
}
var hdr = {
filePath: yaccOutputFilePath(input, "y.tab.h", options),
fileTags: ["hpp"],
};
src.filePath = yaccOutputFilePath(input, "y.tab.c", options);
src.cpp = {
includePaths: [].concat(input.cpp.includePaths, input.lex_yacc.outputDir),
warningLevel: input.lex_yacc.enableCompilerWarnings ? "all" : "none",
};
return [hdr, src];
}
function yaccCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn)
{
var args = input.lex_yacc.yaccFlags;
args.push("-d");
var impl = outputs[input.lex_yacc.outputTag][0];
if (impl.lex_yacc.useOutputFromModule)
args.push("-o" + input.lex_yacc.yaccOutputFilePath);
else if (input.lex_yacc.uniqueSymbolPrefix)
args.push("-b", input.baseName, "-p", input.baseName);
args.push(input.filePath);
var cmd = new Command(input.lex_yacc.yaccBinary, args);
cmd.workingDirectory = input.lex_yacc.outputDir;
cmd.description = "generating "
+ impl.fileName
+ " and " + outputs["hpp"][0].fileName;
return [cmd];
}
function lexOutputArtifacts(product, input)
{
var output = {
fileTags: [product.lex_yacc.outputTag],
lex_yacc: {},
};
var options = readLexOptions(input.filePath);
if (!options.outfile && input.lex_yacc.lexOutputFilePath) {
options.outfile = input.lex_yacc.lexOutputFilePath;
output.lex_yacc.useOutfileFromModule = true;
}
output.filePath = lexOutputFilePath(input, "lex.yy.c", options);
output.cpp = {
includePaths: [].concat(input.cpp.includePaths, input.lex_yacc.outputDir),
warningLevel: input.lex_yacc.enableCompilerWarnings ? "all" : "none",
};
return [output];
}
function lexCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn)
{
var args = input.lex_yacc.lexFlags;
if (output.lex_yacc.useOutfileFromModule)
args.push("-o" + input.lex_yacc.lexOutputFilePath);
else if (input.lex_yacc.uniqueSymbolPrefix)
args.push("-P" + input.baseName, "-o" + output.filePath);
args.push(input.filePath);
var cmd = new Command(input.lex_yacc.lexBinary, args);
cmd.workingDirectory = input.lex_yacc.outputDir;
cmd.description = "generating " + output.fileName;
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/lex_yacc/lexyacc.qbs 0000644 0001751 0000166 00000002260 14776170045 021735 0 ustar runner docker import "lexyacc.js" as HelperFunctions
Module {
Depends { name: "cpp" }
property bool enableCompilerWarnings: false
property string lexBinary: "lex"
property string yaccBinary: "yacc"
property string outputTag: "c"
property bool uniqueSymbolPrefix: false
property string lexOutputFilePath
property string yaccOutputFilePath
property stringList lexFlags: []
property stringList yaccFlags: []
readonly property string outputDir: product.buildDirectory + "/lexyacc"
Rule {
inputs: ["lex.input"]
outputFileTags: [product.lex_yacc.outputTag]
outputArtifacts: HelperFunctions.lexOutputArtifacts(product, input)
prepare: HelperFunctions.lexCommands.apply(HelperFunctions, arguments)
}
Rule {
inputs: ["yacc.input"]
outputFileTags: [product.lex_yacc.outputTag, "hpp"]
outputArtifacts: HelperFunctions.yaccOutputArtifacts(product, input)
prepare: HelperFunctions.yaccCommands.apply(HelperFunctions, arguments)
}
FileTagger {
patterns: ["*.l"]
fileTags: ["lex.input"];
}
FileTagger {
patterns: ["*.y"]
fileTags: ["yacc.input"];
}
}
qbs-src-2.6.1/share/qbs/modules/ib/ 0000755 0001751 0000166 00000000000 14776170045 016401 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/ib/ib.js 0000644 0001751 0000166 00000040416 14776170045 017336 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var BundleTools = require("qbs.BundleTools");
var DarwinTools = require("qbs.DarwinTools");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
var PropertyList = require("qbs.PropertyList");
function artifactsFromInputs(inputs) {
var artifacts = [];
for (var tag in inputs) {
artifacts = artifacts.concat(inputs[tag]);
}
return artifacts;
}
function tiffutilScalesMap(inputs) {
return artifactsFromInputs(inputs).map(function (a) {
var m = a.filePath.match(/^(.+?)(@(\d+)x)?(\..+?)$/);
var basePath = m[1];
var scale = m[2] || "";
var nscale = m[3];
var extension = m[4];
if (scale && scale < 1)
throw new Error("Invalid scale '" + nscale + "' for image '" + a.filePath + "'");
return {
basePath: basePath,
extension: extension,
scale: scale
};
}).reduce(function (previous, current) {
previous[current["basePath"]] = (previous[current["basePath"]] || []).concat([{
extension: current["extension"],
scale: current["scale"]
}]);
return previous;
}, {});
}
function tiffutilOutputFilePath(product, basePath) {
return FileInfo.joinPaths(product.destinationDirectory,
"hidpi-images",
FileInfo.relativePath(product.sourceDirectory, basePath) +
product.ib.tiffSuffix);
}
function tiffutilArtifacts(product, inputs) {
var artifacts = [];
var map = tiffutilScalesMap(inputs);
for (var key in map) {
artifacts.push({
filePath: tiffutilOutputFilePath(product, key),
fileTags: ["tiff"]
});
}
return artifacts;
}
function prepareTiffutil(project, product, inputs, outputs, input, output) {
var cmds = [];
var map = tiffutilScalesMap(inputs);
for (var key in map) {
var args = ["-cat" + (product.ib.combineHidpiImages ? "hidpicheck" : "")];
var count = 0;
map[key].forEach(function (obj) {
args.push(key + obj["scale"] + obj["extension"]);
++count;
});
args.push("-out", tiffutilOutputFilePath(product, key));
var cmd = new Command(product.ib.tiffutilPath, args);
cmd.description = "creating " + output.fileName;
cmd.count = count;
cmd.outputFilePath = output.filePath;
cmd.stderrFilterFunction = function (output) {
return output.replace(count + " images written to " + outputFilePath + ".", "");
};
cmds.push(cmd);
}
return cmds;
}
function ibtooldArguments(product, inputs, input, outputs, overrideOutput) {
var i;
var args = [];
var allInputs = artifactsFromInputs(inputs);
var outputFormat = ModUtils.moduleProperty(product, "outputFormat");
if (outputFormat) {
if (!["binary1", "xml1", "human-readable-text"].includes(outputFormat))
throw("Invalid ibtoold output format: " + outputFormat + ". " +
"Must be in [binary1, xml1, human-readable-text].");
args.push("--output-format", outputFormat);
}
var debugFlags = ["warnings", "errors", "notices"];
for (var j in debugFlags) {
var flag = debugFlags[j];
if (ModUtils.modulePropertyFromArtifacts(product, allInputs, product.moduleName, flag)) {
args.push("--" + flag);
}
}
if (inputs.assetcatalog) {
args.push("--platform", DarwinTools.applePlatformName(
product.moduleProperty("qbs", "targetOS"),
product.moduleProperty("xcode", "platformType")));
var appIconName = ModUtils.modulePropertyFromArtifacts(product, inputs.assetcatalog, product.moduleName, "appIconName");
if (appIconName)
args.push("--app-icon", appIconName);
var launchImageName = ModUtils.modulePropertyFromArtifacts(product, inputs.assetcatalog, product.moduleName, "launchImageName");
if (launchImageName)
args.push("--launch-image", launchImageName);
// Undocumented but used by Xcode (only for iOS?), probably runs pngcrush or equivalent
if (ModUtils.modulePropertyFromArtifacts(product, inputs.assetcatalog, product.moduleName, "compressPngs"))
args.push("--compress-pngs");
} else {
var sysroot = product.moduleProperty("qbs", "sysroot");
if (sysroot)
args.push("--sdk", sysroot);
args.push("--flatten", ModUtils.modulePropertyFromArtifacts(product, allInputs, product.moduleName, "flatten") ? 'YES' : 'NO');
// --module and --auto-activate-custom-fonts were introduced in Xcode 6.0
if (ModUtils.moduleProperty(product, "ibtoolVersionMajor") >= 6) {
var module = ModUtils.moduleProperty(product, "module");
if (module)
args.push("--module", module);
if (ModUtils.modulePropertyFromArtifacts(product, allInputs, product.moduleName, "autoActivateCustomFonts"))
args.push("--auto-activate-custom-fonts");
}
}
// --minimum-deployment-target was introduced in Xcode 5.0
var minimumDarwinVersion = product.moduleProperty("cpp", "minimumDarwinVersion");
if (minimumDarwinVersion && ModUtils.moduleProperty(product, "ibtoolVersionMajor") >= 5)
args.push("--minimum-deployment-target", minimumDarwinVersion);
// --target-device and -output-partial-info-plist were introduced in Xcode 6.0 for ibtool
if (ModUtils.moduleProperty(product, "ibtoolVersionMajor") >= 6 || inputs.assetcatalog) {
args.push("--output-partial-info-plist", (outputs && outputs.partial_infoplist)
? outputs.partial_infoplist[outputs.partial_infoplist.length - 1].filePath
: "/dev/null");
// For iOS, we'd normally only output the devices specified in TARGETED_DEVICE_FAMILY
// We can't get this info from Info.plist keys due to dependency order, so use the qbs prop
var targetDevices = ModUtils.moduleProperty(product, "targetDevices");
for (i in targetDevices) {
args.push("--target-device", targetDevices[i]);
}
}
args = args.concat(ModUtils.modulePropertiesFromArtifacts(product, allInputs,
product.moduleName, "flags"));
if (overrideOutput) {
args.push("--compile", overrideOutput);
} else {
if (outputs.compiled_assetcatalog)
args.push("--compile", product.buildDirectory + "/actool.dir");
else // compiled_ibdoc
args.push("--compile", product.buildDirectory + "/ibtool.dir/"
+ ibtoolCompiledDirSuffix(product, input));
}
for (i in allInputs)
args.push(allInputs[i].filePath);
return args;
}
function ibtoolFileTaggers(fileTags) {
var ext;
if (fileTags.includes("nib") && !fileTags.includes("storyboard"))
ext = "nib";
if (fileTags.includes("storyboard") && !fileTags.includes("nib"))
ext = "storyboard";
if (!ext)
throw "unknown ibtool input file tags: " + fileTags;
var t = ["bundle.input", "compiled_ibdoc"];
return {
".nib": t.concat(["compiled_" + ext + (ext !== "nib" ? "_nib" : "")]),
".plist": t.concat(["compiled_" + ext + "_infoplist"]),
".storyboard": t.concat(["compiled_" + ext])
};
}
function ibtoolCompiledDirSuffix(product, input) {
var suffix = input.completeBaseName;
if (input.fileTags.includes("nib"))
suffix += ModUtils.moduleProperty(product, "compiledNibSuffix");
else if (input.fileTags.includes("storyboard"))
suffix += ModUtils.moduleProperty(product, "compiledStoryboardSuffix");
return suffix;
}
function ibtoolOutputArtifacts(product, inputs, input) {
var suffix = ibtoolCompiledDirSuffix(product, input);
var tracker = new ModUtils.BlackboxOutputArtifactTracker();
tracker.hostOS = product.moduleProperty("qbs", "hostOS");
tracker.shellPath = product.moduleProperty("qbs", "shellPath");
tracker.fileTaggers = ibtoolFileTaggers(input.fileTags);
tracker.command = ModUtils.moduleProperty(product, "ibtoolPath");
tracker.commandArgsFunction = function (outputDirectory) {
// Last --output-format argument overrides any previous ones
// Append the name of the base output since it can be either a file or a directory
// in the case of XIB compilations
return ibtooldArguments(product, inputs, input,
undefined, FileInfo.joinPaths(outputDirectory, suffix))
.concat(["--output-format", "xml1"]);
};
var ibtoolBuildDirectory = product.buildDirectory + "/ibtool.dir";
var main = BundleTools.destinationDirectoryForResource(product, input);
var artifacts = tracker.artifacts(ibtoolBuildDirectory);
if (product.moduleProperty("ib", "ibtoolVersionMajor") >= 6) {
var prefix = input.fileTags.includes("storyboard") ? "SB" : "";
var path = FileInfo.joinPaths(product.destinationDirectory, input.completeBaseName +
"-" + prefix + "PartialInfo.plist");
artifacts.push({ filePath: path, fileTags: ["partial_infoplist"] });
}
// Let the output artifacts known the "main" output
// This can be either a file or directory so the artifact might already exist in the output list
for (var i = 0; i < artifacts.length; ++i) {
if (artifacts[i].fileTags.includes("compiled_ibdoc"))
artifacts[i].bundle = {
_bundleFilePath: artifacts[i].filePath.replace(ibtoolBuildDirectory, main)
};
}
return artifacts;
}
function ibtoolCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn)
{
var cmd = new Command(ModUtils.moduleProperty(product, "ibtoolPath"),
ibtooldArguments(product, inputs, input, outputs));
cmd.description = "compiling " + input.fileName;
// Also display the language name of the nib/storyboard being compiled if it has one
var localizationKey = DarwinTools.localizationKey(input.filePath);
if (localizationKey)
cmd.description += ' (' + localizationKey + ')';
cmd.highlight = 'compiler';
// May not be strictly needed, but is set by some versions of Xcode
if (input.fileTags.includes("storyboard"))
cmd.environment.push("IBSC_MINIMUM_COMPATIBILITY_VERSION=" +
(product.moduleProperty("cpp", "minimumDarwinVersion") || ""));
cmd.stdoutFilterFunction = function(output) {
return "";
};
return cmd;
}
function actoolOutputArtifacts(product, inputs) {
// actool has no --dry-run option (rdar://21786925),
// so compile to a fake temporary directory in order to extract the list of output files
var tracker = new ModUtils.BlackboxOutputArtifactTracker();
tracker.hostOS = product.moduleProperty("qbs", "hostOS");
tracker.shellPath = product.moduleProperty("qbs", "shellPath");
tracker.command = ModUtils.moduleProperty(product, "actoolPath");
tracker.commandArgsFunction = function (outputDirectory) {
// Last --output-format argument overrides any previous ones
return ibtooldArguments(product, inputs, undefined,
undefined, outputDirectory).concat(["--output-format", "xml1"]);
};
tracker.processStdOutFunction = parseActoolOutput;
var artifacts = tracker.artifacts(product.buildDirectory + "/actool.dir");
// Newer versions of actool don't generate *anything* if there's no input;
// in that case a partial Info.plist would not have been generated either
if (artifacts && artifacts.length > 0) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
"assetcatalog_generated_info.plist"),
fileTags: ["partial_infoplist"]
});
}
for (var i = 0; i < artifacts.length; ++i) {
if (artifacts[i].fileTags.includes("compiled_assetcatalog")) {
artifacts[i].bundle = {
_bundleFilePath: artifacts[i].filePath.replace(
product.buildDirectory + "/actool.dir",
BundleTools.destinationDirectoryForResource(product, inputs.assetcatalog[0]))
};
}
}
return artifacts;
}
function parseActoolOutput(output) {
var propertyList = new PropertyList();
try {
propertyList.readFromString(output);
var plist = propertyList.toObject();
if (plist)
plist = plist["com.apple.actool.compilation-results"];
if (plist) {
var artifacts = [];
files = plist["output-files"];
for (var i in files) {
if (files[i] === "/dev/null")
continue;
var tags = files[i].endsWith(".plist")
? ["partial_infoplist"]
: ["bundle.input", "compiled_assetcatalog"];
artifacts.push({
// Even though we pass in a canonical base dir, the paths in the XML File
// are non-canonical. See QBS-1417.
filePath: FileInfo.canonicalPath(files[i]),
fileTags: tags
});
}
return artifacts;
}
} finally {
propertyList.clear();
}
}
function ibtoolVersion(ibtool) {
var process;
var version;
try {
process = new Process();
if (process.exec(ibtool, ["--version", "--output-format", "xml1"], true) !== 0)
console.error(process.readStdErr());
var propertyList = new PropertyList();
try {
propertyList.readFromString(process.readStdOut());
var plist = propertyList.toObject();
if (plist)
plist = plist["com.apple.ibtool.version"];
if (plist)
version = plist["short-bundle-version"];
} finally {
propertyList.clear();
}
} finally {
process.close();
}
return version;
}
function compileAssetCatalogCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var mkdir = new JavaScriptCommand();
mkdir.silent = true;
mkdir.sourceCode = function () {
File.makePath(FileInfo.joinPaths(product.buildDirectory, "actool.dir"));
};
var cmd = new Command(ModUtils.moduleProperty(product, "actoolPath"),
ibtooldArguments(product, inputs, input, outputs));
cmd.description = inputs["assetcatalog"].map(function (input) {
return "compiling " + input.fileName;
}).join('\n');
cmd.highlight = "compiler";
cmd.stdoutFilterFunction = function(output) {
return "";
};
return [mkdir, cmd];
}
qbs-src-2.6.1/share/qbs/modules/ib/IBModule.qbs 0000644 0001751 0000166 00000015767 14776170045 020570 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.BundleTools
import qbs.DarwinTools
import qbs.File
import qbs.Host
import qbs.FileInfo
import qbs.ModUtils
import qbs.Process
import 'ib.js' as Ib
Module {
Depends { name: "xcode"; required: false }
Probe {
id: ibProbe
property string toolPath: ibtoolPath // input
property string toolVersion // output
configure: {
toolVersion = Ib.ibtoolVersion(toolPath);
found = true;
}
}
condition: Host.os().includes("darwin") && qbs.targetOS.includes("darwin")
property bool warnings: true
property bool errors: true
property bool notices: true
property stringList flags
// tiffutil specific
property string tiffutilName: "tiffutil"
property string tiffutilPath: FileInfo.joinPaths("/usr/bin", tiffutilName)
property bool combineHidpiImages: true
// iconutil specific
property string iconutilName: "iconutil"
property string iconutilPath: FileInfo.joinPaths("/usr/bin", iconutilName)
// XIB/NIB specific
property string ibtoolName: "ibtool"
property string ibtoolPath: FileInfo.joinPaths(xcode.developerPath, "/usr/bin", ibtoolName)
property bool flatten: true
property string module
property bool autoActivateCustomFonts: true
// Asset catalog specific
property string actoolName: xcode.present ? "actool" : "ictool"
property string actoolPath: FileInfo.joinPaths(xcode.developerPath, "/usr/bin", actoolName)
property string appIconName
property string launchImageName
property bool compressPngs: true
// private properties
property string outputFormat: "human-readable-text"
property string tiffSuffix: ".tiff"
property string appleIconSuffix: ".icns"
property string compiledAssetCatalogSuffix: ".car"
property string compiledNibSuffix: ".nib"
property string compiledStoryboardSuffix: ".storyboardc"
version: ibtoolVersion
property string ibtoolVersion: ibProbe.toolVersion
property var ibtoolVersionParts: ibtoolVersion ? ibtoolVersion.split('.').map(function(item) { return parseInt(item, 10); }) : []
property int ibtoolVersionMajor: ibtoolVersionParts[0]
property int ibtoolVersionMinor: ibtoolVersionParts[1]
property int ibtoolVersionPatch: ibtoolVersionParts[2]
property stringList targetDevices: xcode.present
? xcode.targetDevices
: DarwinTools.targetDevices(qbs.targetOS)
validate: {
var validator = new ModUtils.PropertyValidator("ib");
validator.setRequiredProperty("ibtoolVersion", ibtoolVersion);
validator.setRequiredProperty("ibtoolVersionMajor", ibtoolVersionMajor);
validator.setRequiredProperty("ibtoolVersionMinor", ibtoolVersionMinor);
validator.addVersionValidator("ibtoolVersion", ibtoolVersion, 2, 3);
validator.addRangeValidator("ibtoolVersionMajor", ibtoolVersionMajor, 1);
validator.addRangeValidator("ibtoolVersionMinor", ibtoolVersionMinor, 0);
if (ibtoolVersionPatch !== undefined)
validator.addRangeValidator("ibtoolVersionPatch", ibtoolVersionPatch, 0);
validator.validate();
}
FileTagger {
patterns: ["*.png"]
fileTags: ["png"]
}
FileTagger {
patterns: ["*.iconset"] // bundle
fileTags: ["iconset"]
}
FileTagger {
patterns: ["*.nib", "*.xib"]
fileTags: ["nib"]
}
FileTagger {
patterns: ["*.storyboard"]
fileTags: ["storyboard"]
}
FileTagger {
patterns: ["*.xcassets"] // bundle
fileTags: ["assetcatalog"]
}
Rule {
multiplex: true
inputs: ["png"]
outputFileTags: ["tiff"]
outputArtifacts: Ib.tiffutilArtifacts(product, inputs)
prepare: Ib.prepareTiffutil.apply(Ib, arguments)
}
Rule {
inputs: ["iconset"]
outputFileTags: ["icns", "bundle.input"]
outputArtifacts: ([{
filePath: FileInfo.joinPaths(product.destinationDirectory, input.completeBaseName +
ModUtils.moduleProperty(product, "appleIconSuffix")),
fileTags: ["icns", "bundle.input"],
bundle: {
_bundleFilePath: FileInfo.joinPaths(BundleTools.destinationDirectoryForResource(product, input),
input.completeBaseName +
ModUtils.moduleProperty(product, "appleIconSuffix"))
}
}])
prepare: {
var args = ["--convert", "icns", "--output", output.filePath, input.filePath];
var cmd = new Command(ModUtils.moduleProperty(product, "iconutilPath"), args);
cmd.description = "compiling " + input.fileName;
return cmd;
}
}
Rule {
inputs: ["nib", "storyboard"]
outputFileTags: {
var tags = ["partial_infoplist"];
for (var i = 0; i < inputs.length; ++i)
tags = tags.uniqueConcat(ModUtils.allFileTags(Ib.ibtoolFileTaggers(inputs[i])));
return tags;
}
outputArtifacts: Ib.ibtoolOutputArtifacts(product, inputs, input)
prepare: Ib.ibtoolCommands.apply(Ib, arguments)
}
Rule {
inputs: ["assetcatalog"]
multiplex: true
outputArtifacts: Ib.actoolOutputArtifacts(product, inputs)
outputFileTags: ["bundle.input", "compiled_assetcatalog", "partial_infoplist"]
prepare: Ib.compileAssetCatalogCommands.apply(Ib, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/codesign/ 0000755 0001751 0000166 00000000000 14776170045 017602 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/codesign/android.qbs 0000644 0001751 0000166 00000012231 14776170045 021730 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Raphaël Cotty
** Contact: http://www.qt.io/licensing
**
** This file is part of the Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Probes
import "codesign.js" as CodeSign
CodeSignModule {
condition: qbs.targetOS.includes("android")
priority: 1
enableCodeSigning: true
property bool useApksigner: true
property path apksignerFilePath
Probes.JdkProbe {
id: jdk
environmentPaths: (jdkPath ? [jdkPath] : []).concat(base)
}
property string jdkPath: jdk.path
property string jarsignerFilePath: FileInfo.joinPaths(jdkPath, "bin", jarsignerName)
property string jarsignerName: "jarsigner"
property string keytoolFilePath: FileInfo.joinPaths(jdkPath, "bin", keytoolName)
property string keytoolName: "keytool"
property string debugKeystorePath: FileInfo.joinPaths(
Environment.getEnv(Host.os().includes("windows")
? "USERPROFILE" : "HOME"),
".android", "debug.keystore")
readonly property string debugKeystorePassword: "android"
readonly property string debugPassword: "android"
readonly property string debugKeyAlias: "androiddebugkey"
property string keystorePath: debugKeystorePath
property string keystorePassword: debugKeystorePassword
property string keyPassword: debugPassword
property string keyAlias: debugKeyAlias
// Private property set by the Android.sdk module
property string _packageName
Rule {
condition: useApksigner
inputs: ["android.package_unsigned"]
Artifact {
filePath: product.codesign._packageName
fileTags: "android.package"
}
prepare: CodeSign.signApkPackage.apply(this, arguments)
}
Rule {
condition: !useApksigner
inputs: ["android.package_unsigned"]
Artifact {
filePath: product.codesign._packageName
fileTags: "android.package"
}
prepare: CodeSign.signAabPackage.apply(this, arguments)
}
validate: {
// Typically there is a debug keystore in ~/.android/debug.keystore which gets created
// by the native build tools the first time a build is done. However, we don't want to
// create it ourselves, because writing to a location outside the qbs build directory is
// both polluting and has the potential for race conditions. So we'll instruct the user what
// to do.
if (keystorePath === debugKeystorePath && !File.exists(debugKeystorePath)) {
throw ModUtils.ModuleError("Could not find an Android debug keystore at " +
codesign.debugKeystorePath + ". " +
"If you are developing for Android on this machine for the first time and " +
"have never built an application using the native Gradle / Android Studio " +
"tooling, this is normal. You must create the debug keystore now using the " +
"following command, in order to continue:\n\n" +
CodeSign.createDebugKeyStoreCommandString(codesign.keytoolFilePath,
codesign.debugKeystorePath,
codesign.debugKeystorePassword,
codesign.debugPassword,
codesign.debugKeyAlias) +
"\n\n" +
"See the following URL for more information: " +
"https://developer.android.com/studio/publish/app-signing.html#debug-mode");
}
}
}
qbs-src-2.6.1/share/qbs/modules/codesign/noop.qbs 0000644 0001751 0000166 00000003133 14776170045 021264 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
CodeSignModule {
condition: true
priority: -100
}
qbs-src-2.6.1/share/qbs/modules/codesign/signtool.qbs 0000644 0001751 0000166 00000007004 14776170045 022150 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.Host
import qbs.ModUtils
import qbs.Probes
import "codesign.js" as CODESIGN
CodeSignModule {
condition: qbs.targetOS.includes("windows")
&& Host.os().includes("windows")
&& qbs.toolchain.includes("msvc")
_canSignArtifacts: true
Probes.BinaryProbe {
id: signtoolProbe
names: [codesignName]
searchPaths: CODESIGN.findBestSignToolSearchPaths(Host.architecture())
}
codesignName: "signtool"
codesignPath: signtoolProbe.filePath
property string subjectName
PropertyOptions {
name: "subjectName"
description: "Name of the subject of the signing certificate."
}
property string rootSubjectName
PropertyOptions {
name: "rootSubjectName"
description: "Name of the subject of the root certificate that the signing " +
"certificate must chain to."
}
property string hashAlgorithm
PropertyOptions {
name: "hashAlgorithm"
description: "Name of the hash algorithm used on the signing certificate."
allowedValues: ["sha1", "sha256", "sha384", "sha512"]
}
property string timestampAlgorithm
PropertyOptions {
name: "timestampAlgorithm"
description: "Name of the timestamp algorithm."
allowedValues: ["sha1", "sha256"]
}
property path certificatePath
PropertyOptions {
name: "certificatePath"
description: "Path to the signing certificate PFX file."
}
property string certificatePassword
PropertyOptions {
name: "certificatePassword"
description: "Password to use when opening a certificate PFX file."
}
property path crossCertificatePath
PropertyOptions {
name: "crossCertificatePath"
description: "Path to the additional certificate CER file."
}
validate: {
if (enableCodeSigning && !File.exists(codesignPath)) {
throw ModUtils.ModuleError("Could not find 'signtool' utility");
}
}
}
qbs-src-2.6.1/share/qbs/modules/codesign/apple.qbs 0000644 0001751 0000166 00000021602 14776170045 021413 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.BundleTools
import qbs.DarwinTools
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.PropertyList
import qbs.Probes
import qbs.Utilities
import "codesign.js" as CodeSign
import "../xcode/xcode.js" as XcodeUtils
CodeSignModule {
Depends { name: "xcode"; required: qbs.toolchain && qbs.toolchain.includes("xcode") }
Probes.BinaryProbe {
id: codesignProbe
names: [codesignName]
}
condition: Host.os().includes("macos") && qbs.targetOS.includes("darwin")
priority: 0
enableCodeSigning: _codeSigningRequired
codesignName: "codesign"
codesignPath: codesignProbe.filePath
_canSignArtifacts: true
property string signingType: {
if (_adHocCodeSigningAllowed)
return "ad-hoc";
if (_codeSigningAllowed)
return "app-store";
}
PropertyOptions {
name: "signingType"
allowedValues: ["app-store", "apple-id", "ad-hoc"]
}
property string signingIdentity: {
if (signingType === "ad-hoc") // only useful on macOS
return "-";
var isDebug = qbs.buildVariant !== "release";
if (qbs.targetOS.includes("ios") || qbs.targetOS.includes("tvos")
|| qbs.targetOS.includes("watchos")) {
switch (signingType) {
case "app-store":
return isDebug ? "iPhone Developer" : "iPhone Distribution";
}
}
if (qbs.targetOS.includes("macos")) {
switch (signingType) {
case "app-store":
return isDebug ? "Mac Developer" : "3rd Party Mac Developer Application";
case "apple-id":
return "Developer ID Application";
}
}
}
signingTimestamp: "none"
property string provisioningProfile
PropertyOptions {
name: "provisioningProfile"
description: "Name or UUID of the provisioning profile to embed in the application; " +
"typically left blank to allow automatic provisioning"
}
property string teamIdentifier
PropertyOptions {
name: "teamIdentifier"
description: "Name or identifier of the development team whose identities will be used; " +
"typically left blank unless signed into multiple development teams"
}
property path provisioningProfilesPath: "~/Library/MobileDevice/Provisioning Profiles"
readonly property var _actualSigningIdentity: {
if (signingIdentity === "-") {
return {
SHA1: signingIdentity,
subjectInfo: { CN: "ad hoc" }
}
}
var identities = CodeSign.findSigningIdentities(signingIdentity, teamIdentifier);
if (identities && Object.keys(identities).length > 1) {
throw "Multiple codesigning identities (i.e. certificate and private key pairs) " +
"matching '" + signingIdentity + "' were found." +
CodeSign.humanReadableIdentitySummary(identities);
}
for (var i in identities)
return identities[i];
}
// Allowed for macOS
readonly property bool _adHocCodeSigningAllowed:
XcodeUtils.boolFromSdkOrPlatform("AD_HOC_CODE_SIGNING_ALLOWED",
xcode._sdkProps, xcode._platformProps, true)
// Allowed for all device platforms (not simulators)
readonly property bool _codeSigningAllowed:
XcodeUtils.boolFromSdkOrPlatform("CODE_SIGNING_ALLOWED",
xcode._sdkProps, xcode._platformProps, true)
// Required for tvOS, iOS, and watchOS (not simulators)
property bool _codeSigningRequired: {
// allow to override value from Xcode so tests do not require signing
var envRequired = Environment.getEnv("QBS_AUTOTEST_CODE_SIGNING_REQUIRED");
if (envRequired)
return envRequired === "1";
return XcodeUtils.boolFromSdkOrPlatform("CODE_SIGNING_REQUIRED",
xcode._sdkProps, xcode._platformProps, false)
}
// Required for tvOS, iOS, and watchOS (not simulators)
readonly property bool _entitlementsRequired:
XcodeUtils.boolFromSdkOrPlatform("ENTITLEMENTS_REQUIRED",
xcode._sdkProps, xcode._platformProps, false)
readonly property bool _provisioningProfileAllowed:
product.bundle
&& product.bundle.isBundle
&& product.type.includes("application")
&& xcode.platformType !== "simulator"
// Required for tvOS, iOS, and watchOS (not simulators)
// PROVISIONING_PROFILE_REQUIRED is specified only in Embedded-Device.xcspec in the
// IDEiOSSupportCore IDE plugin, so we'll just write out the logic here manually
readonly property bool _provisioningProfileRequired:
_provisioningProfileAllowed && !qbs.targetOS.includes("macos")
// Not used on simulator platforms either but provisioning profiles aren't used there anyways
readonly property string _provisioningProfilePlatform: {
if (qbs.targetOS.includes("macos"))
return "OSX";
if (qbs.targetOS.includes("ios") || qbs.targetOS.includes("watchos"))
return "iOS";
if (qbs.targetOS.includes("tvos"))
return "tvOS";
}
readonly property string _embeddedProfileName:
(xcode._platformProps || {})["EMBEDDED_PROFILE_NAME"] || "embedded.mobileprovision"
setupBuildEnvironment: {
var prefixes = product.xcode ? [
product.xcode.platformPath + "/Developer",
product.xcode.toolchainPath,
product.xcode.developerPath
] : [];
for (var i = 0; i < prefixes.length; ++i) {
var codesign_allocate = prefixes[i] + "/usr/bin/codesign_allocate";
if (File.exists(codesign_allocate)) {
var v = new ModUtils.EnvironmentVariable("CODESIGN_ALLOCATE");
v.value = codesign_allocate;
v.set();
break;
}
}
}
Group {
name: "Provisioning Profiles"
prefix: provisioningProfilesPath + "/"
files: ["*.mobileprovision", "*.provisionprofile"]
}
FileTagger {
fileTags: ["codesign.entitlements"]
patterns: ["*.entitlements"]
}
FileTagger {
fileTags: ["codesign.provisioningprofile"]
patterns: ["*.mobileprovision", "*.provisionprofile"]
}
Group {
condition: enableCodeSigning
Rule {
multiplex: true
inputs: ["codesign.entitlements", "codesign.embedded_provisioningprofile"]
Artifact {
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName + ".xcent")
fileTags: ["codesign.xcent"]
}
prepare: CodeSign.generateAppleEntitlementsCommands.apply(CodeSign, arguments)
}
Rule {
multiplex: true
condition: module._provisioningProfileAllowed
inputs: ["codesign.provisioningprofile"]
outputFileTags: ["codesign.embedded_provisioningprofile"]
outputArtifacts: CodeSign.generateAppleProvisioningProfileOutputs(product, inputs)
prepare: CodeSign.generateAppleProvisioningProfileCommands.apply(CodeSign, arguments)
}
}
}
qbs-src-2.6.1/share/qbs/modules/codesign/CodeSignModule.qbs 0000644 0001751 0000166 00000004040 14776170045 023150 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import "codesign.js" as CodeSign
Module {
condition: false
property bool enableCodeSigning: false
property string codesignName
property string codesignPath: codesignName
property stringList codesignFlags
property string signingTimestamp
PropertyOptions {
name: "signingTimestamp"
description: "URL of the RFC 3161 time stamp server."
}
property bool _canSignArtifacts: false // whether can sign individual actifacts
}
qbs-src-2.6.1/share/qbs/modules/codesign/codesign.js 0000644 0001751 0000166 00000065057 14776170045 021750 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var PathTools = require("qbs.PathTools");
var Process = require("qbs.Process");
var PropertyList = require("qbs.PropertyList");
var Utilities = require("qbs.Utilities");
function findSigningIdentities(searchString, team) {
if (!searchString)
return {};
var identities = Utilities.signingIdentities();
var matchedIdentities = {};
for (var key in identities) {
var identity = identities[key];
if (team && ![identity.subjectInfo.O, identity.subjectInfo.OU].includes(team))
continue;
if (searchString === key
|| (identity.subjectInfo.CN && identity.subjectInfo.CN.startsWith(searchString))) {
matchedIdentities[key] = identity;
}
}
return matchedIdentities;
}
function humanReadableIdentitySummary(identities) {
return "\n\t" + Object.keys(identities).map(function (key) {
return identities[key].subjectInfo.CN
+ " in team "
+ identities[key].subjectInfo.O
+ " (" + identities[key].subjectInfo.OU + ")";
}).join("\n\t");
}
/**
* Returns the best provisioning profile for code signing a binary with the given parameters.
* Ideally, this should behave identically as Xcode but the algorithm is not documented
* \l{https://developer.apple.com/library/ios/qa/qa1814/_index.html}{Automatic Provisioning}
*/
function findBestProvisioningProfile(product, files) {
var actualSigningIdentity = product.codesign._actualSigningIdentity || {};
var teamIdentifier = product.codesign.teamIdentifier;
var bundleIdentifier = product.bundle.identifier;
var targetOS = product.qbs.targetOS;
var buildVariant = product.qbs.buildVariant;
var query = product.codesign.provisioningProfile;
var profilePlatform = product.codesign._provisioningProfilePlatform;
// Read all provisioning profiles on disk into plist objects in memory
var profiles = files.map(function(filePath) {
var plist = new PropertyList();
try {
plist.readFromData(Utilities.smimeMessageContent(filePath));
return {
data: plist.toObject(),
filePath: filePath
};
} finally {
plist.clear();
}
});
// Do a simple search by matching UUID or Name
if (query) {
for (var i = 0; i < profiles.length; ++i) {
var obj = profiles[i];
if (obj.data && (obj.data.UUID === query || obj.data.Name === query))
return obj;
}
// If we asked for a specific provisioning profile, don't select one automatically
return undefined;
}
// Provisioning profiles are not normally used with ad-hoc code signing or non-apps
// We do these checks down here only for the automatic selection but not above because
// if the user explicitly selects a provisioning profile it should be used no matter what
if (actualSigningIdentity.SHA1 === "-" || !product.type.includes("application"))
return undefined;
// Filter out any provisioning profiles we know to be unsuitable from the start
profiles = profiles.filter(function (profile) {
var data = profile.data;
if (actualSigningIdentity.subjectInfo) {
var certCommonNames = (data["DeveloperCertificates"] || []).map(function (cert) {
return Utilities.certificateInfo(cert).subjectInfo.CN;
});
if (!certCommonNames.includes(actualSigningIdentity.subjectInfo.CN)) {
console.log("Skipping provisioning profile with no matching certificate names for '"
+ actualSigningIdentity.subjectInfo.CN
+ "' (found " + certCommonNames.join(", ") + "): "
+ profile.filePath);
return false;
}
}
var platforms = data["Platform"] || [];
if (platforms.length > 0 && profilePlatform && !platforms.includes(profilePlatform)) {
console.log("Skipping provisioning profile for platform " + platforms.join(", ")
+ " (current platform " + profilePlatform + ")"
+ ": " + profile.filePath);
return false;
}
if (teamIdentifier
&& !data["TeamIdentifier"].includes(teamIdentifier)
&& data["TeamName"] !== teamIdentifier) {
console.log("Skipping provisioning profile for team " + data["TeamIdentifier"]
+ " (" + data["TeamName"] + ") (current team " + teamIdentifier + ")"
+ ": " + profile.filePath);
return false;
}
if (Date.parse(data["ExpirationDate"]) <= Date.now()) {
console.log("Skipping expired provisioning profile: " + profile.filePath);
return false;
}
// Filter development vs distribution profiles;
// though the certificate common names check should have been sufficient
var isDebug = buildVariant === "debug";
if (data["Entitlements"]["get-task-allow"] !== isDebug) {
console.log("Skipping provisioning profile for wrong debug mode: " + profile.filePath);
return false;
}
var prefix = data["ApplicationIdentifierPrefix"];
var fullAppId = data["Entitlements"]["application-identifier"];
if ([prefix, bundleIdentifier].join(".") !== fullAppId
&& [prefix, "*"].join(".") !== fullAppId) {
console.log("Skipping provisioning profile not matching full ("
+ [prefix, bundleIdentifier].join(".") + ") or wildcard ("
+ [prefix, "*"].join(".") + ") app ID (found " + fullAppId + "): "
+ profile.filePath);
return false;
}
return true;
});
// Sort by expiration date - sooner expiration dates come last
profiles.sort(function(profileA, profileB) {
var expA = Date.parse(profileA.data["ExpirationDate"]);
var expB = Date.parse(profileB.data["ExpirationDate"]);
if (expA < expB)
return -1;
if (expA > expB)
return 1;
return 0;
});
// Sort by application identifier - wildcard profiles come last
profiles.sort(function(profileA, profileB) {
var idA = profileA.data["Entitlements"]["application-identifier"];
var idB = profileB.data["Entitlements"]["application-identifier"];
if (!idA.endsWith(".*") && idB.endsWith(".*"))
return -1;
if (idA.endsWith(".*") && !idB.endsWith(".*"))
return 1;
return 0;
});
if (profiles.length) {
console.log("Automatic provisioning using profile "
+ profiles[0].data.UUID
+ " ("
+ profiles[0].data.TeamName
+ " - "
+ profiles[0].data.Name
+ ") in product "
+ product.name);
return profiles[0];
}
}
/**
* Finds out the search paths for the `signtool.exe` utility supplied with
* the Windows SDK's.
*/
function findBestSignToolSearchPaths(arch) {
var searchPaths = [];
var keys = [
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows",
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows"
];
for (var keyIndex = 0; keyIndex < keys.length; ++keyIndex) {
var re = /^v([0-9]+)\.([0-9]+)$/;
var groups = Utilities.nativeSettingGroups(keys[keyIndex]).filter(function(version) {
return version.match(re);
});
groups.sort(function(a, b) {
return Utilities.versionCompare(b.substring(1), a.substring(1));
});
function addSearchPath(searchPath) {
if (File.exists(searchPath) && !searchPaths.includes(searchPath)) {
searchPaths.push(searchPath);
return true;
}
return false;
}
for (var groupIndex = 0; groupIndex < groups.length; ++groupIndex) {
var fullKey = keys[keyIndex] + "\\" + groups[groupIndex];
var fullVersion = Utilities.getNativeSetting(fullKey, "ProductVersion");
if (fullVersion) {
var installRoot = FileInfo.cleanPath(
Utilities.getNativeSetting(fullKey, "InstallationFolder"));
if (installRoot) {
// Try to add the architecture-independent path at first.
var searchPath = FileInfo.joinPaths(installRoot, "App Certification Kit");
if (!addSearchPath(searchPath)) {
// Try to add the architecture-dependent paths at second.
var binSearchPath = FileInfo.joinPaths(installRoot, "bin/" + fullVersion);
if (!File.exists(binSearchPath)) {
binSearchPath += ".0";
if (!File.exists(binSearchPath))
continue;
}
function kitsArchitectureSubDirectory(arch) {
if (arch === "x86")
return "x86";
else if (arch === "x86_64")
return "x64";
else if (arch.startsWith("arm64"))
return "arm64";
else if (arch.startsWith("arm"))
return "arm";
}
var archDir = kitsArchitectureSubDirectory(arch);
searchPath = FileInfo.joinPaths(binSearchPath, archDir);
addSearchPath(searchPath);
}
}
}
}
}
return searchPaths;
}
function prepareSign(project, product, inputs, outputs, input, output) {
var cmd, cmds = [];
if (!product.codesign.enableCodeSigning)
return cmds;
var isBundle = "bundle.content" in outputs;
var artifacts = [];
if (isBundle) {
artifacts = [{
filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName),
fileName: product.bundle.bundleName
}];
} else {
artifacts = outputs["codesign.signed_artifact"];
}
var isProductBundle = product.bundle && product.bundle.isBundle;
var shouldSignArtifact = !isProductBundle || isBundle;
var enableCodeSigning = product.codesign.enableCodeSigning;
if (enableCodeSigning) {
var actualSigningIdentity = product.codesign._actualSigningIdentity;
if (!actualSigningIdentity) {
throw "No codesigning identities (i.e. certificate and private key pairs) matching “"
+ product.codesign.signingIdentity + "” were found.";
}
// If this is a framework, we need to sign its versioned directory
var subpath = "";
if (isBundle) {
var isFramework = product.bundle.packageType === "FMWK";
if (isFramework) {
subpath = product.bundle.contentsFolderPath;
subpath = subpath.substring(product.bundle.bundleName.length);
}
}
// The codesign tool behaves weirdly. It can sign a bundle with a single artifact, but if
// say debug build variant is present, it starts complaining that it is not signed.
// We could always sign everything, but again, in case of a framework (but not in case of
// app or loadable bundle), codesign produces a warning that artifact is already signed.
// So, we skip signing the release artifact and only sign if other build variants present.
if (!shouldSignArtifact && artifacts.length == 1) {
artifacts = [];
}
for (var i = 0; i < artifacts.length; ++i) {
if (!shouldSignArtifact
&& artifacts[i].qbs && artifacts[i].qbs.buildVariant === "release") {
continue;
}
var outputFilePath = artifacts[i].filePath;
var outputFileName = artifacts[i].fileName;
var args = ["--force", "--sign", actualSigningIdentity.SHA1];
// If signingTimestamp is undefined or empty, do not specify the flag at all -
// this uses the system-specific default behavior
var signingTimestamp = product.codesign.signingTimestamp;
if (signingTimestamp) {
// If signingTimestamp is an empty string, specify the flag but do
// not specify a value - this uses a default Apple-provided server
var flag = "--timestamp";
if (signingTimestamp)
flag += "=" + signingTimestamp;
args.push(flag);
}
for (var j in inputs["codesign.xcent"]) {
args.push("--entitlements", inputs["codesign.xcent"][j].filePath);
break; // there should only be one
}
args = args.concat(product.codesign.codesignFlags || []);
args.push(outputFilePath + subpath);
cmd = new Command(product.codesign.codesignPath, args);
cmd.description = "codesign " + outputFileName
+ " (" + actualSigningIdentity.subjectInfo.CN + ")";
cmd.outputFilePath = outputFilePath;
cmd.stderrFilterFunction = function(stderr) {
return stderr.replace(outputFilePath + ": replacing existing signature\n", "");
};
cmds.push(cmd);
}
}
if (isBundle) {
cmd = new Command("touch", ["-c", outputFilePath]);
cmd.silent = true;
cmds.push(cmd);
}
return cmds;
}
function signApkPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var apkInput = inputs["android.package_unsigned"][0];
var apkOutput = outputs["android.package"][0];
var cmd;
if (product.codesign.enableCodeSigning) {
var args = ["sign",
"--ks", product.codesign.keystorePath,
"--ks-pass", "pass:" + product.codesign.keystorePassword,
"--ks-key-alias", product.codesign.keyAlias,
"--key-pass", "pass:" + product.codesign.keyPassword,
"--out", apkOutput.filePath,
apkInput.filePath];
cmd = new Command(product.codesign.apksignerFilePath, args);
cmd.description = "signing " + apkOutput.fileName;
} else {
cmd = new JavaScriptCommand();
cmd.description = "copying without signing " + apkOutput.fileName;
cmd.source = apkInput.filePath;
cmd.target = apkOutput.filePath;
cmd.silent = true;
cmd.sourceCode = function() {
// If enableCodeSigning is changed to false without any change to unsigned package then
// the copy won't happen because of timestamps. So the target file needs file needs to
// be removed to avoid it.
File.remove(target);
File.copy(source, target);
}
}
return cmd;
}
function signAabPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var aabInput = inputs["android.package_unsigned"][0];
var aabOutput = outputs["android.package"][0];
var cmd;
if (product.codesign.enableCodeSigning) {
args = ["-sigalg", "SHA1withRSA", "-digestalg", "SHA1",
"-keystore", product.codesign.keystorePath,
"-storepass", product.codesign.keystorePassword,
"-keypass", product.codesign.keyPassword,
"-signedjar", aabOutput.filePath,
aabInput.filePath,
product.codesign.keyAlias];
cmd = new Command(product.codesign.jarsignerFilePath, args);
cmd.description = "signing " + aabOutput.fileName;
} else {
cmd = new JavaScriptCommand();
cmd.description = "copying without signing " + aabOutput.fileName;
cmd.source = aabInput.filePath;
cmd.target = aabOutput.filePath;
cmd.silent = true;
cmd.sourceCode = function() {
// If enableCodeSigning is changed to false without any change to unsigned package then
// the copy won't happen because of timestamps. So the target file needs file needs to
// be removed to avoid it.
File.remove(target);
File.copy(source, target);
}
}
return cmd;
}
function createDebugKeyStoreCommandString(keytoolFilePath, keystoreFilePath, keystorePassword,
keyPassword, keyAlias) {
var args = ["-genkey", "-keystore", keystoreFilePath, "-alias", keyAlias,
"-storepass", keystorePassword, "-keypass", keyPassword, "-keyalg", "RSA",
"-keysize", "2048", "-validity", "10000", "-dname",
"CN=Android Debug,O=Android,C=US"];
return Process.shellQuote(keytoolFilePath, args);
}
function prepareSigntool(project, product, inputs, outputs, input, output) {
var cmd, cmds = [];
if (!product.codesign.enableCodeSigning)
return cmds;
var args = ["sign"];
var subjectName = product.codesign.subjectName;
if (subjectName)
args.push("/n", subjectName);
var rootSubjectName = product.codesign.rootSubjectName;
if (rootSubjectName)
args.push("/r", rootSubjectName);
var hashAlgorithm = product.codesign.hashAlgorithm;
if (hashAlgorithm)
args.push("/fd", hashAlgorithm);
var signingTimestamp = product.codesign.signingTimestamp;
if (signingTimestamp)
args.push("/tr", signingTimestamp);
var timestampAlgorithm = product.codesign.timestampAlgorithm;
if (timestampAlgorithm)
args.push("/td", timestampAlgorithm);
var certificatePath = product.codesign.certificatePath;
if (certificatePath)
args.push("/f", certificatePath);
var certificatePassword = product.codesign.certificatePassword;
if (certificatePassword)
args.push("/p", certificatePassword);
var crossCertificatePath = product.codesign.crossCertificatePath;
if (crossCertificatePath)
args.push("/ac", crossCertificatePath);
args = args.concat(product.codesign.codesignFlags || []);
var outputArtifact = outputs["codesign.signed_artifact"][0];
args.push(outputArtifact.filePath);
cmd = new Command(product.codesign.codesignPath, args);
cmd.description = "signing " + outputArtifact.fileName;
cmd.highlight = "linker";
cmds.push(cmd);
return cmds;
}
function generateAppleProvisioningProfileOutputs()
{
var artifacts = [];
var provisioningProfiles = (inputs["codesign.provisioningprofile"] || [])
.map(function (a) { return a.filePath; });
var bestProfile = findBestProvisioningProfile(product, provisioningProfiles);
var uuid = product.provisioningProfile;
if (bestProfile) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.codesign._embeddedProfileName),
fileTags: ["codesign.embedded_provisioningprofile"],
codesign: {
_provisioningProfileFilePath: bestProfile.filePath,
_provisioningProfileData: JSON.stringify(bestProfile.data),
}
});
} else if (uuid) {
throw "Your build settings specify a provisioning profile with the UUID '"
+ uuid + "', however, no such provisioning profile was found.";
} else if (product._provisioningProfileRequired) {
var hasProfiles = !!((inputs["codesign.provisioningprofile"] || []).length);
var teamIdentifier = product.teamIdentifier;
var codeSignIdentity = product.signingIdentity;
if (hasProfiles) {
if (codeSignIdentity) {
console.warn("No provisioning profiles matching the bundle identifier '"
+ product.bundle.identifier
+ "' were found.");
} else {
console.warn("No provisioning profiles matching an applicable signing "
+ "identity were found.");
}
} else {
if (codeSignIdentity) {
if (teamIdentifier) {
console.warn("No provisioning profiles with a valid signing identity "
+ "(i.e. certificate and private key pair) matching the "
+ "team ID '" + teamIdentifier + "' were found.")
} else {
console.warn("No provisioning profiles with a valid signing identity "
+ "(i.e. certificate and private key pair) were found.");
}
} else {
console.warn("No non-expired provisioning profiles were found.");
}
}
}
return artifacts;
}
function generateAppleProvisioningProfileCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
var data = JSON.parse(output.codesign._provisioningProfileData);
cmd.source = output.codesign._provisioningProfileFilePath;
cmd.destination = output.filePath;
cmd.description = "using provisioning profile " + data.Name + " (" + data.UUID + ")";
cmd.highlight = "filegen";
cmd.sourceCode = function() {
File.copy(source, destination);
};
return [cmd];
}
function generateAppleEntitlementsCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
cmd.description = "generating entitlements";
cmd.highlight = "codegen";
cmd.bundleIdentifier = product.bundle.identifier;
cmd.signingEntitlements = (inputs["codesign.entitlements"] || [])
.map(function (a) { return a.filePath; });
cmd.provisioningProfiles = (inputs["codesign.embedded_provisioningprofile"] || [])
.map(function (a) { return a.filePath; });
cmd.platformPath = product.xcode ? product.xcode.platformPath : undefined;
cmd.sdkPath = product.xcode ? product.xcode.sdkPath : undefined;
cmd.sourceCode = function() {
var i;
var provData = {};
var provisionProfiles = inputs["codesign.embedded_provisioningprofile"];
for (i in provisionProfiles) {
var plist = new PropertyList();
try {
plist.readFromData(Utilities.smimeMessageContent(
provisionProfiles[i].filePath));
provData = plist.toObject();
} finally {
plist.clear();
}
}
var aggregateEntitlements = {};
// Start building up an aggregate entitlements plist from the files in the SDKs,
// which contain placeholders in the same manner as Info.plist
function entitlementsFileContents(path) {
return File.exists(path) ? BundleTools.infoPlistContents(path) : undefined;
}
var entitlementsSources = [];
if (platformPath) {
entitlementsSources.push(
entitlementsFileContents(
FileInfo.joinPaths(platformPath, "Entitlements.plist")));
}
if (sdkPath) {
entitlementsSources.push(
entitlementsFileContents(
FileInfo.joinPaths(sdkPath, "Entitlements.plist")));
}
for (i = 0; i < signingEntitlements.length; ++i) {
entitlementsSources.push(entitlementsFileContents(signingEntitlements[i]));
}
for (i = 0; i < entitlementsSources.length; ++i) {
var contents = entitlementsSources[i];
for (var key in contents) {
if (contents.hasOwnProperty(key))
aggregateEntitlements[key] = contents[key];
}
}
contents = provData["Entitlements"];
for (key in contents) {
if (contents.hasOwnProperty(key) && !aggregateEntitlements.hasOwnProperty(key))
aggregateEntitlements[key] = contents[key];
}
// Expand entitlements variables with data from the provisioning profile
var env = {
"AppIdentifierPrefix": (provData["ApplicationIdentifierPrefix"] || "") + ".",
"CFBundleIdentifier": bundleIdentifier
};
DarwinTools.expandPlistEnvironmentVariables(aggregateEntitlements, env, true);
// Anything with an undefined or otherwise empty value should be removed
// Only JSON-formatted plists can have null values, other formats error out
// This also follows Xcode behavior
DarwinTools.cleanPropertyList(aggregateEntitlements);
var plist = new PropertyList();
try {
plist.readFromObject(aggregateEntitlements);
plist.writeToFile(outputs["codesign.xcent"][0].filePath, "xml1");
} finally {
plist.clear();
}
};
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/dmg/ 0000755 0001751 0000166 00000000000 14776170045 016556 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/dmg/dmg.js 0000644 0001751 0000166 00000020531 14776170045 017664 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var DarwinTools = require("qbs.DarwinTools");
var FileInfo = require("qbs.FileInfo");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function localizationFromArtifact(input) {
var locale = input.dmg.licenseLocale || DarwinTools.localizationKey(input.filePath);
if (!locale)
throw("Could not determine localization for license file: " + input.filePath);
return locale;
}
function dmgbuildSettings(product, inputs) {
var backgroundImages = inputs["tiff"];
var backgroundImage;
if (backgroundImages) {
if (backgroundImages.length > 1)
throw new Error("only one background image may be specified");
backgroundImage = backgroundImages[0].filePath;
}
var volumeIcons = inputs["icns"];
var volumeIcon;
if (volumeIcons) {
if (volumeIcons.length > 1)
throw new Error("only one volume icon may be specified");
volumeIcon = volumeIcons[0].filePath;
}
var licenseFileObjects = Array.prototype.map.call(inputs["dmg.license"] || [], function (a) {
return {
"dmg": {
"licenseLocale": localizationFromArtifact(a),
"licenseLanguageName": a.dmg.licenseLanguageName,
"licenseAgreeButtonText": a.dmg.licenseAgreeButtonText,
"licenseDisagreeButtonText": a.dmg.licenseDisagreeButtonText,
"licensePrintButtonText": a.dmg.licensePrintButtonText,
"licenseSaveButtonText": a.dmg.licenseSaveButtonText,
"licenseInstructionText": a.dmg.licenseInstructionText,
},
"filePath": a.filePath
};
});
function reduceLicensesForKey(licenseFileObjects, key) {
return licenseFileObjects.reduce(function (accumulator, currentValue) {
var locale = currentValue.dmg.licenseLocale;
if (accumulator[locale])
throw new Error("Multiple license files for localization '" + locale + "'");
switch (key) {
case "licenses":
accumulator[locale] = currentValue.filePath;
break;
case "buttons":
var texts = [
currentValue.dmg.licenseLanguageName,
currentValue.dmg.licenseAgreeButtonText,
currentValue.dmg.licenseDisagreeButtonText,
currentValue.dmg.licensePrintButtonText,
currentValue.dmg.licenseSaveButtonText,
currentValue.dmg.licenseInstructionText
];
accumulator[locale] = texts.every(function (a) { return !!a; }) ? texts : undefined;
break;
}
return accumulator;
}, {});
}
var contentsArray = Array.prototype.map.call(inputs["dmg.input"] || [], function (a) {
if (a.dmg.sourceBase && !a.filePath.startsWith(a.dmg.sourceBase)) {
throw new Error("Cannot install '" + a.filePath + "', " +
"because it doesn't start with the value of " +
"dmg.sourceBase '" + a.dmg.sourceBase + "'.");
}
var isSymlink = a.fileTags.includes("dmg.input.symlink");
return {
"x": a.dmg.iconX,
"y": a.dmg.iconY,
"type": isSymlink ? "link" : "file",
"path": isSymlink ? a.dmg.symlinkTarget : a.filePath,
"name": FileInfo.relativePath(a.dmg.sourceBase || FileInfo.path(a.filePath), a.filePath)
};
});
Array.prototype.forEach.call(product.dmg.iconPositions || [], function (obj) {
var existingIndex = -1;
Array.prototype.forEach.call(contentsArray, function (contentsItem, i) {
if (contentsItem["name"] === obj["path"])
existingIndex = i;
});
if (existingIndex >= 0) {
contentsArray[existingIndex]["x"] = obj["x"];
contentsArray[existingIndex]["y"] = obj["y"];
} else {
contentsArray.push({
"type": "position",
"name": obj["path"], // name => path is not a typo
"path": obj["path"],
"x": obj["x"],
"y": obj["y"]
});
}
});
var result = {
"title": product.dmg.volumeName,
"icon": !product.dmg.badgeVolumeIcon ? volumeIcon : undefined,
"badge-icon": product.dmg.badgeVolumeIcon ? volumeIcon : undefined,
"background": backgroundImage,
"background-color": product.dmg.backgroundColor,
"icon-size": product.dmg.iconSize,
"window": {
"position": {
"x": product.dmg.windowX,
"y": product.dmg.windowY
},
"size": {
"width": product.dmg.windowWidth,
"height": product.dmg.windowHeight
}
},
"format": product.dmg.format,
"compression-level": product.dmg.compressionLevel,
"contents": contentsArray
};
if (licenseFileObjects.length >= 0) {
result["license"] = {
"default-language": product.dmg.defaultLicenseLocale,
"licenses": reduceLicensesForKey(licenseFileObjects, "licenses"),
"buttons": reduceLicensesForKey(licenseFileObjects, "buttons")
};
}
return result;
}
function prepareLicense(project, product, inputs, outputs, input, output) {
var cmd = new Command(product.dmg.textutilPath, [
"-convert", "rtf",
"-strip",
"-font", "Arial",
"-output", output.filePath,
"--", input.filePath
]);
cmd.description = "converting " + input.fileName;
return [cmd];
}
function prepareDmg(project, product, inputs, outputs, input, output) {
var i;
var cmd;
var cmds = [];
var settingsJsonFilePath = FileInfo.joinPaths(product.destinationDirectory,
"settings.json");
cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.settingsJSON = dmgbuildSettings(product, inputs);
cmd.settingsJsonFilePath = settingsJsonFilePath;
cmd.sourceCode = function () {
var tf;
try {
tf = new TextFile(settingsJsonFilePath, TextFile.WriteOnly);
tf.writeLine(JSON.stringify(settingsJSON, undefined, 4));
} finally {
if (tf)
tf.close();
}
}
cmds.push(cmd);
// Create the actual DMG via dmgbuild
cmd = new Command(product.dmg.pythonExePath,
["-m",
"dmgbuild",
product.dmg.volumeName,
output.filePath,
"--no-hidpi", // qbs handles this by itself
"--settings", settingsJsonFilePath]);
cmd.environment = ["PYTHONPATH=" + product.dmg.pythonPath];
cmd.description = "creating " + output.fileName;
cmds.push(cmd);
return cmds;
}
qbs-src-2.6.1/share/qbs/modules/dmg/DMGModule.qbs 0000644 0001751 0000166 00000013052 14776170045 021043 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.DarwinTools
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Process
import qbs.Probes
import qbs.TextFile
import "dmg.js" as Dmg
Module {
Depends { name: "xcode"; required: false }
condition: Host.os().includes("darwin") && qbs.targetOS.includes("darwin")
property string volumeName: product.targetName
PropertyOptions {
name: "volumeName"
description: "the name of the disk image (displayed in Finder when mounted)"
}
property bool badgeVolumeIcon: false
PropertyOptions {
name: "badgeVolumeIcon"
description: "whether to render the user-supplied icon on top of the " +
"default volume icon instead of using it directly"
}
property string format: "UDBZ"
PropertyOptions {
name: "format"
description: "the format to create the disk image in"
}
property int compressionLevel: qbs.buildVariant === "release" ? 9 : undefined
PropertyOptions {
name: "compressionLevel"
description: "sets the zlib or bzip2 compression level for UDZO and UDBZ disk images"
}
property string textutilPath: "/usr/bin/textutil"
property string hdiutilPath: "/usr/bin/hdiutil"
property string dmgSuffix: ".dmg"
property string sourceBase
Probes.BinaryProbe {
id: pythonProbe
names: ["python3"]
}
property string pythonExePath: pythonProbe.found ? pythonProbe.filePath : "python3"
readonly property string pythonPath: File.canonicalFilePath(FileInfo.joinPaths(path,
"..", "..",
"python"))
property string backgroundColor
property int iconSize: 128
property int windowX: 100
property int windowY: 100
property int windowWidth: 640
property int windowHeight: 480
property var iconPositions
property int iconX: windowWidth / 2
property int iconY: windowHeight / 2
property string defaultLicenseLocale
property string licenseLocale
property string licenseLanguageName
property string licenseAgreeButtonText
property string licenseDisagreeButtonText
property string licensePrintButtonText
property string licenseSaveButtonText
property string licenseInstructionText
FileTagger {
patterns: [
"*.txt", "*.rtf", "*.html", "*.doc", "*.docx", "*.odt", "*.xml", "*.webarchive",
"LICENSE"
]
fileTags: ["dmg.license.input"]
}
FileTagger {
patterns: ["*.icns"]
fileTags: ["icns"]
}
FileTagger {
patterns: ["*.tif", "*.tiff"]
fileTags: ["tiff"]
}
Rule {
inputs: ["dmg.license.input"]
outputFileTags: ["dmg.license"]
outputArtifacts: ([{
filePath: FileInfo.joinPaths(product.destinationDirectory, "licenses",
FileInfo.relativePath(product.sourceDirectory,
input.filePath) + ".rtf"),
fileTags: ["dmg.license"],
dmg: {
licenseLocale: input.dmg.licenseLocale,
licenseLanguageName: input.dmg.licenseLanguageName,
licenseAgreeButtonText: input.dmg.licenseAgreeButtonText,
licenseDisagreeButtonText: input.dmg.licenseDisagreeButtonText,
licensePrintButtonText: input.dmg.licensePrintButtonText,
licenseSaveButtonText: input.dmg.licenseSaveButtonText,
licenseInstructionText: input.dmg.licenseInstructionText
}
}])
prepare: Dmg.prepareLicense.apply(Dmg, arguments)
}
Rule {
multiplex: true
inputs: ["dmg.input", "dmg.license", "icns", "tiff"]
Artifact {
fileTags: ["dmg.dmg"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName + product.dmg.dmgSuffix)
}
prepare: Dmg.prepareDmg.apply(Dmg, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/innosetup/ 0000755 0001751 0000166 00000000000 14776170045 020033 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/innosetup/InnoSetupModule.qbs 0000644 0001751 0000166 00000013211 14776170045 023632 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
import qbs.ModUtils
import qbs.Probes
Module {
condition: qbs.targetOS.includes("windows")
Probes.InnoSetupProbe {
id: innoSetupProbe
}
property path toolchainInstallPath: innoSetupProbe.path
version: innoSetupProbe.version
property var versionParts: version ? version.split('.').map(function (item) { return parseInt(item, 10); }) : []
property int versionMajor: versionParts[0]
property int versionMinor: versionParts[1]
property int versionPatch: versionParts[2]
property string compilerName: "ISCC.exe"
property string compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
property bool verboseOutput: false
PropertyOptions {
name: "verboseOutput"
description: "display verbose output from the Inno Setup compiler"
}
property pathList includePaths
PropertyOptions {
name: "includePaths"
description: "directories to add to the include search path"
}
property stringList defines
PropertyOptions {
name: "defines"
description: "variables that are defined when using the Inno Setup compiler"
}
property stringList compilerFlags
PropertyOptions {
name: "compilerFlags"
description: "additional flags for the Inno Setup compiler"
}
readonly property string executableSuffix: ".exe"
validate: {
if (!innoSetupProbe.found) {
throw ModUtils.ModuleError("Could not find InnoSetup in Windows registry. Make " +
"sure InnoSetup is installed correctly.");
}
var validator = new ModUtils.PropertyValidator("innosetup");
validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath);
validator.setRequiredProperty("version", version);
validator.setRequiredProperty("versionMajor", versionMajor);
validator.setRequiredProperty("versionMinor", versionMinor);
validator.setRequiredProperty("versionPatch", versionPatch);
validator.addVersionValidator("version", version, 3, 3);
validator.addRangeValidator("versionMajor", versionMajor, 1);
validator.addRangeValidator("versionMinor", versionMinor, 0);
validator.addRangeValidator("versionPatch", versionPatch, 0);
validator.validate();
}
// Inno Setup Script
FileTagger {
patterns: ["*.iss"]
fileTags: ["innosetup.iss"]
}
Rule {
id: innoSetupCompiler
inputs: ["innosetup.iss"]
auxiliaryInputs: ["installable"]
auxiliaryInputsFromDependencies: ["installable"]
Artifact {
fileTags: ["innosetup.exe", "application"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ ModUtils.moduleProperty(product, "executableSuffix"))
}
prepare: {
var i;
var args = [
"/O" + FileInfo.toNativeSeparators(FileInfo.path(output.filePath)),
"/F" + FileInfo.toNativeSeparators(FileInfo.completeBaseName(output.fileName))
];
if (!ModUtils.moduleProperty(product, "verboseOutput"))
args.push("/Q");
var includePaths = ModUtils.moduleProperty(product, "includePaths");
for (i in includePaths)
args.push("/I" + FileInfo.toNativeSeparators(includePaths[i]));
// User-supplied defines
var defines = ModUtils.moduleProperty(product, "defines");
for (i in defines)
args.push("/D" + defines[i]);
// User-supplied flags
var flags = ModUtils.moduleProperty(product, "compilerFlags");
for (i in flags)
args.push(flags[i]);
args.push(FileInfo.toNativeSeparators(input.filePath));
var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args);
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.workingDirectory = FileInfo.path(input.filePath);
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/modules/xcode/ 0000755 0001751 0000166 00000000000 14776170045 017111 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/xcode/xcode.qbs 0000644 0001751 0000166 00000020205 14776170045 020721 0 ustar runner docker import qbs.BundleTools
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.DarwinTools
import qbs.ModUtils
import qbs.Probes
import qbs.PropertyList
import qbs.Utilities
Module {
Probes.XcodeLocationProbe {
id: xcodeLocationProbe
condition: !developerPath
}
Probes.XcodeProbe {
id: xcodeProbe
developerPath: parent.developerPath
platformType: parent.platformType
platformPath: parent.platformPath
devicePlatformPath: parent.devicePlatformPath
xcodebuildPath: parent.xcodebuildPath
sdksPath: parent.sdksPath
}
condition: qbs.targetOS.includes("darwin") &&
qbs.toolchain && qbs.toolchain.includes("xcode")
version: xcodeProbe.xcodeVersion
property path developerPath: xcodeLocationProbe.found
? xcodeLocationProbe.developerPath
: undefined
property string sdk: DarwinTools.applePlatformName(qbs.targetOS, platformType)
property stringList targetDevices: DarwinTools.targetDevices(qbs.targetOS)
property string platformType: {
if (qbs.targetOS.containsAny(["ios-simulator", "tvos-simulator", "watchos-simulator"]))
return "simulator";
if (qbs.targetOS.containsAny(["ios", "tvos", "watchos"]))
return "device";
}
readonly property string sdkName: {
if (_sdkSettings) {
return _sdkSettings["CanonicalName"];
}
}
readonly property string sdkVersion: {
if (_sdkSettings) {
return _sdkSettings["Version"];
}
}
readonly property string shortSdkVersion: {
var v = sdkVersion;
if (v && v.split('.').length > 2)
v = v.slice(0, v.lastIndexOf('.'));
return v;
}
readonly property string latestSdkName: {
if (_latestSdk) {
return _latestSdk["CanonicalName"];
}
}
readonly property string latestSdkVersion: {
if (_latestSdk) {
return _latestSdk["Version"];
}
}
readonly property stringList availableSdkNames: {
if (_availableSdks) {
return _availableSdks.map(function (obj) { return obj["CanonicalName"]; });
}
}
readonly property stringList availableSdkVersions: {
if (_availableSdks) {
return _availableSdks.map(function (obj) { return obj["Version"]; });
}
}
readonly property path toolchainPath: FileInfo.joinPaths(toolchainsPath,
"XcodeDefault" + ".xctoolchain")
readonly property path platformPath: FileInfo.joinPaths(platformsPath,
DarwinTools.applePlatformDirectoryName(
qbs.targetOS, platformType)
+ ".platform")
readonly property path devicePlatformPath: FileInfo.joinPaths(
platformsPath,
DarwinTools.applePlatformDirectoryName(
qbs.targetOS, "device")
+ ".platform")
readonly property path simulatorPlatformPath: FileInfo.joinPaths(
platformsPath,
DarwinTools.applePlatformDirectoryName(
qbs.targetOS, "simulator")
+ ".platform")
readonly property path sdkPath: FileInfo.joinPaths(sdksPath,
DarwinTools.applePlatformDirectoryName(
qbs.targetOS, platformType,
shortSdkVersion) + ".sdk")
// private properties
readonly property path toolchainsPath: FileInfo.joinPaths(developerPath, "Toolchains")
readonly property path platformsPath: FileInfo.joinPaths(developerPath, "Platforms")
readonly property path sdksPath: FileInfo.joinPaths(platformPath, "Developer", "SDKs")
readonly property path platformInfoPlist: FileInfo.joinPaths(platformPath, "Info.plist")
readonly property path sdkSettingsPlist: FileInfo.joinPaths(sdkPath, "SDKSettings.plist")
readonly property path toolchainInfoPlist: FileInfo.joinPaths(toolchainPath,
"ToolchainInfo.plist")
readonly property var _platformSettings: xcodeProbe.platformSettings
readonly property var _platformProps: {
if (_platformSettings)
return _platformSettings["DefaultProperties"];
}
readonly property stringList standardArchitectures: _architectureSettings["ARCHS_STANDARD"]
readonly property var _architectureSettings: xcodeProbe.architectureSettings
readonly property var _availableSdks: xcodeProbe.availableSdks
readonly property var _latestSdk: _availableSdks[_availableSdks.length - 1]
readonly property var _sdkSettings: {
if (_availableSdks) {
// see 'sdk' property doc to understand why this loop is needed
for (var i in _availableSdks) {
if (_availableSdks[i]["Version"] === sdk)
return _availableSdks[i];
if (_availableSdks[i]["CanonicalName"] === sdk)
return _availableSdks[i];
}
// Latest SDK available for the platform (default case)
if (DarwinTools.applePlatformName(qbs.targetOS, platformType) === sdk)
return _latestSdk;
}
}
readonly property var _sdkProps: {
if (_sdkSettings) {
return _sdkSettings["DefaultProperties"];
}
}
qbs.sysroot: sdkPath
validate: {
if (!_availableSdks) {
throw "There are no SDKs available for this platform in the Xcode installation.";
}
if (!_sdkSettings) {
throw "There is no matching SDK available for " + sdk + ".";
}
var validator = new ModUtils.PropertyValidator("xcode");
validator.setRequiredProperty("developerPath", developerPath);
validator.setRequiredProperty("sdk", sdk);
validator.setRequiredProperty("sdkName", sdkName);
validator.setRequiredProperty("sdkVersion", sdkVersion);
validator.setRequiredProperty("toolchainsPath", toolchainsPath);
validator.setRequiredProperty("toolchainPath", toolchainPath);
validator.setRequiredProperty("platformsPath", platformsPath);
validator.setRequiredProperty("platformPath", platformPath);
validator.setRequiredProperty("sdksPath", sdkPath);
validator.setRequiredProperty("sdkPath", sdkPath);
validator.addVersionValidator("sdkVersion", sdkVersion, 2, 3);
validator.addCustomValidator("sdkName", sdkName, function (value) {
return value === DarwinTools.applePlatformDirectoryName(
qbs.targetOS, platformType, shortSdkVersion, false).toLowerCase();
}, "is '" + sdkName + "', but target OS is [" + qbs.targetOS.join(",")
+ "] and Xcode SDK version is '" + sdkVersion + "'");
validator.addCustomValidator("sdk", sdk, function (value) {
return value === sdkName || (value + shortSdkVersion) === sdkName;
}, "is '" + sdk + "', but canonical SDK name is '" + sdkName + "'");
validator.validate();
}
property var buildEnv: ({
"DEVELOPER_DIR": developerPath,
"SDKROOT": sdkPath
})
setupBuildEnvironment: {
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), false);
v.prepend(product.xcode.platformPath + "/Developer/usr/bin");
v.prepend(product.xcode.developerPath + "/usr/bin");
v.set();
for (var key in product.xcode.buildEnv) {
v = new ModUtils.EnvironmentVariable(key);
v.value = product.xcode.buildEnv[key];
v.set();
}
}
}
qbs-src-2.6.1/share/qbs/modules/xcode/xcode.js 0000644 0001751 0000166 00000025146 14776170045 020561 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var DarwinTools = require("qbs.DarwinTools");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Process = require("qbs.Process");
var PropertyList = require("qbs.PropertyList");
var Utilities = require("qbs.Utilities");
var XcodeArchSpecsReader = (function () {
function XcodeArchSpecsReader(specsPath) {
var plist = new PropertyList();
try {
plist.readFromFile(specsPath);
this.specsObject = plist.toObject();
} finally {
plist.clear();
}
}
XcodeArchSpecsReader.prototype.getArchitectureSettings = function () {
if (this.specsObject) {
var names = [];
for (var i = 0; i < this.specsObject.length; ++i) {
var dict = this.specsObject[i];
var name = dict["ArchitectureSetting"];
if (name)
names.push(name);
}
return names;
}
};
XcodeArchSpecsReader.prototype.getArchitectureSettingValue = function (settingName) {
// settingName can be: ARCHS_STANDARD, ARCHS_STANDARD_32_BIT, ARCHS_STANDARD_64_BIT,
// ARCHS_STANDARD_32_64_BIT, ARCHS_STANDARD_INCLUDING_64_BIT, or ARCHS_UNIVERSAL_IPHONE_OS.
// NATIVE_ARCH_ACTUAL doesn't have a RealArchitectures property since it's determined by
// Xcode programmatically.
if (this.specsObject) {
for (var i = 0; i < this.specsObject.length; ++i) {
var dict = this.specsObject[i];
if (dict["ArchitectureSetting"] === settingName) {
var realArchs = dict["RealArchitectures"];
if (realArchs) {
var effectiveRealArchs = [];
for (var j = 0; j < realArchs.length; ++j) {
var re = /^\$\(([A-Za-z0-9_]+)\)$/;
var match = realArchs[j].match(re);
if (match) {
var val = this.getArchitectureSettingValue(match[1]);
// Don't silently omit values if missing. For example, if
// ARCHS_FOO=[x86_64, $(ARCHS_BAR)], return 'undefined' instead of
// simply [x86_64]. Not known to have any real world occurrences.
if (!val)
return undefined;
Array.prototype.push.apply(effectiveRealArchs, val);
} else {
effectiveRealArchs.push(realArchs[j]);
}
}
return effectiveRealArchs;
}
}
}
}
};
return XcodeArchSpecsReader;
}());
function platformInfo(platformInfoPlist) {
var propertyList = new PropertyList();
try {
propertyList.readFromFile(platformInfoPlist);
return propertyList.toObject();
} finally {
propertyList.clear();
}
}
function sdkInfoList(sdksPath) {
var sdkInfo = [];
var sdks = File.directoryEntries(sdksPath, File.Dirs | File.NoDotAndDotDot);
for (var i in sdks) {
// SDK directory name must contain a version number;
// we don't want the versionless iPhoneOS.sdk directory for example
if (!sdks[i].match(/[0-9]+/))
continue;
if (sdks[i].startsWith("DriverKit") || sdks[i].startsWith("AssetRuntime"))
continue;
var settingsPlist = FileInfo.joinPaths(sdksPath, sdks[i], "SDKSettings.plist");
var propertyList = new PropertyList();
try {
propertyList.readFromFile(settingsPlist);
function checkPlist(plist) {
if (!plist || !plist["CanonicalName"] || !plist["Version"])
return false;
var re = /^[0-9]+\.[0-9]+(\.[0-9]+)?$/;
return plist["Version"].match(re);
}
var plist = propertyList.toObject();
if (!checkPlist(plist)) {
console.warn("Skipping corrupted SDK installation: "
+ FileInfo.joinPaths(sdksPath, sdks[i]));
continue;
}
sdkInfo.push(plist);
} finally {
propertyList.clear();
}
}
// Sort by SDK version number
sdkInfo.sort(function (a, b) { return Utilities.versionCompare(a["Version"], b["Version"]); });
return sdkInfo;
}
function findSigningIdentities(security, searchString) {
var process;
var identities;
if (searchString) {
try {
process = new Process();
if (process.exec(security, ["find-identity", "-p", "codesigning", "-v"], true) !== 0)
console.error(process.readStdErr());
var lines = process.readStdOut().split("\n");
for (var i in lines) {
// e.g. 1) AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA "Mac Developer: John Doe (XXXXXXXXXX) john.doe@example.org"
var match = lines[i].match(/^\s*[0-9]+\)\s+([A-Fa-f0-9]{40})\s+"([^"]+)"$/);
if (match !== null) {
var hexId = match[1];
var displayName = match[2];
if (hexId === searchString || displayName.startsWith(searchString)) {
if (!identities)
identities = [];
identities.push([hexId, displayName]);
break;
}
}
}
} finally {
process.close();
}
}
return identities;
}
function provisioningProfilePlistContents(filePath) {
if (filePath === undefined || !File.exists(filePath))
return undefined;
var plist = new PropertyList();
try {
plist.readFromFile(filePath);
return plist.toObject();
} finally {
plist.clear();
}
}
function boolFromSdkOrPlatform(varName, sdkProps, platformProps, defaultValue) {
var values = [(sdkProps || {})[varName], (platformProps || {})[varName]];
for (var i = 0; i < values.length; ++i) {
if (values[i] === "YES")
return true;
if (values[i] === "NO")
return false;
}
return defaultValue;
}
function archsSpecsPath(version, targetOS, platformType, platformPath, devicePlatformPath,
developerPath) {
if (Utilities.versionCompare(version, "13.3") >= 0) {
var pluginsDir;
if (Utilities.versionCompare(version, "15.3") >= 0) {
pluginsDir = FileInfo.joinPaths(developerPath, "..",
"SharedFrameworks", "XCBuild.framework", "PlugIns", "XCBBuildService.bundle",
"Contents", "PlugIns");
} else if (Utilities.versionCompare(version, "14.3") >= 0) {
pluginsDir = FileInfo.joinPaths(developerPath, "Library", "Xcode", "Plug-ins");
} else {
pluginsDir = FileInfo.joinPaths(developerPath, "..", "PlugIns");
}
var baseDir = FileInfo.joinPaths(pluginsDir,
"XCBSpecifications.ideplugin", "Contents", "Resources");
var baseName = targetOS.includes("macos") ? "MacOSX Architectures"
: targetOS.includes("ios-simulator") ? "iOS Simulator"
: targetOS.includes("ios") ? "iOS Device"
: targetOS.includes("tvos-simulator") ? "tvOS Simulator"
: targetOS.includes("tvos") ? "tvOS Device"
: targetOS.includes("watchos-simulator") ? "watchOS Simulator" : "watchOS Device";
return FileInfo.joinPaths(baseDir, baseName + ".xcspec");
}
var _specsPluginBaseName;
if (Utilities.versionCompare(version, "12") >= 0) {
if (targetOS.includes("macos"))
_specsPluginBaseName = "OSX";
}
if (Utilities.versionCompare(version, "7") >= 0) {
if (targetOS.includes("ios"))
_specsPluginBaseName = "iOSPlatform";
if (targetOS.includes("tvos"))
_specsPluginBaseName = "AppleTV";
if (targetOS.includes("watchos"))
_specsPluginBaseName = "Watch";
}
var _archSpecsDir = _specsPluginBaseName
? FileInfo.joinPaths(devicePlatformPath, "Developer", "Library", "Xcode",
"PrivatePlugIns",
"IDE" + _specsPluginBaseName + "SupportCore.ideplugin", "Contents",
"Resources")
: FileInfo.joinPaths(platformPath, "Developer", "Library", "Xcode", "Specifications");
var _archSpecsFileBaseName = targetOS.includes("ios")
? (targetOS.includes("ios-simulator") ? "iPhone Simulator " : "iPhoneOS")
: DarwinTools.applePlatformDirectoryName(targetOS, platformType) + " ";
if (_specsPluginBaseName) {
switch (platformType) {
case "device":
return FileInfo.joinPaths(_archSpecsDir, "Device.xcspec");
case "simulator":
return FileInfo.joinPaths(_archSpecsDir, "Simulator.xcspec");
}
}
return FileInfo.joinPaths(_archSpecsDir, _archSpecsFileBaseName + "Architectures.xcspec");
}
qbs-src-2.6.1/share/qbs/modules/Exporter/ 0000755 0001751 0000166 00000000000 14776170045 017617 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Exporter/exporter.js 0000644 0001751 0000166 00000006420 14776170045 022027 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of the Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
function getPrefixToStrip(project, product, propName, value)
{
function checkValuePrefix(forbiddenPrefix, prefixDescription)
{
if (value.startsWith(forbiddenPrefix)) {
throw "Value '" + value + "' for exported property '" + propName + "' in product '"
+ product.name + "' points into " + prefixDescription + ".\n"
+ "Did you forget to set the prefixMapping property in an Export item?";
}
}
// Catch user oversights: Paths that point into the project source or build directories
// make no sense in the module.
if (!value.startsWith(product.qbs.installRoot)) {
checkValuePrefix(project.buildDirectory, "project build directory");
checkValuePrefix(project.sourceDirectory, "project source directory");
}
// Adapt file paths pointing into the install dir, that is, make them relative to the
// module file for relocatability. We accept them with or without the install root.
// The latter form will typically be a result of applying the prefixMapping property,
// while the first one could be an untransformed path, for instance if the project
// file is written in such a way that include paths are picked up from the installed
// location rather than the source directory.
var result;
var fullInstallPrefix = FileInfo.joinPaths(product.qbs.installRoot, product.qbs.installPrefix);
if (fullInstallPrefix.length > 1 && value.startsWith(fullInstallPrefix)) {
result = fullInstallPrefix;
} else {
var installPrefix = FileInfo.joinPaths("/", product.qbs.installPrefix);
if (installPrefix.length > 1 && value.startsWith(installPrefix))
result = installPrefix;
}
return result;
}
qbs-src-2.6.1/share/qbs/modules/Exporter/qbs/ 0000755 0001751 0000166 00000000000 14776170045 020404 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Exporter/qbs/qbsexporter.js 0000644 0001751 0000166 00000023203 14776170045 023320 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var ExporterHelpers = require("../exporter.js");
function tagListToString(tagList)
{
return JSON.stringify(tagList);
}
function stringToTagList(tagListString)
{
return JSON.parse(tagListString);
}
function writeTargetArtifactGroup(output, tagList, artifactList, moduleInstallDir, moduleFile)
{
// Do not add our qbs module file itself.
if (tagListToString(tagList) === tagListToString(output.fileTags))
return;
moduleFile.writeLine(" Group {");
moduleFile.writeLine(" filesAreTargets: true");
var filteredTagList = tagList.filter(function(t) { return t !== "installable"; });
moduleFile.writeLine(" fileTags: " + JSON.stringify(filteredTagList));
moduleFile.writeLine(" files: [");
for (i = 0; i < artifactList.length; ++i) {
var artifact = artifactList[i];
var installedArtifactFilePath = ModUtils.artifactInstalledFilePath(artifact);
// Use relative file paths for relocatability.
var relativeInstalledArtifactFilePath = FileInfo.relativePath(moduleInstallDir,
installedArtifactFilePath);
moduleFile.writeLine(" " + JSON.stringify(relativeInstalledArtifactFilePath)
+ ",");
}
moduleFile.writeLine(" ]");
moduleFile.writeLine(" }");
}
function writeTargetArtifactGroups(product, output, moduleFile)
{
var relevantArtifacts = [];
for (var i = 0; i < (product.Exporter.qbs._artifactTypes || []).length; ++i) {
var tag = product.Exporter.qbs._artifactTypes[i];
var artifactsForTag = product.artifacts[tag] || [];
for (var j = 0; j < artifactsForTag.length; ++j) {
if (!relevantArtifacts.includes(artifactsForTag[j]))
relevantArtifacts.push(artifactsForTag[j]);
}
}
var artifactsByTags = {};
var artifactCount = relevantArtifacts ? relevantArtifacts.length : 0;
for (i = 0; i < artifactCount; ++i) {
var artifact = relevantArtifacts[i];
if (!artifact.fileTags.includes("installable"))
continue;
// Put all artifacts with the same set of file tags into the same group, so we don't
// create more groups than necessary.
var key = tagListToString(artifact.fileTags);
var currentList = artifactsByTags[key];
if (currentList)
currentList.push(artifact);
else
currentList = [artifact];
artifactsByTags[key] = currentList;
}
var moduleInstallDir = FileInfo.path(ModUtils.artifactInstalledFilePath(output));
for (var tagListKey in artifactsByTags) {
writeTargetArtifactGroup(output, stringToTagList(tagListKey), artifactsByTags[tagListKey],
moduleInstallDir, moduleFile);
}
}
function stringifyValue(project, product, moduleInstallDir, prop, value)
{
if (value instanceof Array) {
var repr = "[";
for (var i = 0; i < value.length; ++i) {
repr += stringifyValue(project, product, moduleInstallDir, prop, value[i]) + ", ";
}
repr += "]";
return repr;
}
if (typeof(value) !== "string") {
var value = JSON.stringify(value);
if (prop.type === "variant")
value = '(' + value + ')';
return value;
}
var valuePrefixToStrip = ExporterHelpers.getPrefixToStrip(project, product, prop.name, value);
if (valuePrefixToStrip) {
var fullInstallPrefix = FileInfo.joinPaths(product.qbs.installRoot, product.qbs.installPrefix);
var deployedModuleInstallDir = moduleInstallDir.slice(fullInstallPrefix.length);
return "FileInfo.cleanPath(FileInfo.joinPaths(path, FileInfo.relativePath("
+ JSON.stringify(deployedModuleInstallDir) + ", "
+ JSON.stringify(value.slice(valuePrefixToStrip.length) || "/") + ")))";
}
return JSON.stringify(value);
}
function writeProperty(project, product, moduleInstallDir, prop, indentation, considerValue,
moduleFile)
{
var line = indentation;
var separatorIndex = prop.name.lastIndexOf(".");
var isModuleProperty = separatorIndex !== -1;
var needsDeclaration = !prop.isBuiltin && !isModuleProperty;
if (needsDeclaration)
line += "property " + prop.type + " ";
var moduleName;
if (isModuleProperty) {
moduleName = prop.name.slice(0, separatorIndex);
if ((product.Exporter.qbs.excludedDependencies || []).includes(moduleName))
return;
}
line += prop.name + ": ";
// We emit the literal value, unless the source code clearly refers to values from inside the
// original project, in which case the evaluated value is used.
if (considerValue && /(project|product|exportingProduct)\./.test(prop.sourceCode)) {
var value;
if (isModuleProperty) {
var propertyName = prop.name.slice(separatorIndex + 1);
value = product.exports[moduleName][propertyName];
} else {
value = product.exports[prop.name];
}
line += stringifyValue(project, product, moduleInstallDir, prop, value);
} else {
line += prop.sourceCode.replace(/importingProduct\./g, "product.");
}
moduleFile.writeLine(line);
}
function writeProperties(project, product, moduleInstallDir, list, indentation, considerValue,
moduleFile)
{
for (var i = 0; i < list.length; ++i) {
writeProperty(project, product, moduleInstallDir, list[i], indentation, considerValue,
moduleFile);
}
}
// This writes properties set on other modules in the Export item, i.e. property assignments
// like "cpp.includePaths: '...'".
function writeModuleProperties(project, product, output, moduleFile)
{
var moduleInstallDir = FileInfo.path(ModUtils.artifactInstalledFilePath(output));
var filteredProps = product.exports.properties.filter(function(p) {
return p.name !== "name";
});
// The right-hand side can refer to values from the exporting product, in which case
// the evaluated value, rather than the source code, needs to go into the module file.
var considerValues = true;
writeProperties(project, product, moduleInstallDir, filteredProps, " ", considerValues,
moduleFile);
}
function writeItem(product, item, indentation, moduleFile)
{
moduleFile.writeLine(indentation + item.name + " {");
var newIndentation = indentation + " ";
// These are sub-items of the Export item, whose properties entirely live in the context
// of the importing product. Therefore, they must never use pre-evaluated values.
var considerValues = false;
writeProperties(undefined, product, undefined, item.properties, newIndentation, considerValues,
moduleFile)
for (var i = 0; i < item.childItems.length; ++i)
writeItem(product, item.childItems[i], newIndentation, moduleFile);
moduleFile.writeLine(indentation + "}");
}
function isExcludedDependency(product, childItem)
{
if ((product.Exporter.qbs.excludedDependencies || []).length === 0)
return false;
if (childItem.name !== "Depends")
return false;
for (var i = 0; i < childItem.properties.length; ++i) {
var prop = childItem.properties[i];
var unquotedRhs = prop.sourceCode.slice(1, -1);
if (prop.name === "name" && product.Exporter.qbs.excludedDependencies.includes(unquotedRhs))
return true;
}
return false;
}
function writeChildItems(product, moduleFile)
{
for (var i = 0; i < product.exports.childItems.length; ++i) {
var item = product.exports.childItems[i];
if (!isExcludedDependency(product, item))
writeItem(product, item, " ", moduleFile);
}
}
function writeImportStatements(product, moduleFile)
{
var imports = product.exports.imports;
// We potentially use FileInfo ourselves when transforming paths in stringifyValue().
if (!imports.includes("import qbs.FileInfo"))
imports.push("import qbs.FileInfo");
for (var i = 0; i < imports.length; ++i)
moduleFile.writeLine(imports[i]);
}
qbs-src-2.6.1/share/qbs/modules/Exporter/qbs/qbsexporter.qbs 0000644 0001751 0000166 00000006127 14776170045 023477 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
import qbs.TextFile
import "qbsexporter.js" as HelperFunctions
Module {
property stringList artifactTypes
property string fileName: product.targetName + ".qbs"
property stringList excludedDependencies
property string additionalContent
property stringList _artifactTypes: artifactTypes ? artifactTypes : ["installable"]
additionalProductTypes: ["Exporter.qbs.module"]
Rule {
multiplex: true
requiresInputs: false
// Make sure we only run when all other artifacts are already present.
auxiliaryInputs: product.type.filter(function(t) { return t !== "Exporter.qbs.module"; })
Artifact {
filePath: product.Exporter.qbs.fileName
fileTags: ["Exporter.qbs.module"]
qbs.install: true
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.sourceCode = function() {
var f = new TextFile(output.filePath, TextFile.WriteOnly);
HelperFunctions.writeImportStatements(product, f);
f.writeLine("\nModule {");
HelperFunctions.writeModuleProperties(project, product, output, f);
HelperFunctions.writeTargetArtifactGroups(product, output, f);
HelperFunctions.writeChildItems(product, f);
if (product.Exporter.qbs.additionalContent)
f.writeLine(product.Exporter.qbs.additionalContent);
f.writeLine("}");
f.close();
};
return [cmd];
}
}
}
qbs-src-2.6.1/share/qbs/modules/Exporter/cmake/ 0000755 0001751 0000166 00000000000 14776170045 020677 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Exporter/cmake/cmakeexporter.js 0000644 0001751 0000166 00000024176 14776170045 024120 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 Raphaël Cotty
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of the Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var ExporterHelpers = require("../exporter.js");
function tagListToString(tagList)
{
return JSON.stringify(tagList);
}
function collectAutodetectedData(project, topLevelProduct, outputs)
{
var packageName = topLevelProduct.Exporter.cmake.packageName;
var data = {};
data.packageName = packageName;
data.installPrefixDir = "_" + packageName.toUpperCase() + "_INSTALL_PREFIX";
data.packages = [];
function quote(value)
{
return "\"" + value + "\"";
}
function quoteAndPrefixify(propName)
{
function quoteAndPrefixifyHelper(value) {
var prefixToStrip =
ExporterHelpers.getPrefixToStrip(project, topLevelProduct, propName, value);
if (typeof value !== "string"
|| !prefixToStrip
|| (value.length > prefixToStrip.length
&& value[prefixToStrip.length] !== '/')) {
return quote(value);
}
return quote("${" + data.installPrefixDir + "}" + value.slice(prefixToStrip.length));
}
return quoteAndPrefixifyHelper;
}
var installedOutputFilePath = ModUtils.artifactInstalledFilePath(
outputs["Exporter.cmake.configFile"][0]);
var installedOutputPathName = FileInfo.path(installedOutputFilePath);
var installRootPath = FileInfo.joinPaths(topLevelProduct.qbs.installRoot, topLevelProduct.qbs.installPrefix);
data.installPrefix = FileInfo.relativePath(installedOutputPathName, installRootPath);
var libArtifacts;
var libImportArtifacts;
var isProduct = !topLevelProduct.present;
var considerFramework = !isProduct || (topLevelProduct.type
&& topLevelProduct.type.includes("bundle.content"))
&& topLevelProduct.bundle
&& topLevelProduct.bundle.isBundle
&& topLevelProduct.qbs.targetOS.includes("darwin");
var considerDynamicLibs = !isProduct || (topLevelProduct.type
&& topLevelProduct.type.includes("dynamiclibrary"));
var considerStaticLibs = !isProduct || (topLevelProduct.type
&& topLevelProduct.type.includes("staticlibrary"));
if (considerFramework) {
libArtifacts = topLevelProduct.artifacts["bundle.symlink.executable"];
if (considerDynamicLibs)
data.type = "SHARED";
else if (considerStaticLibs)
data.type = "STATIC";
else
data.type = "INTERFACE";
} else if (considerDynamicLibs) {
libArtifacts = topLevelProduct.artifacts.dynamiclibrary;
libImportArtifacts = topLevelProduct.artifacts.dynamiclibrary_import;
data.type = "SHARED";
} else if (considerStaticLibs) {
libArtifacts = topLevelProduct.artifacts.staticlibrary;
data.type = "STATIC";
} else {
data.type = "INTERFACE";
}
for (var i = 0; i < (libArtifacts || []).length; ++i) {
var libArtifact = libArtifacts[i];
var libImportArtifact = (libImportArtifacts || [])[i];
if (libArtifact.qbs.install) {
var installPath = ModUtils.artifactInstalledFilePath(libArtifact);
data.importedLocation = quoteAndPrefixify("installRoot")(installPath);
data.soName = topLevelProduct.targetName;
if (libImportArtifact && libImportArtifact.qbs.install) {
installPath = ModUtils.artifactInstalledFilePath(libImportArtifact);
data.importedImplibLocation = quoteAndPrefixify("installRoot")(installPath);
}
break;
}
}
var cpp = topLevelProduct.exports.cpp;
if (cpp) {
data.libraryPaths = (cpp.libraryPaths || []).map(quoteAndPrefixify("cpp.libraryPaths"));
data.linkLibraries = [];
data.linkLibraries = data.linkLibraries.concat(cpp.dynamicLibraries || []);
data.linkLibraries = data.linkLibraries.concat(cpp.staticLibraries || []);
data.linkLibraries = data.linkLibraries.map(quoteAndPrefixify("cpp.dynamicLibraries"));
data.linkOptions = [];
data.linkOptions = data.linkOptions.concat(cpp.driverLinkerFlags || []);
if ((cpp.linkerFlags || []).length > 0) {
data.linkOptions =
data.linkOptions.concat("LINKER:" + (cpp.linkerFlags || []).join(","));
}
data.linkOptions = data.linkOptions.map(quote);
data.includeDirectories =
(cpp.includePaths || []).map(quoteAndPrefixify("cpp.includePaths"));
data.compileDefinitions = (cpp.defines || []).map(quote);
data.compileOptions = [];
data.compileOptions = data.compileOptions.concat(cpp.commonCompilerFlags || []);
data.compileOptions = data.compileOptions.concat(cpp.driverFlags || []);
data.compileOptions = data.compileOptions.concat(cpp.cxxFlags || []);
data.compileOptions = data.compileOptions.concat(cpp.cFlags || []);
data.compileOptions = data.compileOptions.map(quote);
}
function gatherDeps(dep) {
if (dep.name === "Exporter.cmake")
return;
var depHasExporter = dep.Exporter && dep.Exporter.cmake;
if (!depHasExporter)
return;
data.packages.push(dep.Exporter.cmake.packageName);
}
var exportedDeps = topLevelProduct.exports ? topLevelProduct.exports.dependencies : [];
exportedDeps.forEach(gatherDeps);
return data;
}
function writeConfigFile(project, product, outputs)
{
var autoDetectedData = collectAutodetectedData(project, product, outputs);
var packageName = autoDetectedData.packageName;
function writeCommand(command, lines)
{
if ((lines || []).length === 0)
return;
cmakeConfigFile.writeLine(command + "(" + packageName + " INTERFACE");
for (i = 0; i < lines.length; i++) {
cmakeConfigFile.writeLine(" " + lines[i]);
}
cmakeConfigFile.writeLine(")");
}
var cmakeConfigFile = new TextFile(outputs["Exporter.cmake.configFile"][0].filePath,
TextFile.WriteOnly);
cmakeConfigFile.writeLine("# Generated by Qbs");
cmakeConfigFile.writeLine("cmake_minimum_required(VERSION 3.5)");
cmakeConfigFile.writeLine("if(TARGET " + packageName + ")");
cmakeConfigFile.writeLine(" return()");
cmakeConfigFile.writeLine("endif()");
cmakeConfigFile.writeLine("set(" + autoDetectedData.installPrefixDir +
" \"${CMAKE_CURRENT_LIST_DIR}/" +
autoDetectedData.installPrefix + "\")");
autoDetectedData.packages.forEach(function(packageName) {
cmakeConfigFile.writeLine("find_package(" + packageName + " REQUIRED SILENT)");
});
cmakeConfigFile.writeLine(
"add_library(" + packageName + " " + autoDetectedData.type + " IMPORTED)");
var configuration = (product.qbs.buildVariant) ?
product.qbs.buildVariant.toUpperCase() : "NONE";
cmakeConfigFile.writeLine("set_property(TARGET " + packageName +
" APPEND PROPERTY IMPORTED_CONFIGURATIONS " +
configuration + ")");
cmakeConfigFile.writeLine("set_target_properties(" + packageName + " PROPERTIES");
cmakeConfigFile.writeLine(" IMPORTED_LINK_INTERFACE_LANGUAGES_" + configuration +
" CXX");
if (autoDetectedData.type !== "INTERFACE") {
cmakeConfigFile.writeLine(" IMPORTED_LOCATION_" + configuration + " " +
autoDetectedData.importedLocation);
}
if (autoDetectedData.importedImplibLocation) {
cmakeConfigFile.writeLine(" IMPORTED_IMPLIB_" + configuration + " " +
autoDetectedData.importedImplibLocation);
}
cmakeConfigFile.writeLine(")");
writeCommand("target_link_directories", autoDetectedData.libraryPaths);
writeCommand("target_link_libraries",
autoDetectedData.linkLibraries.concat(autoDetectedData.packages));
writeCommand("target_link_options", autoDetectedData.linkOptions);
writeCommand("target_include_directories", autoDetectedData.includeDirectories);
writeCommand("target_compile_definitions", autoDetectedData.compileDefinitions);
writeCommand("target_compile_options", autoDetectedData.compileOptions);
cmakeConfigFile.close();
}
function writeVersionFile(product, outputs)
{
var cmakeVersionFile = new TextFile(
outputs["Exporter.cmake.versionFile"][0].filePath, TextFile.WriteOnly);
cmakeVersionFile.writeLine("# Generated by Qbs");
cmakeVersionFile.writeLine("set(PACKAGE_VERSION \"" + product.version + "\")");
cmakeVersionFile.close();
}
qbs-src-2.6.1/share/qbs/modules/Exporter/cmake/cmakeexporter.qbs 0000644 0001751 0000166 00000006435 14776170045 024267 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 Raphaël Cotty
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.TextFile
import "cmakeexporter.js" as HelperFunctions
Module {
property string configFileName: packageName + "Config.cmake"
property string versionFileName: packageName + "ConfigVersion.cmake"
property string packageName: product.targetName
additionalProductTypes: ["Exporter.cmake.package"]
Rule {
multiplex: true
requiresInputs: false
auxiliaryInputs: {
if (product.type.includes("staticlibrary"))
return ["staticlibrary"];
if (product.type.includes("dynamiclibrary"))
return ["dynamiclibrary"];
}
Artifact {
filePath: product.Exporter.cmake.configFileName
fileTags: ["Exporter.cmake.package", "Exporter.cmake.configFile"]
}
Artifact {
filePath: product.Exporter.cmake.versionFileName
fileTags: ["Exporter.cmake.package", "Exporter.cmake.versionFile"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "generate cmake package files";
cmd.sourceCode = function() {
HelperFunctions.writeConfigFile(project, product, outputs);
HelperFunctions.writeVersionFile(product, outputs);
}
return [cmd];
}
}
}
qbs-src-2.6.1/share/qbs/modules/Exporter/pkgconfig/ 0000755 0001751 0000166 00000000000 14776170045 021566 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Exporter/pkgconfig/pkgconfig.js 0000644 0001751 0000166 00000023206 14776170045 024076 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
function quote(value)
{
if (value.includes(" ") || value.includes("'") || value.includes('"')) {
return '"' + value.replace(/(["'\\])/g, "\\$1") + '"';
}
return value;
}
function writeEntry(product, file, key, propertyName, required, additionalValues)
{
var value = product.Exporter.pkgconfig[propertyName];
if (additionalValues && additionalValues.length > 0)
value = (value || []).concat(additionalValues);
var valueIsNotEmpty = value && (!(value instanceof Array) || value.length > 0);
if (valueIsNotEmpty) {
if (value instanceof Array)
value = value.join(' ');
file.writeLine(key + ": " + value);
} else if (required) {
throw "Failure creating " + FileInfo.fileName(file.filePath()) + ": The entry '" + key
+ "' is required, but property Exporter.pkgconfig."
+ propertyName + " is not set.";
}
}
function collectAutodetectedData(topLevelProduct)
{
var data = {
libs: [],
cflags: [],
requires: [],
requiresPrivate: []
};
if (!topLevelProduct.Exporter.pkgconfig.autoDetect)
return data;
var excludedDeps = topLevelProduct.Exporter.pkgconfig.excludedDependencies || [];
var explicitRequires = topLevelProduct.Exporter.pkgconfig.requiresEntry || [];
var explicitRequiresPrivate = topLevelProduct.Exporter.pkgconfig.requiresPrivateEntry || [];
var transformFunc = topLevelProduct.Exporter.pkgconfig.transformFunction;
// Make use of the "prefix" convenience variable if applicable.
function quoteAndPrefixify(value)
{
var quotedValue = quote(value);
var installPrefix = topLevelProduct.qbs.installPrefix || "";
if (!topLevelProduct.Exporter.pkgconfig._usePrefix || typeof value !== "string"
|| !value.startsWith(installPrefix)
|| (value.length > installPrefix.length && value[installPrefix.length] !== '/')) {
return quotedValue;
}
return quotedValue.replace(topLevelProduct.qbs.installPrefix, "${prefix}");
}
function transformedValue(product, moduleName, propertyName)
{
var originalValue = product.exports[moduleName][propertyName];
var value = transformFunc
? eval("(" + transformFunc + ")(product, moduleName, propertyName, originalValue)")
: originalValue;
if (value instanceof Array)
value.forEach(function(v, i, a) { a[i] = quoteAndPrefixify(v); });
else if (value)
value = quoteAndPrefixify(value);
return value;
}
function collectLibs(productOrModule)
{
var libs = [];
var libArtifacts;
var isProduct = !productOrModule.present;
var considerDynamicLibs = !isProduct || (productOrModule.type
&& productOrModule.type.includes("dynamiclibrary"));
if (considerDynamicLibs) {
libArtifacts = productOrModule.artifacts.dynamiclibrary;
} else {
var considerStaticLibs = !isProduct || (productOrModule.type
&& productOrModule.type.includes("staticlibrary"));
if (considerStaticLibs)
libArtifacts = productOrModule.artifacts.staticlibrary;
}
for (var i = 0; i < (libArtifacts || []).length; ++i) {
var libArtifact = libArtifacts[i];
if (libArtifact.qbs.install) {
var installDir = FileInfo.path(ModUtils.artifactInstalledFilePath(libArtifact));
installDir = installDir.slice(libArtifact.qbs.installRoot.length);
libs.push("-L" + quoteAndPrefixify(FileInfo.cleanPath(installDir)),
"-l" + quote(productOrModule.targetName));
}
}
if (!productOrModule.exports.cpp)
return libs;
var libPaths = transformedValue(productOrModule, "cpp", "libraryPaths");
if (libPaths)
libs.push.apply(libs, libPaths.map(function(p) { return "-L" + p; }));
function libNamesToLibEntries(libNames) {
return libNames.map(function(libName) { return "-l" + libName; });
};
var dlls = transformedValue(productOrModule, "cpp", "dynamicLibraries");
if (dlls)
libs.push.apply(libs, libNamesToLibEntries(dlls));
var staticLibs = transformedValue(productOrModule, "cpp", "staticLibraries");
if (staticLibs)
libs.push.apply(libs, libNamesToLibEntries(staticLibs));
var lFlags = transformedValue(productOrModule, "cpp", "linkerFlags");
if (lFlags)
libs.push.apply(libs, lFlags);
lFlags = transformedValue(productOrModule, "cpp", "driverFlags");
if (lFlags)
libs.push.apply(libs, lFlags);
lFlags = transformedValue(productOrModule, "cpp", "driverLinkerFlags");
if (lFlags)
libs.push.apply(libs, lFlags);
return libs;
}
function collectCFlags(productOrModule)
{
if (!productOrModule.exports.cpp)
return [];
var flags = [];
var defs = transformedValue(productOrModule, "cpp", "defines");
if (defs)
flags.push.apply(flags, defs.map(function(d) { return "-D" + d; }));
var incPaths = transformedValue(productOrModule, "cpp", "includePaths");
if (incPaths)
flags.push.apply(flags, incPaths.map(function(p) { return "-I" + p; }));
var cflags = transformedValue(productOrModule, "cpp", "commonCompilerFlags");
if (cflags)
flags.push.apply(flags, cflags);
cflags = transformedValue(productOrModule, "cpp", "driverFlags");
if (cflags)
flags.push.apply(flags, cflags);
cflags = transformedValue(productOrModule, "cpp", "cxxFlags")
|| transformedValue(productOrModule, "cpp", "cFlags");
if (cflags)
flags.push.apply(flags, cflags);
return flags;
}
function collectAutodetectedDataRecursive(productOrModule, privateContext)
{
if (!privateContext) {
data.libs.push.apply(data.libs, collectLibs(productOrModule));
data.cflags.push.apply(data.cflags, collectCFlags(productOrModule));
}
var exportedDeps = productOrModule.exports ? productOrModule.exports.dependencies : [];
var exportedDepNames = [];
var privateDeps = [];
for (var i = 0; i < exportedDeps.length; ++i)
exportedDepNames.push(exportedDeps[i].name);
for (i = 0; i < (productOrModule.dependencies || []).length; ++i) {
var dep = productOrModule.dependencies[i];
if (exportedDepNames.includes(dep.name))
continue;
privateDeps.push(dep);
}
function gatherData(dep) {
if (dep.name === "Exporter.pkgconfig")
return;
var depHasPkgConfig = dep.Exporter && dep.Exporter.pkgconfig;
if (depHasPkgConfig) {
var entry = FileInfo.completeBaseName(dep.Exporter.pkgconfig.fileName);
if (excludedDeps.includes(entry))
return;
if (isPrivateDep && !data.requiresPrivate.includes(entry)
&& !explicitRequiresPrivate.includes(entry)) {
data.requiresPrivate.push(entry);
}
if (!isPrivateDep && !data.requires.includes(entry)
&& !explicitRequires.includes(entry)) {
data.requires.push(entry);
}
} else {
if (excludedDeps.includes(dep.name))
return;
if (isPrivateDep && explicitRequiresPrivate.includes(dep.name))
return;
if (!isPrivateDep && explicitRequires.includes(dep.name))
return;
collectAutodetectedDataRecursive(dep, isPrivateDep);
}
}
var isPrivateDep = privateContext;
exportedDeps.forEach(gatherData);
isPrivateDep = true;
privateDeps.forEach(gatherData);
}
collectAutodetectedDataRecursive(topLevelProduct, false);
return data;
}
qbs-src-2.6.1/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs 0000644 0001751 0000166 00000007365 14776170045 024257 0 ustar runner docker import qbs.FileInfo
import qbs.TextFile
import "pkgconfig.js" as HelperFunctions
Module {
property string fileName: product.targetName + ".pc"
property bool autoDetect: true
property var transformFunction // function(product, moduleName, propertyName, valueElement)
property stringList excludedDependencies
property string nameEntry: product.name
property string descriptionEntry: product.name
property string versionEntry: product.version
property string urlEntry
property stringList cflagsEntry: []
property stringList libsEntry: []
property stringList libsPrivateEntry: []
property stringList requiresEntry: []
property stringList requiresPrivateEntry: []
property stringList conflictsEntry: []
property var customVariables
property bool _usePrefix: autoDetect && qbs.installPrefix
additionalProductTypes: ["Exporter.pkgconfig.pc"]
Rule {
multiplex: true
requiresInputs: false
// Make sure all relevant library artifacts have been created by the time we run.
auxiliaryInputs: {
if (!autoDetect)
return undefined;
if (product.type.includes("staticlibrary"))
return ["staticlibrary"];
if (product.type.includes("dynamiclibrary"))
return ["dynamiclibrary"];
}
Artifact {
filePath: product.Exporter.pkgconfig.fileName
fileTags: ["Exporter.pkgconfig.pc"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.sourceCode = function() {
var f = new TextFile(output.filePath, TextFile.WriteOnly);
if (product.Exporter.pkgconfig._usePrefix)
f.writeLine("prefix=" + product.qbs.installPrefix + "\n");
var customVariables = product.Exporter.pkgconfig.customVariables;
if (customVariables) {
for (var customVar in customVariables)
f.writeLine(customVar + "=" + customVariables[customVar]);
f.writeLine("");
}
var autoDetectedData = HelperFunctions.collectAutodetectedData(product);
HelperFunctions.writeEntry(product, f, "Name", "nameEntry", true);
HelperFunctions.writeEntry(product, f, "Description", "descriptionEntry", true);
HelperFunctions.writeEntry(product, f, "Version", "versionEntry", true);
HelperFunctions.writeEntry(product, f, "URL", "urlEntry");
HelperFunctions.writeEntry(product, f, "Cflags", "cflagsEntry", false,
autoDetectedData.cflags);
HelperFunctions.writeEntry(product, f, "Libs", "libsEntry", false,
autoDetectedData.libs);
HelperFunctions.writeEntry(product, f, "Libs.private", "libsPrivateEntry");
HelperFunctions.writeEntry(product, f, "Requires", "requiresEntry", false,
autoDetectedData.requires);
HelperFunctions.writeEntry(product, f, "Requires.private", "requiresPrivateEntry",
false, autoDetectedData.requiresPrivate);
HelperFunctions.writeEntry(product, f, "Conflicts", "conflictsEntry");
};
return [cmd];
}
}
validate: {
if (requiresEntry && excludedDependencies
&& requiresEntry.containsAny(excludedDependencies)) {
throw "The contents of Export.pkgconfig.requiresEntry and "
+ "Export.pkgconfig.excludedDependencies must not overlap.";
}
}
}
qbs-src-2.6.1/share/qbs/modules/qbs/ 0000755 0001751 0000166 00000000000 14776170045 016574 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/qbs/common.qbs 0000644 0001751 0000166 00000024353 14776170045 020602 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.FileInfo
import qbs.ModUtils
import qbs.PathTools
import qbs.Utilities
Module {
readonly property string configurationName: "default"
property string defaultBuildVariant: {
switch (configurationName.toLowerCase()) {
case "release":
return "release";
default:
return "debug";
}
}
property string buildVariant: defaultBuildVariant
property bool enableDebugCode: buildVariant == "debug"
property bool debugInformation: (buildVariant !== "release")
property string optimization: (buildVariant === "debug" ? "none" : "fast")
readonly property string hostPlatform: undefined // set internally
readonly property stringList hostOS: Utilities.canonicalPlatform(hostPlatform)
property string hostOSVersion: {
if (hostOS && hostOS.includes("macos")) {
return Utilities.getNativeSetting("/System/Library/CoreServices/ServerVersion.plist", "ProductVersion") ||
Utilities.getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductVersion");
} else if (hostOS && hostOS.includes("windows")) {
var version = Utilities.getNativeSetting(windowsRegistryKey, "CurrentVersion");
return version + "." + hostOSBuildVersion;
}
}
readonly property string hostArchitecture: undefined // set internally
property string hostOSBuildVersion: {
if (hostOS.includes("macos")) {
return Utilities.getNativeSetting("/System/Library/CoreServices/ServerVersion.plist", "ProductBuildVersion") ||
Utilities.getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductBuildVersion");
} else if (hostOS.includes("windows")) {
return Utilities.getNativeSetting(windowsRegistryKey, "CurrentBuildNumber");
}
}
readonly property var hostOSVersionParts: hostOSVersion ? hostOSVersion.split('.').map(function(item) { return parseInt(item, 10); }) : []
readonly property int hostOSVersionMajor: hostOSVersionParts[0] || 0
readonly property int hostOSVersionMinor: hostOSVersionParts[1] || 0
readonly property int hostOSVersionPatch: hostOSVersionParts[2] || 0
property string targetPlatform: hostPlatform
readonly property stringList targetOS: Utilities.canonicalPlatform(targetPlatform)
property string pathListSeparator: hostOS.includes("windows") ? ";" : ":"
property string pathSeparator: hostOS.includes("windows") ? "\\" : "/"
property string nullDevice: hostOS.includes("windows") ? "NUL" : "/dev/null"
property path shellPath: hostOS.includes("windows") ? windowsShellPath : "/bin/sh"
property string profile: project.profile
property string toolchainType: {
if (targetOS.includes("windows"))
return hostOS.includes("windows") ? "msvc" : "mingw";
if (targetOS.includes("darwin"))
return hostOS.includes("macos") ? "xcode" : "clang";
if (targetOS.includes("freebsd"))
return "clang";
if (targetOS.includes("qnx"))
return "qcc";
if (targetOS.containsAny(["haiku", "vxworks", "unix"]))
return "gcc";
}
readonly property stringList toolchain: Utilities.canonicalToolchain(toolchainType)
property string architecture
property bool install: false
property path installSourceBase
property string installRoot: project.buildDirectory + "/install-root"
property string installDir
property string installPrefix: targetOS.includes("unix") ? "/usr/local" : ""
property path sysroot
PropertyOptions {
name: "buildVariant"
allowedValues: ['debug', 'release', 'profiling']
description: "name of the build variant"
}
PropertyOptions {
name: "optimization"
allowedValues: ['none', 'fast', 'small']
description: "optimization level"
}
validate: {
var validator = new ModUtils.PropertyValidator("qbs");
validator.setRequiredProperty("hostOS", hostOS);
validator.setRequiredProperty("targetOS", targetOS);
validator.addCustomValidator("targetOS", targetOS, function (value) {
if (!value || (value.includes("osx") && !value.includes("macos")))
return false;
return true;
}, "the value 'osx' has been replaced by 'macos'; use that instead and update "
+ "hostOS and targetOS condition checks in your project accordingly");
if (hostOS && (hostOS.includes("windows") || hostOS.includes("macos"))) {
validator.setRequiredProperty("hostOSVersion", hostOSVersion,
"could not detect host operating system version; " +
"verify that system files and registry keys have not " +
"been modified.");
if (hostOSVersion)
validator.addVersionValidator("hostOSVersion", hostOSVersion, 2, 4);
validator.setRequiredProperty("hostOSBuildVersion", hostOSBuildVersion,
"could not detect host operating system build version; " +
"verify that system files or registry have not been " +
"tampered with.");
}
validator.addCustomValidator("architecture", architecture, function (value) {
return !architecture || architecture === Utilities.canonicalArchitecture(architecture);
}, "'" + architecture + "' is invalid." + (architecture
? " You must use the canonical name '" + Utilities.canonicalArchitecture(architecture)
: "") + "'");
validator.addCustomValidator("toolchain", toolchain, function (value) {
if (toolchain === undefined)
return false; // cannot have null toolchain, empty is valid... for now
var canonical = Utilities.canonicalToolchain.apply(Utilities, toolchain);
for (var i = 0; i < Math.max(canonical.length, toolchain.length); ++i) {
if (canonical[i] !== toolchain[i])
return false;
}
return true;
}, "'" + toolchain + "' is invalid. You must use the canonical list '" +
Utilities.canonicalToolchain.apply(Utilities, toolchain) + "'");
validator.addCustomValidator("toolchain", toolchain, function (value) {
// None of the pairs listed here may appear in the same toolchain list.
// Note that this check is applied AFTER canonicalization, so for example
// {"clang", "msvc"} need not be checked, since a toolchain containing clang is
// guaranteed to also contain gcc.
var pairs = [
["gcc", "msvc"],
["llvm", "mingw"]
];
var canonical = Utilities.canonicalToolchain.apply(Utilities, value);
for (var i = 0; i < pairs.length; ++i) {
if (canonical.includes(pairs[i][0]) && canonical.includes(pairs[i][1]))
return false;
}
return true;
}, "'" + toolchain + "' contains one or more mutually exclusive toolchain types.");
validator.validate();
}
// private properties
property string windowsRegistryKey: "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion"
property path windowsSystemRoot: FileInfo.fromWindowsSeparators(Utilities.getNativeSetting(windowsRegistryKey, "SystemRoot"))
property path windowsShellPath: FileInfo.fromWindowsSeparators(Environment.getEnv("COMSPEC")) || FileInfo.joinPaths(windowsSystemRoot, "System32", "cmd.exe")
property string windowsPathVariable: hostOS.includes("windows") ? "PATH" : "WINEPATH"
property var commonRunEnvironment: ({})
setupRunEnvironment: {
var env = product.qbs.commonRunEnvironment;
for (var i in env) {
var v = new ModUtils.EnvironmentVariable(i, product.qbs.pathListSeparator,
product.qbs.hostOS.includes("windows"));
v.value = env[i];
v.set();
}
}
// Properties that can be set for multiplexing products.
property stringList profiles: []
property stringList architectures: []
property stringList buildVariants: []
// internal properties
readonly property string version: [versionMajor, versionMinor, versionPatch].join(".")
readonly property int versionMajor: undefined // set internally
readonly property int versionMinor: undefined // set internally
readonly property int versionPatch: undefined // set internally
readonly property var multiplexMap: ({
profiles: "profile",
architectures: "architecture",
buildVariants: "buildVariant"
})
}
qbs-src-2.6.1/share/qbs/modules/autotest/ 0000755 0001751 0000166 00000000000 14776170045 017657 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/autotest/autotest.qbs 0000644 0001751 0000166 00000000213 14776170045 022232 0 ustar runner docker Module {
property stringList arguments
property bool allowFailure: false
property string workingDir
property int timeout
}
qbs-src-2.6.1/share/qbs/modules/archiver/ 0000755 0001751 0000166 00000000000 14776170045 017612 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/archiver/archiver.qbs 0000644 0001751 0000166 00000023071 14776170045 022127 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.File
import qbs.Host
import qbs.FileInfo
import qbs.Probes
Module {
// jar is a suitable fallback for creating zip files as they are the same format
// This will most likely end up being used on Windows
Depends { name: "java"; required: false }
Probes.BinaryProbe {
id: tarProbe
names: ["tar"]
}
Probes.BinaryProbe {
id: zipProbe
names: ["zip"]
}
Probes.BinaryProbe {
id: sevenZipProbe
names: ["7z"]
platformSearchPaths: {
var paths = base;
if (Host.os().includes("windows")) {
var env32 = Environment.getEnv("PROGRAMFILES(X86)");
var env64 = Environment.getEnv("PROGRAMFILES");
if (env64 === env32 && env64.endsWith(" (x86)"))
env64 = env64.slice(0, -(" (x86)".length)); // QTBUG-3845
paths.push(FileInfo.joinPaths(env64, "7-Zip"));
paths.push(FileInfo.joinPaths(env32, "7-Zip"));
}
return paths;
}
}
property string type
property string archiveBaseName: product.targetName
property string workingDirectory
property stringList flags: []
property path outputDirectory: product.destinationDirectory
property string archiveExtension: {
if (type === "7zip")
return "7z";
if (type == "tar") {
var extension = "tar";
if (compressionType !== "none")
extension += "." + compressionType;
return extension;
}
if (type === "zip")
return "zip";
return undefined;
}
property string command: {
if (type === "7zip")
return sevenZipProbe.filePath;
if (type === "tar") {
if (tarProbe.found)
return tarProbe.filePath;
if (sevenZipProbe.found)
return sevenZipProbe.filePath;
}
if (type === "zip") {
// Prefer zip (probably Info-Zip) and fall back to 7z or jar when it's not available
// (as is the likely case on Windows)
if (zipProbe.found)
return zipProbe.filePath;
if (sevenZipProbe.found)
return sevenZipProbe.filePath;
if (java.present)
return java.jarFilePath;
}
return undefined;
}
property string compressionLevel
property string compressionType: {
if (type === "tar")
return "gz";
return undefined;
}
PropertyOptions {
name: "type"
description: "The type of archive to create."
allowedValues: ["7zip", "tar", "zip"]
}
PropertyOptions {
name: "compressionLevel"
description: "How much effort to put into compression.\n"
+ "Higher numbers mean smaller archive files at the cost of taking more time.\n"
+ "This property is only used for the '7zip' and 'zip' types.\n"
+ "'7zip' only supports 0 and odd numbers."
allowedValues: [undefined, "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
}
PropertyOptions {
name: "compressionType"
description: "The compression format to use.\n"
+ "For tar archives, the respective tool needs to be present.\n"
+ "This property is only used for the 'tar' and 'zip' types."
allowedValues: ["none", "gz", "bz2", "Z", "xz", "deflate", "store"]
}
Rule {
inputs: ["archiver.input-list"]
Artifact {
filePath: FileInfo.joinPaths(product.moduleProperty("archiver", "outputDirectory"),
product.moduleProperty("archiver", "archiveBaseName") + '.'
+ product.moduleProperty("archiver", "archiveExtension"));
fileTags: ["archiver.archive"]
}
prepare: {
var binary = product.moduleProperty("archiver", "command");
var binaryName = FileInfo.baseName(binary);
var args = [];
var commands = [];
var type = product.moduleProperty("archiver", "type");
var compression = product.moduleProperty("archiver", "compressionType");
var compressionLevel = product.moduleProperty("archiver", "compressionLevel");
if (binaryName === "7z") {
var rmCommand = new JavaScriptCommand();
rmCommand.silent = true;
rmCommand.sourceCode = function() {
if (File.exists(output.filePath))
File.remove(output.filePath);
};
commands.push(rmCommand);
args.push("a", "-y", "-mmt=on");
switch (type) {
case "7zip":
args.push("-t7z");
break;
case "zip":
args.push("-tzip");
break;
case "tar":
if (compression === "gz")
args.push("-tgzip");
else if (compression === "bz2")
args.push("-tbzip2");
else
args.push("-ttar");
break;
default:
throw "7zip: unrecognized archive type: '" + type + "'";
}
if (compressionLevel)
args.push("-mx" + compressionLevel);
args = args.concat(product.moduleProperty("archiver", "flags"));
args.push(output.filePath);
args.push("@" + input.filePath);
} else if (binaryName === "tar" && type === "tar") {
args.push("-c");
if (compression === "gz")
args.push("-z");
else if (compression === "bz2")
args.push("-j");
else if (compression === "Z")
args.push("-Z");
else if (compression === "xz")
args.push("-J");
args.push("-f", output.filePath, "-T", input.filePath);
args = args.concat(product.moduleProperty("archiver", "flags"));
} else if (binaryName === "jar" && type === "zip") {
if (compression === "none" || compressionLevel === "0")
args.push("-0");
args.push("-cfM", output.filePath, "@" + input.filePath);
args = args.concat(product.moduleProperty("archiver", "flags"));
} else if (binaryName === "zip" && type === "zip") {
// The "zip" program included with most Linux and Unix distributions
// (including macOS) is Info-ZIP's Zip, so this should be fairly portable.
if (compression === "none") {
args.push("-0");
} else {
compression = compression === "bz2" ? "bzip2" : compression;
if (["store", "deflate", "bzip2"].includes(compression))
args.push("-Z", compression);
if (compressionLevel)
args.push("-" + compressionLevel);
}
args.push("-r", output.filePath, ".", "-i@" + input.filePath);
args = args.concat(product.moduleProperty("archiver", "flags"));
} else if (["tar", "zip", "jar"].includes(binaryName)) {
throw binaryName + ": unrecognized archive type: '" + type + "'";
} else if (binaryName) {
throw "unrecognized archive tool: '" + binaryName + "'";
} else {
throw "no archive tool available to produce archive type: '" + type + "'";
}
var archiverCommand = new Command(binary, args);
archiverCommand.description = "creating archive file " + output.fileName;
archiverCommand.highlight = "linker";
archiverCommand.workingDirectory
= product.moduleProperty("archiver", "workingDirectory");
commands.push(archiverCommand);
return commands;
}
}
}
qbs-src-2.6.1/share/qbs/modules/emsdk/ 0000755 0001751 0000166 00000000000 14776170045 017112 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/emsdk/emsdk.js 0000644 0001751 0000166 00000010153 14776170045 020553 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 Danya Patrushev
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
var Process = require("qbs.Process");
var Host = require("qbs.Host");
var FileInfo = require("qbs.FileInfo");
var File = require("qbs.File");
var Environment = require("qbs.Environment");
function getEnvironment(shellPath, emccDir)
{
var winOs = Host.os().includes("windows")
var emsdkEnvFileName = "emsdk_env." + (winOs ? "bat" : "sh")
var sep = FileInfo.pathSeparator()
//if the compiler comes from emsdk its directory should be */emsdk/upstream/emscripten/
var emsdkEnvFilePath = FileInfo.cleanPath(emccDir + sep + ".." + sep + ".." + sep + emsdkEnvFileName)
if (!File.exists(emsdkEnvFilePath))
{
if (!winOs)
{
console.info("Emcc compiler found but " + emsdkEnvFilePath +
" doesn't exist - assuming compiler is provided by system package")
return {}
}
else
throw emsdkEnvFilePath + " not found";
}
else
{
var env = {}
// If the environment already contains emsdk specific variables, running the script
// will return a concise message about "Setting up EMSDK environment" without all
// the data that we need, so we check the environment first.
var dir = Environment.getEnv("EMSDK")
//use it as an indication that the environment is already set
if (dir)
{
env["EMSDK"] = dir;
var python = Environment.getEnv("EMSDK_PYTHON")
if (python)
env["EMSDK_PYTHON"] = python;
var node = Environment.getEnv("EMSDK_NODE");
if (node)
env["EMSDK_NODE"] = node;
}
else
{
var process = new Process();
process.exec(shellPath, [emsdkEnvFilePath]);
var equalStr = " = ";
var lines = process.readStdErr().split("\n");
for (var i in lines)
{
var line = lines[i];
var index = line.indexOf(equalStr);
if (index === -1)
continue;
var key = line.slice(0, index);
if (key === "PATH")
continue;
env[key] = line.slice(index + equalStr.length);
}
}
return env;
}
}
qbs-src-2.6.1/share/qbs/modules/emsdk/emsdk.qbs 0000644 0001751 0000166 00000001354 14776170045 020727 0 ustar runner docker import qbs.Probes
import "emsdk.js" as Emsdk
Module
{
property string configuredInstallPath
property string detectedInstallPath: emccPathProbe.found ? emccPathProbe.path : undefined
Probes.BinaryProbe
{
id: emccPathProbe
condition: !configuredInstallPath
names: ["emcc"]
}
property var environment: emsdkEnvProbe.environment
Probe
{
id: emsdkEnvProbe
property string emccDir: configuredInstallPath || detectedInstallPath
property string shellPath: product.qbs.shellPath
property var environment
condition: emccDir
configure: {
environment = Emsdk.getEnvironment(shellPath, emccDir);
found = true;
}
}
}
qbs-src-2.6.1/share/qbs/modules/flatbuf/ 0000755 0001751 0000166 00000000000 14776170045 017432 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/flatbuf/flatbuffers.js 0000644 0001751 0000166 00000010401 14776170045 022267 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var File = require("qbs.File");
function validateCompiler(compilerName, compilerPath) {
if (!File.exists(compilerPath)) {
throw "Can't find '" + compilerName + "' binary. Please set the compilerPath property or "
+ "make sure the compiler is found in PATH";
}
}
function getOutputDir(module, input) {
var outputDir = module._outputDir;
if (!module.keepPrefix)
return outputDir;
var importPaths = module.importPaths;
if (importPaths !== undefined && importPaths.length !== 0) {
var canonicalInput = File.canonicalFilePath(FileInfo.path(input.filePath));
for (var i = 0; i < importPaths.length; ++i) {
var path = File.canonicalFilePath(importPaths[i]);
if (canonicalInput.startsWith(path)) {
return outputDir + "/" + FileInfo.relativePath(path, canonicalInput);
}
}
}
return outputDir;
}
function artifactC(module, input, tag, suffix) {
var outputDir = module._outputDir;
return {
fileTags: [tag],
filePath: outputDir + "/" + FileInfo.baseName(input.fileName) + suffix,
cpp: { warningLevel: "none"}
};
}
function doPrepareC(module, input)
{
var args = [];
args.push("-a") // write all
args.push("-o", input.flatbuf.c._outputDir) // output dir
var importPaths = module.importPaths;
importPaths.forEach(function(path) {
args.push("-I", path);
});
args.push(input.filePath);
var cmd = new Command(module.compilerPath, args);
cmd.workingDirectory = FileInfo.path(module._outputDir)
cmd.highlight = "codegen";
cmd.description = "generating C files for " + input.fileName;
return [cmd];
}
function artifact(module, input, tag, suffix) {
var outputDir = getOutputDir(module, input);
return {
fileTags: [tag],
filePath: outputDir + "/" + FileInfo.baseName(input.fileName) + suffix,
cpp: { warningLevel: "none" }
};
}
function doPrepareCpp(module, input, output)
{
var outputDir = FileInfo.path(output.filePath);
var result = [];
var args = [];
args.push("--cpp")
var importPaths = module.importPaths;
importPaths.forEach(function(path) {
args.push("-I", path);
});
args.push("--filename-ext", module.filenameExtension);
args.push("--filename-suffix", module.filenameSuffix);
if (module.includePrefix)
args.push("--include-prefix", module.includePrefix);
if (module.keepPrefix)
args.push("--keep-prefix");
args.push(input.filePath);
var cmd = new Command(input.flatbuf.cpp.compilerPath, args);
cmd.workingDirectory = outputDir;
cmd.highlight = "codegen";
cmd.description = "generating C++ files for " + input.fileName;
result.push(cmd);
return result;
}
qbs-src-2.6.1/share/qbs/modules/flatbuf/flatbuffersbase.qbs 0000644 0001751 0000166 00000004112 14776170045 023275 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs
import qbs.File
import qbs.FileInfo
import qbs.Probes
import "flatbuffers.js" as HelperFunctions
Module {
property string compilerName: "flatc"
property string compilerPath: compilerProbe.filePath
property pathList importPaths: []
property string _outputDir: FileInfo.joinPaths(product.buildDirectory, "flatbuf")
property stringList _searchPaths
FileTagger {
patterns: ["*.fbs"]
fileTags: ["flatbuf.input"];
}
Probes.BinaryProbe {
id: compilerProbe
names: [compilerName]
searchPaths: _searchPaths
}
}
qbs-src-2.6.1/share/qbs/modules/flatbuf/cpp/ 0000755 0001751 0000166 00000000000 14776170045 020214 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/flatbuf/cpp/flatbuffers-cpp.qbs 0000644 0001751 0000166 00000005104 14776170045 024006 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs
import qbs.FileInfo
import "../flatbuffers.js" as Flatbuf
import "../flatbuffersbase.qbs" as FlatbufBase
FlatbufBase {
Depends { name: "cpp" }
Depends { name: "flatbuffers" }
property string filenameExtension: "h"
property string filenameSuffix: "_generated"
property string includePrefix // TODO: test
property bool keepPrefix: false
_outputDir: FileInfo.joinPaths(product.buildDirectory, "flatbuf", "cpp")
_searchPaths: flatbuffers.hostBinDirs
cpp.cxxLanguageVersion: "c++11"
cpp.systemIncludePaths: base.concat([_outputDir])
Rule {
inputs: ["flatbuf.input"]
outputFileTags: ["hpp"]
outputArtifacts: {
var module = input.flatbuf.cpp;
var fullSuffix = module.filenameSuffix + "." + module.filenameExtension;
return [ Flatbuf.artifact(module, input, "hpp", fullSuffix) ];
}
prepare: {
return Flatbuf.doPrepareCpp(input.flatbuf.cpp, input, output);
}
}
validate: {
Flatbuf.validateCompiler(compilerName, compilerPath);
}
}
qbs-src-2.6.1/share/qbs/modules/flatbuf/c/ 0000755 0001751 0000166 00000000000 14776170045 017654 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/flatbuf/c/flatbuffers-c.qbs 0000644 0001751 0000166 00000004343 14776170045 023112 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs
import qbs.FileInfo
import "../flatbuffers.js" as Flatbuf
import "../flatbuffersbase.qbs" as FlatbufBase
FlatbufBase {
Depends { name: "cpp" }
Depends { name: "flatcc" }
compilerName: "flatcc"
_outputDir: FileInfo.joinPaths(product.buildDirectory, "flatbuf", "c")
_searchPaths: flatbuffers.hostBinDirs
cpp.systemIncludePaths: base.concat([_outputDir])
Rule {
inputs: ["flatbuf.input"]
outputFileTags: ["hpp"]
outputArtifacts: [Flatbuf.artifactC(input.flatbuf.c, input, "hpp", "_generated.h")]
prepare: {
return Flatbuf.doPrepareC(input.flatbuf.c, input);
}
}
validate: {
Flatbuf.validateCompiler(compilerName, compilerPath);
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/ 0000755 0001751 0000166 00000000000 14776170045 016571 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/cpp/cosmic.js 0000644 0001751 0000166 00000037202 14776170045 020410 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Cpp = require("cpp.js");
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
var TemporaryDir = require("qbs.TemporaryDir");
var TextFile = require("qbs.TextFile");
function toolchainDetails(qbs) {
var architecture = qbs.architecture;
if (architecture.startsWith("arm")) {
return {
"executableSuffix": ".cxm",
"staticLibrarySuffix": ".cxm",
"assemblerName": "cacorm",
"compilerName": "cxcorm"
};
} else if (architecture === "stm8") {
return {
"executableSuffix": ".sm8",
"staticLibrarySuffix": ".sm8",
"assemblerName": "castm8",
"compilerName": "cxstm8"
};
} else if (architecture === "hcs8") {
return {
"executableSuffix": ".h08",
"staticLibrarySuffix": ".h08",
"assemblerName": "ca6808",
"compilerName": "cx6808"
};
} else if (architecture === "hcs12") {
return {
"executableSuffix": ".h12",
"staticLibrarySuffix": ".h12",
"assemblerName": "ca6812",
"compilerName": "cx6812"
};
} else if (architecture === "m68k") {
return {
"executableSuffix": ".332",
"staticLibrarySuffix": ".332",
"assemblerName": "ca332",
"compilerName": "cx332"
};
}
}
function guessArchitecture(compilerFilePath) {
var baseName = FileInfo.baseName(compilerFilePath);
if (baseName === "cxcorm")
return "arm";
else if (baseName === "cxstm8")
return "stm8";
else if (baseName === "cx6808")
return "hcs8";
else if (baseName === "cx6812")
return "hcs12";
else if (baseName === "cx332")
return "m68k";
}
function dumpMacros(compilerFilePath) {
// Note: The COSMIC compiler does not support the predefined
// macros dumping. So, we do it with the following trick, where we try
// to create and compile a special temporary file and to parse the console
// output with the own magic pattern: (""|"key"|"value"|"").
var outputDirectory = new TemporaryDir();
var outputFilePath = FileInfo.fromNativeSeparators(FileInfo.joinPaths(outputDirectory.path(),
"dump-macros.c"));
var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly);
outputFile.writeLine("#define VALUE_TO_STRING(x) #x");
outputFile.writeLine("#define VALUE(x) VALUE_TO_STRING(x)");
outputFile.writeLine("#define VAR_NAME_VALUE(var) #var VALUE(var)");
// The COSMIC compiler defines only one pre-defined macro
// (at least nothing is said about other macros in the documentation).
var keys = ["__CSMC__"];
for (var i in keys) {
var key = keys[i];
outputFile.writeLine("#if defined (" + key + ")");
outputFile.writeLine("#pragma message (VAR_NAME_VALUE(" + key + "))");
outputFile.writeLine("#endif");
}
outputFile.close();
var process = new Process();
process.exec(compilerFilePath, [outputFilePath], false);
File.remove(outputFilePath);
var map = {};
// COSMIC compiler use the errors output!
process.readStdErr().trim().split(/\r?\n/g).map(function(line) {
var match = line.match(/^#message \("(.+)" "(.+)"\)$/);
if (match)
map[match[1]] = match[2];
});
return map;
}
function dumpVersion(compilerFilePath) {
var p = new Process();
p.exec(compilerFilePath, ["-vers"]);
// COSMIC compiler use the errors output!
var output = p.readStdErr();
var match = output.match(/^COSMIC.+V(\d+)\.?(\d+)\.?(\*|\d+)?/);
if (match) {
var major = match[1] ? parseInt(match[1], 10) : 0;
var minor = match[2] ? parseInt(match[2], 10) : 0;
var patch = match[3] ? parseInt(match[3], 10) : 0;
return { major: major, minor: minor, patch: patch };
}
}
function guessEndianness(architecture) {
// There is no mention of supported endianness in the cosmic compiler.
return "big";
}
function dumpDefaultPaths(compilerFilePath, architecture) {
var rootPath = FileInfo.path(compilerFilePath);
var includePath;
var includePaths = [];
if (architecture.startsWith("arm")) {
includePath = FileInfo.joinPaths(rootPath, "hcorm");
if (File.exists(includePath))
includePaths.push(includePath);
} else if (architecture === "stm8") {
includePath = FileInfo.joinPaths(rootPath, "hstm8");
if (File.exists(includePath))
includePaths.push(includePath);
} else if (architecture === "hcs8") {
includePath = FileInfo.joinPaths(rootPath, "h6808");
if (File.exists(includePath))
includePaths.push(includePath);
} else if (architecture === "hcs12") {
includePath = FileInfo.joinPaths(rootPath, "h6812");
if (File.exists(includePath))
includePaths.push(includePath);
} else if (architecture === "m68k") {
includePath = FileInfo.joinPaths(rootPath, "h332");
if (File.exists(includePath))
includePaths.push(includePath);
}
var libraryPaths = [];
var libraryPath = FileInfo.joinPaths(rootPath, "lib");
if (File.exists(libraryPath))
libraryPaths.push(libraryPath);
return {
"includePaths": includePaths,
"libraryPaths": libraryPaths,
}
}
function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = [];
// Up to 128 include files.
args = args.concat(Cpp.collectPreincludePathsArguments(input));
// Defines.
args = args.concat(Cpp.collectDefinesArguments(input));
// Up to 128 include paths.
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input));
// Debug information flags.
if (input.cpp.debugInformation)
args.push("+debug");
var architecture = input.qbs.architecture;
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
// Warning level flags.
switch (input.cpp.warningLevel) {
case "none":
// Disabled by default.
break;
case "all":
// Highest warning level.
args.push("-pw7");
break;
}
// C language version flags.
if (tag === "c") {
var knownValues = ["c99"];
var cLanguageVersion = Cpp.languageVersion(
input.cpp.cLanguageVersion, knownValues, "C");
switch (cLanguageVersion) {
case "c99":
args.push("-p", "c99");
break;
default:
break;
}
}
// Objects output directory.
args.push("-co", FileInfo.path(outputs.obj[0].filePath));
// Listing files generation flag.
if (input.cpp.generateCompilerListingFiles) {
// Enable listings.
args.push("-l");
// Listings output directory.
args.push("-cl", FileInfo.path(outputs.lst[0].filePath));
}
// Misc flags.
args = args.concat(Cpp.collectMiscCompilerArguments(input, tag),
Cpp.collectMiscDriverArguments(product));
// Input.
args.push(input.filePath);
return args;
}
function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = [];
// Up to 128 include paths.
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input));
// Debug information flags.
if (input.cpp.debugInformation)
args.push("-xx");
// Misc flags.
args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm"));
// Listing files generation flag.
if (input.cpp.generateAssemblerListingFiles) {
args.push("-l");
args.push("+l", outputs.lst[0].filePath);
}
// Objects output file path.
args.push("-o", outputs.obj[0].filePath);
// Input.
args.push(input.filePath);
return args;
}
function linkerFlags(project, product, inputs, outputs) {
var args = [];
// Library paths.
args = args.concat(Cpp.collectLibraryPaths(product).map(function(path) {
// It is workaround to use the relative paths avoids a strange linking
// errors. Maybe it is related to the limitations on the length of the
// command arguments, or on the length of the paths.
return product.cpp.libraryPathFlag + Cpp.relativePath(product.buildDirectory, path);
}));
// Output.
args.push("-o", outputs.application[0].filePath);
// Map file generation flag.
if (product.cpp.generateLinkerMapFile)
args.push("-m", outputs.mem_map[0].filePath);
// Misc flags.
args = args.concat(Cpp.collectMiscEscapableLinkerArguments(product),
Cpp.collectMiscLinkerArguments(product),
Cpp.collectMiscDriverArguments(product));
// Linker scripts.
args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs));
// Input objects.
args = args.concat(Cpp.collectLinkerObjectPaths(inputs));
// Library dependencies (order has matters).
args = args.concat(Cpp.collectLibraryDependencies(product).map(function(dep) {
// It is workaround to use the relative paths avoids a strange linking
// errors. Maybe it is related to the limitations on the length of the
// command arguments, or on the length of the paths.
return Cpp.relativePath(product.buildDirectory, dep.filePath);
}));
return args;
}
function archiverFlags(project, product, inputs, outputs) {
var args = ["-cl"];
// Output.
args.push(outputs.staticlibrary[0].filePath);
// Input objects.
args = args.concat(Cpp.collectLinkerObjectPaths(inputs));
return args;
}
function createPath(fullPath) {
var cmd = new JavaScriptCommand();
cmd.fullPath = fullPath;
cmd.silent = true;
cmd.sourceCode = function() {
File.makePath(fullPath);
};
return cmd;
}
// It is a workaround to rename the generated object file to the desired name.
// Reason is that the Cosmic compiler always generates the object files in the
// format of 'module.o', but we expect it in flexible format, e.g. 'module.c.obj'
// or 'module.c.o' depending on the cpp.objectSuffix property.
function renameObjectFile(project, product, inputs, outputs, input, output) {
var object = outputs.obj[0];
var cmd = new JavaScriptCommand();
cmd.newObject = object.filePath;
cmd.oldObject = FileInfo.joinPaths(FileInfo.path(object.filePath),
object.baseName + ".o");
cmd.silent = true;
cmd.sourceCode = function() { File.move(oldObject, newObject); };
return cmd;
}
// It is a workaround to rename the generated listing file to the desired name.
// Reason is that the Cosmic compiler always generates the listing files in the
// format of 'module.ls', but we expect it in flexible format, e.g. 'module.c.lst'
// or 'module.c.ls' depending on the cpp.compilerListingSuffix property.
function renameListingFile(project, product, inputs, outputs, input, output) {
var listing = outputs.lst[0];
var cmd = new JavaScriptCommand();
cmd.newListing = listing.filePath;
cmd.oldListing = FileInfo.joinPaths(FileInfo.path(listing.filePath),
listing.baseName + ".ls");
cmd.silent = true;
cmd.sourceCode = function() { File.move(oldListing, newListing); };
return cmd;
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
// Create output objects path, because the Cosmic doesn't do it.
var cmd = createPath(FileInfo.path(outputs.obj[0].filePath));
cmds.push(cmd);
// Create output listing path, because the Cosmic doesn't do it.
if (input.cpp.generateCompilerListingFiles) {
cmd = createPath(FileInfo.path(outputs.lst[0].filePath));
cmds.push(cmd);
}
var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn);
cmd = new Command(input.cpp.compilerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "compiler";
cmds.push(cmd);
cmds.push(renameObjectFile(project, product, inputs, outputs, input, output));
if (input.cpp.generateCompilerListingFiles)
cmds.push(renameListingFile(project, product, inputs, outputs, input, output));
return cmds;
}
function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
// Create output objects path, because the Cosmic doesn't do it.
var cmd = createPath(FileInfo.path(outputs.obj[0].filePath));
cmds.push(cmd);
// Create output listing path, because the Cosmic doesn't do it.
if (input.cpp.generateCompilerListingFiles) {
cmd = createPath(FileInfo.path(outputs.lst[0].filePath));
cmds.push(cmd);
}
var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn);
cmd = new Command(input.cpp.assemblerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "assembling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "assembler";
cmds.push(cmd);
return cmds;
}
function prepareLinker(project, product, inputs, outputs, input, output) {
var primaryOutput = outputs.application[0];
var args = linkerFlags(project, product, inputs, outputs);
var cmd = new Command(product.cpp.linkerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "linking " + primaryOutput.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
return [cmd];
}
function prepareArchiver(project, product, inputs, outputs, input, output) {
var args = archiverFlags(project, product, inputs, outputs);
var cmd = new Command(product.cpp.archiverPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "creating " + output.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/cpp/iar.js 0000644 0001751 0000166 00000062774 14776170045 017722 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Cpp = require("cpp.js");
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
var TemporaryDir = require("qbs.TemporaryDir");
var TextFile = require("qbs.TextFile");
function supportXLinker(architecture) {
return architecture === "78k"
|| architecture === "avr"
|| architecture === "avr32"
|| architecture === "cr16"
|| architecture === "hcs12"
|| architecture === "hcs8"
|| architecture === "m16c"
|| architecture === "m32c"
|| architecture === "m68k"
|| architecture === "mcs51"
|| architecture === "msp430"
|| architecture === "r32c"
|| architecture === "v850";
}
function supportILinker(architecture) {
return architecture.startsWith("arm")
|| architecture === "rh850"
|| architecture === "riscv"
|| architecture === "rl78"
|| architecture === "rx"
|| architecture === "sh"
|| architecture === "stm8";
}
function supportXArchiver(architecture) {
return architecture === "78k"
|| architecture === "avr"
|| architecture === "avr32"
|| architecture === "cr16"
|| architecture === "hcs12"
|| architecture === "hcs8"
|| architecture === "m16c"
|| architecture === "m32c"
|| architecture === "m68k"
|| architecture === "mcs51"
|| architecture === "msp430"
|| architecture === "r32c"
|| architecture === "v850";
}
function supportIArchiver(architecture) {
return architecture.startsWith("arm")
|| architecture === "rh850"
|| architecture === "riscv"
|| architecture === "rl78"
|| architecture === "rx"
|| architecture === "sh"
|| architecture === "stm8";
}
function supportXAssembler(architecture) {
return architecture.startsWith("arm")
|| architecture === "78k"
|| architecture === "avr"
|| architecture === "hcs12"
|| architecture === "m16c"
|| architecture === "mcs51"
|| architecture === "msp430"
|| architecture === "m32c"
|| architecture === "v850";
}
function supportIAssembler(architecture) {
return architecture === "avr32"
|| architecture === "cr16"
|| architecture === "hcs8"
|| architecture === "r32c"
|| architecture === "rh850"
|| architecture === "riscv"
|| architecture === "rl78"
|| architecture === "rx"
|| architecture === "sh"
|| architecture === "stm8"
|| architecture === "m68k";
}
function supportEndianness(architecture) {
return architecture.startsWith("arm")
|| architecture === "rx";
}
function supportCppExceptions(architecture) {
return architecture.startsWith("arm")
|| architecture === "rh850"
|| architecture === "riscv"
|| architecture === "rl78"
|| architecture === "rx";
}
function supportCppRtti(architecture) {
return architecture.startsWith("arm")
|| architecture === "rh850"
|| architecture === "riscv"
|| architecture === "rl78"
|| architecture === "rx";
}
function supportCppWarningAboutCStyleCast(architecture) {
return architecture.startsWith("arm")
|| architecture === "avr"
|| architecture === "avr32"
|| architecture === "cr16"
|| architecture === "mcs51"
|| architecture === "msp430"
|| architecture === "rh850"
|| architecture === "rl78"
|| architecture === "rx"
|| architecture === "stm8"
|| architecture === "v850";
}
function supportDeprecatedFeatureWarnings(architecture) {
return architecture.startsWith("arm")
|| architecture === "avr"
|| architecture === "cr16"
|| architecture === "mcs51"
|| architecture === "msp430"
|| architecture === "rh850"
|| architecture === "rl78"
|| architecture === "rx"
|| architecture === "stm8"
|| architecture === "v850";
}
function supportCLanguageVersion(architecture) {
return architecture !== "78k";
}
function supportCppLanguage(compilerFilePath) {
var baseName = FileInfo.baseName(compilerFilePath);
return baseName !== "iccs08";
}
// It is a 'magic' IAR-specific target architecture code.
function architectureCode(architecture) {
switch (architecture) {
case "78k":
return "26";
case "avr":
return "90";
case "avr32":
return "82";
case "mcs51":
return "51";
case "msp430":
return "43";
case "v850":
return "85";
case "m68k":
return "68";
case "m32c":
return "48";
case "r32c":
return "53";
case "m16c":
return "34";
case "cr16":
return "45";
case "hcs12":
return "12";
case "hcs8":
return "78";
case "rh850": case "riscv": case "rl78": case "rx": case "sh": case "stm8":
return "";
default:
if (architecture.startsWith("arm"))
return "";
break;
}
}
function toolchainDetails(qbs) {
var architecture = qbs.architecture;
var code = architectureCode(architecture);
var details = {};
if (supportXLinker(architecture)) {
details.libraryPathFlag = "-I";
details.linkerScriptFlag = "-f";
details.linkerName = "xlink";
details.linkerSilentFlag = "-S";
details.linkerMapFileFlag = "-l";
details.linkerEntryPointFlag = "-s";
} else if (supportILinker(architecture)) {
details.libraryPathFlag = "-L";
details.linkerScriptFlag = "--config";
details.linkerSilentFlag = "--silent";
details.linkerMapFileFlag = "--map";
details.linkerEntryPointFlag = "--entry";
details.linkerName = architecture.startsWith("arm")
? "ilinkarm" : ("ilink" + architecture);
}
if (supportXArchiver(architecture))
details.archiverName = "xar";
else if (supportIArchiver(architecture))
details.archiverName = "iarchive";
var hasCode = (code !== "");
details.staticLibrarySuffix = hasCode ? (".r" + code) : ".a";
details.executableSuffix = hasCode
? ((qbs.debugInformation) ? (".d" + code) : (".a" + code)) : ".out";
details.objectSuffix = hasCode ? (".r" + code) : ".o";
details.imageFormat = hasCode ? "ubrof" : "elf";
if (architecture.startsWith("arm")) {
details.compilerName = "iccarm";
details.assemblerName = "iasmarm";
} else if (architecture === "78k") {
details.compilerName = "icc78k";
details.assemblerName = "a78k";
} else if (architecture === "avr") {
details.compilerName = "iccavr";
details.assemblerName = "aavr";
} else if (architecture === "avr32") {
details.compilerName = "iccavr32";
details.assemblerName = "aavr32";
} else if (architecture === "cr16") {
details.compilerName = "icccr16c";
details.assemblerName = "acr16c";
} else if (architecture === "hcs12") {
details.compilerName = "icchcs12";
details.assemblerName = "ahcs12";
} else if (architecture === "hcs8") {
details.compilerName = "iccs08";
details.assemblerName = "as08";
} else if (architecture === "m16c") {
details.compilerName = "iccm16c";
details.assemblerName = "am16c";
} else if (architecture === "m32c") {
details.compilerName = "iccm32c";
details.assemblerName = "am32c";
} else if (architecture === "m68k") {
details.compilerName = "icccf";
details.assemblerName = "acf";
} else if (architecture === "mcs51") {
details.compilerName = "icc8051";
details.assemblerName = "a8051";
} else if (architecture === "msp430") {
details.compilerName = "icc430";
details.assemblerName = "a430";
} else if (architecture === "r32c") {
details.compilerName = "iccr32c";
details.assemblerName = "ar32c";
} else if (architecture === "rh850") {
details.compilerName = "iccrh850";
details.assemblerName = "iasmrh850";
} else if (architecture === "riscv") {
details.compilerName = "iccriscv";
details.assemblerName = "iasmriscv";
} else if (architecture === "rl78") {
details.compilerName = "iccrl78";
details.assemblerName = "iasmrl78";
} else if (architecture === "rx") {
details.compilerName = "iccrx";
details.assemblerName = "iasmrx";
} else if (architecture === "sh") {
details.compilerName = "iccsh";
details.assemblerName = "iasmsh";
} else if (architecture === "stm8") {
details.compilerName = "iccstm8";
details.assemblerName = "iasmstm8";
} else if (architecture === "v850") {
details.compilerName = "iccv850";
details.assemblerName = "av850";
}
return details;
}
function guessArmArchitecture(core) {
var arch = "arm";
if (core === "__ARM4M__")
arch += "v4m";
else if (core === "__ARM4TM__")
arch += "v4tm";
else if (core === "__ARM5E__")
arch += "v5e";
else if (core === "__ARM5__")
arch += "v5";
else if (core === "__ARM6M__")
arch += "v6m";
else if (core === "__ARM6SM__")
arch += "v6sm";
else if (core === "__ARM6__")
arch += "v6";
else if (core === "__ARM7M__")
arch += "v7m";
else if (core === "__ARM7R__")
arch += "v7r";
return arch;
}
function guessArchitecture(macros) {
if (macros["__ICC430__"] === "1")
return "msp430";
else if (macros["__ICC78K__"] === "1")
return "78k";
else if (macros["__ICC8051__"] === "1")
return "mcs51";
else if (macros["__ICCARM__"] === "1")
return guessArmArchitecture(macros["__CORE__"]);
else if (macros["__ICCAVR32__"] === "1")
return "avr32";
else if (macros["__ICCAVR__"] === "1")
return "avr";
else if (macros["__ICCCF__"] === "1")
return "m68k";
else if (macros["__ICCCR16C__"] === "1")
return "cr16";
else if (macros["__ICCHCS12__"] === "1")
return "hcs12";
else if (macros["__ICCM16C__"] === "1")
return "m16c";
else if (macros["__ICCM32C__"] === "1")
return "m32c";
else if (macros["__ICCR32C__"] === "1")
return "r32c";
else if (macros["__ICCRH850__"] === "1")
return "rh850";
else if (macros["__ICCRISCV__"] === "1")
return "riscv";
else if (macros["__ICCRL78__"] === "1")
return "rl78";
else if (macros["__ICCRX__"] === "1")
return "rx";
else if (macros["__ICCS08__"] === "1")
return "hcs8";
else if (macros["__ICCSH__"] === "1")
return "sh";
else if (macros["__ICCSTM8__"] === "1")
return "stm8";
else if (macros["__ICCV850__"] === "1")
return "v850";
}
function guessEndianness(macros) {
if (macros["__LITTLE_ENDIAN__"] === "1")
return "little";
return "big"
}
function guessVersion(macros, architecture) {
var version = parseInt(macros["__VER__"], 10);
if (architecture.startsWith("arm")) {
return { major: parseInt(version / 1000000),
minor: parseInt(version / 1000) % 1000,
patch: parseInt(version) % 1000 }
} else if (architecture === "78k"
|| architecture === "avr"
|| architecture === "avr32"
|| architecture === "cr16"
|| architecture === "hcs12"
|| architecture === "hcs8"
|| architecture === "m16c"
|| architecture === "m32c"
|| architecture === "m68k"
|| architecture === "mcs51"
|| architecture === "msp430"
|| architecture === "r32c"
|| architecture === "rh850"
|| architecture === "riscv"
|| architecture === "rl78"
|| architecture === "rx"
|| architecture === "sh"
|| architecture === "stm8"
|| architecture === "v850") {
return { major: parseInt(version / 100),
minor: parseInt(version % 100),
patch: 0 }
}
}
function cppLanguageOption(compilerFilePath) {
var baseName = FileInfo.baseName(compilerFilePath);
switch (baseName) {
case "iccarm":
case "iccrh850":
case "iccriscv":
case "iccrl78":
case "iccrx":
return "--c++";
case "icc430":
case "icc78k":
case "icc8051":
case "iccavr":
case "iccavr32":
case "icccf":
case "icccr16c":
case "icchcs12":
case "iccm16c":
case "iccm32c":
case "iccr32c":
case "iccsh":
case "iccstm8":
case "iccv850":
return "--ec++";
}
}
function dumpMacros(compilerFilePath, tag) {
var tempDir = new TemporaryDir();
var inFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/empty-source.c");
var inFile = new TextFile(inFilePath, TextFile.WriteOnly);
var outFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/iar-macros.predef");
var args = [ inFilePath, "--predef_macros", outFilePath ];
if (tag === "cpp" && supportCppLanguage(compilerFilePath))
args.push(cppLanguageOption(compilerFilePath));
var p = new Process();
p.setWorkingDirectory(tempDir.path());
p.exec(compilerFilePath, args, true);
var outFile = new TextFile(outFilePath, TextFile.ReadOnly);
return Cpp.extractMacros(outFile.readAll());
}
function dumpCompilerIncludePaths(compilerFilePath, tag) {
// We can dump the compiler include paths using the undocumented `--IDE3` flag,
// e.g. which also is used in the IAR extension for the VSCode. In this case the
// compiler procuces the console output in the following format:
// `$$TOOL_BEGIN $$VERSION "3" $$INC_BEGIN $$FILEPATH "" $$TOOL_END`
var tempDir = new TemporaryDir();
var inFilePath = FileInfo.fromNativeSeparators(tempDir.path() + "/empty-source.c");
var inFile = new TextFile(inFilePath, TextFile.WriteOnly);
var args = ["--IDE3", inFilePath];
if (tag === "cpp" && supportCppLanguage(compilerFilePath))
args.push(cppLanguageOption(compilerFilePath));
var includePaths = [];
var p = new Process();
p.setWorkingDirectory(tempDir.path());
// It is possible that the process can return an error code in case the
// compiler does not support the `--IDE3` flag. So, don't throw an error in this case.
p.exec(compilerFilePath, args, false);
p.readStdOut().trim().split(/\r?\n/g).map(function(line) {
var m = line.match(/\$\$INC_BEGIN\s\$\$FILEPATH\s\"([^"]*)/);
if (m) {
var includePath = m[1].replace(/\\\\/g, '/');
if (includePath && File.exists(includePath))
includePaths.push(includePath);
}
});
if (includePaths.length === 0) {
// This can happen if the compiler does not support the `--IDE3` flag,
// e.g. IAR for S08 architecture. In this case we use fallback to the
// detection of the `inc` directory.
var includePath = FileInfo.joinPaths(FileInfo.path(compilerFilePath), "../inc/");
if (File.exists(includePath))
includePaths.push(includePath);
}
return includePaths;
}
function dumpDefaultPaths(compilerFilePath, tag) {
var includePaths = dumpCompilerIncludePaths(compilerFilePath, tag);
return {
"includePaths": includePaths
};
}
function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = [];
// Input.
args.push(input.filePath);
// Output.
args.push("-o", outputs.obj[0].filePath);
// Preinclude headers.
args = args.concat(Cpp.collectPreincludePathsArguments(input, true));
// Defines.
args = args.concat(Cpp.collectDefinesArguments(input));
// Includes.
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input));
// Silent output generation flag.
args.push("--silent");
// Debug information flags.
if (input.cpp.debugInformation)
args.push("--debug");
// Optimization flags.
switch (input.cpp.optimization) {
case "small":
args.push("-Ohz");
break;
case "fast":
args.push("-Ohs");
break;
case "none":
args.push("-On");
break;
}
var architecture = input.qbs.architecture;
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
// Warning level flags.
switch (input.cpp.warningLevel) {
case "none":
args.push("--no_warnings");
break;
case "all":
if (supportDeprecatedFeatureWarnings(architecture)) {
args.push("--deprecated_feature_warnings="
+"+attribute_syntax,"
+"+preprocessor_extensions,"
+"+segment_pragmas");
}
if (tag === "cpp" && supportCppWarningAboutCStyleCast(architecture))
args.push("--warn_about_c_style_casts");
break;
}
if (input.cpp.treatWarningsAsErrors)
args.push("--warnings_are_errors");
// C language version flags.
if (tag === "c" && supportCLanguageVersion(architecture)) {
var knownValues = ["c89"];
var cLanguageVersion = Cpp.languageVersion(
input.cpp.cLanguageVersion, knownValues, "C");
switch (cLanguageVersion) {
case "c89":
args.push("--c89");
break;
default:
// Default C language version is C18/C11/C99 that
// depends on the IAR version.
break;
}
}
// C++ language version flags.
var compilerFilePath = input.cpp.compilerPath;
if (tag === "cpp" && supportCppLanguage(compilerFilePath)) {
// C++ language flag.
var cppOption = cppLanguageOption(compilerFilePath);
args.push(cppOption);
// Exceptions flag.
var enableExceptions = input.cpp.enableExceptions;
if (!enableExceptions && supportCppExceptions(architecture))
args.push("--no_exceptions");
// RTTI flag.
var enableRtti = input.cpp.enableRtti;
if (!enableRtti && supportCppRtti(architecture))
args.push("--no_rtti");
}
// Byte order flags.
var endianness = input.cpp.endianness;
if (endianness && supportEndianness(architecture))
args.push("--endian=" + endianness);
// Listing files generation flag.
if (input.cpp.generateCompilerListingFiles)
args.push("-l", outputs.lst[0].filePath);
// Misc flags.
args = args.concat(Cpp.collectMiscCompilerArguments(input, tag),
Cpp.collectMiscDriverArguments(product));
return args;
}
function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = [];
// Input.
args.push(input.filePath);
// Output.
args.push("-o", outputs.obj[0].filePath);
var architecture = input.qbs.architecture;
// The `--preinclude` flag is only supported for a certain
// set of assemblers, not for all.
if (supportIAssembler(architecture))
args = args.concat(Cpp.collectPreincludePathsArguments(input));
// Includes.
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input));
// Debug information flags.
if (input.cpp.debugInformation)
args.push("-r");
// Architecture specific flags.
if (supportIAssembler(architecture)) {
// Silent output generation flag.
args.push("--silent");
// Warning level flags.
if (input.cpp.warningLevel === "none")
args.push("--no_warnings");
if (input.cpp.treatWarningsAsErrors)
args.push("--warnings_are_errors");
} else if (supportXAssembler(architecture)){
// Silent output generation flag.
args.push("-S");
// Warning level flags.
args.push("-w" + (input.cpp.warningLevel === "none" ? "-" : "+"));
}
// Byte order flags.
var endianness = input.cpp.endianness;
if (endianness && supportEndianness(architecture))
args.push("--endian", endianness);
// Listing files generation flag.
if (input.cpp.generateAssemblerListingFiles)
args.push("-l", outputs.lst[0].filePath);
// Misc flags.
args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm"));
return args;
}
function linkerFlags(project, product, inputs, outputs) {
var args = [];
// Inputs.
args = args.concat(Cpp.collectLinkerObjectPaths(inputs));
// Output.
args.push("-o", outputs.application[0].filePath);
// Library paths.
args = args.concat(Cpp.collectLibraryPathsArguments(product));
// Library dependencies.
args = args.concat(Cpp.collectLibraryDependenciesArguments(product));
// Linker scripts.
args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs, true));
// Silent output generation flag.
args.push(product.cpp.linkerSilentFlag);
// Map file generation flag.
if (product.cpp.generateLinkerMapFile)
args.push(product.cpp.linkerMapFileFlag, outputs.mem_map[0].filePath);
// Entry point flag.
if (product.cpp.entryPoint)
args.push(product.cpp.linkerEntryPointFlag, product.cpp.entryPoint);
// Debug information flag.
if (supportXLinker(product.qbs.architecture)) {
if (product.cpp.debugInformation)
args.push("-rt");
}
// Misc flags.
args = args.concat(Cpp.collectMiscEscapableLinkerArguments(product),
Cpp.collectMiscLinkerArguments(product),
Cpp.collectMiscDriverArguments(product));
return args;
}
function archiverFlags(project, product, inputs, outputs) {
var args = [];
// Inputs.
args = args.concat(Cpp.collectLinkerObjectPaths(inputs));
// Output.
var architecture = product.qbs.architecture;
if (supportIArchiver(architecture))
args.push("--create");
args.push("-o", outputs.staticlibrary[0].filePath);
return args;
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn);
var compilerPath = input.cpp.compilerPath;
var cmd = new Command(compilerPath, args);
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "compiler";
return [cmd];
}
function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn);
var assemblerPath = input.cpp.assemblerPath;
var cmd = new Command(assemblerPath, args);
cmd.description = "assembling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "assembler";
return [cmd];
}
function prepareLinker(project, product, inputs, outputs, input, output) {
var primaryOutput = outputs.application[0];
var args = linkerFlags(project, product, inputs, outputs);
var linkerPath = product.cpp.linkerPath;
var cmd = new Command(linkerPath, args);
cmd.description = "linking " + primaryOutput.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
return [cmd];
}
function prepareArchiver(project, product, inputs, outputs, input, output) {
var args = archiverFlags(project, product, inputs, outputs);
var archiverPath = product.cpp.archiverPath;
var cmd = new Command(archiverPath, args);
cmd.description = "creating " + output.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
cmd.stdoutFilterFunction = function(output) {
return "";
};
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/cpp/freebsd.js 0000644 0001751 0000166 00000000407 14776170045 020542 0 ustar runner docker var Utilities = require("qbs.Utilities");
function stripKernelReleaseSuffix(r) {
var idx = r.indexOf("-RELEASE");
return idx >= 0 ? r.substr(0, idx) : r;
}
function hostKernelRelease() {
return stripKernelReleaseSuffix(Utilities.kernelVersion());
}
qbs-src-2.6.1/share/qbs/modules/cpp/sdcc.js 0000644 0001751 0000166 00000050161 14776170045 020046 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var BinaryFile = require("qbs.BinaryFile");
var Cpp = require("cpp.js");
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Host = require("qbs.Host");
var ModUtils = require("qbs.ModUtils");
var PathTools = require("qbs.PathTools");
var Process = require("qbs.Process");
var TemporaryDir = require("qbs.TemporaryDir");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
var WindowsUtils = require("qbs.WindowsUtils");
function toolchainDetails(qbs) {
var architecture = qbs.architecture;
if (architecture === "mcs51") {
return {
"assemblerName": "sdas8051",
"linkerName": "sdld"
}
} else if (architecture === "stm8") {
return {
"assemblerName": "sdasstm8",
"linkerName": "sdldstm8"
}
} else if (architecture === "hcs8") {
return {
"assemblerName": "sdas6808",
"linkerName": "sdld6808"
}
}
}
function targetArchitectureFlag(architecture) {
if (architecture === "mcs51")
return "-mmcs51";
if (architecture === "stm8")
return "-mstm8";
if (architecture === "hcs8")
return "-mhc08";
}
function guessArchitecture(macros) {
if (macros["__SDCC_mcs51"] === "1")
return "mcs51";
if (macros["__SDCC_stm8"] === "1")
return "stm8";
if (macros["__SDCC_hc08"] === "1")
return "hcs8";
}
function guessEndianness(macros) {
// SDCC stores numbers in little-endian format.
return "little";
}
function guessVersion(macros) {
if ("__SDCC_VERSION_MAJOR" in macros
&& "__SDCC_VERSION_MINOR" in macros
&& "__SDCC_VERSION_PATCH" in macros) {
return { major: parseInt(macros["__SDCC_VERSION_MAJOR"], 10),
minor: parseInt(macros["__SDCC_VERSION_MINOR"], 10),
patch: parseInt(macros["__SDCC_VERSION_PATCH"], 10) }
} else if ("__SDCC" in macros) {
var versions = macros["__SDCC"].split("_");
if (versions.length === 3) {
return { major: parseInt(versions[0], 10),
minor: parseInt(versions[1], 10),
patch: parseInt(versions[2], 10) };
}
}
}
function dumpMacros(compilerFilePath, architecture) {
var tempDir = new TemporaryDir();
var fakeIn = new TextFile(tempDir.path() + "/empty-source.c", TextFile.WriteOnly);
var args = [ fakeIn.filePath(), "-dM", "-E" ];
var targetFlag = targetArchitectureFlag(architecture);
if (targetFlag)
args.push(targetFlag);
var p = new Process();
p.exec(compilerFilePath, args, true);
return Cpp.extractMacros(p.readStdOut());
}
function dumpDefaultPaths(compilerFilePath, architecture) {
var args = [ "--print-search-dirs" ];
var targetFlag = targetArchitectureFlag(architecture);
if (targetFlag)
args.push(targetFlag);
var p = new Process();
p.exec(compilerFilePath, args, true);
var includePaths = [];
var addIncludePaths = false;
var lines = p.readStdOut().trim().split(/\r?\n/g);
for (var i in lines) {
var line = lines[i];
if (line.startsWith("includedir:")) {
addIncludePaths = true;
} else if (line.startsWith("programs:")
|| line.startsWith("datadir:")
|| line.startsWith("libdir:")
|| line.startsWith("libpath:")) {
addIncludePaths = false;
} else if (addIncludePaths) {
if (File.exists(line))
includePaths.push(line);
}
}
return {
"includePaths": includePaths
}
}
function effectiveLinkerPath(product) {
if (product.cpp.linkerMode === "automatic")
return product.cpp.compilerPath;
return product.cpp.linkerPath;
}
function useCompilerDriverLinker(product) {
var linker = effectiveLinkerPath(product);
return linker === product.cpp.compilerPath;
}
function escapeLinkerFlags(product, linkerFlags) {
if (!linkerFlags || linkerFlags.length === 0 || !useCompilerDriverLinker(product))
return linkerFlags;
return ["-Wl " + linkerFlags.join(",")];
}
function escapePreprocessorFlags(preprocessorFlags) {
if (!preprocessorFlags || preprocessorFlags.length === 0)
return preprocessorFlags;
return ["-Wp " + preprocessorFlags.join(",")];
}
// We need to use the asm_adb, asm_src, asm_sym and rst_data
// artifacts without of any conditions. Because SDCC always generates
// it (and seems, this behavior can not be disabled for SDCC).
function extraCompilerOutputTags() {
return ["asm_adb", "asm_src", "asm_sym", "rst_data"];
}
// We need to use the lk_cmd, and mem_summary artifacts without
// of any conditions. Because SDCC always generates
// it (and seems, this behavior can not be disabled for SDCC).
function extraApplicationLinkerOutputTags() {
return ["lk_cmd", "mem_summary"];
}
// We need to use the asm_adb, asm_src, asm_sym and rst_data
// artifacts without of any conditions. Because SDCC always generates
// it (and seems, this behavior can not be disabled for SDCC).
function extraCompilerOutputArtifacts(input) {
return [{
fileTags: ["asm_adb"],
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + ".adb"
}, {
fileTags: ["asm_src"],
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + ".asm"
}, {
fileTags: ["asm_sym"],
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + ".sym"
}, {
fileTags: ["rst_data"],
filePath: Utilities.getHash(input.baseDir) + "/"
+ input.fileName + ".rst"
}];
}
// We need to use the lk_cmd, and mem_summary artifacts without
// of any conditions. Because SDCC always generates
// it (and seems, this behavior can not be disabled for SDCC).
function extraApplicationLinkerOutputArtifacts(product) {
return [{
fileTags: ["lk_cmd"],
filePath: FileInfo.joinPaths(
product.destinationDirectory,
product.targetName + ".lk")
}, {
fileTags: ["mem_summary"],
filePath: FileInfo.joinPaths(
product.destinationDirectory,
product.targetName + ".mem")
}];
}
function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = [];
var escapablePreprocessorFlags = [];
// Input.
args.push(input.filePath);
// Output.
args.push("-c");
args.push("-o", outputs.obj[0].filePath);
// Prefix headers.
escapablePreprocessorFlags = escapablePreprocessorFlags.concat(
Cpp.collectPreincludePathsArguments(input));
// Defines.
args = args.concat(Cpp.collectDefinesArguments(input));
// Includes.
args = args.concat(Cpp.collectIncludePathsArguments(input));
escapablePreprocessorFlags = escapablePreprocessorFlags.concat(
Cpp.collectSystemIncludePathsArguments(input));
// Target MCU flag.
var targetFlag = targetArchitectureFlag(input.cpp.architecture);
if (targetFlag)
args.push(targetFlag);
// Debug information flags.
if (input.cpp.debugInformation)
args.push("--debug");
// Optimization level flags.
switch (input.cpp.optimization) {
case "small":
args.push("--opt-code-size");
break;
case "fast":
args.push("--opt-code-speed");
break;
case "none":
// SDCC has not option to disable the optimization.
break;
}
// Warning level flags.
var warnings = input.cpp.warningLevel
if (warnings === "none") {
args.push("--less-pedantic");
escapablePreprocessorFlags.push("-w");
} else if (warnings === "all") {
escapablePreprocessorFlags.push("-Wall");
}
if (input.cpp.treatWarningsAsErrors)
args.push("--Werror");
// Determine which C-language we"re compiling.
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
// C language version flags.
if (tag === "c") {
var knownValues = ["c2x", "c17", "c11", "c99", "c89"];
var cLanguageVersion = Cpp.languageVersion(
input.cpp.cLanguageVersion, knownValues, "C");
switch (cLanguageVersion) {
case "c17":
cLanguageVersion = "c11";
// fall through
case "c89":
case "c99":
case "c11":
case "c2x":
args.push("--std-" + cLanguageVersion);
break;
}
}
var escapedPreprocessorFlags = escapePreprocessorFlags(escapablePreprocessorFlags);
if (escapedPreprocessorFlags)
Array.prototype.push.apply(args, escapedPreprocessorFlags);
// Misc flags.
args = args.concat(Cpp.collectMiscCompilerArguments(input, tag),
Cpp.collectMiscDriverArguments(input));
return args;
}
function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = [];
// Includes.
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input, input.cpp.includeFlag));
// Misc flags.
args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm"));
args.push("-ol");
args.push(outputs.obj[0].filePath);
args.push(input.filePath);
return args;
}
function linkerFlags(project, product, inputs, outputs) {
var args = [];
// Target MCU flag.
var targetFlag = targetArchitectureFlag(product.cpp.architecture);
if (targetFlag)
args.push(targetFlag);
var escapableLinkerFlags = [];
// Map file generation flag.
if (product.cpp.generateLinkerMapFile)
escapableLinkerFlags.push("-m");
escapableLinkerFlags = escapableLinkerFlags.concat(Cpp.collectMiscEscapableLinkerArguments(product));
var useCompilerDriver = useCompilerDriverLinker(product);
// Output.
if (useCompilerDriver)
args.push("-o");
args.push(outputs.application[0].filePath);
// Inputs.
args = args.concat(Cpp.collectLinkerObjectPaths(inputs));
// Library paths.
var libraryPathFlag = useCompilerDriver ? "-L" : "-k";
args = args.concat(Cpp.collectLibraryPathsArguments(product, libraryPathFlag));
// Linker scripts.
// Note: We need to split the '-f' flag and the file path to separate
// lines when we don't use the compiler driver mode.
escapableLinkerFlags = escapableLinkerFlags.concat(
Cpp.collectLinkerScriptPathsArguments(product, inputs, !useCompilerDriver));
// Library dependencies.
args = args.concat(Cpp.collectLibraryDependenciesArguments(product));
var escapedLinkerFlags = escapeLinkerFlags(product, escapableLinkerFlags);
if (escapedLinkerFlags)
Array.prototype.push.apply(args, escapedLinkerFlags);
// Misc flags.
if (useCompilerDriver) {
args = args.concat(Cpp.collectMiscLinkerArguments(product),
Cpp.collectMiscDriverArguments(product));
}
return args;
}
function archiverFlags(project, product, inputs, outputs) {
var args = ["-rc"];
args.push(outputs.staticlibrary[0].filePath);
args = args.concat(Cpp.collectLinkerObjectPaths(inputs));
return args;
}
function buildLinkerMapFilePath(target, suffix) {
return FileInfo.joinPaths(FileInfo.path(target.filePath),
FileInfo.completeBaseName(target.fileName) + suffix);
}
// This is the workaround for the SDCC bug on a Windows host:
// * https://sourceforge.net/p/sdcc/bugs/2970/
// We need to replace the '\r\n\' line endings with the'\n' line
// endings for each generated object file.
function patchObjectFile(project, product, inputs, outputs, input, output) {
var isWindows = Host.os().includes("windows");
if (isWindows && input.cpp.debugInformation) {
var cmd = new JavaScriptCommand();
cmd.objectPath = outputs.obj[0].filePath;
cmd.silent = true;
cmd.sourceCode = function() {
var file = new BinaryFile(objectPath, BinaryFile.ReadWrite);
var data = file.read(file.size());
file.resize(0);
for (var pos = 0; pos < data.length; ++pos) {
// Find the next index of CR (\r) symbol.
var index = data.indexOf(0x0d, pos);
if (index < 0)
index = data.length;
// Write next data chunk between the previous position and the CR
// symbol, exclude the CR symbol.
file.write(data.slice(pos, index));
pos = index;
}
};
return cmd;
}
}
// It is a workaround which removes the generated linker map file
// if it is disabled by cpp.generateLinkerMapFile property.
// Reason is that the SDCC compiler always generates this file,
// and does not have an option to disable generation for a linker
// map file. So, we can to remove a listing files only after the
// linking completes.
function removeLinkerMapFile(project, product, inputs, outputs, input, output) {
if (!product.cpp.generateLinkerMapFile) {
var target = outputs.application[0];
var cmd = new JavaScriptCommand();
cmd.mapFilePath = buildLinkerMapFilePath(target, product.cpp.linkerMapSuffix)
cmd.silent = true;
cmd.sourceCode = function() { File.remove(mapFilePath); };
return cmd;
}
}
// It is a workaround to rename the extension of the output linker
// map file to the specified one, since the linker generates only
// files with the '.map' extension.
function renameLinkerMapFile(project, product, inputs, outputs, input, output) {
if (product.cpp.generateLinkerMapFile && (product.cpp.linkerMapSuffix !== ".map")) {
var target = outputs.application[0];
var cmd = new JavaScriptCommand();
cmd.newMapFilePath = buildLinkerMapFilePath(target, product.cpp.linkerMapSuffix);
cmd.oldMapFilePath = buildLinkerMapFilePath(target, ".map");
cmd.silent = true;
cmd.sourceCode = function() { File.move(oldMapFilePath, newMapFilePath); };
return cmd;
}
}
// It is a workaround which removes the generated listing files
// if it is disabled by cpp.generateCompilerListingFiles property
// or when the cpp.compilerListingSuffix differs with '.lst'.
// Reason is that the SDCC compiler does not have an option to
// disable generation for a listing files. Besides, the SDCC
// compiler use this files and for the linking. So, we can to
// remove a listing files only after the linking completes.
function removeCompilerListingFiles(project, product, inputs, outputs, input, output) {
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode = function() {
inputs.obj.forEach(function(object) {
if (!object.filePath.endsWith(".c" + object.cpp.objectSuffix))
return; // Skip the assembler generated objects.
if (!object.cpp.generateCompilerListingFiles
|| (object.cpp.compilerListingSuffix !== ".lst")) {
var listingPath = FileInfo.joinPaths(FileInfo.path(object.filePath),
object.completeBaseName + ".lst");
File.remove(listingPath);
}
})
};
return cmd;
}
// It is a workaround that duplicates the generated listing files
// but with desired names. The problem is that the SDCC compiler does
// not support an options to specify names for the generated listing
// files. At the same time, the compiler always generates the listing
// files in the form of 'module.c.lst', which makes it impossible to
// change the file suffix to a user-specified one. In addition, these
// files are also somehow used for linking. Thus, we can not rename them
// on the compiling stage.
function duplicateCompilerListingFile(project, product, inputs, outputs, input, output) {
if (input.cpp.generateCompilerListingFiles
&& (input.cpp.compilerListingSuffix !== ".lst")) {
var cmd = new JavaScriptCommand();
cmd.newListing = outputs.lst[0].filePath;
cmd.oldListing = FileInfo.joinPaths(FileInfo.path(outputs.lst[0].filePath),
outputs.lst[0].completeBaseName + ".lst");
cmd.silent = true;
cmd.sourceCode = function() { File.copy(oldListing, newListing); };
return cmd;
}
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn);
var compilerPath = input.cpp.compilerPath;
var cmd = new Command(compilerPath, args);
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "compiler";
cmds.push(cmd);
cmd = patchObjectFile(project, product, inputs, outputs, input, output);
if (cmd)
cmds.push(cmd);
cmd = duplicateCompilerListingFile(project, product, inputs, outputs, input, output);
if (cmd)
cmds.push(cmd);
return cmds;
}
function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn);
var assemblerPath = input.cpp.assemblerPath;
var cmd = new Command(assemblerPath, args);
cmd.description = "assembling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "assembler";
cmds.push(cmd);
cmd = patchObjectFile(project, product, inputs, outputs, input, output);
if (cmd)
cmds.push(cmd);
return cmds;
}
function prepareLinker(project, product, inputs, outputs, input, output) {
var cmds = [];
var args = linkerFlags(project, product, inputs, outputs);
var linkerPath = effectiveLinkerPath(product);
var cmd = new Command(linkerPath, args);
cmd.description = "linking " + outputs.application[0].fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
cmds.push(cmd);
cmd = removeCompilerListingFiles(project, product, inputs, outputs, input, output);
if (cmd)
cmds.push(cmd);
cmd = renameLinkerMapFile(project, product, inputs, outputs, input, output);
if (cmd)
cmds.push(cmd);
cmd = removeLinkerMapFile(project, product, inputs, outputs, input, output);
if (cmd)
cmds.push(cmd);
return cmds;
}
function prepareArchiver(project, product, inputs, outputs, input, output) {
var args = archiverFlags(project, product, inputs, outputs);
var archiverPath = product.cpp.archiverPath;
var cmd = new Command(archiverPath, args);
cmd.description = "creating " + output.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/cpp/windows-msvc.qbs 0000644 0001751 0000166 00000005707 14776170045 021751 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Host
import qbs.Probes
import "windows-msvc-base.qbs" as MsvcBaseModule
MsvcBaseModule {
condition: Host.os().includes('windows') &&
qbs.targetOS.includes('windows') &&
qbs.toolchain && qbs.toolchain.includes('msvc')
priority: 50
Probes.ClBinaryProbe {
id: compilerPathProbe
preferredArchitecture: qbs.architecture
condition: !toolchainInstallPath && !_skipAllChecks
names: ["cl"]
}
Probes.MsvcProbe {
id: msvcProbe
condition: !_skipAllChecks
compilerFilePath: compilerPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
preferredArchitecture: qbs.architecture
winSdkVersion: windowsSdkVersion
}
Properties {
condition: msvcProbe.found
qbs.architecture: msvcProbe.architecture
}
compilerVersionMajor: msvcProbe.versionMajor
compilerVersionMinor: msvcProbe.versionMinor
compilerVersionPatch: msvcProbe.versionPatch
compilerIncludePaths: msvcProbe.includePaths
compilerDefinesByLanguage: msvcProbe.compilerDefinesByLanguage
toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path
: undefined
buildEnv: msvcProbe.buildEnv
enableCxxLanguageMacro: true
compiledModuleSuffix: ".ifc"
moduleOutputFlag: "-ifcOutput "
moduleFileFlag: "-reference %module%="
}
qbs-src-2.6.1/share/qbs/modules/cpp/windows-clang-cl.qbs 0000644 0001751 0000166 00000007413 14776170045 022455 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Ivan Komissarov (abbapoh@gmail.com)
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Host
import qbs.ModUtils
import qbs.Probes
import qbs.FileInfo
import 'windows-msvc-base.qbs' as MsvcBaseModule
MsvcBaseModule {
condition: Host.os().includes('windows') &&
qbs.targetOS.includes('windows') &&
qbs.toolchain && qbs.toolchain.includes('clang-cl')
priority: 100
Probes.ClangClBinaryProbe {
id: clangPathProbe
condition: !toolchainInstallPath && !_skipAllChecks
names: ["clang-cl"]
}
Probes.ClangClProbe {
id: clangClProbe
condition: !_skipAllChecks
compilerFilePath: compilerPath
vcvarsallFilePath: vcvarsallPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
preferredArchitecture: qbs.architecture
winSdkVersion: windowsSdkVersion
}
Properties {
condition: clangClProbe.found
qbs.architecture: clangClProbe.architecture
}
compilerVersionMajor: clangClProbe.versionMajor
compilerVersionMinor: clangClProbe.versionMinor
compilerVersionPatch: clangClProbe.versionPatch
compilerIncludePaths: clangClProbe.includePaths
compilerDefinesByLanguage: clangClProbe.compilerDefinesByLanguage
toolchainInstallPath: clangPathProbe.found ? clangPathProbe.path
: undefined
buildEnv: clangClProbe.buildEnv
property string linkerVariant
PropertyOptions {
name: "linkerVariant"
allowedValues: ["lld", "link"]
description: "Allows to specify the linker variant. Maps to clang-cl's -fuse-ld option."
}
Properties {
condition: linkerVariant
driverLinkerFlags: "-fuse-ld=" + linkerVariant
}
property string vcvarsallPath : clangPathProbe.found ? clangPathProbe.vcvarsallPath : undefined
compilerName: "clang-cl.exe"
linkerName: "lld-link.exe"
linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName)
systemIncludeFlag: "/imsvc"
validateFunc: {
var baseFunc = base;
return function() {
if (_skipAllChecks)
return;
var validator = new ModUtils.PropertyValidator("cpp");
validator.setRequiredProperty("vcvarsallPath", vcvarsallPath);
validator.validate();
baseFunc();
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/watcom.js 0000644 0001751 0000166 00000054707 14776170045 020436 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2022 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Cpp = require("cpp.js");
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var PathTools = require("qbs.PathTools");
var Process = require("qbs.Process");
var TemporaryDir = require("qbs.TemporaryDir");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function toolchainDetails(qbs) {
var platform = qbs.targetPlatform;
var details = {};
if (platform === "dos") {
details.imageFormat = "mz";
details.executableSuffix = ".exe";
} else if (platform === "os2") {
details.imageFormat = "pe";
details.executableSuffix = ".exe";
details.dynamicLibrarySuffix = ".dll";
} else if (platform === "windows") {
details.imageFormat = "pe";
details.executableSuffix = ".exe";
details.dynamicLibrarySuffix = ".dll";
} else if (platform === "linux") {
details.imageFormat = "elf";
details.executableSuffix = "";
details.dynamicLibrarySuffix = ".so";
}
return details;
}
function languageFlag(tag) {
if (tag === "c")
return "-xc";
else if (tag === "cpp")
return "-xc++";
}
function targetFlag(platform, architecture, type) {
if (platform === "dos") {
if (architecture === "x86_16")
return "-bdos";
else if (architecture === "x86")
return "-bdos4g";
} else if (platform === "os2") {
if (architecture === "x86_16")
return "-bos2";
else if (architecture === "x86")
return "-bos2v2";
} else if (platform === "windows") {
if (architecture === "x86_16") {
if (type.includes("dynamiclibrary"))
return "-bwindows_dll";
return "-bwindows";
} else if (architecture === "x86") {
if (type.includes("dynamiclibrary"))
return "-bnt_dll";
return "-bnt";
}
} else if (platform === "linux") {
return "-blinux";
}
}
function guessVersion(macros) {
var version = parseInt(macros["__WATCOMC__"], 10)
|| parseInt(macros["__WATCOM_CPLUSPLUS__"], 10);
if (version) {
return { major: parseInt((version - 1100) / 100),
minor: parseInt(version / 10) % 10,
patch: ((version % 10) > 0) ? parseInt(version % 10) : 0 }
}
}
function guessEnvironment(hostOs, platform, architecture,
toolchainInstallPath, pathListSeparator) {
var toolchainRootPath = FileInfo.path(toolchainInstallPath);
if (!File.exists(toolchainRootPath)) {
throw "Unable to deduce environment due to compiler root directory: '"
+ toolchainRootPath + "' does not exist";
}
var env = {};
function setVariable(key, properties, path, separator) {
var values = [];
for (var i = 0; i < properties.length; ++i) {
if (path) {
var fullpath = FileInfo.joinPaths(path, properties[i]);
values.push(FileInfo.toNativeSeparators(fullpath));
} else {
values.push(properties[i]);
}
}
env[key] = values.join(separator);
}
setVariable("WATCOM", [toolchainRootPath], undefined, pathListSeparator);
setVariable("EDPATH", ["eddat"], toolchainRootPath, pathListSeparator);
if (hostOs.includes("linux"))
setVariable("PATH", ["binl64", "binl"], toolchainRootPath, pathListSeparator);
else if (hostOs.includes("windows"))
setVariable("PATH", ["binnt64", "binnt"], toolchainRootPath, pathListSeparator);
if (platform === "linux") {
setVariable("INCLUDE", ["lh"], toolchainRootPath, pathListSeparator);
} else {
// Common for DOS, Windows, OS/2.
setVariable("WIPFC", ["wipfc"], toolchainRootPath, pathListSeparator);
setVariable("WHTMLHELP", ["binnt/help"], toolchainRootPath, pathListSeparator);
var includes = ["h"];
if (platform === "dos") {
// Same includes as before.
} else if (platform === "os2") {
if (architecture === "x86")
includes = includes.concat(["h/os2"]);
else if (architecture === "x86_16")
includes = includes.concat(["h/os21x"]);
} else if (platform === "windows") {
if (architecture === "x86")
includes = includes.concat(["h/nt", "h/nt/directx", "h/nt/ddk"]);
else if (architecture === "x86_16")
includes = includes.concat(["h/win"]);
} else {
throw "Unable to deduce environment for unsupported target platform: '"
+ platform + "'";
}
setVariable("INCLUDE", includes, toolchainRootPath, pathListSeparator);
}
return env;
}
function dumpMacros(environment, compilerPath, platform, architecture, tag) {
// Note: The Open Watcom compiler does not support the predefined
// macros dumping. So, we do it with the following trick, where we try
// to create and compile a special temporary file and to parse the console
// output with the own magic pattern: #define .
var outputDirectory = new TemporaryDir();
var outputFilePath = FileInfo.joinPaths(outputDirectory.path(), "dump-macros.c");
var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly);
outputFile.writeLine("#define VALUE_TO_STRING(x) #x");
outputFile.writeLine("#define VALUE(x) VALUE_TO_STRING(x)");
outputFile.writeLine("#define VAR_NAME_VALUE(var) \"#define \"#var\" \"VALUE(var)");
// Declare all available pre-defined macros of Watcon compiler.
var keys = [
// Prepare the DOS target macros.
"__DOS__", "_DOS", "MSDOS",
// Prepare the OS/2 target macros.
"__OS2__",
// Prepare the QNX target macros.
"__QNX__",
// Prepare the Netware target macros.
"__NETWARE__", "__NETWARE_386__",
// Prepare the Windows target macros.
"__NT__", "__WINDOWS__", "_WINDOWS", "__WINDOWS_386__",
// Prepare the Linux and Unix target macros.
"__LINUX__", "__UNIX__",
// Prepare the 16-bit target specific macros.
"__I86__", "M_I86", "_M_I86", "_M_IX86",
// Prepare the 32-bit target specific macros.
"__386__", "M_I386", "_M_I386", "_M_IX86",
// Prepare the indicated options macros.
"_MT", "_DLL", "__FPI__", "__CHAR_SIGNED__", "__INLINE_FUNCTIONS__",
"_CPPRTTI", "_CPPUNWIND", "NO_EXT_KEYS",
// Prepare the common memory model macros.
"__FLAT__", "__SMALL__", "__MEDIUM__",
"__COMPACT__", "__LARGE__", "__HUGE__",
// Prepare the 16-bit memory model macros.
"M_I86SM", "_M_I86SM", "M_I86MM", "_M_I86MM", "M_I86CM",
"_M_I86CM", "M_I86LM", "_M_I86LM", "M_I86HM", "_M_I86HM",
// Prepare the 32-bit memory model macros.
"M_386FM", "_M_386FM", "M_386SM", "M_386MM", "_M_386MM",
"M_386CM", "_M_386CM", "M_386LM", "_M_386LM",
// Prepare the compiler macros.
"__X86__", "__cplusplus", "__WATCOMC__", "__WATCOM_CPLUSPLUS__",
"_INTEGRAL_MAX_BITS", "_PUSHPOP_SUPPORTED", "_STDCALL_SUPPORTED",
// Prepare the other macros.
"__3R__", "_based", "_cdecl", "cdecl", "_export", "_far16", "_far", "far",
"_fastcall", "_fortran", "fortran", "_huge", "huge", "_inline", "_interrupt",
"interrupt", "_loadds", "_near", "near", "_pascal", "pascal", "_saveregs",
"_segment", "_segname", "_self", "SOMDLINK", "_STDCALL_SUPPORTED", "__SW_0",
"__SW_3R", "__SW_5", "__SW_FP287", "__SW_FP2", "__SW_FP387", "__SW_FP3",
"__SW_FPI", "__SW_MF", "__SW_MS", "__SW_ZDP", "__SW_ZFP", "__SW_ZGF",
"__SW_ZGP", "_stdcall", "_syscall", "__BIG_ENDIAN"
];
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
outputFile.writeLine("#if defined(" + key + ")");
outputFile.writeLine("#pragma message (VAR_NAME_VALUE(" + key + "))");
outputFile.writeLine("#endif");
}
outputFile.close();
var process = new Process();
process.setWorkingDirectory(outputDirectory.path());
for (var envkey in environment)
process.setEnv(envkey, environment[envkey]);
var target = targetFlag(platform, architecture, ["application"]);
var lang = languageFlag(tag);
var args = [ target, lang, outputFilePath ];
process.exec(compilerPath, args, false);
var m = Cpp.extractMacros(process.readStdOut(), /"?(#define(\s\w+){1,2})"?$/);
if (tag === "cpp" && m["__cplusplus"] === "1")
return m;
else if (tag === "c")
return m;
}
function effectiveLinkerPath(product) {
if (product.cpp.linkerMode === "automatic") {
var compilerPath = product.cpp.compilerPath;
if (compilerPath)
return compilerPath;
console.log("Found no C-language objects, choosing system linker for " + product.name);
}
return product.cpp.linkerPath;
}
function useCompilerDriverLinker(product) {
var linker = effectiveLinkerPath(product);
var compiler = product.cpp.compilerPath;
return linker === compiler;
}
function escapeLinkerFlags(useCompilerDriver, linkerFlags) {
if (!linkerFlags || linkerFlags.length === 0)
return [];
if (useCompilerDriver) {
var sep = ",";
return [["-Wl"].concat(linkerFlags).join(sep)];
}
return linkerFlags;
}
function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = [FileInfo.toNativeSeparators(input.filePath)];
args.push("-fo=" + FileInfo.toNativeSeparators(outputs.obj[0].filePath));
args = args.concat(Cpp.collectPreincludePaths(input).map(function(path) {
return "-fi" + FileInfo.toNativeSeparators(path);
}));
args = args.concat(Cpp.collectDefinesArguments(input, "-d"));
var includePaths = [].concat(Cpp.collectIncludePaths(input)).concat(
Cpp.collectSystemIncludePaths(input));
args = args.concat(includePaths.map(function(path) {
return "-i" + FileInfo.toNativeSeparators(path);
}));
if (input.cpp.debugInformation)
args.push("-d1");
var warnings = input.cpp.warningLevel
if (warnings === "none")
args.push("-w0");
else if (warnings === "all")
args.push("-wx");
if (input.cpp.treatWarningsAsErrors)
args.push("-we");
args.push("-zq"); // Silent.
args = args.concat(Cpp.collectMiscAssemblerArguments(input));
return args;
}
function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = ["-g" + (input.cpp.debugInformation ? "3" : "0")];
var target = targetFlag(product.qbs.targetPlatform, product.qbs.architecture,
product.type);
args.push(target);
if (product.type.includes("application")) {
if (product.qbs.targetPlatform === "windows") {
var consoleApplication = product.consoleApplication;
args.push(consoleApplication ? "-mconsole" : "-mwindows");
}
} else if (product.type.includes("dynamiclibrary")) {
args.push("-shared");
}
var optimization = input.cpp.optimization
if (optimization === "fast")
args.push("-Ot");
else if (optimization === "small")
args.push("-Os");
else if (optimization === "none")
args.push("-O0");
var warnings = input.cpp.warningLevel
if (warnings === "none") {
args.push("-w");
} else if (warnings === "all") {
args.push("-Wall");
args.push("-Wextra");
}
if (input.cpp.treatWarningsAsErrors)
args.push("-Werror");
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
var langFlag = languageFlag(tag);
if (langFlag)
args.push(langFlag);
if (tag === "cpp") {
var enableExceptions = input.cpp.enableExceptions;
if (enableExceptions) {
var ehModel = input.cpp.exceptionHandlingModel;
switch (ehModel) {
case "direct":
args.push("-feh-direct");
break;
case "table":
args.push("-feh-table");
break;
default:
args.push("-feh");
break;
}
} else {
args.push("-fno-eh");
}
var enableRtti = input.cpp.enableRtti;
args.push(enableRtti ? "-frtti" : "-fno-rtti");
} else if (tag === "c") {
var knownValues = ["c99", "c89"];
var cLanguageVersion = Cpp.languageVersion(input.cpp.cLanguageVersion, knownValues, "C");
switch (cLanguageVersion) {
case "c89":
args.push("-std=c89");
break;
case "c99":
args.push("-std=c99");
break;
}
}
var preincludePaths = Cpp.collectPreincludePaths(input);
for (var i = 0; i < preincludePaths.length; ++i)
args.push(input.cpp.preincludeFlag, preincludePaths[i]);
args = args.concat(Cpp.collectDefinesArguments(input));
args = args.concat(Cpp.collectIncludePaths(input).map(function(path) {
return input.cpp.includeFlag + FileInfo.toNativeSeparators(path);
}));
args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) {
return input.cpp.systemIncludeFlag + FileInfo.toNativeSeparators(path);
}));
args = args.concat(Cpp.collectMiscCompilerArguments(input, tag),
Cpp.collectMiscDriverArguments(input));
args.push("-o", FileInfo.toNativeSeparators(outputs.obj[0].filePath));
args.push("-c", FileInfo.toNativeSeparators(input.filePath));
return args;
}
function resourceCompilerFlags(project, product, input, outputs) {
var args = [input.filePath];
args.push("-fo=" + FileInfo.toNativeSeparators(outputs.res[0].filePath));
args = args.concat(Cpp.collectDefinesArguments(input, "-d"));
args = args.concat(Cpp.collectIncludePaths(input).map(function(path) {
return input.cpp.includeFlag + FileInfo.toNativeSeparators(path);
}));
args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) {
return input.cpp.includeFlag + FileInfo.toNativeSeparators(path);
}));
args.push("-q", "-ad", "-r");
return args;
}
function linkerFlags(project, product, inputs, outputs) {
var args = [];
var useCompilerDriver = useCompilerDriverLinker(product);
if (useCompilerDriver) {
var target = targetFlag(product.qbs.targetPlatform, product.qbs.architecture,
product.type);
args.push(target);
if (product.type.includes("application")) {
args.push("-o", FileInfo.toNativeSeparators(outputs.application[0].filePath));
if (product.cpp.generateLinkerMapFile)
args.push("-fm=" + FileInfo.toNativeSeparators(outputs.mem_map[0].filePath));
} else if (product.type.includes("dynamiclibrary")) {
if (product.qbs.targetPlatform === "windows") {
args.push("-Wl, option implib=" + FileInfo.toNativeSeparators(
outputs.dynamiclibrary_import[0].filePath));
}
args.push("-o", FileInfo.toNativeSeparators(outputs.dynamiclibrary[0].filePath))
}
var escapableLinkerFlags = [];
var targetLinkerFlags = product.cpp.targetLinkerFlags;
if (targetLinkerFlags)
escapableLinkerFlags = escapableLinkerFlags.concat(targetLinkerFlags);
escapableLinkerFlags = escapableLinkerFlags.concat(
Cpp.collectMiscEscapableLinkerArguments(product));
var escapedLinkerFlags = escapeLinkerFlags(useCompilerDriver, escapableLinkerFlags);
if (escapedLinkerFlags)
args = args.concat(escapedLinkerFlags);
args = args.concat(Cpp.collectLibraryPaths(product).map(function(path) {
return product.cpp.libraryPathFlag + FileInfo.toNativeSeparators(path);
}));
args = args.concat(Cpp.collectLinkerObjectPaths(inputs).map(function(path) {
return FileInfo.toNativeSeparators(path);
}));
var libraryDependencies = Cpp.collectLibraryDependencies(product);
for (var i = 0; i < libraryDependencies.length; ++i) {
var lib = libraryDependencies[i].filePath;
if (FileInfo.isAbsolutePath(lib) || lib.startsWith('@'))
args.push(FileInfo.toNativeSeparators(lib));
else
args.push("-Wl, libfile " + lib);
}
var resourcePaths = Cpp.collectResourceObjectPaths(inputs).map(function(path) {
return FileInfo.toNativeSeparators(path);
});
if (resourcePaths.length > 0)
args = args.concat("-Wl, resource " + resourcePaths.join(","));
}
args = args.concat(Cpp.collectMiscLinkerArguments(product),
Cpp.collectMiscDriverArguments(product));
return args;
}
function libraryManagerFlags(project, product, inputs, outputs) {
var args = ["-b", "-n", "-q"];
args = args.concat(Cpp.collectLinkerObjectPaths(inputs).map(function(path) {
return "+" + FileInfo.toNativeSeparators(path);
}));
args.push("-o", FileInfo.toNativeSeparators(outputs.staticlibrary[0].filePath));
return args;
}
function disassemblerFlags(project, product, inputs, outputs) {
var objectPath = Cpp.relativePath(product.buildDirectory, outputs.obj[0].filePath);
var listingPath = Cpp.relativePath(product.buildDirectory, outputs.lst[0].filePath);
var args = [];
args.push(FileInfo.toNativeSeparators(objectPath));
args.push("-l=" + FileInfo.toNativeSeparators(listingPath));
args.push("-s", "-a");
return args;
}
function generateCompilerListing(project, product, inputs, outputs, input, output) {
var args = disassemblerFlags(project, product, input, outputs);
var cmd = new Command(input.cpp.disassemblerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.silent = true;
cmd.jobPool = "watcom_job_pool";
return cmd;
}
function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
var args = assemblerFlags(project, product, input, outputs);
var cmd = new Command(input.cpp.assemblerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "assembling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "watcom_job_pool";
cmds.push(cmd);
if (input.cpp.generateAssemblerListingFiles)
cmds.push(generateCompilerListing(project, product, inputs, outputs, input, output));
return cmds;
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn);
var cmd = new Command(input.cpp.compilerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "watcom_job_pool";
cmds.push(cmd);
if (input.cpp.generateCompilerListingFiles)
cmds.push(generateCompilerListing(project, product, inputs, outputs, input, output));
return cmds;
}
function prepareResourceCompiler(project, product, inputs, outputs, input, output,
explicitlyDependsOn) {
var args = resourceCompilerFlags(project, product, input, outputs);
var cmd = new Command(input.cpp.resourceCompilerPath, args);
// Set working directory to source directory as a workaround
// to make the resources compilable by resource compiler (it is magic).
cmd.workingDirectory = product.sourceDirectory;
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "watcom_job_pool";
return [cmd];
}
function prepareLinker(project, product, inputs, outputs, input, output) {
var primaryOutput = outputs.dynamiclibrary ? outputs.dynamiclibrary[0]
: outputs.application[0];
var args = linkerFlags(project, product, inputs, outputs);
var linkerPath = effectiveLinkerPath(product);
var cmd = new Command(linkerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "linking " + primaryOutput.fileName;
cmd.highlight = "linker";
cmd.jobPool = "watcom_job_pool";
return [cmd];
}
function prepareLibraryManager(project, product, inputs, outputs, input, output) {
var args = libraryManagerFlags(project, product, inputs, outputs);
var cmd = new Command(product.cpp.libraryManagerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "linking " + outputs.staticlibrary[0].fileName;
cmd.highlight = "linker";
cmd.jobPool = "watcom_job_pool";
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/cpp/cpp.js 0000644 0001751 0000166 00000061631 14776170045 017720 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var BinaryFile = require("qbs.BinaryFile");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var PathTools = require("qbs.PathTools");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function languageVersion(versionArray, knownValues, lang) {
if (!versionArray)
return undefined;
var versions = [].uniqueConcat(versionArray);
if (versions.length === 1)
return versions[0];
for (var i = 0; i < knownValues.length; ++i) {
var candidate = knownValues[i];
if (versions.includes(candidate))
return candidate;
}
var version = versions[0];
console.debug("Randomly choosing '" + version
+ "' from list of unknown " + lang + " version strings (" + versions + ")");
return version;
}
function extractMacros(output, regexp) {
var m = {};
output.trim().split(/\r?\n/g).map(function(line) {
if (regexp) {
var match = regexp.exec(line);
if (!match)
return;
line = match[1];
}
var prefix = "#define ";
if (!line.startsWith(prefix))
return;
var index = line.indexOf(" ", prefix.length);
if (index !== -1)
m[line.substr(prefix.length, index - prefix.length)] = line.substr(index + 1);
});
return m;
}
function relativePath(baseDirectory, filePath) {
if (FileInfo.isAbsolutePath(filePath))
return FileInfo.relativePath(baseDirectory, filePath);
return filePath;
}
function assemblerOutputTags(needsListingFiles) {
var tags = ["obj"];
if (needsListingFiles)
tags.push("lst");
return tags;
}
function compilerOutputTags(withListingFiles, withCxxModules) {
var tags = ["obj", "intermediate_obj"];
if (withListingFiles)
tags.push("lst");
if (withCxxModules)
tags = tags.concat(["compiled-module", "modulemap", "moduleinfo"]);
return tags;
}
function applicationLinkerOutputTags(needsLinkerMapFile) {
var tags = ["application"];
if (needsLinkerMapFile)
tags.push("mem_map");
return tags;
}
function dynamicLibraryLinkerOutputTags() {
return ["dynamiclibrary", "dynamiclibrary_import"];
}
function staticLibraryLinkerOutputTags() {
return ["staticlibrary"];
}
function resourceCompilerOutputTags() {
return ["res"];
}
function precompiledHeaderOutputTags(lang, generateObjects) {
var tags = [lang + "_pch"];
if (generateObjects)
tags.push("obj");
return tags;
};
function assemblerOutputArtifacts(input) {
var artifacts = [];
artifacts.push({
fileTags: ["obj"],
filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir),
input.fileName + input.cpp.objectSuffix)
});
if (input.cpp.generateAssemblerListingFiles) {
artifacts.push({
fileTags: ["lst"],
filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir),
input.fileName + input.cpp.assemblerListingSuffix)
});
}
return artifacts;
}
function cxxModulesArtifacts(input) {
var artifacts = [];
if (input.cpp.forceUseCxxModules === false)
return artifacts;
if (input.cpp.compiledModuleSuffix === undefined
|| input.cpp.moduleOutputFlag === undefined
|| input.cpp.moduleFileFlag === undefined) {
console.warn("Skip additional artifacts for '" + input.fileName + "' since '"
+ input.qbs.toolchainType + "' toolchain does not support C++ Modules.");
return artifacts;
}
var moduleInformation = CppModulesScanner.apply(input);
if (moduleInformation.providesModule || moduleInformation.requiresModules.length > 0) {
artifacts.push({
filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir),
input.fileName + input.cpp.moduleMapSuffix),
fileTags: ["modulemap"],
// we can't use maps here only strings and lists
cpp: {
_providesModule: moduleInformation.providesModule,
_isInterfaceModule: moduleInformation.isInterfaceModule,
_requiresModules : moduleInformation.requiresModules,
},
})
}
if (input.fileTags.includes("cppm")) {
const moduleName = moduleInformation.providesModule
? moduleInformation.providesModule : undefined;
if (moduleName) {
const moduleFileName = moduleName.replace(':', '-');
artifacts.push({
filePath: FileInfo.joinPaths("cxx-modules", moduleFileName + product.cpp.compiledModuleSuffix),
fileTags: ["compiled-module"],
})
artifacts.push({
filePath: FileInfo.joinPaths("cxx-modules", moduleFileName + product.cpp.moduleInfoSuffix),
fileTags: ["moduleinfo"],
})
} else {
console.warn("File '" + input.fileName + "' has 'cppm' tag, but does not "
+ "provide a module interface unit or partition");
}
}
return artifacts;
}
function compilerOutputArtifacts(input, inputs, withCxxModules) {
var objTags = input.fileTags.includes("cpp_intermediate_object")
? ["intermediate_obj"]
: ["obj"];
if (inputs) {
if (inputs.c || inputs.objc)
objTags.push("c_obj");
if (inputs.cpp || inputs.objcpp || inputs.cppm)
objTags.push("cpp_obj");
}
var artifacts = [{
fileTags: objTags,
filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir),
input.fileName + input.cpp.objectSuffix)
}];
if (input.cpp.generateCompilerListingFiles) {
artifacts.push({
fileTags: ["lst"],
filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir),
input.fileName + input.cpp.compilerListingSuffix)
});
}
if (withCxxModules)
artifacts = artifacts.concat(cxxModulesArtifacts(input));
return artifacts;
}
function applicationLinkerOutputArtifacts(product) {
var artifacts = [{
fileTags: ["application"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.applicationFilePath(product))
}];
if (product.cpp.generateLinkerMapFile) {
artifacts.push({
fileTags: ["mem_map"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName + product.cpp.linkerMapSuffix)
});
}
return artifacts;
}
function dynamicLibraryLinkerOutputArtifacts(product) {
return [{
fileTags: ["dynamiclibrary"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.dynamicLibraryFilePath(product))
}, {
fileTags: ["dynamiclibrary_import"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.importLibraryFilePath(product)),
alwaysUpdated: false
}];
}
function staticLibraryLinkerOutputArtifacts(product) {
return [{
fileTags: ["staticlibrary"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.staticLibraryFilePath(product))
}];
}
function resourceCompilerOutputArtifacts(input) {
return [{
fileTags: ["res"],
filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir),
input.completeBaseName + input.cpp.resourceSuffix)
}];
}
function precompiledHeaderOutputArtifacts(input, product, lang, generateObjects) {
var artifacts = [{
fileTags: [lang + "_pch"],
filePath: product.name + "_" + lang + product.cpp.precompiledHeaderSuffix
}];
if (generateObjects) {
artifacts.push({
fileTags: ["obj"],
filePath: Utilities.getHash(input.completeBaseName)
+ "_" + lang + input.cpp.objectSuffix
});
}
return artifacts;
}
function collectLibraryDependencies(product) {
var seen = {};
var seenObjectFiles = [];
var result = [];
function addFilePath(filePath, wholeArchive, productName) {
result.push({ filePath: filePath, wholeArchive: wholeArchive, productName: productName });
}
function addArtifactFilePaths(dep, artifacts) {
if (!artifacts)
return;
var artifactFilePaths = artifacts.map(function(a) { return a.filePath; });
var wholeArchive = dep.parameters.cpp && dep.parameters.cpp.linkWholeArchive;
var artifactsAreImportLibs = artifacts.length > 0
&& artifacts[0].fileTags.includes("dynamiclibrary_import");
for (var i = 0; i < artifactFilePaths.length; ++i) {
addFilePath(artifactFilePaths[i], wholeArchive,
artifactsAreImportLibs ? dep.name : undefined);
}
}
function addExternalLibs(obj) {
if (!obj.cpp)
return;
function ensureArray(a) {
return (a instanceof Array) ? a : [];
}
function sanitizedModuleListProperty(obj, moduleName, propertyName) {
return ensureArray(ModUtils.sanitizedModuleProperty(obj, moduleName, propertyName));
}
function handleExternalLibraries(tag, libSuffix, objSuffix) {
var externalLibs = sanitizedModuleListProperty(obj, "cpp", tag) || [];
externalLibs.forEach(function(libName) {
var isObjectFile = objSuffix && libName.endsWith(objSuffix);
if (isObjectFile) {
if (seenObjectFiles.includes(libName))
return;
seenObjectFiles.push(libName);
}
if (!libName.endsWith(libSuffix) && !isObjectFile && !libName.startsWith('@'))
libName += libSuffix;
addFilePath(libName, false);
});
}
handleExternalLibraries("staticLibraries",
obj.moduleProperty("cpp", "staticLibrarySuffix"),
obj.moduleProperty("cpp", "objectSuffix"));
handleExternalLibraries("dynamicLibraries",
obj.moduleProperty("cpp", "dynamicLibraryImportSuffix"));
}
function traverse(dep) {
if (seen.hasOwnProperty(dep.name))
return;
if (dep.parameters.cpp && dep.parameters.cpp.link === false)
return;
var staticLibraryArtifacts = dep.artifacts["staticlibrary"];
var dynamicLibraryArtifacts = staticLibraryArtifacts
? null : dep.artifacts["dynamiclibrary_import"];
if (staticLibraryArtifacts) {
seen[dep.name] = true;
dep.dependencies.forEach(traverse);
addArtifactFilePaths(dep, staticLibraryArtifacts);
if (product.cpp.importPrivateLibraries)
addExternalLibs(dep);
} else if (dynamicLibraryArtifacts) {
seen[dep.name] = true;
addArtifactFilePaths(dep, dynamicLibraryArtifacts);
}
}
product.dependencies.forEach(traverse);
addExternalLibs(product);
return result;
}
function collectAbsoluteLibraryDependencyPaths(product) {
var paths = collectLibraryPaths(product);
var deps = collectLibraryDependencies(product);
return deps.map(function(dep) {
var filePath = dep.filePath;
if (FileInfo.isAbsolutePath(filePath))
return filePath;
for (var i = 0; i < paths.length; ++i) {
var fullPath = FileInfo.joinPaths(paths[i], filePath);
if (File.exists(fullPath))
return fullPath;
}
return filePath;
});
}
function collectDefines(input) {
var allDefines = [];
var platformDefines = input.cpp.platformDefines;
if (platformDefines)
allDefines = allDefines.uniqueConcat(platformDefines);
var defines = input.cpp.defines;
if (defines)
allDefines = allDefines.uniqueConcat(defines);
return allDefines;
}
function collectIncludePaths(input) {
var allIncludePaths = [];
var includePaths = input.cpp.includePaths;
if (includePaths)
allIncludePaths = allIncludePaths.uniqueConcat(includePaths);
var builtIns = input.cpp.compilerIncludePaths;
return allIncludePaths.filter(function(p) {
return !builtIns.includes(p);
});
}
function collectSystemIncludePaths(input) {
var allIncludePaths = [];
var systemIncludePaths = input.cpp.systemIncludePaths;
if (systemIncludePaths)
allIncludePaths = allIncludePaths.uniqueConcat(systemIncludePaths);
var distributionIncludePaths = input.cpp.distributionIncludePaths;
if (distributionIncludePaths)
allIncludePaths = allIncludePaths.uniqueConcat(distributionIncludePaths);
var builtIns = input.cpp.compilerIncludePaths;
return allIncludePaths.filter(function(p) {
return !builtIns.includes(p);
});
}
function collectPreincludePaths(input) {
return input.cpp.prefixHeaders;
}
function collectLibraryPaths(product) {
var allLibraryPaths = [];
var libraryPaths = product.cpp.libraryPaths;
if (libraryPaths)
allLibraryPaths = allLibraryPaths.uniqueConcat(libraryPaths);
var distributionLibraryPaths = product.cpp.distributionLibraryPaths;
if (distributionLibraryPaths)
allLibraryPaths = allLibraryPaths.uniqueConcat(distributionLibraryPaths);
return allLibraryPaths;
}
function collectLinkerScriptPaths(inputs) {
return inputs.linkerscript
? inputs.linkerscript.map(function(script) { return script.filePath; })
: [];
}
function collectLinkerObjectPaths(inputs) {
return inputs.obj ? inputs.obj.map(function(obj) { return obj.filePath; }) : [];
}
function collectResourceObjectPaths(inputs) {
return inputs.res ? inputs.res.map(function(res) { return res.filePath; }) : [];
}
function collectLibraryDependenciesArguments(product) {
var deps = collectLibraryDependencies(product);
return deps.map(function(dep) { return product.cpp.libraryDependencyFlag + dep.filePath })
}
function collectDefinesArguments(input) {
var defines = collectDefines(input);
return defines.map(function(define) { return input.cpp.defineFlag + define });
}
function collectIncludePathsArguments(input) {
var paths = collectIncludePaths(input);
return paths.map(function(path) { return input.cpp.includeFlag + path });
}
function collectSystemIncludePathsArguments(input, flag) {
flag = (flag === undefined) ? input.cpp.systemIncludeFlag : flag;
var paths = collectSystemIncludePaths(input);
return paths.map(function(path) { return flag + path });
}
function collectPreincludePathsArguments(input, split) {
var paths = collectPreincludePaths(input);
if (split) {
var args = [];
for (var i = 0; i < paths.length; ++i)
args.push(input.cpp.preincludeFlag, paths[i]);
return args;
} else {
return paths.map(function(path) { return input.cpp.preincludeFlag + path });
}
}
function collectLibraryPathsArguments(product, flag) {
flag = (flag === undefined) ? product.cpp.libraryPathFlag : flag;
var paths = collectLibraryPaths(product);
return paths.map(function(path) { return flag + path });
}
function collectLinkerScriptPathsArguments(product, inputs, split, flag) {
flag = (flag === undefined) ? product.cpp.linkerScriptFlag : flag;
var paths = collectLinkerScriptPaths(inputs);
if (split) {
var args = [];
for (var i = 0; i < paths.length; ++i)
args.push(flag, paths[i]);
return args;
} else {
return paths.map(function(path) { return flag + path });
}
}
function collectLinkerObjectPathsArguments(product, inputs, flag) {
flag = (flag === undefined) ? "" : flag;
var paths = collectLinkerObjectPaths(product);
return paths.map(function(path) { return flag + path });
}
function collectMiscCompilerArguments(input, tag) {
if (tag === "cppm")
tag = "cpp";
return [].concat(ModUtils.moduleProperty(input, "platformFlags"),
ModUtils.moduleProperty(input, "flags"),
ModUtils.moduleProperty(input, "platformFlags", tag),
ModUtils.moduleProperty(input, "flags", tag));
}
function collectMiscAssemblerArguments(input, tag) {
return [].concat(ModUtils.moduleProperty(input, "platformFlags", tag),
ModUtils.moduleProperty(input, "flags", tag));
}
function collectMiscDriverArguments(config) {
return [].concat(ModUtils.moduleProperty(config, "platformDriverFlags"),
ModUtils.moduleProperty(config, "driverFlags"),
ModUtils.moduleProperty(config, "targetDriverFlags"));
}
function collectMiscLinkerArguments(product) {
return [].concat(ModUtils.moduleProperty(product, "driverLinkerFlags"));
}
function collectMiscEscapableLinkerArguments(product) {
return [].concat(ModUtils.moduleProperty(product, "platformLinkerFlags"),
ModUtils.moduleProperty(product, "linkerFlags"));
}
function supportsArchitecture(architecture, knownArchitectures) {
for (var i = 0; i < knownArchitectures.length; ++i) {
if (architecture.startsWith("arm")) {
if (architecture.startsWith(knownArchitectures[i]))
return true;
} else {
if (architecture === knownArchitectures[i])
return true;
}
}
return false;
}
function prepareModuleInfo(moduleInformation, input, output, product) {
var command = new JavaScriptCommand()
command.moduleInformation = moduleInformation
command.outPath = output.filePath
command.description = "generating module info for " + input.fileName
command.highlight = "filegen"
command.sourceCode = function() {
var file = new TextFile(outPath, TextFile.WriteOnly);
file.write(JSON.stringify(moduleInformation, undefined, 4));
file.close();
}
return command;
}
function prepareModuleMap(moduleInformation, input, mm, product) {
var modulesFromDeps = {};
product.dependencies.forEach(function(dep){
(dep.artifacts["compiled-module"] || []).forEach(function(a) {
modulesFromDeps[a.completeBaseName.replace('-', ':')] = a.filePath;
});
});
var generateModuleMap = new JavaScriptCommand()
generateModuleMap.outPath = mm.filePath
generateModuleMap.moduleInformation = moduleInformation;
generateModuleMap.compiledModuleSuffix = product.cpp.compiledModuleSuffix;
generateModuleMap.moduleInfoSuffix = product.cpp.moduleInfoSuffix;
generateModuleMap.moduleOutputFlag = product.cpp.moduleOutputFlag;
generateModuleMap.moduleFileFlag = product.cpp.moduleFileFlag;
generateModuleMap.toolchain = product.qbs.toolchain;
generateModuleMap.toolchainType = product.qbs.toolchainType;
generateModuleMap.modulesFromDeps = modulesFromDeps;
generateModuleMap.description = "generating module map for " + input.fileName
generateModuleMap.highlight = "filegen"
generateModuleMap.sourceCode = function() {
function moduleFileOption(moduleName) {
return moduleFileFlag.replace("%module%", moduleName);
}
function moduleOutputOption(moduleName) {
return moduleOutputFlag.replace("%module%", moduleName);
}
var content = "";
if (toolchainType === "gcc" || toolchainType === "mingw")
content += "$root .\n";
const isModule = input.fileTags.includes("cppm");
function modulePath(moduleName) {
return FileInfo.joinPaths(
product.buildDirectory,
"cxx-modules",
moduleName.replace(':', "-") + compiledModuleSuffix);
}
const providesModule = moduleInformation.providesModule
if (isModule && providesModule !== undefined) {
if (toolchainType === "msvc") {
if (moduleInformation.isInterfaceModule)
content += "-interface\n";
else
content += "-internalPartition\n";
}
content += moduleOutputOption(providesModule)
+ modulePath(providesModule) + "\n";
}
function isHeaderImport(mod) {
return mod.length > 2
&& (mod[0] == '<' && mod[mod.length - 1] == '>'
|| mod[0] == '"' && mod[mod.length - 1] == '"')
}
function processImport(mod) {
if (!isHeaderImport(mod)) {
const moduleFile = modulesFromDeps[mod] || modulePath(mod);
content += moduleFileOption(mod) + moduleFile + "\n";
function getModuleInfo(moduleFile) {
const moduleInfoPath = FileInfo.joinPaths(
FileInfo.path(moduleFile), FileInfo.completeBaseName(moduleFile) + moduleInfoSuffix);
var file = new TextFile(moduleInfoPath, TextFile.ReadOnly);
const moduleInfo = JSON.parse(file.readAll());
file.close();
return moduleInfo;
}
function processImportsRecursive(moduleFile) {
// can we do better rather than pass info via a file?
const moduleInfo = getModuleInfo(moduleFile);
const requiresModules = moduleInfo['requiresModules'] || [];
requiresModules.forEach(function(importModule) {
const importModuleFile = modulesFromDeps[importModule] || modulePath(importModule);
content += moduleFileOption(importModule) + importModuleFile + "\n";
processImportsRecursive(importModuleFile);
});
}
processImportsRecursive(moduleFile);
}
}
moduleInformation.requiresModules.forEach(processImport);
// converts UTF string to an array of bytes
function encode(string) {
var bytes = [];
for (var i = 0; i < string.length; i++) {
bytes.push(string.charCodeAt(i));
}
return bytes;
}
// MinGW fails if file contains \r on Windows, so we use Unix line-endings on all platforms
// and thus we use BinaryFile instead of TextFile here
var file = new BinaryFile(outPath, TextFile.WriteOnly);
file.write(encode(content));
file.close();
}
return generateModuleMap;
}
function prepareModules(project, product, inputs, outputs, input, output) {
var commands = [];
// module map is present for both cppm and regular cpp files if they use modules
const moduleMapOutputs = outputs["modulemap"];
if (moduleMapOutputs === undefined)
return commands;
const cppModuleMap = moduleMapOutputs[0];
if (cppModuleMap === undefined)
return commands;
const moduleInformation = {
providesModule: cppModuleMap.cpp._providesModule,
isInterfaceModule: cppModuleMap.cpp._isInterfaceModule,
requiresModules: cppModuleMap.cpp._requiresModules,
};
// module info json is present only for cppm
var cppModuleInfo = outputs["moduleinfo"];
if (cppModuleInfo)
commands.push(prepareModuleInfo(moduleInformation, input, cppModuleInfo[0], product));
commands.push(prepareModuleMap(moduleInformation, input, cppModuleMap, product));
return commands;
} qbs-src-2.6.1/share/qbs/modules/cpp/emcc.qbs 0000644 0001751 0000166 00000001521 14776170045 020206 0 ustar runner docker import qbs
import qbs.ModUtils
GenericGCC
{
condition: qbs.toolchain && qbs.toolchain.includes("emscripten")
priority: 100
qbs.targetPlatform: "wasm-emscripten"
cCompilerName: "emcc"
cxxCompilerName: "em++"
archiverName: "emar"
dynamicLibrarySuffix: ".so"
dynamicLibraryPrefix: "lib"
executableSuffix: ".js"
rpathOrigin: "irrelevant"//to pass tests
imageFormat: "wasm"
Depends { name: "emsdk" }
emsdk.configuredInstallPath: toolchainInstallPath
toolchainInstallPath: emsdk.detectedInstallPath ? emsdk.detectedInstallPath : undefined
probeEnv: emsdk.environment
setupBuildEnvironment: {
for (var key in product.cpp.probeEnv) {
var v = new ModUtils.EnvironmentVariable(key);
v.value = product.cpp.probeEnv[key];
v.set();
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/windows-msvc-base.qbs 0000644 0001751 0000166 00000020103 14776170045 022644 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.PathTools
import qbs.Probes
import qbs.Utilities
import qbs.WindowsUtils
import 'cpp.js' as Cpp
import 'msvc.js' as MSVC
CppModule {
condition: false
Depends { name: "codesign" }
windowsApiCharacterSet: "unicode"
platformDefines: {
var defines = base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet))
.concat("WIN32");
var def = WindowsUtils.winapiFamilyDefine(windowsApiFamily);
if (def)
defines.push("WINAPI_FAMILY=WINAPI_FAMILY_" + def);
(windowsApiAdditionalPartitions || []).map(function (name) {
defines.push("WINAPI_PARTITION_" + WindowsUtils.winapiPartitionDefine(name) + "=1");
});
return defines;
}
platformCommonCompilerFlags: {
var flags = base;
if (compilerVersionMajor >= 18) // 2013
flags.push("/FS");
return flags;
}
warningLevel: "default"
compilerName: "cl.exe"
compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
assemblerName: {
switch (qbs.architecture) {
case "armv7":
return "armasm.exe";
case "arm64":
return "armasm64.exe";
case "ia64":
return "ias.exe";
case "x86":
return "ml.exe";
case "x86_64":
return "ml64.exe";
}
}
linkerName: "link.exe"
runtimeLibrary: "dynamic"
separateDebugInformation: true
property bool generateManifestFile: true
architecture: qbs.architecture
endianness: "little"
staticLibrarySuffix: ".lib"
dynamicLibrarySuffix: ".dll"
executableSuffix: ".exe"
debugInfoSuffix: ".pdb"
objectSuffix: ".obj"
precompiledHeaderSuffix: ".pch"
imageFormat: "pe"
Properties {
condition: product.multiplexByQbsProperties.includes("buildVariants")
&& qbs.buildVariants && qbs.buildVariants.length > 1
&& qbs.buildVariant !== "release"
&& product.type.containsAny(["staticlibrary", "dynamiclibrary"])
variantSuffix: "d"
}
property var buildEnv
readonly property bool shouldSignArtifacts: codesign.enableCodeSigning
property bool enableCxxLanguageMacro: false
setupBuildEnvironment: {
for (var key in product.cpp.buildEnv) {
var v = new ModUtils.EnvironmentVariable(key, ';');
v.prepend(product.cpp.buildEnv[key]);
v.set();
}
}
property string windowsSdkVersion
defineFlag: "/D"
includeFlag: "/I"
systemIncludeFlag: "/external:I"
preincludeFlag: "/FI"
libraryPathFlag: "/LIBPATH:"
Rule {
condition: useCPrecompiledHeader
inputs: ["c_pch_src"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.precompiledHeaderOutputTags("c", true)
outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "c", true)
prepare: MSVC.prepareCompiler.apply(MSVC, arguments)
}
Rule {
condition: useCxxPrecompiledHeader
inputs: ["cpp_pch_src"]
explicitlyDependsOn: ["c_pch"] // to prevent vc--0.pdb conflict
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.precompiledHeaderOutputTags("cpp", true)
outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "cpp", true)
prepare: MSVC.prepareCompiler.apply(MSVC, arguments)
}
Rule {
name: "cpp_compiler"
inputs: ["cpp", "cppm", "c"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
explicitlyDependsOn: ["c_pch", "cpp_pch"]
outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles, /*withCxxModules*/ true)
outputArtifacts: Cpp.compilerOutputArtifacts(input, undefined, /*withCxxModules*/ true)
prepare: MSVC.prepareCompiler.apply(MSVC, arguments)
}
FileTagger {
patterns: ["*.manifest"]
fileTags: ["native.pe.manifest"]
}
FileTagger {
patterns: ["*.def"]
fileTags: ["def"]
}
Rule {
name: "applicationLinker"
multiplex: true
inputs: ['obj', 'res', 'native.pe.manifest', 'def']
inputsFromDependencies: ['staticlibrary', 'dynamiclibrary_import', "debuginfo_app"]
outputFileTags: {
var tags = ["application", "debuginfo_app"];
if (generateLinkerMapFile)
tags.push("mem_map");
if (shouldSignArtifacts)
tags.push("codesign.signed_artifact");
return tags;
}
outputArtifacts: MSVC.appLinkerOutputArtifacts(product)
prepare: MSVC.prepareLinker.apply(MSVC, arguments)
}
Rule {
name: "dynamicLibraryLinker"
multiplex: true
inputs: ['obj', 'res', 'native.pe.manifest', 'def']
inputsFromDependencies: ['staticlibrary', 'dynamiclibrary_import', "debuginfo_dll"]
outputFileTags: {
var tags = ["dynamiclibrary", "dynamiclibrary_import", "debuginfo_dll"];
if (shouldSignArtifacts)
tags.push("codesign.signed_artifact");
return tags;
}
outputArtifacts: MSVC.dllLinkerOutputArtifacts(product)
prepare: MSVC.prepareLinker.apply(MSVC, arguments)
}
Rule {
name: "libtool"
multiplex: true
inputs: ["obj", "res"]
inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"]
outputFileTags: ["staticlibrary", "debuginfo_cl"]
outputArtifacts: MSVC.libtoolOutputArtifacts(product)
prepare: MSVC.libtoolCommands.apply(MSVC, arguments)
}
FileTagger {
patterns: ["*.rc"]
fileTags: ["rc"]
}
Rule {
inputs: ["rc"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.resourceCompilerOutputTags()
outputArtifacts: Cpp.resourceCompilerOutputArtifacts(input)
prepare: {
// From MSVC 2010 on, the logo can be suppressed.
var logo = product.cpp.compilerVersionMajor >= 16
? "can-suppress-logo" : "always-shows-logo";
return MSVC.createRcCommand("rc", input, output, logo);
}
}
FileTagger {
patterns: "*.asm"
fileTags: ["asm"]
}
Rule {
inputs: ["asm"]
outputFileTags: Cpp.assemblerOutputTags(false)
outputArtifacts: Cpp.assemblerOutputArtifacts(input)
prepare: MSVC.assemblerCommands.apply(MSVC, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/setuprunenv.js 0000644 0001751 0000166 00000014111 14776170045 021523 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var File = require("qbs.File");
var Host = require("qbs.Host");
var ModUtils = require("qbs.ModUtils"); // TODO: append/prepend functionality should go to qbs.Environment
function addNewElement(list, elem)
{
if (!list.includes(elem))
list.push(elem);
}
function artifactDir(artifact)
{
if (!artifact.qbs.install)
return FileInfo.path(artifact.filePath);
return FileInfo.path(ModUtils.artifactInstalledFilePath(artifact));
}
function addExternalLibPath(product, list, path)
{
addNewElement(list, path);
if (Host.os().includes("windows") && FileInfo.fileName(path) === "lib") {
var binPath = FileInfo.joinPaths(FileInfo.path(path), "bin");
if (File.exists(binPath))
addNewElement(list, binPath);
}
}
function gatherPaths(product, libPaths, frameworkPaths, seenProducts)
{
if (seenProducts.includes(product.name))
return;
seenProducts.push(product.name);
// Gather explicitly given library paths.
if (product.cpp && product.cpp.libraryPaths)
product.cpp.libraryPaths.forEach(function(p) { addExternalLibPath(product, libPaths, p); });
if (product.cpp && product.cpp.frameworkPaths)
product.cpp.frameworkPaths.forEach(function(p) { addNewElement(frameworkPaths, p); });
if (product.cpp && product.cpp.systemFrameworkPaths)
product.cpp.systemFrameworkPaths.forEach(function(p) { addNewElement(frameworkPaths, p); });
// Extract paths from dynamic libraries, if they are given as file paths.
if (product.cpp && product.cpp.dynamicLibraries) {
product.cpp.dynamicLibraries.forEach(function(dll) {
if (FileInfo.isAbsolutePath(dll))
addExternalLibPath(product, libPaths, FileInfo.path(dll));
});
}
// Traverse library dependencies.
for (var i = 0; i < product.dependencies.length; ++i) {
var dep = product.dependencies[i];
var dllSymlinkArtifacts = dep.artifacts["bundle.symlink.executable"];
if (dllSymlinkArtifacts) {
var addArtifact = function(artifact) {
addNewElement(frameworkPaths, FileInfo.path(artifactDir(artifact)));
};
dllSymlinkArtifacts.forEach(addArtifact); // TODO: Will also catch applications. Can we prevent that?
} else {
addArtifact = function(artifact) {
addNewElement(libPaths, artifactDir(artifact));
};
var dllArtifacts = dep.artifacts["dynamiclibrary"];
if (dllArtifacts)
dllArtifacts.forEach(addArtifact);
var loadableModuleArtifacts = dep.artifacts["loadablemodule"];
if (loadableModuleArtifacts)
loadableModuleArtifacts.forEach(addArtifact);
}
if (!dep.hasOwnProperty("present")) // Recurse if the dependency is a product. TODO: Provide non-heuristic way to decide whether dependency is a product.
gatherPaths(dep, libPaths, frameworkPaths, seenProducts);
}
}
function setupRunEnvironment(product, config)
{
if (config.includes("ignore-lib-dependencies"))
return;
if (Host.platform() !== product.qbs.targetPlatform)
return;
var libPaths = [];
var frameworkPaths = [];
gatherPaths(product, libPaths, frameworkPaths, []);
var runPaths = product.cpp ? product.cpp.systemRunPaths : undefined;
if (runPaths && runPaths.length > 0) {
var canonicalRunPaths = runPaths.map(function(p) { return File.canonicalFilePath(p); });
var filterFunc = function(libPath) {
return !runPaths.includes(libPath)
&& !canonicalRunPaths.includes(File.canonicalFilePath(libPath));
};
libPaths = libPaths.filter(filterFunc);
frameworkPaths = frameworkPaths.filter(filterFunc);
}
if (libPaths.length > 0) {
var envVarName;
if (product.qbs.targetOS.includes("windows"))
envVarName = "PATH";
else if (product.qbs.targetOS.includes("macos"))
envVarName = "DYLD_LIBRARY_PATH";
else
envVarName = "LD_LIBRARY_PATH";
var envVar = new ModUtils.EnvironmentVariable(envVarName, FileInfo.pathListSeparator(),
Host.os().includes("windows"));
libPaths.forEach(function(p) { envVar.prepend(p); });
envVar.set();
}
if (product.qbs.targetOS.includes("macos") && frameworkPaths.length > 0) {
envVar = new ModUtils.EnvironmentVariable("DYLD_FRAMEWORK_PATH", ':', false);
frameworkPaths.forEach(function(p) { envVar.prepend(p); });
envVar.set();
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/sdcc.qbs 0000644 0001751 0000166 00000013210 14776170045 020211 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Probes
import "cpp.js" as Cpp
import "sdcc.js" as SDCC
CppModule {
condition: qbs.toolchain && qbs.toolchain.includes("sdcc")
Probes.BinaryProbe {
id: compilerPathProbe
condition: !toolchainInstallPath && !_skipAllChecks
names: ["sdcc"]
}
Probes.SdccProbe {
id: sdccProbe
condition: !_skipAllChecks
compilerFilePath: compilerPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
preferredArchitecture: qbs.architecture
}
Properties {
condition: sdccProbe.found
qbs.architecture: sdccProbe.architecture
}
qbs.targetPlatform: "none"
compilerVersionMajor: sdccProbe.versionMajor
compilerVersionMinor: sdccProbe.versionMinor
compilerVersionPatch: sdccProbe.versionPatch
endianness: sdccProbe.endianness
compilerDefinesByLanguage: sdccProbe.compilerDefinesByLanguage
compilerIncludePaths: sdccProbe.includePaths
toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined
/* Work-around for QtCreator which expects these properties to exist. */
property string cCompilerName: compilerName
property string cxxCompilerName: compilerName
property string linkerMode: "automatic"
compilerName: "sdcc" + compilerExtension
compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
assemblerName: toolchainDetails.assemblerName + compilerExtension
assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName)
linkerName: toolchainDetails.linkerName + compilerExtension
linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName)
property string archiverName: "sdar" + compilerExtension
property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName)
runtimeLibrary: "static"
staticLibrarySuffix: ".lib"
executableSuffix: ".ihx"
objectSuffix: ".rel"
imageFormat: "ihx"
enableExceptions: false
enableRtti: false
defineFlag: "-D"
includeFlag: "-I"
systemIncludeFlag: "-isystem"
preincludeFlag: "-include"
libraryDependencyFlag: "-l"
libraryPathFlag: "-L"
linkerScriptFlag: "-f"
toolchainDetails: SDCC.toolchainDetails(qbs)
knownArchitectures: ["hcs8", "mcs51", "stm8"]
Rule {
id: assembler
inputs: ["asm"]
outputFileTags: SDCC.extraCompilerOutputTags().concat(
Cpp.assemblerOutputTags(generateAssemblerListingFiles))
outputArtifacts: SDCC.extraCompilerOutputArtifacts(input).concat(
Cpp.assemblerOutputArtifacts(input))
prepare: SDCC.prepareAssembler.apply(SDCC, arguments)
}
FileTagger {
patterns: ["*.s", "*.a51", "*.asm"]
fileTags: ["asm"]
}
Rule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: SDCC.extraCompilerOutputTags().concat(
Cpp.compilerOutputTags(generateCompilerListingFiles))
outputArtifacts: SDCC.extraCompilerOutputArtifacts(input).concat(
Cpp.compilerOutputArtifacts(input))
prepare: SDCC.prepareCompiler.apply(SDCC, arguments)
}
Rule {
id: applicationLinker
multiplex: true
inputs: ["obj", "linkerscript"]
inputsFromDependencies: ["staticlibrary"]
outputFileTags: SDCC.extraApplicationLinkerOutputTags().concat(
Cpp.applicationLinkerOutputTags(generateLinkerMapFile))
outputArtifacts: SDCC.extraApplicationLinkerOutputArtifacts(product).concat(
Cpp.applicationLinkerOutputArtifacts(product))
prepare: SDCC.prepareLinker.apply(SDCC, arguments)
}
Rule {
id: staticLibraryLinker
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary"]
outputFileTags: Cpp.staticLibraryLinkerOutputTags()
outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product)
prepare: SDCC.prepareArchiver.apply(SDCC, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/freebsd-gcc.qbs 0000644 0001751 0000166 00000003555 14776170045 021454 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import "freebsd.js" as FreeBSD
import qbs.Host
UnixGCC {
condition: qbs.targetOS.includes("freebsd") &&
qbs.toolchain && qbs.toolchain.includes("gcc")
priority: 1
targetSystem: "freebsd" + (Host.os().includes("freebsd") ? FreeBSD.hostKernelRelease() : "")
distributionIncludePaths: ["/usr/local/include"]
distributionLibraryPaths: ["/usr/local/lib"]
}
qbs-src-2.6.1/share/qbs/modules/cpp/tvos-gcc.qbs 0000644 0001751 0000166 00000004164 14776170045 021032 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
DarwinGCC {
priority: 1
condition: qbs.targetOS.includes('tvos') &&
qbs.toolchain && qbs.toolchain.includes('gcc')
targetSystem: "tvos" + (minimumTvosVersion || "")
minimumDarwinVersion: minimumTvosVersion
minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("tvos-simulator")
? "-mtvos-simulator-version-min"
: "-mtvos-version-min"
minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("tvos-simulator")
? "-tvos_simulator_version_min"
: "-tvos_version_min"
}
qbs-src-2.6.1/share/qbs/modules/cpp/dmc.qbs 0000644 0001751 0000166 00000015625 14776170045 020054 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.PathTools
import qbs.Probes
import qbs.Utilities
import "dmc.js" as DMC
import "cpp.js" as Cpp
CppModule {
condition: Host.os().includes("windows") && qbs.toolchain && qbs.toolchain.includes("dmc")
Probes.BinaryProbe {
id: compilerPathProbe
condition: !toolchainInstallPath && !_skipAllChecks
names: ["dmc"]
}
Probes.DmcProbe {
id: dmcProbe
condition: !_skipAllChecks
compilerFilePath: compilerPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
_targetPlatform: qbs.targetPlatform
_targetArchitecture: qbs.architecture
_targetExtender: extenderName
}
Properties {
condition: dmcProbe.found
qbs.architecture: dmcProbe.architecture
qbs.targetPlatform: dmcProbe.targetPlatform
}
compilerVersionMajor: dmcProbe.versionMajor
compilerVersionMinor: dmcProbe.versionMinor
compilerVersionPatch: dmcProbe.versionPatch
endianness: "little"
compilerDefinesByLanguage: dmcProbe.compilerDefinesByLanguage
compilerIncludePaths: dmcProbe.includePaths
toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined
/* Work-around for QtCreator which expects these properties to exist. */
property string cCompilerName: compilerName
property string cxxCompilerName: compilerName
compilerName: "dmc.exe"
compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
assemblerName: "dmc.exe"
assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName)
linkerName: "link.exe"
linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName)
property string archiverName: "lib.exe"
property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName)
property string rccCompilerName: "rcc.exe"
property string rccCompilerPath: FileInfo.joinPaths(toolchainInstallPath, rccCompilerName)
property string extenderName
PropertyOptions {
name: "extenderName"
allowedValues: [undefined, "dosz", "dosr", "dosx", "dosp"]
description: "Specifies the DOS memory extender to compile with:\n"
+ " - \"dosz\" is the ZPM 16 bit DOS Extender\n"
+ " - \"dosr\" is the Rational 16 bit DOS Extender\n"
+ " - \"dosx\" is the DOSX 32 bit DOS Extender\n"
+ " - \"dosp\" is the Pharlap 32 bit DOS Extender\n"
;
}
runtimeLibrary: "dynamic"
staticLibrarySuffix: ".lib"
dynamicLibrarySuffix: ".dll"
executableSuffix: ".exe"
objectSuffix: ".obj"
imageFormat: {
if (qbs.targetPlatform === "dos")
return "mz";
else if (qbs.targetPlatform === "windows")
return "pe";
}
defineFlag: "-D"
includeFlag: "-I"
systemIncludeFlag: "-I"
preincludeFlag: "-HI"
libraryPathFlag: "-L/packcode"
knownArchitectures: ["x86", "x86_16"]
Rule {
id: assembler
inputs: ["asm"]
outputFileTags: DMC.depsOutputTags().concat(
Cpp.assemblerOutputTags(generateAssemblerListingFiles))
outputArtifacts: DMC.depsOutputArtifacts(input, product).concat(
Cpp.assemblerOutputArtifacts(input))
prepare: DMC.prepareAssembler.apply(DMC, arguments)
}
FileTagger {
patterns: ["*.s", "*.asm"]
fileTags: ["asm"]
}
Rule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: DMC.depsOutputTags().concat(
Cpp.compilerOutputTags(generateCompilerListingFiles))
outputArtifacts: DMC.depsOutputArtifacts(input, product).concat(
Cpp.compilerOutputArtifacts(input))
prepare: DMC.prepareCompiler.apply(DMC, arguments)
}
Rule {
id: rccCompiler
inputs: ["rc"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.resourceCompilerOutputTags()
outputArtifacts: Cpp.resourceCompilerOutputArtifacts(input)
prepare: DMC.prepareRccCompiler.apply(DMC, arguments)
}
FileTagger {
patterns: ["*.rc"]
fileTags: ["rc"]
}
Rule {
id: applicationLinker
multiplex: true
inputs: ["obj", "res", "linkerscript"]
inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"]
outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile)
outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product)
prepare: DMC.prepareLinker.apply(DMC, arguments)
}
Rule {
id: dynamicLibraryLinker
multiplex: true
inputs: ["obj", "res"]
inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"]
outputFileTags: Cpp.dynamicLibraryLinkerOutputTags()
outputArtifacts: Cpp.dynamicLibraryLinkerOutputArtifacts(product)
prepare: DMC.prepareLinker.apply(DMC, arguments)
}
Rule {
id: staticLibraryLinker
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"]
outputFileTags: Cpp.staticLibraryLinkerOutputTags()
outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product)
prepare: DMC.prepareArchiver.apply(DMC, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/CppModule.qbs 0000644 0001751 0000166 00000054713 14776170045 021202 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
// base for Cpp modules
import qbs.FileInfo
import qbs.ModUtils
import qbs.Utilities
import qbs.WindowsUtils
import "cpp.js" as Cpp
import "setuprunenv.js" as SetupRunEnv
Module {
condition: false
Depends { name: "cpufeatures" }
version: compilerVersion
property string compilerVersion:
[compilerVersionMajor, compilerVersionMinor, compilerVersionPatch].join(".")
property int compilerVersionMajor
property int compilerVersionMinor
property int compilerVersionPatch
property string warningLevel : 'all' // 'none', 'all'
property bool treatWarningsAsErrors : false
property bool enableSuspiciousLinkerFlagWarnings: true
property string architecture: qbs.architecture
property string endianness
property string machineType // undocumented
property string imageFormat // undocumented
property string optimization: qbs.optimization
property bool debugInformation: qbs.debugInformation
property bool enableReproducibleBuilds: false
property bool separateDebugInformation: false
property pathList prefixHeaders
property bool useCPrecompiledHeader: true
property bool useCxxPrecompiledHeader: true
property bool useObjcPrecompiledHeader: true
property bool useObjcxxPrecompiledHeader: true
property bool forceUseCxxModules: false
property string moduleOutputFlag // undocumented
property string moduleFileFlag // undocumented
property bool treatSystemHeadersAsDependencies: false
property stringList defines
property stringList platformDefines: qbs.enableDebugCode ? [] : ["NDEBUG"]
property stringList compilerDefines: compilerDefinesByLanguage
? ModUtils.flattenDictionary(compilerDefinesByLanguage["c"])
: []
property var compilerDefinesByLanguage: undefined
PropertyOptions {
name: "compilerDefinesByLanguage"
description: "preprocessor macros that are defined when using this particular compiler"
}
property stringList enableCompilerDefinesByLanguage: []
property string windowsApiCharacterSet
property string windowsApiFamily
property stringList windowsApiAdditionalPartitions
property bool requireAppContainer
property string minimumWindowsVersion
PropertyOptions {
name: "minimumWindowsVersion"
description: "A version number in the format [major].[minor] indicating the earliest \
version of Windows that the product should run on. Defines WINVER, \
_WIN32_WINNT, and _WIN32_WINDOWS, and applies a version number to the \
linker flags /SUBSYSTEM and /OSVERSION for MSVC or \
--major-subsystem-version, --minor-subsystem-version, \
--major-os-version and --minor-os-version for MinGW. \
If undefined, compiler defaults will be used."
}
property string minimumOsxVersion
property string minimumMacosVersion: minimumOsxVersion
PropertyOptions {
name: "minimumMacosVersion"
description: "a version number in the format [major].[minor] indicating the earliest \
version of macOS that the product should run on. passes -mmacosx-version-min= \
to the compiler. if undefined, compiler defaults will be used."
}
property string minimumIosVersion: qbs.architecture == "armv7a" ? "6.0" : undefined
PropertyOptions {
name: "minimumIosVersion"
description: "a version number in the format [major].[minor] indicating the earliest \
version of iOS that the product should run on. passes -miphoneos-version-min= \
to the compiler. if undefined, compiler defaults will be used."
}
property string minimumWatchosVersion
PropertyOptions {
name: "minimumWatchosVersion"
description: "a version number in the format [major].[minor] indicating the earliest \
version of watchOS that the product should run on. if undefined, compiler \
defaults will be used."
}
property string minimumTvosVersion: "6.0"
PropertyOptions {
name: "minimumTvosVersion"
description: "a version number in the format [major].[minor] indicating the earliest \
version of tvOS that the product should run on. if undefined, compiler \
defaults will be used."
}
property string minimumAndroidVersion // not used, undocumented
PropertyOptions {
name: "minimumAndroidVersion"
description: "a version number in the format [major].[minor] indicating the earliest \
version of Android that the product should run on. this value is converted into an SDK \
version which is then written to AndroidManifest.xml."
}
property string maximumAndroidVersion // not used, undocumented
PropertyOptions {
name: "maximumAndroidVersion"
description: "a version number in the format [major].[minor] indicating the latest \
version of Android that the product should run on. this value is converted into an SDK \
version which is then written to AndroidManifest.xml. if undefined, no upper limit will \
be set."
}
property string toolchainInstallPath
PropertyOptions {
name: "toolchainInstallPath"
description: "a path to the directory where the toolchain executable files are located."
}
property pathList includePaths
property pathList systemIncludePaths
property pathList distributionIncludePaths
property pathList compilerIncludePaths
property pathList libraryPaths
property pathList distributionLibraryPaths
property pathList compilerLibraryPaths
property pathList frameworkPaths
property pathList systemFrameworkPaths
property pathList distributionFrameworkPaths
property pathList compilerFrameworkPaths
property stringList systemRunPaths: []
property string assemblerName
property string assemblerPath: assemblerName
property string compilerName
property string compilerPath: compilerName
property var compilerPathByLanguage
property stringList compilerWrapper
property string linkerName
property string linkerPath: linkerName
property stringList linkerWrapper
property string staticLibraryPrefix: ""
property string dynamicLibraryPrefix: ""
property string loadableModulePrefix: ""
property string executablePrefix: ""
property string staticLibrarySuffix: ""
property string dynamicLibrarySuffix: ""
property string archSuffix: ""
property string loadableModuleSuffix: ""
property string executableSuffix: ""
property string debugInfoSuffix: ""
property string debugInfoBundleSuffix: ""
property string variantSuffix: ""
property string dynamicLibraryImportSuffix: ".lib"
property string objectSuffix: ".o"
property string linkerMapSuffix: ".map"
property string compilerListingSuffix: ".lst"
property string assemblerListingSuffix: ".lst"
property string resourceSuffix: ".res"
property string compiledModuleSuffix
property string moduleMapSuffix: ".modulemap"
property string moduleInfoSuffix: ".moduleinfo.json"
property string precompiledHeaderSuffix
property bool createSymlinks: true
property stringList dynamicLibraries // list of names, will be linked with -lname
property stringList staticLibraries // list of static library files
property stringList frameworks // list of frameworks, will be linked with '-framework '
property stringList weakFrameworks // list of weakly-linked frameworks, will be linked with '-weak_framework '
property string rpathOrigin
property stringList rpaths
property string sonamePrefix: ""
property bool useRPaths: true
property bool useRPathLink
property string rpathLinkFlag
property bool discardUnusedData
property bool removeDuplicateLibraries: true
property string defineFlag
property string includeFlag
property string systemIncludeFlag
property string preincludeFlag
property string libraryDependencyFlag
property string libraryPathFlag
property string linkerScriptFlag
property stringList knownArchitectures: []
property var toolchainDetails
property string compilerExtension: FileInfo.executableSuffix()
property string linkerMode: "automatic"
PropertyOptions {
name: "linkerMode"
allowedValues: ["automatic", "manual"]
description: "Controls whether to automatically use an appropriate compiler frontend "
+ "in place of the system linker when linking binaries. The default is \"automatic\", "
+ "which chooses either the C++ compiler, C compiler, or system linker specified by "
+ "the linkerName/linkerPath properties, depending on the type of object files "
+ "present on the linker command line. \"manual\" allows you to explicitly specify "
+ "the linker using the linkerName/linkerPath properties, and allows linker flags "
+ "passed to the linkerFlags and platformLinkerFlags properties to be escaped "
+ "manually (using -Wl or -Xlinker) instead of automatically based on the selected "
+ "linker."
}
property stringList assemblerFlags
PropertyOptions {
name: "assemblerFlags"
description: "additional flags for the assembler"
}
property stringList cppFlags
PropertyOptions {
name: "cppFlags"
description: "additional flags for the C preprocessor"
}
property stringList cFlags
PropertyOptions {
name: "cFlags"
description: "additional flags for the C compiler"
}
property stringList cxxFlags
PropertyOptions {
name: "cxxFlags"
description: "additional flags for the C++ compiler"
}
property stringList objcFlags
PropertyOptions {
name: "objcFlags"
description: "additional flags for the Objective-C compiler"
}
property stringList objcxxFlags
PropertyOptions {
name: "objcxxFlags"
description: "additional flags for the Objective-C++ compiler"
}
property stringList commonCompilerFlags
PropertyOptions {
name: "commonCompilerFlags"
description: "flags added to all compilation independently of the language"
}
property stringList linkerFlags
PropertyOptions {
name: "linkerFlags"
description: "additional linker flags"
}
property stringList driverFlags
PropertyOptions {
name: "driverFlags"
description: "additional compiler driver flags"
}
property stringList driverLinkerFlags
PropertyOptions {
name: "driverLinkerFlags"
description: "additional compiler driver flags used for linking only"
}
property bool generateLinkerMapFile: false
PropertyOptions {
name: "generateLinkerMapFile"
description: "generate linker map file"
}
property bool generateCompilerListingFiles: false
PropertyOptions {
name: "generateCompilerListingFiles"
description: "generate compiler listing files"
}
property bool generateAssemblerListingFiles: false
PropertyOptions {
name: "generateAssemblerListingFiles"
description: "generate assembler listing files"
}
property bool positionIndependentCode: true
PropertyOptions {
name: "positionIndependentCode"
description: "generate position independent code"
}
property string entryPoint
PropertyOptions {
name: "entryPoint"
description: "entry point symbol for an executable or dynamic library"
}
property string runtimeLibrary
PropertyOptions {
name: "runtimeLibrary"
description: "determine which runtime library to use"
allowedValues: ['static', 'dynamic']
}
property string visibility: 'default'
PropertyOptions {
name: "visibility"
description: "export symbols visibility level"
allowedValues: ['default', 'hidden', 'hiddenInlines', 'minimal']
}
property stringList cLanguageVersion
PropertyOptions {
name: "cLanguageVersion"
description: "The version of the C standard with which the code must comply."
}
property stringList cxxLanguageVersion
PropertyOptions {
name: "cxxLanguageVersion"
description: "The version of the C++ standard with which the code must comply."
}
property bool useLanguageVersionFallback
PropertyOptions {
name: "useLanguageVersionFallback"
description: "whether to explicitly use the language standard version fallback values in " +
"compiler command line invocations"
}
property string cxxStandardLibrary
PropertyOptions {
name: "cxxStandardLibrary"
allowedValues: ["libstdc++", "libc++"]
description: "version of the C++ standard library to use"
}
property bool enableExceptions: true
PropertyOptions {
name: "enableExceptions"
description: "enable/disable exception handling (enabled by default)"
}
property string exceptionHandlingModel: "default"
PropertyOptions {
name: "exceptionHandlingModel"
description: "the kind of exception handling to be used by the compiler"
}
property bool enableRtti
// Platform properties. Those are intended to be set by the toolchain setup
// and are prepended to the corresponding user properties.
property stringList platformAssemblerFlags
property stringList platformCommonCompilerFlags
property stringList platformCFlags
property stringList platformCxxFlags
property stringList platformObjcFlags
property stringList platformObjcxxFlags
property stringList platformLinkerFlags
property stringList platformDriverFlags
// Apple platforms properties
property bool automaticReferenceCounting
PropertyOptions {
name: "automaticReferenceCounting"
description: "whether to enable Automatic Reference Counting (ARC) for Objective-C"
}
property bool requireAppExtensionSafeApi
PropertyOptions {
name: "requireAppExtensionSafeApi"
description: "whether to require app-extension-safe APIs only"
}
property bool allowUnresolvedSymbols
property bool combineCSources: false
property bool combineCxxSources: false
property bool combineObjcSources: false
property bool combineObjcxxSources: false
// Those are set internally by different cpp module implementations
property stringList targetAssemblerFlags
property stringList targetDriverFlags
property stringList targetLinkerFlags
property bool _skipAllChecks: false // Internal
property bool validateTargetTriple: true // undocumented
property bool importPrivateLibraries: true
// TODO: The following four rules could use a convenience base item if rule properties
// were available in Artifact items and prepare scripts.
Rule {
multiplex: true
inputs: ["c.combine"]
Artifact {
filePath: "amalgamated_" + product.targetName + ".c"
fileTags: ["c"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
ModUtils.mergeCFiles(inputs["c.combine"], output.filePath);
};
return [cmd];
}
}
Rule {
multiplex: true
inputs: ["cpp.combine"]
Artifact {
filePath: "amalgamated_" + product.targetName + ".cpp"
fileTags: ["cpp"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
ModUtils.mergeCFiles(inputs["cpp.combine"], output.filePath);
};
return [cmd];
}
}
Rule {
multiplex: true
inputs: ["objc.combine"]
Artifact {
filePath: "amalgamated_" + product.targetName + ".m"
fileTags: ["objc"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
ModUtils.mergeCFiles(inputs["objc.combine"], output.filePath);
};
return [cmd];
}
}
Rule {
multiplex: true
inputs: ["objcpp.combine"]
Artifact {
filePath: "amalgamated_" + product.targetName + ".mm"
fileTags: ["objccpp"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
ModUtils.mergeCFiles(inputs["objcpp.combine"], output.filePath);
};
return [cmd];
}
}
FileTagger {
patterns: ["*.c"]
fileTags: combineCSources ? ["c.combine"] : ["c"]
}
FileTagger {
patterns: ["*.C", "*.cpp", "*.cxx", "*.c++", "*.cc"]
fileTags: combineCxxSources ? ["cpp.combine"] : ["cpp"]
}
FileTagger {
patterns: ["*.cppm", "*.ixx"]
fileTags: ["cppm"]
}
FileTagger {
patterns: ["*.m"]
fileTags: combineObjcSources ? ["objc.combine"] : ["objc"]
}
FileTagger {
patterns: ["*.mm"]
fileTags: combineObjcxxSources ? ["objcpp.combine"] : ["objcpp"]
}
FileTagger {
patterns: ["*.h", "*.H", "*.hpp", "*.hxx", "*.h++"]
fileTags: ["hpp"]
}
property var validateFunc: {
return function() {
var validator = new ModUtils.PropertyValidator("cpp");
validator.setRequiredProperty("architecture", architecture,
"you might want to re-run 'qbs-setup-toolchains'");
validator.addCustomValidator("architecture", architecture, function (value) {
return !architecture || architecture === Utilities.canonicalArchitecture(architecture);
}, "'" + architecture + "' is invalid. You must use the canonical name '" +
Utilities.canonicalArchitecture(architecture) + "'");
validator.setRequiredProperty("endianness", endianness);
validator.setRequiredProperty("compilerDefinesByLanguage", compilerDefinesByLanguage);
validator.setRequiredProperty("compilerVersion", compilerVersion);
validator.setRequiredProperty("compilerVersionMajor", compilerVersionMajor);
validator.setRequiredProperty("compilerVersionMinor", compilerVersionMinor);
validator.setRequiredProperty("compilerVersionPatch", compilerVersionPatch);
validator.addVersionValidator("compilerVersion", compilerVersion, 3, 3);
validator.addRangeValidator("compilerVersionMajor", compilerVersionMajor, 1);
validator.addRangeValidator("compilerVersionMinor", compilerVersionMinor, 0);
validator.addRangeValidator("compilerVersionPatch", compilerVersionPatch, 0);
if (minimumWindowsVersion) {
validator.addVersionValidator("minimumWindowsVersion", minimumWindowsVersion, 2, 2);
validator.addCustomValidator("minimumWindowsVersion", minimumWindowsVersion, function (v) {
return !v || v === WindowsUtils.canonicalizeVersion(v);
}, "'" + minimumWindowsVersion + "' is invalid. Did you mean '" +
WindowsUtils.canonicalizeVersion(minimumWindowsVersion) + "'?");
}
validator.validate();
if (minimumWindowsVersion && !WindowsUtils.isValidWindowsVersion(minimumWindowsVersion)) {
console.warn("Unknown Windows version '" + minimumWindowsVersion
+ "'; expected one of: "
+ WindowsUtils.knownWindowsVersions().map(function (a) {
return '"' + a + '"'; }).join(", ")
+ ". See https://docs.microsoft.com/en-us/windows/desktop/SysInfo/operating-system-version");
}
if (knownArchitectures && knownArchitectures.length > 0) {
var isSupported = Cpp.supportsArchitecture(qbs.architecture, knownArchitectures);
if (!isSupported) {
throw ModUtils.ModuleError("Unsupported architecture: '" + qbs.architecture + "'");
}
}
}
}
validate: {
return validateFunc();
}
setupRunEnvironment: {
SetupRunEnv.setupRunEnvironment(product, config);
}
Parameter {
property bool link
}
Parameter {
property bool linkWholeArchive
}
Parameter {
property string symbolLinkMode
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/qnx-qcc.qbs 0000644 0001751 0000166 00000007101 14776170045 020651 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
UnixGCC {
Depends { name: "qnx" }
condition: qbs.targetOS.includes("qnx") &&
qbs.toolchain && qbs.toolchain.includes("qcc")
priority: 1
distributionIncludePaths: FileInfo.joinPaths(qnx.targetDir, "usr", "include")
toolchainInstallPath: FileInfo.joinPaths(qnx.hostDir, "usr", "bin")
sysroot: qnx.targetDir
sysrootFlags: sysroot ? [systemIncludeFlag + FileInfo.joinPaths(sysroot, "usr", "include")] : []
cCompilerName: "qcc" + compilerExtension
cxxCompilerName: (qnx.qnx7 ? "q++" : "QCC") + compilerExtension
targetDriverFlags: qnxTarget ? ["-V" + qnxTarget] : []
systemIncludeFlag: !qnx.qnx7 ? includeFlag : base
property string qnxTarget: qbs.architecture
? qnx.compilerName + "_" + targetSystem + qnxTargetArchName
: undefined
property string qnxTargetArchName: {
switch (qbs.architecture) {
case "arm64":
return "aarch64le";
case "armv7a":
return "armv7le";
case "x86":
case "x86_64":
return qbs.architecture;
}
}
// QNX doesn't support Objective-C or Objective-C++ and qcc/q++ don't use toolchainPrefix
compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
compilerPathByLanguage: ({
"c": FileInfo.joinPaths(toolchainInstallPath, cCompilerName),
"cpp": FileInfo.joinPaths(toolchainInstallPath, cxxCompilerName),
"objc": undefined,
"objcpp": undefined,
"asm_cpp": FileInfo.joinPaths(toolchainInstallPath, cCompilerName)
})
toolchainPrefix: target + "-"
targetVendor: ["x86", "x86_64"].includes(qbs.architecture) ? "pc" : base
targetSystem: "nto"
targetAbi: "qnx" + qnx.version + (qnxTargetArchName === "armv7le" ? "eabi" : "")
buildEnv: qnx.buildEnv
probeEnv: buildEnv
setupBuildEnvironment: {
for (var key in product.cpp.buildEnv) {
v = new ModUtils.EnvironmentVariable(key);
v.value = product.cpp.buildEnv[key];
v.set();
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/iar.qbs 0000644 0001751 0000166 00000013323 14776170045 020055 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.PathTools
import qbs.Probes
import qbs.Utilities
import "cpp.js" as Cpp
import "iar.js" as IAR
CppModule {
condition: qbs.toolchain && qbs.toolchain.includes("iar")
Probes.BinaryProbe {
id: compilerPathProbe
condition: !toolchainInstallPath && !_skipAllChecks
names: ["iccarm"]
}
Probes.IarProbe {
id: iarProbe
condition: !_skipAllChecks
compilerFilePath: compilerPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
}
Properties {
condition: iarProbe.found
qbs.architecture: iarProbe.architecture
}
qbs.targetPlatform: "none"
compilerVersionMajor: iarProbe.versionMajor
compilerVersionMinor: iarProbe.versionMinor
compilerVersionPatch: iarProbe.versionPatch
endianness: iarProbe.endianness
compilerDefinesByLanguage: iarProbe.compilerDefinesByLanguage
compilerIncludePaths: iarProbe.includePaths
toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined
/* Work-around for QtCreator which expects these properties to exist. */
property string cCompilerName: compilerName
property string cxxCompilerName: compilerName
compilerName: toolchainDetails.compilerName + compilerExtension
compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
assemblerName: toolchainDetails.assemblerName + compilerExtension
assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName)
linkerName: toolchainDetails.linkerName + compilerExtension
linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName)
property string archiverName: toolchainDetails.archiverName + compilerExtension
property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName)
runtimeLibrary: "static"
staticLibrarySuffix: toolchainDetails.staticLibrarySuffix
executableSuffix: toolchainDetails.executableSuffix
objectSuffix: toolchainDetails.objectSuffix
imageFormat: toolchainDetails.imageFormat
enableExceptions: false
enableRtti: false
defineFlag: "-D"
includeFlag: "-I"
systemIncludeFlag: "-I"
preincludeFlag: "--preinclude"
libraryDependencyFlag: ""
libraryPathFlag: toolchainDetails.libraryPathFlag
linkerScriptFlag: toolchainDetails.linkerScriptFlag
property string linkerSilentFlag: toolchainDetails.linkerSilentFlag
property string linkerMapFileFlag: toolchainDetails.linkerMapFileFlag
property string linkerEntryPointFlag: toolchainDetails.linkerEntryPointFlag
toolchainDetails: IAR.toolchainDetails(qbs)
knownArchitectures: ["78k", "arm", "avr", "avr32", "cr16",
"hcs12", "hcs8", "m16c", "m32c", "m68k", "mcs51", "msp430",
"r32c", "rh850", "riscv", "rl78", "rx", "sh", "stm8", "v850"]
Rule {
id: assembler
inputs: ["asm"]
outputFileTags: Cpp.assemblerOutputTags(generateAssemblerListingFiles)
outputArtifacts: Cpp.assemblerOutputArtifacts(input)
prepare: IAR.prepareAssembler.apply(IAR, arguments)
}
FileTagger {
patterns: ["*.s", "*.s43", "*.s51", "*.s90", "*.msa", "*.asm"]
fileTags: ["asm"]
}
Rule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles)
outputArtifacts: Cpp.compilerOutputArtifacts(input)
prepare: IAR.prepareCompiler.apply(IAR, arguments)
}
Rule {
id: applicationLinker
multiplex: true
inputs: ["obj", "linkerscript"]
inputsFromDependencies: ["staticlibrary"]
outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile)
outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product)
prepare: IAR.prepareLinker.apply(IAR, arguments)
}
Rule {
id: staticLibraryLinker
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary"]
outputFileTags: Cpp.staticLibraryLinkerOutputTags()
outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product)
prepare: IAR.prepareArchiver.apply(IAR, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/darwin.js 0000644 0001751 0000166 00000020746 14776170045 020424 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Codesign = require("../codesign/codesign.js");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Gcc = require("./gcc.js");
var ModUtils = require("qbs.ModUtils");
var PathTools = require("qbs.PathTools");
function lipoOutputArtifacts(product, inputs, fileTag, debugSuffix) {
var buildVariants = [];
for (var i = 0; i < inputs[fileTag].length; ++i) {
var variant = inputs[fileTag][i].qbs.buildVariant;
var suffix = inputs[fileTag][i].cpp.variantSuffix;
if (!buildVariants.some(function (x) { return x.name === variant; }))
buildVariants.push({ name: variant, suffix: suffix });
}
var list = [];
if (fileTag === "dynamiclibrary") {
Array.prototype.push.apply(list, buildVariants.map(function (variant) {
return {
filePath: product.destinationDirectory + "/.sosymbols/"
+ PathTools.dynamicLibraryFilePath(product, variant.suffix),
fileTags: ["dynamiclibrary_symbols"],
qbs: { buildVariant: variant.name },
cpp: { variantSuffix: variant.suffix },
alwaysUpdated: false
};
}));
buildVariants.forEach(function (variant) {
Array.prototype.push.apply(list, Gcc.librarySymlinkArtifacts(product, variant.suffix));
});
}
// Bundles should have a "normal" variant. In the case of frameworks, they cannot normally be
// linked to without a default variant unless a variant is specifically chosen at link time
// by passing the full path to the shared library executable instead of the -framework switch.
// Technically this doesn't affect qbs since qbs always uses full paths for internal
// dependencies but the "normal" variant is always the one that is linked to, since the
// alternative variants should only be chosen at runtime using the DYLD_IMAGE_SUFFIX variable.
// So for frameworks we'll create a symlink to the "default" variant as chosen by the user
// (we cannot do this automatically since the user must tell us which variant should be
// preferred, if there are multiple alternative variants). Applications are fine without a
// symlink but still need an explicitly chosen variant to set as the CFBundleExecutable so that
// Finder/LaunchServices can launch it normally but for simplicity we'll just use the symlink
// approach for all bundle types.
var defaultVariant;
if (!buildVariants.some(function (x) { return x.name === "release"; })
&& product.multiplexByQbsProperties.includes("buildVariants")
&& product.qbs.buildVariants && product.qbs.buildVariants.length > 1) {
var defaultBuildVariant = product.qbs.defaultBuildVariant;
buildVariants.map(function (variant) {
if (variant.name === defaultBuildVariant)
defaultVariant = variant;
});
if (!defaultVariant) {
throw new Error("qbs.defaultBuildVariant is '" + defaultBuildVariant + "', but this " +
"variant is not in the qbs.buildVariants list (" +
product.qbs.buildVariants.join(", ") + ")");
}
buildVariants.push({
name: "release",
suffix: "",
isSymLink: true
});
}
Array.prototype.push.apply(list, buildVariants.map(function (variant) {
var tags = ["bundle.input"];
if (variant.isSymLink)
tags.push("bundle.variant_symlink");
else
tags.push(fileTag, "primary");
if (product.codesign.enableCodeSigning)
tags.push("codesign.signed_artifact");
return {
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.linkerOutputFilePath(fileTag, product,
variant.suffix)),
fileTags: tags,
qbs: {
buildVariant: variant.name,
_buildVariantFileName: variant.isSymLink && defaultVariant
? FileInfo.fileName(PathTools.linkerOutputFilePath(
fileTag, product,
defaultVariant.suffix))
: undefined
},
bundle: {
_bundleFilePath: product.destinationDirectory + "/"
+ PathTools.bundleExecutableFilePath(product, variant.suffix)
},
cpp: {
variantSuffix: variant.suffix
}
};
}));
if (debugSuffix)
Array.prototype.push.apply(list, Gcc.debugInfoArtifacts(product, buildVariants,
debugSuffix));
return list;
}
function prepareLipo(project, product, inputs, outputs, input, output) {
var cmd;
var commands = [];
for (var p in inputs)
inputs[p] = inputs[p].filter(function(inp) { return inp.product.name === product.name; });
var allInputs = [].concat.apply([], Object.keys(inputs).map(function (tag) {
return ["application", "dynamiclibrary", "staticlibrary", "loadablemodule"].includes(tag)
? inputs[tag] : [];
}));
(outputs["bundle.variant_symlink"] || []).map(function (symlink) {
cmd = new Command("ln", ["-sfn", symlink.qbs._buildVariantFileName, symlink.filePath]);
cmd.silent = true;
commands.push(cmd);
});
for (var i = 0; i < outputs.primary.length; ++i) {
var vInputs = allInputs.filter(function (f) {
return f.qbs.buildVariant === outputs.primary[i].qbs.buildVariant
}).map(function (f) {
return f.filePath
});
if (vInputs.length > 1 || product.cpp.alwaysUseLipo) {
cmd = new Command(ModUtils.moduleProperty(product, "lipoPath"),
["-create", "-output", outputs.primary[i].filePath].concat(vInputs));
cmd.description = "lipo " + outputs.primary[i].fileName;
cmd.highlight = "linker";
} else {
cmd = new JavaScriptCommand();
cmd.src = vInputs[0];
cmd.dst = outputs.primary[i].filePath;
cmd.sourceCode = function () {
File.copy(src, dst);
};
cmd.silent = true;
}
Array.prototype.push.apply(commands, Gcc.librarySymlinkCommands(outputs, outputs.primary[i]));
commands.push(cmd);
}
commands = commands.concat(
Gcc.separateDebugInfoCommandsDarwin(product, outputs, outputs.primary));
if (outputs.dynamiclibrary_symbols)
Array.prototype.push.apply(commands, Gcc.createSymbolCheckingCommands(product, outputs));
if (product.codesign.enableCodeSigning) {
Array.prototype.push.apply(
commands, Codesign.prepareSign(project, product, inputs, outputs, input, output));
}
return commands;
}
qbs-src-2.6.1/share/qbs/modules/cpp/GenericGCC.qbs 0000644 0001751 0000166 00000064226 14776170045 021203 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.PathTools
import qbs.Probes
import qbs.Process
import qbs.TextFile
import qbs.Utilities
import qbs.UnixUtils
import qbs.WindowsUtils
import 'cpp.js' as Cpp
import 'gcc.js' as Gcc
CppModule {
condition: qbs.toolchain && qbs.toolchain.includes("gcc")
priority: -100
Depends { name: "codesign" }
Probes.GccBinaryProbe {
id: compilerPathProbe
condition: !toolchainInstallPath && !_skipAllChecks
_compilerName: compilerName
_toolchainPrefix: toolchainPrefix
}
// Find the version as early as possible in case other things depend on it,
// for example the question of whether certain flags are supported and which need to be used
// in the GccProbe itself.
Probes.GccVersionProbe {
id: gccVersionProbe
compilerFilePath: compilerPath
environment: probeEnv
}
Probes.GccProbe {
id: gccProbe
condition: !_skipAllChecks
compilerFilePathByLanguage: compilerPathByLanguage
enableDefinesByLanguage: enableCompilerDefinesByLanguage
environment: probeEnv
flags: targetDriverFlags.concat(sysrootFlags)
_sysroot: sysroot
}
property var probeEnv
Probes.BinaryProbe {
id: binutilsProbe
condition: !File.exists(archiverPath) && !_skipAllChecks
names: Gcc.toolNames([archiverName, assemblerName, linkerName, nmName,
objcopyName, stripName], toolchainPrefix)
}
targetLinkerFlags: Gcc.targetFlags("linker", false,
target, targetArch, machineType, qbs.targetOS)
targetAssemblerFlags: Gcc.targetFlags("assembler", assemblerHasTargetOption,
target, targetArch, machineType, qbs.targetOS)
targetDriverFlags: Gcc.targetFlags("compiler", compilerHasTargetOption,
target, targetArch, machineType, qbs.targetOS)
Probe {
id: nmProbe
condition: !_skipAllChecks
property string theNmPath: nmPath
property bool hasDynamicOption
configure: {
var proc = new Process();
try {
hasDynamicOption = proc.exec(theNmPath, ["-D", theNmPath], false) == 0;
console.debug("nm has -D: " + hasDynamicOption);
} finally {
proc.close();
}
}
}
Properties {
condition: gccProbe.found
qbs.architecture: gccProbe.architecture
}
endianness: gccProbe.endianness
compilerDefinesByLanguage: gccProbe.compilerDefinesByLanguage
compilerVersionMajor: gccVersionProbe.versionMajor
compilerVersionMinor: gccVersionProbe.versionMinor
compilerVersionPatch: gccVersionProbe.versionPatch
compilerIncludePaths: gccProbe.includePaths
compilerFrameworkPaths: gccProbe.frameworkPaths
compilerLibraryPaths: gccProbe.libraryPaths
staticLibraryPrefix: "lib"
staticLibrarySuffix: ".a"
precompiledHeaderSuffix: ".gch"
property bool compilerHasTargetOption: qbs.toolchain.includes("clang")
&& Utilities.versionCompare(compilerVersion, "3.1") >= 0
property bool assemblerHasTargetOption: qbs.toolchain.includes("xcode")
&& Utilities.versionCompare(compilerVersion, "7") >= 0
property string target: targetArch
? [targetArch, targetVendor, targetSystem, targetAbi].join("-")
: undefined
property string targetArch: Utilities.canonicalTargetArchitecture(
qbs.architecture, endianness,
targetVendor, targetSystem, targetAbi)
property string targetVendor: "unknown"
property string targetSystem: "unknown"
property string targetAbi: "unknown"
property string toolchainPrefix: compilerPathProbe.found
? compilerPathProbe.tcPrefix
: undefined
toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined
property string binutilsPath: binutilsProbe.found ? binutilsProbe.path : toolchainInstallPath
assemblerName: 'as' + compilerExtension
compilerName: cxxCompilerName
linkerName: 'ld' + compilerExtension
property string archiverName: 'ar' + compilerExtension
property string nmName: 'nm' + compilerExtension
property string objcopyName: "objcopy" + compilerExtension
property string stripName: "strip" + compilerExtension
property string dsymutilName: "dsymutil" + compilerExtension
property string lipoName
property string sysroot: qbs.sysroot
property string syslibroot: sysroot
property stringList sysrootFlags: sysroot ? ["--sysroot=" + sysroot] : []
property string exportedSymbolsCheckMode: "ignore-undefined"
PropertyOptions {
name: "exportedSymbolsCheckMode"
allowedValues: ["strict", "ignore-undefined"]
description: "Controls when we consider an updated dynamic library as changed with "
+ "regards to other binaries depending on it. The default is \"ignore-undefined\", "
+ "which means we do not care about undefined symbols being added or removed. "
+ "If you do care about that, e.g. because you link dependent products with an option "
+ "such as \"--no-undefined\", then you should set this property to \"strict\"."
}
property string linkerVariant
PropertyOptions {
name: "linkerVariant"
allowedValues: ["bfd", "gold", "lld", "mold"]
description: "Allows to specify the linker variant. Maps to gcc's and clang's -fuse-ld "
+ "option."
}
Properties {
condition: linkerVariant
driverLinkerFlags: "-fuse-ld=" + linkerVariant
}
property string toolchainPathPrefix: Gcc.pathPrefix(toolchainInstallPath, toolchainPrefix)
property string binutilsPathPrefix: Gcc.pathPrefix(binutilsPath, toolchainPrefix)
property string cCompilerName: (qbs.toolchain.includes("clang") ? "clang" : "gcc")
+ compilerExtension
property string cxxCompilerName: (qbs.toolchain.includes("clang") ? "clang++" : "g++")
+ compilerExtension
compilerPathByLanguage: ({
"c": toolchainPathPrefix + cCompilerName,
"cpp": toolchainPathPrefix + cxxCompilerName,
"cppm": toolchainPathPrefix + cxxCompilerName,
"objc": toolchainPathPrefix + cCompilerName,
"objcpp": toolchainPathPrefix + cxxCompilerName,
"asm_cpp": toolchainPathPrefix + cCompilerName
})
assemblerPath: binutilsPathPrefix + assemblerName
compilerPath: toolchainPathPrefix + compilerName
linkerPath: binutilsPathPrefix + linkerName
property string archiverPath: binutilsPathPrefix + archiverName
property string nmPath: binutilsPathPrefix + nmName
property bool _nmHasDynamicOption: nmProbe.hasDynamicOption
property string objcopyPath: binutilsPathPrefix + objcopyName
property string stripPath: binutilsPathPrefix + stripName
property string dsymutilPath: toolchainPathPrefix + dsymutilName
property string lipoPath
property stringList dsymutilFlags
property bool alwaysUseLipo: false
defineFlag: "-D"
includeFlag: "-I"
systemIncludeFlag: "-isystem"
preincludeFlag: "-include"
libraryPathFlag: "-L"
linkerScriptFlag: "-T"
readonly property bool shouldCreateSymlinks: {
return createSymlinks && internalVersion && ["macho", "elf"].includes(imageFormat);
}
readonly property bool shouldSignArtifacts: codesign._canSignArtifacts
&& codesign.enableCodeSigning
// codesigning is done during the lipo step
&& !product.multiplexed
property string internalVersion: {
if (product.version === undefined)
return undefined;
var coreVersion = product.version.match("^([0-9]+\.){0,3}[0-9]+");
if (!coreVersion)
return undefined;
var maxVersionParts = 3;
var versionParts = coreVersion[0].split('.').slice(0, maxVersionParts);
// pad if necessary
for (var i = versionParts.length; i < maxVersionParts; ++i)
versionParts.push("0");
return versionParts.join('.');
}
property string soVersion: {
if (!internalVersion)
return "";
return internalVersion.split('.')[0];
}
property var buildEnv: {
var env = {};
if (qbs.toolchain.includes("mingw"))
env.PATH = toolchainInstallPath; // For libwinpthread etc
return env;
}
compiledModuleSuffix: qbs.toolchain.includes("clang") ? ".pcm" : ".gcm"
moduleOutputFlag: qbs.toolchain.includes("clang") ? "-fmodule-output=" : "%module% "
moduleFileFlag: qbs.toolchain.includes("clang") ? "-fmodule-file=%module%=" : "%module% "
exceptionHandlingModel: {
if (qbs.toolchain.includes("mingw")) {
// https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html claims
// __USING_SJLJ_EXCEPTIONS__ is defined as 1 when using SJLJ exceptions, but there don't
// seem to be defines for the other models, so use the presence of the DLLs for now.
var prefix = toolchainInstallPath;
if (!Host.os().includes("windows"))
prefix = FileInfo.joinPaths(toolchainInstallPath, "..", "lib", "gcc",
toolchainPrefix,
[compilerVersionMajor, compilerVersionMinor].join("."));
var models = ["seh", "sjlj", "dw2"];
for (var i = 0; i < models.length; ++i) {
if (File.exists(FileInfo.joinPaths(prefix, "libgcc_s_" + models[i] + "-1.dll"))) {
return models[i];
}
}
}
return base;
}
validate: {
if (_skipAllChecks)
return;
if (!File.exists(compilerPath)) {
var pathMessage = FileInfo.isAbsolutePath(compilerPath)
? "at '" + compilerPath + "'"
: "'" + compilerPath + "' in PATH";
throw ModUtils.ModuleError("Could not find selected C++ compiler " + pathMessage + ". "
+ "Ensure that the compiler is properly "
+ "installed, or set cpp.toolchainInstallPath to a valid "
+ "toolchain path, or consider whether you meant to set "
+ "cpp.compilerName instead.");
}
var isWrongTriple = false;
if (gccProbe.architecture) {
if (Utilities.canonicalArchitecture(architecture)
!== Utilities.canonicalArchitecture(gccProbe.architecture))
isWrongTriple = true;
} else if (architecture) {
// This is a warning and not an error on the rare chance some new architecture comes
// about which qbs does not know about the macros of. But it *might* still work.
console.warn("Unknown architecture '" + architecture + "' " +
"may not be supported by this compiler.");
}
if (gccProbe.endianness) {
if (endianness !== gccProbe.endianness)
isWrongTriple = true;
} else if (endianness) {
console.warn("Could not detect endianness ('"
+ endianness + "' given)");
}
if (gccProbe.targetPlatform) {
// Can't differentiate Darwin OSes at the compiler level alone
if (gccProbe.targetPlatform === "darwin"
? !qbs.targetOS.includes("darwin")
: qbs.targetPlatform !== gccProbe.targetPlatform)
isWrongTriple = true;
} else if (qbs.targetPlatform) {
console.warn("Could not detect target platform ('"
+ qbs.targetPlatform + "' given)");
}
if (isWrongTriple) {
var realTriple = [
Utilities.canonicalArchitecture(gccProbe.architecture),
gccProbe.targetPlatform,
gccProbe.endianness ? gccProbe.endianness + "-endian" : undefined
].join("-");
var givenTriple = [
Utilities.canonicalArchitecture(architecture),
qbs.targetPlatform,
endianness ? endianness + "-endian" : undefined
].join("-");
var msg = "The selected compiler '" + compilerPath + "' produces code for '" +
realTriple + "', but '" + givenTriple + "' was given, which is incompatible.";
if (validateTargetTriple) {
msg += " If you are absolutely certain that your configuration is correct " +
"(check the values of the qbs.architecture, qbs.targetPlatform, " +
"and qbs.endianness properties) and that this message has been " +
"emitted in error, set the cpp.validateTargetTriple property to " +
"false. However, you should consider submitting a bug report in any " +
"case.";
throw ModUtils.ModuleError(msg);
} else {
console.warn(msg);
}
}
var validateFlagsFunction = function (value) {
if (value) {
for (var i = 0; i < value.length; ++i) {
if (["-target", "-triple", "-arch"].includes(value[i]))
return false;
}
}
return true;
}
var validator = new ModUtils.PropertyValidator("cpp");
var msg = "'-target', '-triple' and '-arch' cannot appear in flags; set qbs.architecture instead";
validator.addCustomValidator("assemblerFlags", assemblerFlags, validateFlagsFunction, msg);
validator.addCustomValidator("cppFlags", cppFlags, validateFlagsFunction, msg);
validator.addCustomValidator("cFlags", cFlags, validateFlagsFunction, msg);
validator.addCustomValidator("cxxFlags", cxxFlags, validateFlagsFunction, msg);
validator.addCustomValidator("objcFlags", objcFlags, validateFlagsFunction, msg);
validator.addCustomValidator("objcxxFlags", objcxxFlags, validateFlagsFunction, msg);
validator.addCustomValidator("commonCompilerFlags", commonCompilerFlags, validateFlagsFunction, msg);
validator.addCustomValidator("platformAssemblerFlags", platformAssemblerFlags, validateFlagsFunction, msg);
//validator.addCustomValidator("platformCppFlags", platformCppFlags, validateFlagsFunction, msg);
validator.addCustomValidator("platformCFlags", platformCFlags, validateFlagsFunction, msg);
validator.addCustomValidator("platformCxxFlags", platformCxxFlags, validateFlagsFunction, msg);
validator.addCustomValidator("platformObjcFlags", platformObjcFlags, validateFlagsFunction, msg);
validator.addCustomValidator("platformObjcxxFlags", platformObjcxxFlags, validateFlagsFunction, msg);
validator.addCustomValidator("platformCommonCompilerFlags", platformCommonCompilerFlags, validateFlagsFunction, msg);
validator.setRequiredProperty("compilerVersion", compilerVersion);
validator.setRequiredProperty("compilerVersionMajor", compilerVersionMajor);
validator.setRequiredProperty("compilerVersionMinor", compilerVersionMinor);
validator.setRequiredProperty("compilerVersionPatch", compilerVersionPatch);
validator.addVersionValidator("compilerVersion", compilerVersion, 3, 3);
validator.addRangeValidator("compilerVersionMajor", compilerVersionMajor, 1);
validator.addRangeValidator("compilerVersionMinor", compilerVersionMinor, 0);
validator.addRangeValidator("compilerVersionPatch", compilerVersionPatch, 0);
validator.setRequiredProperty("compilerIncludePaths", compilerIncludePaths);
validator.setRequiredProperty("compilerFrameworkPaths", compilerFrameworkPaths);
validator.setRequiredProperty("compilerLibraryPaths", compilerLibraryPaths);
validator.validate();
}
// Product should be linked if it's not multiplexed or aggregated at all,
// or if it is multiplexed, if it's not the aggregate product
readonly property bool shouldLink: !(product.multiplexed || product.aggregate)
|| product.multiplexConfigurationId
Group {
condition: shouldLink
Rule {
name: "dynamicLibraryLinker"
multiplex: true
inputs: {
var tags = ["obj", "res", "linkerscript", "versionscript"];
if (product.bundle && product.bundle.embedInfoPlist
&& product.qbs.targetOS.includes("darwin")) {
tags.push("aggregate_infoplist");
}
return tags;
}
inputsFromDependencies: ["dynamiclibrary_symbols", "staticlibrary", "dynamiclibrary_import"]
outputFileTags: {
var tags = ["bundle.input", "dynamiclibrary", "dynamiclibrary_symlink",
"dynamiclibrary_symbols", "debuginfo_dll", "debuginfo_bundle",
"dynamiclibrary_import", "debuginfo_plist"];
if (product.cpp.shouldSignArtifacts)
tags.push("codesign.signed_artifact");
return tags;
}
outputArtifacts: Gcc.dynamicLibLinkerOutputArtifacts(product)
prepare: Gcc.prepareLinker.apply(Gcc, arguments)
}
Rule {
name: "staticLibraryLinker"
multiplex: true
inputs: ["obj", "res", "linkerscript"]
inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
outputFileTags: ["bundle.input", "staticlibrary", "c_staticlibrary", "cpp_staticlibrary"]
outputArtifacts: Gcc.staticLibLinkerOutputArtifacts(product, inputs)
prepare: Gcc.staticLibLinkerCommands.apply(Gcc, arguments)
}
Rule {
name: "loadableModuleLinker"
multiplex: true
inputs: {
var tags = ["obj", "res", "linkerscript"];
if (product.bundle && product.bundle.embedInfoPlist
&& product.qbs.targetOS.includes("darwin")) {
tags.push("aggregate_infoplist");
}
return tags;
}
inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
outputFileTags: {
var tags = ["bundle.input", "loadablemodule", "debuginfo_loadablemodule",
"debuginfo_bundle", "debuginfo_plist"];
if (product.cpp.shouldSignArtifacts)
tags.push("codesign.signed_artifact");
return tags;
}
outputArtifacts: Gcc.moduleLinkerOutputArtifacts(product)
prepare: Gcc.prepareLinker.apply(Gcc, arguments)
}
Rule {
name: "applicationLinker"
multiplex: true
inputs: {
var tags = ["obj", "res", "linkerscript"];
if (product.bundle && product.bundle.embedInfoPlist
&& product.qbs.targetOS.includes("darwin")) {
tags.push("aggregate_infoplist");
}
return tags;
}
inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
outputFileTags: {
var tags = ["bundle.input", "application", "debuginfo_app", "debuginfo_bundle",
"debuginfo_plist"];
if (product.cpp.shouldSignArtifacts)
tags.push("codesign.signed_artifact");
if (product.cpp.generateLinkerMapFile)
tags.push("mem_map");
if(product.qbs.toolchain.includes("emscripten"))
tags.push("wasm")
return tags;
}
outputArtifacts: Gcc.appLinkerOutputArtifacts(product)
prepare: Gcc.prepareLinker.apply(Gcc, arguments)
}
}
Rule {
name: "cpp_compiler"
inputs: ["cpp", "cppm", "c", "objcpp", "objc", "asm_cpp"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
explicitlyDependsOn: ["c_pch", "cpp_pch", "objc_pch", "objcpp_pch"]
outputFileTags: Cpp.compilerOutputTags(/*withListingFiles*/ false, /*withCxxModules*/ true)
.concat(["c_obj", "cpp_obj"])
outputArtifacts: Cpp.compilerOutputArtifacts(input, inputs, /*withCxxModules*/ true)
prepare: Gcc.prepareCompiler.apply(Gcc, arguments)
}
Rule {
name: "assembler"
inputs: ["asm"]
outputFileTags: Cpp.assemblerOutputTags(false)
outputArtifacts: Cpp.assemblerOutputArtifacts(input)
prepare: Gcc.prepareAssembler.apply(Gcc, arguments)
}
Rule {
condition: useCPrecompiledHeader
inputs: ["c_pch_src"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.precompiledHeaderOutputTags("c", false)
outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "c", false)
prepare: Gcc.prepareCompiler.apply(Gcc, arguments)
}
Rule {
condition: useCxxPrecompiledHeader
inputs: ["cpp_pch_src"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.precompiledHeaderOutputTags("cpp", false)
outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "cpp", false)
prepare: Gcc.prepareCompiler.apply(Gcc, arguments)
}
Rule {
condition: useObjcPrecompiledHeader
inputs: ["objc_pch_src"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.precompiledHeaderOutputTags("objc", false)
outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "objc", false)
prepare: Gcc.prepareCompiler.apply(Gcc, arguments)
}
Rule {
condition: useObjcxxPrecompiledHeader
inputs: ["objcpp_pch_src"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.precompiledHeaderOutputTags("objcpp", false)
outputArtifacts: Cpp.precompiledHeaderOutputArtifacts(input, product, "objcpp", false)
prepare: Gcc.prepareCompiler.apply(Gcc, arguments)
}
FileTagger {
patterns: "*.s"
fileTags: ["asm"]
}
FileTagger {
patterns: "*.S"
fileTags: ["asm_cpp"]
}
FileTagger {
patterns: "*.sx"
fileTags: ["asm_cpp"]
}
Scanner {
inputs: ["linkerscript"]
recursive: true
scan: {
console.debug("scanning linkerscript " + filePath + " for dependencies");
var retval = [];
var linkerScript = new TextFile(filePath, TextFile.ReadOnly);
var regexp = /[\s]*INCLUDE[\s]+(\S+).*/ // "INCLUDE filename"
var match;
while (!linkerScript.atEof()) {
match = regexp.exec(linkerScript.readLine());
if (match) {
var dependencyFileName = match[1];
retval.push(dependencyFileName);
console.debug("linkerscript " + filePath + " depends on " + dependencyFileName);
}
}
linkerScript.close();
return retval;
}
searchPaths: {
var retval = [];
for (var i = 0; i < (product.cpp.libraryPaths || []).length; i++)
retval.push(product.cpp.libraryPaths[i]);
var regexp = /[\s]*SEARCH_DIR\((\S+)\).*/ // "SEARCH_DIR(path)"
var match;
var linkerScript = new TextFile(input.filePath, TextFile.ReadOnly);
while (!linkerScript.atEof()) {
match = regexp.exec(linkerScript.readLine());
if(match) {
var additionalPath = match[1];
// path can be quoted to use non-latin letters, remove quotes if present
if (additionalPath.startsWith("\"") && additionalPath.endsWith("\""))
additionalPath = additionalPath.slice(1, additionalPath.length - 1);
retval.push(additionalPath);
}
}
linkerScript.close();
return retval;
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/android-gcc.qbs 0000644 0001751 0000166 00000017135 14776170045 021461 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.TextFile
import qbs.Utilities
import "../../modules/Android/ndk/utils.js" as NdkUtils
import 'gcc.js' as Gcc
LinuxGCC {
Depends { name: "Android.ndk" }
condition: qbs.targetOS.includes("android") && qbs.toolchain && qbs.toolchain.includes("llvm")
priority: 2
rpaths: []
// toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/x86_64-linux-android
cxxLanguageVersion: "c++14"
property string archLibsDir: {
switch (qbs.architecture) {
case "arm64":
return "aarch64";
case "armv7a":
return "arm";
case "x86_64":
return qbs.architecture;
case "x86":
return "i686";
}
}
property string targetDir: "android" + (["armeabi", "armeabi-v7a"].includes(Android.ndk.abi) ? "eabi" : "")
property string triple: [archLibsDir, targetSystem, targetDir].join("-")
property string libsDir: FileInfo.joinPaths(sysroot, "usr", "lib", triple);
property string sharedStlFilePath: (libsDir && Android.ndk.appStl.endsWith("_shared"))
? FileInfo.joinPaths(libsDir, dynamicLibraryPrefix + Android.ndk.appStl + dynamicLibrarySuffix)
: undefined
property string staticStlFilePath: (libsDir && Android.ndk.appStl.endsWith("_static"))
? FileInfo.joinPaths(libsDir, Android.ndk.platformVersion,
NdkUtils.stlFileName(staticLibraryPrefix, Android.ndk,
staticLibrarySuffix))
: undefined
toolchainInstallPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains",
"llvm", "prebuilt",
Android.ndk.hostArch, "bin")
property string toolchainTriple: [targetAbi === "androideabi" ? "arm" : targetArch,
targetSystem, targetAbi].join("-")
internalVersion: undefined
toolchainPrefix: undefined
machineType: {
if (Android.ndk.abi === "armeabi-v7a")
return "armv7-a";
}
qbs.optimization: targetAbi === "androideabi" ? "small" : base
enableExceptions: Android.ndk.appStl !== "system"
enableRtti: Android.ndk.appStl !== "system"
commonCompilerFlags: NdkUtils.commonCompilerFlags(qbs.toolchain, qbs.buildVariant, Android.ndk)
linkerFlags: NdkUtils.commonLinkerFlags(Android.ndk);
driverLinkerFlags: {
var flags = ["-fuse-ld=lld", "-Wl,--exclude-libs,libgcc.a", "-nostdlib++"];
// See https://android.googlesource.com/platform/ndk/+/ndk-release-r21/docs/BuildSystemMaintainers.md#Unwinding
if (Android.ndk.abi === "armeabi-v7a") {
flags = flags.concat(["-Wl,--exclude-libs,libgcc_real.a"]);
if (Android.ndk.appStl.startsWith("c++"))
flags = flags.concat(["-Wl,--exclude-libs,libunwind.a"]);
}
return flags;
}
platformDriverFlags: ["-fdata-sections", "-ffunction-sections", "-funwind-tables",
"-fstack-protector-strong", "-no-canonical-prefixes"]
dynamicLibraries: {
var libs = ["c", "m"];
if (sharedStlFilePath)
libs.push(FileInfo.joinPaths(libsDir, Android.ndk.platformVersion,
NdkUtils.stlFileName(dynamicLibraryPrefix, Android.ndk,
dynamicLibrarySuffix)));
return libs;
}
staticLibraries: staticStlFilePath
// When using ndk r19c, llvm doesn't add sysroot/usr/include/c++/v1 to the path
// But it works starting with ndk r20b
systemIncludePaths: (Utilities.versionCompare(Android.ndk.version, "20") < 0) ?
FileInfo.joinPaths(sysroot, "usr", "include", "c++", "v1") : []
defines: ["ANDROID", "__ANDROID__"]
binutilsPath: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains", "llvm", "prebuilt",
Android.ndk.hostArch, "bin");
binutilsPathPrefix: FileInfo.joinPaths(binutilsPath, "llvm-")
sysroot: FileInfo.joinPaths(Android.ndk.ndkDir, "toolchains", "llvm", "prebuilt",
Android.ndk.hostArch, "sysroot")
targetArch: {
switch (qbs.architecture) {
case "arm64":
return "aarch64";
case "armv5":
case "armv5te":
return "armv5te";
case "armv7a":
case "x86_64":
return qbs.architecture;
case "x86":
return "i686";
}
}
target: [targetArch, targetSystem, targetAbi].join("-")
targetSystem: "linux"
targetAbi: "android" + (["armeabi", "armeabi-v7a"].includes(Android.ndk.abi) ? "eabi" : "") +
Android.ndk.platformVersion
endianness: "little"
Group {
condition: shouldLink
Group {
name: "Android STL"
condition: module.sharedStlFilePath
files: module.sharedStlFilePath ? [module.sharedStlFilePath] : []
fileTags: "android.stl"
}
Rule {
inputs: "dynamiclibrary"
Artifact {
filePath: FileInfo.joinPaths("stripped-libs", input.fileName)
fileTags: "android.nativelibrary"
}
prepare: {
var stripArgs = ["--strip-all", "-o", output.filePath, input.filePath];
var stripCmd = new Command(product.cpp.stripPath, stripArgs);
stripCmd.description = "stripping unneeded symbols from " + input.fileName;
return stripCmd;
}
}
}
_skipAllChecks: !shouldLink
validate: {
if (_skipAllChecks)
return;
var baseValidator = new ModUtils.PropertyValidator("qbs");
baseValidator.addCustomValidator("architecture", targetArch, function (value) {
return value !== undefined;
}, "unknown Android architecture '" + qbs.architecture + "'.");
var validator = new ModUtils.PropertyValidator("cpp");
validator.setRequiredProperty("targetArch", targetArch);
return baseValidator.validate() && validator.validate();
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/watcom.qbs 0000644 0001751 0000166 00000016230 14776170045 020574 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2022 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs 1.0
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.Probes
import "cpp.js" as Cpp
import "watcom.js" as WATCOM
CppModule {
condition: qbs.toolchain && qbs.toolchain.includes("watcom")
Probes.BinaryProbe {
id: compilerPathProbe
condition: !toolchainInstallPath && !_skipAllChecks
names: ["owcc"]
}
Probes.WatcomProbe {
id: watcomProbe
condition: !_skipAllChecks
compilerFilePath: compilerPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
_pathListSeparator: qbs.pathListSeparator
_toolchainInstallPath: toolchainInstallPath
_targetPlatform: qbs.targetPlatform
_targetArchitecture: qbs.architecture
}
Properties {
condition: watcomProbe.found
qbs.architecture: watcomProbe.architecture
qbs.targetPlatform: watcomProbe.targetPlatform
}
compilerVersionMajor: watcomProbe.versionMajor
compilerVersionMinor: watcomProbe.versionMinor
compilerVersionPatch: watcomProbe.versionPatch
endianness: watcomProbe.endianness
compilerDefinesByLanguage: watcomProbe.compilerDefinesByLanguage
compilerIncludePaths: watcomProbe.includePaths
toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined
/* Work-around for QtCreator which expects these properties to exist. */
property string cCompilerName: compilerName
property string cxxCompilerName: compilerName
compilerName: "owcc" + compilerExtension
compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
assemblerName: "wasm" + compilerExtension
assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName)
linkerName: "wlink" + compilerExtension
linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName)
property string disassemblerName: "wdis" + compilerExtension
property string disassemblerPath: FileInfo.joinPaths(toolchainInstallPath,
disassemblerName)
property string resourceCompilerName: "wrc" + compilerExtension
property string resourceCompilerPath: FileInfo.joinPaths(toolchainInstallPath,
resourceCompilerName)
property string libraryManagerName: "wlib" + compilerExtension
property string libraryManagerPath: FileInfo.joinPaths(toolchainInstallPath,
libraryManagerName)
runtimeLibrary: "dynamic"
staticLibrarySuffix: ".lib"
dynamicLibrarySuffix: toolchainDetails.dynamicLibrarySuffix
executableSuffix: toolchainDetails.executableSuffix
objectSuffix: ".obj"
imageFormat: toolchainDetails.imageFormat
defineFlag: "-D"
includeFlag: "-I"
systemIncludeFlag: "-I"
preincludeFlag: "-include"
libraryDependencyFlag: "-l"
libraryPathFlag: "-L"
linkerScriptFlag: ""
toolchainDetails: WATCOM.toolchainDetails(qbs)
knownArchitectures: ["x86", "x86_16"]
property var buildEnv: watcomProbe.environment
setupBuildEnvironment: {
for (var key in product.cpp.buildEnv) {
var v = new ModUtils.EnvironmentVariable(key, product.qbs.pathListSeparator);
v.prepend(product.cpp.buildEnv[key]);
v.set();
}
}
Rule {
id: assembler
inputs: ["asm"]
outputFileTags: Cpp.assemblerOutputTags(generateAssemblerListingFiles)
outputArtifacts: Cpp.assemblerOutputArtifacts(input)
prepare: WATCOM.prepareAssembler.apply(WATCOM, arguments)
}
FileTagger {
patterns: ["*.asm"]
fileTags: ["asm"]
}
Rule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles)
outputArtifacts: Cpp.compilerOutputArtifacts(input)
prepare: WATCOM.prepareCompiler.apply(WATCOM, arguments)
}
Rule {
id: rccCompiler
inputs: ["rc"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.resourceCompilerOutputTags()
outputArtifacts: Cpp.resourceCompilerOutputArtifacts(input)
prepare: WATCOM.prepareResourceCompiler.apply(WATCOM, arguments)
}
FileTagger {
patterns: ["*.rc"]
fileTags: ["rc"]
}
Rule {
id: applicationLinker
multiplex: true
inputs: ["obj", "res", "linkerscript"]
inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"]
outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile)
outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product)
prepare: WATCOM.prepareLinker.apply(WATCOM, arguments)
}
Rule {
id: dynamicLibraryLinker
condition: qbs.targetOS.includes("windows")
multiplex: true
inputs: ["obj", "res"]
inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"]
outputFileTags: Cpp.dynamicLibraryLinkerOutputTags();
outputArtifacts: Cpp.dynamicLibraryLinkerOutputArtifacts(product)
prepare: WATCOM.prepareLinker.apply(WATCOM, arguments)
}
Rule {
id: libraryManager
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"]
outputFileTags: Cpp.staticLibraryLinkerOutputTags()
outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product)
prepare: WATCOM.prepareLibraryManager.apply(WATCOM, arguments)
}
JobLimit {
jobPool: "watcom_job_pool"
jobCount: 1
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/gcc.js 0000644 0001751 0000166 00000210221 14776170045 017661 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Codesign = require("../codesign/codesign.js");
var Cpp = require("cpp.js");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Host = require("qbs.Host");
var DarwinTools = require("qbs.DarwinTools");
var ModUtils = require("qbs.ModUtils");
var PathTools = require("qbs.PathTools");
var Process = require("qbs.Process");
var TextFile = require("qbs.TextFile");
var UnixUtils = require("qbs.UnixUtils");
var Utilities = require("qbs.Utilities");
var WindowsUtils = require("qbs.WindowsUtils");
function effectiveLinkerPath(product, inputs) {
if (product.cpp.linkerMode === "automatic") {
var compilers = product.cpp.compilerPathByLanguage;
if (compilers) {
if (inputs.cpp_obj || inputs.cpp_staticlibrary) {
console.log("Found C++ or Objective-C++ objects, choosing C++ linker for "
+ product.name);
return compilers["cpp"];
}
if (inputs.c_obj || inputs.c_staticlibrary) {
console.log("Found C or Objective-C objects, choosing C linker for "
+ product.name);
return compilers["c"];
}
}
console.log("Found no C-language objects, choosing system linker for "
+ product.name);
}
return product.cpp.linkerPath;
}
function useCompilerDriverLinker(product, inputs) {
var linker = effectiveLinkerPath(product, inputs);
var compilers = product.cpp.compilerPathByLanguage;
if (compilers) {
return linker === compilers["cpp"]
|| linker === compilers["c"];
}
return linker === product.cpp.compilerPath;
}
function collectLibraryDependencies(product, isDarwin) {
var publicDeps = {};
var privateDeps = {};
var objects = [];
var objectByFilePath = {};
var tagForLinkingAgainstSharedLib = product.cpp.imageFormat === "pe"
? "dynamiclibrary_import" : "dynamiclibrary";
var removeDuplicateLibraries = product.cpp.removeDuplicateLibraries
function addObject(obj, addFunc) {
/* If the object is already known, remove its previous usage and insert
* it again in the new desired position. This preserves the order of
* the other objects, and is analogous to what qmake does (see the
* mergeLflags parameter in UnixMakefileGenerator::findLibraries()).
*/
if (removeDuplicateLibraries && (obj.filePath in objectByFilePath)) {
var oldObj = objectByFilePath[obj.filePath];
var i = objects.indexOf(oldObj);
if (i >= 0)
objects.splice(i, 1);
}
addFunc.call(objects, obj);
objectByFilePath[obj.filePath] = obj;
}
function addPublicFilePath(filePath, dep) {
var existing = objectByFilePath[filePath];
var wholeArchive = dep.parameters.cpp && dep.parameters.cpp.linkWholeArchive;
var symbolLinkMode = dep.parameters.cpp && dep.parameters.cpp.symbolLinkMode;
if (existing) {
existing.direct = true;
existing.wholeArchive = wholeArchive;
existing.symbolLinkMode = symbolLinkMode;
} else {
addObject({ direct: true, filePath: filePath,
wholeArchive: wholeArchive, symbolLinkMode: symbolLinkMode },
Array.prototype.unshift);
}
}
function addPrivateFilePath(filePath) {
var existing = objectByFilePath[filePath];
if (!existing)
addObject({ direct: false, filePath: filePath }, Array.prototype.unshift);
}
function addArtifactFilePaths(dep, tag, addFunction) {
var artifacts = dep.artifacts[tag];
if (!artifacts)
return;
var artifactFilePaths = artifacts.map(function(a) { return a.filePath; });
for (var i = 0; i < artifactFilePaths.length; ++i)
addFunction(artifactFilePaths[i], dep);
}
function addExternalLibs(obj) {
if (!obj.cpp)
return;
function ensureArray(a) {
return (a instanceof Array) ? a : [];
}
function sanitizedModuleListProperty(obj, moduleName, propertyName) {
return ensureArray(ModUtils.sanitizedModuleProperty(obj, moduleName, propertyName));
}
var externalLibs = [].concat(
ensureArray(sanitizedModuleListProperty(obj, "cpp", "staticLibraries")),
ensureArray(sanitizedModuleListProperty(obj, "cpp", "dynamicLibraries")));
for (var i = 0, len = externalLibs.length; i < len; ++i)
addObject({ direct: true, filePath: externalLibs[i] }, Array.prototype.push);
if (isDarwin) {
externalLibs = [].concat(
ensureArray(sanitizedModuleListProperty(obj, "cpp", "frameworks")));
for (var i = 0, len = externalLibs.length; i < len; ++i)
addObject({ direct: true, filePath: externalLibs[i], framework: true },
Array.prototype.push);
externalLibs = [].concat(
ensureArray(sanitizedModuleListProperty(obj, "cpp", "weakFrameworks")));
for (var i = 0, len = externalLibs.length; i < len; ++i)
addObject({ direct: true, filePath: externalLibs[i], framework: true,
symbolLinkMode: "weak" }, Array.prototype.push);
}
}
function traverse(dep, isBelowIndirectDynamicLib) {
if (publicDeps[dep.name])
return;
if (dep.parameters.cpp && dep.parameters.cpp.link === false)
return;
var isStaticLibrary = typeof dep.artifacts["staticlibrary"] !== "undefined";
var isDynamicLibrary = !isStaticLibrary
&& typeof dep.artifacts[tagForLinkingAgainstSharedLib] !== "undefined";
if (!isStaticLibrary && !isDynamicLibrary)
return;
if (isBelowIndirectDynamicLib && privateDeps[dep.name])
return;
var nextIsBelowIndirectDynamicLib = isBelowIndirectDynamicLib || isDynamicLibrary;
dep.dependencies.forEach(function(depdep) {
// If "dep" is an aggregate product, and "depdep" is one of the multiplexed variants
// of the same product, we don't want to depend on the multiplexed variants, because
// that could mean linking more than one time against the same library. Instead skip
// the multiplexed dependency, and depend only on the aggregate one.
if (depdep.name === dep.name)
return;
traverse(depdep, nextIsBelowIndirectDynamicLib);
});
if (isStaticLibrary) {
if (!isBelowIndirectDynamicLib) {
addArtifactFilePaths(dep, "staticlibrary", addPublicFilePath);
if (product.cpp.importPrivateLibraries)
addExternalLibs(dep);
publicDeps[dep.name] = true;
}
} else if (isDynamicLibrary) {
if (!isBelowIndirectDynamicLib) {
addArtifactFilePaths(dep, tagForLinkingAgainstSharedLib, addPublicFilePath);
publicDeps[dep.name] = true;
} else {
addArtifactFilePaths(dep, tagForLinkingAgainstSharedLib, addPrivateFilePath);
privateDeps[dep.name] = true;
}
}
}
function traverseDirectDependency(dep) {
traverse(dep, false);
}
product.dependencies.forEach(traverseDirectDependency);
addExternalLibs(product);
var result = { libraries: [], rpath_link: [] };
objects.forEach(
function (obj) {
if (obj.direct) {
result.libraries.push({ filePath: obj.filePath,
wholeArchive: obj.wholeArchive,
symbolLinkMode: obj.symbolLinkMode,
framework: obj.framework });
} else {
var dirPath = FileInfo.path(obj.filePath);
result.rpath_link.push(dirPath);
}
});
return result;
}
function escapeLinkerFlags(product, inputs, linkerFlags) {
if (!linkerFlags || linkerFlags.length === 0)
return [];
if (useCompilerDriverLinker(product, inputs)) {
var sep = ",";
var useXlinker = linkerFlags.some(function (f) { return f.includes(sep); });
if (useXlinker) {
// One or more linker arguments contain the separator character itself
// Use -Xlinker to handle these
var xlinkerFlags = [];
linkerFlags.map(function (linkerFlag) {
if (product.cpp.enableSuspiciousLinkerFlagWarnings
&& linkerFlag.startsWith("-Wl,")) {
console.warn("Encountered escaped linker flag '" + linkerFlag + "'. This may " +
"cause the target to fail to link. Please do not escape these " +
"flags manually; qbs does that for you.");
}
xlinkerFlags.push("-Xlinker", linkerFlag);
});
return xlinkerFlags;
}
if (product.cpp.enableSuspiciousLinkerFlagWarnings && linkerFlags.includes("-Xlinker")) {
console.warn("Encountered -Xlinker linker flag escape sequence. This may cause the " +
"target to fail to link. Please do not escape these flags manually; " +
"qbs does that for you.");
}
// If no linker arguments contain the separator character we can just use -Wl,
// which is more compact and easier to read in logs
return [["-Wl"].concat(linkerFlags).join(sep)];
}
return linkerFlags;
}
function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPath) {
var isDarwin = product.qbs.targetOS.includes("darwin");
var libraryDependencies = collectLibraryDependencies(product, isDarwin);
var rpaths = (product.cpp.useRPaths !== false) ? product.cpp.rpaths : undefined;
var systemRunPaths = product.cpp.systemRunPaths || [];
var canonicalSystemRunPaths = systemRunPaths.map(function(p) {
return File.canonicalFilePath(p);
});
var i, args = additionalCompilerAndLinkerFlags(product);
var escapableLinkerFlags = [];
if (primaryOutput.fileTags.includes("dynamiclibrary")) {
if (isDarwin) {
args.push((function () {
var tags = ["c", "cpp", "cppm", "objc", "objcpp", "asm_cpp"];
for (var i = 0; i < tags.length; ++i) {
if (linkerPath === product.cpp.compilerPathByLanguage[tags[i]])
return "-dynamiclib";
}
return "-dylib"; // for ld64
})());
} else {
args.push("-shared");
}
if (isDarwin) {
if (product.cpp.internalVersion)
args.push("-current_version", product.cpp.internalVersion);
escapableLinkerFlags.push("-install_name", UnixUtils.soname(product,
primaryOutput.fileName));
} else if (product.cpp.imageFormat === "elf") {
escapableLinkerFlags.push("-soname=" + UnixUtils.soname(product,
primaryOutput.fileName));
}
}
if (primaryOutput.fileTags.includes("loadablemodule"))
args.push(isDarwin ? "-bundle" : "-shared");
if (primaryOutput.fileTags.containsAny(["dynamiclibrary", "loadablemodule"])) {
if (isDarwin)
escapableLinkerFlags.push("-headerpad_max_install_names");
else if (product.cpp.imageFormat === "elf")
escapableLinkerFlags.push("--as-needed");
}
if (isLegacyQnxSdk(product)) {
["c", "cpp"].map(function (tag) {
if (linkerPath === product.cpp.compilerPathByLanguage[tag])
args = args.concat(qnxLangArgs(product, tag));
});
}
var targetLinkerFlags = product.cpp.targetLinkerFlags;
if (targetLinkerFlags)
Array.prototype.push.apply(escapableLinkerFlags, targetLinkerFlags);
var sysroot = product.cpp.syslibroot;
if (sysroot) {
if (product.qbs.toolchain.includes("qcc"))
escapableLinkerFlags.push("--sysroot=" + sysroot);
else if (isDarwin)
escapableLinkerFlags.push("-syslibroot", sysroot);
else
args.push("--sysroot=" + sysroot); // do not escape, compiler-as-linker also needs it
}
if (product.cpp.allowUnresolvedSymbols) {
if (isDarwin)
escapableLinkerFlags.push("-undefined", "suppress");
else
escapableLinkerFlags.push("--unresolved-symbols=ignore-all");
}
function fixupRPath(rpath) {
// iOS, tvOS, watchOS, and others, are fine
if (!product.qbs.targetOS.includes("macos"))
return rpath;
// ...as are newer versions of macOS
var min = product.cpp.minimumMacosVersion;
if (min && Utilities.versionCompare(min, "10.10") >= 0)
return rpath;
// In older versions of dyld, a trailing slash is required
if (!rpath.endsWith("/"))
return rpath + "/";
return rpath;
}
function isNotSystemRunPath(p) {
return !FileInfo.isAbsolutePath(p) || (!systemRunPaths.includes(p)
&& !canonicalSystemRunPaths.includes(File.canonicalFilePath(p)));
};
if (!product.qbs.targetOS.includes("windows")) {
for (i in rpaths) {
if (isNotSystemRunPath(rpaths[i]))
escapableLinkerFlags.push("-rpath", fixupRPath(rpaths[i]));
}
}
if (product.cpp.entryPoint)
escapableLinkerFlags.push("-e", product.cpp.entryPoint);
if (product.qbs.toolchain.includes("mingw")) {
if (product.consoleApplication !== undefined)
escapableLinkerFlags.push("-subsystem",
product.consoleApplication ? "console" : "windows");
var minimumWindowsVersion = product.cpp.minimumWindowsVersion;
if (minimumWindowsVersion) {
// workaround for QBS-1724, mingw seems to be broken
if (Utilities.versionCompare(minimumWindowsVersion, "6.2") > 0)
minimumWindowsVersion = "6.2";
var subsystemVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'subsystem');
if (subsystemVersion) {
var major = subsystemVersion.split('.')[0];
var minor = subsystemVersion.split('.')[1];
// http://sourceware.org/binutils/docs/ld/Options.html
escapableLinkerFlags.push("--major-subsystem-version", major,
"--minor-subsystem-version", minor,
"--major-os-version", major,
"--minor-os-version", minor);
}
}
}
if (inputs.aggregate_infoplist)
args.push("-sectcreate", "__TEXT", "__info_plist", inputs.aggregate_infoplist[0].filePath);
var isLinkingCppObjects = !!(inputs.cpp_obj || inputs.cpp_staticlibrary);
var stdlib = isLinkingCppObjects
? product.cpp.cxxStandardLibrary
: undefined;
if (stdlib && product.qbs.toolchain.includes("clang"))
args.push("-stdlib=" + stdlib);
// Flags for library search paths
var allLibraryPaths = Cpp.collectLibraryPaths(product);
var builtIns = product.cpp.compilerLibraryPaths
allLibraryPaths = allLibraryPaths.filter(function(p) { return !builtIns.includes(p); });
args = args.concat(allLibraryPaths.map(function(path) { return product.cpp.libraryPathFlag + path }));
escapableLinkerFlags = escapableLinkerFlags.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs));
var versionScripts = inputs.versionscript
? inputs.versionscript.map(function(a) { return a.filePath; }) : [];
Array.prototype.push.apply(escapableLinkerFlags, [].uniqueConcat(versionScripts)
.map(function(path) { return '--version-script=' + path }));
if (isDarwin && product.cpp.warningLevel === "none")
args.push('-w');
var useCompilerDriver = useCompilerDriverLinker(product, inputs);
args = args.concat(configFlags(product, useCompilerDriver));
escapableLinkerFlags = escapableLinkerFlags.concat(Cpp.collectMiscEscapableLinkerArguments(product));
// Note: due to the QCC response files hack in prepareLinker(), at least one object file or
// library file must follow the output file path so that QCC has something to process before
// sending the rest of the arguments through the response file.
args.push("-o", primaryOutput.filePath);
args = args.concat(Cpp.collectLinkerObjectPaths(inputs));
args = args.concat(Cpp.collectResourceObjectPaths(inputs));
var wholeArchiveActive = false;
var prevLib;
for (i = 0; i < libraryDependencies.libraries.length; ++i) {
var dep = libraryDependencies.libraries[i];
var lib = dep.filePath;
if (lib === prevLib)
continue;
prevLib = lib;
if (dep.wholeArchive && !wholeArchiveActive) {
var wholeArchiveFlag;
if (isDarwin) {
wholeArchiveFlag = "-force_load";
} else {
wholeArchiveFlag = "--whole-archive";
wholeArchiveActive = true;
}
Array.prototype.push.apply(args,
escapeLinkerFlags(product, inputs, [wholeArchiveFlag]));
}
if (!dep.wholeArchive && wholeArchiveActive) {
Array.prototype.push.apply(args,
escapeLinkerFlags(product, inputs, ["--no-whole-archive"]));
wholeArchiveActive = false;
}
var symbolLinkMode = dep.symbolLinkMode;
if (isDarwin && symbolLinkMode) {
if (!["lazy", "reexport", "upward", "weak"].includes(symbolLinkMode))
throw new Error("unknown value '" + symbolLinkMode + "' for cpp.symbolLinkMode");
}
var supportsLazyMode = Utilities.versionCompare(product.cpp.compilerVersion, "15.0.0") < 0;
if (isDarwin && symbolLinkMode && (symbolLinkMode !== "lazy" || supportsLazyMode)) {
if (FileInfo.isAbsolutePath(lib) || lib.startsWith('@'))
escapableLinkerFlags.push("-" + symbolLinkMode + "_library", lib);
else if (dep.framework)
escapableLinkerFlags.push("-" + symbolLinkMode + "_framework", lib);
else
escapableLinkerFlags.push("-" + symbolLinkMode + "-l" + lib);
} else if (FileInfo.isAbsolutePath(lib) || lib.startsWith('@')) {
args.push(dep.framework ? PathTools.frameworkExecutablePath(lib) : lib);
} else if (dep.framework) {
args.push("-framework", lib);
} else {
args.push('-l' + lib);
}
}
if (wholeArchiveActive) {
Array.prototype.push.apply(args,
escapeLinkerFlags(product, inputs, ["--no-whole-archive"]));
}
var discardUnusedData = product.cpp.discardUnusedData;
if (discardUnusedData !== undefined) {
var flags = [];
if (discardUnusedData === true) {
if (isDarwin)
escapableLinkerFlags.push("-dead_strip");
else
escapableLinkerFlags.push("--gc-sections");
} else if (!isDarwin) {
escapableLinkerFlags.push("--no-gc-sections");
}
}
if (product.cpp.useRPathLink) {
if (!product.cpp.rpathLinkFlag)
throw new Error("Using rpath-link but cpp.rpathLinkFlag is not defined");
Array.prototype.push.apply(escapableLinkerFlags, libraryDependencies.rpath_link.map(
function(dir) {
return product.cpp.rpathLinkFlag + dir;
}));
}
var importLibs = outputs.dynamiclibrary_import;
if (importLibs)
escapableLinkerFlags.push("--out-implib", importLibs[0].filePath);
if (outputs.application && product.cpp.generateLinkerMapFile) {
if (isDarwin)
escapableLinkerFlags.push("-map", outputs.mem_map[0].filePath);
else
escapableLinkerFlags.push("-Map=" + outputs.mem_map[0].filePath);
}
var escapedLinkerFlags = escapeLinkerFlags(product, inputs, escapableLinkerFlags);
Array.prototype.push.apply(escapedLinkerFlags, args);
if (useCompilerDriver)
escapedLinkerFlags = escapedLinkerFlags.concat(Cpp.collectMiscLinkerArguments(product));
if (product.qbs.toolchain.includes("mingw") && product.cpp.runtimeLibrary === "static")
escapedLinkerFlags = ['-static-libgcc', '-static-libstdc++'].concat(escapedLinkerFlags);
return escapedLinkerFlags;
}
// for compiler AND linker
function configFlags(config, isDriver) {
var args = [];
if (isDriver !== false)
args = args.concat(Cpp.collectMiscDriverArguments(config));
var frameworkPaths = config.cpp.frameworkPaths;
if (frameworkPaths)
args = args.uniqueConcat(frameworkPaths.map(function(path) { return '-F' + path }));
var allSystemFrameworkPaths = [];
var systemFrameworkPaths = config.cpp.systemFrameworkPaths;
if (systemFrameworkPaths)
allSystemFrameworkPaths = allSystemFrameworkPaths.uniqueConcat(systemFrameworkPaths);
var distributionFrameworkPaths = config.cpp.distributionFrameworkPaths;
if (distributionFrameworkPaths)
allSystemFrameworkPaths = allSystemFrameworkPaths.uniqueConcat(distributionFrameworkPaths);
args = args.concat(allSystemFrameworkPaths.map(function(path) { return '-iframework' + path }));
return args;
}
function languageTagFromFileExtension(toolchain, fileName) {
var i = fileName.lastIndexOf('.');
if (i === -1)
return;
var m = {
"c" : "c",
"C" : "cpp",
"cpp" : "cpp",
"cxx" : "cpp",
"c++" : "cpp",
"cc" : "cpp",
"m" : "objc",
"mm" : "objcpp",
"s" : "asm",
"S" : "asm_cpp"
};
if (!toolchain.includes("clang"))
m["sx"] = "asm_cpp"; // clang does NOT recognize .sx
else
m["cppm"] = "cppm";
return m[fileName.substring(i + 1)];
}
// Older versions of the QNX SDK have C and C++ compilers whose filenames differ only by case,
// which won't work in case insensitive environments like Win32+NTFS, HFS+ and APFS
function isLegacyQnxSdk(config) {
return config.qbs.toolchain.includes("qcc") && config.qnx && !config.qnx.qnx7;
}
function effectiveCompilerInfo(toolchain, input, output) {
var compilerPath, language;
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
// Whether we're compiling a precompiled header or normal source file
var pchOutput = output.fileTags.includes(tag + "_pch");
var compilerPathByLanguage = input.cpp.compilerPathByLanguage;
if (compilerPathByLanguage)
compilerPath = compilerPathByLanguage[tag];
if (!compilerPath
|| tag !== languageTagFromFileExtension(toolchain, input.fileName)
|| isLegacyQnxSdk(input)) {
if (input.qbs.toolchain.includes("qcc"))
language = qnxLangArgs(input, tag);
else
language = ["-x", languageName(tag) + (pchOutput ? '-header' : '')];
}
if (!compilerPath)
// fall back to main compiler
compilerPath = input.cpp.compilerPath;
return {
path: compilerPath,
language: language,
tag: tag
};
}
function qnxLangArgs(config, tag) {
switch (tag) {
case "c":
return ["-lang-c"];
case "cpp":
return ["-lang-c++"];
default:
return [];
}
}
function handleCpuFeatures(input, flags) {
function potentiallyAddFlagForFeature(propName, flagName) {
var propValue = input.cpufeatures[propName];
if (propValue === true)
flags.push("-m" + flagName);
else if (propValue === false)
flags.push("-mno-" + flagName);
}
if (!input.qbs.architecture)
return;
if (input.qbs.architecture.startsWith("x86")) {
potentiallyAddFlagForFeature("x86_avx", "avx");
potentiallyAddFlagForFeature("x86_avx2", "avx2");
potentiallyAddFlagForFeature("x86_avx512bw", "avx512bw");
potentiallyAddFlagForFeature("x86_avx512cd", "avx512cd");
potentiallyAddFlagForFeature("x86_avx512dq", "avx512dq");
potentiallyAddFlagForFeature("x86_avx512er", "avx512er");
potentiallyAddFlagForFeature("x86_avx512f", "avx512f");
potentiallyAddFlagForFeature("x86_avx512ifma", "avx512ifma");
potentiallyAddFlagForFeature("x86_avx512pf", "avx512pf");
potentiallyAddFlagForFeature("x86_avx512vbmi", "avx512vbmi");
potentiallyAddFlagForFeature("x86_avx512vl", "avx512vl");
potentiallyAddFlagForFeature("x86_f16c", "f16c");
potentiallyAddFlagForFeature("x86_sse2", "sse2");
potentiallyAddFlagForFeature("x86_sse3", "sse3");
potentiallyAddFlagForFeature("x86_sse4_1", "sse4.1");
potentiallyAddFlagForFeature("x86_sse4_2", "sse4.2");
potentiallyAddFlagForFeature("x86_ssse3", "ssse3");
} else if (input.qbs.architecture.startsWith("arm")) {
if (input.cpufeatures.arm_neon === true)
flags.push("-mfpu=neon");
if (input.cpufeatures.arm_vfpv4 === true)
flags.push("-mfpu=vfpv4");
} else if (input.qbs.architecture.startsWith("mips")) {
potentiallyAddFlagForFeature("mips_dsp", "dsp");
potentiallyAddFlagForFeature("mips_dspr2", "dspr2");
}
}
function standardFallbackValueOrDefault(toolchain, compilerVersion, languageVersion,
useLanguageVersionFallback) {
// NEVER use the fallback values (safety brake for users in case our version map is ever wrong)
if (useLanguageVersionFallback === false)
return languageVersion;
// Deprecated, but compatible with older compiler versions.
// Note that these versions are the first to support the *value* to the -std= command line
// option, not necessarily the first versions where support for that language standard was
// considered fully implemented. Tested manually.
var languageVersionsMap = {
"c++11": {
"fallback": "c++0x",
"toolchains": [
{"name": "xcode", "version": "4.3"},
{"name": "clang", "version": "3.0"},
{"name": "gcc", "version": "4.7"}
]
},
"c11": {
"fallback": "c1x",
"toolchains": [
{"name": "xcode", "version": "5.0"},
{"name": "clang", "version": "3.1"},
{"name": "gcc", "version": "4.7"}
]
},
"c17": {
"fallback": "c11",
"toolchains": [
{"name": "xcode", "version": "10.2"},
{"name": "clang", "version": "7.0"},
{"name": "gcc", "version": "8.1"}
]
},
"c2x": {
"fallback": "c17",
"toolchains": [
{"name": "xcode", "version": "11.4"},
{"name": "clang", "version": "9.0"},
{"name": "gcc", "version": "9.0"}
]
},
"c++14": {
"fallback": "c++1y",
"toolchains": [
{"name": "xcode", "version": "6.3"},
{"name": "clang", "version": "3.5"},
{"name": "gcc", "version": "4.9"}
]
},
"c++17": {
"fallback": "c++1z",
"toolchains": [
{"name": "xcode", "version": "9.3"},
{"name": "clang", "version": "5.0"},
{"name": "gcc", "version": "5.1"}
]
},
"c++20": {
"fallback": "c++2a",
"toolchains": [
{"name": "xcode", "version": "12.5"},
{"name": "clang", "version": "11.0"},
{"name": "gcc", "version": "10.1"}
]
},
"c++23": {
"fallback": "c++2b",
"toolchains": [
{"name": "xcode"},
{"name": "clang"},
{"name": "gcc"}
]
}
};
var m = languageVersionsMap[languageVersion];
if (m) {
for (var idx = 0; idx < m.toolchains.length; ++idx) {
var tc = m.toolchains[idx];
if (toolchain.includes(tc.name)) {
// If we found our toolchain and it doesn't yet support the language standard
// we're requesting, or we're using an older version that only supports the
// preliminary flag, use that.
if (useLanguageVersionFallback
|| !tc.version
|| Utilities.versionCompare(compilerVersion, tc.version) < 0)
return m.fallback;
break;
}
}
}
// If we didn't find our toolchain at all, simply use the standard value.
return languageVersion;
}
function compilerFlags(project, product, outputs, input, output, explicitlyDependsOn) {
var i;
// Determine which C-language we're compiling
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags));
if (!["c", "cpp", "cppm", "objc", "objcpp", "asm_cpp"].includes(tag))
throw ("unsupported source language: " + tag);
var compilerInfo = effectiveCompilerInfo(product.qbs.toolchain,
input, output);
var args = additionalCompilerAndLinkerFlags(product);
Array.prototype.push.apply(args, product.cpp.sysrootFlags);
handleCpuFeatures(input, args);
if (input.cpp.debugInformation)
args.push('-g');
var opt = input.cpp.optimization
if (opt === 'fast')
args.push('-O2');
if (opt === 'small')
args.push('-Os');
if (opt === 'none')
args.push('-O0');
if (input.cpp.forceUseCxxModules) {
if (!product.qbs.toolchain.includes("clang"))
args.push('-fmodules-ts')
}
var warnings = input.cpp.warningLevel
if (warnings === 'none')
args.push('-w');
if (warnings === 'all') {
args.push('-Wall');
args.push('-Wextra');
}
if (input.cpp.treatWarningsAsErrors)
args.push('-Werror');
var moduleMap = (outputs["modulemap"] || [])[0];
if (moduleMap) {
const moduleMapperFlag = product.qbs.toolchain.includes("clang")
? "@" // clang uses response file with the list of flags
: "-fmodule-mapper="; // gcc uses file with special syntax
args.push(moduleMapperFlag + moduleMap.filePath);
}
args = args.concat(configFlags(input));
if (!input.qbs.toolchain.includes("qcc"))
args.push('-pipe');
if (input.cpp.enableReproducibleBuilds) {
var toolchain = product.qbs.toolchain;
if (!toolchain.includes("clang")) {
var hashString = FileInfo.relativePath(project.sourceDirectory, input.filePath);
var hash = Utilities.getHash(hashString);
args.push("-frandom-seed=0x" + hash.substring(0, 8));
}
var major = product.cpp.compilerVersionMajor;
var minor = product.cpp.compilerVersionMinor;
if ((toolchain.includes("clang") && (major > 3 || (major === 3 && minor >= 5))) ||
(toolchain.includes("gcc") && (major > 4 || (major === 4 && minor >= 9)))) {
args.push("-Wdate-time");
}
}
var useArc = input.cpp.automaticReferenceCounting;
if (useArc !== undefined && (tag === "objc" || tag === "objcpp")) {
args.push(useArc ? "-fobjc-arc" : "-fno-objc-arc");
}
var enableExceptions = input.cpp.enableExceptions;
if (enableExceptions !== undefined) {
if (tag === "cpp" || tag === "objcpp" || tag === "cppm")
args.push(enableExceptions ? "-fexceptions" : "-fno-exceptions");
if (tag === "objc" || tag === "objcpp") {
args.push(enableExceptions ? "-fobjc-exceptions" : "-fno-objc-exceptions");
if (useArc !== undefined)
args.push(useArc ? "-fobjc-arc-exceptions" : "-fno-objc-arc-exceptions");
}
}
var enableRtti = input.cpp.enableRtti;
if (enableRtti !== undefined && (tag === "cpp" || tag === "objcpp" || tag === "cppm")) {
args.push(enableRtti ? "-frtti" : "-fno-rtti");
}
var visibility = input.cpp.visibility;
if (!product.qbs.toolchain.includes("mingw")) {
if (visibility === 'hidden' || visibility === 'minimal')
args.push('-fvisibility=hidden');
if ((visibility === 'hiddenInlines' || visibility === 'minimal') && tag === 'cpp')
args.push('-fvisibility-inlines-hidden');
if (visibility === 'default')
args.push('-fvisibility=default')
}
if (compilerInfo.language)
// Only push language arguments if we have to.
Array.prototype.push.apply(args, compilerInfo.language);
args = args.concat(Cpp.collectMiscCompilerArguments(input, tag));
var pchTag = compilerInfo.tag + "_pch";
var pchOutput = output.fileTags.includes(pchTag);
var pchInputs = explicitlyDependsOn[pchTag];
if (!pchOutput && pchInputs && pchInputs.length === 1
&& ModUtils.moduleProperty(input, 'usePrecompiledHeader', tag)) {
var pchInput = pchInputs[0];
var pchFilePath = FileInfo.joinPaths(FileInfo.path(pchInput.filePath),
pchInput.completeBaseName);
args.push(input.cpp.preincludeFlag, pchFilePath);
}
args = args.concat(Cpp.collectPreincludePathsArguments(input));
var positionIndependentCode = input.cpp.positionIndependentCode;
if (positionIndependentCode && !product.qbs.targetOS.includes("windows"))
args.push('-fPIC');
var cppFlags = input.cpp.cppFlags;
for (i in cppFlags)
args.push('-Wp,' + cppFlags[i])
args = args.concat(Cpp.collectDefinesArguments(input));
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input));
var minimumWindowsVersion = input.cpp.minimumWindowsVersion;
if (minimumWindowsVersion && product.qbs.targetOS.includes("windows")) {
var hexVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'hex');
if (hexVersion) {
var versionDefs = [ 'WINVER', '_WIN32_WINNT', '_WIN32_WINDOWS' ];
for (i in versionDefs)
args.push(input.cpp.defineFlag + versionDefs[i] + '=' + hexVersion);
}
}
function currentLanguageVersion(tag) {
switch (tag) {
case "c":
case "objc":
var knownValues = ["c2x", "c17", "c11", "c99", "c90", "c89"];
return Cpp.languageVersion(input.cpp.cLanguageVersion, knownValues, "C");
case "cpp":
case "cppm":
case "objcpp":
knownValues = ["c++23", "c++2b", "c++20", "c++2a", "c++17", "c++1z",
"c++14", "c++1y", "c++11", "c++0x",
"c++03", "c++98"];
return Cpp.languageVersion(input.cpp.cxxLanguageVersion, knownValues, "C++");
}
}
var langVersion = currentLanguageVersion(tag);
if (langVersion) {
args.push("-std=" + standardFallbackValueOrDefault(product.qbs.toolchain,
product.cpp.compilerVersion,
langVersion,
product.cpp.useLanguageVersionFallback));
}
if (tag === "cpp" || tag === "objcpp" || tag === "cppm") {
var cxxStandardLibrary = product.cpp.cxxStandardLibrary;
if (cxxStandardLibrary && product.qbs.toolchain.includes("clang")) {
args.push("-stdlib=" + cxxStandardLibrary);
}
}
args.push("-o", output.filePath);
args.push("-c", input.filePath);
return args;
}
function additionalCompilerAndLinkerFlags(product) {
var args = []
var requireAppExtensionSafeApi = product.cpp.requireAppExtensionSafeApi;
if (requireAppExtensionSafeApi !== undefined && product.qbs.targetOS.includes("darwin")) {
args.push(requireAppExtensionSafeApi ? "-fapplication-extension" : "-fno-application-extension");
}
return args
}
// Returns the GCC language name equivalent to fileTag, accepted by the -x argument
function languageName(fileTag) {
if (fileTag === 'c')
return 'c';
else if (fileTag === 'cpp')
return 'c++';
else if (fileTag === 'cppm')
return 'c++';
else if (fileTag === 'objc')
return 'objective-c';
else if (fileTag === 'objcpp')
return 'objective-c++';
else if (fileTag === 'asm')
return 'assembler';
else if (fileTag === 'asm_cpp')
return 'assembler-with-cpp';
}
function prepareAssembler(project, product, inputs, outputs, input, output) {
var assemblerPath = product.cpp.assemblerPath;
var args = product.cpp.targetAssemblerFlags;
if (input.cpp.debugInformation)
args.push('-g');
var warnings = input.cpp.warningLevel
if (warnings === 'none')
args.push('-W');
args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm"));
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input, input.cpp.includeFlag));
args.push("-o", output.filePath);
args.push(input.filePath);
var cmd = new Command(assemblerPath, args);
cmd.description = "assembling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "assembler";
return cmd;
}
function compilerEnvVars(config, compilerInfo)
{
if (config.qbs.toolchain.includes("qcc"))
return ["QCC_CONF_PATH"];
var list = ["CPATH", "TMPDIR"];
if (compilerInfo.tag === "c")
list.push("C_INCLUDE_PATH");
else if (compilerInfo.tag === "cpp")
list.push("CPLUS_INCLUDE_PATH");
else if (compilerInfo.tag === "cppm")
list.push("CPLUS_INCLUDE_PATH");
else if (compilerInfo.tag === "objc")
list.push("OBJC_INCLUDE_PATH");
else if (compilerInfo.tag === "objccpp")
list.push("OBJCPLUS_INCLUDE_PATH");
if (config.qbs.targetOS.includes("macos"))
list.push("MACOSX_DEPLOYMENT_TARGET");
else if (config.qbs.targetOS.includes("ios"))
list.push("IPHONEOS_DEPLOYMENT_TARGET");
else if (config.qbs.targetOS.includes("tvos"))
list.push("TVOS_DEPLOYMENT_TARGET");
else if (config.qbs.targetOS.includes("watchos"))
list.push("WATCHOS_DEPLOYMENT_TARGET");
if (config.qbs.toolchain.includes("clang")) {
list.push("TEMP", "TMP");
} else {
list.push("LANG", "LC_CTYPE", "LC_MESSAGES", "LC_ALL", "GCC_COMPARE_DEBUG",
"GCC_EXEC_PREFIX", "COMPILER_PATH", "SOURCE_DATE_EPOCH");
}
return list;
}
function linkerEnvVars(config, inputs)
{
if (config.qbs.toolchain.includes("clang") || config.qbs.toolchain.includes("qcc"))
return [];
var list = ["GNUTARGET", "LDEMULATION", "COLLECT_NO_DEMANGLE"];
if (useCompilerDriverLinker(config, inputs))
list.push("LIBRARY_PATH");
return list;
}
function setResponseFileThreshold(command, product)
{
if (Host.os().includes("windows"))
command.responseFileThreshold = 8000;
}
function prepareCompilerInternal(project, product, inputs, outputs, input, output_, explicitlyDependsOn) {
var output = output_ || outputs["obj"][0];
var compilerInfo = effectiveCompilerInfo(product.qbs.toolchain,
input, output);
var compilerPath = compilerInfo.path;
var pchOutput = output.fileTags.includes(compilerInfo.tag + "_pch");
var args = compilerFlags(project, product, outputs, input, output, explicitlyDependsOn);
var wrapperArgsLength = 0;
var wrapperArgs = product.cpp.compilerWrapper;
var extraEnv;
if (wrapperArgs && wrapperArgs.length > 0) {
// distcc cannot deal with absolute compiler paths (QBS-1336).
for (var i = 0; i < wrapperArgs.length; ++i) {
if (FileInfo.baseName(wrapperArgs[i]) !== "distcc")
continue;
if (i === wrapperArgs.length - 1) {
if (FileInfo.isAbsolutePath(compilerPath)) {
extraEnv = ["PATH=" + FileInfo.path(compilerPath)];
compilerPath = FileInfo.fileName(compilerPath);
}
} else if (FileInfo.isAbsolutePath(wrapperArgs[i + 1])) {
extraEnv = ["PATH=" + FileInfo.path(FileInfo.path(wrapperArgs[i + 1]))];
wrapperArgs[i + 1] = FileInfo.fileName(wrapperArgs[i + 1]);
}
break;
}
wrapperArgsLength = wrapperArgs.length;
args.unshift(compilerPath);
compilerPath = wrapperArgs.shift();
args = wrapperArgs.concat(args);
}
var cmd = new Command(compilerPath, args);
cmd.description = (pchOutput ? 'pre' : '') + 'compiling ' + input.fileName;
if (pchOutput)
cmd.description += ' (' + compilerInfo.tag + ')';
cmd.highlight = "compiler";
cmd.jobPool = "compiler";
cmd.relevantEnvironmentVariables = compilerEnvVars(input, compilerInfo);
if (extraEnv)
cmd.environment = extraEnv;
cmd.responseFileArgumentIndex = wrapperArgsLength;
cmd.responseFileUsagePrefix = '@';
setResponseFileThreshold(cmd, product);
return cmd;
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var result = Cpp.prepareModules(project, product, inputs, outputs, input, output);
result = result.concat(prepareCompilerInternal(
project, product, inputs, outputs, input, output, explicitlyDependsOn));
return result;
}
// Concatenates two arrays of library names and preserves the dependency order that ld needs.
function concatLibs(libs, deplibs) {
var r = [];
var s = {};
function addLibs(lst) {
for (var i = lst.length; --i >= 0;) {
var lib = lst[i];
if (!s[lib]) {
s[lib] = true;
r.unshift(lib);
}
}
}
addLibs(deplibs);
addLibs(libs);
return r;
}
function collectStdoutLines(command, args)
{
var p = new Process();
try {
p.exec(command, args);
return p.readStdOut().split(/\r?\n/g).filter(function (e) { return e; });
} finally {
p.close();
}
}
function getSymbolInfo(product, inputFile)
{
var result = { };
var command = product.cpp.nmPath;
var args = ["-g", "-P"];
if (product.cpp._nmHasDynamicOption)
args.push("-D");
try {
result.allGlobalSymbols = collectStdoutLines(command, args.concat(inputFile));
// GNU nm has the "--defined" option but POSIX nm does not, so we have to manually
// construct the list of defined symbols by subtracting.
var undefinedGlobalSymbols = collectStdoutLines(command, args.concat(["-u", inputFile]));
result.definedGlobalSymbols = result.allGlobalSymbols.filter(function(line) {
return !undefinedGlobalSymbols.includes(line); });
result.success = true;
} catch (e) {
console.debug("Failed to collect symbols for shared library: nm command '"
+ command + "' failed (" + e.toString() + ")");
result.success = false;
}
return result;
}
function createSymbolFile(filePath, allSymbols, definedSymbols)
{
var file;
try {
file = new TextFile(filePath, TextFile.WriteOnly);
for (var lineNr in allSymbols)
file.writeLine(allSymbols[lineNr]);
file.writeLine("===");
for (lineNr in definedSymbols)
file.writeLine(definedSymbols[lineNr]);
} finally {
if (file)
file.close();
}
}
function readSymbolFile(filePath)
{
var result = { success: true, allGlobalSymbols: [], definedGlobalSymbols: [] };
var file;
try {
file = new TextFile(filePath, TextFile.ReadOnly);
var prop = "allGlobalSymbols";
while (true) {
var line = file.readLine();
if (!line)
break;
if (line === "===") {
prop = "definedGlobalSymbols";
continue;
}
result[prop].push(line);
}
} catch (e) {
console.debug("Failed to read symbols from '" + filePath + "'");
result.success = false;
} finally {
if (file)
file.close();
}
return result;
}
function createSymbolCheckingCommands(product, outputs) {
var commands = [];
if (!outputs.dynamiclibrary || !outputs.dynamiclibrary_symbols)
return commands;
if (outputs.dynamiclibrary.length !== outputs.dynamiclibrary_symbols.length)
throw new Error("The number of outputs tagged dynamiclibrary ("
+ outputs.dynamiclibrary.length + ") must be equal to the number of "
+ "outputs tagged dynamiclibrary_symbols ("
+ outputs.dynamiclibrary_symbols.length + ")");
for (var d = 0; d < outputs.dynamiclibrary_symbols.length; ++d) {
// Update the symbols file if the list of relevant symbols has changed.
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.d = d;
cmd.sourceCode = function() {
if (outputs.dynamiclibrary[d].qbs.buildVariant
!== outputs.dynamiclibrary_symbols[d].qbs.buildVariant)
throw new Error("Build variant of output tagged dynamiclibrary ("
+ outputs.dynamiclibrary[d].qbs.buildVariant + ") is not equal to "
+ "build variant of output tagged dynamiclibrary_symbols ("
+ outputs.dynamiclibrary_symbols[d].qbs.buildVariant + ") at index "
+ d);
var libFilePath = outputs.dynamiclibrary[d].filePath;
var symbolFilePath = outputs.dynamiclibrary_symbols[d].filePath;
var newNmResult = getSymbolInfo(product, libFilePath);
if (!newNmResult.success)
return;
if (!File.exists(symbolFilePath)) {
console.debug("Symbol file '" + symbolFilePath + "' does not yet exist.");
createSymbolFile(symbolFilePath, newNmResult.allGlobalSymbols,
newNmResult.definedGlobalSymbols);
return;
}
var oldNmResult = readSymbolFile(symbolFilePath);
var checkMode = product.cpp.exportedSymbolsCheckMode;
var oldSymbols;
var newSymbols;
if (checkMode === "strict") {
oldSymbols = oldNmResult.allGlobalSymbols;
newSymbols = newNmResult.allGlobalSymbols;
} else {
var weakFilter = function(line) {
var symbolType = line.split(/\s+/)[1];
return symbolType != "v" && symbolType != "V"
&& symbolType != "w" && symbolType != "W";
};
oldSymbols = oldNmResult.definedGlobalSymbols.filter(weakFilter);
newSymbols = newNmResult.definedGlobalSymbols.filter(weakFilter);
}
if (oldSymbols.length !== newSymbols.length) {
console.debug("List of relevant symbols differs for '" + libFilePath + "'.");
createSymbolFile(symbolFilePath, newNmResult.allGlobalSymbols,
newNmResult.definedGlobalSymbols);
return;
}
for (var i = 0; i < oldSymbols.length; ++i) {
var oldLine = oldSymbols[i];
var newLine = newSymbols[i];
var oldLineElems = oldLine.split(/\s+/);
var newLineElems = newLine.split(/\s+/);
if (oldLineElems[0] !== newLineElems[0] // Object name.
|| oldLineElems[1] !== newLineElems[1]) { // Object type
console.debug("List of relevant symbols differs for '" + libFilePath + "'.");
createSymbolFile(symbolFilePath, newNmResult.allGlobalSymbols,
newNmResult.definedGlobalSymbols);
return;
}
}
}
commands.push(cmd);
}
return commands;
}
function separateDebugInfoCommands(product, outputs, primaryOutput) {
var commands = [];
var debugInfo = outputs.debuginfo_app || outputs.debuginfo_dll
|| outputs.debuginfo_loadablemodule;
if (debugInfo && !product.qbs.toolchain.includes("emscripten")) {
var objcopy = product.cpp.objcopyPath;
var cmd = new Command(objcopy, ["--only-keep-debug", primaryOutput.filePath,
debugInfo[0].filePath]);
cmd.silent = true;
commands.push(cmd);
cmd = new Command(objcopy, ["--strip-debug", primaryOutput.filePath]);
cmd.silent = true;
commands.push(cmd);
cmd = new Command(objcopy, ["--add-gnu-debuglink=" + debugInfo[0].filePath,
primaryOutput.filePath]);
cmd.silent = true;
commands.push(cmd);
}
return commands;
}
function separateDebugInfoCommandsDarwin(product, outputs, primaryOutputs) {
var commands = [];
var debugInfo = outputs.debuginfo_app || outputs.debuginfo_dll
|| outputs.debuginfo_loadablemodule;
if (debugInfo) {
var dsymPath = debugInfo[0].filePath;
if (outputs.debuginfo_bundle && outputs.debuginfo_bundle[0])
dsymPath = outputs.debuginfo_bundle[0].filePath;
var flags = product.cpp.dsymutilFlags || [];
var files = primaryOutputs.map(function (f) { return f.filePath; });
var cmd = new Command(product.cpp.dsymutilPath,
flags.concat(["-o", dsymPath].concat(files)));
cmd.description = "generating dSYM for " + product.name;
commands.push(cmd);
// strip debug info
cmd = new Command(product.cpp.stripPath, ["-S"].concat(files));
cmd.silent = true;
commands.push(cmd);
}
return commands;
}
function librarySymlinkArtifacts(product, buildVariantSuffix) {
var artifacts = [];
if (product.cpp.shouldCreateSymlinks && (!product.bundle || !product.bundle.isBundle)) {
var maxVersionParts = product.cpp.internalVersion ? 3 : 1;
var primaryFileName =
PathTools.dynamicLibraryFilePath(product, buildVariantSuffix, undefined);
for (var i = 0; i < maxVersionParts; ++i) {
var symlink = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.dynamicLibraryFilePath(
product, buildVariantSuffix, undefined, i)),
fileTags: ["dynamiclibrary_symlink"],
cpp: { primaryFileName: primaryFileName }
};
if (i > 0 && artifacts[i-1].filePath == symlink.filePath)
break; // Version number has less than three components.
artifacts.push(symlink);
}
}
return artifacts;
}
function librarySymlinkCommands(outputs, primaryOutput) {
var commands = [];
// Create symlinks from {libfoo, libfoo.1, libfoo.1.0} to libfoo.1.0.0
var links = outputs["dynamiclibrary_symlink"];
var symlinkCount = links ? links.length : 0;
for (i = 0; i < symlinkCount; ++i) {
var cmd = new Command("ln", ["-sf", links[i].cpp.primaryFileName, links[i].filePath]);
cmd.highlight = "filegen";
cmd.description = "creating symbolic link '" + links[i].fileName + "'";
cmd.workingDirectory = FileInfo.path(primaryOutput.filePath);
commands.push(cmd);
}
return commands;
}
function prepareLinker(project, product, inputs, outputs, input, output) {
var i, primaryOutput, cmd, commands = [];
if (outputs.application) {
primaryOutput = outputs.application[0];
} else if (outputs.dynamiclibrary) {
primaryOutput = outputs.dynamiclibrary[0];
} else if (outputs.loadablemodule) {
primaryOutput = outputs.loadablemodule[0];
}
var linkerPath = effectiveLinkerPath(product, inputs)
var args = linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPath);
var wrapperArgsLength = 0;
var wrapperArgs = product.cpp.linkerWrapper;
if (wrapperArgs && wrapperArgs.length > 0) {
wrapperArgsLength = wrapperArgs.length;
args.unshift(linkerPath);
linkerPath = wrapperArgs.shift();
args = wrapperArgs.concat(args);
}
var responseFileArgumentIndex = wrapperArgsLength;
// qcc doesn't properly handle response files, so we have to do it manually
var useQnxResponseFileHack = product.qbs.toolchain.includes("qcc")
&& useCompilerDriverLinker(product, inputs);
if (useQnxResponseFileHack) {
// qcc needs to see at least one object/library file to think it has something to do,
// so start the response file at the second object file (so, 3 after the last -o option)
var idx = args.lastIndexOf("-o");
if (idx !== -1 && idx + 3 < args.length)
responseFileArgumentIndex += idx + 3;
}
cmd = new Command(linkerPath, args);
cmd.description = 'linking ' + primaryOutput.fileName;
cmd.highlight = 'linker';
cmd.jobPool = "linker";
cmd.relevantEnvironmentVariables = linkerEnvVars(product, inputs);
cmd.responseFileArgumentIndex = responseFileArgumentIndex;
cmd.responseFileUsagePrefix = useQnxResponseFileHack ? "-Wl,@" : "@";
setResponseFileThreshold(cmd, product);
commands.push(cmd);
if (product.qbs.toolchain.includes("emscripten") && outputs.application
&& product.cpp.separateDebugInformation) {
args.push("-gseparate-dwarf");
} else if (product.qbs.targetOS.includes("darwin")) {
if (!product.aggregate) {
commands = commands.concat(separateDebugInfoCommandsDarwin(
product, outputs, [primaryOutput]));
}
} else {
commands = commands.concat(separateDebugInfoCommands(product, outputs, primaryOutput));
}
if (outputs.dynamiclibrary) {
Array.prototype.push.apply(commands, createSymbolCheckingCommands(product, outputs));
Array.prototype.push.apply(commands, librarySymlinkCommands(outputs, primaryOutput));
}
if (product.cpp.shouldSignArtifacts) {
Array.prototype.push.apply(
commands, Codesign.prepareSign(project, product, inputs, outputs, input, output));
}
return commands;
}
function debugInfoArtifacts(product, variants, debugInfoTagSuffix) {
var fileTag;
switch (debugInfoTagSuffix) {
case "app":
fileTag = "application";
break;
case "dll":
fileTag = "dynamiclibrary";
break;
default:
fileTag = debugInfoTagSuffix;
break;
}
variants = variants || [{}];
var artifacts = [];
var separateDebugInfo = product.cpp.separateDebugInformation;
if (separateDebugInfo && product.qbs.toolchain.includes("emscripten"))
separateDebugInfo = fileTag === "application";
if (separateDebugInfo) {
variants.map(function (variant) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.debugInfoFilePath(product,
variant.suffix,
fileTag)),
fileTags: ["debuginfo_" + debugInfoTagSuffix]
});
});
if (PathTools.debugInfoIsBundle(product)) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.debugInfoBundlePath(product, fileTag)),
fileTags: ["debuginfo_bundle"]
});
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.debugInfoPlistFilePath(product, fileTag)),
fileTags: ["debuginfo_plist"]
});
}
}
return artifacts;
}
function dumpMacros(env, compilerFilePath, args, nullDevice, tag) {
var p = new Process();
try {
p.setEnv("LC_ALL", "C");
for (var key in env)
p.setEnv(key, env[key]);
// qcc NEEDS the explicit -Wp, prefix to -dM; clang and gcc do not but all three accept it
p.exec(compilerFilePath,
(args || []).concat(["-Wp,-dM", "-E", "-x", languageName(tag || "c") , nullDevice]),
true);
return Cpp.extractMacros(p.readStdOut());
} finally {
p.close();
}
}
function dumpDefaultPaths(env, compilerFilePath, args, nullDevice, pathListSeparator, sysroot,
targetOS) {
var p = new Process();
try {
p.setEnv("LC_ALL", "C");
for (var key in env)
p.setEnv(key, env[key]);
args = args || [];
p.exec(compilerFilePath, args.concat(["-v", "-E", "-x", "c++", nullDevice]), true);
var suffix = " (framework directory)";
var includePaths = [];
var libraryPaths = [];
var frameworkPaths = [];
var addIncludes = false;
var lines = p.readStdErr().trim().split(/\r?\n/g).map(function (line) { return line.trim(); });
for (var i = 0; i < lines.length; ++i) {
var line = lines[i];
var prefix = "LIBRARY_PATH=";
if (line.startsWith(prefix)) {
libraryPaths = libraryPaths.concat(line.substr(prefix.length)
.split(pathListSeparator));
} else if (line === "#include <...> search starts here:") {
addIncludes = true;
} else if (line === "End of search list.") {
addIncludes = false;
} else if (addIncludes) {
if (line.endsWith(suffix))
frameworkPaths.push(line.substr(0, line.length - suffix.length));
else
includePaths.push(line);
}
}
sysroot = sysroot || "";
if (includePaths.length === 0)
includePaths.push(sysroot + "/usr/include", sysroot + "/usr/local/include");
if (libraryPaths.length === 0)
libraryPaths.push(sysroot + "/lib", sysroot + "/usr/lib");
if (frameworkPaths.length === 0 && targetOS.includes("darwin"))
frameworkPaths.push(sysroot + "/System/Library/Frameworks");
return {
"includePaths": includePaths,
"libraryPaths": libraryPaths,
"frameworkPaths": frameworkPaths
};
} finally {
p.close();
}
}
function targetLinkerFlags(targetArch, targetOS) {
var linkerFlags = {
"windows": {
"i386": "i386pe",
"x86_64": "i386pep",
},
"freebsd": {
"i386": "elf_i386_fbsd",
"x86_64": "elf_x86_64_fbsd",
},
"other": {
"i386": "elf_i386",
"x86_64": "elf_x86_64",
}
};
if (targetOS.includes("windows"))
return linkerFlags["windows"][targetArch];
else if (targetOS.includes("freebsd"))
return linkerFlags["freebsd"][targetArch];
return linkerFlags["other"][targetArch];
}
function targetFlags(tool, hasTargetOption, target, targetArch, machineType, targetOS) {
var args = [];
if (hasTargetOption) {
if (target)
args.push("-target", target);
} else {
var archArgs = {
"compiler": {
"i386": ["-m32"],
"x86_64": ["-m64"],
},
"linker": {
"i386": ["-m", targetLinkerFlags("i386", targetOS)],
"x86_64": ["-m", targetLinkerFlags("x86_64", targetOS)],
},
"assembler": {
"i386": ["--32"],
"x86_64": ["--64"],
},
};
var flags = archArgs[tool] ? archArgs[tool][targetArch] : undefined;
if (flags)
args = args.concat(flags);
if (machineType && tool !== "linker")
args.push("-march=" + machineType);
}
return args;
}
function toolNames(rawToolNames, toolchainPrefix)
{
return toolchainPrefix
? rawToolNames.map(function(rawName) { return toolchainPrefix + rawName; })
: rawToolNames;
}
function pathPrefix(baseDir, prefix)
{
var path = '';
if (baseDir) {
path += baseDir;
if (path.substr(-1) !== '/')
path += '/';
}
if (prefix)
path += prefix;
return path;
}
function appLinkerOutputArtifacts(product)
{
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.applicationFilePath(product)),
fileTags: ["bundle.input", "application"].concat(
product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []),
bundle: {
_bundleFilePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.bundleExecutableFilePath(product))
}
}
var artifacts = [app];
if (!product.aggregate)
artifacts = artifacts.concat(debugInfoArtifacts(product, undefined, "app"));
if (product.cpp.generateLinkerMapFile) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName + product.cpp.linkerMapSuffix),
fileTags: ["mem_map"]
});
}
if (product.qbs.toolchain.includes("emscripten"))
artifacts = artifacts.concat(wasmArtifacts(product));
return artifacts;
}
function moduleLinkerOutputArtifacts(product, inputs)
{
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.loadableModuleFilePath(product)),
fileTags: ["bundle.input", "loadablemodule"]
.concat(product.cpp.shouldSignArtifacts
? ["codesign.signed_artifact"] : []),
bundle: {
_bundleFilePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.bundleExecutableFilePath(product))
}
}
var artifacts = [app];
if (!product.aggregate)
artifacts = artifacts.concat(debugInfoArtifacts(product, undefined,
"loadablemodule"));
return artifacts;
}
function staticLibLinkerOutputArtifacts(product)
{
var tags = ["bundle.input", "staticlibrary"];
var objs = inputs["obj"];
var objCount = objs ? objs.length : 0;
for (var i = 0; i < objCount; ++i) {
var ft = objs[i].fileTags;
if (ft.includes("c_obj"))
tags.push("c_staticlibrary");
if (ft.includes("cpp_obj"))
tags.push("cpp_staticlibrary");
}
return [{
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.staticLibraryFilePath(product)),
fileTags: tags,
bundle: {
_bundleFilePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.bundleExecutableFilePath(product))
}
}];
}
function staticLibLinkerCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var args = ['rcs', output.filePath];
for (var i in inputs.obj)
args.push(inputs.obj[i].filePath);
for (var i in inputs.res)
args.push(inputs.res[i].filePath);
var cmd = new Command(product.cpp.archiverPath, args);
cmd.description = 'creating ' + output.fileName;
cmd.highlight = 'linker'
cmd.jobPool = "linker";
cmd.responseFileUsagePrefix = '@';
setResponseFileThreshold(cmd, product);
return cmd;
}
function dynamicLibLinkerOutputArtifacts(product)
{
var artifacts = [{
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.dynamicLibraryFilePath(product)),
fileTags: ["bundle.input", "dynamiclibrary"]
.concat(product.cpp.shouldSignArtifacts
? ["codesign.signed_artifact"] : []),
bundle: {
_bundleFilePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.bundleExecutableFilePath(product))
}
}];
if (product.cpp.imageFormat === "pe") {
artifacts.push({
fileTags: ["dynamiclibrary_import"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.importLibraryFilePath(product)),
alwaysUpdated: false
});
} else {
// List of libfoo's public symbols for smart re-linking.
artifacts.push({
filePath: product.destinationDirectory + "/.sosymbols/"
+ PathTools.dynamicLibraryFilePath(product),
fileTags: ["dynamiclibrary_symbols"],
alwaysUpdated: false,
});
}
artifacts = artifacts.concat(librarySymlinkArtifacts(product));
if (!product.aggregate)
artifacts = artifacts.concat(debugInfoArtifacts(product, undefined, "dll"));
return artifacts;
}
function wasmArtifacts(product)
{
var flags = product.cpp.driverLinkerFlags;
var wasmoption = 1;
var pthread = false;
for (var index in flags) {
var option = flags[index];
if (option.indexOf("WASM") !== -1) {
option = option.trim();
wasmoption = option.substring(option.length - 1);
} else if (option.indexOf("-pthread") !== -1) {
pthread = true;
}
}
var artifacts = [];
var createAppArtifact = function(fileName) {
return {
filePath: FileInfo.joinPaths(product.destinationDirectory, fileName),
fileTags: ["wasm"]
};
};
var suffix = product.cpp.executableSuffix;
if (suffix !== ".wasm") {
if (suffix === ".html")
artifacts.push(createAppArtifact(product.targetName + ".js"));
if (pthread)
artifacts.push(createAppArtifact(product.targetName + ".worker.js"));
}
if (wasmoption !== 0 && suffix !== ".wasm") //suffix .wasm will already result in "application".wasm
artifacts.push(createAppArtifact(product.targetName + ".wasm"));
if (wasmoption == 2)
artifacts.push(createAppArtifact(product.targetName + ".wasm.js"));
return artifacts;
}
qbs-src-2.6.1/share/qbs/modules/cpp/macos-gcc.qbs 0000644 0001751 0000166 00000004032 14776170045 021133 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.ModUtils
import qbs.Utilities
DarwinGCC {
priority: 1
condition: qbs.targetOS.includes('macos') &&
qbs.toolchain && qbs.toolchain.includes('gcc')
targetSystem: "macosx" + (minimumMacosVersion || "")
minimumDarwinVersion: minimumMacosVersion
minimumDarwinVersionCompilerFlag: "-mmacosx-version-min"
minimumDarwinVersionLinkerFlag: "-macosx_version_min"
libcxxAvailable: base
&& minimumDarwinVersion
&& Utilities.versionCompare(minimumDarwinVersion, "10.7") >= 0
}
qbs-src-2.6.1/share/qbs/modules/cpp/dmc.js 0000644 0001751 0000166 00000047076 14776170045 017710 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Cpp = require("cpp.js");
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
var TemporaryDir = require("qbs.TemporaryDir");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function targetFlags(platform, architecture, extender, consoleApp, type) {
if (platform === "dos") {
if (architecture === "x86_16") {
if (extender === "dosz")
return ["-mz"];
else if (extender === "dosr")
return ["-mr"];
return ["-mc"];
} else if (architecture === "x86") {
if (extender === "dosx")
return ["-mx"];
else if (extender === "dosp")
return ["-mp"];
}
} else if (platform === "windows") {
var flags = [];
if (architecture === "x86_16") {
flags.push("-ml");
if (type.includes("application") && !consoleApp)
flags.push("-WA");
else if (type.includes("dynamiclibrary"))
flags.push("-WD");
} else if (architecture === "x86") {
flags.push("-mn");
if (type.includes("application"))
flags.push("-WA");
else if (type.includes("dynamiclibrary"))
flags.push("-WD");
}
return flags;
}
return [];
}
function languageFlags(tag) {
if (tag === "cpp")
return ["-cpp"];
return [];
}
function dumpMacros(compilerPath, platform, architecture, extender, tag) {
// Note: The DMC compiler does not support the predefined/ macros dumping. So, we do it
// with the following trick, where we try to create and compile a special temporary file
// and to parse the console output with the own magic pattern: #define .
var outputDirectory = new TemporaryDir();
var outputFilePath = FileInfo.joinPaths(outputDirectory.path(), "dump-macros.c");
var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly);
outputFile.writeLine("#define VALUE_TO_STRING(x) #x");
outputFile.writeLine("#define VALUE(x) VALUE_TO_STRING(x)");
outputFile.writeLine("#define VAR_NAME_VALUE(var) \"#define \" #var\" \"VALUE(var)");
// Declare all available pre-defined macros of DMC compiler.
var keys = [
// Prepare the DOS target macros.
"_MSDOS", "MSDOS",
// Prepare the OS/2 target macros.
"__OS2__",
// Prepare the Windows target macros.
"WIN32", "_WIN32", "__NT__",
// Prepare extended the 32 and 16 bit DOS target macros.
"DOS386", "DOS16RM",
// Prepare the memory model macros.
"M_I86", "_M_I86",
"_M_I86TM", "M_I86TM",
"_M_I86SM", "M_I86SM",
"_M_I86MM", "M_I86MM",
"_M_I86CM", "M_I86CM",
"_M_I86LM", "M_I86LM",
"_M_I86VM", "M_I86VM",
// Prepare 8086 macros.
"_M_I8086", "M_I8086",
// Prepare 286 macros.
"_M_I286", "M_I286",
// Prepare 32 bit macros.
"_M_IX86",
// Prepare compiler identification macros.
"__DMC__", "__DMC_VERSION_STRING__",
// Prepare common compiler macros.
"_CHAR_UNSIGNED", "_CHAR_EQ_UCHAR", "_DEBUG_TRACE", "_DLL",
"_ENABLE_ARRAYNEW", "_BOOL_DEFINED", "_WCHAR_T_DEFINED",
"_CPPRTTI", "_CPPUNWIND", "_MD", "_PUSHPOP_SUPPORTED",
"_STDCALL_SUPPORTED", "__INTSIZE", "__DEFALIGN", "_INTEGRAL_MAX_BITS",
"_WINDOWS", "_WINDLL", "__INLINE_8087", "__I86__", "__SMALL__",
"__MEDIUM__", "__COMPACT__", "__LARGE__", "__VCM__", "__FPCE__",
"__FPCE__IEEE__", "DEBUG",
// Prepare C99 and C++98 macros.
"__STDC__", "__STDC_HOSTED__", "__STDC_VERSION__", "__STDC_IEC_559__",
"__STDC_IEC_559_COMPLEX__", "__STDC_ISO_10646__", "__cplusplus"
];
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
outputFile.writeLine("#if defined (" + key + ")");
outputFile.writeLine("#pragma message (VAR_NAME_VALUE(" + key + "))");
outputFile.writeLine("#endif");
}
outputFile.close();
var process = new Process();
process.setWorkingDirectory(outputDirectory.path());
var lang = languageFlags(tag);
var target = targetFlags(platform, architecture, extender, false, ["application"]);
var args = ["-c"].concat(lang, target, FileInfo.toWindowsSeparators(outputFilePath));
process.exec(compilerPath, args, false);
File.remove(outputFilePath);
var out = process.readStdOut();
return Cpp.extractMacros(out);
}
function dumpDefaultPaths(compilerFilePath, tag) {
var binPath = FileInfo.path(compilerFilePath);
var rootPath = FileInfo.path(binPath);
var includePaths = [];
var cppIncludePath = FileInfo.joinPaths(rootPath, "stlport/stlport");
if (File.exists(cppIncludePath))
includePaths.push(cppIncludePath);
var cIncludePath = FileInfo.joinPaths(rootPath, "include");
if (File.exists(cIncludePath))
includePaths.push(cIncludePath);
var libraryPaths = [];
var libraryPath = FileInfo.joinPaths(rootPath, "lib");
if (File.exists(libraryPath))
libraryPaths.push(libraryPath);
return {
"includePaths": includePaths,
"libraryPaths": libraryPaths,
}
}
function guessVersion(macros) {
var version = macros["__DMC__"];
return { major: parseInt(version / 100),
minor: parseInt(version % 100),
patch: 0 };
}
function effectiveLinkerPath(product) {
if (product.cpp.linkerMode === "automatic") {
var compilerPath = product.cpp.compilerPath;
if (compilerPath)
return compilerPath;
console.log("Found no C-language objects, choosing system linker for " + product.name);
}
return product.cpp.linkerPath;
}
function useCompilerDriverLinker(product) {
var linker = effectiveLinkerPath(product);
var compilers = product.cpp.compilerPathByLanguage;
if (compilers)
return linker === compilers["cpp"] || linker === compilers["c"];
return linker === product.cpp.compilerPath;
}
function depsOutputTags() {
return ["dep"];
}
function depsOutputArtifacts(input, product) {
return [{
fileTags: depsOutputTags(),
filePath: FileInfo.joinPaths(product.destinationDirectory,
input.baseName + ".dep")
}];
}
function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = ["-c"];
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
args = args.concat(languageFlags(tag));
args = args.concat(targetFlags(product.qbs.targetPlatform, product.qbs.architecture,
product.cpp.extenderName, product.consoleApplication,
product.type));
// Input.
args.push(FileInfo.toWindowsSeparators(input.filePath));
// Output.
args.push("-o" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath));
// Preinclude headers.
args = args.concat(Cpp.collectPreincludePaths(input).map(function(path) {
return input.cpp.preincludeFlag + FileInfo.toWindowsSeparators(path);
}));
// Defines.
args = args.concat(Cpp.collectDefinesArguments(input));
if (tag === "cpp") {
// We need to add the paths to the STL includes, because the DMC compiler does
// not handle it by default (because the STL libraries is a separate port).
var compilerIncludePaths = input.cpp.compilerIncludePaths || [];
args = args.concat(compilerIncludePaths.map(function(path) {
return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path);
}));
}
// Other includes.
args = args.concat(Cpp.collectIncludePaths(input).map(function(path) {
return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path);
}));
args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) {
return input.cpp.systemIncludeFlag + FileInfo.toWindowsSeparators(path);
}));
// Debug information flags.
if (input.cpp.debugInformation)
args.push("-d");
// Optimization flags.
switch (input.cpp.optimization) {
case "small":
args.push("-o+space");
break;
case "fast":
args.push("-o+speed");
break;
case "none":
args.push("-o+none");
break;
}
// Warning level flags.
switch (input.cpp.warningLevel) {
case "none":
args.push("-w");
break;
case "all":
args.push("-w-");
break;
}
if (input.cpp.treatWarningsAsErrors)
args.push("-wx");
if (tag === "cpp") {
// Exceptions flag.
if (input.cpp.enableExceptions)
args.push("-Ae");
// RTTI flag.
var enableRtti = input.cpp.enableRtti;
if (input.cpp.enableRtti)
args.push("-Ar");
}
// Listing files generation flag.
if (input.cpp.generateCompilerListingFiles) {
// We need to use the relative path here, because the DMC compiler does not handle
// a long file path for this option.
var listingPath = Cpp.relativePath(product.buildDirectory, outputs.lst[0].filePath);
args.push("-l" + FileInfo.toWindowsSeparators(listingPath));
}
// Misc flags.
args = args.concat(Cpp.collectMiscCompilerArguments(input, tag),
Cpp.collectMiscDriverArguments(product));
return args;
}
function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = ["-c"];
// Input.
args.push(FileInfo.toWindowsSeparators(input.filePath));
// Output.
args.push("-o" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath));
// Preinclude headers.
args = args.concat(Cpp.collectPreincludePaths(input).map(function(path) {
return input.cpp.preincludeFlag + FileInfo.toWindowsSeparators(path);
}));
// Defines.
args = args.concat(Cpp.collectDefinesArguments(input));
// Other includes.
args = args.concat(Cpp.collectIncludePaths(input).map(function(path) {
return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path);
}));
args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) {
return input.cpp.systemIncludeFlag + FileInfo.toWindowsSeparators(path);
}));
// Misc flags.
args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm"));
return args;
}
function linkerFlags(project, product, inputs, outputs) {
var args = [];
var useCompilerDriver = useCompilerDriverLinker(product);
if (useCompilerDriver) {
args = args.concat(targetFlags(product.qbs.targetPlatform, product.qbs.architecture,
product.cpp.extenderName, product.consoleApplication,
product.type));
// Input objects.
args = args.concat(Cpp.collectLinkerObjectPaths(inputs).map(function(path) {
return FileInfo.toWindowsSeparators(path);
}));
// Input resources.
args = args.concat(Cpp.collectResourceObjectPaths(inputs).map(function(path) {
return FileInfo.toWindowsSeparators(path);
}));
// Input libraries.
args = args.concat(Cpp.collectAbsoluteLibraryDependencyPaths(product).map(function(path) {
return FileInfo.toWindowsSeparators(path);
}));
// Output.
if (product.type.includes("application")) {
args.push("-o" + FileInfo.toWindowsSeparators(outputs.application[0].filePath));
args.push("-L/" + (product.cpp.generateLinkerMapFile ? "MAP" : "NOMAP"));
if (product.qbs.targetPlatform === "windows" && product.qbs.architecture === "x86")
args.push("-L/SUBSYSTEM:" + (product.consoleApplication ? "CONSOLE" : "WINDOWS"));
} else if (product.type.includes("dynamiclibrary")) {
args.push("-o" + FileInfo.toWindowsSeparators(outputs.dynamiclibrary[0].filePath));
if (product.qbs.targetPlatform === "windows" && product.qbs.architecture === "x86") {
args.push("kernel32.lib");
args.push("-L/IMPLIB:" + FileInfo.toWindowsSeparators(
outputs.dynamiclibrary_import[0].filePath));
}
}
if (product.cpp.debugInformation)
args.push("-L/DEBUG");
args.push("-L/NOLOGO", "-L/SILENT");
}
// Misc flags.
args = args.concat(Cpp.collectMiscEscapableLinkerArguments(product),
Cpp.collectMiscLinkerArguments(product),
Cpp.collectMiscDriverArguments(product));
return args;
}
function archiverFlags(project, product, inputs, outputs) {
var args = ["-c"];
// Output.
args.push(FileInfo.toWindowsSeparators(outputs.staticlibrary[0].filePath));
// Input objects.
args = args.concat(Cpp.collectLinkerObjectPaths(inputs).map(function(path) {
return FileInfo.toWindowsSeparators(path);
}));
return args;
}
function rccCompilerFlags(project, product, input, outputs) {
// Input.
var args = [FileInfo.toWindowsSeparators(input.filePath)];
// Output.
args.push("-o" + FileInfo.toWindowsSeparators(outputs.res[0].filePath));
// Bitness.
args.push("-32");
// Defines
args = args.concat(Cpp.collectDefinesArguments(input));
// Other includes.
args = args.concat(Cpp.collectIncludePaths(input).map(function(path) {
return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path);
}));
args = args.concat(Cpp.collectSystemIncludePaths(input).map(function(path) {
return input.cpp.systemIncludeFlag + FileInfo.toWindowsSeparators(path);
}));
return args;
}
function buildLinkerMapFilePath(target, suffix) {
return FileInfo.joinPaths(FileInfo.path(target.filePath),
FileInfo.completeBaseName(target.fileName) + suffix);
}
// It is a workaround which removes the generated linker map file if it is disabled
// by cpp.generateLinkerMapFile property. Reason is that the DMC compiler always
// generates this file, and does not have an option to disable generation for a linker
// map file. So, we can to remove a listing files only after the linking completes.
function removeLinkerMapFile(project, product, inputs, outputs, input, output) {
var target = outputs.dynamiclibrary ? outputs.dynamiclibrary[0]
: outputs.application[0];
var cmd = new JavaScriptCommand();
cmd.mapFilePath = buildLinkerMapFilePath(target, ".map")
cmd.silent = true;
cmd.sourceCode = function() { File.remove(mapFilePath); };
return cmd;
}
// It is a workaround to rename the extension of the output linker map file to the
// specified one, since the linker generates only files with the '.map' extension.
function renameLinkerMapFile(project, product, inputs, outputs, input, output) {
var target = outputs.dynamiclibrary ? outputs.dynamiclibrary[0]
: outputs.application[0];
var cmd = new JavaScriptCommand();
cmd.newMapFilePath = buildLinkerMapFilePath(target, product.cpp.linkerMapSuffix);
cmd.oldMapFilePath = buildLinkerMapFilePath(target, ".map");
cmd.silent = true;
cmd.sourceCode = function() {
if (oldMapFilePath !== newMapFilePath)
File.move(oldMapFilePath, newMapFilePath);
};
return cmd;
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn);
var cmd = new Command(input.cpp.compilerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "compiler";
return [cmd];
}
function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn);
var cmd = new Command(input.cpp.assemblerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "assembler";
return [cmd];
}
function prepareLinker(project, product, inputs, outputs, input, output) {
var cmds = [];
var primaryOutput = outputs.dynamiclibrary ? outputs.dynamiclibrary[0]
: outputs.application[0];
var args = linkerFlags(project, product, inputs, outputs);
var linkerPath = effectiveLinkerPath(product);
var cmd = new Command(linkerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "linking " + primaryOutput.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
cmds.push(cmd);
if (product.cpp.generateLinkerMapFile)
cmds.push(renameLinkerMapFile(project, product, inputs, outputs, input, output));
else
cmds.push(removeLinkerMapFile(project, product, inputs, outputs, input, output));
return cmds;
}
function prepareArchiver(project, product, inputs, outputs, input, output) {
var args = archiverFlags(project, product, inputs, outputs);
var cmd = new Command(product.cpp.archiverPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "creating " + output.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
return [cmd];
}
function prepareRccCompiler(project, product, inputs, outputs, input, output) {
var args = rccCompilerFlags(project, product, input, outputs);
var cmd = new Command(input.cpp.rccCompilerPath, args);
cmd.workingDirectory = product.buildDirectory;
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "compiler";
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/cpp/watchos-gcc.qbs 0000644 0001751 0000166 00000004270 14776170045 021505 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
DarwinGCC {
priority: 1
condition: qbs.targetOS.includes('watchos') &&
qbs.toolchain && qbs.toolchain.includes('gcc')
targetSystem: "watchos" + (minimumWatchosVersion || "")
minimumDarwinVersion: minimumWatchosVersion
minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("watchos-simulator")
? "-mwatchos-simulator-version-min"
: "-mwatchos-version-min"
minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("watchos-simulator")
? "-watchos_simulator_version_min"
: "-watchos_version_min"
}
qbs-src-2.6.1/share/qbs/modules/cpp/UnixGCC.qbs 0000644 0001751 0000166 00000003712 14776170045 020543 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
GenericGCC {
condition: qbs.toolchain && qbs.toolchain.includes("gcc")
&& qbs.targetOS.includes("unix")
priority: -50
dynamicLibraryPrefix: "lib"
loadableModulePrefix: "lib"
dynamicLibrarySuffix: ".so"
debugInfoSuffix: ".debug"
imageFormat: "elf"
systemRunPaths: ["/lib", "/usr/lib"].filter(function(p) { return File.exists(p); })
rpathOrigin: "$ORIGIN"
useRPathLink: true
rpathLinkFlag: "-rpath-link="
}
qbs-src-2.6.1/share/qbs/modules/cpp/msvc.js 0000644 0001751 0000166 00000074747 14776170045 020122 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Codesign = require("../codesign/codesign.js");
var Cpp = require("cpp.js");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var Utilities = require("qbs.Utilities");
var WindowsUtils = require("qbs.WindowsUtils");
function effectiveLinkerPath(product, inputs) {
if (product.cpp.linkerMode === "automatic") {
var compiler = product.cpp.compilerPath;
if (compiler) {
if (inputs.obj || inputs.staticlibrary) {
console.log("Found C/C++ objects, using compiler as a linker for " + product.name);
return compiler;
}
}
console.log("Found no C-language objects, choosing system linker for " + product.name);
}
return product.cpp.linkerPath;
}
function handleCpuFeatures(input, flags) {
if (!input.qbs.architecture)
return;
if (input.qbs.architecture.startsWith("x86")) {
if (input.qbs.architecture === "x86") {
var sse2 = input.cpufeatures.x86_sse2;
if (sse2 === true)
flags.push("/arch:SSE2");
if (sse2 === false)
flags.push("/arch:IA32");
}
if (input.cpufeatures.x86_avx === true)
flags.push("/arch:AVX");
if (input.cpufeatures.x86_avx2 === true)
flags.push("/arch:AVX2");
} else if (input.qbs.architecture.startsWith("arm")) {
if (input.cpufeatures.arm_vfpv4 === true)
flags.push("/arch:VFPv4");
if (input.cpp.machineType === "armv7ve")
flags.push("/arch:ARMv7VE");
}
}
function hasCxx17Option(input)
{
// Probably this is not the earliest version to support the flag, but we have tested this one
// and it's a pain to find out the exact minimum.
return (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 7)
|| Utilities.versionCompare(input.cpp.compilerVersion, "19.12.25831") >= 0;
}
function hasZCplusPlusOption(input)
{
// /Zc:__cplusplus is supported starting from Visual Studio 15.7
// Looks like closest MSVC version is 14.14.26428 (cl ver 19.14.26433)
// At least, this version is tested
// https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus
// clang-cl supports this option starting around-ish versions 8/9, but it
// ignores this option, so this doesn't really matter
// https://reviews.llvm.org/D45877
return (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 9)
|| Utilities.versionCompare(input.cpp.compilerVersion, "19.14.26433") >= 0;
}
function hasCxx20Option(input)
{
return (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 13)
|| Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30133.0") >= 0;
}
function hasCVerOption(input)
{
return (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 13)
|| Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30138.0") >= 0;
}
function supportsExternalIncludesOption(input) {
if (input.qbs.toolchain.includes("clang-cl"))
return false; // Exclude clang-cl.
// This option was introcuded since MSVC 2017 v15.6 (aka _MSC_VER 19.13).
// But due to some MSVC bugs:
// * https://developercommunity.visualstudio.com/content/problem/181006/externali-include-paths-not-working.html
// this option has been fixed since MSVC 2017 update 9, v15.9 (aka _MSC_VER 19.16).
return Utilities.versionCompare(input.cpp.compilerVersion, "19.16") >= 0;
}
function addCxxLanguageVersionFlag(input, args) {
var cxxVersion = Cpp.languageVersion(input.cpp.cxxLanguageVersion,
["c++23", "c++20", "c++17", "c++14", "c++11", "c++98"], "C++");
if (!cxxVersion)
return;
// Visual C++ 2013, Update 3 or clang-cl
var hasStdOption = input.qbs.toolchain.includes("clang-cl")
|| Utilities.versionCompare(input.cpp.compilerVersion, "18.00.30723") >= 0;
if (!hasStdOption)
return;
var flag;
if (cxxVersion === "c++14")
flag = "/std:c++14";
else if (cxxVersion === "c++17" && hasCxx17Option(input))
flag = "/std:c++17";
else if (cxxVersion === "c++20" && hasCxx20Option(input))
flag = "/std:c++20";
else if (cxxVersion !== "c++11" && cxxVersion !== "c++98")
flag = "/std:c++latest";
if (flag)
args.push(flag);
}
function addCLanguageVersionFlag(input, args) {
var cVersion = Cpp.languageVersion(input.cpp.cLanguageVersion,
["c17", "c11"], "C");
if (!cVersion)
return;
var hasStdOption = hasCVerOption(input);
if (!hasStdOption)
return;
var flag;
if (cVersion === "c17")
flag = "/std:c17";
else if (cVersion === "c11")
flag = "/std:c11";
if (flag)
args.push(flag);
}
function handleClangClArchitectureFlags(product, architecture, flags) {
if (product.qbs.toolchain.includes("clang-cl")) {
if (architecture === "x86")
flags.push("-m32");
else if (architecture === "x86_64")
flags.push("-m64");
}
}
function prepareCompilerInternal(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var i;
var debugInformation = input.cpp.debugInformation;
var args = ['/nologo', '/c']
handleCpuFeatures(input, args);
// Determine which C-language we're compiling
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(Object.keys(outputs)));
if (!["c", "cpp", "cppm"].includes(tag))
throw ("unsupported source language");
var enableExceptions = input.cpp.enableExceptions;
if (enableExceptions) {
var ehModel = input.cpp.exceptionHandlingModel;
switch (ehModel) {
case "default":
args.push("/EHsc"); // "Yes" in VS
break;
case "seh":
args.push("/EHa"); // "Yes with SEH exceptions" in VS
break;
case "externc":
args.push("/EHs"); // "Yes with Extern C functions" in VS
break;
}
}
var enableRtti = input.cpp.enableRtti;
if (enableRtti !== undefined) {
args.push(enableRtti ? "/GR" : "/GR-");
}
switch (input.cpp.optimization) {
case "small":
args.push('/Os')
break;
case "fast":
args.push('/O2')
break;
case "none":
args.push("/Od");
break;
}
handleClangClArchitectureFlags(product, input.cpp.architecture, args);
if (debugInformation) {
if (product.cpp.separateDebugInformation)
args.push('/Zi');
else
args.push('/Z7');
}
var rtl = product.cpp.runtimeLibrary;
if (rtl) {
rtl = (rtl === "static" ? "/MT" : "/MD");
if (product.qbs.enableDebugCode)
rtl += "d";
args.push(rtl);
}
args = args.concat(Cpp.collectMiscDriverArguments(product));
// warnings:
var warningLevel = input.cpp.warningLevel;
if (warningLevel === 'none')
args.push('/w')
if (warningLevel === 'all')
args.push('/Wall')
if (input.cpp.treatWarningsAsErrors)
args.push('/WX')
var includePaths = Cpp.collectIncludePaths(input);
args = args.concat([].uniqueConcat(includePaths).map(function(path) {
return input.cpp.includeFlag + FileInfo.toWindowsSeparators(path);
}));
var includeFlag = input.qbs.toolchain.includes("clang-cl")
? input.cpp.systemIncludeFlag : input.cpp.includeFlag;
if (!input.qbs.toolchain.includes("clang-cl")) {
if (supportsExternalIncludesOption(input)) {
args.push("/experimental:external");
var enforcesSlashW =
Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30037") >= 0
if (enforcesSlashW)
args.push("/external:W0")
includeFlag = input.cpp.systemIncludeFlag;
}
}
var systemIncludePaths = Cpp.collectSystemIncludePaths(input);
args = args.concat([].uniqueConcat(systemIncludePaths).map(function(path) {
return includeFlag + FileInfo.toWindowsSeparators(path);
}));
var defines = Cpp.collectDefines(input);
args = args.concat([].uniqueConcat(defines).map(function(define) {
return input.cpp.defineFlag + define.replace(/%/g, "%%");
}));
var minimumWindowsVersion = product.cpp.minimumWindowsVersion;
if (minimumWindowsVersion) {
var hexVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'hex');
if (hexVersion) {
var versionDefs = [ 'WINVER', '_WIN32_WINNT', '_WIN32_WINDOWS' ];
for (i in versionDefs) {
args.push(input.cpp.defineFlag + versionDefs[i] + '=' + hexVersion);
}
}
}
if (product.cpp.debugInformation && product.cpp.separateDebugInformation)
args.push("/Fd" + product.targetName + ".cl" + product.cpp.debugInfoSuffix);
if (input.cpp.generateCompilerListingFiles)
args.push("/Fa" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath));
if (input.cpp.enableCxxLanguageMacro && hasZCplusPlusOption(input))
args.push("/Zc:__cplusplus");
var objectMap = outputs.obj || outputs.intermediate_obj
var objOutput = objectMap ? objectMap[0] : undefined
args.push('/Fo' + FileInfo.toWindowsSeparators(objOutput.filePath))
args.push(FileInfo.toWindowsSeparators(input.filePath))
var preincludePaths = Cpp.collectPreincludePaths(input);
args = args.concat([].uniqueConcat(preincludePaths).map(function(path) {
return input.cpp.preincludeFlag + FileInfo.toWindowsSeparators(path);
}));
// Language
if (tag === "cpp" || tag === "cppm") {
args.push("/TP");
addCxxLanguageVersionFlag(input, args);
} else if (tag === "c") {
args.push("/TC");
addCLanguageVersionFlag(input, args);
}
var moduleMap = (outputs["modulemap"] || [])[0];
if (moduleMap) {
args.push("@" + moduleMap.filePath);
}
// Whether we're compiling a precompiled header or normal source file
var pchOutput = outputs[tag + "_pch"] ? outputs[tag + "_pch"][0] : undefined;
var pchInputs = explicitlyDependsOn[tag + "_pch"];
if (pchOutput) {
// create PCH
if (input.qbs.toolchain.includes("clang-cl")) {
// clang-cl does not support /Yc flag without filename
args.push("/Yc" + FileInfo.toWindowsSeparators(input.filePath));
// clang-cl complains when pch file is not included
args.push("/FI" + FileInfo.toWindowsSeparators(input.filePath));
args.push("/Fp" + FileInfo.toWindowsSeparators(pchOutput.filePath));
args.push("/Fo" + FileInfo.toWindowsSeparators(objOutput.filePath));
} else { // real msvc
args.push("/Yc");
args.push("/Fp" + FileInfo.toWindowsSeparators(pchOutput.filePath));
args.push("/Fo" + FileInfo.toWindowsSeparators(objOutput.filePath));
args.push(FileInfo.toWindowsSeparators(input.filePath));
}
} else if (pchInputs && pchInputs.length === 1
&& ModUtils.moduleProperty(input, "usePrecompiledHeader", tag)) {
// use PCH
var pchSourceArtifacts = product.artifacts[tag + "_pch_src"];
if (pchSourceArtifacts && pchSourceArtifacts.length > 0) {
var pchSourceFilePath = pchSourceArtifacts[0].filePath;
var pchFilePath = FileInfo.toWindowsSeparators(pchInputs[0].filePath);
args.push("/FI" + pchSourceFilePath);
args.push("/Yu" + pchSourceFilePath);
args.push("/Fp" + pchFilePath);
} else {
console.warning("products." + product.name + ".usePrecompiledHeader is true, "
+ "but there is no " + tag + "_pch_src artifact.");
}
}
args = args.concat(Cpp.collectMiscCompilerArguments(input, tag));
var compilerPath = product.cpp.compilerPath;
var wrapperArgs = product.cpp.compilerWrapper;
if (wrapperArgs && wrapperArgs.length > 0) {
args.unshift(compilerPath);
compilerPath = wrapperArgs.shift();
args = wrapperArgs.concat(args);
}
var cmd = new Command(compilerPath, args)
cmd.description = (pchOutput ? 'pre' : '') + 'compiling ' + input.fileName;
if (pchOutput)
cmd.description += ' (' + tag + ')';
cmd.highlight = "compiler";
cmd.jobPool = "compiler";
cmd.workingDirectory = product.buildDirectory;
cmd.responseFileUsagePrefix = '@';
// cl.exe outputs the cpp file name. We filter that out.
cmd.inputFileName = input.fileName;
cmd.relevantEnvironmentVariables = ["CL", "_CL_", "INCLUDE"];
cmd.stdoutFilterFunction = function(output) {
return output.split(inputFileName + "\r\n").join("");
};
return [cmd];
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var result = Cpp.prepareModules(project, product, inputs, outputs, input, output);
result = result.concat(prepareCompilerInternal(
project, product, inputs, outputs, input, output, explicitlyDependsOn));
return result;
}
function linkerSupportsWholeArchive(product)
{
return product.qbs.toolchainType.includes("clang-cl") ||
Utilities.versionCompare(product.cpp.compilerVersion, "19.0.24215.1") >= 0
}
function handleDiscardProperty(product, flags) {
var discardUnusedData = product.cpp.discardUnusedData;
if (discardUnusedData === true)
flags.push("/OPT:REF");
else if (discardUnusedData === false)
flags.push("/OPT:NOREF");
}
function prepareLinker(project, product, inputs, outputs, input, output) {
var i;
var linkDLL = (outputs.dynamiclibrary ? true : false)
var primaryOutput = (linkDLL ? outputs.dynamiclibrary[0] : outputs.application[0])
var debugInformation = product.cpp.debugInformation;
var additionalManifestInputs = Array.prototype.map.call(inputs["native.pe.manifest"] || [],
function (a) {
return a.filePath;
});
var moduleDefinitionInputs = Array.prototype.map.call(inputs["def"] || [],
function (a) {
return a.filePath;
});
var generateManifestFiles = !linkDLL && product.cpp.generateManifestFile;
var useClangCl = product.qbs.toolchain.includes("clang-cl");
var canEmbedManifest = useClangCl || product.cpp.compilerVersionMajor >= 17 // VS 2012
var linkerPath = effectiveLinkerPath(product, inputs);
var useCompilerDriver = linkerPath === product.cpp.compilerPath;
// args variable is built as follows:
// [linkerWrapper] linkerPath /nologo [driverFlags driverLinkerFlags]
// allInputs libDeps [/link] linkerArgs
var args = []
if (useCompilerDriver) {
args.push('/nologo');
args = args.concat(Cpp.collectMiscDriverArguments(product),
Cpp.collectMiscLinkerArguments(product));
}
var allInputs = [].concat(Cpp.collectLinkerObjectPaths(inputs),
Cpp.collectResourceObjectPaths(inputs));
args = args.concat([].uniqueConcat(allInputs).map(function(path) {
return FileInfo.toWindowsSeparators(path);
}));
var linkerArgs = ['/nologo']
if (linkDLL) {
linkerArgs.push('/DLL');
linkerArgs.push('/IMPLIB:' + FileInfo.toWindowsSeparators(outputs.dynamiclibrary_import[0].filePath));
}
if (debugInformation) {
linkerArgs.push("/DEBUG");
var debugInfo = outputs.debuginfo_app || outputs.debuginfo_dll;
if (debugInfo)
linkerArgs.push("/PDB:" + debugInfo[0].fileName);
} else {
linkerArgs.push('/INCREMENTAL:NO')
}
switch (product.qbs.architecture) {
case "x86":
linkerArgs.push("/MACHINE:X86");
break;
case "x86_64":
linkerArgs.push("/MACHINE:X64");
break;
case "ia64":
linkerArgs.push("/MACHINE:IA64");
break;
case "armv7":
linkerArgs.push("/MACHINE:ARM");
break;
case "arm64":
linkerArgs.push("/MACHINE:ARM64");
break;
}
if (useCompilerDriver)
handleClangClArchitectureFlags(product, product.qbs.architecture, args);
var requireAppContainer = product.cpp.requireAppContainer;
if (requireAppContainer !== undefined)
linkerArgs.push("/APPCONTAINER" + (requireAppContainer ? "" : ":NO"));
var minimumWindowsVersion = product.cpp.minimumWindowsVersion;
var subsystemSwitch = undefined;
if (minimumWindowsVersion || product.consoleApplication !== undefined) {
// Ensure that we default to console if product.consoleApplication is undefined
// since that could still be the case if only minimumWindowsVersion had been defined
subsystemSwitch = product.consoleApplication === false ? '/SUBSYSTEM:WINDOWS' : '/SUBSYSTEM:CONSOLE';
}
var useLldLink = useCompilerDriver && product.cpp.linkerVariant === "lld"
|| !useCompilerDriver && product.cpp.linkerName === "lld-link.exe";
if (minimumWindowsVersion) {
var subsystemVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion,
'subsystem');
if (subsystemVersion) {
subsystemSwitch += ',' + subsystemVersion;
// llvm linker does not support /OSVERSION
if (!useLldLink)
linkerArgs.push('/OSVERSION:' + subsystemVersion);
}
}
if (subsystemSwitch)
linkerArgs.push(subsystemSwitch);
var linkerOutputNativeFilePath = FileInfo.toWindowsSeparators(primaryOutput.filePath);
var manifestFileNames = [];
if (generateManifestFiles) {
if (canEmbedManifest) {
linkerArgs.push("/MANIFEST:embed");
additionalManifestInputs.forEach(function (manifestFileName) {
linkerArgs.push("/MANIFESTINPUT:" + manifestFileName);
});
} else {
linkerOutputNativeFilePath
= FileInfo.toWindowsSeparators(
FileInfo.path(primaryOutput.filePath) + "/intermediate."
+ primaryOutput.fileName);
var manifestFileName = linkerOutputNativeFilePath + ".manifest";
linkerArgs.push('/MANIFEST', '/MANIFESTFILE:' + manifestFileName);
manifestFileNames = [manifestFileName].concat(additionalManifestInputs);
}
}
if (moduleDefinitionInputs.length === 1)
linkerArgs.push("/DEF:" + moduleDefinitionInputs[0]);
else if (moduleDefinitionInputs.length > 1)
throw new Error("Only one '.def' file can be specified for linking");
var wholeArchiveSupported = linkerSupportsWholeArchive(product);
var wholeArchiveRequested = false;
var libDeps = Cpp.collectLibraryDependencies(product);
var prevLib;
for (i = 0; i < libDeps.length; ++i) {
var dep = libDeps[i];
var lib = dep.filePath;
if (lib === prevLib)
continue;
prevLib = lib;
if (wholeArchiveSupported && dep.wholeArchive) {
// need to pass libraries to the driver to avoid "no input files" error if no object
// files are specified; thus libraries are duplicated when using "WHOLEARCHIVE"
if (useCompilerDriver && allInputs.length === 0)
args.push(FileInfo.toWindowsSeparators(lib));
linkerArgs.push("/WHOLEARCHIVE:" + FileInfo.toWindowsSeparators(lib));
} else {
args.push(FileInfo.toWindowsSeparators(lib));
}
if (dep.wholeArchive)
wholeArchiveRequested = true;
}
if (wholeArchiveRequested && !wholeArchiveSupported) {
console.warn("Product '" + product.name + "' sets cpp.linkWholeArchive on a dependency, "
+ "but your linker does not support the /WHOLEARCHIVE option. "
+ "Please upgrade to Visual Studio 2015 Update 2 or higher.");
}
if (product.cpp.entryPoint)
linkerArgs.push("/ENTRY:" + product.cpp.entryPoint);
if (outputs.application && product.cpp.generateLinkerMapFile) {
if (useLldLink)
linkerArgs.push("/lldmap:" + outputs.mem_map[0].filePath);
else
linkerArgs.push("/MAP:" + outputs.mem_map[0].filePath);
}
if (useCompilerDriver)
args.push('/Fe' + linkerOutputNativeFilePath);
else
linkerArgs.push('/OUT:' + linkerOutputNativeFilePath);
var libraryPaths = Cpp.collectLibraryPaths(product);
linkerArgs = linkerArgs.concat([].uniqueConcat(libraryPaths).map(function(path) {
return product.cpp.libraryPathFlag + FileInfo.toWindowsSeparators(path);
}));
handleDiscardProperty(product, linkerArgs);
var linkerFlags = product.cpp.platformLinkerFlags.concat(product.cpp.linkerFlags);
linkerArgs = linkerArgs.concat(linkerFlags);
if (product.cpp.allowUnresolvedSymbols)
linkerArgs.push("/FORCE:UNRESOLVED");
var wrapperArgs = product.cpp.linkerWrapper;
if (wrapperArgs && wrapperArgs.length > 0) {
args.unshift(linkerPath);
linkerPath = wrapperArgs.shift();
args = wrapperArgs.concat(args);
}
var commands = [];
var warningCmd = new JavaScriptCommand();
warningCmd.silent = true;
warningCmd.libDeps = libDeps;
warningCmd.sourceCode = function() {
for (var i = 0; i < libDeps.length; ++i) {
if (!libDeps[i].productName || File.exists(libDeps[i].filePath))
continue;
console.warn("Import library '" + FileInfo.toNativeSeparators(libDeps[i].filePath)
+ "' does not exist. This typically happens when a DLL does not "
+ "export any symbols. Please make sure the '" + libDeps[i].productName
+ "' library exports symbols, or, if you do not intend to actually "
+ "link against it, specify \"cpp.link: false\" in the Depends item.");
}
};
commands.push(warningCmd);
if (linkerArgs.length !== 0)
args = args.concat(useCompilerDriver ? ['/link'] : []).concat(linkerArgs);
var cmd = new Command(linkerPath, args)
cmd.description = 'linking ' + primaryOutput.fileName;
cmd.highlight = 'linker';
cmd.jobPool = "linker";
cmd.relevantEnvironmentVariables = ["LINK", "_LINK_", "LIB", "TMP"];
cmd.workingDirectory = FileInfo.path(primaryOutput.filePath)
cmd.responseFileUsagePrefix = '@';
cmd.responseFileSeparator = useCompilerDriver ? ' ' : '\n';
cmd.stdoutFilterFunction = function(output) {
res = output.replace(/^.*performing full link.*\s*/, "");
res = res.replace(/^ *Creating library.*\s*/, "");
res = res.replace(/^\s*Generating code\s*/, "");
res = res.replace(/^\s*Finished generating code\s*/, "");
return res;
};
commands.push(cmd);
if (generateManifestFiles && !canEmbedManifest) {
var outputNativeFilePath = FileInfo.toWindowsSeparators(primaryOutput.filePath);
cmd = new JavaScriptCommand();
cmd.src = linkerOutputNativeFilePath;
cmd.dst = outputNativeFilePath;
cmd.sourceCode = function() {
File.copy(src, dst);
}
cmd.silent = true
commands.push(cmd);
args = ['/nologo', '/manifest'].concat(manifestFileNames);
args.push("/outputresource:" + outputNativeFilePath + ";#" + (linkDLL ? "2" : "1"));
cmd = new Command("mt.exe", args)
cmd.description = 'embedding manifest into ' + primaryOutput.fileName;
cmd.highlight = 'linker';
cmd.workingDirectory = FileInfo.path(primaryOutput.filePath)
commands.push(cmd);
}
if (product.cpp.shouldSignArtifacts) {
Array.prototype.push.apply(
commands, Codesign.prepareSigntool(
project, product, inputs, outputs, input, output));
}
return commands;
}
function createRcCommand(binary, input, output, logo) {
var platformDefines = input.cpp.platformDefines;
var defines = input.cpp.defines;
var includePaths = input.cpp.includePaths;
var systemIncludePaths = input.cpp.systemIncludePaths;
var args = [];
if (logo === "can-suppress-logo")
args.push("/nologo");
for (i in platformDefines) {
args.push("/d");
args.push(platformDefines[i]);
}
for (i in defines) {
args.push("/d");
args.push(defines[i]);
}
for (i in includePaths) {
args.push("/I");
args.push(includePaths[i]);
}
for (i in systemIncludePaths) {
args.push("/I");
args.push(systemIncludePaths[i]);
}
args = args.concat(["/FO", output.filePath, input.filePath]);
var cmd = new Command(binary, args);
cmd.description = 'compiling ' + input.fileName;
cmd.highlight = 'compiler';
cmd.jobPool = "compiler";
if (logo === "always-shows-logo") {
// Remove the first two lines of stdout. That's the logo.
cmd.stdoutFilterFunction = function(output) {
var idx = 0;
for (var i = 0; i < 3; ++i)
idx = output.indexOf('\n', idx + 1);
return output.substr(idx + 1);
}
}
return cmd;
}
function assemblerCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn)
{
var args = ["/nologo", "/c", "/Fo" + FileInfo.toWindowsSeparators(output.filePath)];
if (product.cpp.debugInformation)
args.push("/Zi");
args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm"));
args.push(FileInfo.toWindowsSeparators(input.filePath));
var cmd = new Command(product.cpp.assemblerPath, args);
cmd.description = "assembling " + input.fileName;
cmd.jobPool = "assembler";
cmd.inputFileName = input.fileName;
cmd.stdoutFilterFunction = function(output) {
var lines = output.split("\r\n").filter(function (s) {
return !s.endsWith(inputFileName); });
return lines.join("\r\n");
};
return cmd;
}
function libtoolOutputArtifacts(product)
{
var artifacts = [
{
fileTags: ["staticlibrary"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.staticLibraryFilePath(product))
}
];
if (product.cpp.debugInformation && product.cpp.separateDebugInformation) {
artifacts.push({
fileTags: ["debuginfo_cl"],
filePath: product.targetName + ".cl" + product.cpp.debugInfoSuffix
});
}
return artifacts;
}
function libtoolCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn)
{
var args = ['/nologo']
var lib = outputs["staticlibrary"][0];
var nativeOutputFileName = FileInfo.toWindowsSeparators(lib.filePath)
args.push('/OUT:' + nativeOutputFileName)
for (var i in inputs.obj) {
var fileName = FileInfo.toWindowsSeparators(inputs.obj[i].filePath)
args.push(fileName)
}
for (var i in inputs.res) {
var fileName = FileInfo.toWindowsSeparators(inputs.res[i].filePath)
args.push(fileName)
}
var cmd = new Command("lib.exe", args);
cmd.description = 'creating ' + lib.fileName;
cmd.highlight = 'linker';
cmd.jobPool = "linker";
cmd.workingDirectory = FileInfo.path(lib.filePath)
cmd.responseFileUsagePrefix = '@';
return cmd;
}
function dllLinkerOutputArtifacts(product)
{
var artifacts = [
{
fileTags: ["dynamiclibrary"].concat(
product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []),
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.dynamicLibraryFilePath(product))
},
{
fileTags: ["dynamiclibrary_import"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.importLibraryFilePath(product)),
alwaysUpdated: false
}
];
if (product.cpp.debugInformation && product.cpp.separateDebugInformation) {
var lib = artifacts[0];
artifacts.push({
fileTags: ["debuginfo_dll"],
filePath: lib.filePath.substr(0, lib.filePath.length - 4)
+ product.cpp.debugInfoSuffix
});
}
return artifacts;
}
function appLinkerOutputArtifacts(product)
{
var app = {
fileTags: ["application"].concat(
product.cpp.shouldSignArtifacts ? ["codesign.signed_artifact"] : []),
filePath: FileInfo.joinPaths(
product.destinationDirectory,
PathTools.applicationFilePath(product))
};
var artifacts = [app];
if (product.cpp.debugInformation && product.cpp.separateDebugInformation) {
artifacts.push({
fileTags: ["debuginfo_app"],
filePath: app.filePath.substr(0, app.filePath.length - 4)
+ product.cpp.debugInfoSuffix
});
}
if (product.cpp.generateLinkerMapFile) {
artifacts.push({
fileTags: ["mem_map"],
filePath: FileInfo.joinPaths(
product.destinationDirectory,
product.targetName + product.cpp.linkerMapSuffix)
});
}
return artifacts;
}
qbs-src-2.6.1/share/qbs/modules/cpp/MingwBaseModule.qbs 0000644 0001751 0000166 00000010234 14776170045 022322 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.TextFile
import qbs.Utilities
import qbs.WindowsUtils
import "setuprunenv.js" as SetupRunEnv
GenericGCC {
condition: false
dynamicLibrarySuffix: ".dll"
executableSuffix: ".exe"
debugInfoSuffix: ".debug"
imageFormat: "pe"
windowsApiCharacterSet: "unicode"
platformDefines: base.concat(WindowsUtils.characterSetDefines(windowsApiCharacterSet))
.concat("WIN32")
runtimeLibrary: "dynamic"
Properties {
condition: product.multiplexByQbsProperties.includes("buildVariants")
&& qbs.buildVariants && qbs.buildVariants.length > 1
&& qbs.buildVariant !== "release"
&& product.type.containsAny(["staticlibrary", "dynamiclibrary"])
variantSuffix: "d"
}
FileTagger {
patterns: ["*.manifest"]
fileTags: ["native.pe.manifest"]
}
FileTagger {
patterns: ["*.rc"]
fileTags: ["rc"]
}
Rule {
inputs: ["native.pe.manifest"]
multiplex: true
outputFileTags: ["rc"]
outputArtifacts: {
if (product.type.containsAny(["application", "dynamiclibrary"])) {
return [{
filePath: input.completeBaseName + ".rc",
fileTags: ["rc"]
}];
}
return [];
}
prepare: {
var inputList = inputs["native.pe.manifest"];
// TODO: Emulate manifest merging like Microsoft's mt.exe tool does
if (inputList.length !== 1) {
throw("The MinGW toolchain does not support manifest merging; " +
"you may only specify a single manifest file to embed into your assembly.");
}
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.productType = product.type;
cmd.inputFilePath = inputList[0].filePath;
cmd.outputFilePath = output.filePath;
cmd.sourceCode = function() {
var tf;
try {
tf = new TextFile(outputFilePath, TextFile.WriteOnly);
if (productType.includes("application"))
tf.write("1 "); // CREATEPROCESS_MANIFEST_RESOURCE_ID
else if (productType.includes("dynamiclibrary"))
tf.write("2 "); // ISOLATIONAWARE_MANIFEST_RESOURCE_ID
tf.write("24 "); // RT_MANIFEST
tf.writeLine(Utilities.cStringQuote(inputFilePath));
} finally {
if (tf)
tf.close();
}
};
return [cmd];
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/LinuxGCC.qbs 0000644 0001751 0000166 00000005405 14776170045 020720 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Host
import qbs.Process
UnixGCC {
condition: qbs.targetOS.includes('linux') &&
qbs.toolchain && qbs.toolchain.includes('gcc')
priority: 1
targetVendor: "pc"
targetSystem: "linux"
targetAbi: "gnu"
Probe {
id: runPathsProbe
condition: !_skipAllChecks && qbs.targetPlatform === Host.platform()
property stringList systemRunPaths: []
configure: {
var paths = [];
var ldconfig = new Process();
try {
var success = ldconfig.exec("ldconfig", ["-vNX"]);
if (success === -1)
return;
var line;
do {
line = ldconfig.readLine();
if (line.charAt(0) === '/') {
var colonIndex = line.indexOf(':');
if (colonIndex == -1)
continue;
paths.push(line.slice(0, colonIndex));
}
} while (line && line.length > 0)
found = true;
systemRunPaths = paths;
} finally {
ldconfig.close();
}
}
}
systemRunPaths: runPathsProbe.found ? runPathsProbe.systemRunPaths : base
}
qbs-src-2.6.1/share/qbs/modules/cpp/DarwinGCC.qbs 0000644 0001751 0000166 00000026715 14776170045 021054 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.DarwinTools
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.PathTools
import qbs.Probes
import qbs.PropertyList
import qbs.TextFile
import qbs.Utilities
import "darwin.js" as Darwin
import "gcc.js" as Gcc
UnixGCC {
condition: false
Depends { name: "xcode"; required: qbs.toolchain && qbs.toolchain.includes("xcode") }
Probes.BinaryProbe {
id: lipoProbe
condition: !_skipAllChecks
names: [lipoName]
platformSearchPaths: {
var paths = (xcode.present && xcode.devicePlatformPath)
? [xcode.devicePlatformPath + "/Developer/usr/bin"]
: [];
return paths.concat([toolchainInstallPath, "/usr/bin"]);
}
}
property string lipoPathPrefix: Gcc.pathPrefix(lipoProbe.found
? lipoProbe.path
: toolchainInstallPath, toolchainPrefix)
lipoName: "lipo"
lipoPath: lipoPathPrefix + lipoName
property bool enableAggregationRules: product.aggregate && !product.multiplexConfigurationId
targetVendor: "apple"
targetSystem: "darwin"
targetAbi: "macho"
imageFormat: "macho"
cxxStandardLibrary: libcxxAvailable ? "libc++" : base
loadableModulePrefix: ""
loadableModuleSuffix: ".bundle"
dynamicLibrarySuffix: ".dylib"
Properties {
condition: product.multiplexByQbsProperties.includes("buildVariants")
&& qbs.buildVariants && qbs.buildVariants.length > 1
&& (!product.aggregate || !!product.multiplexConfigurationId)
&& qbs.buildVariant !== "release"
variantSuffix: "_" + qbs.buildVariant
}
separateDebugInformation: true
debugInfoBundleSuffix: ".dSYM"
debugInfoSuffix: ".dwarf"
rpathOrigin: "@loader_path"
useRPathLink: !minimumDarwinVersion
|| Utilities.versionCompare(minimumDarwinVersion, "10.5") < 0
rpathLinkFlag: "-L"
toolchainInstallPath: xcode.present
? FileInfo.joinPaths(xcode.toolchainPath, "usr", "bin") : base
sysroot: xcode.present ? xcode.sdkPath : base
sysrootFlags: sysroot ? ["-isysroot", sysroot] : []
setupBuildEnvironment: {
for (var key in product.cpp.buildEnv) {
var v = new ModUtils.EnvironmentVariable(key);
v.value = product.cpp.buildEnv[key];
v.set();
}
}
property var defaultInfoPlist: {
var dict = {};
if (qbs.targetOS.includes("macos")) {
dict["NSPrincipalClass"] = "NSApplication"; // needed for Retina display support
// QBS-1670: set this flag by default to avoid extensive GPU usage
dict["NSSupportsAutomaticGraphicsSwitching"] = true;
if (minimumMacosVersion)
dict["LSMinimumSystemVersion"] = minimumMacosVersion;
}
if (qbs.targetOS.includes("ios") && minimumIosVersion)
dict["MinimumOSVersion"] = minimumIosVersion;
else if (qbs.targetOS.includes("tvos") && minimumTvosVersion)
dict["MinimumOSVersion"] = minimumTvosVersion;
else if (qbs.targetOS.includes("watchos") && minimumWatchosVersion)
dict["MinimumOSVersion"] = minimumWatchosVersion;
if (qbs.targetOS.containsAny(["ios", "tvos"])) {
dict["LSRequiresIPhoneOS"] = true;
if (xcode.platformType === "device") {
if (qbs.targetOS.includes("ios")) {
if (qbs.architecture === "arm64")
dict["UIRequiredDeviceCapabilities"] = ["arm64"];
else
dict["UIRequiredDeviceCapabilities"] = ["armv7"];
}
if (qbs.targetOS.includes("tvos"))
dict["UIRequiredDeviceCapabilities"] = ["arm64"];
}
}
if (xcode.present) {
var targetDevices = DarwinTools.targetedDeviceFamily(xcode.targetDevices);
if (qbs.targetOS.includes("ios"))
dict["UIDeviceFamily"] = targetDevices;
if (qbs.targetOS.containsAny(["ios", "watchos"])) {
var orientations = [
"UIInterfaceOrientationPortrait",
"UIInterfaceOrientationPortraitUpsideDown",
"UIInterfaceOrientationLandscapeLeft",
"UIInterfaceOrientationLandscapeRight"
];
if (targetDevices.includes("ipad"))
dict["UISupportedInterfaceOrientations~ipad"] = orientations;
if (targetDevices.includes("watch"))
dict["UISupportedInterfaceOrientations"] = orientations.slice(0, 2);
if (targetDevices.includes("iphone")) {
orientations.splice(1, 1);
dict["UISupportedInterfaceOrientations"] = orientations;
}
}
}
return dict;
}
targetLinkerFlags: darwinArchFlags.concat(minimumDarwinVersionLinkerFlags)
targetAssemblerFlags: !assemblerHasTargetOption ? darwinArchFlags : base;
targetDriverFlags: !compilerHasTargetOption ? legacyTargetDriverFlags : base
property stringList legacyTargetDriverFlags:
base.concat(darwinArchFlags).concat(minimumDarwinVersionCompilerFlags)
// private properties
readonly property stringList darwinArchFlags: targetArch ? ["-arch", targetArch] : []
readonly property stringList minimumDarwinVersionCompilerFlags:
(minimumDarwinVersionCompilerFlag && minimumDarwinVersion)
? [minimumDarwinVersionCompilerFlag + "=" + minimumDarwinVersion] : []
readonly property stringList minimumDarwinVersionLinkerFlags:
(minimumDarwinVersionLinkerFlag && minimumDarwinVersion && compilerVersionMajor < 11)
? [minimumDarwinVersionLinkerFlag, minimumDarwinVersion] : []
readonly property var buildEnv: {
var env = {
"ARCHS_STANDARD": xcode.standardArchitectures,
"EXECUTABLE_NAME": product.targetName,
"LANG": "en_US.US-ASCII",
"PRODUCT_NAME": product.name
}
// Set the corresponding environment variable even if the minimum OS version is undefined,
// because this indicates the default deployment target for that OS
if (qbs.targetOS.includes("ios") && minimumIosVersion)
env["IPHONEOS_DEPLOYMENT_TARGET"] = minimumIosVersion;
if (qbs.targetOS.includes("macos") && minimumMacosVersion)
env["MACOSX_DEPLOYMENT_TARGET"] = minimumMacosVersion;
if (qbs.targetOS.includes("watchos") && minimumWatchosVersion)
env["WATCHOS_DEPLOYMENT_TARGET"] = minimumWatchosVersion;
if (qbs.targetOS.includes("tvos") && minimumTvosVersion)
env["TVOS_DEPLOYMENT_TARGET"] = minimumTvosVersion;
if (xcode.present)
env["TARGETED_DEVICE_FAMILY"] =
DarwinTools.targetedDeviceFamily(xcode.targetDevices).join(",");
return env;
}
property string minimumDarwinVersion
property string minimumDarwinVersionCompilerFlag
property string minimumDarwinVersionLinkerFlag
property bool libcxxAvailable: qbs.toolchain.includes("clang") && cxxLanguageVersion !== "c++98"
Group {
condition: enableAggregationRules
Rule {
inputsFromDependencies: ["application"]
multiplex: true
outputFileTags: ["bundle.input", "application", "primary", "debuginfo_app",
"debuginfo_bundle", "bundle.variant_symlink", "debuginfo_plist",
"codesign.signed_artifact"]
outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "application", "app")
prepare: Darwin.prepareLipo.apply(Darwin, arguments)
}
Rule {
inputsFromDependencies: ["loadablemodule"]
multiplex: true
outputFileTags: ["bundle.input", "loadablemodule", "primary", "debuginfo_loadablemodule",
"debuginfo_bundle", "debuginfo_plist", "codesign.signed_artifact"]
outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "loadablemodule",
"loadablemodule")
prepare: Darwin.prepareLipo.apply(Darwin, arguments)
}
Rule {
inputsFromDependencies: ["dynamiclibrary"]
multiplex: true
outputFileTags: ["bundle.input", "dynamiclibrary", "dynamiclibrary_symbols", "primary",
"debuginfo_dll","debuginfo_bundle","bundle.variant_symlink",
"debuginfo_plist", "codesign.signed_artifact", "dynamiclibrary_symlink"]
outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "dynamiclibrary", "dll")
prepare: Darwin.prepareLipo.apply(Darwin, arguments)
}
Rule {
inputsFromDependencies: ["staticlibrary"]
multiplex: true
outputFileTags: ["bundle.input", "staticlibrary", "primary", "codesign.signed_artifact"]
outputArtifacts: Darwin.lipoOutputArtifacts(product, inputs, "staticlibrary")
prepare: Darwin.prepareLipo.apply(Darwin, arguments)
}
}
Rule {
condition: qbs.targetOS.includes("darwin")
multiplex: true
Artifact {
filePath: product.name + "-cpp-Info.plist"
fileTags: ["partial_infoplist"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.inputData = product.cpp.defaultInfoPlist;
cmd.outputFilePath = output.filePath;
cmd.sourceCode = function() {
var plist = new PropertyList();
try {
plist.readFromObject(inputData);
plist.writeToFile(outputFilePath, "xml1");
} finally {
plist.clear();
}
};
return [cmd];
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/windows-mingw.qbs 0000644 0001751 0000166 00000007636 14776170045 022125 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.Utilities
import 'cpp.js' as Cpp
import "setuprunenv.js" as SetupRunEnv
MingwBaseModule {
condition: qbs.targetOS.includes("windows") &&
qbs.toolchain && qbs.toolchain.includes("mingw")
priority: 0
probeEnv: buildEnv
property string windresName: "windres" + compilerExtension
property path windresPath: {
var filePath = toolchainPathPrefix + windresName;
if (!File.exists(filePath))
filePath = FileInfo.joinPaths(toolchainInstallPath, windresName);
return filePath;
}
setupBuildEnvironment: {
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true);
v.prepend(product.cpp.toolchainInstallPath);
v.set();
}
setupRunEnvironment: {
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true);
v.prepend(product.cpp.toolchainInstallPath);
v.set();
SetupRunEnv.setupRunEnvironment(product, config);
}
Rule {
inputs: ["rc"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.resourceCompilerOutputTags()
outputArtifacts: Cpp.resourceCompilerOutputArtifacts(input)
prepare: {
var platformDefines = input.cpp.platformDefines;
var defines = input.cpp.defines;
var includePaths = input.cpp.includePaths;
var systemIncludePaths = input.cpp.systemIncludePaths;
var args = [];
var i;
for (i in platformDefines) {
args.push('-D');
args.push(platformDefines[i]);
}
for (i in defines) {
args.push('-D');
args.push(defines[i]);
}
for (i in includePaths) {
args.push('-I');
args.push(includePaths[i]);
}
for (i in systemIncludePaths) {
args.push('-I');
args.push(systemIncludePaths[i]);
}
args.push("-O", "coff"); // Set COFF format explicitly.
args = args.concat(['-i', input.filePath, '-o', output.filePath]);
var cmd = new Command(product.cpp.windresPath, args);
cmd.description = 'compiling ' + input.fileName;
cmd.highlight = 'compiler';
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/ios-gcc.qbs 0000644 0001751 0000166 00000007356 14776170045 020637 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.DarwinTools
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Utilities
DarwinGCC {
priority: 1
condition: qbs.targetOS.includes('ios') &&
qbs.toolchain && qbs.toolchain.includes('gcc')
minimumIosVersion: {
if (Host.architecture() == "armv7a")
return "6.0";
// XCode 12 requres version (at least 8.0) to be present in the -target triplet
// when compiling for ios-simulator
if (xcode.present && Utilities.versionCompare(xcode.version, "12.0") >= 0)
return "8.0";
}
targetSystem: "ios" + (minimumIosVersion || "")
minimumDarwinVersion: minimumIosVersion
minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("ios-simulator")
? "-mios-simulator-version-min"
: "-miphoneos-version-min"
minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("ios-simulator")
? "-ios_simulator_version_min"
: "-iphoneos_version_min"
libcxxAvailable: base
&& (!minimumDarwinVersion
|| Utilities.versionCompare(minimumDarwinVersion, "5") >= 0)
platformObjcFlags: base.concat(simulatorObjcFlags)
platformObjcxxFlags: base.concat(simulatorObjcFlags)
// Private properties
readonly property stringList simulatorObjcFlags: {
// default in Xcode and also required for building 32-bit Simulator binaries with ARC
// since the default ABI version is 0 for 32-bit targets
return qbs.targetOS.includes("ios-simulator")
? ["-fobjc-abi-version=2", "-fobjc-legacy-dispatch"]
: [];
}
Rule {
condition: !product.qbs.targetOS.includes("ios-simulator")
inputsFromDependencies: ["bundle.content"]
Artifact {
filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ".ipa")
fileTags: ["ipa"]
}
prepare: {
var cmd = new Command("PackageApplication", [input.filePath, "-o", output.filePath]);
cmd.description = "creating ipa";
cmd.highlight = "codegen";
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/cosmic.qbs 0000644 0001751 0000166 00000012311 14776170045 020553 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.PathTools
import qbs.Probes
import qbs.Utilities
import "cosmic.js" as COSMIC
import "cpp.js" as Cpp
CppModule {
condition: qbs.toolchain && qbs.toolchain.includes("cosmic")
Probes.BinaryProbe {
id: compilerPathProbe
condition: !toolchainInstallPath && !_skipAllChecks
names: ["cxcorm"]
}
Probes.CosmicProbe {
id: cosmicProbe
condition: !_skipAllChecks
compilerFilePath: compilerPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
}
Properties {
condition: cosmicProbe.found
qbs.architecture: cosmicProbe.architecture
}
qbs.targetPlatform: "none"
compilerVersionMajor: cosmicProbe.versionMajor
compilerVersionMinor: cosmicProbe.versionMinor
compilerVersionPatch: cosmicProbe.versionPatch
endianness: cosmicProbe.endianness
compilerDefinesByLanguage: cosmicProbe.compilerDefinesByLanguage
compilerIncludePaths: cosmicProbe.includePaths
toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined
/* Work-around for QtCreator which expects these properties to exist. */
property string cCompilerName: compilerName
property string cxxCompilerName: compilerName
compilerName: toolchainDetails.compilerName + compilerExtension
compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
assemblerName: toolchainDetails.assemblerName + compilerExtension
assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName)
linkerName: "clnk" + compilerExtension
linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName)
property string archiverName: "clib" + compilerExtension
property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName)
runtimeLibrary: "static"
staticLibrarySuffix: toolchainDetails.staticLibrarySuffix
executableSuffix: toolchainDetails.executableSuffix
imageFormat: "cosmic"
enableExceptions: false
enableRtti: false
defineFlag: "-d"
includeFlag: "-i"
systemIncludeFlag: "-i"
preincludeFlag: "-ph"
libraryDependencyFlag: ""
libraryPathFlag: "-l"
linkerScriptFlag: ""
toolchainDetails: COSMIC.toolchainDetails(qbs)
knownArchitectures: ["arm", "hcs12", "hcs8", "m68k", "stm8"]
Rule {
id: assembler
inputs: ["asm"]
outputFileTags: Cpp.assemblerOutputTags(generateAssemblerListingFiles)
outputArtifacts: Cpp.assemblerOutputArtifacts(input)
prepare: COSMIC.prepareAssembler.apply(COSMIC, arguments)
}
FileTagger {
patterns: ["*.s"]
fileTags: ["asm"]
}
Rule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles)
outputArtifacts: Cpp.compilerOutputArtifacts(input)
prepare: COSMIC.prepareCompiler.apply(COSMIC, arguments)
}
Rule {
id: applicationLinker
multiplex: true
inputs: ["obj", "linkerscript"]
inputsFromDependencies: ["staticlibrary"]
outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile)
outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product)
prepare: COSMIC.prepareLinker.apply(COSMIC, arguments)
}
Rule {
id: staticLibraryLinker
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary"]
outputFileTags: Cpp.staticLibraryLinkerOutputTags()
outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product)
prepare: COSMIC.prepareArchiver.apply(COSMIC, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/keil.js 0000644 0001751 0000166 00000110752 14776170045 020061 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Cpp = require("cpp.js");
var Environment = require("qbs.Environment");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var PathTools = require("qbs.PathTools");
var Process = require("qbs.Process");
var TemporaryDir = require("qbs.TemporaryDir");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function isMcs51Architecture(architecture) {
return architecture === "mcs51";
}
function isMcs251Architecture(architecture) {
return architecture === "mcs251";
}
function isMcsArchitecture(architecture) {
return isMcs51Architecture(architecture)
|| isMcs251Architecture(architecture);
}
function isC166Architecture(architecture) {
return architecture === "c166";
}
function isArmArchitecture(architecture) {
return architecture.startsWith("arm");
}
function isMcsCompiler(compilerPath) {
var base = FileInfo.baseName(compilerPath).toLowerCase();
return base === "c51" || base === "cx51" || base === "c251";
}
function isC166Compiler(compilerPath) {
return FileInfo.baseName(compilerPath).toLowerCase() === "c166";
}
function isArmCCCompiler(compilerPath) {
return FileInfo.baseName(compilerPath).toLowerCase() === "armcc";
}
function isArmClangCompiler(compilerPath) {
return FileInfo.baseName(compilerPath).toLowerCase() === "armclang";
}
function preincludeFlag(compilerPath) {
if (isArmCCCompiler(compilerPath))
return "--preinclude";
else if (isArmClangCompiler(compilerPath))
return "-include";
}
function toolchainDetails(qbs) {
var architecture = qbs.architecture;
if (isMcs51Architecture(architecture)) {
return {
"imageFormat": "omf",
"linkerMapSuffix":".m51",
"objectSuffix": ".obj",
"executableSuffix": ".abs",
"compilerName": "c51",
"assemblerName": "a51",
"linkerName": "bl51",
"archiverName": "lib51"
};
} else if (isMcs251Architecture(architecture)) {
return {
"imageFormat": "omf",
"linkerMapSuffix":".m51",
"objectSuffix": ".obj",
"executableSuffix": ".abs",
"compilerName": "c251",
"assemblerName": "a251",
"linkerName": "l251",
"archiverName": "lib251"
};
} else if (isC166Architecture(architecture)) {
return {
"imageFormat": "omf",
"linkerMapSuffix":".m66",
"objectSuffix": ".obj",
"executableSuffix": ".abs",
"compilerName": "c166",
"assemblerName": "a166",
"linkerName": "l166",
"archiverName": "lib166"
};
} else if (isArmArchitecture(architecture)) {
return {
"imageFormat": "elf",
"linkerMapSuffix":".map",
"objectSuffix": ".o",
"executableSuffix": ".axf",
"disassemblerName": "fromelf",
"compilerName": "armcc",
"assemblerName": "armasm",
"linkerName": "armlink",
"archiverName": "armar"
};
}
}
function guessArmCCArchitecture(targetArchArm, targetArchThumb) {
var arch = "arm";
if (targetArchArm === "4" && targetArchThumb === "0")
arch += "v4";
else if (targetArchArm === "4" && targetArchThumb === "1")
arch += "v4t";
else if (targetArchArm === "5" && targetArchThumb === "2")
arch += "v5t";
else if (targetArchArm === "6" && targetArchThumb === "3")
arch += "v6";
else if (targetArchArm === "6" && targetArchThumb === "4")
arch += "v6t2";
else if (targetArchArm === "0" && targetArchThumb === "3")
arch += "v6m";
else if (targetArchArm === "7" && targetArchThumb === "4")
arch += "v7r";
else if (targetArchArm === "0" && targetArchThumb === "4")
arch += "v7m";
return arch;
}
function guessArmClangArchitecture(targetArchArm, targetArchProfile) {
targetArchProfile = targetArchProfile.replace(/'/g, "");
var arch = "arm";
if (targetArchArm !== "" && targetArchProfile !== "")
arch += "v" + targetArchArm + targetArchProfile.toLowerCase();
return arch;
}
function guessArchitecture(macros) {
if (macros["__C51__"])
return "mcs51";
else if (macros["__C251__"])
return "mcs251";
else if (macros["__C166__"])
return "c166";
else if (macros["__CC_ARM"] === "1")
return guessArmCCArchitecture(macros["__TARGET_ARCH_ARM"], macros["__TARGET_ARCH_THUMB"]);
else if (macros["__clang__"] === "1" && macros["__arm__"] === "1")
return guessArmClangArchitecture(macros["__ARM_ARCH"], macros["__ARM_ARCH_PROFILE"]);
}
function guessEndianness(macros) {
if (macros["__C51__"] || macros["__C251__"]) {
// The 8051 processors are 8-bit. So, the data with an integer type
// represented by more than one byte is stored as big endian in the
// Keil toolchain. See for more info:
// * http://www.keil.com/support/man/docs/c51/c51_ap_2bytescalar.htm
// * http://www.keil.com/support/man/docs/c51/c51_ap_4bytescalar.htm
// * http://www.keil.com/support/man/docs/c251/c251_ap_2bytescalar.htm
// * http://www.keil.com/support/man/docs/c251/c251_ap_4bytescalar.htm
return "big";
} else if (macros["__C166__"]) {
// The C166 processors are 16-bit. So, the data with an integer type
// represented by more than one byte is stored as little endian in the
// Keil toolchain. See for more info:
// * http://www.keil.com/support/man/docs/c166/c166_ap_ints.htm
// * http://www.keil.com/support/man/docs/c166/c166_ap_longs.htm
return "little";
} else if (macros["__CC_ARM"]) {
return macros["__BIG_ENDIAN"] ? "big" : "little";
} else if (macros["__clang__"] && macros["__arm__"]) {
switch (macros["__BYTE_ORDER__"]) {
case "__ORDER_BIG_ENDIAN__":
return "big";
case "__ORDER_LITTLE_ENDIAN__":
return "little";
}
}
}
function guessVersion(macros) {
if (macros["__C51__"] || macros["__C251__"]) {
var mcsVersion = macros["__C51__"] || macros["__C251__"];
return { major: parseInt(mcsVersion / 100),
minor: parseInt(mcsVersion % 100),
patch: 0 }
} else if (macros["__C166__"]) {
var xcVersion = macros["__C166__"];
return { major: parseInt(xcVersion / 100),
minor: parseInt(xcVersion % 100),
patch: 0 }
} else if (macros["__CC_ARM"] || macros["__clang__"]) {
var armVersion = macros["__ARMCC_VERSION"];
return { major: parseInt(armVersion / 1000000),
minor: parseInt(armVersion / 10000) % 100,
patch: parseInt(armVersion) % 10000 }
}
}
function dumpMcsCompilerMacros(compilerFilePath, tag) {
// C51 or C251 compiler support only C language.
if (tag === "cpp")
return {};
// Note: The C51 or C251 compiler does not support the predefined
// macros dumping. So, we do it with the following trick, where we try
// to create and compile a special temporary file and to parse the console
// output with the own magic pattern: (""|"key"|"value"|"").
var outputDirectory = new TemporaryDir();
var outputFilePath = FileInfo.fromNativeSeparators(FileInfo.joinPaths(outputDirectory.path(),
"dump-macros.c"));
var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly);
outputFile.writeLine("#define VALUE_TO_STRING(x) #x");
outputFile.writeLine("#define VALUE(x) VALUE_TO_STRING(x)");
// Predefined keys for C51 and C251 compilers, see details:
// * https://www.keil.com/support/man/docs/c51/c51_pp_predefmacroconst.htm
// * https://www.keil.com/support/man/docs/c251/c251_pp_predefmacroconst.htm
var keys = ["__C51__", "__CX51__", "__C251__", "__MODEL__",
"__STDC__", "__FLOAT64__", "__MODSRC__"];
// For C51 compiler.
outputFile.writeLine("#if defined(__C51__) || defined(__CX51__)");
outputFile.writeLine("# define VAR_NAME_VALUE(var) \"(\"\"\"\"|\"#var\"|\"VALUE(var)\"|\"\"\"\")\"");
for (var i in keys) {
var key = keys[i];
outputFile.writeLine("# if defined (" + key + ")");
outputFile.writeLine("# pragma message (VAR_NAME_VALUE(" + key + "))");
outputFile.writeLine("# endif");
}
outputFile.writeLine("#endif");
// For C251 compiler.
outputFile.writeLine("#if defined(__C251__)");
outputFile.writeLine("# define VAR_NAME_VALUE(var) \"\"|#var|VALUE(var)|\"\"");
for (var i in keys) {
var key = keys[i];
outputFile.writeLine("# if defined (" + key + ")");
outputFile.writeLine("# warning (VAR_NAME_VALUE(" + key + "))");
outputFile.writeLine("# endif");
}
outputFile.writeLine("#endif");
outputFile.close();
var process = new Process();
process.exec(compilerFilePath, [outputFilePath], false);
File.remove(outputFilePath);
var map = {};
process.readStdOut().trim().split(/\r?\n/g).map(function(line) {
var parts = line.split("\"|\"", 4);
if (parts.length === 4)
map[parts[1]] = parts[2];
});
return map;
}
function dumpC166CompilerMacros(compilerFilePath, tag) {
// C166 compiler support only C language.
if (tag === "cpp")
return {};
// Note: The C166 compiler does not support the predefined
// macros dumping. Also, it does not support the '#pragma' and
// '#message|warning|error' directives properly (it is impossible
// to print to console the value of macro).
// So, we do it with the following trick, where we try
// to create and compile a special temporary file and to parse the console
// output with the own magic pattern, e.g:
//
// *** WARNING C320 IN LINE 41 OF c51.c: __C166__
// *** WARNING C2 IN LINE 42 OF c51.c: '757': unknown #pragma/control, line ignored
//
// where the '__C166__' is a key, and the '757' is a value.
var outputDirectory = new TemporaryDir();
var outputFilePath = FileInfo.fromNativeSeparators(outputDirectory.path() + "/dump-macros.c");
var outputFile = new TextFile(outputFilePath, TextFile.WriteOnly);
// Predefined keys for C166 compiler, see details:
// * https://www.keil.com/support/man/docs/c166/c166_pp_predefmacroconst.htm
var keys = ["__C166__", "__DUS__", "__MAC__", "__MOD167__",
"__MODEL__", "__MODV2__", "__SAVEMAC__", "__STDC__"];
// For C166 compiler.
outputFile.writeLine("#if defined(__C166__)");
for (var i in keys) {
var key = keys[i];
outputFile.writeLine("# if defined (" + key + ")");
outputFile.writeLine("# warning " + key);
outputFile.writeLine("# pragma " + key);
outputFile.writeLine("# endif");
}
outputFile.writeLine("#endif");
outputFile.close();
function extractKey(line, knownKeys) {
for (var i in keys) {
var key = knownKeys[i];
var regexp = new RegExp("^\\*\\*\\* WARNING C320 IN LINE .+: (" + key + ")$");
var match = regexp.exec(line);
if (match)
return key;
}
};
function extractValue(line) {
var regexp = new RegExp("^\\*\\*\\* WARNING C2 IN LINE .+'(.+)':.+$");
var match = regexp.exec(line);
if (match)
return match[1];
};
var process = new Process();
process.exec(compilerFilePath, [outputFilePath], false);
File.remove(outputFilePath);
var lines = process.readStdOut().trim().split(/\r?\n/g);
var map = {};
for (var i = 0; i < lines.length; ++i) {
// First line should contains the macro key.
var keyLine = lines[i];
var key = extractKey(keyLine, keys);
if (!key)
continue;
i += 1;
if (i >= lines.length)
break;
// Second line should contains the macro value.
var valueLine = lines[i];
var value = extractValue(valueLine);
if (!value)
continue;
map[key] = value;
}
return map;
}
function dumpArmCCCompilerMacros(compilerFilePath, tag, nullDevice) {
var args = [ "-E", "--list-macros", "--cpu=cortex-m0", nullDevice ];
if (tag === "cpp")
args.push("--cpp");
var p = new Process();
p.exec(compilerFilePath, args, false);
return Cpp.extractMacros(p.readStdOut());
}
function dumpArmClangCompilerMacros(compilerFilePath, tag, nullDevice) {
var args = [ "--target=arm-arm-none-eabi", "-mcpu=cortex-m0", "-dM", "-E",
"-x", ((tag === "cpp") ? "c++" : "c"), nullDevice ];
var p = new Process();
p.exec(compilerFilePath, args, false);
return Cpp.extractMacros(p.readStdOut());
}
function dumpMacros(compilerFilePath, tag, nullDevice) {
if (isMcsCompiler(compilerFilePath))
return dumpMcsCompilerMacros(compilerFilePath, tag, nullDevice);
else if (isC166Compiler(compilerFilePath))
return dumpC166CompilerMacros(compilerFilePath, tag, nullDevice);
else if (isArmCCCompiler(compilerFilePath))
return dumpArmCCCompilerMacros(compilerFilePath, tag, nullDevice);
else if (isArmClangCompiler(compilerFilePath))
return dumpArmClangCompilerMacros(compilerFilePath, tag, nullDevice);
return {};
}
function dumpMcsCompilerIncludePaths(compilerFilePath) {
var includePath = compilerFilePath.replace(/bin[\\\/](.*)$/i, "inc");
return [includePath];
}
function dumpC166CompilerIncludePaths(compilerFilePath) {
// Same as for MCS compiler.
return dumpMcsCompilerIncludePaths(compilerFilePath);
}
function dumpArmCCCompilerIncludePaths(compilerFilePath) {
var includePath = compilerFilePath.replace(/bin[\\\/](.*)$/i, "include");
return [includePath];
}
function dumpArmClangCompilerIncludePaths(compilerFilePath, nullDevice) {
var args = [ "--target=arm-arm-none-eabi", "-mcpu=cortex-m0", "-v", "-E",
"-x", "c++", nullDevice ];
var p = new Process();
p.exec(compilerFilePath, args, false);
var lines = p.readStdErr().trim().split(/\r?\n/g).map(function (line) { return line.trim(); });
var addIncludes = false;
var includePaths = [];
for (var i = 0; i < lines.length; ++i) {
var line = lines[i];
if (line === "#include <...> search starts here:")
addIncludes = true;
else if (line === "End of search list.")
addIncludes = false;
else if (addIncludes)
includePaths.push(line);
}
return includePaths;
}
function dumpDefaultPaths(compilerFilePath, nullDevice) {
var includePaths = [];
if (isMcsCompiler(compilerFilePath))
includePaths = dumpMcsCompilerIncludePaths(compilerFilePath);
else if (isC166Compiler(compilerFilePath))
includePaths = dumpC166CompilerIncludePaths(compilerFilePath);
else if (isArmCCCompiler(compilerFilePath))
includePaths = dumpArmCCCompilerIncludePaths(compilerFilePath);
else if (isArmClangCompiler(compilerFilePath))
includePaths = dumpArmClangCompilerIncludePaths(compilerFilePath, nullDevice);
return { "includePaths": includePaths };
}
function filterMcsOutput(output) {
var filteredLines = [];
output.split(/\r\n|\r|\n/).forEach(function(line) {
var regexp = /^\s*\*{3}\s|^\s{29}|^\s{4}\S|^\s{2}[0-9A-F]{4}|^\s{21,25}\d+|^[0-9A-F]{4}\s\d+/;
if (regexp.exec(line))
filteredLines.push(line);
});
return filteredLines.join('\n');
};
function filterC166Output(output) {
var filteredLines = [];
output.split(/\r\n|\r|\n/).forEach(function(line) {
var regexp = /^\s*\*{3}\s|^\s{29}|^\s{27,28}\d+|^\s{21}\d+|^\s{4}\S|^\s{2}[0-9A-F]{4}|^[0-9A-F]{4}\s\d+/;
if (regexp.exec(line))
filteredLines.push(line);
});
return filteredLines.join('\n');
};
function compilerFlags(project, product, input, outputs, explicitlyDependsOn) {
// Determine which C-language we're compiling.
var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(outputs.obj[0].fileTags));
var args = [];
var architecture = input.qbs.architecture;
if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) {
// Input.
args.push(input.filePath);
// Output.
args.push("OBJECT(" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath) + ")");
// Defines.
var defines = Cpp.collectDefines(input);
if (defines.length > 0)
args = args.concat("DEFINE (" + defines.join(",") + ")");
// Includes.
var allIncludePaths = [].concat(Cpp.collectIncludePaths(input),
Cpp.collectSystemIncludePaths(input));
if (allIncludePaths.length > 0)
args = args.concat("INCDIR(" + allIncludePaths.map(function(path) {
return FileInfo.toWindowsSeparators(path); }).join(";") + ")");
// Debug information flags.
if (input.cpp.debugInformation)
args.push("DEBUG");
// Optimization level flags.
switch (input.cpp.optimization) {
case "small":
args.push("OPTIMIZE (SIZE)");
break;
case "fast":
args.push("OPTIMIZE (SPEED)");
break;
case "none":
args.push("OPTIMIZE (0)");
break;
}
// Warning level flags.
switch (input.cpp.warningLevel) {
case "none":
args.push("WARNINGLEVEL (0)");
break;
case "all":
args.push("WARNINGLEVEL (2)");
if (isMcs51Architecture(architecture))
args.push("FARWARNING");
break;
}
// Listing files generation flag.
if (!input.cpp.generateCompilerListingFiles)
args.push("NOPRINT");
else
args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath) + ")");
} else if (isArmArchitecture(architecture)) {
// Input.
args.push("-c", input.filePath);
// Output.
args.push("-o", outputs.obj[0].filePath);
// Preinclude headers.
args = args.concat(Cpp.collectPreincludePathsArguments(input, true));
// Defines.
args = args.concat(Cpp.collectDefinesArguments(input));
// Includes.
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input));
var compilerPath = input.cpp.compilerPath;
if (isArmCCCompiler(compilerPath)) {
// Debug information flags.
if (input.cpp.debugInformation) {
args.push("--debug");
args.push("-g");
}
// Optimization level flags.
switch (input.cpp.optimization) {
case "small":
args.push("-Ospace")
break;
case "fast":
args.push("-Otime")
break;
case "none":
args.push("-O0")
break;
}
// Warning level flags.
switch (input.cpp.warningLevel) {
case "none":
args.push("-W");
break;
default:
// By default all warnings are enabled.
break;
}
if (tag === "c") {
// C language version flags.
var knownCLanguageValues = ["c99", "c90"];
var cLanguageVersion = Cpp.languageVersion(
input.cpp.cLanguageVersion, knownCLanguageValues, "C");
switch (cLanguageVersion) {
case "c99":
args.push("--c99");
break;
case "c90":
args.push("--c90");
break;
}
} else if (tag === "cpp") {
// C++ language version flags.
var knownCppLanguageValues = ["c++11", "c++03"];
var cppLanguageVersion = Cpp.languageVersion(
input.cpp.cxxLanguageVersion, knownCppLanguageValues, "C++");
switch (cppLanguageVersion) {
case "c++11":
args.push("--cpp11");
break;
default:
// Default C++ language is C++03.
args.push("--cpp");
break;
}
// Exceptions flags.
var enableExceptions = input.cpp.enableExceptions;
if (enableExceptions !== undefined)
args.push(enableExceptions ? "--exceptions" : "--no_exceptions");
// RTTI flags.
var enableRtti = input.cpp.enableRtti;
if (enableRtti !== undefined)
args.push(enableRtti ? "--rtti" : "--no_rtti");
}
// Listing files generation flag.
if (input.cpp.generateCompilerListingFiles) {
args.push("--list");
args.push("--list_dir", FileInfo.path(outputs.lst[0].filePath));
}
} else if (isArmClangCompiler(compilerPath)) {
// Debug information flags.
if (input.cpp.debugInformation)
args.push("-g");
// Optimization level flags.
switch (input.cpp.optimization) {
case "small":
args.push("-Oz")
break;
case "fast":
args.push("-Ofast")
break;
case "none":
args.push("-O0")
break;
}
// Warning level flags.
switch (input.cpp.warningLevel) {
case "all":
args.push("-Wall");
break;
default:
break;
}
if (input.cpp.treatWarningsAsErrors)
args.push("-Werror");
if (tag === "c") {
// C language version flags.
var knownCLanguageValues = ["c11", "c99", "c90", "c89"];
var cLanguageVersion = Cpp.languageVersion(
input.cpp.cLanguageVersion, knownCLanguageValues, "C");
if (cLanguageVersion)
args.push("-std=" + cLanguageVersion);
} else if (tag === "cpp") {
// C++ language version flags.
var knownCppLanguageValues = ["c++17", "c++14", "c++11", "c++03", "c++98"];
var cppLanguageVersion = Cpp.languageVersion(
input.cpp.cxxLanguageVersion, knownCppLanguageValues, "C++");
if (cppLanguageVersion)
args.push("-std=" + cppLanguageVersion);
// Exceptions flags.
var enableExceptions = input.cpp.enableExceptions;
if (enableExceptions !== undefined)
args.push(enableExceptions ? "-fexceptions" : "-fno-exceptions");
// RTTI flags.
var enableRtti = input.cpp.enableRtti;
if (enableRtti !== undefined)
args.push(enableRtti ? "-frtti" : "-fno-rtti");
}
// Listing files generation does not supported!
// There are only a workaround: http://www.keil.com/support/docs/4152.htm
}
}
// Misc flags.
args = args.concat(Cpp.collectMiscCompilerArguments(input, tag),
Cpp.collectMiscDriverArguments(input));
return args;
}
function assemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = [];
var architecture = input.qbs.architecture;
if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) {
// Input.
args.push(input.filePath);
// Output.
args.push("OBJECT(" + FileInfo.toWindowsSeparators(outputs.obj[0].filePath) + ")");
// Includes.
var allIncludePaths = [].concat(Cpp.collectIncludePaths(input),
Cpp.collectSystemIncludePaths(input));
if (allIncludePaths.length > 0)
args = args.concat("INCDIR(" + allIncludePaths.map(function(path) {
return FileInfo.toWindowsSeparators(path); }).join(";") + ")");
// Debug information flags.
if (input.cpp.debugInformation)
args.push("DEBUG");
// Enable errors printing.
args.push("EP");
// Listing files generation flag.
if (!input.cpp.generateAssemblerListingFiles)
args.push("NOPRINT");
else
args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.lst[0].filePath) + ")");
} else if (isArmArchitecture(architecture)) {
// Input.
args.push(input.filePath);
// Output.
args.push("-o", outputs.obj[0].filePath);
// Includes.
args = args.concat(Cpp.collectIncludePathsArguments(input));
args = args.concat(Cpp.collectSystemIncludePathsArguments(input));
// Debug information flags.
if (input.cpp.debugInformation) {
args.push("--debug");
args.push("-g");
}
// Warning level flags.
if (input.cpp.warningLevel === "none")
args.push("--no_warn");
// Byte order flags.
var endianness = input.cpp.endianness;
if (endianness)
args.push((endianness === "little") ? "--littleend" : "--bigend");
// Listing files generation flag.
if (input.cpp.generateAssemblerListingFiles)
args.push("--list", outputs.lst[0].filePath);
}
// Misc flags.
args = args.concat(Cpp.collectMiscAssemblerArguments(input, "asm"));
return args;
}
function disassemblerFlags(project, product, input, outputs, explicitlyDependsOn) {
var args = ["--disassemble", "--interleave=source"];
args.push(outputs.obj[0].filePath);
args.push("--output=" + outputs.lst[0].filePath);
return args;
}
function linkerFlags(project, product, inputs, outputs) {
var args = [];
var libraryPaths = Cpp.collectLibraryPaths(product);
var architecture = product.qbs.architecture;
if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) {
// Semi-intelligent handling the library paths.
// We need to add the full path prefix to the library file if this
// file is not absolute or not relative. Reason is that the C51, C251,
// and C166 linkers does not support the library paths.
function collectLibraryObjectPaths(product) {
var libraryObjects = Cpp.collectLibraryDependencies(product);
return libraryObjects.map(function(dep) {
var filePath = dep.filePath;
if (FileInfo.isAbsolutePath(filePath))
return filePath;
for (var i = 0; i < libraryPaths.length; ++i) {
var fullPath = FileInfo.joinPaths(libraryPaths[i], filePath);
if (File.exists(fullPath))
return fullPath;
}
return filePath;
});
}
// Note: The C51, C251, or C166 linker does not distinguish an object files and
// a libraries, it interpret all this stuff as an input objects,
// so, we need to pass it together in one string.
function collectAllObjectPathsArguments(product, inputs) {
return [].concat(Cpp.collectLinkerObjectPaths(inputs),
collectLibraryObjectPaths(product));
}
// Add all input objects as arguments (application and library object files).
var allObjectPaths = collectAllObjectPathsArguments(product, inputs);
if (allObjectPaths.length > 0)
args = args.concat(allObjectPaths.map(function(path) {
return FileInfo.toWindowsSeparators(path); }).join(","));
// Output.
args.push("TO", FileInfo.toWindowsSeparators(outputs.application[0].filePath));
// Map file generation flag.
if (!product.cpp.generateLinkerMapFile)
args.push("NOPRINT");
else
args.push("PRINT(" + FileInfo.toWindowsSeparators(outputs.mem_map[0].filePath) + ")");
} else if (isArmArchitecture(architecture)) {
// Inputs.
args = args.concat(Cpp.collectLinkerObjectPaths(inputs));
// Output.
args.push("--output", outputs.application[0].filePath);
// Library paths.
if (libraryPaths.length > 0)
args.push(product.cpp.libraryPathFlag + libraryPaths.join(","));
// Library dependencies.
args = args.concat(Cpp.collectLibraryDependenciesArguments(product));
// Linker scripts.
args = args.concat(Cpp.collectLinkerScriptPathsArguments(product, inputs, true));
// Map file generation flag.
if (product.cpp.generateLinkerMapFile)
args.push("--list", outputs.mem_map[0].filePath);
// Entry point flag.
if (product.cpp.entryPoint)
args.push("--entry", product.cpp.entryPoint);
// Debug information flag.
var debugInformation = product.cpp.debugInformation;
if (debugInformation !== undefined)
args.push(debugInformation ? "--debug" : "--no_debug");
}
// Misc flags.
args = args.concat(Cpp.collectMiscEscapableLinkerArguments(product),
Cpp.collectMiscLinkerArguments(product),
Cpp.collectMiscDriverArguments(product));
return args;
}
function archiverFlags(project, product, inputs, outputs) {
var args = [];
// Inputs.
var objectPaths = Cpp.collectLinkerObjectPaths(inputs);
var architecture = product.qbs.architecture;
if (isMcsArchitecture(architecture) || isC166Architecture(architecture)) {
// Library creation command.
args.push("TRANSFER");
// Inputs.
if (objectPaths.length > 0)
args = args.concat(objectPaths.map(function(path) {
return FileInfo.toWindowsSeparators(path); }).join(","));
// Output.
args.push("TO", FileInfo.toWindowsSeparators(outputs.staticlibrary[0].filePath));
} else if (isArmArchitecture(architecture)) {
// Note: The ARM archiver command line expect the output file
// first, and then a set of input objects.
// Output.
args.push("--create", outputs.staticlibrary[0].filePath);
// Inputs.
args = args.concat(objectPaths);
// Debug information flag.
if (product.cpp.debugInformation)
args.push("--debug_symbols");
}
return args;
}
// The ARMCLANG compiler does not support generation
// for the listing files:
// * https://www.keil.com/support/docs/4152.htm
// So, we generate the listing files from the object files
// using the disassembler.
function generateClangCompilerListing(project, product, inputs, outputs, input, output) {
if (isArmClangCompiler(input.cpp.compilerPath) && input.cpp.generateCompilerListingFiles) {
var args = disassemblerFlags(project, product, input, outputs, explicitlyDependsOn);
var disassemblerPath = input.cpp.disassemblerPath;
var cmd = new Command(disassemblerPath, args);
cmd.silent = true;
return cmd;
}
}
// The ARMCC compiler generates the listing files only in a short form,
// e.g. to 'module.lst' instead of 'module.{c|cpp}.lst', that complicates
// the auto-tests. Therefore we need to rename generated listing files
// with correct unified names.
function generateArmccCompilerListing(project, product, inputs, outputs, input, output) {
if (isArmCCCompiler(input.cpp.compilerPath) && input.cpp.generateCompilerListingFiles) {
var listingPath = FileInfo.path(outputs.lst[0].filePath);
var cmd = new JavaScriptCommand();
cmd.oldListing = FileInfo.joinPaths(listingPath, input.baseName + ".lst");
cmd.newListing = FileInfo.joinPaths(
listingPath, input.fileName + input.cpp.compilerListingSuffix);
cmd.silent = true;
cmd.sourceCode = function() { File.move(oldListing, newListing); };
return cmd;
}
}
function prepareCompiler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
var args = compilerFlags(project, product, input, outputs, explicitlyDependsOn);
var compilerPath = input.cpp.compilerPath;
var architecture = input.cpp.architecture;
var cmd = new Command(compilerPath, args);
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "compiler";
if (isMcsArchitecture(architecture)) {
cmd.maxExitCode = 1;
cmd.stdoutFilterFunction = filterMcsOutput;
} else if (isC166Architecture(architecture)) {
cmd.maxExitCode = 1;
cmd.stdoutFilterFunction = filterC166Output;
}
cmds.push(cmd);
cmd = generateClangCompilerListing(project, product, inputs, outputs, input, output);
if (cmd)
cmds.push(cmd);
cmd = generateArmccCompilerListing(project, product, inputs, outputs, input, output);
if (cmd)
cmds.push(cmd);
return cmds;
}
function prepareAssembler(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var args = assemblerFlags(project, product, input, outputs, explicitlyDependsOn);
var assemblerPath = input.cpp.assemblerPath;
var architecture = input.cpp.architecture;
var cmd = new Command(assemblerPath, args);
cmd.description = "assembling " + input.fileName;
cmd.highlight = "compiler";
cmd.jobPool = "assembler";
if (isMcsArchitecture(architecture)) {
cmd.maxExitCode = 1;
cmd.stdoutFilterFunction = filterMcsOutput;
} else if (isC166Architecture(architecture)) {
cmd.maxExitCode = 1;
cmd.stdoutFilterFunction = filterC166Output;
}
return [cmd];
}
function prepareLinker(project, product, inputs, outputs, input, output) {
var primaryOutput = outputs.application[0];
var args = linkerFlags(project, product, inputs, outputs);
var linkerPath = product.cpp.linkerPath;
var architecture = product.cpp.architecture;
var cmd = new Command(linkerPath, args);
cmd.description = "linking " + primaryOutput.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
if (isMcsArchitecture(architecture)) {
cmd.maxExitCode = 1;
cmd.stdoutFilterFunction = filterMcsOutput;
} else if (isC166Architecture(architecture)) {
cmd.maxExitCode = 1;
cmd.stdoutFilterFunction = filterC166Output;
}
return [cmd];
}
function prepareArchiver(project, product, inputs, outputs, input, output) {
var args = archiverFlags(project, product, inputs, outputs);
var archiverPath = product.cpp.archiverPath;
var architecture = product.cpp.architecture;
var cmd = new Command(archiverPath, args);
cmd.description = "creating " + output.fileName;
cmd.highlight = "linker";
cmd.jobPool = "linker";
if (isMcsArchitecture(architecture)) {
cmd.stdoutFilterFunction = filterMcsOutput;
} else if (isC166Architecture(architecture)) {
cmd.stdoutFilterFunction = filterC166Output;
}
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/cpp/windows-clang-mingw.qbs 0000644 0001751 0000166 00000007425 14776170045 023203 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Utilities
import "msvc.js" as MSVC
import "setuprunenv.js" as SetupRunEnv
MingwBaseModule {
condition: qbs.targetOS.includes("windows") &&
qbs.toolchain && qbs.toolchain.includes("clang")
priority: 0
// llvm-as and llvm-objopy are not shipped with the official binaries on Windows at the
// moment (8.0). We fall back to using the mingw versions in that case.
assemblerName: "llvm-as" + compilerExtension
assemblerPath: {
if (File.exists(base))
return base;
if (qbs.sysroot)
return FileInfo.joinPaths(qbs.sysroot, "bin", "as" + compilerExtension);
}
objcopyName: "llvm-objcopy" + compilerExtension
objcopyPath: {
if (File.exists(base))
return base;
if (qbs.sysroot)
return FileInfo.joinPaths(qbs.sysroot, "bin", "objcopy" + compilerExtension);
}
archiverName: "llvm-ar" + compilerExtension
linkerVariant: "lld"
targetVendor: "pc"
targetSystem: "windows"
targetAbi: "gnu"
property string rcFilePath: FileInfo.joinPaths(toolchainInstallPath,
"llvm-rc" + compilerExtension)
setupBuildEnvironment: {
if (Host.os().includes("windows") && product.qbs.sysroot) {
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true);
v.prepend(FileInfo.joinPaths(product.qbs.sysroot, "bin"));
v.set();
}
}
setupRunEnvironment: {
if (Host.os().includes("windows") && product.qbs.sysroot) {
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true);
v.prepend(FileInfo.joinPaths(product.qbs.sysroot, "bin"));
v.set();
SetupRunEnv.setupRunEnvironment(product, config);
}
}
Rule {
inputs: ["rc"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
Artifact {
filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir),
input.completeBaseName + ".res")
fileTags: ["obj"]
}
prepare: MSVC.createRcCommand(product.cpp.rcFilePath, input, output)
}
}
qbs-src-2.6.1/share/qbs/modules/cpp/keil.qbs 0000644 0001751 0000166 00000013043 14776170045 020225 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Denis Shienkov
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.Probes
import "cpp.js" as Cpp
import "keil.js" as KEIL
CppModule {
condition: Host.os().includes("windows") && qbs.toolchain && qbs.toolchain.includes("keil")
Probes.BinaryProbe {
id: compilerPathProbe
condition: !toolchainInstallPath && !_skipAllChecks
names: ["c51"]
}
Probes.KeilProbe {
id: keilProbe
condition: !_skipAllChecks
compilerFilePath: compilerPath
enableDefinesByLanguage: enableCompilerDefinesByLanguage
}
Properties {
condition: keilProbe.found
qbs.architecture: keilProbe.architecture
}
qbs.targetPlatform: "none"
compilerVersionMajor: keilProbe.versionMajor
compilerVersionMinor: keilProbe.versionMinor
compilerVersionPatch: keilProbe.versionPatch
endianness: keilProbe.endianness
compilerDefinesByLanguage: keilProbe.compilerDefinesByLanguage
compilerIncludePaths: keilProbe.includePaths
toolchainInstallPath: compilerPathProbe.found ? compilerPathProbe.path : undefined
/* Work-around for QtCreator which expects these properties to exist. */
property string cCompilerName: compilerName
property string cxxCompilerName: compilerName
compilerName: toolchainDetails.compilerName + compilerExtension
compilerPath: FileInfo.joinPaths(toolchainInstallPath, compilerName)
assemblerName: toolchainDetails.assemblerName + compilerExtension
assemblerPath: FileInfo.joinPaths(toolchainInstallPath, assemblerName)
linkerName: toolchainDetails.linkerName + compilerExtension
linkerPath: FileInfo.joinPaths(toolchainInstallPath, linkerName)
property string archiverName: toolchainDetails.archiverName + compilerExtension
property string archiverPath: FileInfo.joinPaths(toolchainInstallPath, archiverName)
property string disassemblerName: toolchainDetails.disassemblerName + compilerExtension
property string disassemblerPath: FileInfo.joinPaths(toolchainInstallPath, disassemblerName)
runtimeLibrary: "static"
staticLibrarySuffix: ".lib"
executableSuffix: toolchainDetails.executableSuffix
objectSuffix: toolchainDetails.objectSuffix
linkerMapSuffix: toolchainDetails.linkerMapSuffix
imageFormat: toolchainDetails.imageFormat
enableExceptions: false
enableRtti: false
defineFlag: "-D"
includeFlag: "-I"
systemIncludeFlag: "-I"
preincludeFlag: KEIL.preincludeFlag(compilerPath)
libraryDependencyFlag: ""
libraryPathFlag: "--userlibpath="
linkerScriptFlag: "--scatter"
toolchainDetails: KEIL.toolchainDetails(qbs)
knownArchitectures: ["arm", "c166", "mcs251", "mcs51"]
Rule {
id: assembler
inputs: ["asm"]
outputFileTags: Cpp.assemblerOutputTags(generateAssemblerListingFiles)
outputArtifacts: Cpp.assemblerOutputArtifacts(input)
prepare: KEIL.prepareAssembler.apply(KEIL, arguments)
}
FileTagger {
patterns: ["*.s", "*.a51", ".asm"]
fileTags: ["asm"]
}
Rule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
auxiliaryInputsFromDependencies: ["hpp"]
outputFileTags: Cpp.compilerOutputTags(generateCompilerListingFiles)
outputArtifacts: Cpp.compilerOutputArtifacts(input)
prepare: KEIL.prepareCompiler.apply(KEIL, arguments)
}
Rule {
id: applicationLinker
multiplex: true
inputs: ["obj", "linkerscript"]
inputsFromDependencies: ["staticlibrary"]
outputFileTags: Cpp.applicationLinkerOutputTags(generateLinkerMapFile)
outputArtifacts: Cpp.applicationLinkerOutputArtifacts(product)
prepare: KEIL.prepareLinker.apply(KEIL, arguments)
}
Rule {
id: staticLibraryLinker
multiplex: true
inputs: ["obj"]
inputsFromDependencies: ["staticlibrary"]
outputFileTags: Cpp.staticLibraryLinkerOutputTags()
outputArtifacts: Cpp.staticLibraryLinkerOutputArtifacts(product)
prepare: KEIL.prepareArchiver.apply(KEIL, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/protobuf/ 0000755 0001751 0000166 00000000000 14776170045 017647 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/protobuf/objc/ 0000755 0001751 0000166 00000000000 14776170045 020564 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/protobuf/objc/protobufobjc.qbs 0000644 0001751 0000166 00000004361 14776170045 023775 0 ustar runner docker import qbs.File
import qbs.FileInfo
import qbs.Probes
import "../protobufbase.qbs" as ProtobufBase
import "../protobuf.js" as HelperFunctions
ProtobufBase {
property string includePath: includeProbe.path
property string libraryPath: libraryProbe.path
property string frameworkPath: frameworkProbe.path
Depends { name: "cpp" }
cpp.includePaths: [outputDir].concat(!frameworkPath && includePath ? [includePath] : [])
cpp.libraryPaths: !frameworkPath && libraryPath ? [libraryPath] : []
cpp.dynamicLibraries: !frameworkPath && libraryPath ? ["ProtocolBuffers"] : []
cpp.frameworkPaths: frameworkPath ? [frameworkPath] : []
cpp.frameworks: ["Foundation"].concat(frameworkPath ? ["Protobuf"] : [])
cpp.defines: frameworkPath ? ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS"] : []
Rule {
inputs: ["protobuf.input"]
outputFileTags: ["hpp", "protobuf.hpp", "objc"]
outputArtifacts: {
var outputDir = HelperFunctions.getOutputDir(input.protobuf.objc, input);
return [
HelperFunctions.objcArtifact(outputDir, input, ["hpp", "protobuf.hpp"],
".pbobjc.h"),
HelperFunctions.objcArtifact(outputDir, input, ["objc"], ".pbobjc.m")
];
}
prepare: HelperFunctions.doPrepare(input.protobuf.objc, product, input, outputs, "objc")
}
Probes.IncludeProbe {
id: includeProbe
names: "GPBMessage.h"
}
Probes.LibraryProbe {
id: libraryProbe
names: "ProtocolBuffers"
}
Probes.FrameworkProbe {
id: frameworkProbe
names: ["Protobuf"]
}
validate: {
HelperFunctions.validateCompiler(compilerName, compilerPath);
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.";
}
}
}
}
qbs-src-2.6.1/share/qbs/modules/protobuf/nanopb/ 0000755 0001751 0000166 00000000000 14776170045 021124 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/protobuf/nanopb/nanopb.qbs 0000644 0001751 0000166 00000006547 14776170045 023124 0 ustar runner docker import qbs.File
import qbs.FileInfo
import qbs.Probes
import qbs.ModUtils
import "../protobufbase.qbs" as ProtobufBase
import "../protobuf.js" as HelperFunctions
ProtobufBase {
property string includePath: includeProbe.found ? includeProbe.path : undefined
property string libraryPath: libraryProbe.found ? libraryProbe.path : undefined
property string pluginPath: pluginProbe.filePath
property string pluginName: "protoc-gen-nanopb"
readonly property string _plugin: "protoc-gen-nanopb=" + pluginPath
readonly property string _libraryName: {
var libraryName;
if (libraryProbe.found) {
libraryName = FileInfo.baseName(libraryProbe.fileName);
if (libraryName.startsWith("lib"))
libraryName = libraryName.substring(3);
}
return libraryName;
}
Depends { name: "cpp" }
cpp.libraryPaths: {
var result = [];
if (libraryProbe.found)
result.push(libraryProbe.path);
return result;
}
cpp.dynamicLibraries: {
var result = [];
if (_libraryName)
result.push(_libraryName);
return result;
}
cpp.includePaths: {
var result = [outputDir];
if (includeProbe.found)
result.push(includePath);
return result;
}
cpp.cxxLanguageVersion: qbs.targetOS.contains("darwin") ? ["c++17"] : ["c++11"]
Rule {
inputs: ["protobuf.input"]
outputFileTags: ["hpp", "protobuf.hpp", "cpp"]
outputArtifacts: {
var outputDir = HelperFunctions.getOutputDir(input.protobuf.nanopb, input);
var result = [
HelperFunctions.cppArtifact(outputDir, input, ["hpp", "protobuf.hpp"],
".pb.h"),
HelperFunctions.cppArtifact(outputDir, input, ["cpp"], ".pb.c")
];
return result;
}
prepare: {
var options = input.protobuf.nanopb.importPaths.map(function (path) {
return "-I" + path;
})
var result = HelperFunctions.doPrepare(
input.protobuf.nanopb, product, input, outputs, "nanopb",
input.protobuf.nanopb._plugin, options);
return result;
}
}
Probes.IncludeProbe {
id: includeProbe
names: ["pb.h", "pb_encode.h", "pb_decode.h", "pb_common.h"]
platformSearchPaths: includePath ? [] : base
searchPaths: includePath ? [includePath] : []
}
Probes.LibraryProbe {
id: libraryProbe
names: [
"protobuf-nanopb",
"protobuf-nanopbd",
]
platformSearchPaths: libraryPath ? [] : base
searchPaths: libraryPath ? [libraryPath] : []
}
Probes.BinaryProbe {
id: pluginProbe
names: pluginName
}
validate: {
HelperFunctions.validateCompiler(compilerName, compilerPath);
if (!includeProbe.found)
throw "Can't find nanopb protobuf include files. Please set the includePath property.";
if (!libraryProbe.found)
throw "Can't find nanopb protobuf library. Please set the libraryPath property.";
if (!HelperFunctions.checkPath(pluginPath))
throw "Can't find nanopb protobuf plugin. Please set the pluginPath property.";
}
}
qbs-src-2.6.1/share/qbs/modules/protobuf/protobuf.js 0000644 0001751 0000166 00000011060 14776170045 022043 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2018 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
function validateCompiler(compilerName, compilerPath) {
if (!File.exists(compilerPath)) {
throw "Can't find '" + compilerName + "' binary. Please set the compilerPath property or "
+ "make sure the compiler is found in PATH";
}
}
function checkPath(path) {
return path && File.exists(path);
};
function toCamelCase(str){
return str.split('_').map(function(word, index) {
// If it is the first word make sure to lowercase all the chars.
if (index === 0) {
return word.toLowerCase();
}
// If it is not the first word only upper case the first char and lowercase the rest.
return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();
}).join('');
}
function getOutputDir(module, input) {
var outputDir = module.outputDir;
var importPaths = module.importPaths;
if (importPaths.length !== 0) {
var canonicalInput = File.canonicalFilePath(FileInfo.path(input.filePath));
for (var i = 0; i < importPaths.length; ++i) {
var path = File.canonicalFilePath(importPaths[i]);
if (canonicalInput.startsWith(path)) {
return outputDir + "/" + FileInfo.relativePath(path, canonicalInput);
}
}
}
return outputDir;
}
function cppArtifact(outputDir, input, tags, suffix) {
return {
fileTags: tags,
filePath: FileInfo.joinPaths(outputDir, FileInfo.baseName(input.fileName) + suffix),
cpp: {
includePaths: [].concat(input.cpp.includePaths, outputDir),
defines: ["NDEBUG"],
warningLevel: "none",
}
};
}
function objcArtifact(outputDir, input, tags, suffix) {
return {
fileTags: tags,
filePath: FileInfo.joinPaths(
outputDir, toCamelCase(FileInfo.baseName(input.fileName)) + suffix),
cpp: {
automaticReferenceCounting: false,
includePaths: [].concat(input.cpp.includePaths, outputDir),
warningLevel: "none",
}
}
}
function doPrepare(module, product, input, outputs, generator, plugin, generatorOptions)
{
var outputDir = module.outputDir;
var args = [];
if (!!plugin)
args.push("--plugin=" + plugin)
args.push("--" + generator + "_out", outputDir);
if (!!generatorOptions) {
for (var i = 0; i < generatorOptions.length; ++i)
args.push("--" + generator + "_opt=" + generatorOptions[i])
}
var importPaths = module.importPaths;
if (importPaths.length === 0)
importPaths = [FileInfo.path(input.filePath)];
importPaths.forEach(function(path) {
if (!FileInfo.isAbsolutePath(path))
path = FileInfo.joinPaths(product.sourceDirectory, path);
args.push("--proto_path", path);
});
args.push(input.filePath);
var cmd = new Command(module.compilerPath, args);
cmd.highlight = "codegen";
cmd.description = "generating " + generator + " files for " + input.fileName;
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/protobuf/cpp/ 0000755 0001751 0000166 00000000000 14776170045 020431 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/protobuf/cpp/protobufcpp.qbs 0000644 0001751 0000166 00000005661 14776170045 023513 0 ustar runner docker import qbs.File
import qbs.FileInfo
import qbs.Probes
import qbs.ModUtils
import "../protobufbase.qbs" as ProtobufBase
import "../protobuf.js" as HelperFunctions
ProtobufBase {
property bool useGrpc: false
property bool _linkLibraries: true
readonly property bool _hasModules: protobuflib.present && (!useGrpc || grpcpp.present)
property string _cxxLanguageVersion: "c++17"
_searchPaths: protobuflib.present ? protobuflib.hostBinDirs : undefined
property stringList _grpcSearchPaths: grpcpp.present ? grpcpp.hostBinDirs : undefined
cpp.includePaths: outputDir
Depends { name: "cpp" }
Depends {
name: "protobuflib";
condition: _linkLibraries;
required: false
}
Depends {
name: "grpc++";
id: grpcpp
condition: _linkLibraries && useGrpc;
required: false
}
property path grpcPluginPath: grpcPluginProbe.filePath
Probes.BinaryProbe {
condition: useGrpc
id: grpcPluginProbe
names: "grpc_cpp_plugin"
searchPaths: _grpcSearchPaths
}
cpp.cxxLanguageVersion: _cxxLanguageVersion
Rule {
inputs: ["protobuf.input", "protobuf.grpc"]
outputFileTags: ["hpp", "protobuf.hpp", "cpp"]
outputArtifacts: {
var outputDir = HelperFunctions.getOutputDir(input.protobuf.cpp, input);
var result = [
HelperFunctions.cppArtifact(outputDir, input, ["hpp", "protobuf.hpp"],
".pb.h"),
HelperFunctions.cppArtifact(outputDir, input, "cpp", ".pb.cc")
];
if (input.fileTags.includes("protobuf.grpc")) {
result.push(
HelperFunctions.cppArtifact(outputDir, input, ["hpp", "protobuf.hpp"],
".grpc.pb.h"),
HelperFunctions.cppArtifact(outputDir, input, ["cpp"], ".grpc.pb.cc"));
}
return result;
}
prepare: {
var result = HelperFunctions.doPrepare(
input.protobuf.cpp, product, input, outputs, "cpp");
if (input.fileTags.includes("protobuf.grpc")) {
result = ModUtils.concatAll(result, HelperFunctions.doPrepare(
input.protobuf.cpp, product, input, outputs, "grpc",
"protoc-gen-grpc=" + input.protobuf.cpp.grpcPluginPath));
}
return result;
}
}
validate: {
HelperFunctions.validateCompiler(compilerName, compilerPath);
if (_linkLibraries && ! _hasModules) {
throw "Can't find cpp protobuf runtime. Make sure .pc files are present";
}
if (useGrpc) {
if (!File.exists(grpcPluginPath))
throw "Can't find grpc_cpp_plugin plugin. Please set the grpcPluginPath property.";
}
}
}
qbs-src-2.6.1/share/qbs/modules/protobuf/protobufbase.qbs 0000644 0001751 0000166 00000001066 14776170045 023054 0 ustar runner docker import qbs.File
import qbs.FileInfo
import qbs.Probes
import "protobuf.js" as HelperFunctions
Module {
property string compilerName: "protoc"
property string compilerPath: compilerProbe.filePath
property var _searchPaths
property pathList importPaths: []
readonly property string outputDir: product.buildDirectory + "/protobuf"
FileTagger {
patterns: ["*.proto"]
fileTags: ["protobuf.input"]
}
Probes.BinaryProbe {
id: compilerProbe
names: [compilerName]
searchPaths: _searchPaths
}
}
qbs-src-2.6.1/share/qbs/modules/Sanitizers/ 0000755 0001751 0000166 00000000000 14776170045 020142 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Sanitizers/address/ 0000755 0001751 0000166 00000000000 14776170045 021567 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Sanitizers/address/asan.qbs 0000644 0001751 0000166 00000006323 14776170045 023224 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2022 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Utilities
Module {
Depends { name: "cpp" }
property bool enabled: true
readonly property bool _supported: qbs.toolchain.includes("gcc")
|| qbs.toolchain.includes("clang-cl")
|| (qbs.toolchain.includes("msvc")
&& Utilities.versionCompare(cpp.compilerVersion, "19.28.29500.0") >= 0)
readonly property bool _enabled: enabled && _supported
property string detectUseAfterReturn: "always"
PropertyOptions {
name: "detectUseAfterReturn"
description: "Whether to detect problems with stack use after return from a function"
allowedValues: ["never", "runtime", "always"]
}
property bool detectUseAfterScope: true
cpp.driverFlags: {
var flags = [];
if (!_enabled)
return flags;
if (qbs.toolchain.includes("msvc") && !qbs.toolchain.includes("clang-cl")) {
flags.push("/fsanitize=address");
if (detectUseAfterReturn !== "never")
flags.push("/fsanitize-address-use-after-return");
return flags;
}
flags.push("-fsanitize=address", "-fno-omit-frame-pointer");
if (detectUseAfterScope)
flags.push("-fsanitize-address-use-after-scope");
if (detectUseAfterReturn) {
if (qbs.toolchain.includes("llvm")) {
var minVersion = qbs.toolchain.contains("xcode") ? "14" : "13";
if (Utilities.versionCompare(cpp.compilerVersion, minVersion) >= 0)
flags.push("-fsanitize-address-use-after-return=" + detectUseAfterReturn);
} else if (detectUseAfterReturn === "never") {
flags.push("--param", "asan-use-after-return=0");
}
}
return flags;
}
}
qbs-src-2.6.1/share/qbs/modules/texttemplate/ 0000755 0001751 0000166 00000000000 14776170045 020527 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/texttemplate/texttemplate.qbs 0000644 0001751 0000166 00000004731 14776170045 023763 0 ustar runner docker import qbs.TextFile
Module {
property var dict: ({})
property string outputTag: "text"
property string outputFileName
FileTagger {
patterns: ["*.in"]
fileTags: ["texttemplate.input"]
}
Rule {
inputs: ["texttemplate.input"]
outputFileTags: [product.texttemplate.outputTag]
outputArtifacts: [
{
fileTags: [product.texttemplate.outputTag],
filePath: input.texttemplate.outputFileName || input.completeBaseName
}
]
prepare: {
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode = function() {
try {
var src = new TextFile(input.filePath, TextFile.ReadOnly);
var dst = new TextFile(output.filePath, TextFile.WriteOnly);
var rex = /\${(\$|\w+)}/g;
var match;
while (!src.atEof()) {
rex.lastIndex = 0;
var line = src.readLine();
var matches = [];
while (match = rex.exec(line))
matches.push(match);
for (var i = matches.length; --i >= 0;) {
match = matches[i];
var replacement;
if (match[1] === "$") {
replacement = "$";
} else {
replacement = input.texttemplate.dict[match[1]];
if (typeof replacement === "undefined") {
throw new Error("Placeholder '" + match[1]
+ "' is not defined in textemplate.dict for '"
+ input.fileName + "'.");
}
}
line = line.substr(0, match.index)
+ replacement
+ line.substr(match.index + match[0].length);
}
dst.writeLine(line);
}
} finally {
if (src)
src.close();
if (dst)
dst.close();
}
};
return [cmd];
}
}
}
qbs-src-2.6.1/share/qbs/modules/cpufeatures/ 0000755 0001751 0000166 00000000000 14776170045 020335 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/cpufeatures/cpufeatures.qbs 0000644 0001751 0000166 00000001160 14776170045 023370 0 ustar runner docker Module {
property bool arm_neon
property bool arm_vfpv4
property bool mips_dsp
property bool mips_dspr2
property bool x86_avx
property bool x86_avx2
property bool x86_avx512bw
property bool x86_avx512cd
property bool x86_avx512dq
property bool x86_avx512er
property bool x86_avx512f
property bool x86_avx512ifma
property bool x86_avx512pf
property bool x86_avx512vbmi
property bool x86_avx512vl
property bool x86_f16c
property bool x86_sse2
property bool x86_sse3
property bool x86_sse4_1
property bool x86_sse4_2
property bool x86_ssse3
}
qbs-src-2.6.1/share/qbs/modules/vcs/ 0000755 0001751 0000166 00000000000 14776170045 016602 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/vcs/vcs-module.qbs 0000644 0001751 0000166 00000013230 14776170045 021366 0 ustar runner docker import qbs.File
import qbs.FileInfo
import qbs.Process
import qbs.TextFile
import qbs.Utilities
Module {
property string type: typeProbe.type
property string repoDir: project.sourceDirectory
property string toolFilePath: {
if (type === "git")
return "git";
if (type === "svn")
return "svn";
}
property string headerFileName: "vcs-repo-state.h"
readonly property string repoState: gitProbe.repoState || subversionProbe.repoState
// Internal
readonly property string includeDir: FileInfo.joinPaths(product.buildDirectory, "vcs-include")
readonly property string metaDataBaseDir: typeProbe.metaDataBaseDir
PropertyOptions {
name: "type"
allowedValues: ["git", "svn"]
description: "the version control system your project is using"
}
Group {
condition: headerFileName
Depends { name: "cpp" }
product.cpp.includePaths: [includeDir]
Rule {
multiplex: true
Artifact {
filePath: FileInfo.joinPaths(product.vcs.includeDir, product.vcs.headerFileName)
fileTags: ["hpp"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "generating " + output.fileName;
cmd.highlight = "codegen";
cmd.repoState = product.vcs.repoState;
cmd.sourceCode = function() {
var f = new TextFile(output.filePath, TextFile.WriteOnly);
try {
f.writeLine("#ifndef VCS_REPO_STATE_H");
f.writeLine("#define VCS_REPO_STATE_H");
f.writeLine('#define VCS_REPO_STATE "' + (repoState ? repoState : "none") + '"')
f.writeLine("#endif");
} finally {
f.close();
}
};
return [cmd];
}
}
}
Probe {
id: typeProbe
property string tool: toolFilePath
property string theRepoDir: repoDir
property string type
property string metaDataBaseDir
configure: {
var detector = new Process();
try {
detector.setWorkingDirectory(theRepoDir);
if (detector.exec(tool || "git", ["rev-parse", "--git-dir"]) === 0) {
found = true;
type = "git";
metaDataBaseDir = detector.readStdOut().trim();
if (!FileInfo.isAbsolutePath(metaDataBaseDir))
metaDataBaseDir = FileInfo.joinPaths(theRepoDir, metaDataBaseDir);
return;
}
if (detector.exec(tool || "svn",
["info", "--show-item", "wc-root", "--no-newline"]) === 0) {
found = true
type = "svn";
metaDataBaseDir = FileInfo.joinPaths(detector.readStdOut(), ".svn");
return;
} else if (detector.exec(tool || "svn", ["info"]) === 0) {
if (detector.exec(tool || "svn", ["--version", "--quiet"]) === 0
&& Utilities.versionCompare(detector.readStdOut().trim(), "1.9") < 0) {
throw "svn too old, version >= 1.9 required";
}
}
} finally {
detector.close();
}
}
}
Probe {
id: gitProbe
condition: type === "git"
property string tool: toolFilePath
property string theRepoDir: repoDir
property string filePath: FileInfo.joinPaths(metaDataBaseDir, "logs/HEAD")
property var timestamp: File.lastModified(filePath)
property string repoState
configure: {
if (!File.exists(filePath)) {
// it is possible that the HEAD file is not present in CI environments, in this
// case we can use the commit count to determine the repo state
// see https://bugreports.qt.io/projects/QBS/issues/QBS-1814
try {
var proc = new Process();
proc.setWorkingDirectory(theRepoDir);
proc.exec(tool, ["rev-list", "HEAD", "--count"], true);
} catch (e) {
return; // No commits yet.
} finally {
proc.close();
}
}
try {
var proc = new Process();
proc.setWorkingDirectory(theRepoDir);
proc.exec(tool, ["describe", "--always", "HEAD"], true);
repoState = proc.readStdOut().trim();
if (repoState)
found = true;
} finally {
proc.close();
}
}
}
Probe {
id: subversionProbe
condition: type === "svn"
property string tool: toolFilePath
property string theRepoDir: repoDir
property string filePath: FileInfo.joinPaths(metaDataBaseDir, "wc.db")
property var timestamp: File.lastModified(filePath)
property string repoState
configure: {
var proc = new Process();
try {
proc.setWorkingDirectory(theRepoDir);
proc.exec(tool, ["info", "-r", "HEAD", "--show-item", "revision", "--no-newline"],
true);
repoState = proc.readStdOut().trim();
if (repoState)
found = true;
} finally {
proc.close();
}
}
}
}
qbs-src-2.6.1/share/qbs/modules/bundle/ 0000755 0001751 0000166 00000000000 14776170045 017260 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/bundle/MacOSX-Package-Types.xcspec 0000644 0001751 0000166 00000050471 14776170045 024223 0 ustar runner docker /**
MacOSX Package Types.xcspec
Copyright (c) 1999-2015 Apple Inc. All rights reserved.
Package type specifications in the Mac OS X platform.
*/
(
// Mach-O executable
{ Type = PackageType;
Identifier = com.apple.package-type.mach-o-executable;
Name = "Mach-O Executable";
Description = "Mach-O executable";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = compiled.mach-o.executable;
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = YES;
};
},
// Mach-O object file
{ Type = PackageType;
Identifier = com.apple.package-type.mach-o-objfile;
Name = "Mach-O Object File";
Description = "Mach-O Object File";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = compiled.mach-o.objfile;
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = NO;
};
},
// Mach-O dynamic library
{ Type = PackageType;
Identifier = com.apple.package-type.mach-o-dylib;
Name = "Mach-O Dynamic Library";
Description = "Mach-O dynamic library";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = compiled.mach-o.dylib;
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = NO;
};
},
// Static library ('ar' archive containing .o files)
{ Type = PackageType;
Identifier = com.apple.package-type.static-library;
Name = "Mach-O Static Library";
Description = "Mach-O static library";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "lib";
EXECUTABLE_SUFFIX = ".a";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = archive.ar;
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = NO;
};
},
// Mach-O bundle (not related to a CFBundle)
{ Type = PackageType;
Identifier = com.apple.package-type.mach-o-bundle;
Name = "Mach-O Loadable";
Description = "Mach-O loadable";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = ".dylib";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
};
ProductReference = {
FileType = compiled.mach-o.bundle;
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = NO;
};
},
// CFBundle wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper;
Name = "Wrapper";
Description = "Wrapper";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "BNDL";
WRAPPER_PREFIX = "";
WRAPPER_SUFFIX = ".bundle";
WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
CONTENTS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH_SHALLOW_BUNDLE_$(SHALLOW_BUNDLE))";
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_VARIANT_SUFFIX)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_FOLDER_PATH = "$(EXECUTABLE_FOLDER_PATH_SHALLOW_BUNDLE_$(SHALLOW_BUNDLE))";
EXECUTABLE_PATH = "$(EXECUTABLE_FOLDER_PATH)/$(EXECUTABLE_NAME)";
INFOPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/Info.plist";
INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/InfoPlist.strings";
PKGINFO_PATH = "$(CONTENTS_FOLDER_PATH)/PkgInfo";
PBDEVELOPMENTPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/pbdevelopment.plist";
VERSIONPLIST_PATH = "$(CONTENTS_FOLDER_PATH)/version.plist";
PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Headers";
PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PrivateHeaders";
EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Executables"; // Not the same as EXECUTABLE_FOLDER_PATH
FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Frameworks";
SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedFrameworks";
SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/SharedSupport";
UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH_SHALLOW_BUNDLE_$(SHALLOW_BUNDLE))";
LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj";
DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/Documentation";
MODULES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Modules";
PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/PlugIns";
SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Scripts";
JAVA_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Java";
SYSTEM_EXTENSIONS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)/Library/SystemExtensions";
// Settings specific to deep bundles (macOS)
CONTENTS_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(WRAPPER_NAME)/Contents";
EXECUTABLE_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(CONTENTS_FOLDER_PATH)/MacOS";
UNLOCALIZED_RESOURCES_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(CONTENTS_FOLDER_PATH)/Resources";
// Settings specific to shallow bundles (iOS, DriverKit on any OS)
CONTENTS_FOLDER_PATH_SHALLOW_BUNDLE_YES = "$(WRAPPER_NAME)";
EXECUTABLE_FOLDER_PATH_SHALLOW_BUNDLE_YES = "$(CONTENTS_FOLDER_PATH)";
UNLOCALIZED_RESOURCES_FOLDER_PATH_SHALLOW_BUNDLE_YES = "$(CONTENTS_FOLDER_PATH)";
// DriverKit should always use shallow bundles
SHALLOW_BUNDLE = "$(SHALLOW_BUNDLE_$(SWIFT_PLATFORM_TARGET_PREFIX))";
SHALLOW_BUNDLE_ = YES;
SHALLOW_BUNDLE_macos = NO;
SHALLOW_BUNDLE_ios = NO; // for macCatalyst
SHALLOW_BUNDLE_driverkit = YES;
};
ProductReference = {
FileType = wrapper.cfbundle;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Shallow CFBundle wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper.shallow;
BasedOn = com.apple.package-type.wrapper;
Name = "Wrapper (Shallow)";
Description = "Shallow Wrapper";
DefaultBuildSettings = {
SHALLOW_BUNDLE = YES;
};
ProductReference = {
FileType = wrapper.cfbundle;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Application wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper.application;
BasedOn = com.apple.package-type.wrapper;
Name = "Application Wrapper";
Description = "Application Wrapper";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "APPL";
GENERATE_PKGINFO_FILE = YES;
};
ProductReference = {
FileType = wrapper.application;
Name = "$(WRAPPER_NAME)";
IsLaunchable = YES;
};
},
// Shallow Application wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper.application.shallow;
BasedOn = com.apple.package-type.wrapper.shallow;
Name = "Application Wrapper (Shallow)";
Description = "Shallow Application Wrapper";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "APPL";
GENERATE_PKGINFO_FILE = YES;
SHALLOW_BUNDLE = YES;
};
ProductReference = {
FileType = wrapper.application;
Name = "$(WRAPPER_NAME)";
IsLaunchable = YES;
};
},
// System extension wrapper
{
Type = PackageType;
Identifier = com.apple.package-type.wrapper.system-extension;
BasedOn = com.apple.package-type.wrapper;
Name = "System Extension Wrapper";
Description = "System Extension Wrapper";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "SYSX";
};
ProductReference = {
FileType = wrapper.system-extension;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Driver extension wrapper
{
Type = PackageType;
Identifier = com.apple.package-type.wrapper.driver-extension;
BasedOn = com.apple.package-type.wrapper.system-extension;
Name = "Driver Extension Wrapper";
Description = "Driver Extension Wrapper";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "DEXT";
};
ProductReference = {
FileType = wrapper.driver-extension;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Kernel extension wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper.kernel-extension;
BasedOn = com.apple.package-type.wrapper;
Name = "Kernel Extension Wrapper";
Description = "Kernel Extension Wrapper";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "KEXT";
PUBLIC_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/Headers/$(KEXT_FAMILY_NAME)";
PRIVATE_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/PrivateHeaders/$(KEXT_FAMILY_NAME)";
};
ProductReference = {
FileType = wrapper.cfbundle;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Shallow Kernel extension wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper.kernel-extension.shallow;
BasedOn = com.apple.package-type.wrapper.shallow;
Name = "Kernel Extension Wrapper (Shallow)";
Description = "Shallow Kernel Extension Wrapper";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "KEXT";
PUBLIC_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/Headers/$(KEXT_FAMILY_NAME)";
PRIVATE_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/PrivateHeaders/$(KEXT_FAMILY_NAME)";
SHALLOW_BUNDLE = YES;
};
ProductReference = {
FileType = wrapper.cfbundle;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Framework wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper.framework;
BasedOn = com.apple.package-type.wrapper;
Name = "Framework Wrapper";
Description = "Framework wrapper";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "FMWK";
WRAPPER_SUFFIX = ".framework";
VERSIONS_FOLDER_PATH = "$(VERSIONS_FOLDER_PATH_SHALLOW_BUNDLE_$(SHALLOW_BUNDLE))";
CURRENT_VERSION = "Current";
INFOPLIST_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/Info.plist";
PKGINFO_PATH = "$(WRAPPER_NAME)/PkgInfo";
VERSIONPLIST_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/version.plist";
EXECUTABLES_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)"; // Not the same as EXECUTABLE_FOLDER_PATH
SHARED_SUPPORT_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)";
CODESIGNING_FOLDER_PATH = "$(TARGET_BUILD_DIR)/$(CONTENTS_FOLDER_PATH)";
// Settings specific to deep bundles (macOS)
VERSIONS_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(WRAPPER_NAME)/Versions";
CONTENTS_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(VERSIONS_FOLDER_PATH)/$(FRAMEWORK_VERSION)";
EXECUTABLE_FOLDER_PATH_SHALLOW_BUNDLE_NO = "$(CONTENTS_FOLDER_PATH)";
// Settings specific to shallow bundles (iOS, DriverKit on any OS)
VERSIONS_FOLDER_PATH_SHALLOW_BUNDLE_YES = "$(WRAPPER_NAME)";
};
ProductReference = {
FileType = wrapper.framework;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Static framework wrapper (like a framework, except that it contains a libX.a instead of a dylib)
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper.framework.static;
Name = "Mach-O Static Framework";
Description = "Mach-O static framework";
BasedOn = com.apple.package-type.wrapper.framework;
DefaultBuildSettings = {
};
ProductReference = {
FileType = wrapper.framework.static;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Shallow Framework Package
{ Type = PackageType;
Identifier = com.apple.package-type.wrapper.framework.shallow;
Name = "Shallow Framework Wrapper";
Description = "Shallow framework wrapper";
BasedOn = com.apple.package-type.wrapper.framework;
DefaultBuildSettings = {
SHALLOW_BUNDLE = YES;
};
ProductReference = {
FileType = wrapper.framework;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Unit Test Bundle wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.bundle.unit-test;
BasedOn = com.apple.package-type.wrapper;
Name = "Unit Test Bundle";
Description = "Unit Test Bundle";
DefaultBuildSettings = {
WRAPPER_SUFFIX = "xctest";
};
ProductReference = {
FileType = wrapper.cfbundle;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Legacy OCUnit Test Bundle wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.bundle.ocunit-test;
BasedOn = com.apple.package-type.wrapper;
Name = "OCUnit Test Bundle";
Description = "OCUnit Test Bundle";
DefaultBuildSettings = {
WRAPPER_SUFFIX = "octest";
};
ProductReference = {
FileType = wrapper.cfbundle;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// In-app Purchase Content wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.in-app-purchase-content;
BasedOn = com.apple.package-type.wrapper;
Name = "In-App Purchase Content";
Description = "In-App Purchase Content";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "";
WRAPPER_SUFFIX = "";
EXECUTABLE_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
INFOPLIST_PATH = "$(WRAPPER_NAME)/ContentInfo.plist";
INFOSTRINGS_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)/ContentInfo.strings";
PUBLIC_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
PRIVATE_HEADERS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
EXECUTABLES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
SHARED_FRAMEWORKS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
SHARED_SUPPORT_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
UNLOCALIZED_RESOURCES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
LOCALIZED_RESOURCES_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)/$(DEVELOPMENT_LANGUAGE).lproj";
DOCUMENTATION_FOLDER_PATH = "$(LOCALIZED_RESOURCES_FOLDER_PATH)";
MODULES_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
PLUGINS_FOLDER_PATH = "$(CONTENTS_FOLDER_PATH)";
SCRIPTS_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)";
JAVA_FOLDER_PATH = "$(UNLOCALIZED_RESOURCES_FOLDER_PATH)";
};
ProductReference = {
FileType = folder;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// XPC Service wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.xpc-service;
BasedOn = com.apple.package-type.wrapper;
Name = "XPC Service";
Description = "XPC Service";
DefaultBuildSettings = {
PRODUCT_BUNDLE_PACKAGE_TYPE = "XPC!";
WRAPPER_SUFFIX = ".xpc";
};
ProductReference = {
FileType = wrapper.xpc-service;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// PlugInKit PlugIn wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.pluginkit-plugin;
BasedOn = com.apple.package-type.xpc-service;
Name = "PlugInKit PlugIn";
Description = "PlugInKit PlugIn";
DefaultBuildSettings = {
WRAPPER_SUFFIX = ".pluginkit";
};
ProductReference = {
FileType = wrapper.app-extension;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// App Extension wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.app-extension;
BasedOn = com.apple.package-type.pluginkit-plugin;
Name = "App Extension";
Description = "App Extension";
DefaultBuildSettings = {
WRAPPER_SUFFIX = ".appex";
};
ProductReference = {
FileType = wrapper.app-extension;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Spotlight Importer wrapper
{ Type = PackageType;
Identifier = com.apple.package-type.spotlight-importer;
BasedOn = com.apple.package-type.wrapper;
Name = "Spotlight Importer";
Description = "Spotlight Importer";
DefaultBuildSettings = {
};
ProductReference = {
FileType = wrapper.spotlight-importer;
Name = "$(WRAPPER_NAME)";
IsLaunchable = NO;
};
},
// Jar file
{ Type = PackageType;
Identifier = com.apple.package-type.jarfile;
Name = "Jar File";
Description = "Jar file";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = ".jar";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
JAVA_ARCHIVE_CLASSES = YES;
JAVA_MAKE_ZIPFILE = NO;
};
ProductReference = {
FileType = archive.jar;
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = NO;
};
},
// Zip file
{ Type = PackageType;
Identifier = com.apple.package-type.zipfile;
Name = "Zip File";
Description = "Zip file";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = ".zip";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
JAVA_ARCHIVE_CLASSES = YES;
JAVA_MAKE_ZIPFILE = YES;
};
ProductReference = {
FileType = archive.zip;
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = NO;
};
},
// Java class folder
{ Type = PackageType;
Identifier = com.apple.package-type.javaclassfolder;
Name = "Class Folder";
Description = "Class folder";
DefaultBuildSettings = {
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
EXECUTABLE_NAME = "$(EXECUTABLE_PREFIX)$(PRODUCT_NAME)$(EXECUTABLE_SUFFIX)";
EXECUTABLE_PATH = "$(EXECUTABLE_NAME)";
JAVA_ARCHIVE_CLASSES = NO;
};
ProductReference = {
FileType = wrapper.java-classfolder;
Name = "$(EXECUTABLE_NAME)";
IsLaunchable = NO;
};
},
)
qbs-src-2.6.1/share/qbs/modules/bundle/BundleModule.qbs 0000644 0001751 0000166 00000040034 14776170045 022347 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.BundleTools
import qbs.DarwinTools
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.PropertyList
import qbs.TextFile
import qbs.Utilities
import "bundle.js" as Bundle
import "../codesign/codesign.js" as Codesign
Module {
Depends { name: "xcode"; required: false; }
Depends { name: "codesign"; required: false; }
Probe {
id: bundleSettingsProbe
condition: qbs.targetOS.includes("darwin")
property string xcodeDeveloperPath: xcode.developerPath
property var xcodeArchSettings: xcode._architectureSettings
property string productTypeIdentifier: _productTypeIdentifier
property bool useXcodeBuildSpecs: !useBuiltinXcodeBuildSpecs
property bool isMacOs: qbs.targetOS.includes("macos")
property bool xcodePresent: xcode.present
property string xcodeVersion: xcode.version
// Note that we include several settings pointing to properties which reference the output
// of this probe (WRAPPER_NAME, WRAPPER_EXTENSION, etc.). This is to ensure that derived
// properties take into account the value of these settings if the user customized them.
property var additionalSettings: ({
"DEVELOPMENT_LANGUAGE": "English",
"EXECUTABLE_VARIANT_SUFFIX": "", // e.g. _debug, _profile
"FRAMEWORK_VERSION": frameworkVersion,
"GENERATE_PKGINFO_FILE": generatePackageInfo !== undefined
? (generatePackageInfo ? "YES" : "NO")
: undefined,
"IS_MACCATALYST": "NO",
"LD_RUNPATH_SEARCH_PATHS_NO": [],
"PRODUCT_NAME": product.targetName,
"LOCAL_APPS_DIR": Environment.getEnv("HOME") + "/Applications",
"LOCAL_LIBRARY_DIR": Environment.getEnv("HOME") + "/Library",
// actually, this is cpp.targetAbi, but XCode does not set it for non-simulator builds
// while Qbs set it to "macho".
"LLVM_TARGET_TRIPLE_SUFFIX": qbs.targetOS.includes("simulator") ? "-simulator" : "",
"SWIFT_PLATFORM_TARGET_PREFIX": isMacOs ? "macos"
: qbs.targetOS.includes("ios") ? "ios" : "",
"TARGET_BUILD_DIR": product.buildDirectory,
"WRAPPER_NAME": bundleName,
"WRAPPER_EXTENSION": extension
})
// Outputs
property var xcodeSettings: ({})
property var productTypeIdentifierChain: []
configure: {
var specsPaths = [path];
var specsSeparator = "-";
if (xcodeDeveloperPath && useXcodeBuildSpecs) {
specsPaths = Bundle.macOSSpecsPaths(xcodeVersion, xcodeDeveloperPath);
specsSeparator = " ";
}
var reader = new Bundle.XcodeBuildSpecsReader(specsPaths,
specsSeparator,
additionalSettings,
!isMacOs);
var settings = reader.expandedSettings(productTypeIdentifier,
xcodePresent
? xcodeArchSettings
: {});
var chain = reader.productTypeIdentifierChain(productTypeIdentifier);
if (settings && chain) {
xcodeSettings = settings;
productTypeIdentifierChain = chain;
found = true;
} else {
xcodeSettings = {};
productTypeIdentifierChain = [];
found = false;
}
}
}
additionalProductTypes: !(product.multiplexed || product.aggregate)
|| !product.multiplexConfigurationId ? ["bundle.content"] : []
property bool isBundle: !product.consoleApplication && qbs.targetOS.includes("darwin")
readonly property bool isShallow: bundleSettingsProbe.xcodeSettings["SHALLOW_BUNDLE"] === "YES"
property string identifierPrefix: "org.example"
property string identifier: [identifierPrefix, Utilities.rfc1034Identifier(product.targetName)].join(".")
property string extension: bundleSettingsProbe.xcodeSettings["WRAPPER_EXTENSION"]
property string packageType: Bundle.packageType(_productTypeIdentifier)
property string signature: "????" // legacy creator code in Mac OS Classic (CFBundleSignature), can be ignored
property string bundleName: bundleSettingsProbe.xcodeSettings["WRAPPER_NAME"]
property string frameworkVersion: {
var n = parseInt(product.version, 10);
return isNaN(n) ? bundleSettingsProbe.xcodeSettings["FRAMEWORK_VERSION"] : String(n);
}
property bool generatePackageInfo: {
// Make sure to return undefined as default to indicate "not set"
var genPkgInfo = bundleSettingsProbe.xcodeSettings["GENERATE_PKGINFO_FILE"];
if (genPkgInfo)
return genPkgInfo === "YES";
}
property pathList publicHeaders
property pathList privateHeaders
property pathList resources
property var infoPlist
property bool processInfoPlist: true
property bool embedInfoPlist: product.consoleApplication && !isBundle
property string infoPlistFormat: qbs.targetOS.includes("macos") ? "same-as-input" : "binary1"
property string localizedResourcesFolderSuffix: ".lproj"
property string lsregisterName: "lsregister"
property string lsregisterPath: FileInfo.joinPaths(
"/System/Library/Frameworks/CoreServices.framework" +
"/Versions/A/Frameworks/LaunchServices.framework" +
"/Versions/A/Support", lsregisterName);
// all paths are relative to the directory containing the bundle
readonly property string infoPlistPath: bundleSettingsProbe.xcodeSettings["INFOPLIST_PATH"]
readonly property string infoStringsPath: bundleSettingsProbe.xcodeSettings["INFOSTRINGS_PATH"]
readonly property string pbdevelopmentPlistPath: bundleSettingsProbe.xcodeSettings["PBDEVELOPMENTPLIST_PATH"]
readonly property string pkgInfoPath: bundleSettingsProbe.xcodeSettings["PKGINFO_PATH"]
readonly property string versionPlistPath: bundleSettingsProbe.xcodeSettings["VERSIONPLIST_PATH"]
readonly property string executablePath: bundleSettingsProbe.xcodeSettings["EXECUTABLE_PATH"]
readonly property string contentsFolderPath: bundleSettingsProbe.xcodeSettings["CONTENTS_FOLDER_PATH"]
readonly property string documentationFolderPath: bundleSettingsProbe.xcodeSettings["DOCUMENTATION_FOLDER_PATH"]
readonly property string executableFolderPath: bundleSettingsProbe.xcodeSettings["EXECUTABLE_FOLDER_PATH"]
readonly property string executablesFolderPath: bundleSettingsProbe.xcodeSettings["EXECUTABLES_FOLDER_PATH"]
readonly property string frameworksFolderPath: bundleSettingsProbe.xcodeSettings["FRAMEWORKS_FOLDER_PATH"]
readonly property string javaFolderPath: bundleSettingsProbe.xcodeSettings["JAVA_FOLDER_PATH"]
readonly property string localizedResourcesFolderPath: bundleSettingsProbe.xcodeSettings["LOCALIZED_RESOURCES_FOLDER_PATH"]
readonly property string pluginsFolderPath: bundleSettingsProbe.xcodeSettings["PLUGINS_FOLDER_PATH"]
readonly property string privateHeadersFolderPath: bundleSettingsProbe.xcodeSettings["PRIVATE_HEADERS_FOLDER_PATH"]
readonly property string publicHeadersFolderPath: bundleSettingsProbe.xcodeSettings["PUBLIC_HEADERS_FOLDER_PATH"]
readonly property string scriptsFolderPath: bundleSettingsProbe.xcodeSettings["SCRIPTS_FOLDER_PATH"]
readonly property string sharedFrameworksFolderPath: bundleSettingsProbe.xcodeSettings["SHARED_FRAMEWORKS_FOLDER_PATH"]
readonly property string sharedSupportFolderPath: bundleSettingsProbe.xcodeSettings["SHARED_SUPPORT_FOLDER_PATH"]
readonly property string unlocalizedResourcesFolderPath: bundleSettingsProbe.xcodeSettings["UNLOCALIZED_RESOURCES_FOLDER_PATH"]
readonly property string versionsFolderPath: bundleSettingsProbe.xcodeSettings["VERSIONS_FOLDER_PATH"]
property bool useBuiltinXcodeBuildSpecs: !_useXcodeBuildSpecs // true to use ONLY the qbs build specs
// private properties
property string _productTypeIdentifier: Bundle.productTypeIdentifier(product.type)
property stringList _productTypeIdentifierChain: bundleSettingsProbe.productTypeIdentifierChain
readonly property path _developerPath: xcode.developerPath
readonly property path _platformInfoPlist: xcode.platformInfoPlist
readonly property path _sdkSettingsPlist: xcode.sdkSettingsPlist
readonly property path _toolchainInfoPlist: xcode.toolchainInfoPlist
property bool _useXcodeBuildSpecs: true // TODO: remove in 1.25
property var extraEnv: ({
"PRODUCT_BUNDLE_IDENTIFIER": identifier
})
readonly property var qmakeEnv: {
return {
"BUNDLEIDENTIFIER": identifier,
"EXECUTABLE": product.targetName,
"FULL_VERSION": product.version || "1.0", // CFBundleVersion
"ICON": product.targetName, // ### QBS-73
"LIBRARY": product.targetName,
"SHORT_VERSION": product.version || "1.0", // CFBundleShortVersionString
"TYPEINFO": signature // CFBundleSignature
};
}
readonly property var defaultInfoPlist: {
return {
CFBundleDevelopmentRegion: "en", // default localization
CFBundleDisplayName: product.targetName, // localizable
CFBundleExecutable: product.targetName,
CFBundleIdentifier: identifier,
CFBundleInfoDictionaryVersion: "6.0",
CFBundleName: product.targetName, // short display name of the bundle, localizable
CFBundlePackageType: packageType,
CFBundleShortVersionString: product.version || "1.0", // "release" version number, localizable
CFBundleSignature: signature, // legacy creator code in Mac OS Classic, can be ignored
CFBundleVersion: product.version || "1.0.0" // build version number, must be 3 octets
};
}
validate: {
if (!qbs.targetOS.includes("darwin"))
return;
if (!bundleSettingsProbe.found) {
var error = "Bundle product type " + _productTypeIdentifier + " is not supported.";
if ((_productTypeIdentifier || "").startsWith("com.apple.product-type."))
error += " You may need to upgrade Xcode.";
throw error;
}
var validator = new ModUtils.PropertyValidator("bundle");
validator.setRequiredProperty("bundleName", bundleName);
validator.setRequiredProperty("infoPlistPath", infoPlistPath);
validator.setRequiredProperty("pbdevelopmentPlistPath", pbdevelopmentPlistPath);
validator.setRequiredProperty("pkgInfoPath", pkgInfoPath);
validator.setRequiredProperty("versionPlistPath", versionPlistPath);
validator.setRequiredProperty("executablePath", executablePath);
validator.setRequiredProperty("contentsFolderPath", contentsFolderPath);
validator.setRequiredProperty("documentationFolderPath", documentationFolderPath);
validator.setRequiredProperty("executableFolderPath", executableFolderPath);
validator.setRequiredProperty("executablesFolderPath", executablesFolderPath);
validator.setRequiredProperty("frameworksFolderPath", frameworksFolderPath);
validator.setRequiredProperty("javaFolderPath", javaFolderPath);
validator.setRequiredProperty("localizedResourcesFolderPath", localizedResourcesFolderPath);
validator.setRequiredProperty("pluginsFolderPath", pluginsFolderPath);
validator.setRequiredProperty("privateHeadersFolderPath", privateHeadersFolderPath);
validator.setRequiredProperty("publicHeadersFolderPath", publicHeadersFolderPath);
validator.setRequiredProperty("scriptsFolderPath", scriptsFolderPath);
validator.setRequiredProperty("sharedFrameworksFolderPath", sharedFrameworksFolderPath);
validator.setRequiredProperty("sharedSupportFolderPath", sharedSupportFolderPath);
validator.setRequiredProperty("unlocalizedResourcesFolderPath", unlocalizedResourcesFolderPath);
if (packageType === "FMWK") {
validator.setRequiredProperty("frameworkVersion", frameworkVersion);
validator.setRequiredProperty("versionsFolderPath", versionsFolderPath);
}
// extension and infoStringsPath might not be set
return validator.validate();
}
FileTagger {
fileTags: ["infoplist"]
patterns: ["Info.plist", "*-Info.plist"]
}
Rule {
condition: qbs.targetOS.includes("darwin")
multiplex: true
requiresInputs: false // TODO: The resources property should probably be a tag instead.
inputs: ["infoplist", "partial_infoplist"]
outputFileTags: ["bundle.input", "aggregate_infoplist"]
outputArtifacts: Bundle.aggregateInfoPlistOutputs(product)
prepare: Bundle.aggregateInfoPlistCommands.apply(Bundle, arguments)
}
Rule {
condition: qbs.targetOS.includes("darwin")
multiplex: true
inputs: ["aggregate_infoplist"]
outputFileTags: ["bundle.input", "pkginfo"]
outputArtifacts: Bundle.generatePkgInfoOutputs(product)
prepare: Bundle.generatePkgInfoCommands.apply(Bundle, arguments)
}
Rule {
condition: qbs.targetOS.includes("darwin")
multiplex: true
inputs: ["bundle.input",
"aggregate_infoplist", "pkginfo", "hpp",
"icns", "codesign.xcent",
"compiled_ibdoc", "compiled_assetcatalog",
"codesign.embedded_provisioningprofile", "bundle.input.privacymanifest"]
// Make sure the inputs of this rule are only those rules which produce outputs compatible
// with the type of the bundle being produced.
excludedInputs: Bundle.excludedAuxiliaryInputs(project, product)
outputFileTags: [
"bundle.content",
"bundle.symlink.headers", "bundle.symlink.private-headers",
"bundle.symlink.resources", "bundle.symlink.executable",
"bundle.symlink.version", "bundle.hpp", "bundle.resource",
"bundle.provisioningprofile", "bundle.content.copied", "bundle.application-executable",
"bundle.code-signature", "bundle.privacymanifest"]
outputArtifacts: Bundle.generateBundleOutputs(product, inputs)
prepare: Bundle.generateBundleCommands.apply(Bundle, arguments)
}
}
qbs-src-2.6.1/share/qbs/modules/bundle/bundle.js 0000644 0001751 0000166 00000105307 14776170045 021075 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Codesign = require("../codesign/codesign.js");
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var DarwinTools = require("qbs.DarwinTools");
var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
var Utilities = require("qbs.Utilities");
// HACK: Workaround until the PropertyList extension is supported cross-platform
var TextFile = require("qbs.TextFile");
var PropertyList2 = (function () {
function PropertyList2() {
}
PropertyList2.prototype.readFromFile = function (filePath) {
var str;
var process = new Process();
try {
if (process.exec("plutil", ["-convert", "json", "-o", "-", filePath], false) === 0) {
str = process.readStdOut();
} else {
var tf = new TextFile(filePath);
try {
str = tf.readAll();
} finally {
tf.close();
}
}
} finally {
process.close();
}
if (str)
this.obj = JSON.parse(str);
};
PropertyList2.prototype.toObject = function () {
return this.obj;
};
PropertyList2.prototype.clear = function () {
};
return PropertyList2;
}());
// Order is significant due to productTypeIdentifier() search path
var _productTypeIdentifiers = {
"inapppurchase": "com.apple.product-type.in-app-purchase-content",
"applicationextension": "com.apple.product-type.app-extension",
"xpcservice": "com.apple.product-type.xpc-service",
"application": "com.apple.product-type.application",
"dynamiclibrary": "com.apple.product-type.framework",
"loadablemodule": "com.apple.product-type.bundle",
"staticlibrary": "com.apple.product-type.framework.static",
"kernelmodule": "com.apple.product-type.kernel-extension"
};
function productTypeIdentifier(productType) {
for (var k in _productTypeIdentifiers) {
if (productType.includes(k))
return _productTypeIdentifiers[k];
}
return "com.apple.package-type.wrapper";
}
function excludedAuxiliaryInputs(project, product) {
var chain = product.bundle._productTypeIdentifierChain;
var bestPossibleType;
for (var i = chain.length - 1; i >= 0; --i) {
switch (chain[i]) {
case "com.apple.product-type.bundle":
bestPossibleType = "loadablemodule";
break;
case "com.apple.product-type.framework":
bestPossibleType = "dynamiclibrary";
break;
case "com.apple.product-type.framework.static":
bestPossibleType = "staticlibrary";
break;
case "com.apple.product-type.application":
case "com.apple.product-type.xpc-service":
bestPossibleType = "application";
break;
}
}
var excluded = [];
var possibleTypes = ["application", "dynamiclibrary", "staticlibrary", "loadablemodule"];
for (i = 0; i < possibleTypes.length; ++i) {
if (possibleTypes[i] !== bestPossibleType)
excluded.push(possibleTypes[i]);
}
return excluded;
}
function packageType(productTypeIdentifier) {
switch (productTypeIdentifier) {
case "com.apple.product-type.in-app-purchase-content":
return undefined;
case "com.apple.product-type.app-extension":
case "com.apple.product-type.xpc-service":
return "XPC!";
case "com.apple.product-type.application":
return "APPL";
case "com.apple.product-type.framework":
case "com.apple.product-type.framework.static":
return "FMWK";
case "com.apple.product-type.kernel-extension":
case "com.apple.product-type.kernel-extension.iokit":
return "KEXT";
default:
return "BNDL";
}
}
function _assign(target, source) {
if (source) {
for (var k in source) {
if (source.hasOwnProperty(k))
target[k] = source[k];
}
return target;
}
}
function macOSSpecsPaths(version, developerPath) {
var result = [];
if (Utilities.versionCompare(version, "15.3") >= 0) {
result.push(FileInfo.joinPaths(
developerPath, "..", "SharedFrameworks", "XCBuild.framework", "PlugIns",
"XCBBuildService.bundle", "Contents", "PlugIns", "XCBSpecifications.ideplugin",
"Contents", "Resources"));
}
if (Utilities.versionCompare(version, "14.3") >= 0) {
result.push(FileInfo.joinPaths(
developerPath, "Library", "Xcode", "Plug-ins", "XCBSpecifications.ideplugin",
"Contents", "Resources"));
} else if (Utilities.versionCompare(version, "12.5") >= 0) {
result.push(FileInfo.joinPaths(
developerPath, "..", "PlugIns", "XCBSpecifications.ideplugin",
"Contents", "Resources"));
} else if (Utilities.versionCompare(version, "12") >= 0) {
result.push(FileInfo.joinPaths(
developerPath, "Platforms", "MacOSX.platform", "Developer", "Library", "Xcode",
"PrivatePlugIns", "IDEOSXSupportCore.ideplugin", "Contents", "Resources"));
} else {
result.push(FileInfo.joinPaths(
developerPath, "Platforms", "MacOSX.platform", "Developer", "Library", "Xcode",
"Specifications"));
}
return result;
}
var XcodeBuildSpecsReader = (function () {
function XcodeBuildSpecsReader(specsPaths, separator, additionalSettings, useShallowBundles) {
this._additionalSettings = additionalSettings;
this._useShallowBundles = useShallowBundles;
this._packageTypes = [];
this._productTypes = [];
var i, j;
for (i = 0; i < specsPaths.length; ++i) {
var specsPath = specsPaths[i];
var names = ["", "Darwin", "MacOSX"];
for (j = 0; j < names.length; ++j) {
var name = names[j];
var plist = new PropertyList2();
var plist2 = new PropertyList2();
try
{
var plistName = [name, "Package", "Types.xcspec"].join(name ? separator : "");
var plistName2 = [name, "Product", "Types.xcspec"].join(name ? separator : "");
var plistPath = FileInfo.joinPaths(specsPath, plistName);
var plistPath2 = FileInfo.joinPaths(specsPath, plistName2);
if (File.exists(plistPath)) {
plist.readFromFile(plistPath);
this._packageTypes = this._packageTypes.concat(plist.toObject());
}
if (File.exists(plistPath2)) {
plist2.readFromFile(plistPath2);
this._productTypes = this._productTypes.concat(plist2.toObject());
}
} finally {
plist.clear();
plist2.clear();
}
}
}
this._types = {};
for (i = 0; i < this._packageTypes.length; ++i)
this._types[this._packageTypes[i]["Identifier"]] = this._packageTypes[i];
for (i = 0; i < this._productTypes.length; ++i)
this._types[this._productTypes[i]["Identifier"]] = this._productTypes[i];
}
XcodeBuildSpecsReader.prototype.productTypeIdentifierChain = function (typeIdentifier) {
var ids = [typeIdentifier];
var obj = this._types[typeIdentifier];
var parentId = obj && obj["BasedOn"];
if (parentId)
return ids.concat(this.productTypeIdentifierChain(parentId));
return ids;
};
XcodeBuildSpecsReader.prototype.settings = function (typeIdentifier, recursive, skipPackageTypes) {
// Silently use shallow bundles when preferred since it seems to be some sort of automatic
// shadowing mechanism. For example, this matches Xcode behavior where static frameworks
// are shallow even though no such product specification exists, and also seems to match
// other behavior i.e. where productType in pbxproj files is never explicitly shallow.
if (this._useShallowBundles && this._types[typeIdentifier + ".shallow"] && !skipPackageTypes)
typeIdentifier += ".shallow";
var typesObject = this._types[typeIdentifier];
if (typesObject) {
var buildProperties = {};
if (recursive) {
// Get all the settings for the product's package type
if (!skipPackageTypes && typesObject["PackageTypes"]) {
for (var k = 0; k < typesObject["PackageTypes"].length; ++k) {
var props = this.settings(typesObject["PackageTypes"][k], recursive, true);
for (var y in props) {
if (props.hasOwnProperty(y))
buildProperties[y] = props[y];
}
break;
}
}
// Get all the settings for the product's inherited product type
if (typesObject["BasedOn"]) {
// We'll only do the auto shallow substitution for wrapper package types...
// this ensures that in-app purchase content bundles are non-shallow on both
// macOS and iOS, for example (which matches Xcode behavior)
var isWrapper = false;
if (typesObject["ProductReference"]) {
var fileType = typesObject["ProductReference"]["FileType"];
if (fileType)
isWrapper = fileType.startsWith("wrapper.");
}
// Prevent recursion loop if this spec's base plus .shallow would be the same
// as the current spec's identifier
var baseIdentifier = typesObject["BasedOn"];
if (this._useShallowBundles && isWrapper
&& this._types[baseIdentifier + ".shallow"]
&& typeIdentifier !== baseIdentifier + ".shallow")
baseIdentifier += ".shallow";
props = this.settings(baseIdentifier, recursive, true);
for (y in props) {
if (props.hasOwnProperty(y))
buildProperties[y] = props[y];
}
}
}
if (typesObject["Type"] === "PackageType") {
props = typesObject["DefaultBuildSettings"];
for (y in props) {
if (props.hasOwnProperty(y))
buildProperties[y] = props[y];
}
}
if (typesObject["Type"] === "ProductType") {
props = typesObject["DefaultBuildProperties"];
for (y in props) {
if (props.hasOwnProperty(y))
buildProperties[y] = props[y];
}
}
return buildProperties;
}
};
XcodeBuildSpecsReader.prototype.setting = function (typeIdentifier, settingName) {
var obj = this.settings(typeIdentifier, false);
if (obj) {
return obj[settingName];
}
};
XcodeBuildSpecsReader.prototype.expandedSettings = function (typeIdentifier, baseSettings) {
var obj = this.settings(typeIdentifier, true);
if (obj) {
for (var k in obj)
obj[k] = this.expandedSetting(typeIdentifier, baseSettings, k);
return obj;
}
};
XcodeBuildSpecsReader.prototype.expandedSetting = function (typeIdentifier, baseSettings,
settingName) {
var obj = {};
_assign(obj, baseSettings); // todo: copy recursively
obj = _assign(obj, this.settings(typeIdentifier, true));
if (obj) {
for (var x in this._additionalSettings) {
var additionalSetting = this._additionalSettings[x];
if (additionalSetting !== undefined)
obj[x] = additionalSetting;
}
var setting = obj[settingName];
var original;
while (original !== setting) {
original = setting;
setting = DarwinTools.expandPlistEnvironmentVariables({ key: setting }, obj, false)["key"];
}
return setting;
}
};
return XcodeBuildSpecsReader;
}());
function generateBundleOutputs(product, inputs)
{
var i, artifacts = [];
if (product.bundle.isBundle) {
for (i in inputs["bundle.input"]) {
var fp = inputs["bundle.input"][i].bundle._bundleFilePath;
if (!fp)
throw("Artifact " + inputs["bundle.input"][i].filePath + " has no associated bundle file path");
var extraTags = inputs["bundle.input"][i].fileTags.includes("application")
? ["bundle.application-executable"] : [];
artifacts.push({
filePath: fp,
fileTags: ["bundle.content", "bundle.content.copied"].concat(extraTags)
});
}
var provprofiles = inputs["codesign.embedded_provisioningprofile"];
for (i in provprofiles) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.bundle.contentsFolderPath,
provprofiles[i].fileName),
fileTags: ["bundle.provisioningprofile", "bundle.content"]
});
}
var privacymanifests = inputs["bundle.input.privacymanifest"] || [];
for (var i = 0; i < privacymanifests.length; ++i) {
var filePath;
if (product.qbs.targetOS.includes("macos")) {
filePath = FileInfo.joinPaths(product.destinationDirectory,
product.bundle.contentsFolderPath,
"Resources",
privacymanifests[i].fileName);
} else if (product.qbs.targetOS.includes("ios")) {
filePath = FileInfo.joinPaths(product.destinationDirectory,
product.bundle.contentsFolderPath,
privacymanifests[i].fileName);
}
if (filePath) {
artifacts.push({
filePath: filePath,
fileTags: ["bundle.content", "bundle.privacymanifest"]
});
}
}
var packageType = product.bundle.packageType;
var isShallow = product.bundle.isShallow;
if (packageType === "FMWK" && !isShallow) {
var publicHeaders = product.bundle.publicHeaders;
if (publicHeaders && publicHeaders.length) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "Headers"),
fileTags: ["bundle.symlink.headers", "bundle.content"]
});
}
var privateHeaders = ModUtils.moduleProperty(product, "privateHeaders");
if (privateHeaders && privateHeaders.length) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "PrivateHeaders"),
fileTags: ["bundle.symlink.private-headers", "bundle.content"]
});
}
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, "Resources"),
fileTags: ["bundle.symlink.resources", "bundle.content"]
});
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.bundleName, product.targetName),
fileTags: ["bundle.symlink.executable", "bundle.content"]
});
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.versionsFolderPath, "Current"),
fileTags: ["bundle.symlink.version", "bundle.content"]
});
}
var headerTypes = ["public", "private"];
for (var h in headerTypes) {
var sources = ModUtils.moduleProperty(product, headerTypes[h] + "Headers");
var destination = FileInfo.joinPaths(product.destinationDirectory, ModUtils.moduleProperty(product, headerTypes[h] + "HeadersFolderPath"));
for (i in sources) {
artifacts.push({
filePath: FileInfo.joinPaths(destination, FileInfo.fileName(sources[i])),
fileTags: ["bundle.hpp", "bundle.content"]
});
}
}
sources = product.bundle.resources;
for (i in sources) {
destination = BundleTools.destinationDirectoryForResource(product, {baseDir: FileInfo.path(sources[i]), fileName: FileInfo.fileName(sources[i])});
artifacts.push({
filePath: FileInfo.joinPaths(destination, FileInfo.fileName(sources[i])),
fileTags: ["bundle.resource", "bundle.content"]
});
}
var wrapperPath = FileInfo.joinPaths(
product.destinationDirectory,
product.bundle.bundleName);
for (var i = 0; i < artifacts.length; ++i)
artifacts[i].bundle = { wrapperPath: wrapperPath };
if (Host.os().includes("darwin") && product.codesign
&& product.codesign.enableCodeSigning) {
artifacts.push({
filePath: FileInfo.joinPaths(product.bundle.contentsFolderPath, "_CodeSignature/CodeResources"),
fileTags: ["bundle.code-signature", "bundle.content"]
});
}
}
return artifacts;
}
function generateBundleCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var i, cmd, commands = [];
var packageType = product.bundle.packageType;
var bundleType = "bundle";
if (packageType === "APPL")
bundleType = "application";
if (packageType === "FMWK")
bundleType = "framework";
// Product is unbundled
if (!product.bundle.isBundle) {
cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode = function () { };
commands.push(cmd);
}
var symlinks = outputs["bundle.symlink.version"];
for (i in symlinks) {
cmd = new Command("ln", ["-sfn", product.bundle.frameworkVersion,
symlinks[i].filePath]);
cmd.silent = true;
commands.push(cmd);
}
var publicHeaders = outputs["bundle.symlink.headers"];
for (i in publicHeaders) {
cmd = new Command("ln", ["-sfn", "Versions/Current/Headers",
publicHeaders[i].filePath]);
cmd.silent = true;
commands.push(cmd);
}
var privateHeaders = outputs["bundle.symlink.private-headers"];
for (i in privateHeaders) {
cmd = new Command("ln", ["-sfn", "Versions/Current/PrivateHeaders",
privateHeaders[i].filePath]);
cmd.silent = true;
commands.push(cmd);
}
var resources = outputs["bundle.symlink.resources"];
for (i in resources) {
cmd = new Command("ln", ["-sfn", "Versions/Current/Resources",
resources[i].filePath]);
cmd.silent = true;
commands.push(cmd);
}
var executables = outputs["bundle.symlink.executable"];
for (i in executables) {
cmd = new Command("ln", ["-sfn", FileInfo.joinPaths("Versions", "Current", product.targetName),
executables[i].filePath]);
cmd.silent = true;
commands.push(cmd);
}
function sortedArtifactList(list, func) {
if (list) {
return list.sort(func || (function (a, b) {
return a.filePath.localeCompare(b.filePath);
}));
}
}
var bundleInputs = sortedArtifactList(inputs["bundle.input"], function (a, b) {
return a.bundle._bundleFilePath.localeCompare(
b.bundle._bundleFilePath);
});
var bundleContents = sortedArtifactList(outputs["bundle.content.copied"]);
for (i in bundleContents) {
cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.source = bundleInputs[i].filePath;
cmd.destination = bundleContents[i].filePath;
cmd.sourceCode = function() {
File.copy(source, destination);
};
commands.push(cmd);
}
cmd = new JavaScriptCommand();
cmd.description = "copying provisioning profile";
cmd.highlight = "filegen";
cmd.sources = (inputs["codesign.embedded_provisioningprofile"] || [])
.map(function(artifact) { return artifact.filePath; });
cmd.destination = (outputs["bundle.provisioningprofile"] || [])
.map(function(artifact) { return artifact.filePath; });
cmd.sourceCode = function() {
var i;
for (var i in sources) {
File.copy(sources[i], destination[i]);
}
};
if (cmd.sources && cmd.sources.length)
commands.push(cmd);
cmd = new JavaScriptCommand();
cmd.description = "copying privacy manifest";
cmd.highlight = "filegen";
cmd.sources = (inputs["bundle.input.privacymanifest"] || [])
.map(function(artifact) { return artifact.filePath; });
cmd.destination = (outputs["bundle.privacymanifest"] || [])
.map(function(artifact) { return artifact.filePath; });
cmd.sourceCode = function() {
var i;
for (var i = 0; i < sources.length; ++i)
File.copy(sources[i], destination[i]);
};
if (cmd.sources && cmd.sources.length)
commands.push(cmd);
cmd = new JavaScriptCommand();
cmd.description = "copying public headers";
cmd.highlight = "filegen";
cmd.sources = product.bundle.publicHeaders;
cmd.destination = FileInfo.joinPaths(product.destinationDirectory, product.bundle.publicHeadersFolderPath);
cmd.sourceCode = function() {
var i;
for (var i in sources) {
File.copy(sources[i], FileInfo.joinPaths(destination, FileInfo.fileName(sources[i])));
}
};
if (cmd.sources && cmd.sources.length)
commands.push(cmd);
cmd = new JavaScriptCommand();
cmd.description = "copying private headers";
cmd.highlight = "filegen";
cmd.sources = product.bundle.privateHeaders;
cmd.destination = FileInfo.joinPaths(product.destinationDirectory, product.bundle.privateHeadersFolderPath);
cmd.sourceCode = function() {
var i;
for (var i in sources) {
File.copy(sources[i], FileInfo.joinPaths(destination, FileInfo.fileName(sources[i])));
}
};
if (cmd.sources && cmd.sources.length)
commands.push(cmd);
cmd = new JavaScriptCommand();
cmd.description = "copying resources";
cmd.highlight = "filegen";
cmd.sources = product.bundle.resources;
cmd.sourceCode = function() {
var i;
for (var i in sources) {
var destination = BundleTools.destinationDirectoryForResource(product, {baseDir: FileInfo.path(sources[i]), fileName: FileInfo.fileName(sources[i])});
File.copy(sources[i], FileInfo.joinPaths(destination, FileInfo.fileName(sources[i])));
}
};
if (cmd.sources && cmd.sources.length)
commands.push(cmd);
if (product.qbs.hostOS.includes("darwin")) {
Array.prototype.push.apply(commands, Codesign.prepareSign(
project, product, inputs, outputs, input, output));
if (bundleType === "application"
&& product.qbs.targetOS.includes("macos")) {
var bundlePath = FileInfo.joinPaths(
product.destinationDirectory, product.bundle.bundleName);
cmd = new Command(product.bundle.lsregisterPath,
["-f", bundlePath]);
cmd.description = "registering " + product.bundle.bundleName;
commands.push(cmd);
}
}
return commands;
}
function generatePkgInfoOutputs(product)
{
var artifacts = [];
if (product.bundle.isBundle && product.bundle.generatePackageInfo) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory, "PkgInfo"),
fileTags: ["bundle.input", "pkginfo"],
bundle: { _bundleFilePath: FileInfo.joinPaths(product.destinationDirectory, product.bundle.pkgInfoPath) }
});
}
return artifacts;
}
function generatePkgInfoCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
cmd.description = "generating PkgInfo for " + product.name;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
var infoPlist = BundleTools.infoPlistContents(inputs.aggregate_infoplist[0].filePath);
var pkgType = infoPlist['CFBundlePackageType'];
if (!pkgType)
throw("CFBundlePackageType not found in Info.plist; this should not happen");
var pkgSign = infoPlist['CFBundleSignature'];
if (!pkgSign)
throw("CFBundleSignature not found in Info.plist; this should not happen");
var pkginfo = new TextFile(outputs.pkginfo[0].filePath, TextFile.WriteOnly);
pkginfo.write(pkgType + pkgSign);
pkginfo.close();
}
return cmd;
}
function aggregateInfoPlistOutputs(product)
{
var artifacts = [];
var embed = product.bundle.embedInfoPlist;
if (product.bundle.isBundle || embed) {
artifacts.push({
filePath: FileInfo.joinPaths(
product.destinationDirectory, product.name + "-Info.plist"),
fileTags: ["aggregate_infoplist"].concat(!embed ? ["bundle.input"] : []),
bundle: {
_bundleFilePath: FileInfo.joinPaths(
product.destinationDirectory,
product.bundle.infoPlistPath),
}
});
}
return artifacts;
}
function aggregateInfoPlistCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
cmd.description = "generating Info.plist for " + product.name;
cmd.highlight = "codegen";
cmd.infoPlist = product.bundle.infoPlist || {};
cmd.processInfoPlist = product.bundle.processInfoPlist;
cmd.infoPlistFormat = product.bundle.infoPlistFormat;
cmd.extraEnv = product.bundle.extraEnv;
cmd.qmakeEnv = product.bundle.qmakeEnv;
// TODO: bundle module should know nothing about cpp module
cmd.buildEnv = product.moduleProperty("cpp", "buildEnv");
cmd.developerPath = product.bundle._developerPath;
cmd.platformInfoPlist = product.bundle._platformInfoPlist;
cmd.sdkSettingsPlist = product.bundle._sdkSettingsPlist;
cmd.toolchainInfoPlist = product.bundle._toolchainInfoPlist;
cmd.osBuildVersion = product.qbs.hostOSBuildVersion;
cmd.sourceCode = function() {
var plist, process, key, i;
// Contains the combination of default, file, and in-source keys and values
// Start out with the contents of this file as the "base", if given
var aggregatePlist = {};
for (i = 0; i < (inputs.infoplist || []).length; ++i) {
aggregatePlist =
BundleTools.infoPlistContents(inputs.infoplist[i].filePath);
infoPlistFormat = (infoPlistFormat === "same-as-input")
? BundleTools.infoPlistFormat(inputs.infoplist[i].filePath)
: "xml1";
break;
}
// Add local key-value pairs (overrides equivalent keys specified in the file if
// one was given)
for (key in infoPlist) {
if (infoPlist.hasOwnProperty(key))
aggregatePlist[key] = infoPlist[key];
}
// Do some postprocessing if desired
if (processInfoPlist) {
// Add default values to the aggregate plist if the corresponding keys
// for those values are not already present
var defaultValues = product.bundle.defaultInfoPlist;
for (key in defaultValues) {
if (defaultValues.hasOwnProperty(key) && !(key in aggregatePlist))
aggregatePlist[key] = defaultValues[key];
}
// Add keys from platform's Info.plist if not already present
var platformInfo = {};
var sdkSettings = {};
var toolchainInfo = {};
if (developerPath) {
plist = new PropertyList();
try {
plist.readFromFile(platformInfoPlist);
platformInfo = plist.toObject();
} finally {
plist.clear();
}
var additionalProps = platformInfo["AdditionalInfo"];
for (key in additionalProps) {
// override infoPlist?
if (additionalProps.hasOwnProperty(key) && !(key in aggregatePlist))
aggregatePlist[key] = defaultValues[key];
}
props = platformInfo['OverrideProperties'];
for (key in props) {
aggregatePlist[key] = props[key];
}
plist = new PropertyList();
try {
plist.readFromFile(sdkSettingsPlist);
sdkSettings = plist.toObject();
} finally {
plist.clear();
}
plist = new PropertyList();
try {
plist.readFromFile(toolchainInfoPlist);
toolchainInfo = plist.toObject();
} finally {
plist.clear();
}
}
aggregatePlist["BuildMachineOSBuild"] = osBuildVersion;
// setup env
env = {
"SDK_NAME": sdkSettings["CanonicalName"],
"XCODE_VERSION_ACTUAL": toolchainInfo["DTXcode"],
"SDK_PRODUCT_BUILD_VERSION": toolchainInfo["DTPlatformBuild"],
"GCC_VERSION": platformInfo["DTCompiler"],
"XCODE_PRODUCT_BUILD_VERSION": platformInfo["DTPlatformBuild"],
"PLATFORM_PRODUCT_BUILD_VERSION": platformInfo["ProductBuildVersion"],
}
env["MAC_OS_X_PRODUCT_BUILD_VERSION"] = osBuildVersion;
for (key in extraEnv)
env[key] = extraEnv[key];
for (key in buildEnv)
env[key] = buildEnv[key];
for (key in qmakeEnv)
env[key] = qmakeEnv[key];
var expander = new DarwinTools.PropertyListVariableExpander();
expander.undefinedVariableFunction = function (key, varName) {
var msg = "Info.plist variable expansion encountered undefined variable '"
+ varName + "' when expanding value for key '" + key
+ "', defined in one of the following files:\n\t";
var allFilePaths = [];
for (i = 0; i < (inputs.infoplist || []).length; ++i)
allFilePaths.push(inputs.infoplist[i].filePath);
if (platformInfoPlist)
allFilePaths.push(platformInfoPlist);
msg += allFilePaths.join("\n\t") + "\n";
msg += "or in the bundle.infoPlist property of product '"
+ product.name + "'";
console.warn(msg);
};
aggregatePlist = expander.expand(aggregatePlist, env);
// Add keys from partial Info.plists from asset catalogs, XIBs, and storyboards.
for (var j = 0; j < (inputs.partial_infoplist || []).length; ++j) {
var partialInfoPlist =
BundleTools.infoPlistContents(
inputs.partial_infoplist[j].filePath)
|| {};
for (key in partialInfoPlist) {
if (partialInfoPlist.hasOwnProperty(key)
&& aggregatePlist[key] === undefined)
aggregatePlist[key] = partialInfoPlist[key];
}
}
}
// Anything with an undefined or otherwise empty value should be removed
// Only JSON-formatted plists can have null values, other formats error out
// This also follows Xcode behavior
DarwinTools.cleanPropertyList(aggregatePlist);
if (infoPlistFormat === "same-as-input")
infoPlistFormat = "xml1";
var validFormats = [ "xml1", "binary1", "json" ];
if (!validFormats.includes(infoPlistFormat))
throw("Invalid Info.plist format " + infoPlistFormat + ". " +
"Must be in [xml1, binary1, json].");
// Write the plist contents in the format appropriate for the current platform
plist = new PropertyList();
try {
plist.readFromObject(aggregatePlist);
plist.writeToFile(outputs.aggregate_infoplist[0].filePath, infoPlistFormat);
} finally {
plist.clear();
}
}
return cmd;
}
qbs-src-2.6.1/share/qbs/modules/bundle/MacOSX-Product-Types.xcspec 0000644 0001751 0000166 00000075500 14776170045 024310 0 ustar runner docker //
// MacOSX Product Types.xcspec
//
// Copyright © 1999-2020 Apple Inc. All rights reserved.
//
// Product type specifications in the macOS platform.
//
(
//
// Single-file product types
//
// Tool (normal Unix command-line executable)
{ Type = ProductType;
Identifier = com.apple.product-type.tool;
Class = PBXToolProductType;
Name = "Command-line Tool";
Description = "Standalone command-line tool";
IconNamePrefix = "TargetExecutable";
DefaultTargetName = "Command-line Tool";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
MACH_O_TYPE = "mh_execute";
EXECUTABLE_PREFIX = "";
EXECUTABLE_SUFFIX = "";
REZ_EXECUTABLE = YES;
INSTALL_PATH = "/usr/local/bin";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = YES;
GCC_DYNAMIC_NO_PIC = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
STRIP_STYLE = "all";
CODE_SIGNING_ALLOWED = YES;
};
PackageTypes = (
com.apple.package-type.mach-o-executable // default
);
WantsSigningEditing = YES;
WantsBundleIdentifierEditing = YES;
},
// Java tool
{ Type = ProductType;
Identifier = com.apple.product-type.tool.java;
Name = "Java Command-line Tool";
Description = "Java Command-line tool";
IconNamePrefix = "TargetExecutable";
DefaultTargetName = "Java Command-line Tool";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
REZ_EXECUTABLE = YES;
INSTALL_PATH = "/usr/local/bin";
};
IsJava = YES;
PackageTypes = (
com.apple.package-type.jarfile, // default
com.apple.package-type.zipfile,
com.apple.package-type.javaclassfolder
);
},
// Object file
{ Type = ProductType;
Identifier = com.apple.product-type.objfile;
Class = XCStandaloneExecutableProductType;
Name = "Object File";
Description = "Object File";
IconNamePrefix = "TargetPlugin";
DefaultTargetName = "Object File";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
MACH_O_TYPE = "mh_object";
LINK_WITH_STANDARD_LIBRARIES = NO;
REZ_EXECUTABLE = YES;
EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)";
EXECUTABLE_EXTENSION = "o";
PUBLIC_HEADERS_FOLDER_PATH = "/usr/local/include";
PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include";
INSTALL_PATH = "$(HOME)/Objects";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = YES;
SKIP_INSTALL = YES;
STRIP_STYLE = "debugging";
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
KEEP_PRIVATE_EXTERNS = YES;
DEAD_CODE_STRIPPING = NO;
};
PackageTypes = (
com.apple.package-type.mach-o-objfile // default
);
},
// Dynamic library
{ Type = ProductType;
Identifier = com.apple.product-type.library.dynamic;
Class = PBXDynamicLibraryProductType;
Name = "Dynamic Library";
Description = "Dynamic library";
IconNamePrefix = "TargetLibrary";
DefaultTargetName = "Dynamic Library";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
MACH_O_TYPE = "mh_dylib";
REZ_EXECUTABLE = YES;
EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)";
EXECUTABLE_EXTENSION = "dylib";
PUBLIC_HEADERS_FOLDER_PATH = "/usr/local/include";
PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include";
INSTALL_PATH = "/usr/local/lib";
DYLIB_INSTALL_NAME_BASE = "$(INSTALL_PATH)";
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
DYLIB_COMPATIBILITY_VERSION = "1";
DYLIB_CURRENT_VERSION = "1";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = YES;
STRIP_STYLE = "debugging";
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
CODE_SIGNING_ALLOWED = YES;
CODE_SIGNING_REQUIRED = NO;
};
PackageTypes = (
com.apple.package-type.mach-o-dylib // default
);
},
// Static library
{ Type = ProductType;
Identifier = com.apple.product-type.library.static;
Class = PBXStaticLibraryProductType;
Name = "Static Library";
Description = "Static library";
IconNamePrefix = "TargetLibrary";
DefaultTargetName = "Static Library";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(EXECUTABLE_NAME)";
MACH_O_TYPE = "staticlib";
REZ_EXECUTABLE = YES;
EXECUTABLE_PREFIX = "lib";
EXECUTABLE_SUFFIX = ".$(EXECUTABLE_EXTENSION)";
EXECUTABLE_EXTENSION = "a";
PUBLIC_HEADERS_FOLDER_PATH = "/usr/local/include";
PRIVATE_HEADERS_FOLDER_PATH = "/usr/local/include";
INSTALL_PATH = "/usr/local/lib";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = YES;
STRIP_STYLE = "debugging";
CLANG_ENABLE_MODULE_DEBUGGING = NO;
CODE_SIGNING_ALLOWED = NO;
};
AlwaysPerformSeparateStrip = YES;
PackageTypes = (
com.apple.package-type.static-library // default
);
},
// Java library (jar or zip file)
{ Type = ProductType;
Identifier = com.apple.product-type.library.java.archive;
Name = "Java Library";
Description = "Java library packaged as a Jar file, Zip file, or class folder";
IconNamePrefix = "TargetPlugin";
DefaultTargetName = "Java Library";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(PRODUCT_NAME)";
INSTALL_PATH = "/usr/local/lib";
};
IsJava = YES;
PackageTypes = (
com.apple.package-type.jarfile, // default
com.apple.package-type.zipfile,
com.apple.package-type.javaclassfolder
);
},
//
// Wrapper product types
//
// Bundle
{ Type = ProductType;
Identifier = com.apple.product-type.bundle;
Class = PBXBundleProductType;
Name = "Bundle";
Description = "Generic bundle";
IconNamePrefix = "TargetPlugin";
DefaultTargetName = "Bundle";
DefaultBuildProperties = {
FULL_PRODUCT_NAME = "$(WRAPPER_NAME)";
MACH_O_TYPE = "mh_bundle";
WRAPPER_PREFIX = "";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "bundle";
WRAPPER_NAME = "$(WRAPPER_PREFIX)$(PRODUCT_NAME)$(WRAPPER_SUFFIX)";
FRAMEWORK_FLAG_PREFIX = "-framework";
LIBRARY_FLAG_PREFIX = "-l";
LIBRARY_FLAG_NOSPACE = YES;
STRIP_STYLE = "non-global";
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
CODE_SIGNING_ALLOWED = YES;
};
PackageTypes = (
com.apple.package-type.wrapper, // default
com.apple.package-type.wrapper.shallow // Not clear if this is needed in the presence of the Shallow Bundle product type below.
);
IsWrapper = YES;
HasInfoPlist = YES;
HasInfoPlistStrings = YES;
WantsBundleIdentifierEditing = YES;
WantsSigningEditing = YES;
},
// Shallow Bundle Product
{ Type = ProductType;
Identifier = com.apple.product-type.bundle.shallow;
BasedOn = com.apple.product-type.bundle;
Class = PBXBundleProductType;
Name = "Bundle (Shallow)";
Description = "Bundle (Shallow)";
PackageTypes = (
com.apple.package-type.wrapper.shallow
);
},
// Application
{ Type = ProductType;
Identifier = com.apple.product-type.application;
BasedOn = com.apple.product-type.bundle;
Class = PBXApplicationProductType;
Name = "Application";
Description = "Application";
IconNamePrefix = "TargetApp";
DefaultTargetName = "Application";
DefaultBuildProperties = {
MACH_O_TYPE = "mh_execute";
GCC_DYNAMIC_NO_PIC = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
GCC_INLINES_ARE_PRIVATE_EXTERN = YES;
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "app";
INSTALL_PATH = "$(LOCAL_APPS_DIR)";
STRIP_STYLE = "all";
CODE_SIGNING_ALLOWED = YES;
LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST))";
LD_RUNPATH_SEARCH_PATHS_YES = ( "@loader_path/../Frameworks", );
};
PackageTypes = (
com.apple.package-type.wrapper.application // default
);
/** Product type validation hooks */
Validation = {
// Checks - a dictionary of checks that are perform just prior to building the product
// Each dictionary key is the "XCPropertyMacroExpression" to evaluate
// The dictionary value contains the error message to display if the condition evaluates to false.
Checks = {
// This is intentially empty as currently all of the checks are done in-code for this particular application type. However, we enable the plubmbing for the validation tool spec infrastructure to be called to avoid any further hacks in pbxbuild or xcbuild. This is to enable rdar://problem/45590882.
};
// Determines if the legacy build system has support for this validation hook. This is a workaround for enabling additional validation in xcbuild (specifically for rdar://problem/45590882), which does not have the same plugin restriction that is imposed on pbxbuild's implementation of the validation hooks.
EnabledForLegacyBuildSystem = NO;
// ValidationToolSpec - the identifier of the tool (script) to run after a target is constructed.
ValidationToolSpec = "com.apple.build-tools.platform.validate";
};
CanEmbedCompilerSanitizerLibraries = YES;
RunpathSearchPathForEmbeddedFrameworks = "@executable_path/../Frameworks";
ValidateEmbeddedBinaries = YES;
ProvisioningProfileSupported = YES;
ProvisioningProfileRequired = NO;
WantsBundleIdentifierEditing = YES;
WantsSigningEditing = YES;
},
// Shallow Application Product
{ Type = ProductType;
Identifier = com.apple.product-type.application.shallow;
BasedOn = com.apple.product-type.application;
Class = PBXApplicationProductType; // see radar 5604879, this shouldn't be necesary
Name = "Application (Shallow Bundle)";
Description = "Application (Shallow Bundle)";
PackageTypes = (
com.apple.package-type.wrapper.application.shallow
);
},
// Java Application
{ Type = ProductType;
Identifier = com.apple.product-type.application.java;
BasedOn = com.apple.product-type.application;
Name = "Java Application";
Description = "Java Application";
DefaultTargetName = "Java Application";
DefaultBuildProperties = {
INFOPLIST_PATH = "";
PKGINFO_PATH = "";
};
IsJava = YES;
},
// Framework
{ Type = ProductType;
Identifier = com.apple.product-type.framework;
BasedOn = com.apple.product-type.bundle;
Class = PBXFrameworkProductType;
Name = "Framework";
Description = "Framework";
IconNamePrefix = "TargetFramework";
DefaultTargetName = "Framework";
DefaultBuildProperties = {
MACH_O_TYPE = "mh_dylib";
FRAMEWORK_VERSION = "A";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "framework";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
DYLIB_INSTALL_NAME_BASE = "$(INSTALL_PATH)";
LD_DYLIB_INSTALL_NAME = "$(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH)";
STRIP_STYLE = "debugging";
CODE_SIGNING_ALLOWED = YES;
CODE_SIGNING_REQUIRED = NO;
ENTITLEMENTS_REQUIRED = NO;
CODE_SIGNING_REQUIRES_TEAM = YES;
};
PackageTypes = (
com.apple.package-type.wrapper.framework // default
);
},
// Shallow Framework Product
{ Type = ProductType;
Identifier = com.apple.product-type.framework.shallow;
BasedOn = com.apple.product-type.framework;
Class = PBXFrameworkProductType;
Name = "Framework (Shallow Bundle)";
Description = "Framework (Shallow Bundle)";
PackageTypes = (
com.apple.package-type.wrapper.framework.shallow
);
},
// Static framework
{ Type = ProductType;
Identifier = com.apple.product-type.framework.static;
BasedOn = com.apple.product-type.framework;
Class = XCStaticFrameworkProductType;
Name = "Static Framework";
Description = "Static Framework";
IconNamePrefix = "TargetFramework";
DefaultTargetName = "Static Framework";
DefaultBuildProperties = {
MACH_O_TYPE = "staticlib";
FRAMEWORK_VERSION = "A";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "framework";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
DYLIB_INSTALL_NAME_BASE = "";
LD_DYLIB_INSTALL_NAME = "";
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
CODE_SIGNING_ALLOWED = NO;
};
AlwaysPerformSeparateStrip = YES;
PackageTypes = (
com.apple.package-type.wrapper.framework.static // default
);
},
// System extension
{ Type = ProductType;
Identifier = com.apple.product-type.system-extension;
BasedOn = com.apple.product-type.bundle;
Name = "DriverKit Driver";
Description = "DriverKit driver";
DefaultTargetName = "DriverKit Driver";
DefaultBuildProperties = {
MACH_O_TYPE = "mh_execute";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "systemextension";
PRODUCT_NAME = "$(PRODUCT_BUNDLE_IDENTIFIER)";
};
PackageTypes = (
com.apple.package-type.wrapper.system-extension,
);
ProvisioningProfileSupported = YES;
ProvisioningProfileRequired = NO;
},
// DriverKit driver
{ Type = ProductType;
Identifier = com.apple.product-type.driver-extension;
BasedOn = com.apple.product-type.system-extension;
Name = "DriverKit Driver";
Description = "DriverKit driver";
DefaultTargetName = "DriverKit Driver";
DefaultBuildProperties = {
SDKROOT = "driverkit";
MACH_O_TYPE = "mh_execute";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "dext";
INSTALL_PATH = "$(DEFAULT_DEXT_INSTALL_PATH)";
STRIP_STYLE = "debugging";
DEXT_FRAMEWORK_NAME = "DriverKit";
DEXT_FRAMEWORK = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(DEXT_FRAMEWORK_NAME).framework";
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
PRODUCT_NAME = "$(PRODUCT_BUNDLE_IDENTIFIER)";
PRODUCT_TYPE_HEADER_SEARCH_PATHS = "$(inherited) $(IIG_HEADERS_DIR)";
};
DefaultEntitlements = {
"com.apple.developer.driverkit" = YES;
};
PackageTypes = (
com.apple.package-type.wrapper.driver-extension,
);
},
// Kernel Extension
{ Type = ProductType;
Identifier = com.apple.product-type.kernel-extension;
BasedOn = com.apple.product-type.bundle;
Class = XCKernelExtensionProductType;
Name = "Kernel Extension";
Description = "Kernel extension";
DefaultTargetName = "Kernel Extension";
DefaultBuildProperties = {
MACH_O_TYPE = "mh_execute";
WRAPPER_SUFFIX = ".$(WRAPPER_EXTENSION)";
WRAPPER_EXTENSION = "kext";
INSTALL_PATH = "$(DEFAULT_KEXT_INSTALL_PATH)";
STRIP_STYLE = "debugging";
KEXT_FRAMEWORK_NAME = "Kernel";
KEXT_FRAMEWORK = "$(SYSTEM_LIBRARY_DIR)/Frameworks/$(KEXT_FRAMEWORK_NAME).framework";
KEXT_FAMILY_NAME = "family";
PUBLIC_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/Headers/$(KEXT_FAMILY_NAME)";
PRIVATE_HEADERS_FOLDER_PATH = "$(KEXT_FRAMEWORK)/Contents/PrivateHeaders/$(KEXT_FAMILY_NAME)";
MODULE_NAME = "com.company.driver.modulename";
MODULE_VERSION = "1.0";
MODULE_START = "0";
MODULE_STOP = "0";
ENABLE_APPLE_KEXT_CODE_GENERATION = YES; // -fapple-kext
GCC_ENABLE_KERNEL_DEVELOPMENT = YES; // -mkernel
GCC_USE_STANDARD_INCLUDE_SEARCHING = NO; // -nostdinc
GCC_ENABLE_PASCAL_STRINGS = NO; // Disables -fpascal-strings
GCC_FORCE_CPU_SUBTYPE_ALL = YES; // -force_cpusubtype_ALL
GCC_CHECK_RETURN_VALUE_OF_OPERATOR_NEW = YES; // -fcheck-new
GCC_INLINES_ARE_PRIVATE_EXTERN = NO; // -fvisibility-inlines-hidden
GCC_ENABLE_BUILTIN_FUNCTIONS = NO; // -fno-builtin
GCC_NO_COMMON_BLOCKS = YES; // -fno-common
GCC_ENABLE_CPP_EXCEPTIONS = NO; // -fno-exceptions
GCC_ENABLE_CPP_RTTI = NO; // -fno-rtti
// Supposedly these two flags are the default in GCC, but they're provided here for compatibility with older Xcode versions.
GCC_ENABLE_FUNCTION_INLINING = YES; // -finline
GCC_DISABLE_STATIC_FUNCTION_INLINING = YES; // -fno-keep-inline-functions
// Per-product-type settings.
// The KERNEL_*** settings are defined differently for some SDKs, so we continue to use them for compatibility reasons.
KERNEL_FRAMEWORK = "$(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Kernel.framework";
KERNEL_FRAMEWORK_HEADERS = "$(KERNEL_FRAMEWORK)/Headers";
KERNEL_EXTENSION_HEADER_SEARCH_PATHS = "$(KERNEL_FRAMEWORK)/PrivateHeaders $(KERNEL_FRAMEWORK_HEADERS)";
// These settings are reserved for use by product types.
GCC_PRODUCT_TYPE_PREPROCESSOR_DEFINITIONS = "$(inherited) KERNEL KERNEL_PRIVATE DRIVER_PRIVATE APPLE NeXT";
PRODUCT_TYPE_CFLAGS = "$(inherited) $(KEXT_CFLAGS)";
PRODUCT_TYPE_CPLUSPLUSFLAGS = "$(inherited) $(KEXT_CPLUSPLUSFLAGS)";
PRODUCT_SPECIFIC_LDFLAGS = "$(inherited) $(KEXT_LDFLAGS)";
PRODUCT_TYPE_HEADER_SEARCH_PATHS = "$(inherited) $(KERNEL_EXTENSION_HEADER_SEARCH_PATHS)";
CODE_SIGNING_ALLOWED = YES;
ARCHS_STANDARD = "arm64e x86_64";
ARCHS_STANDARD_64_BIT = "$(ARCHS_STANDARD)";
ARCHS_STANDARD_INCLUDING_64_BIT = "$(ARCHS_STANDARD)";
};
PackageTypes = (
com.apple.package-type.wrapper.kernel-extension, // Default
com.apple.package-type.wrapper.kernel-extension.shallow,
);
},
// Shallow Kernel Extension
{
Type = ProductType;
Identifier = com.apple.product-type.kernel-extension.shallow;
BasedOn = com.apple.product-type.kernel-extension;
Class = XCKernelExtensionProductType;
Name = "Kernel Extension (Shallow)";
Description = "Kernel extension (shallow)";
DefaultBuildProperties = {
// None yet
};
PackageTypes = (
com.apple.package-type.wrapper.kernel-extension.shallow,
);
},
// IOKit Kernel Extension
{ Type = ProductType;
Identifier = com.apple.product-type.kernel-extension.iokit;
BasedOn = com.apple.product-type.kernel-extension;
Class = XCKernelExtensionProductType;
Name = "IOKit Kernel Extension";
Description = "IOKit Kernel extension";
DefaultTargetName = "IOKit Kernel Extension";
DefaultBuildProperties = {
CODE_SIGNING_ALLOWED = YES;
};
PackageTypes = (
com.apple.package-type.wrapper.kernel-extension, // Default
com.apple.package-type.wrapper.kernel-extension.shallow,
);
},
// Shallow IOKit Kernel Extension
{ Type = ProductType;
Identifier = com.apple.product-type.kernel-extension.iokit.shallow;
BasedOn = com.apple.product-type.kernel-extension;
Class = XCKernelExtensionProductType;
Name = "IOKit Kernel Extension (Shallow)";
Description = "IOKit Kernel extension (Shallow)";
DefaultTargetName = "IOKit Kernel Extension (Shallow)";
DefaultBuildProperties = {
// None yet
};
PackageTypes = (
com.apple.package-type.wrapper.kernel-extension.shallow,
);
},
// Unit Test Bundle
{ Type = ProductType;
Identifier = com.apple.product-type.bundle.unit-test;
BasedOn = com.apple.product-type.bundle;
Class = PBXXCTestBundleProductType;
Name = "Unit Test Bundle";
Description = "Unit Test Bundle";
DefaultBuildProperties = {
WRAPPER_EXTENSION = "xctest";
ENABLE_TESTING_SEARCH_PATHS = YES;
PRODUCT_SPECIFIC_LDFLAGS = "-framework XCTest";
XCTRUNNER_PATH = "$(XCTRUNNER_PATH$(TEST_BUILD_STYLE))";
LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST))";
LD_RUNPATH_SEARCH_PATHS_YES = (
"@loader_path/../Frameworks",
"@executable_path/../Frameworks",
);
};
PackageTypes = (
com.apple.package-type.bundle.unit-test
);
CanEmbedCompilerSanitizerLibraries = YES;
IsUnitTest = YES;
WantsBundleIdentifierEditing = NO;
},
// UI Testing Bundle
{ Type = ProductType;
Identifier = com.apple.product-type.bundle.ui-testing;
BasedOn = com.apple.product-type.bundle.unit-test;
Class = PBXXCTestBundleProductType;
Name = "UI Testing Bundle";
Description = "UI Testing Bundle";
DefaultBuildProperties = {
USES_XCTRUNNER = "YES";
};
PackageTypes = (
com.apple.package-type.bundle.unit-test
);
ProvisioningProfileSupported = YES;
IsUITest = YES;
InfoPlistAdditions = {
XCTContainsUITests = YES;
};
WantsBundleIdentifierEditing = NO;
},
// Legacy OCUnit Test Bundle
{ Type = ProductType;
Identifier = com.apple.product-type.bundle.ocunit-test;
BasedOn = com.apple.product-type.bundle;
Class = PBXBundleProductType;
Name = "OCUnit Test Bundle";
Description = "OCUnit Test Bundle";
DefaultBuildProperties = {
WRAPPER_EXTENSION = "octest";
};
PackageTypes = (
com.apple.package-type.bundle.ocunit-test
);
IsUnitTest = YES;
},
// In-App Purchase Content
{ Type = ProductType;
Identifier = com.apple.product-type.in-app-purchase-content;
Class = PBXBundleProductType;
Name = "In-App Purchase Content";
Description = "In-App Purchase Content";
DefaultBuildProperties = {
CODE_SIGNING_ALLOWED = NO;
FULL_PRODUCT_NAME = "$(WRAPPER_NAME)";
};
PackageTypes = (
com.apple.package-type.in-app-purchase-content, // default
);
IsWrapper = YES;
HasInfoPlist = YES;
HasInfoPlistStrings = NO;
},
// XPC Service
{
Type = ProductType;
Identifier = "com.apple.product-type.xpc-service";
BasedOn = "com.apple.product-type.bundle";
Class = PBXBundleProductType;
Name = "XPC Service";
Description = "XPC Service";
IconNamePrefix = XPCService;
DefaultTargetName = "XPC Service";
CanEmbedCompilerSanitizerLibraries = YES;
"DefaultBuildProperties" = {
"MACH_O_TYPE" = "mh_execute";
WRAPPER_EXTENSION = "xpc";
LD_RUNPATH_SEARCH_PATHS = "$(LD_RUNPATH_SEARCH_PATHS_$(IS_MACCATALYST)_$(_BOOL_$(SKIP_INSTALL)))";
LD_RUNPATH_SEARCH_PATHS_YES_YES = (
"@loader_path/../Frameworks",
"@loader_path/../../../../Frameworks",
);
LD_RUNPATH_SEARCH_PATHS_YES_NO = ( "@loader_path/../Frameworks", );
};
PackageTypes = (
"com.apple.package-type.xpc-service",
);
ProvisioningProfileSupported = YES;
ProvisioningProfileRequired = NO;
WantsBundleIdentifierEditing = YES;
WantsSigningEditing = YES;
},
// PlugIn-Kit PlugIn
{
Type = ProductType;
Identifier = "com.apple.product-type.pluginkit-plugin";
BasedOn = "com.apple.product-type.xpc-service";
Class = PBXBundleProductType;
Name = "PlugInKit PlugIn";
Description = "PlugInKit PlugIn";
IconNamePrefix = XPCService;
DefaultTargetName = "PlugInKit PlugIn";
"DefaultBuildProperties" = {
"PRODUCT_SPECIFIC_LDFLAGS" = "$(SDKROOT)/System/Library/PrivateFrameworks/PlugInKit.framework/PlugInKit";
WRAPPER_EXTENSION = "pluginkit";
};
PackageTypes = (
"com.apple.package-type.pluginkit-plugin",
);
},
// App Extension
{
Type = ProductType;
Identifier = "com.apple.product-type.app-extension";
BasedOn = "com.apple.product-type.pluginkit-plugin";
Class = PBXBundleProductType;
Name = "App Extension";
Description = "App Extension";
IconNamePrefix = AppExtension;
DefaultTargetName = "App Extension";
"DefaultBuildProperties" = {
"CODE_SIGNING_ALLOWED" = YES;
"APPLICATION_EXTENSION_API_ONLY" = YES;
"PRODUCT_SPECIFIC_LDFLAGS" = "-e _NSExtensionMain";
WRAPPER_EXTENSION = "appex";
};
PackageTypes = (
"com.apple.package-type.app-extension",
);
ProvisioningProfileSupported = YES;
ProvisioningProfileRequired = NO;
WantsBundleIdentifierEditing = YES;
WantsSigningEditing = YES;
},
// Xcode Extension
{
Type = ProductType;
Identifier = "com.apple.product-type.xcode-extension";
BasedOn = "com.apple.product-type.app-extension";
Name = "Xcode Extension";
Description = "Xcode Extension";
IconNamePrefix = XcodeExtension;
DefaultTargetName = "Xcode Extension";
"DefaultBuildProperties" = {
"CODE_SIGNING_ALLOWED" = YES;
"APPLICATION_EXTENSION_API_ONLY" = YES;
"PRODUCT_SPECIFIC_LDFLAGS" = "-e _XCExtensionMain -lXcodeExtension";
"PRODUCT_TYPE_FRAMEWORK_SEARCH_PATHS" = (
"$(inherited)",
"$(DEVELOPER_FRAMEWORKS_DIR)",
);
"PRODUCT_TYPE_LIBRARY_SEARCH_PATHS" = (
"$(inherited)",
"$(DEVELOPER_USR_DIR)/lib",
);
LD_RUNPATH_SEARCH_PATHS = (
"@loader_path/../Frameworks",
);
WRAPPER_EXTENSION = "appex";
};
PackageTypes = (
"com.apple.package-type.app-extension",
);
ProvisioningProfileSupported = YES;
ProvisioningProfileRequired = NO;
WantsBundleIdentifierEditing = YES;
WantsSigningEditing = YES;
},
// Spotlight Importer
{
Type = ProductType;
Identifier = "com.apple.product-type.spotlight-importer";
BasedOn = "com.apple.product-type.bundle";
Class = PBXBundleProductType;
Name = "Spotlight Importer";
Description = "Spotlight Importer";
DefaultTargetName = "Spotlight";
"DefaultBuildProperties" = {
"CODE_SIGNING_ALLOWED" = YES;
};
PackageTypes = (
"com.apple.package-type.spotlight-importer",
);
},
// Copied from iOS specs to aid in build system diagnostic support.
// Later, we should put these in some central place.
{
Type = ProductType;
Identifier = "com.apple.product-type.app-extension.messages";
BasedOn = "com.apple.product-type.app-extension";
},
{
Type = ProductType;
Identifier = "com.apple.product-type.app-extension.messages-sticker-pack";
BasedOn = "com.apple.product-type.app-extension";
IsCapabilitiesUnsupported = YES;
WantsSimpleTargetEditing = YES;
DefaultBuildProperties = {
MESSAGES_APPLICATION_EXTENSION_PRODUCT_BINARY_SOURCE_PATH = "$(PLATFORM_DIR)/Library/Application Support/MessagesApplicationExtensionStub/MessagesApplicationExtensionStub";
ASSETCATALOG_COMPILER_INCLUDE_STICKER_CONTENT = YES;
ASSETCATALOG_COMPILER_TARGET_STICKERS_ICON_ROLE = "extension";
ASSETCATALOG_COMPILER_STICKER_PACK_IDENTIFIER_PREFIX = "$(PRODUCT_BUNDLE_IDENTIFIER).sticker-pack.";
};
AllowedBuildPhases = (
"com.apple.buildphase.resources",
"com.apple.buildphase.shell-script",
);
InfoPlistAdditions = {
LSApplicationIsStickerProvider = YES;
};
},
{
Type = ProductType;
Identifier = "com.apple.product-type.application.on-demand-install-capable";
BasedOn = "com.apple.product-type.application";
Name = "App Clip";
Description = "App Clip";
DefaultBuildProperties = {
ENABLE_ON_DEMAND_RESOURCES = NO;
ASSETCATALOG_COMPILER_STANDALONE_ICON_BEHAVIOR = none; // Don't include standalone icons to keep size down
PRODUCT_SPECIFIC_LDFLAGS = "$(inherited) -framework AppClip";
SKIP_INSTALL = YES;
};
DefaultEntitlements = {
"com.apple.developer.on-demand-install-capable" = YES;
};
SupportsOnDemandResources = NO;
IsEmbeddable = YES;
BuildPhaseInjectionsWhenEmbedding = (
{
BuildPhase = "CopyFiles";
Name = "Embed App Clips";
RunOnlyForDeploymentPostprocessing = NO;
DstSubFolderSpec = 16;
DstPath = "$(CONTENTS_FOLDER_PATH)/AppClips";
}
);
},
)
qbs-src-2.6.1/share/qbs/modules/nsis/ 0000755 0001751 0000166 00000000000 14776170045 016763 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/nsis/NSISModule.qbs 0000644 0001751 0000166 00000022570 14776170045 021422 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Utilities
Module {
condition: qbs.targetOS.includes("windows")
property path toolchainInstallPath: Utilities.getNativeSetting(registryKey)
version: (versionMajor !== undefined && versionMinor !== undefined) ? (versionMajor + "." + versionMinor) : undefined
property var versionParts: [ versionMajor, versionMinor, versionPatch, versionBuild ]
property int versionMajor: Utilities.getNativeSetting(registryKey, "VersionMajor")
property int versionMinor: Utilities.getNativeSetting(registryKey, "VersionMinor")
property int versionPatch: Utilities.getNativeSetting(registryKey, "VersionBuild")
property int versionBuild: Utilities.getNativeSetting(registryKey, "VersionRevision")
property string compilerName: "makensis"
property string compilerPath: compilerName
property string warningLevel: "normal"
PropertyOptions {
name: "warningLevel"
allowedValues: ["none", "normal", "errors", "warnings", "info", "all"]
}
property bool disableConfig: false
PropertyOptions {
name: "disableConfig"
description: "disable inclusion of nsisconf.nsh"
}
property bool enableQbsDefines: true
PropertyOptions {
name: "enableQbsDefines"
description: "built-in variables that are defined when using the NSIS compiler"
}
property stringList defines
PropertyOptions {
name: "defines"
description: "variables that are defined when using the NSIS compiler"
}
property stringList compilerFlags
PropertyOptions {
name: "compilerFlags"
description: "additional flags for the NSIS compiler"
}
property string compressor: "default"
PropertyOptions {
name: "compressor"
description: "the compression algorithm used to compress files/data in the installer"
allowedValues: ["default", "zlib", "zlib-solid", "bzip2", "bzip2-solid", "lzma", "lzma-solid"]
}
property string executableSuffix: ".exe"
// Private properties
property string registryKey: {
if (!Host.os().includes("windows"))
return undefined;
var keys = [ "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS" ];
for (var i in keys) {
if (Utilities.getNativeSetting(keys[i]))
return keys[i];
}
}
validate: {
var validator = new ModUtils.PropertyValidator("nsis");
// Only *require* the toolchain install path on Windows
// On other (Unix-like) operating systems it'll probably be in the PATH
if (qbs.targetOS.includes("windows"))
validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath);
validator.setRequiredProperty("versionMajor", versionMajor);
validator.setRequiredProperty("versionMinor", versionMinor);
validator.setRequiredProperty("versionPatch", versionPatch);
validator.setRequiredProperty("versionBuild", versionBuild);
validator.addVersionValidator("version", version, 2, 4);
validator.addRangeValidator("versionMajor", versionMajor, 1);
validator.addRangeValidator("versionMinor", versionMinor, 0);
validator.addRangeValidator("versionPatch", versionPatch, 0);
validator.addRangeValidator("versionBuild", versionBuild, 0);
validator.validate();
}
setupBuildEnvironment: {
if (product.nsis.toolchainInstallPath) {
var v = new ModUtils.EnvironmentVariable("PATH", ";", true);
v.prepend(product.nsis.toolchainInstallPath);
v.prepend(FileInfo.joinPaths(product.nsis.toolchainInstallPath, "bin"));
v.set();
}
}
// NSIS Script File
FileTagger {
patterns: ["*.nsi"]
fileTags: ["nsi"]
}
// NSIS Header File
FileTagger {
patterns: ["*.nsh"]
fileTags: ["nsh"]
}
Rule {
id: nsisCompiler
multiplex: true
inputs: ["nsi"]
auxiliaryInputs: ["installable"]
auxiliaryInputsFromDependencies: ["installable"]
Artifact {
fileTags: ["nsissetup", "application"]
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName + ModUtils.moduleProperty(
product, "executableSuffix"))
}
prepare: {
var i;
var args = [];
// Prefix character for makensis options
var opt = product.moduleProperty("qbs", "hostOS").includes("windows") ? "/" : "-";
if (ModUtils.moduleProperty(product, "disableConfig")) {
args.push(opt + "NOCONFIG");
}
var warningLevel = ModUtils.moduleProperty(product, "warningLevel");
var warningLevels = ["none", "errors", "warnings", "info", "all"];
if (warningLevel !== "normal") {
var level = warningLevels.indexOf(warningLevel);
if (level < 0) {
throw("Unexpected warning level '" + warningLevel + "'.");
} else {
args.push(opt + "V" + level);
}
}
var enableQbsDefines = ModUtils.moduleProperty(product, "enableQbsDefines")
if (enableQbsDefines) {
var map = {
"project.": project,
"product.": product
};
for (var prefix in map) {
var obj = map[prefix];
for (var prop in obj) {
var val = obj[prop];
if (typeof val !== 'function' && typeof val !== 'object' && !prop.startsWith("_")) {
args.push(opt + "D" + prefix + prop + "=" + val);
}
}
}
// Users are likely to need this
var arch = product.moduleProperty("qbs", "architecture");
args.push(opt + "Dqbs.architecture=" + arch);
// Helper define for alternating between 32-bit and 64-bit logic
if (arch === "x86_64" || arch === "ia64") {
args.push(opt + "DWin64");
}
}
// User-supplied defines
var defines = ModUtils.moduleProperty(product, "defines");
for (i in defines) {
args.push(opt + "D" + defines[i]);
}
// User-supplied flags
var flags = ModUtils.moduleProperty(product, "compilerFlags");
for (i in flags) {
args.push(flags[i]);
}
// Override the compression algorithm if needed
var compressor = ModUtils.moduleProperty(product, "compressor");
if (compressor !== "default") {
var compressorFlag = opt + "XSetCompressor /FINAL ";
if (compressor.endsWith("-solid")) {
compressorFlag += "/SOLID ";
}
args.push(compressorFlag + compressor.split('-')[0]);
}
var inputFileNames = [];
for (i in inputs.nsi) {
inputFileNames.push(inputs.nsi[i].fileName);
args.push(FileInfo.toNativeSeparators(inputs.nsi[i].filePath,
product.moduleProperty("qbs", "hostOS")));
}
// Output file name - this goes last to override any OutFile command in the script
args.push(opt + "XOutFile " + output.filePath);
var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args);
cmd.description = "compiling " + inputFileNames.join(", ");
cmd.highlight = "compiler";
cmd.workingDirectory = FileInfo.path(output.filePath);
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/modules/freedesktop/ 0000755 0001751 0000166 00000000000 14776170045 020322 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/freedesktop/freedesktop.js 0000644 0001751 0000166 00000007310 14776170045 023174 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Alberto Mardegan
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var TextFile = require("qbs.TextFile");
function parseDesktopFile(filePath) {
var file = new TextFile(filePath);
var fileValues = {};
var currentSection = {};
var sectionRex = /^\[(.+)\]$/g;
while (!file.atEof()) {
var line = file.readLine().trim();
if (line.length == 0) continue;
if (line[0] == '#') continue;
var match = sectionRex.exec(line);
if (match) {
var currentSectionName = match[1];
fileValues[currentSectionName] = {};
currentSection = fileValues[currentSectionName];
continue;
}
var parts = line.split('=', 2);
currentSection[parts[0]] = parts[1]
}
file.close();
return fileValues
}
function dumpDesktopFile(filePath, keys) {
var file = new TextFile(filePath, TextFile.WriteOnly);
for (var sectionName in keys) {
file.writeLine('[' + sectionName + ']');
var section = keys[sectionName];
for (var key in section) {
var line = key + '=' + section[key];
file.writeLine(line);
}
// Write an empty line between sections (and before EOF)
file.writeLine('');
}
file.close();
}
function generateDesktopFileCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
cmd.description = "generating " + output.fileName + " from " + input.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
var aggregateDesktopKeys = parseDesktopFile(input.filePath);
var desktopKeys = ModUtils.moduleProperty(product, "desktopKeys") || {}
var mainSection = aggregateDesktopKeys['Desktop Entry'];
for (key in desktopKeys) {
if (desktopKeys.hasOwnProperty(key)) {
mainSection[key] = desktopKeys[key];
}
}
var defaultValues = product.freedesktop.defaultDesktopKeys
for (key in defaultValues) {
if (!(key in mainSection)) {
mainSection[key] = defaultValues[key];
}
}
dumpDesktopFile(output.filePath, aggregateDesktopKeys);
}
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/freedesktop/FreeDesktop.qbs 0000644 0001751 0000166 00000006474 14776170045 023257 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 Alberto Mardegan
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.ModUtils
import qbs.TextFile
import "freedesktop.js" as Fdo
Module {
property string name: product.name
property string appName: name
property string hicolorRoot: undefined
property var desktopKeys
readonly property var defaultDesktopKeys: {
return {
'Type': 'Application',
'Name': product.freedesktop.appName,
'Exec': product.targetName,
'Terminal': 'false',
'Version': '1.1',
}
}
property bool _fdoSupported: qbs.targetOS.includes("unix") && !qbs.targetOS.includes("darwin")
additionalProductTypes: "freedesktop.desktopfile"
FileTagger {
patterns: [ "*.desktop" ]
fileTags: [ "freedesktop.desktopfile_source" ]
}
Group {
condition: _fdoSupported
qbs.install: true
Group {
fileTagsFilter: [ "freedesktop.desktopfile" ]
qbs.installDir: "share/applications"
}
Group {
condition: product.freedesktop.hicolorRoot !== undefined
fileTagsFilter: [ "freedesktop.appIcon" ]
qbs.installDir: "share/icons/hicolor"
qbs.installSourceBase: product.freedesktop.hicolorRoot
}
Group {
fileTagsFilter: [ "freedesktop.appstream" ]
qbs.installDir: "share/metainfo"
}
Rule {
inputs: [ "freedesktop.desktopfile_source" ]
outputFileTags: [ "freedesktop.desktopfile" ]
Artifact {
fileTags: [ "freedesktop.desktopfile" ]
filePath: input.fileName
}
prepare: Fdo.generateDesktopFileCommands.apply(Fdo, arguments)
}
}
FileTagger {
patterns: [ "*.metainfo.xml", "*.appdata.xml" ]
fileTags: [ "freedesktop.appstream" ]
}
}
qbs-src-2.6.1/share/qbs/modules/java/ 0000755 0001751 0000166 00000000000 14776170045 016730 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/java/io/ 0000755 0001751 0000166 00000000000 14776170045 017337 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/java/io/qt/ 0000755 0001751 0000166 00000000000 14776170045 017763 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/ 0000755 0001751 0000166 00000000000 14776170045 020550 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/tools/ 0000755 0001751 0000166 00000000000 14776170045 021710 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/tools/utils/ 0000755 0001751 0000166 00000000000 14776170045 023050 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/tools/utils/NullFileObject.java 0000644 0001751 0000166 00000010402 14776170045 026551 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
package io.qt.qbs.tools.utils;
import javax.lang.model.element.Modifier;
import javax.lang.model.element.NestingKind;
import javax.tools.FileObject;
import javax.tools.JavaFileObject;
import java.io.*;
import java.net.URI;
/**
* Represents a FileObject that discards its output when written.
*/
public class NullFileObject implements FileObject, JavaFileObject {
FileObject obj;
public NullFileObject(FileObject obj) {
this.obj = obj;
}
@Override
public URI toUri() {
return obj.toUri();
}
@Override
public String getName() {
return obj.getName();
}
@Override
public InputStream openInputStream() throws IOException {
return obj.openInputStream();
}
@Override
public OutputStream openOutputStream() throws IOException {
return new OutputStream() {
@Override
public void write(int b) throws IOException {
}
};
}
@Override
public Reader openReader(boolean ignoreEncodingErrors) throws IOException {
return obj.openReader(ignoreEncodingErrors);
}
@Override
public CharSequence getCharContent(boolean ignoreEncodingErrors)
throws IOException {
return obj.getCharContent(ignoreEncodingErrors);
}
@Override
public Writer openWriter() throws IOException {
return new Writer() {
@Override
public void write(char[] cbuf, int off, int len) throws IOException {
}
@Override
public void flush() throws IOException {
}
@Override
public void close() throws IOException {
}
};
}
@Override
public long getLastModified() {
return obj.getLastModified();
}
@Override
public boolean delete() {
return true;
}
@Override
public Kind getKind() {
if (obj instanceof JavaFileObject) {
return ((JavaFileObject) obj).getKind();
}
throw new UnsupportedOperationException();
}
@Override
public boolean isNameCompatible(String simpleName, Kind kind) {
if (obj instanceof JavaFileObject) {
return ((JavaFileObject) obj).isNameCompatible(simpleName, kind);
}
throw new UnsupportedOperationException();
}
@Override
public NestingKind getNestingKind() {
if (obj instanceof JavaFileObject) {
return ((JavaFileObject) obj).getNestingKind();
}
throw new UnsupportedOperationException();
}
@Override
public Modifier getAccessLevel() {
if (obj instanceof JavaFileObject) {
return ((JavaFileObject) obj).getAccessLevel();
}
throw new UnsupportedOperationException();
}
}
qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/tools/utils/JavaCompilerScanner.java 0000644 0001751 0000166 00000011023 14776170045 027576 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
package io.qt.qbs.tools.utils;
import io.qt.qbs.*;
import javax.tools.*;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
public class JavaCompilerScanner {
private List artifacts = new ArrayList();
private ArtifactListWriter writer = new ArtifactListJsonWriter();
public List getArtifacts() {
return this.artifacts;
}
public int run(List compilerArguments) {
artifacts.clear();
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager standardFileManager = compiler
.getStandardFileManager(null, null, null);
final JavaFileManager fileManager = new ForwardingJavaFileManager(
standardFileManager) {
@Override
public JavaFileObject getJavaFileForOutput(
JavaFileManager.Location location, String className,
JavaFileObject.Kind kind, FileObject sibling)
throws IOException {
JavaFileObject o = super.getJavaFileForOutput(location,
className, kind, sibling);
Artifact artifact = new Artifact(new File(o.toUri()
.getSchemeSpecificPart()).toString());
if (kind.equals(JavaFileObject.Kind.CLASS)) {
artifact.addFileTag("java.class");
} else if (kind.equals(JavaFileObject.Kind.SOURCE)) {
artifact.addFileTag("java.java");
}
artifacts.add(artifact);
return new NullFileObject(o);
}
@Override
public FileObject getFileForOutput(
JavaFileManager.Location location, String packageName,
String relativeName, FileObject sibling) throws IOException {
FileObject o = super.getFileForOutput(location, packageName,
relativeName, sibling);
Artifact artifact = new Artifact(new File(o.toUri()
.getSchemeSpecificPart()).toString());
if (o.getName().endsWith(".h")) {
artifact.addFileTag("hpp");
}
artifacts.add(artifact);
return new NullFileObject(o);
}
};
final JavaCompilerOptions options = JavaCompilerOptions
.parse(compiler, standardFileManager, compilerArguments
.toArray(new String[compilerArguments.size()]));
return compiler.getTask(
null,
fileManager,
null,
options.getRecognizedOptions(),
options.getClassNames(),
standardFileManager.getJavaFileObjectsFromFiles(options
.getFiles())).call() ? 0 : 1;
}
public void write(OutputStream outputStream) throws IOException {
writer.write(getArtifacts(), outputStream);
}
}
qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/tools/utils/JavaCompilerOptions.java 0000644 0001751 0000166 00000007710 14776170045 027650 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
package io.qt.qbs.tools.utils;
import javax.lang.model.SourceVersion;
import javax.tools.JavaCompiler;
import javax.tools.JavaFileManager;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class JavaCompilerOptions {
private final List recognizedOptions;
private final List classNames;
private final List files;
private JavaCompilerOptions(List recognizedOptions, List classNames, List files) {
this.recognizedOptions = recognizedOptions;
this.classNames = classNames;
this.files = files;
}
public static JavaCompilerOptions parse(JavaCompiler compiler,
JavaFileManager fileManager, String... arguments) {
List recognizedOptions = new ArrayList();
List classNames = new ArrayList();
List files = new ArrayList();
for (int i = 0; i < arguments.length; ++i) {
int argumentCount = compiler.isSupportedOption(arguments[i]);
if (argumentCount < 0)
argumentCount = fileManager.isSupportedOption(arguments[i]);
if (argumentCount >= 0) {
// isSupportedOption() returns 1 for -Xlint* in Java 9. Bug?
if (arguments[i].startsWith("-Xlint"))
argumentCount = 0;
for (int j = 0; j < argumentCount + 1; ++j) {
if (i + j >= arguments.length) {
throw new IllegalArgumentException(arguments[i]);
}
recognizedOptions.add(arguments[i + j]);
}
i += argumentCount;
} else {
File file = new File(arguments[i]);
if (file.exists())
files.add(file);
else if (SourceVersion.isName(arguments[i]))
classNames.add(arguments[i]);
else
throw new IllegalArgumentException(arguments[i]);
}
}
return new JavaCompilerOptions(recognizedOptions, classNames, files);
}
public List getRecognizedOptions() {
return Collections.unmodifiableList(recognizedOptions);
}
public List getFiles() {
return Collections.unmodifiableList(files);
}
public List getClassNames() {
return Collections.unmodifiableList(classNames);
}
}
qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/tools/JavaCompilerScannerTool.java 0000644 0001751 0000166 00000004120 14776170045 027274 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
package io.qt.qbs.tools;
import io.qt.qbs.tools.utils.JavaCompilerScanner;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
public class JavaCompilerScannerTool {
public static void main(String[] args) {
try {
JavaCompilerScanner scanner = new JavaCompilerScanner();
int result = scanner.run(new ArrayList(Arrays.asList(args)));
scanner.write(System.out);
System.exit(result);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
}
}
qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/ArtifactListJsonWriter.java 0000644 0001751 0000166 00000013027 14776170045 026036 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
package io.qt.qbs;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.List;
/**
* This uses a custom JSON implementation because the Java Standard Library does
* not yet have native support for JSON, and only minimal support is required
* here.
*/
public class ArtifactListJsonWriter implements ArtifactListWriter {
private static final int TAB_WIDTH = 4;
// based on escapeString from qtbase/qjsonwriter.cpp
private static String escapeString(String s) {
String out = "";
for (int i = 0; i < s.length();) {
int u = s.codePointAt(i);
// unpaired surrogate
if (u >= Character.MIN_SURROGATE && u <= Character.MAX_SURROGATE) {
out += "\ufffd";
i += Character.charCount(u);
continue;
}
if (u < 0x80) {
if (u < 0x20 || u == 0x22 || u == 0x5c) {
out += "\\";
switch (u) {
case 0x22:
out += "\"";
break;
case 0x5c:
out += "\\";
break;
case 0x8:
out += "b";
break;
case 0xc:
out += "f";
break;
case 0xa:
out += "n";
break;
case 0xd:
out += "r";
break;
case 0x9:
out += "t";
break;
default:
out += "u";
out += "0";
out += "0";
String hex = Integer.toHexString(u);
if (hex.length() == 1)
out += "0";
out += hex;
break;
}
} else {
out += s.substring(i, i + Character.charCount(u));
}
} else {
out += s.substring(i, i + Character.charCount(u));
}
i += Character.charCount(u);
}
return out;
}
private static void writeString(PrintStream printWriter, String s) {
printWriter.print("\"");
printWriter.print(escapeString(s));
printWriter.print("\"");
}
private static void writeIndent(PrintStream printWriter, int level) {
for (int i = 0; i < level * TAB_WIDTH; ++i) {
printWriter.print(" ");
}
}
private static void writeArtifact(Artifact artifact,
PrintStream printWriter, int indentLevel, Boolean comma) {
writeIndent(printWriter, indentLevel++);
printWriter.print("{\n");
writeIndent(printWriter, indentLevel);
writeString(printWriter, "filePath");
printWriter.print(": ");
writeString(printWriter, artifact.getFilePath());
printWriter.println(",");
writeIndent(printWriter, indentLevel);
writeString(printWriter, "fileTags");
printWriter.print(": [");
for (int i = 0; i < artifact.getFileTags().size(); ++i) {
writeString(printWriter, artifact.getFileTags().get(i));
if (i != artifact.getFileTags().size() - 1)
printWriter.print(", ");
}
printWriter.println("]");
writeIndent(printWriter, --indentLevel);
printWriter.println("}" + (comma ? "," : ""));
}
@Override
public void write(List artifacts, OutputStream outputStream)
throws IOException {
PrintStream printWriter = new PrintStream(outputStream);
printWriter.print("[\n");
for (int i = 0; i < artifacts.size(); ++i) {
writeArtifact(artifacts.get(i), printWriter, 1,
i != artifacts.size() - 1);
}
printWriter.println("]");
}
}
qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/ArtifactListWriter.java 0000644 0001751 0000166 00000003344 14776170045 025205 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
package io.qt.qbs;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
public interface ArtifactListWriter {
void write(List artifacts, OutputStream outputStream) throws IOException;
}
qbs-src-2.6.1/share/qbs/modules/java/io/qt/qbs/Artifact.java 0000644 0001751 0000166 00000005016 14776170045 023152 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
package io.qt.qbs;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Artifact {
private String filePath;
private List fileTags;
public Artifact(String filePath) {
if (filePath == null)
throw new IllegalArgumentException("filePath");
this.filePath = filePath;
this.fileTags = new ArrayList();
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public List getFileTags() {
return Collections.unmodifiableList(fileTags);
}
public void setFileTags(List fileTags) {
this.fileTags = new ArrayList(fileTags);
}
public void addFileTag(String fileTag) {
this.fileTags.add(fileTag);
}
public void removeFileTag(String fileTag) {
this.fileTags.remove(fileTag);
}
public void clearFileTags() {
this.fileTags.clear();
}
}
qbs-src-2.6.1/share/qbs/modules/java/JavaModule.qbs 0000644 0001751 0000166 00000033643 14776170045 021477 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Probes
import qbs.Process
import qbs.TextFile
import qbs.Utilities
import "utils.js" as JavaUtils
Module {
Probes.JdkProbe {
id: jdk
environmentPaths: (jdkPath ? [jdkPath] : []).concat(base)
}
Probes.JdkVersionProbe {
id: jdkVersionProbe
javac: compilerFilePath
}
property stringList additionalClassPaths
property stringList additionalCompilerFlags
property stringList additionalJarFlags
property stringList bootClassPaths
property string compilerFilePath: FileInfo.joinPaths(jdkPath, "bin", compilerName)
property string compilerName: "javac"
property bool enableWarnings: true
property string interpreterFilePath : FileInfo.joinPaths(jdkPath, "bin", interpreterName)
property string interpreterName: "java"
property string jarFilePath: FileInfo.joinPaths(jdkPath, "bin", jarName)
property string jarName: "jar"
property string jarsignerFilePath: FileInfo.joinPaths(jdkPath, "bin", jarsignerName)
property string jarsignerName: "jarsigner"
property string keytoolFilePath: FileInfo.joinPaths(jdkPath, "bin", keytoolName)
property string keytoolName: "keytool"
property bool _tagJniHeaders: true
property string jdkPath: jdk.path
version: [compilerVersionMajor, compilerVersionMinor, compilerVersionPatch].join(".")
property string compilerVersion: jdkVersionProbe.version
? jdkVersionProbe.version[1] : undefined
property var compilerVersionParts: JavaUtils.splitVersionString(compilerVersion)
property int compilerVersionMajor: compilerVersionParts[0]
property int compilerVersionMinor: compilerVersionParts[1]
property int compilerVersionPatch: compilerVersionParts[2]
property int compilerVersionUpdate: compilerVersionParts[3]
property string languageVersion
PropertyOptions {
name: "languageVersion"
description: "Java language version to interpret source code as"
}
property string runtimeVersion
PropertyOptions {
name: "runtimeVersion"
description: "version of the Java runtime to generate compatible bytecode for"
}
property var manifest: {
return {
"Manifest-Version": "1.0",
"Class-Path": manifestClassPath ? manifestClassPath.join(" ") : undefined
};
}
PropertyOptions {
name: "manifest"
description: "properties to add to the manifest file when building a JAR"
}
PropertyOptions {
name: "manifestFile"
description: "Use files tagged \"java.manifest\" instead."
removalVersion: "1.9"
}
property stringList manifestClassPath
PropertyOptions {
name: "manifestClassPath"
description: "entries to add to the manifest's Class-Path when building a JAR"
}
property bool warningsAsErrors: false
property pathList jdkIncludePaths: {
var paths = [];
if (isAppleJava) {
paths.push(FileInfo.joinPaths(qbs.sysroot,
"/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers"));
} else {
paths.push(FileInfo.joinPaths(jdkPath, "include"));
var hostOS = Host.os().includes("windows") ? Host.os().concat(["win32"]) : Host.os();
var platforms = ["win32", "darwin", "linux", "bsd", "solaris"];
for (var i = 0; i < platforms.length; ++i) {
if (hostOS.includes(platforms[i])) {
// Corresponds to JDK_INCLUDE_SUBDIR in the JDK Makefiles
paths.push(FileInfo.joinPaths(jdkPath, "include", platforms[i]));
break;
}
}
}
return paths;
}
// Internal properties
property path classFilesDir: FileInfo.joinPaths(product.buildDirectory, "classes")
property path internalClassFilesDir: FileInfo.joinPaths(product.buildDirectory, ".classes")
property bool isAppleJava: Host.os().includes("darwin")
&& (compilerVersionMajor < 1
|| (compilerVersionMajor === 1 && compilerVersionMinor < 7))
// https://developer.apple.com/library/content/documentation/Java/Conceptual/Java14Development/02-JavaDevTools/JavaDevTools.html
// tools.jar does not exist. Classes usually located here are instead included in classes.jar.
// The same is true for rt.jar, although not mentioned in the documentation
property path classesJarPath: {
if (isAppleJava)
return FileInfo.joinPaths(jdkPath, "bundle", "Classes", "classes.jar");
}
property path runtimeJarPath: {
if (compilerVersionMajor >= 9)
return undefined;
if (classesJarPath)
return classesJarPath;
return FileInfo.joinPaths(jdkPath, "jre", "lib", "rt.jar");
}
property path toolsJarPath: {
if (compilerVersionMajor >= 9)
return undefined;
if (classesJarPath)
return classesJarPath;
return FileInfo.joinPaths(jdkPath, "lib", "tools.jar");
}
validate: {
var validator = new ModUtils.PropertyValidator("java");
validator.setRequiredProperty("jdkPath", jdkPath);
validator.setRequiredProperty("compilerVersion", compilerVersion);
validator.setRequiredProperty("compilerVersionParts", compilerVersionParts);
validator.setRequiredProperty("compilerVersionMajor", compilerVersionMajor);
validator.setRequiredProperty("compilerVersionMinor", compilerVersionMinor);
if (Utilities.versionCompare(version, "9") < 0)
validator.setRequiredProperty("compilerVersionUpdate", compilerVersionUpdate);
validator.addVersionValidator("compilerVersion", compilerVersion
? compilerVersion.replace("_", ".") : undefined, 1, 4);
validator.addRangeValidator("compilerVersionMajor", compilerVersionMajor, 1);
validator.addRangeValidator("compilerVersionMinor", compilerVersionMinor, 0);
validator.addRangeValidator("compilerVersionPatch", compilerVersionPatch, 0);
if (Utilities.versionCompare(version, "9") < 0)
validator.addRangeValidator("compilerVersionUpdate", compilerVersionUpdate, 0);
validator.validate();
}
FileTagger {
patterns: "*.java"
fileTags: ["java.java"]
}
FileTagger {
patterns: ["*.mf"]
fileTags: ["java.manifest"]
}
Group {
name: "io.qt.qbs.internal.java-helper"
files: {
return JavaUtils.helperFullyQualifiedNames("java").map(function(name) {
return FileInfo.joinPaths(path, name + ".java");
});
}
fileTags: ["java.java-internal"]
}
Rule {
multiplex: true
inputs: ["java.java-internal"]
outputFileTags: ["java.class-internal"]
outputArtifacts: {
return JavaUtils.helperOutputArtifacts(product);
}
prepare: {
var cmd = new Command(ModUtils.moduleProperty(product, "compilerFilePath"),
JavaUtils.javacArguments(product, inputs,
JavaUtils.helperOverrideArgs(product,
"javac")));
cmd.ignoreDryRun = true;
cmd.silent = true;
return [cmd];
}
}
Rule {
multiplex: true
inputs: ["java.java"]
inputsFromDependencies: ["java.jar"]
explicitlyDependsOn: ["java.class-internal"]
outputFileTags: ["java.class"].concat(_tagJniHeaders ? ["hpp"] : ["java.jni-hpp"]) // Annotations can produce additional java source files. Ignored for now.
outputArtifacts: {
var artifacts = JavaUtils.outputArtifacts(product, inputs);
if (!product.java._tagJniHeaders) {
for (var i = 0; i < artifacts.length; ++i) {
var a = artifacts[i];
if (a.fileTags instanceof Array)
a.fileTags = a.fileTags.map(function(tag) {
if (tag === "hpp")
return "java.jni-hpp";
return tag;
});
}
}
return artifacts;
}
prepare: {
var cmd = new Command(ModUtils.moduleProperty(product, "compilerFilePath"),
JavaUtils.javacArguments(product, inputs));
cmd.description = "compiling Java sources";
cmd.highlight = "compiler";
return [cmd];
}
}
Rule {
inputs: ["java.class", "java.manifest"]
multiplex: true
Artifact {
fileTags: ["java.jar"]
filePath: FileInfo.joinPaths(product.destinationDirectory, product.targetName + ".jar")
}
prepare: {
var i, key;
var flags = "cf";
var args = [output.filePath];
var aggregateManifest = {};
var manifestFiles = (inputs["java.manifest"] || []).map(function (a) { return a.filePath; });
manifestFiles.forEach(function (manifestFile) {
var mf = JavaUtils.manifestContents(manifestFile);
for (key in mf) {
if (mf.hasOwnProperty(key)) {
var oldValue = aggregateManifest[key];
var newValue = mf[key];
if (oldValue !== undefined && oldValue !== newValue) {
throw new Error("Conflicting values '"
+ oldValue + "' and '"
+ newValue + "' for manifest file key '" + key + "'");
}
aggregateManifest[key] = newValue;
}
}
});
// Add local key-value pairs (overrides equivalent keys specified in the file if
// one was given)
var manifest = product.java.manifest;
for (key in manifest) {
if (manifest.hasOwnProperty(key))
aggregateManifest[key] = manifest[key];
}
for (key in aggregateManifest) {
if (aggregateManifest.hasOwnProperty(key) && aggregateManifest[key] === undefined)
delete aggregateManifest[key];
}
// Use default manifest unless we actually have properties to set
var needsManifestFile = manifestFiles.length > 0
|| aggregateManifest !== {"Manifest-Version": "1.0"};
var manifestFile = FileInfo.joinPaths(product.buildDirectory, "manifest.mf");
var mf;
try {
mf = new TextFile(manifestFile, TextFile.WriteOnly);
// Ensure that manifest version comes first
mf.write("Manifest-Version: " + (aggregateManifest["Manifest-Version"] || "1.0") + "\n");
delete aggregateManifest["Manifest-Version"];
for (key in aggregateManifest)
mf.write(key + ": " + aggregateManifest[key] + "\n");
mf.write("\n");
} finally {
if (mf) {
mf.close();
}
}
if (needsManifestFile) {
flags += "m";
args.push(manifestFile);
}
var entryPoint = ModUtils.moduleProperty(product, "entryPoint");
var entryPoint = product.entryPoint;
if (entryPoint) {
flags += "e";
args.push(entryPoint);
}
args.unshift(flags);
var otherFlags = ModUtils.moduleProperty(product, "additionalJarFlags");
if (otherFlags)
args = args.concat(otherFlags);
for (i in inputs["java.class"])
args.push(FileInfo.relativePath(ModUtils.moduleProperty(product, "classFilesDir"),
inputs["java.class"][i].filePath));
var cmd = new Command(ModUtils.moduleProperty(product, "jarFilePath"), args);
cmd.workingDirectory = ModUtils.moduleProperty(product, "classFilesDir");
cmd.description = "building " + FileInfo.fileName(output.fileName);
cmd.highlight = "linker";
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/modules/java/utils.js 0000644 0001751 0000166 00000035767 14776170045 020450 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
var WindowsUtils = require("qbs.WindowsUtils");
function is64bitProcess() {
var y = jdkRootRegistryKey(true);
var n = jdkRootRegistryKey(false);
y = Utilities.getNativeSetting(y + "\\" + Utilities.getNativeSetting(y, "CurrentVersion"), "JavaHome");
n = Utilities.getNativeSetting(n + "\\" + Utilities.getNativeSetting(n, "CurrentVersion"), "JavaHome");
return y !== n;
}
function useWow64Key(arch) {
var wow64 = false;
switch (arch) {
case "x86_64":
case "ia64":
// QTBUG-3845
if (!is64bitProcess())
return undefined;
break;
case "x86":
case "armv7":
wow64 = is64bitProcess();
break;
}
return wow64;
}
function jdkRootRegistryKey(wow64) {
// If an architecture is specified, search the appropriate key for that architecture,
// on this version of Windows (i.e. WOW64 or not) if compatible,
// otherwise get both keys since any JDK will be usable
if (wow64 === undefined)
return undefined;
return FileInfo.toWindowsSeparators(FileInfo.joinPaths("HKEY_LOCAL_MACHINE", "SOFTWARE",
(wow64 ? "Wow6432Node" : undefined),
"JavaSoft", "Java Development Kit"));
}
function findJdkPath(hostOS, arch, environmentPaths, searchPaths) {
var i;
for (i = 0; i < environmentPaths.length; ++i) {
if (environmentPaths[i])
return environmentPaths[i];
}
if (hostOS.includes("windows")) {
var rootKey = jdkRootRegistryKey(useWow64Key(arch));
if (rootKey) {
var current = Utilities.getNativeSetting(rootKey, "CurrentVersion"); // 1.8 etc.
if (current) {
var home = Utilities.getNativeSetting([rootKey, current].join("\\"), "JavaHome");
if (home) {
return home;
}
}
}
return undefined;
}
if (hostOS.includes("macos")) {
var p = new Process();
try {
// We filter by architecture here so that we'll get a compatible JVM for JNI use.
var args = [];
var canonicalArch;
if (arch) {
// Hardcoding apple/macosx/macho here is fine because we know we're on macOS
canonicalArch = Utilities.canonicalTargetArchitecture(arch, undefined, "apple",
"macosx", "macho");
args.push("--arch", canonicalArch);
}
// --failfast doesn't print the default JVM if nothing matches the filter(s).
var status = p.exec("/usr/libexec/java_home", args.concat(["--failfast"]));
if (status === 0)
return p.readStdOut().trim();
// It has been obvserved that java_home fails for any architecture that is passed,
// so try without the filter and look up the JDK architecture manually.
if (!canonicalArch)
return undefined;
if (p.exec("/usr/libexec/java_home", ["--failfast"]) !== 0)
return undefined;
var jdkPath = p.readStdOut().trim();
var releaseFile = new TextFile(jdkPath + "/release", TextFile.ReadOnly);
var line;
while ((line = releaseFile.readLine())) {
if (!line.startsWith("OS_ARCH="))
continue;
var firstQuote = line.indexOf('"');
if (firstQuote === -1)
break;
var secondQuote = line.indexOf('"', firstQuote + 1);
if (secondQuote === -1)
break;
var archFromFile = line.substring(firstQuote + 1, secondQuote);
if (archFromFile !== canonicalArch)
break;
return jdkPath;
}
return undefined;
} finally {
p.close();
}
}
if (hostOS.includes("unix")) {
var requiredTools = ["javac", "java", "jar"];
for (i = 0; i < searchPaths.length; ++i) {
function fullToolPath(tool) {
return FileInfo.joinPaths(searchPaths[i], "bin", tool);
}
if (requiredTools.map(function(p) { return fullToolPath(p); })
.every(function(p) { return File.exists(p); })) {
return searchPaths[i];
}
}
return undefined;
}
}
function findJdkVersion(compilerFilePath) {
var p = new Process();
try {
p.exec(compilerFilePath, ["-version"]);
var re = /^javac (([0-9]+(?:\.[0-9]+){0,2})(_([0-9]+))?)(.*)?$/m;
var match = p.readStdErr().trim().match(re);
if (!match)
match = p.readStdOut().trim().match(re);
if (match !== null)
return match;
} finally {
p.close();
}
}
function splitVersionString(compilerVersion) {
if (!compilerVersion)
return [];
var result = compilerVersion.split(/[\._]/).map(function(item) {
return parseInt(item, 10);
});
// special case, if javac -version returned "12" instead of "12.0.0"
if (result.length === 1)
result.push(0, 0);
return result;
}
function supportsGeneratedNativeHeaderFiles(product) {
var compilerVersionMajor = ModUtils.moduleProperty(product, "compilerVersionMajor");
if (compilerVersionMajor === 1) {
if (ModUtils.moduleProperty(product, "compilerVersionMinor") >= 8) {
return true;
}
}
return compilerVersionMajor > 1;
}
function javacArguments(product, inputs, overrides) {
function getModuleProperty(product, propertyName, overrides) {
if (overrides && overrides[propertyName])
return overrides[propertyName];
return ModUtils.moduleProperty(product, propertyName);
}
function getModuleProperties(product, propertyName, overrides) {
if (overrides && overrides[propertyName])
return overrides[propertyName];
return ModUtils.moduleProperty(product, propertyName);
}
var i;
var outputDir = getModuleProperty(product, "classFilesDir", overrides);
var classPaths = [outputDir];
var additionalClassPaths = getModuleProperties(product, "additionalClassPaths", overrides);
if (additionalClassPaths)
classPaths = classPaths.concat(additionalClassPaths);
for (i in inputs["java.jar"])
classPaths.push(inputs["java.jar"][i].filePath);
var debugArg = product.moduleProperty("qbs", "buildVariant") === "debug"
? "-g" : "-g:none";
var pathListSeparator = FileInfo.pathListSeparator();
var args = [
"-classpath", classPaths.join(pathListSeparator),
"-s", product.buildDirectory,
debugArg, "-d", outputDir
];
if (supportsGeneratedNativeHeaderFiles(product))
args.push("-h", product.buildDirectory);
var runtimeVersion = getModuleProperty(product, "runtimeVersion", overrides);
if (runtimeVersion)
args.push("-target", runtimeVersion);
var languageVersion = getModuleProperty(product, "languageVersion", overrides);
if (languageVersion)
args.push("-source", languageVersion);
var bootClassPaths = getModuleProperties(product, "bootClassPaths", overrides);
if (bootClassPaths && bootClassPaths.length > 0
&& (!runtimeVersion || Utilities.versionCompare(runtimeVersion, "9") < 0)) {
args.push("-bootclasspath", bootClassPaths.join(pathListSeparator));
}
if (!getModuleProperty(product, "enableWarnings", overrides))
args.push("-nowarn");
if (getModuleProperty(product, "warningsAsErrors", overrides))
args.push("-Werror");
var otherFlags = getModuleProperties(product, "additionalCompilerFlags", overrides);
if (otherFlags)
args = args.concat(otherFlags);
for (i in inputs["java.java"])
args.push(inputs["java.java"][i].filePath);
for (i in inputs["java.java-internal"])
args.push(inputs["java.java-internal"][i].filePath);
return args;
}
/**
* Returns a list of fully qualified Java class names for the compiler helper tool.
*
* @param type @c java to return names of sources, @c to return names of compiled classes
*/
function helperFullyQualifiedNames(type) {
var names = [
"io/qt/qbs/Artifact",
"io/qt/qbs/ArtifactListJsonWriter",
"io/qt/qbs/ArtifactListWriter",
"io/qt/qbs/tools/JavaCompilerScannerTool",
"io/qt/qbs/tools/utils/JavaCompilerOptions",
"io/qt/qbs/tools/utils/JavaCompilerScanner",
"io/qt/qbs/tools/utils/JavaCompilerScanner$1",
"io/qt/qbs/tools/utils/NullFileObject",
"io/qt/qbs/tools/utils/NullFileObject$1",
"io/qt/qbs/tools/utils/NullFileObject$2",
];
if (type === "java") {
return names.filter(function (name) {
return !name.includes("$");
});
} else if (type === "class") {
return names;
}
}
function helperOutputArtifacts(product) {
File.makePath(ModUtils.moduleProperty(product, "internalClassFilesDir"));
return helperFullyQualifiedNames("class").map(function (name) {
return {
filePath: FileInfo.joinPaths(ModUtils.moduleProperty(product, "internalClassFilesDir"),
name + ".class"),
fileTags: ["java.class-internal"]
};
});
}
function helperOverrideArgs(product, tool) {
var overrides = {};
if (tool === "javac") {
// Build the helper tool with the same source and target version as the JDK it's being
// compiled with. Both are irrelevant here since the resulting tool will only be run
// with the same JDK as it was built with, and we know in advance the source is
// compatible with all Java language versions from 1.6 and above.
var jdkVersionArray = [product.java.compilerVersionMajor];
if (product.java.compilerVersionMajor < 9)
jdkVersionArray.push(product.java.compilerVersionMinor);
var jdkVersion = jdkVersionArray.join(".");
overrides["languageVersion"] = jdkVersion;
overrides["runtimeVersion"] = jdkVersion;
// Build the helper tool's class files separately from the actual product's class files
overrides["classFilesDir"] = ModUtils.moduleProperty(product, "internalClassFilesDir");
// Add tools.jar to the classpath as required for the tree scanner API
var toolsJarPath = ModUtils.moduleProperty(product, "toolsJarPath");
if (toolsJarPath)
overrides["additionalClassPaths"] = [toolsJarPath].concat(
ModUtils.moduleProperty(product, "additionalClassPaths"));
}
// Inject the current JDK's runtime classes into the boot class path when building/running the
// dependency scanner. This is normally not necessary but is important for Android platforms
// where android.jar is the only JAR on the boot classpath and JSR 199 is unavailable.
var rtJarPath = product.java.runtimeJarPath;
overrides["bootClassPaths"] = (rtJarPath ? [rtJarPath] : []).concat(
ModUtils.moduleProperty(product, "bootClassPaths"));
return overrides;
}
function outputArtifacts(product, inputs) {
// Handle the case where a product depends on Java but has no Java sources
if (!inputs["java.java"] || inputs["java.java"].length === 0)
return [];
// We need to ensure that the output directory is created first, because the Java compiler
// internally checks that it is present before performing any actions
File.makePath(ModUtils.moduleProperty(product, "classFilesDir"));
var process;
try {
process = new Process();
process.setWorkingDirectory(
FileInfo.joinPaths(ModUtils.moduleProperty(product, "internalClassFilesDir")));
var sep = FileInfo.pathListSeparator();
var toolsJarPath = ModUtils.moduleProperty(product, "toolsJarPath");
var javaArgs = [
"-classpath", process.workingDirectory() + (toolsJarPath ? (sep + toolsJarPath) : ""),
"io/qt/qbs/tools/JavaCompilerScannerTool",
];
process.exec(ModUtils.moduleProperty(product, "interpreterFilePath"), javaArgs
.concat(javacArguments(product, inputs, helperOverrideArgs(product))), true);
var out = JSON.parse(process.readStdOut());
console.error(process.readStdErr());
return out;
} finally {
if (process)
process.close();
}
}
function manifestContents(filePath) {
if (filePath === undefined)
return undefined;
var contents, file;
try {
file = new TextFile(filePath);
contents = file.readAll();
} finally {
if (file) {
file.close();
}
}
if (contents) {
var dict = {};
var lines = contents.split(/\r?\n/g).filter(function (line) { return line.length > 0; });
for (var i = 0; i < lines.length; ++i) {
var kv = lines[i].split(":");
if (kv.length !== 2)
throw new Error("Syntax error in manifest file '"
+ filePath + "'; found \"" + lines[i] + "\" on line "
+ parseInt(i, 10) + "; expected format \"Key: Value\"");
dict[kv[0].trim()] = kv[1].trim();
}
return dict;
}
}
qbs-src-2.6.1/share/qbs/modules/capnproto/ 0000755 0001751 0000166 00000000000 14776170045 020014 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/capnproto/capnprotobase.qbs 0000644 0001751 0000166 00000004645 14776170045 023374 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.FileInfo
import qbs.Probes
import "capnproto.js" as HelperFunctions
Module {
property string compilerName: "capnpc"
property string compilerPath: compilerProbe.filePath
property string pluginName
property string pluginPath: pluginProbe.filePath
property pathList importPaths: []
property string outputDir: product.buildDirectory + "/capnp"
property var _searchPaths
Probes.BinaryProbe {
id: compilerProbe
names: compilerName ? [compilerName] : []
searchPaths: _searchPaths
}
Probes.BinaryProbe {
id: pluginProbe
names: pluginName ? [pluginName] : []
searchPaths: _searchPaths
}
FileTagger {
patterns: ["*.capnp"]
fileTags: ["capnproto.input"];
}
validate: {
HelperFunctions.validateCompiler(compilerName, compilerPath);
HelperFunctions.validatePlugin(pluginName, pluginPath);
}
}
qbs-src-2.6.1/share/qbs/modules/capnproto/cpp/ 0000755 0001751 0000166 00000000000 14776170045 020576 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/capnproto/cpp/capnprotocpp.qbs 0000644 0001751 0000166 00000005026 14776170045 024020 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import "../capnprotobase.qbs" as CapnProtoBase
import "../capnproto.js" as HelperFunctions
CapnProtoBase {
property bool useRpc: false
Depends { name: "cpp" }
Depends { name: "capnp" }
Depends { name: "capnp-rpc"; condition: useRpc }
pluginName: "capnpc-c++"
version: capnp.version
_searchPaths: capnp.hostBinDirs
cpp.systemIncludePaths: outputDir
cpp.cxxLanguageVersion: "c++14"
Rule {
inputs: ["capnproto.input"]
outputFileTags: ["hpp", "cpp"]
outputArtifacts: {
var outputDir = HelperFunctions.getOutputDir(input.capnproto.cpp, input);
var result = [
HelperFunctions.artifact(outputDir, input, "hpp", ".capnp.h"),
HelperFunctions.artifact(outputDir, input, "cpp", ".capnp.c++")
];
return result;
}
prepare: {
var result = HelperFunctions.doPrepare(
input.capnproto.cpp, product, input, outputs, "cpp");
return result;
}
}
}
qbs-src-2.6.1/share/qbs/modules/capnproto/capnproto.js 0000644 0001751 0000166 00000007252 14776170045 022365 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2020 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Utilities = require("qbs.Utilities");
function validateCompiler(name, path) {
if (!File.exists(path))
throw "Cannot find executable '" + name + "'. Please set the compilerPath "
+ "property or make sure the compiler is found in PATH";
}
function validatePlugin(name, path) {
if (!name)
throw "pluginName is not set";
if (!File.exists(path))
throw "Cannot find plugin '" + name + "'. Please set the pluginPath "
+ "property or make sure the plugin is found in PATH";
}
function getOutputDir(module, input) {
var outputDir = module.outputDir;
var importPaths = module.importPaths;
if (importPaths.length !== 0) {
var canonicalInput = File.canonicalFilePath(FileInfo.path(input.filePath));
for (var i = 0; i < importPaths.length; ++i) {
var path = File.canonicalFilePath(importPaths[i]);
if (canonicalInput.startsWith(path)) {
return outputDir + "/" + FileInfo.relativePath(path, canonicalInput);
}
}
}
return outputDir;
}
function artifact(outputDir, input, tag, suffix) {
return {
fileTags: [tag],
filePath: FileInfo.joinPaths(outputDir, FileInfo.baseName(input.fileName) + suffix),
cpp: {
includePaths: [].concat(input.cpp.includePaths, outputDir),
warningLevel: "none",
}
};
}
function doPrepare(module, product, input, outputs, lang)
{
var outputDir = FileInfo.path(outputs["cpp"][0].filePath);
var args = [];
args.push("--output=" + module.pluginPath + ":" + outputDir);
args.push("--src-prefix=" + FileInfo.path(input.filePath));
var importPaths = module.importPaths;
importPaths.forEach(function(path) {
if (!FileInfo.isAbsolutePath(path))
path = FileInfo.joinPaths(product.sourceDirectory, path);
args.push("--import-path", path);
});
args.push(input.filePath);
var cmd = new Command(module.compilerPath, args);
cmd.highlight = "codegen";
cmd.description = "generating " + lang + " files for " + input.fileName;
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/ico/ 0000755 0001751 0000166 00000000000 14776170045 016561 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/ico/ico.js 0000644 0001751 0000166 00000007737 14776170045 017707 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Process = require("qbs.Process");
function prepareIconset(project, product, inputs, outputs, input, output) {
inputs = File.directoryEntries(input.filePath, File.Files).map(function (p) {
return {
filePath: FileInfo.joinPaths(input.filePath, p),
fileTags: p.endsWith(".png") ? ["png"] : [],
ico: {}
};
});
inputs = {"png": inputs.filter(function (a) { return a.fileTags.includes("png"); })};
input = undefined;
return prepare(project, product, inputs, outputs, input, output);
}
function prepare(project, product, inputs, outputs, input, output) {
var args = ["--create", "--output=" + output.filePath];
if (output.fileTags.includes("ico")) {
args.push("--icon");
if (product.ico.alphaThreshold !== undefined)
args.push("--alpha-threshold=" + product.ico.alphaThreshold);
}
var isCursor = output.fileTags.includes("cur");
if (isCursor)
args.push("--cursor");
var hasMultipleImages = inputs["png"].length > 1;
inputs["png"].map(function(inp) {
if (isCursor) {
var hasX = inp.ico.cursorHotspotX !== undefined;
var hasY = inp.ico.cursorHotspotY !== undefined;
if (hasX || hasY) {
if (hasMultipleImages && product.ico.hasCursorHotspotBug) {
console.warn("icotool " + product.ico.version + " does not support setting " +
"the hotspot for cursor files with multiple images. Install " +
"icoutils 0.32.0 or newer to use this feature.");
} else {
if (hasX)
args.push("--hotspot-x=" + inp.ico.cursorHotspotX);
if (hasY)
args.push("--hotspot-y=" + inp.ico.cursorHotspotY);
}
}
}
if (inp.ico.raw)
args.push("-r");
args.push(inp.filePath);
});
var cmd = new Command(product.ico.icotoolFilePath, args);
cmd.description = "creating " + output.fileName;
return [cmd];
}
function findIcoUtilsVersion(toolFilePath) {
var p = new Process();
try {
p.exec(toolFilePath, ["--version"]);
var re = /^[a-z]+ \(icoutils\) ([0-9]+(?:\.[0-9]+){1,2})$/m;
var match = p.readStdOut().trim().match(re);
if (match !== null)
return match[1];
} finally {
p.close();
}
}
qbs-src-2.6.1/share/qbs/modules/ico/IcoModule.qbs 0000644 0001751 0000166 00000004626 14776170045 021160 0 ustar runner docker import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.Probes
import qbs.Process
import qbs.Utilities
import "ico.js" as IcoUtils
Module {
Probes.BinaryProbe {
id: icotoolProbe
names: ["icotool"]
}
Probes.IcoUtilsVersionProbe {
id: icotoolVersionProbe
toolFilePath: icotoolFilePath
}
version: icotoolVersionProbe.version
property int alphaThreshold
property int cursorHotspotX
property int cursorHotspotY
property bool raw
// private properties
property string icotoolFilePath: icotoolProbe.filePath
readonly property bool hasCursorHotspotBug: Utilities.versionCompare(version, "0.32") < 0
FileTagger {
patterns: ["*.png"]
fileTags: ["png"]
}
FileTagger {
patterns: ["*.iconset"] // bundle
fileTags: ["iconset"]
}
Rule {
inputs: ["iconset"]
Artifact {
filePath: input.baseName + ".ico"
fileTags: ["ico"]
}
prepare: IcoUtils.prepareIconset.apply(IcoUtils, arguments)
}
Rule {
multiplex: true
inputs: ["png"]
Artifact {
filePath: product.targetName + ".ico"
fileTags: ["ico"]
}
prepare: IcoUtils.prepare.apply(IcoUtils, arguments)
}
Rule {
inputs: ["iconset"]
Artifact {
filePath: input.baseName + ".cur"
fileTags: ["cur"]
}
prepare: IcoUtils.prepareIconset.apply(IcoUtils, arguments)
}
Rule {
multiplex: true
inputs: ["png"]
Artifact {
filePath: product.targetName + ".cur"
fileTags: ["cur"]
}
prepare: IcoUtils.prepare.apply(IcoUtils, arguments)
}
validate: {
if (!icotoolFilePath)
throw ModUtils.ModuleError("Could not find icotool in any of the following "
+ "locations:\n\t" + icotoolProbe.candidatePaths.join("\n\t")
+ "\nInstall the icoutils package on your platform.");
if (!version)
throw ModUtils.ModuleError("Could not determine icoutils package version.");
var validator = new ModUtils.PropertyValidator("ico");
validator.setRequiredProperty("version", version);
validator.addVersionValidator("version", version, 2, 3);
return validator.validate()
}
}
qbs-src-2.6.1/share/qbs/modules/Android/ 0000755 0001751 0000166 00000000000 14776170045 017367 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Android/sdk/ 0000755 0001751 0000166 00000000000 14776170045 020150 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Android/sdk/sdk.qbs 0000644 0001751 0000166 00000040610 14776170045 021441 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.Probes
import qbs.TextFile
import qbs.Utilities
import qbs.Xml
import "utils.js" as SdkUtils
Module {
Probes.AndroidSdkProbe {
id: sdkProbe
environmentPaths: (sdkDir ? [sdkDir] : []).concat(base)
}
Probes.AndroidNdkProbe {
id: ndkProbe
sdkPath: sdkProbe.path
environmentPaths: (ndkDir ? [ndkDir] : []).concat(base)
}
Probes.PathProbe {
id: bundletoolProbe
platformSearchPaths: [sdkDir]
names: ["bundletool-all"]
nameSuffixes: ["-0.11.0.jar", "-0.12.0.jar", "-0.13.0.jar", "-0.13.3.jar", "-0.13.4.jar",
"-0.14.0.jar", "-0.15.0.jar", "-1.0.0.jar", "-1.1.0.jar", "-1.2.0.jar", "-1.3.0.jar",
"-1.4.0.jar", "-1.5.0.jar", "-1.6.0.jar", "-1.6.1.jar", "-1.7.0.jar", "-1.7.1.jar",
"-1.8.0.jar"]
}
property path sdkDir: sdkProbe.path
property path ndkDir: ndkProbe.path
property path ndkSamplesDir: ndkProbe.samplesDir
property string buildToolsVersion: sdkProbe.buildToolsVersion
property var buildToolsVersionParts: buildToolsVersion ? buildToolsVersion.split('.').map(function(item) { return parseInt(item, 10); }) : []
property int buildToolsVersionMajor: buildToolsVersionParts[0]
property int buildToolsVersionMinor: buildToolsVersionParts[1]
property int buildToolsVersionPatch: buildToolsVersionParts[2]
property string platform: sdkProbe.platform
property string minimumVersion: "21"
property string targetVersion: platformVersion.toString()
property path bundletoolFilePath: bundletoolProbe.filePath
// Product-specific properties and files
property string packageName: {
var idx = product.name.indexOf(".")
if (idx > 0 && idx < product.name.length)
return product.name;
return "com.example." + product.name;
}
property int versionCode
property string versionName
property string apkBaseName: packageName
property bool automaticSources: true
property bool legacyLayout: false
property path sourceSetDir: legacyLayout
? product.sourceDirectory
: FileInfo.joinPaths(product.sourceDirectory, "src/main")
property path resourcesDir: FileInfo.joinPaths(sourceSetDir, "res")
property path assetsDir: FileInfo.joinPaths(sourceSetDir, "assets")
property path sourcesDir: FileInfo.joinPaths(sourceSetDir, legacyLayout ? "src" : "java")
property string manifestFile: defaultManifestFile
readonly property string defaultManifestFile: FileInfo.joinPaths(sourceSetDir,
"AndroidManifest.xml")
property bool customManifestProcessing: false
property bool _enableRules: !product.multiplexConfigurationId && !!packageName
property bool _bundledInAssets: true
// Internal properties.
property int platformVersion: {
if (platform) {
var match = platform.match(/^android-([0-9]+)$/);
if (match !== null) {
return parseInt(match[1], 10);
}
}
}
property string platformJavaVersion: {
if (platformVersion >= 21)
return "1.7";
return "1.5";
}
property path buildToolsDir: FileInfo.joinPaths(sdkDir, "build-tools", buildToolsVersion)
property string aaptName: "aapt2"
PropertyOptions {
name: "aaptName"
allowedValues: ["aapt", "aapt2"]
}
property path aaptFilePath: FileInfo.joinPaths(buildToolsDir, aaptName)
readonly property bool _enableAapt2: aaptName === "aapt2"
property string packageType: "apk"
PropertyOptions {
name: "packageType"
allowedValues: ["apk", "aab"]
}
readonly property bool _generateAab: packageType == "aab"
property stringList extraResourcePackages
PropertyOptions {
name: "extraResourcePackages"
description: "extra resource packages to compile resources for"
}
property path apksignerFilePath: FileInfo.joinPaths(buildToolsDir, "apksigner")
property path aidlFilePath: FileInfo.joinPaths(buildToolsDir, "aidl")
property path dxFilePath: FileInfo.joinPaths(buildToolsDir, "dx")
property path d8FilePath: FileInfo.joinPaths(buildToolsDir, "d8")
property string dexCompilerName: "d8"
PropertyOptions {
name: "dexCompilerName"
allowedValues: ["dx", "d8"]
}
readonly property bool _useD8: dexCompilerName === "d8"
property bool d8Desugaring: false
PropertyOptions {
name: "d8Desugaring"
description: "enable desugaring in d8 dex compiler"
}
property path zipalignFilePath: FileInfo.joinPaths(buildToolsDir, "zipalign")
property path androidJarFilePath: FileInfo.joinPaths(sdkDir, "platforms", platform,
"android.jar")
property path frameworkAidlFilePath: FileInfo.joinPaths(sdkDir, "platforms", platform,
"framework.aidl")
property path generatedJavaFilesBaseDir: FileInfo.joinPaths(product.buildDirectory, "gen")
property path generatedJavaFilesDir: FileInfo.joinPaths(generatedJavaFilesBaseDir,
(packageName || "").split('.').join('/'))
property path compiledResourcesDir: FileInfo.joinPaths(product.buildDirectory,
"compiled_resources")
property string packageContentsDir: FileInfo.joinPaths(product.buildDirectory, packageType)
property stringList aidlSearchPaths
Group {
condition: automaticSources
Group {
name: "java sources"
prefix: FileInfo.resolvePath(product.sourceDirectory, module.sourcesDir + '/')
files: "**/*.java"
}
Group {
name: "android resources"
fileTags: ["android.resources"]
prefix: FileInfo.resolvePath(product.sourceDirectory, module.resourcesDir + '/')
files: "**/*"
}
Group {
name: "android assets"
fileTags: ["android.assets"]
prefix: FileInfo.resolvePath(product.sourceDirectory, module.assetsDir + '/')
files: "**/*"
}
Group {
name: "manifest"
fileTags: ["android.manifest"]
files: module.manifestFile && module.manifestFile !== module.defaultManifestFile
? [module.manifestFile]
: (File.exists(module.defaultManifestFile) ? [module.defaultManifestFile] : [])
}
}
Group {
condition: !customManifestProcessing
fileTagsFilter: "android.manifest_processed"
fileTags: "android.manifest_final"
}
Group {
condition: _enableRules
Depends { name: "java" }
Depends { name: "codesign" }
product.java.languageVersion: platformJavaVersion
product.java.runtimeVersion: platformJavaVersion
product.java.bootClassPaths: androidJarFilePath
product.codesign.apksignerFilePath: apksignerFilePath
product.codesign._packageName: apkBaseName + (_generateAab ? ".aab" : ".apk")
product.codesign.useApksigner: !_generateAab
Rule {
inputs: ["android.aidl"]
Artifact {
filePath: FileInfo.joinPaths(Utilities.getHash(input.filePath),
input.completeBaseName + ".java")
fileTags: ["java.java"]
}
prepare: SdkUtils.processAidlCommands.apply(SdkUtils, arguments)
}
Rule {
inputs: "android.manifest"
Artifact {
filePath: FileInfo.joinPaths("processed_manifest", input.fileName)
fileTags: "android.manifest_processed"
}
prepare: SdkUtils.generateProcessedManifestCommands.apply(SdkUtils, arguments)
}
Rule {
multiplex: true
Artifact {
filePath: FileInfo.joinPaths(product.Android.sdk.generatedJavaFilesDir,
"BuildConfig.java")
fileTags: ["java.java"]
}
prepare: SdkUtils.generateBuildConfigJavaCommands(product, output)
}
Rule {
multiplex: true
inputs: ["java.class"]
inputsFromDependencies: ["java.jar", "bundled_jar"]
Artifact {
filePath: product.Android.sdk._generateAab ?
FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "dex",
"classes.dex") :
FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "classes.dex")
fileTags: ["android.dex"]
}
prepare: SdkUtils.prepareDex.apply(SdkUtils, arguments)
}
Rule {
property stringList inputTags: "android.nativelibrary"
inputsFromDependencies: inputTags
inputs: product.aggregate ? [] : inputTags
Artifact {
filePath: FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "lib",
input.Android.ndk.abi, product.Android.sdk._archInName ?
input.baseName + "_" + input.Android.ndk.abi + ".so" :
input.fileName)
fileTags: "android.nativelibrary_deployed"
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "copying " + input.fileName + " for packaging";
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); };
return cmd;
}
}
Rule {
multiplex: true
property stringList inputTags: "android.stl"
inputsFromDependencies: inputTags
inputs: product.aggregate ? [] : inputTags
outputFileTags: "android.stl_deployed"
outputArtifacts: SdkUtils.deployStlOutputs(product, inputs)
prepare: SdkUtils.deployStlCommands(product, inputs)
}
Group {
condition: module._enableAapt2
Rule {
inputs: ["android.resources"]
outputFileTags: ["android.resources_compiled"]
outputArtifacts: SdkUtils.aapt2CompileResourceOutputs(product, inputs)
prepare: SdkUtils.prepareAapt2CompileResource.apply(SdkUtils, arguments)
}
Rule {
multiplex: true
inputs: ["android.resources_compiled", "android.assets", "android.manifest_final"]
outputFileTags: ["java.java", "android.apk_resources"]
outputArtifacts: SdkUtils.aaptLinkOutputs(product, inputs)
prepare: SdkUtils.prepareAapt2Link.apply(SdkUtils, arguments)
}
Rule {
condition: module._generateAab
multiplex: true
inputs: [
"android.apk_resources", "android.manifest_final",
"android.dex", "android.stl_deployed",
"android.nativelibrary_deployed"
]
Artifact {
filePath: product.Android.sdk.apkBaseName + ".aab_unsigned"
fileTags: "android.package_unsigned"
}
prepare: SdkUtils.prepareBundletoolPackage.apply(SdkUtils, arguments)
}
Rule {
condition: !module._generateAab
multiplex: true
inputs: [
"android.apk_resources", "android.manifest_final",
"android.dex", "android.stl_deployed",
"android.nativelibrary_deployed"
]
Artifact {
filePath: product.Android.sdk.apkBaseName + ".apk_unsigned"
fileTags: "android.package_unsigned"
}
prepare: SdkUtils.prepareApkPackage.apply(SdkUtils, arguments)
}
}
Group {
condition: !module._enableAapt2
Rule {
multiplex: true
inputs: ["android.resources", "android.assets", "android.manifest_final"]
outputFileTags: ["java.java"]
outputArtifacts: SdkUtils.aaptGenerateOutputs(product, inputs)
prepare: SdkUtils.prepareAaptGenerate.apply(SdkUtils, arguments)
}
Rule {
condition: !module._generateAab
multiplex: true
inputs: [
"android.resources", "android.assets", "android.manifest_final",
"android.dex", "android.stl_deployed",
"android.nativelibrary_deployed"
]
Artifact {
filePath: product.Android.sdk.apkBaseName + ".apk_unsigned"
fileTags: "android.package_unsigned"
}
prepare: SdkUtils.prepareAaptPackage.apply(SdkUtils, arguments)
}
}
}
validate: {
if (!sdkDir) {
throw ModUtils.ModuleError("Could not find an Android SDK at any of the following "
+ "locations:\n\t" + sdkProbe.candidatePaths.join("\n\t")
+ "\nInstall the Android SDK to one of the above locations, "
+ "or set the Android.sdk.sdkDir property or "
+ "ANDROID_HOME environment variable to a valid "
+ "Android SDK location.");
}
if (!bundletoolFilePath && _generateAab) {
throw ModUtils.ModuleError("Could not find Android bundletool at the following "
+ "location:\n\t" + Android.sdk.sdkDir
+ "\nInstall the Android bundletool to the above location, "
+ "or set the Android.sdk.bundletoolFilePath property.\n"
+ "Android bundletool can be downloaded from "
+ "https://github.com/google/bundletool");
}
if (Utilities.versionCompare(buildToolsVersion, "24.0.3") < 0) {
throw ModUtils.ModuleError("Version of Android SDK build tools too old. This version "
+ "is " + buildToolsVersion + " and minimum version is "
+ "24.0.3. Please update the Android SDK.")
}
}
FileTagger {
patterns: ["AndroidManifest.xml"]
fileTags: ["android.manifest"]
}
FileTagger {
patterns: ["*.aidl"]
fileTags: ["android.aidl"]
}
Parameter {
property bool embedJar: true
}
}
qbs-src-2.6.1/share/qbs/modules/Android/sdk/utils.js 0000644 0001751 0000166 00000064030 14776170045 021651 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
var Xml = require("qbs.Xml");
function availableBuildToolsVersions(sdkDir) {
var re = /^([0-9]+)\.([0-9]+)\.([0-9]+)$/;
var buildTools = File.directoryEntries(FileInfo.joinPaths(sdkDir, "build-tools"),
File.Dirs | File.NoDotAndDotDot);
var versions = [];
for (var i = 0; i < buildTools.length; ++i) {
var match = buildTools[i].match(re);
if (match !== null) {
versions.push(buildTools[i]);
}
}
// Sort by version number
versions.sort(function (a, b) {
return Utilities.versionCompare(a, b);
});
return versions;
}
function prepareDex(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var dexCompilerFilePath = product.Android.sdk._useD8 ? product.Android.sdk.d8FilePath
: product.Android.sdk.dxFilePath;
var args = ["--output", FileInfo.path(output.filePath)];
if (product.Android.sdk._useD8) {
if (!product.Android.sdk.d8Desugaring)
args.push("--no-desugaring");
if (product.Android.sdk.minimumVersion) {
args.push("--min-api", product.Android.sdk.minimumVersion);
}
args.push("--release");
var classes = inputs["java.class"];
if (classes) {
args = args.concat(classes.map(function(javaClass) {
return FileInfo.relativePath(product.java.classFilesDir, javaClass.filePath) }));
}
} else {
args.unshift("--dex");
args.push(product.java.classFilesDir);
}
var jarFiles = [];
function traverseJarDeps(dep) {
if (dep.parameters.Android && dep.parameters.Android.sdk
&& dep.parameters.Android.sdk.embedJar === false)
return;
var isJar = typeof dep.artifacts["java.jar"] !== "undefined";
if (!isJar)
return;
dep.artifacts["java.jar"].forEach(function(artifact) {
if (!jarFiles.includes(artifact.filePath))
jarFiles.push(artifact.filePath);
});
dep.dependencies.forEach(traverseJarDeps);
}
product.dependencies.forEach(traverseJarDeps);
if (typeof product.artifacts["java.jar"] !== "undefined") {
product.artifacts["java.jar"].forEach(function(artifact) {
if (!jarFiles.includes(artifact.filePath))
jarFiles.push(artifact.filePath);
});
}
args = args.concat(jarFiles);
var cmd;
if (product.Android.sdk._useD8) {
cmd = new JavaScriptCommand();
cmd.args = args;
cmd.dexCompilerFilePath = dexCompilerFilePath;
cmd.description = "creating " + output.fileName;
cmd.workingDirectory = product.java.classFilesDir;
cmd.extendedDescription = dexCompilerFilePath + " " + args.join(' ');
cmd.highlight = "compiler";
cmd.sourceCode = function() {
// androiddeployqt copied jar files in product.java.classFilesDir
// but the rule only tags one jar file ("QtAndroid.jar"/"Qt6Android.jar")
// So to pass all files to d8, Qbs needs to read the directory
var bundledJarFilesDir = product.java.classFilesDir;
var bundledJarFiles = File.directoryEntries(bundledJarFilesDir, File.Files
| File.NoDotAndDotDot);
args = args.concat(bundledJarFiles.map(function(jarFile) {
return FileInfo.joinPaths(bundledJarFilesDir, jarFile) }));
var process = new Process();
var exitCode;
process.setWorkingDirectory(workingDirectory);
process.exec(dexCompilerFilePath, args, true);
try {
process.exec(dexCompilerFilePath, args, true);
} catch (e) {
throw new Error("Error while running dex compiler command: '"
+ Process.shellQuote(dexCompilerFilePath, args) + "': " + e.toString());
} finally {
process.close();
}
}
} else {
cmd = new Command(dexCompilerFilePath, args);
cmd.description = "creating " + output.fileName;
cmd.workingDirectory = product.java.classFilesDir;
}
return [cmd];
}
function findParentDir(filePath, parentDirName)
{
var lastDir;
var currentDir = FileInfo.path(filePath);
while (lastDir !== currentDir) {
if (FileInfo.fileName(currentDir) === parentDirName)
return currentDir;
lastDir = currentDir;
currentDir = FileInfo.path(currentDir);
}
}
function commonAaptPackageArgs(project, product, inputs, outputs, input, output,
explicitlyDependsOn) {
var manifestFilePath = inputs["android.manifest_final"][0].filePath;
var args = ["package", "--auto-add-overlay", "-f",
"-M", manifestFilePath,
"-I", product.Android.sdk.androidJarFilePath];
var resources = inputs["android.resources"];
var resourceDirs = [];
if (resources) {
for (var i = 0; i < resources.length; ++i) {
var resDir = findParentDir(resources[i].filePath, "res");
if (!resDir) {
throw "File '" + resources[i].filePath + "' is tagged as an Android resource, "
+ "but is not located under a directory called 'res'.";
}
if (!resourceDirs.includes(resDir))
resourceDirs.push(resDir);
}
}
for (i = 0; i < resourceDirs.length; ++i)
args.push("-S", resourceDirs[i]);
var assets = inputs["android.assets"];
var assetDirs = [];
if (assets) {
for (i = 0; i < assets.length; ++i) {
var assetDir = findParentDir(assets[i].filePath, "assets");
if (!assetDir) {
throw "File '" + assets[i].filePath + "' is tagged as an Android asset, "
+ "but is not located under a directory called 'assets'.";
}
if (!assetDirs.includes(assetDir))
assetDirs.push(assetDir);
}
}
for (i = 0; i < assetDirs.length; ++i)
args.push("-A", assetDirs[i]);
if (product.qbs.buildVariant === "debug")
args.push("--debug-mode");
return args;
}
// Rules: from https://developer.android.com/studio/command-line/aapt2
// Input Output
// XML resource files, such as Resource table with *.arsc.flat as its extension.
// String and Style, which are
// located in the res/values/
// directory.
// All other resource files. All files other than the files under res/values/ directory are
// converted to binary XML files with *.flat extensions.
// Additionally all PNG files are crunched by default and adopt
// *.png.flat extensions.
function generateAapt2ResourceFileName(filePath) {
var suffix = FileInfo.suffix(filePath);
if (suffix === "xml") {
var data = new Xml.DomDocument();
data.load(filePath);
var rootElem = data.documentElement();
if (rootElem && rootElem.isElement() && rootElem.tagName() === "resources")
// This is a valid XML resource file
suffix = "arsc";
// If the xml file is not a "resources" one then it's treated like any other resource file.
}
var dir = FileInfo.path(filePath);
var baseName = FileInfo.completeBaseName(filePath)
return FileInfo.fileName(dir) + "_" + baseName + "." + suffix + ".flat";
}
function aapt2CompileResourceOutputs(product, inputs)
{
var outputs = [];
var resources = inputs["android.resources"];
for (var i = 0; i < resources.length; ++i) {
var filePath = resources[i].filePath;
var resourceFileName = generateAapt2ResourceFileName(filePath);
var compiledName = FileInfo.joinPaths(product.Android.sdk.compiledResourcesDir,
resourceFileName);
outputs.push({filePath: compiledName, fileTags: "android.resources_compiled"});
}
return outputs;
}
function prepareAapt2CompileResource(project, product, inputs, outputs, input, output,
explicitlyDependsOn) {
var cmds = [];
var resources = inputs["android.resources"];
var compilesResourcesDir = product.Android.sdk.compiledResourcesDir;
if (!File.makePath(compilesResourcesDir)) {
throw "Cannot create directory '" + FileInfo.toNativeSeparators(compilesResourcesDir) +
"'.";
}
var args = ["compile", FileInfo.toNativeSeparators(input.filePath),
"-o", FileInfo.toNativeSeparators(compilesResourcesDir)];
var cmd = new Command(product.Android.sdk.aaptFilePath, args);
var outputFileName = generateAapt2ResourceFileName(input.filePath);
cmd.description = "compiling resource " + input.fileName + " into " + outputFileName;
cmds.push(cmd);
return cmds;
}
function aaptLinkOutputs(product, inputs)
{
var artifacts = [];
artifacts.push({
filePath: product.Android.sdk.apkBaseName + (product.Android.sdk._generateAab ?
".apk_aab" : ".apk_apk"),
fileTags: ["android.apk_resources"]
});
var resources = inputs["android.resources_compiled"];
if (resources && resources.length) {
artifacts.push({
filePath: FileInfo.joinPaths(product.Android.sdk.generatedJavaFilesDir,
"R.java"),
fileTags: ["java.java"]
});
}
for (var rp in product.Android.sdk.extraResourcePackages) {
var resourcePackageName = product.Android.sdk.extraResourcePackages[rp];
artifacts.push({
filePath: FileInfo.joinPaths(product.Android.sdk.generatedJavaFilesBaseDir,
resourcePackageName.split('.').join('/'), "R.java"),
fileTags: ["java.java"]
});
}
return artifacts;
}
function prepareAapt2Link(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
var baseOutputFilePath = outputs["android.apk_resources"][0].filePath;
var manifestFilePath = inputs["android.manifest_final"][0].filePath;
var compilesResourcesDir = product.Android.sdk.compiledResourcesDir;
var compiledResources = inputs["android.resources_compiled"];
var args = ["link", "-o", baseOutputFilePath, "-I", product.Android.sdk.androidJarFilePath];
var i = 0;
if (compiledResources) {
for (i = 0; i < compiledResources.length; ++i)
args.push(compiledResources[i].filePath);
}
args.push("--no-auto-version");
args.push("--auto-add-overlay");
args.push("--manifest", manifestFilePath);
args.push("--java", product.Android.sdk.generatedJavaFilesBaseDir);
var assets = inputs["android.assets"];
var assetDirs = [];
if (assets) {
for (i = 0; i < assets.length; ++i) {
var assetDir = findParentDir(assets[i].filePath, "assets");
if (!assetDir) {
throw "File '" + assets[i].filePath + "' is tagged as an Android asset, "
+ "but is not located under a directory called 'assets'.";
}
if (!assetDirs.includes(assetDir))
assetDirs.push(assetDir);
}
}
for (i = 0; i < assetDirs.length; ++i)
args.push("-A", assetDirs[i]);
if (product.qbs.buildVariant === "debug")
args.push("-v");
if (product.Android.sdk._generateAab)
args.push("--proto-format");
if (product.Android.sdk.extraResourcePackages) {
args.push("--extra-packages");
args.push(product.Android.sdk.extraResourcePackages.join(":"));
}
var cmd = new Command(product.Android.sdk.aaptFilePath, args);
cmd.description = "linking resources";
cmd.workingDirectory = product.buildDirectory;
cmds.push(cmd);
return cmds;
}
function aaptGenerateOutputs(product, inputs)
{
var artifacts = [];
var resources = inputs["android.resources"];
if (resources && resources.length) {
artifacts.push({
filePath: FileInfo.joinPaths(product.Android.sdk.generatedJavaFilesDir,
"R.java"),
fileTags: ["java.java"]
});
}
return artifacts;
}
function prepareAaptGenerate(project, product, inputs, outputs, input, output,
explicitlyDependsOn) {
var args = commonAaptPackageArgs.apply(this, arguments);
args.push("--no-crunch", "-m");
var resources = inputs["android.resources"];
if (resources && resources.length)
args.push("-J", ModUtils.moduleProperty(product, "generatedJavaFilesBaseDir"));
var cmd = new Command(product.Android.sdk.aaptFilePath, args);
cmd.description = "processing resources";
return [cmd];
}
function prepareAaptPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
var apkOutput = outputs["android.package_unsigned"][0];
var args = commonAaptPackageArgs.apply(this, arguments);
args.push("-F", apkOutput.filePath + ".unaligned");
args.push(product.Android.sdk.packageContentsDir);
var cmd = new Command(product.Android.sdk.aaptFilePath, args);
cmd.description = "generating " + apkOutput.fileName;
cmds.push(cmd);
cmd = new Command(product.Android.sdk.zipalignFilePath,
["-f", "4", apkOutput.filePath + ".unaligned", apkOutput.filePath]);
cmd.silent = true;
cmds.push(cmd);
cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.unalignedApk = apkOutput.filePath + ".unaligned";
cmd.sourceCode = function() { File.remove(unalignedApk); };
cmds.push(cmd);
return cmds;
}
function prepareApkPackage(project, product, inputs, outputs, input, output, explicitlyDependsOn) {
var cmds = [];
var apkInputFilePath = inputs["android.apk_resources"][0].filePath;
var apkOutput = outputs["android.package_unsigned"][0];
var apkOutputFilePathUnaligned = apkOutput.filePath + ".unaligned";
var dexFilePath = inputs["android.dex"][0].filePath;
var copyCmd = new JavaScriptCommand();
copyCmd.description = "copying apk";
copyCmd.source = apkInputFilePath;
copyCmd.target = apkOutputFilePathUnaligned;
copyCmd.sourceCode = function() {
File.copy(source, target);
}
cmds.push(copyCmd);
var jarArgs = ["-uvf", apkOutputFilePathUnaligned, "."];
var libPath = FileInfo.joinPaths(product.Android.sdk.packageContentsDir);
var jarCmd = new Command(product.java.jarFilePath, jarArgs);
jarCmd.description = "packaging files";
jarCmd.workingDirectory = libPath;
cmds.push(jarCmd);
cmd = new Command(product.Android.sdk.zipalignFilePath,
["-f", "4", apkOutputFilePathUnaligned, apkOutput.filePath]);
cmd.silent = true;
cmds.push(cmd);
cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.unalignedApk = apkOutputFilePathUnaligned;
cmd.sourceCode = function() { File.remove(unalignedApk); };
cmds.push(cmd);
return cmds;
}
function prepareBundletoolPackage(project, product, inputs, outputs, input, output,
explicitlyDependsOn) {
var cmds = [];
var baseModuleDir = product.Android.sdk.packageContentsDir;
var manifestDirName = FileInfo.joinPaths(baseModuleDir, "manifest");
var pkgBaseFileName = inputs["android.apk_resources"][0].filePath;
var jarResourcesArgs = ["xf", pkgBaseFileName];
var jarResourcesCmd = new Command(product.java.jarFilePath, jarResourcesArgs);
jarResourcesCmd.description = "extracting resources apk";
jarResourcesCmd.workingDirectory = baseModuleDir;
cmds.push(jarResourcesCmd);
var moveManifestCmd = new JavaScriptCommand();
moveManifestCmd.description = "moving manifest in manifest directory";
moveManifestCmd.path = manifestDirName;
moveManifestCmd.manifestFilePath = baseModuleDir + "/AndroidManifest.xml";
moveManifestCmd.sourceCode = function() {
if (!File.exists(path))
File.makePath(path);
if (File.exists(manifestFilePath))
File.move(manifestFilePath, path + "/AndroidManifest.xml");
}
cmds.push(moveManifestCmd);
var baseFilePath = FileInfo.joinPaths(product.buildDirectory, "base.zip");
var jarBaseArgs = ["cfM", baseFilePath, "."];
var jarBaseCmd = new Command(product.java.jarFilePath, jarBaseArgs);
jarBaseCmd.description = "compressing base module";
jarBaseCmd.workingDirectory = baseModuleDir;
cmds.push(jarBaseCmd);
var aabFilePath = outputs["android.package_unsigned"][0].filePath;
var removeCmd = new JavaScriptCommand();
removeCmd.description = "removing previous aab";
removeCmd.filePath = aabFilePath;
removeCmd.sourceCode = function() {
if (File.exists(filePath))
File.remove(filePath);
}
cmds.push(removeCmd);
var bundleConfigFilePath = FileInfo.joinPaths(product.buildDirectory, "BundleConfig.json");
var createBundleConfigCmd = new JavaScriptCommand();
createBundleConfigCmd.description = "create BundleConfig.json";
createBundleConfigCmd.filePath = bundleConfigFilePath;
createBundleConfigCmd.sourceCode = function() {
var bc = new TextFile(filePath, TextFile.WriteOnly);
bc.writeLine('{"optimizations": {');
bc.writeLine('"uncompress_native_libraries": {');
bc.writeLine('"enabled": false');
bc.writeLine('}}}');
}
cmds.push(createBundleConfigCmd);
var args = ["-jar", product.Android.sdk.bundletoolFilePath, "build-bundle"];
args.push("--modules=" + baseFilePath);
args.push("--output=" + aabFilePath);
args.push("--config=" + bundleConfigFilePath);
var cmd = new Command(product.java.interpreterFilePath, args);
cmd.description = "generating " + aabFilePath.fileName;
cmds.push(cmd);
return cmds;
}
function stlDeploymentData(product, inputs, type)
{
var data = { uniqueInputs: [], outputFilePaths: []};
var uniqueFilePaths = [];
var theInputs = inputs["android.stl"];
if (!theInputs)
return data;
for (var i = 0; i < theInputs.length; ++i) {
var currentInput = theInputs[i];
if (uniqueFilePaths.includes(currentInput.filePath))
continue;
uniqueFilePaths.push(currentInput.filePath);
data.uniqueInputs.push(currentInput);
var outputFileName = currentInput.fileName;
data.outputFilePaths.push(FileInfo.joinPaths(product.Android.sdk.packageContentsDir, "lib",
currentInput.Android.ndk.abi,
outputFileName));
}
return data;
}
function elementHasBundledAttributes(element)
{
return element.hasAttribute("android:name") &&
(element.attribute("android:name") === "android.app.bundled_in_assets_resource_id") ||
(element.attribute("android:name") === "android.app.bundled_in_lib_resource_id");
}
function deployStlOutputs(product, inputs)
{
var deploymentData = stlDeploymentData(product, inputs, "stl");
var outputs = [];
for (var i = 0; i < deploymentData.outputFilePaths.length; ++i) {
outputs.push({filePath: deploymentData.outputFilePaths[i],
fileTags: "android.stl_deployed"});
}
return outputs;
}
function deployStlCommands(product, inputs)
{
var cmds = [];
var deploymentData = stlDeploymentData(product, inputs);
for (var i = 0; i < deploymentData.uniqueInputs.length; ++i) {
var input = deploymentData.uniqueInputs[i];
var stripArgs = ["--strip-all", "-o", deploymentData.outputFilePaths[i],
input.filePath];
var cmd = new Command(input.cpp.stripPath, stripArgs);
cmd.description = "deploying " + input.fileName;
cmds.push(cmd);
}
return cmds;
}
function generateBuildConfigJavaCommands(product, output)
{
var cmd = new JavaScriptCommand();
cmd.description = "generating BuildConfig.java";
cmd.sourceCode = function() {
var debugValue = product.qbs.buildVariant === "debug" ? "true" : "false";
var ofile = new TextFile(output.filePath, TextFile.WriteOnly);
ofile.writeLine("package " + product.Android.sdk.packageName + ";")
ofile.writeLine("public final class BuildConfig {");
ofile.writeLine(" public final static boolean DEBUG = " + debugValue + ";");
ofile.writeLine("}");
ofile.close();
};
return [cmd];
}
function generateProcessedManifestCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
cmd.description = "ensuring correct package name in Android manifest file";
cmd.sourceCode = function() {
var manifestData = new Xml.DomDocument();
manifestData.load(input.filePath);
var rootElem = manifestData.documentElement();
if (!rootElem || !rootElem.isElement() || rootElem.tagName() !== "manifest")
throw "No manifest tag found in '" + input.filePath + "'.";
// Quick sanity check. Don't try to be fancy; let's not risk rejecting valid names.
var packageName = product.Android.sdk.packageName;
if (!packageName.match(/^[^.]+(?:\.[^.]+)+$/)) {
throw "Package name '" + packageName + "' is not valid. Please set "
+ "Android.sdk.packageName to a name following the "
+ "'com.mycompany.myproduct' pattern."
}
rootElem.setAttribute("package", packageName);
if (product.Android.sdk.versionCode !== undefined)
rootElem.setAttribute("android:versionCode", product.Android.sdk.versionCode);
if (product.Android.sdk.versionName !== undefined)
rootElem.setAttribute("android:versionName", product.Android.sdk.versionName);
if (product.Android.sdk._bundledInAssets) {
// Remove
// custom AndroidManifest.xml because assets are in rcc files for qt >= 5.14
var appElem = rootElem.firstChild("application");
if (!appElem || !appElem.isElement() || appElem.tagName() !== "application")
throw "No application tag found in '" + input.filePath + "'.";
var activityElem = appElem.firstChild("activity");
if (!activityElem || !activityElem.isElement() ||
activityElem.tagName() !== "activity")
throw "No activity tag found in '" + input.filePath + "'.";
var metaDataElem = activityElem.firstChild("meta-data");
while (metaDataElem && metaDataElem.isElement()) {
if (elementHasBundledAttributes(metaDataElem)) {
var elemToRemove = metaDataElem;
metaDataElem = metaDataElem.nextSibling("meta-data");
activityElem.removeChild(elemToRemove);
} else {
metaDataElem = metaDataElem.nextSibling("meta-data");
}
}
}
var usedSdkElem = rootElem.firstChild("uses-sdk");
if (!usedSdkElem || !usedSdkElem.isElement()) {
usedSdkElem = manifestData.createElement("uses-sdk");
rootElem.appendChild(usedSdkElem);
} else {
if (!usedSdkElem.isElement())
throw "Tag uses-sdk is not an element in '" + input.filePath + "'.";
}
usedSdkElem.setAttribute("android:minSdkVersion",
product.Android.sdk.minimumVersion);
usedSdkElem.setAttribute("android:targetSdkVersion",
product.Android.sdk.targetVersion);
rootElem.appendChild(usedSdkElem);
manifestData.save(output.filePath, 4);
}
return cmd;
}
function processAidlCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var aidl = product.Android.sdk.aidlFilePath;
var args = ["-p" + product.Android.sdk.frameworkAidlFilePath];
var aidlSearchPaths = input.Android.sdk.aidlSearchPaths;
for (var i = 0; i < (aidlSearchPaths ? aidlSearchPaths.length : 0); ++i)
args.push("-I" + aidlSearchPaths[i]);
args.push(input.filePath, output.filePath);
var cmd = new Command(aidl, args);
cmd.description = "processing " + input.fileName;
return [cmd];
}
qbs-src-2.6.1/share/qbs/modules/Android/ndk/ 0000755 0001751 0000166 00000000000 14776170045 020143 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/Android/ndk/ndk.qbs 0000644 0001751 0000166 00000013220 14776170045 021424 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.Probes
import qbs.Utilities
import "utils.js" as NdkUtils
Module {
Probes.AndroidNdkProbe {
id: ndkProbe
environmentPaths: (ndkDir ? [ndkDir] : []).concat(base)
}
version: ndkProbe.ndkVersion
readonly property string abi: NdkUtils.androidAbi(qbs.architecture)
PropertyOptions {
name: "abi"
description: "Supported Android ABIs"
allowedValues: ["arm64-v8a", "armeabi-v7a", "x86", "x86_64"]
}
// From https://android.googlesource.com/platform/ndk/+/refs/heads/ndk-release-r21/docs/BuildSystemMaintainers.md
// Android Studio‘s LLDB debugger uses a binary’s build ID to locate debug information. To
// ensure that LLDB works with a binary, pass an option like -Wl,--build-id=sha1 to Clang when
// linking. Other --build-id= modes are OK, but avoid a plain --build-id argument when using
// LLD, because Android Studio‘s version of LLDB doesn’t recognize LLD's default 8-byte build
// ID. See Issue 885.
// Plain --build-id option is nevertheless implemented when buildId property is empty.
// Possible values (from man page of ld.lld — ELF linker from the LLVM project):
// one of fast, md5, sha1, tree, uuid, 0xhex-string, and none. tree is an alias for sha1.
// Build-IDs of type fast, md5, sha1, and tree are calculated from the object contents. fast is
// not intended to be cryptographically secure.
property string buildId: "sha1"
// See https://developer.android.com/ndk/guides/cpp-support.html
property string appStl: "c++_shared"
PropertyOptions {
name: "appStl"
description: "C++ Runtime Libraries."
allowedValues: ["c++_static", "c++_shared"]
}
property string hostArch: ndkProbe.hostArch
property string ndkDir: ndkProbe.path
property string ndkSamplesDir: ndkProbe.samplesDir
property string platform: {
switch (abi) {
case "armeabi-v7a":
// case "x86": // x86 has broken wstring support
return "android-19";
default:
return "android-21";
}
}
property int platformVersion: {
if (platform) {
var match = platform.match(/^android-([0-9]+)$/);
if (match !== null) {
return parseInt(match[1], 10);
}
}
}
property stringList abis: {
var list = ["armeabi-v7a"];
if (platformVersion >= 16)
list.push("x86");
if (platformVersion >= 21)
list.push("arm64-v8a", "x86_64");
return list;
}
property string armMode: abi && abi.startsWith("armeabi")
? (qbs.buildVariant === "debug" ? "arm" : "thumb")
: undefined;
PropertyOptions {
name: "armMode"
description: "Determines the instruction set for armeabi configurations."
allowedValues: ["arm", "thumb"]
}
validate: {
if (!ndkDir) {
throw ModUtils.ModuleError("Could not find an Android NDK at any of the following "
+ "locations:\n\t" + ndkProbe.candidatePaths.join("\n\t")
+ "\nInstall the Android NDK to one of the above locations, "
+ "or set the Android.ndk.ndkDir property or "
+ "ANDROID_NDK_ROOT environment variable to a valid "
+ "Android NDK location.");
}
if (Utilities.versionCompare(version, "19") < 0)
throw ModUtils.ModuleError("Unsupported NDK version "
+ Android.ndk.version
+ ", please upgrade your NDK to r19+");
if (product.aggregate && !product.multiplexConfigurationId)
return;
var validator = new ModUtils.PropertyValidator("Android.ndk");
validator.setRequiredProperty("abi", abi);
validator.setRequiredProperty("appStl", appStl);
validator.setRequiredProperty("hostArch", hostArch);
validator.setRequiredProperty("platform", platform);
return validator.validate();
}
}
qbs-src-2.6.1/share/qbs/modules/Android/ndk/utils.js 0000644 0001751 0000166 00000006463 14776170045 021652 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var Utilities = require("qbs.Utilities")
function abiNameToDirName(abiName) {
switch (abiName) {
case "armeabi":
case "armeabi-v7a":
return "arm";
case "arm64-v8a":
return "arm64";
default:
return abiName;
}
}
function androidAbi(arch) {
switch (arch) {
case "arm64":
return "arm64-v8a";
case "armv5":
case "armv5te":
return "armeabi";
case "armv7":
case "armv7a":
return "armeabi-v7a";
default:
return arch;
}
}
function commonCompilerFlags(toolchain, buildVariant, ndk) {
var flags = ["-Werror=format-security"];
var abi = ndk.abi;
var armMode = ndk.armMode;
if (abi === "arm64-v8a")
flags.push("-fpic");
if (abi === "armeabi" || abi === "armeabi-v7a") {
flags.push("-fpic");
if (abi === "armeabi")
flags.push("-mtune=xscale", "-msoft-float");
if (abi === "armeabi-v7a") {
flags.push("-mfpu=vfpv3-d16");
flags.push("-mfloat-abi=softfp");
}
}
if (abi === "x86" || abi === "x86_64")
flags.push("-fPIC");
flags.push("-fno-limit-debug-info");
if (armMode)
flags.push("-m" + armMode);
// https://github.com/android-ndk/ndk/issues/884 is fixed in r21
if (ndk.version < 21)
flags.push("-fno-addrsig");
// https://github.com/android/ndk/issues/635 is fixed in api 24
if (abi === "x86" && ndk.platformVersion < 24)
flags.push("-mstackrealign");
return flags;
}
function commonLinkerFlags(ndk) {
var buildId = (ndk.buildId) ? "--build-id=" + ndk.buildId : "--build-id";
return ["-z", "noexecstack", "-z", "relro", "-z", "now", buildId, "--gc-sections"];
}
function stlFileName(prefix, ndk, suffix) {
return prefix + ndk.appStl.slice(0, ndk.appStl.indexOf('_')) + suffix;
}
qbs-src-2.6.1/share/qbs/modules/Android/android-utils.js 0000644 0001751 0000166 00000004165 14776170045 022511 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
function availablePlatforms(baseDir) {
var re = /^android-([0-9]+)$/;
var platforms = File.directoryEntries(FileInfo.joinPaths(baseDir, "platforms"),
File.Dirs | File.NoDotAndDotDot);
var versions = [];
for (var i = 0; i < platforms.length; ++i) {
var match = platforms[i].match(re);
if (match !== null) {
versions.push(platforms[i]);
}
}
versions.sort(function (a, b) {
return parseInt(a.match(re)[1], 10) - parseInt(b.match(re)[1], 10);
});
return versions;
}
qbs-src-2.6.1/share/qbs/modules/wix/ 0000755 0001751 0000166 00000000000 14776170045 016616 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/wix/WiXModule.qbs 0000644 0001751 0000166 00000042056 14776170045 021211 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.Probes
import qbs.Utilities
Module {
condition: qbs.targetOS.includes("windows")
Probes.WiXProbe {
id: wixProbe
}
property path toolchainInstallPath: wixProbe.path
property path toolchainInstallRoot: wixProbe.root
version: wixProbe.version
property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : []
property int versionMajor: versionParts[0]
property int versionMinor: versionParts[1]
property int versionPatch: versionParts[2]
property int versionBuild: versionParts[3]
property string compilerName: "candle.exe"
property string compilerPath: FileInfo.joinPaths(toolchainInstallRoot, compilerName)
property string linkerName: "light.exe"
property string linkerPath: FileInfo.joinPaths(toolchainInstallRoot, linkerName)
property string warningLevel: "normal"
PropertyOptions {
name: "warningLevel"
allowedValues: ["none", "normal", "pedantic"]
}
property bool debugInformation: qbs.debugInformation
property bool treatWarningsAsErrors: false
property bool verboseOutput: false
PropertyOptions {
name: "verboseOutput"
description: "display verbose output from the compiler and linker"
}
property bool visualStudioCompatibility: true
PropertyOptions {
name: "visualStudioCompatibility"
description: "whether to define most of the same variables as " +
"Visual Studio when using the Candle compiler"
}
property bool enableQbsDefines: true
PropertyOptions {
name: "enableQbsDefines"
description: "built-in variables that are defined when using the Candle compiler"
}
property pathList includePaths
PropertyOptions {
name: "includePaths"
description: "directories to add to the include search path"
}
property stringList defines
PropertyOptions {
name: "defines"
description: "variables that are defined when using the Candle compiler"
}
property stringList compilerFlags
PropertyOptions {
name: "compilerFlags"
description: "additional flags for the Candle compiler"
}
property stringList linkerFlags
PropertyOptions {
name: "linkerFlags"
description: "additional flags for the Light linker"
}
property stringList cultures
PropertyOptions {
name: "cultures"
description: "the list of localizations to build the MSI for; leave undefined to build all localizations"
}
property stringList extensions: product.type.includes("wixsetup") ? ["WixBalExtension"] : [] // default to WiX Standard Bootstrapper extension
// private properties
property string targetSuffix: {
if (product.type.includes("msi")) {
return windowsInstallerSuffix;
} else if (product.type.includes("wixsetup")) {
return executableSuffix;
}
}
// MSI/MSM package validation only works natively on Windows
property bool enablePackageValidation: Host.os().includes("windows")
property string executableSuffix: ".exe"
property string windowsInstallerSuffix: ".msi"
validate: {
var validator = new ModUtils.PropertyValidator("wix");
validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath);
validator.setRequiredProperty("toolchainInstallRoot", toolchainInstallRoot);
validator.setRequiredProperty("version", version);
validator.setRequiredProperty("versionMajor", versionMajor);
validator.setRequiredProperty("versionMinor", versionMinor);
validator.setRequiredProperty("versionPatch", versionPatch);
validator.addVersionValidator("version", version, 3, 4);
validator.addRangeValidator("versionMajor", versionMajor, 1);
validator.addRangeValidator("versionMinor", versionMinor, 0);
validator.addRangeValidator("versionPatch", versionPatch, 0);
if (versionParts && versionParts.length >= 4) {
validator.setRequiredProperty("versionBuild", versionBuild);
validator.addRangeValidator("versionBuild", versionBuild, 0);
}
validator.validate();
}
setupBuildEnvironment: {
var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), true);
v.prepend(product.wix.toolchainInstallPath);
v.prepend(product.wix.toolchainInstallRoot);
v.set();
}
// WiX Include Files
FileTagger {
patterns: ["*.wxi"]
fileTags: ["wxi"]
}
// WiX Localization Files
FileTagger {
patterns: ["*.wxl"]
fileTags: ["wxl"]
}
// WiX Source Files
FileTagger {
patterns: ["*.wxs"]
fileTags: ["wxs"]
}
Rule {
id: candleCompiler
inputs: ["wxs"]
auxiliaryInputs: ["wxi", "installable"]
auxiliaryInputsFromDependencies: ["wxi", "installable"]
Artifact {
fileTags: ["wixobj"]
filePath: FileInfo.joinPaths(Utilities.getHash(input.baseDir),
FileInfo.baseName(input.fileName) + ".wixobj")
}
prepare: {
var i;
var args = ["-nologo"];
if (ModUtils.moduleProperty(input, "warningLevel") === "none") {
args.push("-sw");
} else {
if (ModUtils.moduleProperty(input, "warningLevel") === "pedantic") {
args.push("-pedantic");
}
if (ModUtils.moduleProperty(input, "treatWarningsAsErrors")) {
args.push("-wx");
}
}
if (ModUtils.moduleProperty(input, "verboseOutput")) {
args.push("-v");
}
var arch = product.moduleProperty("qbs", "architecture");
// http://wixtoolset.org/documentation/manual/v3/xsd/wix/package.html
switch (arch) {
case "x86_64":
arch = "x64";
break;
case "armv7":
case "armv7a":
arch = "arm";
break;
}
// Visual Studio defines these variables along with various solution and project names and paths;
// we'll pass most of them to ease compatibility between QBS and WiX projects originally created
// using Visual Studio. The only definitions we don't pass are the ones which make no sense at all
// in QBS, like the solution and project directories since they do not exist.
if (ModUtils.moduleProperty(input, "visualStudioCompatibility")) {
var toolchain = product.moduleProperty("qbs", "toolchain");
var toolchainInstallPath = product.moduleProperty("cpp", "toolchainInstallPath");
if (toolchain && toolchain.includes("msvc") && toolchainInstallPath) {
var vcDir = toolchainInstallPath.replace(/[\\/]bin$/i, "");
var vcRootDir = vcDir.replace(/[\\/]VC$/i, "");
args.push("-dDevEnvDir=" + FileInfo.toWindowsSeparators(FileInfo.joinPaths(vcRootDir, 'Common7', 'IDE')));
}
var buildVariant = product.moduleProperty("qbs", "buildVariant");
if (buildVariant === "debug") {
args.push("-dDebug");
args.push("-dConfiguration=Debug");
} else if (buildVariant === "release") {
// VS doesn't define "Release"
args.push("-dConfiguration=Release");
}
var productTargetExt = ModUtils.moduleProperty(input, "targetSuffix");
if (!productTargetExt) {
throw("WiX: Unsupported product type '" + product.type + "'");
}
var builtBinaryFilePath = FileInfo.joinPaths(product.destinationDirectory, product.targetName + productTargetExt);
args.push("-dOutDir=" + FileInfo.toWindowsSeparators(FileInfo.path(builtBinaryFilePath))); // in VS, relative to the project file by default
args.push("-dPlatform=" + (arch || "x86"));
args.push("-dProjectName=" + project.name);
args.push("-dTargetDir=" + FileInfo.toWindowsSeparators(FileInfo.path(builtBinaryFilePath))); // in VS, an absolute path
args.push("-dTargetExt=" + productTargetExt);
args.push("-dTargetFileName=" + product.targetName + productTargetExt);
args.push("-dTargetName=" + product.targetName);
args.push("-dTargetPath=" + FileInfo.toWindowsSeparators(builtBinaryFilePath));
}
var includePaths = ModUtils.moduleProperty(input, "includePaths");
for (i in includePaths) {
args.push("-I" + includePaths[i]);
}
var enableQbsDefines = ModUtils.moduleProperty(input, "enableQbsDefines")
if (enableQbsDefines) {
var map = {
"project.": project,
"product.": product
};
for (var prefix in map) {
var obj = map[prefix];
for (var prop in obj) {
var val = obj[prop];
if (typeof val !== 'function' && typeof val !== 'object' && !prop.startsWith("_")) {
args.push("-d" + prefix + prop + "=" + val);
}
}
}
// Helper define for alternating between 32-bit and 64-bit logic
if (arch === "x64" || arch === "ia64") {
args.push("-dWin64");
}
}
// User-supplied defines
var defines = ModUtils.moduleProperty(input, "defines");
for (i in defines) {
args.push("-d" + defines[i]);
}
// User-supplied flags
var flags = ModUtils.moduleProperty(input, "compilerFlags");
for (i in flags) {
args.push(flags[i]);
}
args.push("-out");
args.push(FileInfo.toWindowsSeparators(output.filePath));
if (arch) {
args.push("-arch");
args.push(arch);
}
var extensions = ModUtils.moduleProperty(input, "extensions");
for (i in extensions) {
args.push("-ext");
args.push(extensions[i]);
}
args.push(FileInfo.toWindowsSeparators(input.filePath));
var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args);
cmd.description = "compiling " + input.fileName;
cmd.highlight = "compiler";
cmd.workingDirectory = FileInfo.path(output.filePath);
// candle.exe outputs the file name. We filter that out.
cmd.inputFileName = input.fileName;
cmd.stdoutFilterFunction = function(output) {
return output.split(inputFileName + "\r\n").join("");
};
return cmd;
}
}
Rule {
id: lightLinker
multiplex: true
inputs: ["wixobj", "wxl"]
auxiliaryInputs: ["installable"]
auxiliaryInputsFromDependencies: ["installable"]
inputsFromDependencies: product.type.includes("wixsetup") ? ["msi"] : []
outputArtifacts: {
var artifacts = [];
if (product.type.includes("wixsetup")) {
artifacts.push({
fileTags: ["wixsetup", "application"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ ModUtils.moduleProperty(product,
"executableSuffix"))
});
}
if (product.type.includes("msi")) {
artifacts.push({
fileTags: ["msi"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName
+ ModUtils.moduleProperty(product,
"windowsInstallerSuffix"))
});
}
if (ModUtils.moduleProperty(product, "debugInformation")) {
artifacts.push({
fileTags: ["wixpdb"],
filePath: FileInfo.joinPaths(product.destinationDirectory,
product.targetName + ".wixpdb")
});
}
return artifacts;
}
outputFileTags: ["application", "msi", "wixpdb", "wixsetup"]
prepare: {
var i;
var primaryOutput;
if (product.type.includes("wixsetup")) {
primaryOutput = outputs.wixsetup[0];
} else if (product.type.includes("msi")) {
primaryOutput = outputs.msi[0];
} else {
throw("WiX: Unsupported product type '" + product.type + "'");
}
var args = ["-nologo"];
if (!ModUtils.moduleProperty(product, "enablePackageValidation")) {
args.push("-sval");
}
if (ModUtils.moduleProperty(product, "warningLevel") === "none") {
args.push("-sw");
} else {
if (ModUtils.moduleProperty(product, "warningLevel") === "pedantic") {
args.push("-pedantic");
}
if (ModUtils.moduleProperty(product, "treatWarningsAsErrors")) {
args.push("-wx");
}
}
if (ModUtils.moduleProperty(product, "verboseOutput")) {
args.push("-v");
}
args.push("-out");
args.push(FileInfo.toWindowsSeparators(primaryOutput.filePath));
if (ModUtils.moduleProperty(product, "debugInformation")) {
args.push("-pdbout");
args.push(FileInfo.toWindowsSeparators(outputs.wixpdb[0].filePath));
} else {
args.push("-spdb");
}
var extensions = ModUtils.moduleProperty(product, "extensions");
for (i in extensions) {
args.push("-ext");
args.push(extensions[i]);
}
for (i in inputs.wxl) {
args.push("-loc");
args.push(FileInfo.toWindowsSeparators(inputs.wxl[i].filePath));
}
if (product.type.includes("msi")) {
var cultures = ModUtils.moduleProperty(product, "cultures");
args.push("-cultures:"
+ (cultures && cultures.length > 0 ? cultures.join(";") : "null"));
}
// User-supplied flags
var flags = ModUtils.moduleProperty(product, "linkerFlags");
for (i in flags) {
args.push(flags[i]);
}
for (i in inputs.wixobj) {
args.push(FileInfo.toWindowsSeparators(inputs.wixobj[i].filePath));
}
var cmd = new Command(ModUtils.moduleProperty(product, "linkerPath"), args);
cmd.description = "linking " + primaryOutput.fileName;
cmd.highlight = "linker";
cmd.workingDirectory = FileInfo.path(primaryOutput.filePath);
return cmd;
}
}
}
qbs-src-2.6.1/share/qbs/modules/pkgconfig/ 0000755 0001751 0000166 00000000000 14776170045 017756 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/pkgconfig/pkgconfig.qbs 0000644 0001751 0000166 00000005071 14776170045 022437 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import qbs.File
import qbs.Probes
Module {
Probes.BinaryProbe {
id: pkgconfigProbe
names: "pkg-config"
}
property path sysroot: {
if (qbs.targetOS.includes("macos"))
return "";
return qbs.sysroot;
}
property string executableFilePath: pkgconfigProbe.filePath
property stringList libDirs
property bool staticMode: false
validate: {
if (!executableFilePath) {
throw "No pkg-config executable found. "
+ "Please set modules.pkgconfig.executableFilePath.";
}
if (!File.exists(executableFilePath))
throw "The pkg-config executable '" + executableFilePath + "' does not exist.";
}
}
qbs-src-2.6.1/share/qbs/modules/typescript/ 0000755 0001751 0000166 00000000000 14776170045 020215 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/typescript/typescript.js 0000644 0001751 0000166 00000024650 14776170045 022770 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var Process = require("qbs.Process");
function findTscVersion(compilerFilePath, nodejsPath) {
var p = new Process();
try {
if (nodejsPath)
p.setEnv("PATH", nodejsPath);
p.exec(compilerFilePath, ["--version"]);
var re = /^(?:message TS6029: )?Version (([0-9]+(?:\.[0-9]+){1,3})(?:-(.+?))?)$/m;
var match = p.readStdOut().trim().match(re);
if (match !== null)
return match;
} finally {
p.close();
}
}
function tscArguments(product, inputs) {
var i;
var args = [];
if (ModUtils.moduleProperty(product, "warningLevel") === "pedantic") {
args.push("--noImplicitAny");
}
var targetVersion = ModUtils.moduleProperty(product, "targetVersion");
if (targetVersion) {
args.push("--target");
args.push(targetVersion);
}
var moduleLoader = ModUtils.moduleProperty(product, "moduleLoader");
if (moduleLoader) {
args.push("--module");
args.push(moduleLoader);
}
if (ModUtils.moduleProperty(product, "stripComments")) {
args.push("--removeComments");
}
if (ModUtils.moduleProperty(product, "generateDeclarations")) {
args.push("--declaration");
}
if (ModUtils.moduleProperty(product, "generateSourceMaps")) {
args.push("--sourcemap");
}
// User-supplied flags
var flags = ModUtils.moduleProperty(product, "compilerFlags");
for (i in flags) {
args.push(flags[i]);
}
if (supportsModernFeatures(product)) {
args.push("--rootDir", product.sourceDirectory);
}
args.push("--outDir", product.buildDirectory);
if (ModUtils.moduleProperty(product, "singleFile")) {
args.push(outOption(product),
FileInfo.joinPaths(product.destinationDirectory, product.targetName) + ".js");
}
if (inputs.typescript_declaration) {
for (i = 0; i < inputs.typescript_declaration.length; ++i) {
args.push(inputs.typescript_declaration[i].filePath);
}
}
if (inputs.typescript) {
for (i = 0; i < inputs.typescript.length; ++i) {
args.push(inputs.typescript[i].filePath);
}
}
if (inputs["typescript.typescript-internal"]) {
for (i = 0; i < inputs["typescript.typescript-internal"].length; ++i) {
args.push(inputs["typescript.typescript-internal"][i].filePath);
}
}
return args;
}
function outputArtifacts(product, inputs) {
if (!supportsModernFeatures(product)) {
console.warn("Qbs does not properly support TypeScript versions prior to 1.5 due to " +
"severe limitations in dependency tracking. This is TypeScript version " +
ModUtils.moduleProperty(product, "version") + ". It is strongly recommended " +
"that you upgrade TypeScript, or continue at your own risk.");
return legacyOutputArtifacts(product, inputs);
}
var process;
try {
process = new Process();
process.setEnv("NODE_PATH", [
ModUtils.moduleProperty(product, "toolchainInstallPath"),
product.moduleProperty("nodejs", "packageManagerRootPath")
].join(FileInfo.pathListSeparator()));
process.exec(product.moduleProperty("nodejs", "interpreterFilePath"),
[FileInfo.joinPaths(product.buildDirectory,
".io.qt.qbs.internal.typescript",
"qbs-tsc-scan.js")]
.concat(tscArguments(product, inputs)), true);
var artifacts = JSON.parse(process.readStdOut());
// Find and tag the "main" output file
var applicationFile = product.moduleProperty("nodejs", "applicationFile");
if (applicationFile) {
var i, appIndex = -1;
if (product.moduleProperty("typescript", "singleFile")) {
for (i = 0; i < artifacts.length; ++i) {
if (artifacts[i].fileTags.includes("compiled_typescript")) {
appIndex = i;
break;
}
}
} else {
var expected = FileInfo.relativePath(product.sourceDirectory, applicationFile);
if (!expected.endsWith(".ts"))
// tsc doesn't allow this anyways, so it's a perfectly reasonable restriction
throw "TypeScript source file name '" + applicationFile +
"' does not end with .ts";
expected = expected.slice(0, -2) + "js";
for (i = 0; i < artifacts.length; ++i) {
if (expected === FileInfo.relativePath(product.buildDirectory,
artifacts[i].filePath)) {
appIndex = i;
break;
}
}
}
if (appIndex === -1 || !artifacts[appIndex].fileTags.includes("compiled_typescript"))
throw "nodejs.applicationFile was set, but Qbs couldn't find the compiled " +
"JavaScript file corresponding to '" + applicationFile + "'";
artifacts[appIndex].fileTags = artifacts[appIndex].fileTags.concat(["application_js"]);
}
return artifacts;
} finally {
if (process)
process.close();
}
}
function legacyOutputArtifacts(product, inputs) {
var artifacts = [];
if (!inputs.typescript) {
return artifacts;
}
var jsTags = ["js", "compiled_typescript"];
var filePath = FileInfo.joinPaths(product.destinationDirectory, product.targetName);
if (product.moduleProperty("typescript", "singleFile")) {
// We could check
// if (product.moduleProperty("nodejs", "applicationFile") === inputs.typescript[i].filePath)
// but since we're compiling to a single file there's no need to state it explicitly
jsTags.push("application_js");
artifacts.push({fileTags: jsTags,
filePath: FileInfo.joinPaths(
product.moduleProperty("nodejs",
"compiledIntermediateDir"),
product.targetName + ".js")});
if (product.moduleProperty("typescript", "generateDeclarations")) {
artifacts.push({fileTags: ["typescript_declaration"],
filePath: filePath + ".d.ts"});
}
if (product.moduleProperty("typescript", "generateSourceMaps")) {
artifacts.push({fileTags: ["source_map"],
filePath: filePath + ".js.map"});
}
} else {
for (var i = 0; i < inputs.typescript.length; ++i) {
jsTags = ["js", "compiled_typescript"];
if (product.moduleProperty("nodejs", "applicationFile") === inputs.typescript[i].filePath)
jsTags.push("application_js");
var intermediatePath = FileInfo.path(FileInfo.relativePath(
product.sourceDirectory,
inputs.typescript[i].filePath));
var baseName = FileInfo.baseName(inputs.typescript[i].fileName);
filePath = FileInfo.joinPaths(product.destinationDirectory,
intermediatePath,
baseName);
artifacts.push({fileTags: jsTags,
filePath: FileInfo.joinPaths(
product.moduleProperty("nodejs",
"compiledIntermediateDir"),
intermediatePath,
baseName + ".js")});
if (product.moduleProperty("typescript", "generateDeclarations")) {
artifacts.push({fileTags: ["typescript_declaration"],
filePath: filePath + ".d.ts"});
}
if (product.moduleProperty("typescript", "generateSourceMaps")) {
artifacts.push({fileTags: ["source_map"],
filePath: filePath + ".js.map"});
}
}
}
return artifacts;
}
function outOption(product) {
var compilerVersionMajor = ModUtils.moduleProperty(product, "versionMajor");
if (compilerVersionMajor === 1) {
if (ModUtils.moduleProperty(product, "versionMinor") < 6) {
return "--out";
}
}
return "--outFile";
}
function supportsModernFeatures(product) {
var compilerVersionMajor = ModUtils.moduleProperty(product, "versionMajor");
if (compilerVersionMajor === 1) {
if (ModUtils.moduleProperty(product, "versionMinor") >= 5) {
return true;
}
}
return compilerVersionMajor > 1;
}
qbs-src-2.6.1/share/qbs/modules/typescript/qbs-tsc-scan/ 0000755 0001751 0000166 00000000000 14776170045 022513 5 ustar runner docker qbs-src-2.6.1/share/qbs/modules/typescript/qbs-tsc-scan/qbs-tsc-scan.ts 0000644 0001751 0000166 00000005167 14776170045 025372 0 ustar runner docker import ts = require("typescript");
declare var process: any;
export namespace io.qt.qbs {
export class Artifact {
filePath: string;
fileTags: string[];
}
export namespace tools {
export namespace utils {
function stringEndsWith(s: string, e: string) {
return s.slice(-e.length) === e;
}
export function artifactFromFilePath(filePath: string): Artifact {
var fileTags: string[] = [];
if (stringEndsWith(filePath, ".js.map")) {
fileTags.push("source_map");
} else if (stringEndsWith(filePath, ".js")) {
fileTags.push("js", "compiled_typescript");
} else if (stringEndsWith(filePath, ".d.ts")) {
fileTags.push("typescript_declaration");
}
return { filePath: filePath, fileTags: fileTags };
}
}
function compileInternal(fileNames: string[], options: ts.CompilerOptions): qbs.Artifact[] {
var outputArtifacts: qbs.Artifact[] = [];
var program = ts.createProgram(fileNames, options);
var emitResult = program.emit(undefined, filePath => {
outputArtifacts.push(utils.artifactFromFilePath(filePath));
});
var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
allDiagnostics.forEach(diagnostic => {
var message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
if (diagnostic.file) {
var { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
console.error(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
} else {
console.error(message);
}
});
return emitResult.emitSkipped ? undefined : outputArtifacts;
}
export function compile(commandLineArguments: string[]): qbs.Artifact[] {
var parsedCommandLine = ts.parseCommandLine(commandLineArguments);
return compileInternal(parsedCommandLine.fileNames, parsedCommandLine.options);
}
export function TypeScriptCompilerScannerToolMain(): void {
var outputArtifacts = compile(process.argv.slice(2));
if (outputArtifacts !== undefined) {
console.log(JSON.stringify(outputArtifacts));
} else {
process.exit(1);
}
}
}
}
io.qt.qbs.tools.TypeScriptCompilerScannerToolMain();
qbs-src-2.6.1/share/qbs/modules/typescript/qbs-tsc-scan/.gitignore 0000644 0001751 0000166 00000000161 14776170045 024501 0 ustar runner docker # Visual Studio Code IDE
tsconfig.json
qbs-tsc-scan.js
typings/node/node.d.ts
typings/typescript/typescript.d.ts
qbs-src-2.6.1/share/qbs/modules/typescript/TypeScriptModule.qbs 0000644 0001751 0000166 00000030553 14776170045 024206 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.ModUtils
import qbs.Probes
import qbs.Process
import "typescript.js" as TypeScript
Module {
// Qbs does NOT support standalone TypeScript installations
// (for example, %PROGRAMFILES%\Microsoft SDKs\TypeScript and some Debian and RPM packages),
// because they do not include typescript.d.ts, which is necessary for building internal tools.
// Only npm-based installations of TypeScript are supported (this is also the most common).
Depends { name: "nodejs" }
additionalProductTypes: ["compiled_typescript"]
Probes.TypeScriptProbe {
id: tsc
interpreterPath: FileInfo.path(nodejs.interpreterFilePath)
packageManagerBinPath: nodejs.packageManagerBinPath
packageManagerRootPath: nodejs.packageManagerRootPath
}
property path toolchainInstallPath: tsc.path
property path toolchainLibDirName: (versionMajor > 1 || (versionMajor === 1 && versionMinor >= 6)) ? "lib" : "bin"
property path toolchainLibInstallPath: FileInfo.joinPaths(nodejs.packageManagerRootPath, "typescript", toolchainLibDirName)
version: tsc.version ? tsc.version[2] : undefined
property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : []
property int versionMajor: versionParts[0]
property int versionMinor: versionParts[1]
property int versionPatch: versionParts[2]
property int versionBuild: versionParts[3]
property string versionSuffix: tsc.version ? tsc.version[3] : undefined
property string compilerName: tsc.fileName
property string compilerPath: tsc.filePath
property string warningLevel: "normal"
PropertyOptions {
name: "warningLevel"
description: "pedantic to warn on expressions and declarations with an implied 'any' type"
allowedValues: ["normal", "pedantic"]
}
property string targetVersion
PropertyOptions {
name: "targetVersion"
description: "ECMAScript target version"
allowedValues: ["ES3", "ES5", "ES2015"]
}
property string moduleLoader
PropertyOptions {
name: "moduleLoader"
allowedValues: ["commonjs", "amd"]
}
property bool stripComments: !qbs.debugInformation
PropertyOptions {
name: "stripComments"
description: "whether to remove comments from the generated output"
}
property bool generateDeclarations: false
PropertyOptions {
name: "generateDeclarations"
description: "whether to generate corresponding .d.ts files during compilation"
}
// In release mode, nodejs can/should default-enable minification and obfuscation,
// making the source maps useless, so these default settings work out fine
property bool generateSourceMaps: qbs.debugInformation
PropertyOptions {
name: "generateSourceMaps"
description: "whether to generate corresponding .map files during compilation"
}
property stringList compilerFlags
PropertyOptions {
name: "compilerFlags"
description: "additional flags for the TypeScript compiler"
}
property bool singleFile: false
PropertyOptions {
name: "singleFile"
description: "whether to compile all source files to a single output file"
}
validate: {
var interpreterMessage = "TypeScript requires the Node.js interpreter to be called 'node'.";
if (File.exists("/etc/debian_version")) {
interpreterMessage += " Did you forget to install the nodejs-legacy package? " +
"See https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html " +
"for more information.";
}
var preValidator = new ModUtils.PropertyValidator("nodejs");
preValidator.addCustomValidator("interpreterFileName", nodejs.interpreterFileName, function (value) {
return value === "node" + FileInfo.executableSuffix();
}, interpreterMessage);
preValidator.addCustomValidator("interpreterFilePath", nodejs.interpreterFilePath, function (value) {
return value.endsWith(nodejs.interpreterFileName);
}, interpreterMessage);
preValidator.validate();
var validator = new ModUtils.PropertyValidator("typescript");
validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath);
validator.setRequiredProperty("compilerName", compilerName);
validator.setRequiredProperty("compilerPath", compilerPath);
validator.setRequiredProperty("version", version);
validator.setRequiredProperty("versionParts", versionParts);
validator.setRequiredProperty("versionMajor", versionMajor);
validator.setRequiredProperty("versionMinor", versionMinor);
validator.setRequiredProperty("versionPatch", versionPatch);
validator.addVersionValidator("version", version, 3, 4);
validator.addRangeValidator("versionMajor", versionMajor, 1);
validator.addRangeValidator("versionMinor", versionMinor, 0);
validator.addRangeValidator("versionPatch", versionPatch, 0);
if (versionParts && versionParts.length >= 4) {
validator.setRequiredProperty("versionBuild", versionBuild);
validator.addRangeValidator("versionBuild", versionBuild, 0);
}
validator.validate();
}
// TypeScript declaration files
FileTagger {
patterns: ["*.d.ts"]
fileTags: ["typescript_declaration"]
}
// TypeScript source files
FileTagger {
patterns: ["*.ts"]
fileTags: ["typescript"]
}
Group {
name: "io.qt.qbs.internal.typescript-helper"
files: [
FileInfo.joinPaths(path, "qbs-tsc-scan", "qbs-tsc-scan.ts"),
FileInfo.joinPaths(typescript.toolchainLibInstallPath, "typescript.d.ts"),
FileInfo.joinPaths(typescript.toolchainLibInstallPath, "..", "package.json")
]
fileTags: ["typescript.typescript-internal"]
}
Rule {
multiplex: true
inputs: ["typescript.typescript-internal"]
outputFileTags: ["typescript.compiled_typescript-internal"]
outputArtifacts: {
if (!TypeScript.supportsModernFeatures(product))
return [];
return [{
filePath: FileInfo.joinPaths(product.buildDirectory,
".io.qt.qbs.internal.typescript", "qbs-tsc-scan.ts"),
fileTags: ["typescript.typescript-internal.copy"]
},
{
filePath: FileInfo.joinPaths(product.buildDirectory,
".io.qt.qbs.internal.typescript",
"node_modules", "typescript", "lib", "typescript.d.ts"),
fileTags: ["typescript.typescript-internal.copy"]
},
{
filePath: FileInfo.joinPaths(product.buildDirectory,
".io.qt.qbs.internal.typescript",
"node_modules", "typescript", "package.json"),
fileTags: ["typescript.typescript-internal.copy"]
},
{
filePath: FileInfo.joinPaths(product.buildDirectory,
".io.qt.qbs.internal.typescript", "qbs-tsc-scan.js"),
fileTags: ["typescript.compiled_typescript-internal"]
}];
}
prepare: {
var inputPaths = inputs["typescript.typescript-internal"].map(function (input) {
return input.filePath;
});
var outputPaths = outputs["typescript.typescript-internal.copy"].map(function (output) {
return output.filePath;
});
var sortFunc = function (a, b) {
return FileInfo.fileName(a).localeCompare(FileInfo.fileName(b));
};
var jcmd = new JavaScriptCommand();
jcmd.ignoreDryRun = true;
jcmd.silent = true;
jcmd.inputPaths = inputPaths.sort(sortFunc);
jcmd.outputPaths = outputPaths.sort(sortFunc);
jcmd.sourceCode = function() {
for (var i = 0; i < inputPaths.length; ++i)
File.copy(inputPaths[i], outputPaths[i]);
};
var outDir = FileInfo.path(
outputs["typescript.compiled_typescript-internal"][0].filePath);
var args = ["--module", "commonjs",
"--outDir", outDir].concat(outputPaths.filter(function (f) { return !f.endsWith(".json"); }));
var cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"), args);
cmd.ignoreDryRun = true;
cmd.silent = true;
return [jcmd, cmd];
}
}
Rule {
id: typescriptCompiler
multiplex: true
inputs: ["typescript"]
inputsFromDependencies: ["typescript_declaration"]
explicitlyDependsOn: ["typescript.compiled_typescript-internal"]
outputArtifacts: TypeScript.outputArtifacts(product, inputs)
outputFileTags: ["application_js", "compiled_typescript", "js", "source_map", "typescript_declaration"]
prepare: {
var cmd, cmds = [];
cmd = new Command(ModUtils.moduleProperty(product, "compilerPath"),
TypeScript.tscArguments(product, inputs));
cmd.description = "compiling " + (ModUtils.moduleProperty(product, "singleFile")
? outputs.compiled_typescript[0].fileName
: inputs.typescript.map(function(obj) {
return obj.fileName; }).join(", "));
cmd.highlight = "compiler";
cmds.push(cmd);
// QBS-5
// Move the compiled JavaScript files compiled by TypeScript to an intermediate
// directory so that the nodejs module can perform any necessary postprocessing
// on the result. The nodejs module will move the files back to their original
// locations after postprocessing.
cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.outDir = product.buildDirectory;
cmd.sourceCode = function() {
for (var i = 0; i < outputs.compiled_typescript.length; ++i) {
var output = outputs.compiled_typescript[i];
var intermediatePath = FileInfo.path(FileInfo.relativePath(product.moduleProperty("nodejs", "compiledIntermediateDir"), output.filePath));
var originalFilePath = FileInfo.joinPaths(outDir, intermediatePath, output.fileName);
File.copy(originalFilePath, output.filePath);
File.remove(originalFilePath);
}
};
cmds.push(cmd);
return cmds;
}
}
}
qbs-src-2.6.1/share/qbs/module-providers/ 0000755 0001751 0000166 00000000000 14776170045 017637 5 ustar runner docker qbs-src-2.6.1/share/qbs/module-providers/conan.js 0000644 0001751 0000166 00000022206 14776170045 021275 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2024 Kai Dohmen
** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com).
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var PathProbe = require("../imports/qbs/Probes/path-probe.js")
var PathTools = require("qbs.PathTools");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
const architectureMap = {
'x86': 'x86',
'x86_64': 'x86_64',
'ppc32be': 'ppc',
'ppc32': 'ppc',
'ppc64le': 'ppc64',
'ppc64': 'ppc64',
'armv4': 'arm',
'armv4i': 'arm',
'armv5el': 'arm',
'armv5hf': 'arm',
'armv6': 'arm',
'armv7': 'arm',
'armv7hf': 'arm',
'armv7s': 'arm',
'armv7k': 'arm',
'armv8': 'arm64',
'armv8_32': 'arm64',
'armv8.3': 'arm64',
'sparc': 'sparc',
'sparcv9': 'sparc64',
'mips': 'mips',
'mips64': 'mips64',
'avr': 'avr',
's390': 's390x',
's390x': 's390x',
'sh4le': 'sh'
}
const platformMap = {
'Windows': 'windows',
'WindowsStore': 'windows',
'WindowsCE': 'windows',
'Linux': 'linux',
'Macos': 'macos',
'Android': 'android',
'iOS': 'ios',
'watchOS': 'watchos',
'tvOS': 'tvos',
'FreeBSD': 'freebsd',
'SunOS': 'solaris',
'AIX': 'aix',
'Emscripten': undefined,
'Arduino': 'none',
'Neutrino': 'qnx',
'VxWorks': 'vxworks',
}
function findLibs(libnames, libdirs, libtypes, targetOS, forImport) {
var result = [];
if (libnames === null || libdirs === null)
return result;
libnames.forEach(function(libraryName) {
const suffixes = PathTools.librarySuffixes(targetOS, libtypes, forImport);
const lib = PathProbe.configure(
undefined, // selectors
[libraryName],
suffixes,
PathTools.libraryNameFilter(),
undefined, // candidateFilter
libdirs, // searchPaths
undefined, // pathSuffixes
[], // platformSearchPaths
undefined, // environmentPaths
undefined // platformEnvironmentPaths
);
if (lib.found)
result.push(lib.files[0].filePath);
});
return result;
}
function getLibraryTypes(options) {
if (options !== undefined && options !== null) {
if (options.shared === undefined)
return ["shared", "static"];
else if (options.shared === "True")
return ["shared"];
else if (options.shared === "False")
return ["static"];
}
return ["shared", "static"];
}
function configure(installDirectory, moduleName, outputBaseDir, jsonProbe) {
const moduleMapping = {"protobuflib": "protobuf"}
const realModuleName = moduleMapping[moduleName] || moduleName;
const moduleFilePath =
FileInfo.joinPaths(installDirectory, "conan-qbs-deps", realModuleName + ".json")
if (!File.exists(moduleFilePath))
return [];
var reverseMapping = {}
for (var key in moduleMapping)
reverseMapping[moduleMapping[key]] = key
console.info("Setting up Conan module '" + moduleName + "'");
var moduleFile = new TextFile(moduleFilePath, TextFile.ReadOnly);
const moduleInfo = JSON.parse(moduleFile.readAll());
const outputDir = FileInfo.joinPaths(outputBaseDir, "modules", moduleName.replace(".", "/"));
File.makePath(outputDir);
const outputFilePath = FileInfo.joinPaths(outputDir, "module.qbs");
const cppInfo = moduleInfo.cpp_info;
var moduleContent = "";
// function write(data) { moduleContent = moduleContent + data }
function writeLine(data) { moduleContent = moduleContent + data + "\n"; }
function writeProperty(propertyName, propertyValue) {
if (propertyValue === undefined || propertyValue === null)
propertyValue = [];
writeLine(" readonly property stringList " + propertyName
+ ": " + ModUtils.toJSLiteral(propertyValue));
}
function writeCppProperty(propertyName, propertyValue) {
writeProperty(propertyName, propertyValue);
// skip empty props for simplicity of the module file
if (propertyValue !== undefined && propertyValue != null && propertyValue.length !== 0) {
writeLine(" cpp." + propertyName + ": " + propertyName);
}
}
writeLine("Module {");
writeLine(" version: " + ModUtils.toJSLiteral(moduleInfo.version));
const architecture = architectureMap[moduleInfo.settings.arch];
const platform = platformMap[moduleInfo.settings.os];
const targetOS = Utilities.canonicalPlatform(platform);
writeLine(" readonly property string architecture: " + ModUtils.toJSLiteral(architecture));
if (platform !== undefined)
writeLine(" readonly property string platform: " + ModUtils.toJSLiteral(platform));
writeLine(" condition: true");
if (architecture !== undefined) {
writeLine(" && (!qbs.architecture || qbs.architecture === architecture)");
}
if (platform !== undefined) {
if (["ios", "tvos", "watchos"].includes(platform)) {
writeLine(" && (qbs.targetPlatform === platform || qbs.targetPlatform === platform + \"-simulator\")");
} else {
writeLine(" && qbs.targetPlatform === platform");
}
}
writeLine(" Depends { name: 'cpp' }");
moduleInfo.dependencies.forEach(function(dep) {
const realDepName = reverseMapping[dep.name] || dep.name;
writeLine(" Depends { name: " + ModUtils.toJSLiteral(realDepName)
+ "; version: " + ModUtils.toJSLiteral(dep.version) + "}");
});
const buildBindirs = FileInfo.fromNativeSeparators(moduleInfo.build_bindirs);
writeLine(" readonly property stringList hostBinDirs: (" + ModUtils.toJSLiteral(buildBindirs) + ")");
const targetBindirs = FileInfo.fromNativeSeparators(cppInfo.bindirs);
writeLine(" readonly property stringList binDirs: (" + ModUtils.toJSLiteral(targetBindirs) + ")");
// TODO: there's a weird issue with system include dirs with xcode-less clang - incorrect include order?
writeCppProperty("includePaths", FileInfo.fromNativeSeparators(cppInfo.includedirs));
writeCppProperty("frameworkPaths", FileInfo.fromNativeSeparators(cppInfo.frameworkdirs));
writeCppProperty("frameworks", cppInfo.frameworks);
writeCppProperty("defines", cppInfo.defines);
writeCppProperty("cFlags", cppInfo.cflags);
writeCppProperty("cxxFlags", cppInfo.cxxflags);
writeCppProperty("linkerFlags", (cppInfo.sharedlinkflags || []).concat(cppInfo.exelinkflags || []));
writeProperty("resources", FileInfo.fromNativeSeparators(cppInfo.resdirs));
const isForImport = targetOS.includes("windows")
const libraryTypes = getLibraryTypes(moduleInfo.options);
libraryTypes.forEach(function(libraryType){
const cppInfoLibs = cppInfo.libs === null ? [] : cppInfo.libs;
const libdirs = FileInfo.fromNativeSeparators(cppInfo.libdirs);
const libs = findLibs(cppInfoLibs, libdirs, libraryType, targetOS, isForImport)
.concat(cppInfo.system_libs === null ? [] : cppInfo.system_libs);
const property = libraryType === "shared" ? "dynamicLibraries" : "staticLibraries";
writeCppProperty(property, libs);
});
writeLine("}");
var moduleFile = new TextFile(outputFilePath, TextFile.WriteOnly);
moduleFile.write(moduleContent);
moduleFile.close();
return "";
}
qbs-src-2.6.1/share/qbs/module-providers/qbspkgconfig.qbs 0000644 0001751 0000166 00000021236 14776170045 023027 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2021 Ivan Komissarov (abbapoh@gmail.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import qbs.Environment
import qbs.File
import qbs.FileInfo
import qbs.Host
import qbs.ModUtils
import qbs.PkgConfig
import qbs.ProviderUtils
import qbs.Probes
import qbs.Process
import qbs.TextFile
import "Qt/setup-qt.js" as SetupQt
ModuleProvider {
property stringList executableNames: ["pkgconf", "pkg-config"]
property string executableFilePath: pkgConfigProbe.filePath
property stringList extraPaths
property stringList libDirs
property bool staticMode: false
property bool definePrefix: Host.os().includes("windows")
// We take the sysroot default from qbs.sysroot, except for Xcode toolchains, where
// the sysroot points into the Xcode installation and does not contain .pc files.
property path sysroot: qbs.toolchain && qbs.toolchain.includes("xcode")
? undefined : qbs.sysroot
Probes.BinaryProbe {
id: pkgConfigProbe
condition: !executableFilePath
names: executableNames
}
Probes.QbsPkgConfigProbe {
id: theProbe
_executableFilePath: executableFilePath
_extraPaths: extraPaths
_sysroot: sysroot
_libDirs: libDirs
_staticMode: staticMode
_definePrefix: definePrefix
}
Probes.QmakeProbe {
id: qmakeProbe
condition: moduleName.startsWith("Qt") && theProbe.qmakePaths
qmakePaths: theProbe.qmakePaths
}
isEager: false
relativeSearchPaths: {
function getModuleInfo(pkg, staticMode) {
var result = {};
var mapper = function(flag) { return flag.value; }
var typeFilter = function(type) {
return function(flag) { return flag.type === type; }
}
function getLibsInfo(libs) {
var result = {};
result.dynamicLibraries = libs.filter(typeFilter(PkgConfig.LibraryName)).map(mapper);
result.staticLibraries =
libs.filter(typeFilter(PkgConfig.StaticLibraryName)).map(mapper);
result.libraryPaths = libs.filter(typeFilter(PkgConfig.LibraryPath)).map(mapper);
result.frameworks = libs.filter(typeFilter(PkgConfig.Framework)).map(mapper);
result.frameworkPaths =
libs.filter(typeFilter(PkgConfig.FrameworkPath)).map(mapper);
result.driverLinkerFlags =
libs.filter(typeFilter(PkgConfig.LinkerFlag)).map(mapper);
return result;
}
result.version = pkg.version;
result.includePaths = pkg.cflags.filter(typeFilter(PkgConfig.IncludePath)).map(mapper);
result.systemIncludePaths =
pkg.cflags.filter(typeFilter(PkgConfig.SystemIncludePath)).map(mapper);
result.defines = pkg.cflags.filter(typeFilter(PkgConfig.Define)).map(mapper);
result.commonCompilerFlags =
pkg.cflags.filter(typeFilter(PkgConfig.CompilerFlag)).map(mapper);
var allLibs = pkg.libs;
if (staticMode)
allLibs = allLibs.concat(pkg.libsPrivate);
var libsInfo = getLibsInfo(allLibs);
for (var key in libsInfo) {
result[key] = libsInfo[key];
}
return result;
}
function getModuleDependencies(pkg, staticMode) {
var mapper = function(p) {
var result = {};
for (var key in p)
result[key] = p[key];
result.name = ProviderUtils.pkgConfigToModuleName(result.name);
return result;
}
var result = pkg.requires.map(mapper);
if (staticMode)
result = result.concat(pkg.requiresPrivate.map(mapper));
return result;
}
console.debug("Running pkgconfig provider for " + moduleName + ".");
var outputDir = FileInfo.joinPaths(outputBaseDir, "modules");
File.makePath(outputDir);
var moduleMapping = {
"protobuf": "protobuflib"
}
var reverseMapping = {}
for (var key in moduleMapping)
reverseMapping[moduleMapping[key]] = key
if (moduleName.startsWith("Qt")) {
function setupQt(packageName, qtInfos) {
if (qtInfos === undefined || qtInfos.length === 0)
return [];
var qtProviderDir = FileInfo.joinPaths(path, "Qt");
return SetupQt.doSetup(packageName, qtInfos, outputBaseDir, qtProviderDir);
}
if (!sysroot) {
return setupQt(moduleName, qmakeProbe.qtInfos);
}
return [];
}
var pkg;
pkg = theProbe.packages[reverseMapping[moduleName]];
if (pkg === undefined)
pkg = theProbe.packagesByModuleName[moduleName];
if (pkg === undefined)
return [];
if (pkg.isBroken) {
console.warn("Failed to load " + moduleName + " as it's pkg-config package is broken");
return [];
}
var moduleInfo = getModuleInfo(pkg, staticMode);
var deps = getModuleDependencies(pkg, staticMode);
var moduleDir = FileInfo.joinPaths(outputDir, moduleName);
File.makePath(moduleDir);
var module =
new TextFile(FileInfo.joinPaths(moduleDir, "module.qbs"), TextFile.WriteOnly);
module.writeLine("Module {");
module.writeLine(" version: " + ModUtils.toJSLiteral(moduleInfo.version));
module.writeLine(" Depends { name: 'cpp' }");
deps.forEach(function(dep) {
var depName = ProviderUtils.pkgConfigToModuleName(
moduleMapping[dep.name] ? moduleMapping[dep.name] : dep.name);
module.write(" Depends { name: '" + depName + "'");
for (var k in dep) {
if (k === "name")
continue;
module.write("; " + k + ": " + ModUtils.toJSLiteral(dep[k]));
}
module.writeLine(" }");
})
function writeProperty(propertyName) {
var value = moduleInfo[propertyName];
if (value.length !== 0) { // skip empty props for simplicity of the module file
module.writeLine(
" cpp." + propertyName + ":" + ModUtils.toJSLiteral(value));
}
}
writeProperty("includePaths");
writeProperty("systemIncludePaths");
writeProperty("defines");
writeProperty("commonCompilerFlags");
writeProperty("dynamicLibraries");
writeProperty("staticLibraries");
writeProperty("libraryPaths");
writeProperty("frameworks");
writeProperty("frameworkPaths");
writeProperty("driverLinkerFlags");
module.writeLine("}");
module.close();
return "";
}
}
qbs-src-2.6.1/share/qbs/module-providers/conan.qbs 0000644 0001751 0000166 00000000361 14776170045 021444 0 ustar runner docker import "conan.js" as ConanHelper
ModuleProvider {
/* input */
property path installDirectory
isEager: false
relativeSearchPaths: {
return ConanHelper.configure(installDirectory, moduleName, outputBaseDir);
}
}
qbs-src-2.6.1/share/qbs/module-providers/__fallback/ 0000755 0001751 0000166 00000000000 14776170045 021674 5 ustar runner docker qbs-src-2.6.1/share/qbs/module-providers/__fallback/provider.qbs 0000644 0001751 0000166 00000004537 14776170045 024246 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
ModuleProvider {
relativeSearchPaths: {
console.debug("Running fallback provider for module '" + name + "'.");
var inputFilePath = FileInfo.joinPaths(path, "fallback.qbs");
var outputDir = FileInfo.joinPaths(outputBaseDir, "modules", name.replace(".", "/"));
File.makePath(outputDir);
var outputFilePath = FileInfo.joinPaths(outputDir, name + ".qbs");
File.copy(inputFilePath, outputFilePath);
return "";
}
}
qbs-src-2.6.1/share/qbs/module-providers/__fallback/fallback.qbs 0000644 0001751 0000166 00000006065 14776170045 024151 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import qbs.FileInfo
import qbs.Probes
Module {
Depends { name: "cpp" }
Depends { name: "pkgconfig"; required: false }
property string theName: FileInfo.completeBaseName(filePath)
readonly property bool __fallback: true // Hack, please look away
Probes.PkgConfigProbe {
id: pkgConfigProbe
condition: pkgconfig.present
sysroot: pkgconfig.sysroot
name: theName
executable: pkgconfig.executableFilePath
libDirs: pkgconfig.libDirs
forStaticBuild: pkgconfig.staticMode
}
Properties {
condition: pkgConfigProbe.found
version: pkgConfigProbe.modversion
cpp.dynamicLibraries: pkgConfigProbe.libraries
cpp.libraryPaths: pkgConfigProbe.libraryPaths
cpp.includePaths: pkgConfigProbe.includePaths
cpp.defines: pkgConfigProbe.defines
cpp.driverLinkerFlags: pkgConfigProbe.linkerFlags
cpp.commonCompilerFlags: pkgConfigProbe.compilerFlags
}
validate: {
if (!pkgConfigProbe.found) {
throw "Dependency '" + theName + "' not found for product '" + product.name + "'. "
+ "Locating a package of this name via pkg-config also failed.";
}
}
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/ 0000755 0001751 0000166 00000000000 14776170045 020223 5 ustar runner docker qbs-src-2.6.1/share/qbs/module-providers/Qt/provider.qbs 0000644 0001751 0000166 00000000650 14776170045 022565 0 ustar runner docker import "setup-qt.js" as SetupQt
import qbs.Probes
ModuleProvider {
Probes.QmakeProbe {
condition: moduleName.startsWith("Qt.")
id: probe
qmakePaths: qmakeFilePaths
}
property stringList qmakeFilePaths
readonly property varList _qtInfos: probe.qtInfos
condition: probe.found
isEager: false
relativeSearchPaths: SetupQt.doSetup(moduleName, _qtInfos, outputBaseDir, path)
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/setup-qt.js 0000644 0001751 0000166 00000055626 14776170045 022361 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
var ProviderUtils = require("qbs.ProviderUtils");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function extractQbsArchs(module, qtProps) {
if (qtProps.mkspecName.startsWith("macx-")) {
var archs = [];
if (module.libFilePathRelease)
archs = Utilities.getArchitecturesFromBinary(module.libFilePathRelease);
return archs;
}
var qbsArch = Utilities.canonicalArchitecture(qtProps.architecture);
if (qbsArch === "arm" && qtProps.mkspecPath.contains("android"))
qbsArch = "armv7a";
// Qt4 has "QT_ARCH = windows" in qconfig.pri for both MSVC and mingw.
if (qbsArch === "windows")
return []
return [qbsArch];
}
function qbsTargetPlatformFromQtMkspec(qtProps) {
var mkspec = qtProps.mkspecName;
var idx = mkspec.lastIndexOf('/');
if (idx !== -1)
mkspec = mkspec.slice(idx + 1);
if (mkspec.startsWith("aix-"))
return "aix";
if (mkspec.startsWith("android-"))
return "android";
if (mkspec.startsWith("cygwin-"))
return "windows";
if (mkspec.startsWith("darwin-"))
return "macos";
if (mkspec.startsWith("freebsd-"))
return "freebsd";
if (mkspec.startsWith("haiku-"))
return "haiku";
if (mkspec.startsWith(("hpux-")) || mkspec.startsWith(("hpuxi-")))
return "hpux";
if (mkspec.startsWith("hurd-"))
return "hurd";
if (mkspec.startsWith("integrity-"))
return "integrity";
if (mkspec.startsWith("linux-"))
return "linux";
if (mkspec.startsWith("macx-")) {
if (mkspec.startsWith("macx-ios-"))
return "ios";
if (mkspec.startsWith("macx-tvos-"))
return "tvos";
if (mkspec.startsWith("macx-watchos-"))
return "watchos";
return "macos";
}
if (mkspec.startsWith("netbsd-"))
return "netbsd";
if (mkspec.startsWith("openbsd-"))
return "openbsd";
if (mkspec.startsWith("qnx-"))
return "qnx";
if (mkspec.startsWith("solaris-"))
return "solaris";
if (mkspec.startsWith("vxworks-"))
return "vxworks";
if (ProviderUtils.isDesktopWindowsQt(qtProps) || mkspec.startsWith("winrt-"))
return "windows";
if (mkspec.startsWith("wasm-"))
return "wasm-emscripten";
}
function pathToJSLiteral(path) { return JSON.stringify(FileInfo.fromNativeSeparators(path)); }
function defaultQpaPlugin(module, qtProps) {
if (qtProps.qtMajorVersion < 5)
return undefined;
function findInPriFile(filePath) {
var priFile = new TextFile(filePath);
var magicString = "QT_DEFAULT_QPA_PLUGIN =";
while (!priFile.atEof()) {
var line = priFile.readLine().trim();
if (line.startsWith(magicString))
return line.slice(magicString.length).trim();
}
};
if (qtProps.qtMajorVersion === 5 && qtProps.qtMinorVersion < 8) {
var pluginName = findInPriFile(FileInfo.joinPaths(qtProps.mkspecBasePath, "qconfig.pri"));
if (pluginName)
return pluginName;
} else {
pluginName = findInPriFile(FileInfo.joinPaths(qtProps.mkspecBasePath, "modules",
"qt_lib_gui.pri"));
if (pluginName)
return pluginName;
var gtGuiHeadersPath = qtProps.frameworkBuild
? FileInfo.joinPaths(qtProps.libraryPath, "QtGui.framework", "Headers")
: FileInfo.joinPaths(qtProps.includePath, "QtGui");
var qtGuiConfigHeader = FileInfo.joinPaths(gtGuiHeadersPath, "qtgui-config.h");
var headerFiles = [];
headerFiles.push(qtGuiConfigHeader);
while (headerFiles.length > 0) {
var filePath = headerFiles.shift();
var headerFile = new TextFile(filePath, TextFile.ReadOnly);
var regexp = /^#define QT_QPA_DEFAULT_PLATFORM_NAME "(.+)".*$/;
var includeRegexp = /^#include "(.+)".*$/;
while (!headerFile.atEof()) {
var line = headerFile.readLine().trim();
var match = line.match(regexp);
if (match)
return 'q' + match[1];
match = line.match(includeRegexp);
if (match) {
var includedFile = match[1];
if (!FileInfo.isAbsolutePath(includedFile)) {
includedFile = FileInfo.cleanPath(
FileInfo.joinPaths(FileInfo.path(filePath), includedFile));
}
headerFiles.push(includedFile);
}
}
headerFile.close();
}
}
if (module.isStaticLibrary)
console.warn("Could not determine default QPA plugin for static Qt.");
}
function libraryFileTag(module, qtProps) {
if (module.isStaticLibrary)
return "staticlibrary";
return ProviderUtils.isMsvcQt(qtProps) || qtProps.mkspecName.startsWith("win32-g++")
? "dynamiclibrary_import" : "dynamiclibrary";
}
function findVariable(content, start) {
var result = [-1, -1];
result[0] = content.indexOf('@', start);
if (result[0] === -1)
return result;
result[1] = content.indexOf('@', result[0] + 1);
if (result[1] === -1) {
result[0] = -1;
return result;
}
var forbiddenChars = [' ', '\n'];
for (var i = 0; i < forbiddenChars.length; ++i) {
var forbidden = forbiddenChars[i];
var k = content.indexOf(forbidden, result[0] + 1);
if (k !== -1 && k < result[1])
return findVariable(content, result[0] + 1);
}
return result;
}
function minVersionJsString(minVersion) {
return !minVersion ? "" : ModUtils.toJSLiteral(minVersion);
}
function abiToArchitecture(abi) {
switch (abi) {
case "armeabi-v7a":
return "armv7a";
case "arm64-v8a":
return "arm64";
case "x86":
case "x86_64":
default:
return abi;
}
}
function replaceSpecialValues(content, module, qtProps, abi) {
var architectures = [];
if (abi.length > 0)
architectures.push(abiToArchitecture(abi));
else
architectures = extractQbsArchs(module, qtProps);
var dict = {
archs: ModUtils.toJSLiteral(architectures),
targetPlatform: ModUtils.toJSLiteral(qbsTargetPlatformFromQtMkspec(qtProps)),
config: ModUtils.toJSLiteral(qtProps.configItems),
qtConfig: ModUtils.toJSLiteral(qtProps.qtConfigItems),
enabledFeatures: ModUtils.toJSLiteral(qtProps.enabledFeatures),
disabledFeatures: ModUtils.toJSLiteral(qtProps.disabledFeatures),
binPath: ModUtils.toJSLiteral(qtProps.binaryPath),
installPath: ModUtils.toJSLiteral(qtProps.installPath),
installPrefixPath: ModUtils.toJSLiteral(qtProps.installPrefixPath),
libPath: ModUtils.toJSLiteral(qtProps.libraryPath),
libExecPath: ModUtils.toJSLiteral(qtProps.libExecPath),
qmlLibExecPath: ModUtils.toJSLiteral(qtProps.qmlLibExecPath),
pluginPath: ModUtils.toJSLiteral(qtProps.pluginPath),
incPath: ModUtils.toJSLiteral(qtProps.includePath),
docPath: ModUtils.toJSLiteral(qtProps.documentationPath),
translationsPath: ModUtils.toJSLiteral(qtProps.translationsPath),
helpGeneratorLibExecPath: ModUtils.toJSLiteral(qtProps.helpGeneratorLibExecPath),
mkspecName: ModUtils.toJSLiteral(qtProps.mkspecName),
mkspecPath: ModUtils.toJSLiteral(qtProps.mkspecPath),
version: ModUtils.toJSLiteral(qtProps.qtVersion),
libInfix: ModUtils.toJSLiteral(qtProps.qtLibInfix),
availableBuildVariants: ModUtils.toJSLiteral(qtProps.buildVariant),
staticBuild: ModUtils.toJSLiteral(qtProps.staticBuild),
multiThreading: ModUtils.toJSLiteral(qtProps.multiThreading),
frameworkBuild: ModUtils.toJSLiteral(qtProps.frameworkBuild),
name: ModUtils.toJSLiteral(ProviderUtils.qtModuleNameWithoutPrefix(module)),
has_library: ModUtils.toJSLiteral(module.hasLibrary),
dependencies: ModUtils.toJSLiteral(module.dependencies),
includes: ModUtils.toJSLiteral(module.includePaths),
staticLibsDebug: ModUtils.toJSLiteral(module.staticLibrariesDebug),
staticLibsRelease: ModUtils.toJSLiteral(module.staticLibrariesRelease),
dynamicLibsDebug: ModUtils.toJSLiteral(module.dynamicLibrariesDebug),
dynamicLibsRelease: ModUtils.toJSLiteral(module.dynamicLibrariesRelease),
linkerFlagsDebug: ModUtils.toJSLiteral(module.linkerFlagsDebug),
linkerFlagsRelease: ModUtils.toJSLiteral(module.linkerFlagsRelease),
libraryPaths: ModUtils.toJSLiteral(module.libraryPaths),
frameworkPathsDebug: ModUtils.toJSLiteral(module.frameworkPathsDebug),
frameworkPathsRelease: ModUtils.toJSLiteral(module.frameworkPathsRelease),
frameworksDebug: ModUtils.toJSLiteral(module.frameworksDebug),
frameworksRelease: ModUtils.toJSLiteral(module.frameworksRelease),
libFilePathDebug: ModUtils.toJSLiteral(module.libFilePathDebug),
libFilePathRelease: ModUtils.toJSLiteral(module.libFilePathRelease),
libNameForLinkerDebug:
ModUtils.toJSLiteral(ProviderUtils.qtLibNameForLinker(module, qtProps, true)),
pluginTypes: ModUtils.toJSLiteral(module.supportedPluginTypes),
moduleConfig: ModUtils.toJSLiteral(module.config),
libNameForLinkerRelease:
ModUtils.toJSLiteral(ProviderUtils.qtLibNameForLinker(module, qtProps, false)),
entryPointLibsDebug: ModUtils.toJSLiteral(qtProps.entryPointLibsDebug),
entryPointLibsRelease: ModUtils.toJSLiteral(qtProps.entryPointLibsRelease),
minWinVersion_optional: minVersionJsString(qtProps.windowsVersion),
minMacVersion_optional: minVersionJsString(qtProps.macosVersion),
minIosVersion_optional: minVersionJsString(qtProps.iosVersion),
minTvosVersion_optional: minVersionJsString(qtProps.tvosVersion),
minWatchosVersion_optional: minVersionJsString(qtProps.watchosVersion),
minAndroidVersion_optional: minVersionJsString(qtProps.androidVersion),
};
var additionalContent = "";
var compilerDefines = ModUtils.toJSLiteral(module.compilerDefines);
if (module.qbsName === "declarative" || module.qbsName === "quick") {
var debugMacro = module.qbsName === "declarative" || qtProps.qtMajorVersion < 5
? "QT_DECLARATIVE_DEBUG" : "QT_QML_DEBUG";
var indent = " ";
additionalContent = "property bool qmlDebugging: false\n"
+ indent + "property string qmlPath";
if (qtProps.qmlPath)
additionalContent += ": " + pathToJSLiteral(qtProps.qmlPath) + '\n';
else
additionalContent += '\n';
additionalContent += indent + "property string qmlImportsPath: "
+ pathToJSLiteral(qtProps.qmlImportPath);
compilerDefines = "{\n"
+ indent + indent + "var result = " + compilerDefines + ";\n"
+ indent + indent + "if (qmlDebugging)\n"
+ indent + indent + indent + "result.push(\"" + debugMacro + "\");\n"
+ indent + indent + "return result;\n"
+ indent + "}";
}
dict.defines = compilerDefines;
if (module.qbsName === "gui")
dict.defaultQpaPlugin = ModUtils.toJSLiteral(defaultQpaPlugin(module, qtProps));
if (module.qbsName === "qml")
dict.qmlPath = pathToJSLiteral(qtProps.qmlPath);
if (module.isStaticLibrary && module.qbsName !== "core") {
if (additionalContent)
additionalContent += "\n ";
additionalContent += "isStaticLibrary: true";
}
if (module.isPlugin) {
dict.className = ModUtils.toJSLiteral(module.pluginData.className);
dict["extends"] = ModUtils.toJSLiteral(module.pluginData["extends"]);
}
indent = " ";
var metaTypesFile = qtProps.libraryPath + "/metatypes/qt"
+ qtProps.qtMajorVersion + module.qbsName + "_metatypes.json";
if (File.exists(metaTypesFile)) {
if (additionalContent)
additionalContent += "\n" + indent;
additionalContent += "Group {\n";
additionalContent += indent + indent + "files: " + JSON.stringify(metaTypesFile) + "\n"
+ indent + indent + "filesAreTargets: true\n"
+ indent + indent + "fileTags: [\"qt.core.metatypes\"]\n"
+ indent + "}";
}
if (module.hasLibrary && !ProviderUtils.qtIsFramework(module, qtProps)) {
if (additionalContent)
additionalContent += "\n" + indent;
additionalContent += "Group {\n";
if (module.isPlugin) {
additionalContent += indent + indent
+ "condition: enableLinking\n";
}
additionalContent += indent + indent + "files: libFilePath\n"
+ indent + indent + "filesAreTargets: true\n"
+ indent + indent + "fileTags: [\"" + libraryFileTag(module, qtProps)
+ "\"]\n"
+ indent + "}";
}
dict.additionalContent = additionalContent;
for (var pos = findVariable(content, 0); pos[0] !== -1;
pos = findVariable(content, pos[0])) {
var varName = content.slice(pos[0] + 1, pos[1]);
var replacement = dict[varName] || "";
if (!replacement && varName.endsWith("_optional")) {
var prevNewline = content.lastIndexOf('\n', pos[0]);
if (prevNewline === -1)
prevNewline = 0;
var nextNewline = content.indexOf('\n', pos[0]);
if (nextNewline === -1)
prevNewline = content.length;
content = content.slice(0, prevNewline) + content.slice(nextNewline);
pos[0] = prevNewline;
} else {
content = content.slice(0, pos[0]) + replacement + content.slice(pos[1] + 1);
pos[0] += replacement.length;
}
}
return content;
}
function copyTemplateFile(fileName, targetDirectory, qtProps, abi, location, allFiles, module,
pluginMap, nonEssentialPlugins)
{
if (!File.makePath(targetDirectory)) {
throw "Cannot create directory '" + FileInfo.toNativeSeparators(targetDirectory) + "'.";
}
var sourceFile = new TextFile(FileInfo.joinPaths(location, "templates", fileName),
TextFile.ReadOnly);
var newContent = sourceFile.readAll();
if (module) {
newContent = replaceSpecialValues(newContent, module, qtProps, abi);
} else {
newContent = newContent.replace("@allPluginsByType@",
'(' + ModUtils.toJSLiteral(pluginMap) + ')');
newContent = newContent.replace("@nonEssentialPlugins@",
ModUtils.toJSLiteral(nonEssentialPlugins));
newContent = newContent.replace("@version@", ModUtils.toJSLiteral(qtProps.qtVersion));
}
sourceFile.close();
var targetPath = FileInfo.joinPaths(targetDirectory, fileName);
allFiles.push(targetPath);
var targetFile = new TextFile(targetPath, TextFile.WriteOnly);
targetFile.write(newContent);
targetFile.close();
}
function setupOneQt(moduleName, qtInfo, outputBaseDir, uniquify, location) {
var qtProps = qtInfo.qtProps;
var relativeSearchPaths = [];
for (a = 0; a < qtInfo.abiInfos.length; ++a) {
var abiInfo = qtInfo.abiInfos[a];
var androidAbi = abiInfo.androidAbi;
if (qtInfo.abiInfos.length > 1)
console.info("Configuring abi '" + androidAbi + "'...");
var relativeSearchPath = uniquify ? Utilities.getHash(qtInfo.qmakeFilePath) : "";
relativeSearchPath = FileInfo.joinPaths(relativeSearchPath, androidAbi);
var qbsQtModuleBaseDir = FileInfo.joinPaths(outputBaseDir, relativeSearchPath,
"modules", "Qt");
// TODO:
// if (File.exists(qbsQtModuleBaseDir))
// File.remove(qbsQtModuleBaseDir);
var allFiles = [];
if (moduleName === "plugin_support") {
copyTemplateFile("plugin_support.qbs",
FileInfo.joinPaths(qbsQtModuleBaseDir, "plugin_support"), qtProps,
androidAbi, location, allFiles, undefined, abiInfo.pluginsByType,
abiInfo.nonEssentialPlugins);
relativeSearchPaths.push(relativeSearchPath);
return relativeSearchPaths;
} else if (moduleName === "android_support") {
// Note that it's not strictly necessary to copy this one, as it has no variable content.
// But we do it anyway for consistency.
copyTemplateFile("android_support.qbs",
FileInfo.joinPaths(qbsQtModuleBaseDir, "android_support"),
qtProps, androidAbi, location, allFiles);
copyTemplateFile("android_support.js",
FileInfo.joinPaths(qbsQtModuleBaseDir, "android_support"),
qtProps, androidAbi, location, allFiles);
relativeSearchPaths.push(relativeSearchPath);
return relativeSearchPaths;
} else if (moduleName === "qmlcache") {
var qmlcacheStr = "qmlcache";
if (File.exists(FileInfo.joinPaths(qtProps.qmlLibExecPath,
"qmlcachegen" + FileInfo.executableSuffix()))) {
copyTemplateFile(qmlcacheStr + ".qbs",
FileInfo.joinPaths(qbsQtModuleBaseDir, qmlcacheStr), qtProps,
androidAbi, location, allFiles);
}
relativeSearchPaths.push(relativeSearchPath);
return relativeSearchPaths;
}
if (abiInfo.modules[moduleName] !== undefined) {
var module = abiInfo.modules[moduleName];
var qbsQtModuleDir = FileInfo.joinPaths(qbsQtModuleBaseDir, module.qbsName);
var moduleTemplateFileName;
if (module.qbsName === "core") {
moduleTemplateFileName = "core.qbs";
copyTemplateFile("core.js", qbsQtModuleDir, qtProps, androidAbi, location,
allFiles);
copyTemplateFile("moc.js", qbsQtModuleDir, qtProps, androidAbi, location,
allFiles);
copyTemplateFile("qdoc.js", qbsQtModuleDir, qtProps, androidAbi, location,
allFiles);
copyTemplateFile("rcc.js", qbsQtModuleDir, qtProps, androidAbi, location,
allFiles);
} else if (module.qbsName === "gui") {
moduleTemplateFileName = "gui.qbs";
} else if (module.qbsName === "scxml") {
moduleTemplateFileName = "scxml.qbs";
} else if (module.qbsName === "dbus") {
moduleTemplateFileName = "dbus.qbs";
copyTemplateFile("dbus.js", qbsQtModuleDir, qtProps, androidAbi, location,
allFiles);
} else if (module.qbsName === "qml") {
moduleTemplateFileName = "qml.qbs";
copyTemplateFile("qml.js", qbsQtModuleDir, qtProps, androidAbi, location,
allFiles);
} else if (module.qbsName === "quick") {
moduleTemplateFileName = "quick.qbs";
copyTemplateFile("quick.js", qbsQtModuleDir, qtProps, androidAbi, location,
allFiles);
copyTemplateFile("rcc.js", qbsQtModuleDir, qtProps, androidAbi, location,
allFiles);
} else if (module.isPlugin) {
moduleTemplateFileName = "plugin.qbs";
} else {
moduleTemplateFileName = "module.qbs";
}
copyTemplateFile(moduleTemplateFileName, qbsQtModuleDir, qtProps, androidAbi,
location, allFiles, module);
relativeSearchPaths.push(relativeSearchPath);
}
}
return relativeSearchPaths;
}
function doSetup(moduleName, qtInfos, outputBaseDir, location) {
if (!qtInfos || qtInfos.length === 0)
return [];
var uniquifySearchPath = qtInfos.length > 1;
var allSearchPaths = [];
moduleName = moduleName.substring(3);
for (var i = 0; i < qtInfos.length; ++i) {
try {
console.info("Setting up Qt module '" + moduleName + "' for Qt located at '"
+ FileInfo.toNativeSeparators(qtInfos[i].qmakeFilePath) + "'.");
var searchPaths = setupOneQt(moduleName, qtInfos[i], outputBaseDir, uniquifySearchPath,
location);
if (searchPaths.length > 0) {
for (var j = 0; j < searchPaths.length; ++j )
allSearchPaths.push(searchPaths[j]);
}
} catch (e) {
console.warn("Error setting up Qt module '" + moduleName + "' for '"
+ FileInfo.toNativeSeparators(qtInfos[i].qmakeFilePath) + "': " + e);
throw e;
}
}
return allSearchPaths;
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/ 0000755 0001751 0000166 00000000000 14776170045 022221 5 ustar runner docker qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/plugin.qbs 0000644 0001751 0000166 00000001634 14776170045 024232 0 ustar runner docker QtPlugin {
qtModuleName: @name@
Depends { name: "Qt"; submodules: @dependencies@}
version: @version@
className: @className@
architectures: @archs@
targetPlatform: @targetPlatform@
staticLibsDebug: @staticLibsDebug@
staticLibsRelease: @staticLibsRelease@
dynamicLibsDebug: @dynamicLibsDebug@
dynamicLibsRelease: @dynamicLibsRelease@
linkerFlagsDebug: @linkerFlagsDebug@
linkerFlagsRelease: @linkerFlagsRelease@
frameworksDebug: @frameworksDebug@
frameworksRelease: @frameworksRelease@
frameworkPathsDebug: @frameworkPathsDebug@
frameworkPathsRelease: @frameworkPathsRelease@
libNameForLinkerDebug: @libNameForLinkerDebug@
libNameForLinkerRelease: @libNameForLinkerRelease@
libFilePathDebug: @libFilePathDebug@
libFilePathRelease: @libFilePathRelease@
cpp.libraryPaths: @libraryPaths@
extendsModules: @extends@
@additionalContent@
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/qmlcache.qbs 0000644 0001751 0000166 00000005630 14776170045 024511 0 ustar runner docker import qbs.File
import qbs.FileInfo
import qbs.Process
import qbs.Utilities
Module {
additionalProductTypes: ["qt.qml.qmlc", "qt.qml.jsc"]
validate: {
if (!qmlcachegenProbe.found)
throw "qmlcachegen unsupported for this target";
}
property string qmlCacheGenPath: FileInfo.joinPaths(Qt.core.qmlLibExecPath, "qmlcachegen")
+ FileInfo.executableSuffix()
property bool supportsAllArchitectures: Utilities.versionCompare(Qt.core.version, "5.11") >= 0
property string installDir
readonly property stringList _targetArgs: {
if (supportsAllArchitectures)
return [];
function translateArch(arch) {
if (arch === "x86")
return "i386";
if (arch.startsWith("armv"))
return "arm";
return arch;
}
var args = ["--target-architecture", translateArch(qbs.architecture)];
return args;
}
Depends { name: "Qt.core" }
Probe {
id: qmlcachegenProbe
property string arch: qbs.architecture
property string _qmlCacheGenPath: qmlCacheGenPath
property stringList targetArgs: _targetArgs
property bool _supportsAllArchitectures: supportsAllArchitectures
configure: {
if (_supportsAllArchitectures) {
found = File.exists(_qmlCacheGenPath);
return;
}
var process = new Process();
found = false;
try {
found = process.exec(_qmlCacheGenPath,
targetArgs.concat("--check-if-supported")) == 0;
if (!found) {
var msg = "QML cache generation was requested but is unsupported on "
+ "architecture '" + arch + "'.";
console.warn(msg);
}
} finally {
process.close();
}
}
}
Rule {
condition: qmlcachegenProbe.found
inputs: ["qt.qml.qml", "qt.qml.js"]
outputArtifacts: [{
filePath: input.fileName + 'c',
fileTags: input.fileTags.filter(function(tag) {
return tag === "qt.qml.qml" || tag === "qt.qml.js";
})[0] + 'c'
}]
outputFileTags: ["qt.qml.qmlc", "qt.qml.jsc"]
prepare: {
var args = input.Qt.qmlcache._targetArgs.concat(input.filePath, "-o", output.filePath);
var cmd = new Command(input.Qt.qmlcache.qmlCacheGenPath, args);
cmd.description = "precompiling " + input.fileName;
cmd.highlight = "compiler";
return cmd;
}
}
Group {
condition: product.Qt.qmlcache.installDir !== undefined
fileTagsFilter: product.Qt.qmlcache.additionalProductTypes
qbs.install: true
qbs.installDir: product.Qt.qmlcache.installDir
}
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/dbus.js 0000644 0001751 0000166 00000006004 14776170045 023514 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
function outputFileName(input, suffix)
{
var parts = input.fileName.split('.').filter(function(s) { return s.length > 0; });
if (parts.length === 0)
throw "Cannot run qdbusxml2cpp on '" + input.filePath + "': Unsuitable file name.";
var outputBaseName = parts.length === 1 ? parts[0] : parts[parts.length - 2];
return outputBaseName.toLowerCase() + suffix;
}
function createCommands(product, input, outputs, option)
{
var exe = ModUtils.moduleProperty(product, "binPath") + '/'
+ ModUtils.moduleProperty(product, "xml2cppName");
var hppOutput = outputs["hpp"][0];
var hppArgs = ModUtils.moduleProperty(product, "xml2CppHeaderFlags");
hppArgs.push(option, hppOutput.fileName + ':', input.filePath); // Can't use filePath on Windows
var hppCmd = new Command(exe, hppArgs)
hppCmd.description = "qdbusxml2cpp " + input.fileName + " -> " + hppOutput.fileName;
hppCmd.highlight = "codegen";
hppCmd.workingDirectory = FileInfo.path(hppOutput.filePath);
var cppOutput = outputs["cpp"][0];
var cppArgs = ModUtils.moduleProperty(product, "xml2CppSourceFlags");
cppArgs.push("-i", hppOutput.filePath, option, ':' + cppOutput.fileName, input.filePath);
var cppCmd = new Command(exe, cppArgs)
cppCmd.description = "qdbusxml2cpp " + input.fileName + " -> " + cppOutput.fileName;
cppCmd.highlight = "codegen";
cppCmd.workingDirectory = FileInfo.path(cppOutput.filePath);
return [hppCmd, cppCmd];
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/rcc.js 0000644 0001751 0000166 00000010052 14776170045 023324 0 ustar runner docker var FileInfo = require("qbs.FileInfo");
var Utilities = require("qbs.Utilities");
var Xml = require("qbs.Xml");
function fullPath(product)
{
if (Utilities.versionCompare(product.Qt.core.version, "6.1") < 0)
return product.Qt.core.binPath + '/' + product.Qt.core.rccName;
return product.Qt.core.libExecPath + '/' + product.Qt.core.rccName;
}
function generateQrcFileCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
cmd.description = "generating " + output.fileName;
cmd.sourceCode = function() {
var doc = new Xml.DomDocument("RCC");
var rccNode = doc.createElement("RCC");
rccNode.setAttribute("version", "1.0");
doc.appendChild(rccNode);
var inputsByPrefix = {}
for (var i = 0; i < inputs["qt.core.resource_data"].length; ++i) {
var inp = inputs["qt.core.resource_data"][i];
var prefix = inp.Qt.core.resourcePrefix;
var inputsList = inputsByPrefix[prefix] || [];
inputsList.push(inp);
inputsByPrefix[prefix] = inputsList;
}
for (var prefix in inputsByPrefix) {
var qresourceNode = doc.createElement("qresource");
qresourceNode.setAttribute("prefix", prefix);
rccNode.appendChild(qresourceNode);
for (var i = 0; i < inputsByPrefix[prefix].length; ++i) {
var inp = inputsByPrefix[prefix][i];
var fullResPath = inp.filePath;
var baseDir = inp.Qt.core.resourceSourceBase;
var resAlias = baseDir
? FileInfo.relativePath(baseDir, fullResPath) : inp.fileName;
var fileNode = doc.createElement("file");
fileNode.setAttribute("alias", resAlias);
qresourceNode.appendChild(fileNode);
var fileTextNode = doc.createTextNode(fullResPath);
fileNode.appendChild(fileTextNode);
}
}
doc.save(output.filePath, 4);
};
return [cmd];
}
function rccOutputArtifacts(input)
{
var artifact = {
filePath: "qrc_" + input.completeBaseName + ".cpp",
fileTags: ["cpp"]
};
if (input.Qt.core.enableBigResources)
artifact.fileTags.push("cpp_intermediate_object");
return [artifact];
}
function rccCommands(product, input, output)
{
var args = [input.filePath,
"-name", FileInfo.completeBaseName(input.filePath),
"-o", output.filePath];
if (input.Qt.core.enableBigResources)
args.push("-pass", "1");
if (product.Qt.core.disabledFeatures.contains("zstd")
&& Utilities.versionCompare(product.Qt.core.version, "5.13") >= 0) {
args.push("--no-zstd");
}
var cmd = new Command(fullPath(product), args);
cmd.description = "rcc "
+ (input.Qt.core.enableBigResources ? "(pass 1) " : "")
+ input.fileName;
cmd.highlight = 'codegen';
return cmd;
}
function rccPass2Commands(product, input, output)
{
function findChild(artifact, predicate) {
var children = artifact.children;
var len = children.length;
for (var i = 0; i < len; ++i) {
var child = children[i];
if (predicate(child))
return child;
child = findChild(child, predicate);
if (child)
return child;
}
return undefined;
}
var qrcArtifact = findChild(input, function(c) { return c.fileTags.contains("qrc"); });
var cppArtifact = findChild(input, function(c) { return c.fileTags.contains("cpp"); });
var cmd = new Command(fullPath(product),
[qrcArtifact.filePath,
"-temp", input.filePath,
"-name", FileInfo.completeBaseName(input.filePath),
"-o", output.filePath,
"-pass", "2"]);
cmd.description = "rcc (pass 2) " + qrcArtifact.fileName;
cmd.highlight = 'codegen';
return cmd;
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/qml.js 0000644 0001751 0000166 00000021703 14776170045 023353 0 ustar runner docker var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Process = require("qbs.Process");
var TextFile = require("qbs.TextFile");
function scannerData(scannerFilePath, qmlFiles, qmlPath, hostOS)
{
var p;
try {
p = new Process();
if (!hostOS.contains("windows")) {
p.exec(scannerFilePath, ["-qmlFiles"].concat(qmlFiles).concat(["-importPath", qmlPath]),
true);
return JSON.parse(p.readStdOut());
}
var data = [];
var nextFileIndex = 0;
while (nextFileIndex < qmlFiles.length) {
var currentFileList = [];
var currentFileListStringLength = 0;
while (nextFileIndex < qmlFiles.length && currentFileListStringLength < 30000) {
var currentFile = qmlFiles[nextFileIndex++];
currentFileList.push(currentFile);
currentFileListStringLength += currentFile.length;
}
p.exec(scannerFilePath, ["-qmlFiles"].concat(currentFileList)
.concat(["-importPath", qmlPath]), true);
data = data.concat(JSON.parse(p.readStdOut()));
}
return data;
} finally {
if (p)
p.close();
}
}
function getPrlRhs(line)
{
return line.split('=')[1].trim();
}
function getLibsForPlugin(pluginData, product)
{
var targetOS = product.qbs.targetOS;
var toolchain = product.qbs.toolchain;
var buildVariant = product.Qt.core.qtBuildVariant;
var qtLibDir = product.Qt.core.libPath;
var qtPluginDir = product.Qt.core.pluginPath;
var qtDir = product.Qt.core.installPrefixPath;
var qtQmlPath = product.Qt.qml.qmlPath;
if (!pluginData.path)
return "";
var prlFileName = "";
if (!targetOS.contains("windows"))
prlFileName += "lib";
prlFileName += pluginData.plugin;
if (buildVariant === "debug") {
if (targetOS.contains("windows")) {
prlFileName += "d";
} else if (product.Qt.core.versionMajor >= 6 &&
(targetOS.contains("ios")
|| targetOS.contains("tvos")
|| targetOS.contains("watchos"))) {
prlFileName += "_debug";
}
}
prlFileName += ".prl";
var prlFilePath = FileInfo.joinPaths(pluginData.path, prlFileName);
if (!File.exists(prlFilePath)) {
console.warn("prl file for QML plugin '" + pluginData.plugin + "' not present at '"
+ prlFilePath + "'. Linking may fail.");
return "";
}
var prlFile = new TextFile(prlFilePath, TextFile.ReadOnly);
try {
var pluginLib;
var otherLibs = [];
var line;
while (!prlFile.atEof()) {
line = prlFile.readLine().trim();
if (!line)
continue;
if (line.startsWith("QMAKE_PRL_TARGET"))
pluginLib = FileInfo.joinPaths(pluginData.path, getPrlRhs(line));
if (line.startsWith("QMAKE_PRL_LIBS = ")) {
var otherLibsLine = ' ' + getPrlRhs(line);
if (toolchain.contains("msvc")) {
otherLibsLine = otherLibsLine.replace(/ -L/g, " /LIBPATH:");
otherLibsLine = otherLibsLine.replace(/-l([^ ]+)/g, "$1" + ".lib");
}
otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_LIBS\]/g, qtLibDir);
otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PLUGINS\]/g, qtPluginDir);
otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_PREFIX\]/g, qtDir);
otherLibsLine = otherLibsLine.replace(/\$\$\[QT_INSTALL_QML\]/g, qtQmlPath);
otherLibs = otherLibs.concat(otherLibsLine.split(' ').map(FileInfo.cleanPath));
}
}
if (!pluginLib)
throw "Malformed prl file '" + prlFilePath + "'.";
return [pluginLib].concat(otherLibs);
} finally {
prlFile.close();
}
}
function typeRegistrarCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var versionParts = product.Qt.qml._importVersionParts;
var args = [
"--generate-qmltypes=" + outputs["qt.qml.types"][0].filePath,
"--import-name=" + product.Qt.qml.importName,
"--major-version=" + versionParts[0],
"--minor-version=" + (versionParts.length > 1 ? versionParts[1] : "0")
];
var foreignTypes = product.Qt.qml.extraMetaTypesFiles || [];
var metaTypeArtifactsFromDeps = explicitlyDependsOn["qt.core.metatypes"] || [];
var filePathFromArtifact = function(a) { return a.filePath; };
foreignTypes = foreignTypes.concat(metaTypeArtifactsFromDeps.map(filePathFromArtifact));
if (foreignTypes.length > 0)
args.push("--foreign-types=" + foreignTypes.join(","));
args.push("-o", outputs.cpp[0].filePath);
args = args.concat(inputs["qt.core.metatypes"].map(filePathFromArtifact));
var cmd = new Command(product.Qt.core.qmlLibExecPath + "/qmltyperegistrar", args);
cmd.description = "running qmltyperegistrar";
cmd.highlight = "codegen";
return cmd;
}
function generatePluginImportOutputArtifacts(product, inputs)
{
var list = [];
if (inputs["qt.qml.qml"])
list.push({ filePath: "qml_plugin_import.cpp", fileTags: ["cpp"] });
list.push({
filePath: product.Qt.core.qtBuildVariant === "debug"
? product.Qt.qml.pluginListFilePathDebug
: product.Qt.qml.pluginListFilePathRelease,
fileTags: ["qt.qml.pluginlist"]
});
return list;
}
function getCppLibsAndFrameworks(cpp)
{
var libs = {"frameworks": {}, "libraries": {}};
for (var i = 0; i < cpp.frameworks.length; ++i)
libs.frameworks[cpp.frameworks[i]] = true;
for (var i = 0; i < cpp.staticLibraries.length; ++i)
libs.libraries[cpp.staticLibraries[i]] = true;
for (var i = 0; i < cpp.dynamicLibraries.length; ++i)
libs.libraries[cpp.dynamicLibraries[i]] = true;
return libs;
}
function getUniqueLibs(libs, seen)
{
var uniqueLibs = [];
for (var i = 0; i < libs.length; ++i) {
if (libs[i] == "-framework") {
var frameworkName = libs[i + 1];
if (frameworkName && !seen.frameworks[frameworkName]) {
seen.frameworks[frameworkName] = true;
uniqueLibs.push("-framework", frameworkName);
}
++i; // Skip framework name
} else {
var libName;
if (libs[i].startsWith("-l"))
libName = libs[i].substr(2);
else
libName = libs[i];
if (!seen.libraries[libName]) {
seen.libraries[libName] = true;
uniqueLibs.push(libs[i]);
}
}
}
return uniqueLibs;
}
function generatePluginImportCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
if (inputs["qt.qml.qml"])
cmd.description = "creating " + outputs["cpp"][0].fileName;
else
cmd.silent = true;
cmd.sourceCode = function() {
var qmlInputs = inputs["qt.qml.qml"];
if (!qmlInputs)
qmlInputs = [];
var scannerData = Qml.scannerData(product.Qt.qml.qmlImportScannerFilePath,
qmlInputs.map(function(inp) { return inp.filePath; }),
product.Qt.qml.qmlPath, Host.os());
var cppFile;
var listFile;
try {
if (qmlInputs.length > 0)
cppFile = new TextFile(outputs["cpp"][0].filePath, TextFile.WriteOnly);
listFile = new TextFile(outputs["qt.qml.pluginlist"][0].filePath,
TextFile.WriteOnly);
if (cppFile)
cppFile.writeLine("#include ");
var plugins = { };
var seen = Qml.getCppLibsAndFrameworks(product.cpp);
var libsWithUniqueObjects = [];
for (var p in scannerData) {
var plugin = scannerData[p].plugin;
if (!plugin || plugins[plugin])
continue;
plugins[plugin] = true;
var className = scannerData[p].classname;
if (!className) {
throw "QML plugin '" + plugin + "' is missing a classname entry. " +
"Please add one to the qmldir file.";
}
if (cppFile)
cppFile.writeLine("Q_IMPORT_PLUGIN(" + className + ")");
var libs = Qml.getLibsForPlugin(scannerData[p], product);
var uniqueLibs = Qml.getUniqueLibs(libs, seen);
libsWithUniqueObjects = libsWithUniqueObjects.concat(uniqueLibs);
}
listFile.write(libsWithUniqueObjects.join("\n"));
} finally {
if (cppFile)
cppFile.close();
if (listFile)
listFile.close();
};
};
return [cmd];
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/quick.qbs 0000644 0001751 0000166 00000011164 14776170045 024047 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
import qbs.File
import qbs.FileInfo
import qbs.Utilities
import 'quick.js' as QC
QtModule {
qtModuleName: @name@
Depends { name: "Qt"; submodules: @dependencies@ }
version: @version@
hasLibrary: @has_library@
architectures: @archs@
targetPlatform: @targetPlatform@
staticLibsDebug: @staticLibsDebug@
staticLibsRelease: @staticLibsRelease@
dynamicLibsDebug: @dynamicLibsDebug@
dynamicLibsRelease: @dynamicLibsRelease@
linkerFlagsDebug: @linkerFlagsDebug@
linkerFlagsRelease: @linkerFlagsRelease@
frameworksDebug: @frameworksDebug@
frameworksRelease: @frameworksRelease@
frameworkPathsDebug: @frameworkPathsDebug@
frameworkPathsRelease: @frameworkPathsRelease@
libNameForLinkerDebug: @libNameForLinkerDebug@
libNameForLinkerRelease: @libNameForLinkerRelease@
libFilePathDebug: @libFilePathDebug@
libFilePathRelease: @libFilePathRelease@
pluginTypes: @pluginTypes@
moduleConfig: @moduleConfig@
cpp.defines: @defines@
cpp.systemIncludePaths: @includes@
cpp.libraryPaths: @libraryPaths@
@additionalContent@
readonly property bool _compilerIsQmlCacheGen: Utilities.versionCompare(Qt.core.version,
"5.11") >= 0
readonly property bool _supportsQmlJsFiltering: Utilities.versionCompare(Qt.core.version,
"5.15") < 0
readonly property string _generatedLoaderFileName: _compilerIsQmlCacheGen
? "qmlcache_loader.cpp"
: "qtquickcompiler_loader.cpp"
property string _compilerBaseDir: _compilerIsQmlCacheGen ? Qt.core.qmlLibExecPath
: Qt.core.binPath
property string compilerBaseName: (_compilerIsQmlCacheGen ? "qmlcachegen" : "qtquickcompiler")
property string compilerFilePath: FileInfo.joinPaths(_compilerBaseDir,
compilerBaseName + FileInfo.executableSuffix())
property bool compilerAvailable: File.exists(compilerFilePath);
property bool useCompiler: compilerAvailable && !_compilerIsQmlCacheGen
Group {
condition: useCompiler
FileTagger {
patterns: "*.qrc"
fileTags: ["qt.quick.qrc"]
priority: 100
}
Scanner {
inputs: 'qt.quick.qrc'
searchPaths: [FileInfo.path(input.filePath)]
scan: QC.scanQrc(product, input.filePath)
}
Rule {
inputs: ["qt.quick.qrc"]
Artifact {
filePath: input.fileName + ".json"
fileTags: ["qt.quick.qrcinfo"]
}
prepare: QC.generateCompilerInputCommands(product, input, output)
}
Rule {
inputs: ["qt.quick.qrcinfo"]
outputFileTags: ["cpp", "qrc", "qt.untranslatable"]
multiplex: true
outputArtifacts: QC.compilerOutputArtifacts(product, inputs)
prepare: QC.compilerCommands.apply(QC, arguments)
}
}
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/qml.qbs 0000644 0001751 0000166 00000010740 14776170045 023523 0 ustar runner docker import qbs.FileInfo
import qbs.Host
import qbs.TextFile
import "qml.js" as Qml
QtModule {
qtModuleName: "Qml"
Depends { name: "Qt"; submodules: @dependencies@}
property string qmlImportScannerName: Qt.core.qmlImportScannerName
property string qmlImportScannerFilePath: Qt.core.qmlImportScannerFilePath
property string qmlPath: @qmlPath@
property bool generateCacheFiles: false
Depends { name: "Qt.qmlcache"; condition: generateCacheFiles; required: false }
readonly property bool cachingEnabled: generateCacheFiles && Qt.qmlcache.present
property string qmlCacheGenPath
Properties {
condition: cachingEnabled
Qt.qmlcache.qmlCacheGenPath: qmlCacheGenPath || original
Qt.qmlcache.installDir: cacheFilesInstallDir || original
}
property string cacheFilesInstallDir
readonly property string pluginListFilePathDebug: product.buildDirectory + "/plugins.list.d"
readonly property string pluginListFilePathRelease: product.buildDirectory + "/plugins.list"
property bool linkPlugins: isStaticLibrary && Qt.plugin_support.linkPlugins
version: @version@
hasLibrary: @has_library@
architectures: @archs@
targetPlatform: @targetPlatform@
staticLibsDebug: (linkPlugins ? ['@' + pluginListFilePathDebug] : []).concat(@staticLibsDebug@)
staticLibsRelease: (linkPlugins ? ['@' + pluginListFilePathRelease] : []).concat(@staticLibsRelease@)
dynamicLibsDebug: @dynamicLibsDebug@
dynamicLibsRelease: @dynamicLibsRelease@
linkerFlagsDebug: @linkerFlagsDebug@
linkerFlagsRelease: @linkerFlagsRelease@
frameworksDebug: @frameworksDebug@
frameworksRelease: @frameworksRelease@
frameworkPathsDebug: @frameworkPathsDebug@
frameworkPathsRelease: @frameworkPathsRelease@
libNameForLinkerDebug: @libNameForLinkerDebug@
libNameForLinkerRelease: @libNameForLinkerRelease@
libFilePathDebug: @libFilePathDebug@
libFilePathRelease: @libFilePathRelease@
pluginTypes: @pluginTypes@
moduleConfig: @moduleConfig@
cpp.defines: @defines@
cpp.systemIncludePaths: @includes@
cpp.libraryPaths: @libraryPaths@
@additionalContent@
FileTagger {
patterns: ["*.qml"]
fileTags: ["qt.qml.qml"]
}
FileTagger {
patterns: ["*.js"]
fileTags: ["qt.qml.js"]
}
// Type registration
property string importName
property string importVersion: product.version
readonly property stringList _importVersionParts: (importVersion || "").split(".")
property string typesFileName: {
if (product.type && product.type.contains("application"))
return product.targetName + ".qmltypes";
return "plugins.qmltypes";
}
property string typesInstallDir
property stringList extraMetaTypesFiles
Group {
condition: importName
product.Qt.core.generateMetaTypesFile: true
Rule {
inputs: "qt.core.metatypes"
multiplex: true
explicitlyDependsOnFromDependencies: "qt.core.metatypes"
Artifact {
filePath: product.targetName.toLowerCase() + "_qmltyperegistrations.cpp"
fileTags: ["cpp", "unmocable", "qt.untranslatable"]
}
Artifact {
filePath: product.Qt.qml.typesFileName
fileTags: "qt.qml.types"
qbs.install: product.Qt.qml.typesInstallDir
qbs.installDir: product.Qt.qml.typesInstallDir
}
prepare: Qml.typeRegistrarCommands.apply(Qml, arguments)
}
}
Rule {
condition: linkPlugins
multiplex: true
requiresInputs: false
inputs: ["qt.qml.qml"]
outputFileTags: ["cpp", "qt.qml.pluginlist", "qt.untranslatable"]
outputArtifacts: Qml.generatePluginImportOutputArtifacts(product, inputs)
prepare: Qml.generatePluginImportCommands.apply(Qml, arguments)
}
validate: {
if (importName) {
if (!importVersion)
throw "Qt.qml.importVersion must be set if Qt.qml.importName is set.";
var isInt = function(value) {
return !isNaN(value) && parseInt(Number(value)) == value
&& !isNaN(parseInt(value, 10));
}
if (!isInt(_importVersionParts[0])
|| (_importVersionParts.length > 1 && !isInt(_importVersionParts[1]))) {
throw "Qt.qml.importVersion must be of the form x.y, where x and y are integers.";
}
}
}
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/plugin_support.qbs 0000644 0001751 0000166 00000005442 14776170045 026027 0 ustar runner docker Module {
// Set by user.
property varList pluginsByType
property bool linkPlugins: product.type
&& (product.type.contains("application") || product.type.contains("sharedlibrary"))
// Set by Qt modules.
property stringList pluginTypes
// Set by setup-qt.
readonly property var allPluginsByType: @allPluginsByType@
readonly property stringList nonEssentialPlugins: @nonEssentialPlugins@
// Derived.
readonly property var defaultPluginsByType: {
var map = {};
for (var i = 0; i < (pluginTypes || []).length; ++i) {
var pType = pluginTypes[i];
map[pType] = (allPluginsByType[pType] || []).filter(function(p) {
return !nonEssentialPlugins.contains(p); });
}
return map;
}
readonly property var effectivePluginsByType: {
var ppt = pluginsByType || [];
var eppt = {};
for (var i = 0; i < ppt.length; ++i) {
var listEntry = ppt[i];
for (var pluginType in listEntry) {
var newValue = listEntry[pluginType];
if (!newValue)
newValue = [];
else if (typeof newValue == "string")
newValue = [newValue];
if (!newValue instanceof Array)
throw "Invalid value '" + newValue + "' in Qt.plugin_support.pluginsByType";
eppt[pluginType] = (eppt[pluginType] || []).uniqueConcat(newValue);
}
}
var dppt = defaultPluginsByType;
for (var pluginType in dppt) {
if (!eppt[pluginType])
eppt[pluginType] = dppt[pluginType];
}
return eppt;
}
readonly property stringList enabledPlugins: {
var list = [];
var eppt = effectivePluginsByType;
for (var t in eppt)
Array.prototype.push.apply(list, eppt[t]);
return list;
}
validate: {
var ppt = pluginsByType;
if (!ppt)
return;
var appt = allPluginsByType;
for (var i = 0; i < ppt.length; ++i) {
for (var pluginType in ppt[i]) {
var requestedPlugins = ppt[i][pluginType];
if (!requestedPlugins)
continue;
var availablePlugins = appt[pluginType] || [];
if (typeof requestedPlugins === "string")
requestedPlugins = [requestedPlugins];
for (var j = 0; j < requestedPlugins.length; ++j) {
if (!availablePlugins.contains(requestedPlugins[j])) {
throw "Plugin '" + requestedPlugins[j] + "' of type '" + pluginType
+ "' was requested, but is not available.";
}
}
}
}
}
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/gui.qbs 0000644 0001751 0000166 00000004663 14776170045 023525 0 ustar runner docker import qbs.FileInfo
import qbs.ModUtils
import qbs.Utilities
QtModule {
qtModuleName: "Gui"
property string uicName: "uic"
FileTagger {
patterns: ["*.ui"]
fileTags: ["ui"]
}
Rule {
inputs: ["ui"]
Artifact {
filePath: FileInfo.joinPaths(input.moduleProperty("Qt.core", "generatedHeadersDir"),
'ui_' + input.completeBaseName + '.h')
fileTags: ["hpp", "qt.untranslatable"]
}
prepare: {
var uicPath = Utilities.versionCompare(product.Qt.gui.version, "6.1") < 0
? product.Qt.core.binPath + '/' + product.Qt.gui.uicName
: product.Qt.core.libExecPath + '/' + product.Qt.gui.uicName;
var cmd = new Command(uicPath, [input.filePath, '-o', output.filePath]);
cmd.description = 'generating ' + output.fileName;
cmd.highlight = 'codegen';
return cmd;
}
}
property string defaultQpaPlugin: @defaultQpaPlugin@
version: @version@
architectures: @archs@
targetPlatform: @targetPlatform@
staticLibsDebug: @staticLibsDebug@
staticLibsRelease: @staticLibsRelease@
dynamicLibsDebug: @dynamicLibsDebug@
dynamicLibsRelease: @dynamicLibsRelease@
linkerFlagsDebug: @linkerFlagsDebug@
linkerFlagsRelease: @linkerFlagsRelease@
frameworksDebug: @frameworksDebug@
frameworksRelease: @frameworksRelease@
frameworkPathsDebug: @frameworkPathsDebug@
frameworkPathsRelease: @frameworkPathsRelease@
libNameForLinkerDebug: @libNameForLinkerDebug@
libNameForLinkerRelease: @libNameForLinkerRelease@
libFilePathDebug: @libFilePathDebug@
libFilePathRelease: @libFilePathRelease@
pluginTypes: @pluginTypes@
cpp.entryPoint: qbs.targetOS.containsAny(["ios", "tvos"])
&& Utilities.versionCompare(version, "5.6.0") >= 0
? "_qt_main_wrapper"
: undefined
cpp.defines: @defines@
cpp.systemIncludePaths: @includes@
cpp.libraryPaths: @libraryPaths@
Properties {
condition: Qt.core.staticBuild && qbs.targetOS.contains("ios")
cpp.frameworks: base.concat(["UIKit", "QuartzCore", "CoreText", "CoreGraphics",
"Foundation", "CoreFoundation", "AudioToolbox"])
}
Properties {
condition: undefined
cpp.frameworks: base
}
@additionalContent@
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/module.qbs 0000644 0001751 0000166 00000002003 14776170045 024210 0 ustar runner docker QtModule {
qtModuleName: @name@
Depends { name: "Qt"; submodules: @dependencies@}
version: @version@
architectures: @archs@
targetPlatform: @targetPlatform@
hasLibrary: @has_library@
staticLibsDebug: @staticLibsDebug@
staticLibsRelease: @staticLibsRelease@
dynamicLibsDebug: @dynamicLibsDebug@
dynamicLibsRelease: @dynamicLibsRelease@
linkerFlagsDebug: @linkerFlagsDebug@
linkerFlagsRelease: @linkerFlagsRelease@
frameworksDebug: @frameworksDebug@
frameworksRelease: @frameworksRelease@
frameworkPathsDebug: @frameworkPathsDebug@
frameworkPathsRelease: @frameworkPathsRelease@
libNameForLinkerDebug: @libNameForLinkerDebug@
libNameForLinkerRelease: @libNameForLinkerRelease@
libFilePathDebug: @libFilePathDebug@
libFilePathRelease: @libFilePathRelease@
pluginTypes: @pluginTypes@
moduleConfig: @moduleConfig@
cpp.defines: @defines@
cpp.systemIncludePaths: @includes@
cpp.libraryPaths: @libraryPaths@
@additionalContent@
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/android_support.qbs 0000644 0001751 0000166 00000013062 14776170045 026146 0 ustar runner docker import qbs.FileInfo
import qbs.ModUtils
import qbs.Utilities
import qbs.Xml
import "android_support.js" as Impl
Module {
version: @version@
property string qmlRootDir: product.sourceDirectory
property stringList extraPrefixDirs
property stringList qmlImportPaths
property stringList deploymentDependencies // qmake: ANDROID_DEPLOYMENT_DEPENDENCIES
property stringList extraPlugins // qmake: ANDROID_EXTRA_PLUGINS
property stringList extraLibs // qmake: ANDROID_EXTRA_LIBS
property bool verboseAndroidDeployQt: false
property string _androidDeployQtFilePath: FileInfo.joinPaths(_qtBinaryDir, "bin",
"androiddeployqt")
property string rccFilePath
property string _qtBinaryDir
property string _qtInstallDir
property bool _enableSdkSupport: product.type && product.type.contains("android.package")
&& !product.consoleApplication
property bool _enableNdkSupport: !product.aggregate || product.multiplexConfigurationId
property string _templatesBaseDir: FileInfo.joinPaths(_qtInstallDir, "src", "android")
property string _deployQtOutDir: FileInfo.joinPaths(product.buildDirectory, "deployqt_out")
property bool _multiAbi: Utilities.versionCompare(version, "5.14") >= 0
// QTBUG-87288: correct QtNetwork jar dependencies for 5.15.0 < Qt < 5.15.3
property bool _correctQtNetworkDependencies: Utilities.versionCompare(version, "5.15.0") > 0 &&
Utilities.versionCompare(version, "5.15.3") < 0
readonly property string _qtAndroidJarFileName: Utilities.versionCompare(version, "6.0") >= 0 ?
"Qt6Android.jar" : "QtAndroid.jar"
Group {
condition: _enableSdkSupport
name: "helper sources from qt"
Depends { name: "Android.sdk" }
Depends { name: "java" }
product.Android.sdk.customManifestProcessing: true
product.Android.sdk._bundledInAssets: _multiAbi
product.java._tagJniHeaders: false // prevent rule cycle
Properties {
condition: Utilities.versionCompare(version, "5.15") >= 0
&& Utilities.versionCompare(version, "6.0") < 0
java.additionalClassPaths: [FileInfo.joinPaths(_qtInstallDir, "jar", "QtAndroid.jar")]
}
Properties {
condition: Utilities.versionCompare(version, "6.0") >= 0
java.additionalClassPaths: [FileInfo.joinPaths(_qtInstallDir, "jar", "Qt6Android.jar")]
Android.sdk.minimumVersion: "23"
}
Properties {
condition: Utilities.versionCompare(version, "6.0") < 0
Android.sdk.minimumVersion: "21"
}
prefix: Qt.android_support._templatesBaseDir + "/java/"
Android.sdk.aidlSearchPaths: prefix + "src"
files: [
"**/*.java",
"**/*.aidl",
]
Rule {
multiplex: true
property stringList inputTags: ["android.nativelibrary", "qrc"]
inputsFromDependencies: inputTags
inputs: product.aggregate ? [] : inputTags
Artifact {
filePath: "androiddeployqt.json"
fileTags: "qt_androiddeployqt_input"
}
prepare: Impl.prepareDeployQtCommands.apply(Impl, arguments)
}
// We use the manifest template from the Qt installation if and only if the project
// does not provide a manifest file.
Rule {
multiplex: true
requiresInputs: false
inputs: "android.manifest"
excludedInputs: "qt.android_manifest"
outputFileTags: ["android.manifest", "qt.android_manifest"]
outputArtifacts: Impl.qtManifestOutputArtifacts(inputs)
prepare: Impl.qtManifestCommands(product, output)
}
Rule {
multiplex: true
property stringList defaultInputs: ["qt_androiddeployqt_input",
"android.manifest_processed"]
property stringList allInputs: ["qt_androiddeployqt_input", "android.manifest_processed",
"android.nativelibrary"]
inputsFromDependencies: "android.nativelibrary"
inputs: product.aggregate ? defaultInputs : allInputs
outputFileTags: [
"android.manifest_final", "android.resources", "android.assets", "bundled_jar",
"android.deployqt_list",
]
outputArtifacts: Impl.deployQtOutputArtifacts(product)
prepare: Impl.deployQtCommands.apply(Impl, arguments)
}
}
Group {
condition: _enableNdkSupport
Depends { name: "cpp" }
Depends { name: "Android.ndk" }
product.Android.ndk.appStl: qbs.toolchain.contains("clang") ? "c++_shared" : "gnustl_shared"
Properties {
condition: _multiAbi
cpp.archSuffix: "_" + Android.ndk.abi
}
// "ANDROID_HAS_WSTRING" was removed from qtcore qstring.h in Qt 5.14.0
Properties {
condition: Utilities.versionCompare(version, "5.14.0") < 0 &&
(Android.ndk.abi === "armeabi-v7a" || Android.ndk.abi === "x86")
cpp.defines: "ANDROID_HAS_WSTRING"
}
}
validate: {
if (Utilities.versionCompare(version, "5.12") < 0)
throw ModUtils.ModuleError("Cannot use Qt " + version + " with Android. "
+ "Version 5.12 or later is required.");
}
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/qdoc.js 0000644 0001751 0000166 00000007540 14776170045 023513 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Copyright (C) 2015 Jake Petroules.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var ModUtils = require("qbs.ModUtils");
function qdocArgs(product, input, outputDir) {
var args = [input.filePath];
var qtVersion = ModUtils.moduleProperty(product, "versionMajor");
if (qtVersion >= 5) {
args.push("-outputdir");
args.push(outputDir);
}
return args;
}
var _qdocDefaultFileTag = "qdoc-output";
function qdocFileTaggers() {
var t = _qdocDefaultFileTag;
return {
".qhp": [t, "qhp"],
".qhp.sha1": [t, "qhp-sha1"],
".css": [t, "qdoc-css"],
".html": [t, "qdoc-html"],
".index": [t, "qdoc-index"],
".png": [t, "qdoc-png"]
};
}
function outputArtifacts(product, input) {
var tracker = new ModUtils.BlackboxOutputArtifactTracker();
tracker.hostOS = product.moduleProperty("qbs", "hostOS");
tracker.shellPath = product.moduleProperty("qbs", "shellPath");
tracker.defaultFileTags = [_qdocDefaultFileTag];
tracker.fileTaggers = qdocFileTaggers();
tracker.command = FileInfo.joinPaths(ModUtils.moduleProperty(product, "binPath"),
ModUtils.moduleProperty(product, "qdocName"));
tracker.commandArgsFunction = function (outputDirectory) {
return qdocArgs(product, input, outputDirectory);
};
tracker.commandEnvironmentFunction = function (outputDirectory) {
var env = {};
var qdocEnv = ModUtils.moduleProperty(product, "qdocEnvironment");
for (var j = 0; j < qdocEnv.length; ++j) {
var e = qdocEnv[j];
var idx = e.indexOf("=");
var name = e.slice(0, idx);
var value = e.slice(idx + 1, e.length);
env[name] = value;
}
env["OUTDIR"] = outputDirectory; // Qt 4 replacement for -outputdir
return env;
};
return tracker.artifacts(ModUtils.moduleProperty(product, "qdocOutputDir"));
}
function commands(product, input)
{
var outputDir = product.Qt.core.qdocOutputDir;
var args = qdocArgs(product, input, outputDir);
var cmd = new Command(product.Qt.core.binPath + '/' + product.Qt.core.qdocName, args);
cmd.description = 'qdoc ' + input.fileName;
cmd.highlight = 'filegen';
cmd.environment = product.Qt.core.qdocEnvironment;
cmd.environment.push("OUTDIR=" + outputDir); // Qt 4 replacement for -outputdir
return cmd;
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/quick.js 0000644 0001751 0000166 00000015710 14776170045 023677 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var FileInfo = require("qbs.FileInfo");
var Process = require("qbs.Process");
var Rcc = require("rcc.js");
var TextFile = require("qbs.TextFile");
function scanQrc(product, qrcFilePath) {
var absInputDir = FileInfo.path(qrcFilePath);
var result = [];
var process = new Process();
try {
var rcc = FileInfo.joinPaths(Rcc.fullPath(product) + FileInfo.executableSuffix());
var exitCode = process.exec(rcc, ["--list", qrcFilePath], true);
for (;;) {
var line = process.readLine();
if (!line)
break;
line = line.trim();
line = FileInfo.relativePath(absInputDir, line);
result.push(line);
}
} finally {
process.close();
}
return result;
}
function qtQuickCompilerOutputName(filePath) {
var str = filePath.replace(/\//g, '_');
var i = str.lastIndexOf('.');
if (i != -1)
str = str.substr(0, i) + '_' + str.substr(i + 1);
str += ".cpp";
return str;
}
function qtQuickResourceFileOutputName(fileName) {
return fileName.replace(/\.qrc$/, "_qtquickcompiler.qrc");
}
function contentFromQrc(product, qrcFilePath) {
var supportsFiltering = product.Qt.quick._supportsQmlJsFiltering;
var filesInQrc = scanQrc(product, qrcFilePath);
var qmlJsFiles = filesInQrc.filter(function (filePath) {
return (/\.(mjs|js|qml)$/).test(filePath);
} );
var content = {};
if (!supportsFiltering || filesInQrc.length - qmlJsFiles.length > 0) {
content.newQrcFileName = qtQuickResourceFileOutputName(input.fileName);
}
content.qmlJsFiles = qmlJsFiles.map(function (filePath) {
return {
input: filePath,
output: qtQuickCompilerOutputName(filePath)
};
});
return content;
}
function generateCompilerInputCommands(product, input, output)
{
var cmd = new JavaScriptCommand();
cmd.silent = true;
cmd.sourceCode = function() {
var content = contentFromQrc(product, input.filePath);
content.qrcFilePath = input.filePath;
var tf = new TextFile(output.filePath, TextFile.WriteOnly);
tf.write(JSON.stringify(content));
tf.close();
}
return cmd;
}
function compilerOutputArtifacts(product, inputs)
{
var infos = [];
inputs["qt.quick.qrcinfo"].forEach(function (input) {
var tf = new TextFile(input.filePath, TextFile.ReadOnly);
infos.push(JSON.parse(tf.readAll()));
tf.close();
});
var result = [];
infos.forEach(function (info) {
if (info.newQrcFileName) {
result.push({
filePath: info.newQrcFileName,
fileTags: ["qrc"]
});
}
info.qmlJsFiles.forEach(function (qmlJsFile) {
result.push({
filePath: qmlJsFile.output,
fileTags: ["cpp"]
});
});
});
result.push({
filePath: product.Qt.quick._generatedLoaderFileName,
fileTags: ["cpp"]
});
return result;
}
function compilerCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn)
{
var infos = [];
inputs["qt.quick.qrcinfo"].forEach(function (input) {
var tf = new TextFile(input.filePath, TextFile.ReadOnly);
infos.push(JSON.parse(tf.readAll()));
tf.close();
});
var cmds = [];
var qmlCompiler = product.Qt.quick.compilerFilePath;
var useCacheGen = product.Qt.quick._compilerIsQmlCacheGen;
var cmd;
var loaderFlags = [];
function findOutput(fileName) {
for (var k in outputs) {
for (var i in outputs[k]) {
if (outputs[k][i].fileName === fileName)
return outputs[k][i];
}
}
throw new Error("Qt Quick compiler rule: Cannot find output artifact "
+ fileName + ".");
}
infos.forEach(function (info) {
if (info.newQrcFileName) {
loaderFlags.push("--resource-file-mapping="
+ FileInfo.fileName(info.qrcFilePath)
+ '=' + info.newQrcFileName);
// Qt 5.15 doesn't really filter anyting but merely copies the qrc
// content to the new location
var args = ["--filter-resource-file",
info.qrcFilePath];
if (useCacheGen)
args.push("-o");
args.push(findOutput(info.newQrcFileName).filePath);
cmd = new Command(qmlCompiler, args);
cmd.description = "generating " + info.newQrcFileName;
cmds.push(cmd);
} else {
loaderFlags.push("--resource-file-mapping=" + info.qrcFilePath);
}
info.qmlJsFiles.forEach(function (qmlJsFile) {
var args = ["--resource=" + info.qrcFilePath, qmlJsFile.input];
if (useCacheGen)
args.push("-o");
args.push(findOutput(qmlJsFile.output).filePath);
cmd = new Command(qmlCompiler, args);
cmd.description = "generating " + qmlJsFile.output;
cmd.workingDirectory = FileInfo.path(info.qrcFilePath);
cmds.push(cmd);
});
});
var args = loaderFlags.concat(infos.map(function (info) { return info.qrcFilePath; }));
if (useCacheGen)
args.push("-o");
args.push(findOutput(product.Qt.quick._generatedLoaderFileName).filePath);
cmd = new Command(qmlCompiler, args);
cmd.description = "generating loader source";
cmds.push(cmd);
return cmds;
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/dbus.qbs 0000644 0001751 0000166 00000004201 14776170045 023662 0 ustar runner docker import qbs.FileInfo
import qbs.ModUtils
import "dbus.js" as DBus
QtModule {
qtModuleName: "DBus"
property string xml2cppName: "qdbusxml2cpp"
property stringList xml2CppHeaderFlags: []
property stringList xml2CppSourceFlags: []
Rule {
inputs: ["qt.dbus.adaptor"]
Artifact {
filePath: FileInfo.joinPaths(input.moduleProperty("Qt.core", "generatedHeadersDir"),
DBus.outputFileName(input, "_adaptor.h"))
fileTags: ["hpp"]
}
Artifact {
filePath: DBus.outputFileName(input, "_adaptor.cpp")
fileTags: ["cpp", "qt.untranslatable"]
}
prepare: DBus.createCommands(product, input, outputs, "-a")
}
Rule {
inputs: ["qt.dbus.interface"]
Artifact {
filePath: FileInfo.joinPaths(input.moduleProperty("Qt.core", "generatedHeadersDir"),
DBus.outputFileName(input, "_interface.h"))
fileTags: ["hpp"]
}
Artifact {
filePath: DBus.outputFileName(input, "_interface.cpp")
fileTags: ["cpp", "qt.untranslatable"]
}
prepare: DBus.createCommands(product, input, outputs, "-p")
}
version: @version@
architectures: @archs@
targetPlatform: @targetPlatform@
staticLibsDebug: @staticLibsDebug@
staticLibsRelease: @staticLibsRelease@
dynamicLibsDebug: @dynamicLibsDebug@
dynamicLibsRelease: @dynamicLibsRelease@
linkerFlagsDebug: @linkerFlagsDebug@
linkerFlagsRelease: @linkerFlagsRelease@
frameworksDebug: @frameworksDebug@
frameworksRelease: @frameworksRelease@
frameworkPathsDebug: @frameworkPathsDebug@
frameworkPathsRelease: @frameworkPathsRelease@
libNameForLinkerDebug: @libNameForLinkerDebug@
libNameForLinkerRelease: @libNameForLinkerRelease@
libFilePathDebug: @libFilePathDebug@
libFilePathRelease: @libFilePathRelease@
pluginTypes: @pluginTypes@
moduleConfig: @moduleConfig@
cpp.defines: @defines@
cpp.systemIncludePaths: @includes@
cpp.libraryPaths: @libraryPaths@
@additionalContent@
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/android_support.js 0000644 0001751 0000166 00000046643 14776170045 026010 0 ustar runner docker var File = require("qbs.File");
var FileInfo = require("qbs.FileInfo");
var Process = require("qbs.Process");
var TextFile = require("qbs.TextFile");
var Utilities = require("qbs.Utilities");
function prepareDeployQtCommands(project, product, inputs, outputs, input, output,
explicitlyDependsOn)
{
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.sourceCode = function() {
var theBinary;
var nativeLibs = inputs["android.nativelibrary"];
var architectures = [];
var triples = [];
var qtInstallDirectories = [];
var hostArch;
var targetArchitecture;
if (nativeLibs.length === 1) {
theBinary = nativeLibs[0];
hostArch = theBinary.Android.ndk.hostArch;
targetArchitecture = theBinary.Android.ndk.abi;
if (product.Qt.android_support._multiAbi) {
architectures.push(theBinary.Android.ndk.abi);
triples.push(theBinary.cpp.toolchainTriple);
qtInstallDirectories.push(theBinary.Qt.android_support._qtInstallDir);
}
} else {
for (i = 0; i < nativeLibs.length; ++i) {
var candidate = nativeLibs[i];
if (product.Qt.android_support._multiAbi) {
if (candidate.product.name === product.name) {
architectures.push(candidate.Android.ndk.abi);
triples.push(candidate.cpp.toolchainTriple);
qtInstallDirectories.push(
candidate.Qt.android_support._qtInstallDir);
hostArch = candidate.Android.ndk.hostArch;
targetArchitecture = candidate.Android.ndk.abi;
theBinary = candidate;
}
} else {
if (!candidate.fileName.contains(candidate.product.targetName))
continue;
if (!theBinary) {
theBinary = candidate;
hostArch = theBinary.Android.ndk.hostArch;
targetArchitecture = theBinary.Android.ndk.abi;
continue;
}
if (candidate.product.name !== product.name) {
continue; // This is not going to be a match
}
if (candidate.product.name === product.name
&& theBinary.product.name !== product.name) {
theBinary = candidate; // The new candidate is a better match.
hostArch = theBinary.Android.ndk.hostArch;
targetArchitecture = theBinary.Android.ndk.abi;
continue;
}
throw "Qt applications for Android support only one native binary "
+ "per package.\n"
+ "In particular, you cannot build a Qt app for more than "
+ "one architecture at the same time.";
}
}
}
var f = new TextFile(output.filePath, TextFile.WriteOnly);
f.writeLine("{");
f.writeLine('"description": "This file was generated by qbs to be read by '
+ 'androiddeployqt and should not be modified by hand.",');
if (Utilities.versionCompare(product.Qt.core.version, "6.3.0") >= 0) {
var line = '"qt": {';
for (var i = 0; i < qtInstallDirectories.length && i < architectures.length;
++i) {
line = line + '"' + architectures[i] + '":"' +
qtInstallDirectories[i] + '"';
if (i < qtInstallDirectories.length-1 || i < architectures.length-1)
line = line + ',';
}
line = line + "},";
f.writeLine(line);
} else {
f.writeLine('"qt": "' + product.Qt.android_support._qtInstallDir + '",');
}
f.writeLine('"sdk": "' + product.Android.sdk.sdkDir + '",');
f.writeLine('"sdkBuildToolsRevision": "' + product.Android.sdk.buildToolsVersion
+ '",');
f.writeLine('"ndk": "' + product.Android.sdk.ndkDir + '",');
f.writeLine('"toolchain-prefix": "llvm",');
f.writeLine('"tool-prefix": "llvm",');
f.writeLine('"useLLVM": true,');
f.writeLine('"ndk-host": "' + hostArch + '",');
if (!product.Qt.android_support._multiAbi) {
f.writeLine('"target-architecture": "' + targetArchitecture + '",');
}
else {
var line = '"architectures": {';
for (var i in architectures) {
line = line + '"' + architectures[i] + '":"' + triples[i] + '"';
if (i < architectures.length-1)
line = line + ',';
}
line = line + "},";
f.writeLine(line);
}
f.writeLine('"qml-root-path": "' + product.Qt.android_support.qmlRootDir + '",');
var deploymentDeps = product.Qt.android_support.deploymentDependencies;
if (deploymentDeps && deploymentDeps.length > 0)
f.writeLine('"deployment-dependencies": "' + deploymentDeps.join() + '",');
var extraPlugins = product.Qt.android_support.extraPlugins;
if (extraPlugins && extraPlugins.length > 0)
f.writeLine('"android-extra-plugins": "' + extraPlugins.join() + '",');
var extraLibs = product.Qt.android_support.extraLibs;
if (extraLibs && extraLibs.length > 0) {
for (var i = 0; i < extraLibs.length; ++i) {
if (!FileInfo.isAbsolutePath(extraLibs[i])) {
extraLibs[i] = FileInfo.joinPaths(product.sourceDirectory, extraLibs[i]);
}
}
f.writeLine('"android-extra-libs": "' + extraLibs.join() + '",');
}
var prefixDirs = product.Qt.android_support.extraPrefixDirs;
if (prefixDirs && prefixDirs.length > 0)
f.writeLine('"extraPrefixDirs": ' + JSON.stringify(prefixDirs) + ',');
var qmlImportPaths = product.Qt.android_support.qmlImportPaths;
if (qmlImportPaths && qmlImportPaths.length > 0)
f.writeLine('"qml-import-paths": "' + qmlImportPaths.join(',') + '",');
else if ((product.qmlImportPaths instanceof Array) && product.qmlImportPaths.length > 0)
f.writeLine('"qml-import-paths": "' + product.qmlImportPaths.join(',') + '",');
if (Utilities.versionCompare(product.Qt.android_support.version, "6.0") >= 0) {
f.writeLine('"qml-importscanner-binary": "'
+ product.Qt.core.qmlImportScannerFilePath + FileInfo.executableSuffix()
+ '",');
f.writeLine('"rcc-binary": "' + product.Qt.android_support.rccFilePath
+ FileInfo.executableSuffix() + '",');
if (inputs["qrc"] && inputs["qrc"].length > 0) {
var qrcFiles = [];
var qrcInputs = inputs["qrc"];
for (i = 0; i < qrcInputs.length; ++i) {
qrcFiles.push(qrcInputs[i].filePath);
}
f.writeLine('"qrcFiles": "' + qrcFiles.join(',') + '",');
}
}
// QBS-1429
if (!product.Qt.android_support._multiAbi) {
f.writeLine('"stdcpp-path": "' + (product.cpp.sharedStlFilePath
? product.cpp.sharedStlFilePath : product.cpp.staticStlFilePath)
+ '",');
f.writeLine('"application-binary": "' + theBinary.filePath + '"');
} else {
f.writeLine('"stdcpp-path": "' + product.Android.sdk.ndkDir +
'/toolchains/llvm/prebuilt/' + hostArch + '/sysroot/usr/lib/",');
f.writeLine('"application-binary": "' + theBinary.product.targetName + '"');
}
f.writeLine("}");
f.close();
};
return cmd;
}
function qtManifestOutputArtifacts(inputs)
{
if (inputs["android.manifest"])
return [];
return [{
filePath: "qt_manifest/AndroidManifest.xml",
fileTags: ["android.manifest", "qt.android_manifest"]
}];
}
function qtManifestCommands(product, output)
{
var cmd = new JavaScriptCommand();
cmd.description = "copying Qt Android manifest template";
cmd.sourceCode = function() {
File.copy(FileInfo.joinPaths(product.Qt.android_support._templatesBaseDir,
"templates", "AndroidManifest.xml"), output.filePath);
};
return cmd;
}
function deployQtOutputArtifacts(product)
{
return [
{
filePath: "AndroidManifest.xml",
fileTags: "android.manifest_final"
},
{
filePath: product.Qt.android_support._deployQtOutDir + "/res/values/libs.xml",
fileTags: "android.resources"
},
{
filePath: product.Qt.android_support._deployQtOutDir
+ "/res/values/strings.xml",
fileTags: "android.resources"
},
{
filePath: product.Qt.android_support._deployQtOutDir + "/assets/.dummy",
fileTags: "android.assets"
},
{
filePath: "deployqt.list",
fileTags: "android.deployqt_list"
},
// androiddeployqt potentially copies more jar files but this one will always be there
// since it comes with Qt.core
{
filePath: FileInfo.joinPaths(product.java.classFilesDir,
product.Qt.android_support._qtAndroidJarFileName),
fileTags: "bundled_jar"
}
];
}
function deployQtCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn)
{
var cmds = [];
var copyCmd = new JavaScriptCommand();
copyCmd.description = "copying Qt resource templates";
copyCmd.sourceCode = function() {
File.copy(inputs["android.manifest_processed"][0].filePath,
product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml");
File.copy(product.Qt.android_support._templatesBaseDir + "/java/res",
product.Qt.android_support._deployQtOutDir + "/res");
File.copy(product.Qt.android_support._templatesBaseDir
+ "/templates/res/values/libs.xml",
product.Qt.android_support._deployQtOutDir + "/res/values/libs.xml");
if (!product.Qt.android_support._multiAbi) {
try {
File.remove(FileInfo.path(outputs["android.assets"][0].filePath));
} catch (e) {
}
}
else {
for (var i in inputs["android.nativelibrary"]) {
var input = inputs["android.nativelibrary"][i];
File.copy(input.filePath,
FileInfo.joinPaths(product.Qt.android_support._deployQtOutDir,
"libs", input.Android.ndk.abi,
input.fileName));
}
}
};
cmds.push(copyCmd);
var androidDeployQtArgs = [
"--output", product.Qt.android_support._deployQtOutDir,
"--input", inputs["qt_androiddeployqt_input"][0].filePath, "--aux-mode",
"--deployment", "bundled",
"--android-platform", product.Android.sdk.platform,
];
if (product.Qt.android_support.verboseAndroidDeployQt)
androidDeployQtArgs.push("--verbose");
var androidDeployQtCmd = new Command(
product.Qt.android_support._androidDeployQtFilePath, androidDeployQtArgs);
androidDeployQtCmd.description = "running androiddeployqt";
cmds.push(androidDeployQtCmd);
// We do not want androiddeployqt to write directly into our APK base dir, so
// we ran it on an isolated directory and now we move stuff over.
// We remember the files for which we do that, so if the next invocation
// of androiddeployqt creates fewer files, the other ones are removed from
// the APK base dir.
var moveCmd = new JavaScriptCommand();
moveCmd.description = "processing androiddeployqt output";
moveCmd.sourceCode = function() {
File.makePath(product.java.classFilesDir);
var libsDir = product.Qt.android_support._deployQtOutDir + "/libs";
var libDir = product.Android.sdk.packageContentsDir + "/lib";
var listFilePath = outputs["android.deployqt_list"][0].filePath;
var oldLibs = [];
try {
var listFile = new TextFile(listFilePath, TextFile.ReadOnly);
var listFileLine = listFile.readLine();
while (listFileLine) {
oldLibs.push(listFileLine);
listFileLine = listFile.readLine();
}
listFile.close();
} catch (e) {
}
listFile = new TextFile(listFilePath, TextFile.WriteOnly);
var newLibs = [];
var moveLibFiles = function(prefix) {
var fullSrcPrefix = FileInfo.joinPaths(libsDir, prefix);
var files = File.directoryEntries(fullSrcPrefix, File.Files);
for (var i = 0; i < files.length; ++i) {
var file = files[i];
var srcFilePath = FileInfo.joinPaths(fullSrcPrefix, file);
var targetFilePath;
if (file.endsWith(".jar"))
targetFilePath = FileInfo.joinPaths(product.java.classFilesDir, file);
else
targetFilePath = FileInfo.joinPaths(libDir, prefix, file);
File.move(srcFilePath, targetFilePath);
listFile.writeLine(targetFilePath);
newLibs.push(targetFilePath);
}
var dirs = File.directoryEntries(fullSrcPrefix,
File.Dirs | File.NoDotAndDotDot);
for (i = 0; i < dirs.length; ++i)
moveLibFiles(FileInfo.joinPaths(prefix, dirs[i]));
};
moveLibFiles("");
listFile.close();
for (i = 0; i < oldLibs.length; ++i) {
if (!newLibs.contains(oldLibs[i]))
File.remove(oldLibs[i]);
}
};
cmds.push(moveCmd);
// androiddeployqt doesn't strip the deployed libraries anymore so it has to done here
// but only for release build
if (product.qbs.buildVariant == "release") {
var stripLibsCmd = new JavaScriptCommand();
stripLibsCmd.description = "stripping unneeded symbols from deployed qt libraries";
stripLibsCmd.sourceCode = function() {
var stripArgs = ["--strip-all"];
var architectures = [];
for (var i in inputs["android.nativelibrary"])
architectures.push(inputs["android.nativelibrary"][i].Android.ndk.abi);
for (var i in architectures) {
var abiDirPath = FileInfo.joinPaths(product.Android.sdk.packageContentsDir,
"lib", architectures[i]);
var files = File.directoryEntries(abiDirPath, File.Files);
for (var i = 0; i < files.length; ++i) {
var filePath = FileInfo.joinPaths(abiDirPath, files[i]);
if (FileInfo.suffix(filePath) == "so") {
stripArgs.push(filePath);
}
}
}
var process = new Process();
process.exec(product.cpp.stripPath, stripArgs, false);
}
cmds.push(stripLibsCmd);
}
var correctingCmd = new JavaScriptCommand();
if (product.Qt.android_support._correctQtNetworkDependencies) {
correctingCmd.description = "correcting network jar dependency";
correctingCmd.sourceCode = function() {
var findNetworkLib = function() {
var libsDir = product.Android.sdk.packageContentsDir + "/lib";
var dirList = File.directoryEntries(libsDir, File.Dirs |
File.NoDotAndDotDot);
for (var i = 0; i < dirList.length; ++i) {
var archDir = FileInfo.joinPaths(libsDir, dirList[i]);
var fileList = File.directoryEntries(archDir, File.Files);
if (fileList) {
for (var j = 0; j < fileList.length; ++j) {
if (fileList[j].contains("libQt5Network")) {
return true;
}
}
}
}
return false;
}
if (findNetworkLib()) {
var manifestData = new Xml.DomDocument();
var manifestFilePath = product.Qt.android_support._deployQtOutDir +
"/AndroidManifest.xml"
manifestData.load(manifestFilePath);
var rootElem = manifestData.documentElement();
if (!rootElem || !rootElem.isElement() || rootElem.tagName() != "manifest")
throw "No manifest tag found in '" + manifestFilePath + "'.";
var appElem = rootElem.firstChild("application");
if (!appElem || !appElem.isElement() || appElem.tagName() != "application")
throw "No application tag found in '" + manifestFilePath + "'.";
var activityElem = appElem.firstChild("activity");
if (!activityElem || !activityElem.isElement() ||
activityElem.tagName() != "activity")
throw "No activity tag found in '" + manifestFilePath + "'.";
var metaDataElem = activityElem.firstChild("meta-data");
while (metaDataElem && metaDataElem.isElement()) {
if (metaDataElem.attribute("android:name") ==
"android.app.load_local_jars" ) {
var value = metaDataElem.attribute("android:value");
var fileName = "QtAndroidNetwork.jar";
metaDataElem.setAttribute("android:value", value + ":jar/" +
fileName);
var jarFilePath = FileInfo.joinPaths(
product.Qt.android_support._qtInstallDir, "jar",
fileName);
var targetFilePath = FileInfo.joinPaths(product.java.classFilesDir,
fileName);
File.copy(jarFilePath, targetFilePath);
break;
}
metaDataElem = metaDataElem.nextSibling("meta-data");
}
manifestData.save(outputs["android.manifest_final"][0].filePath, 4);
} else {
File.move(product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml",
outputs["android.manifest_final"][0].filePath);
}
};
} else {
correctingCmd.description = "copying manifest";
correctingCmd.sourceCode = function() {
File.move(product.Qt.android_support._deployQtOutDir + "/AndroidManifest.xml",
outputs["android.manifest_final"][0].filePath);
}
}
cmds.push(correctingCmd);
return cmds;
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/core.js 0000644 0001751 0000166 00000003642 14776170045 023514 0 ustar runner docker var TextFile = require("qbs.TextFile");
function lreleaseCommands(project, product, inputs, outputs, input, output, explicitlyDependsOn)
{
var inputFilePaths;
if (product.Qt.core.lreleaseMultiplexMode)
inputFilePaths = inputs["ts"].map(function(artifact) { return artifact.filePath; });
else
inputFilePaths = [input.filePath];
var args = ['-silent', '-qm', output.filePath].concat(inputFilePaths);
var cmd = new Command(product.Qt.core.binPath + '/'
+ product.Qt.core.lreleaseName, args);
cmd.description = 'creating ' + output.fileName;
cmd.highlight = 'filegen';
return cmd;
}
function qhelpGeneratorCommands(product, input, output)
{
var args = [input.filePath];
args = args.concat(product.Qt.core.helpGeneratorArgs);
args.push("-o");
args.push(output.filePath);
var cmd = new Command(
product.Qt.core.helpGeneratorLibExecPath + "/qhelpgenerator", args);
cmd.description = 'qhelpgenerator ' + input.fileName;
cmd.highlight = 'filegen';
cmd.stdoutFilterFunction = function(output) { return ""; };
return cmd;
}
function wasmQtHtmlCommands(product, output)
{
var cmd = new JavaScriptCommand();
cmd.description = "Generating Qt html for " + product.targetName;
cmd.highlight = "filegen";
cmd.sourceCode = function() {
var platformsPath = product.Qt.core.pluginPath + "/platforms";
var wasmShellFile = new TextFile(platformsPath + "/wasm_shell.html");
var content = wasmShellFile.readAll();
var appNameTemplate = "@APPNAME@";
var finalContent = content.replaceAll(appNameTemplate, product.name);
var preload = "@PRELOAD@";//TODO: figure out what it's for
finalContent = finalContent.replace(preload, "");
var finalHtmlFile = new TextFile(output.filePath, OpenMode = TextFile.WriteOnly);
finalHtmlFile.write(finalContent);
}
return cmd;
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/moc.js 0000644 0001751 0000166 00000013070 14776170045 023336 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
var ModUtils = require("qbs.ModUtils");
var Utilities = require("qbs.Utilities");
function args(product, input, outputs)
{
var defines = product.cpp.compilerDefinesByLanguage;
if (input.fileTags.contains("objcpp"))
defines = ModUtils.flattenDictionary(defines["objcpp"]) || [];
else if (input.fileTags.contains("cpp") || input.fileTags.contains("hpp"))
defines = ModUtils.flattenDictionary(defines["cpp"]) || [];
else
defines = [];
defines = defines.uniqueConcat(product.cpp.platformDefines);
defines = defines.uniqueConcat(input.cpp.defines);
var includePaths = input.cpp.includePaths;
includePaths = includePaths.uniqueConcat(input.cpp.systemIncludePaths);
var useCompilerPaths = product.Qt.core.versionMajor >= 5;
if (useCompilerPaths) {
includePaths = includePaths.uniqueConcat(input.cpp.compilerIncludePaths);
}
var frameworkPaths = product.cpp.frameworkPaths;
frameworkPaths = frameworkPaths.uniqueConcat(
product.cpp.systemFrameworkPaths);
if (useCompilerPaths) {
frameworkPaths = frameworkPaths.uniqueConcat(
product.cpp.compilerFrameworkPaths);
}
var pluginMetaData = product.Qt.core.pluginMetaData;
var args = [];
if (product.Qt.core._generateMetaTypesFile)
args.push("--output-json");
var outputFileName;
for (tag in outputs) {
if (tag !== "qt.core.metatypes.in") {
outputFileName = outputs[tag][0].filePath;
break;
}
}
args = args.concat(
defines.map(function(item) { return '-D' + item; }),
includePaths.map(function(item) { return '-I' + item; }),
frameworkPaths.map(function(item) { return '-F' + item; }),
pluginMetaData.map(function(item) { return '-M' + item; }),
product.Qt.core.mocFlags,
'-o', outputFileName,
input.filePath);
return args;
}
function fullPath(product)
{
if (Utilities.versionCompare(product.Qt.core.version, "6.1") < 0)
return product.Qt.core.binPath + '/' + product.Qt.core.mocName;
return product.Qt.core.libExecPath + '/' + product.Qt.core.mocName;
}
function outputArtifacts(project, product, inputs, input)
{
var mocInfo = QtMocScanner.apply(input);
if (!mocInfo.hasQObjectMacro)
return [];
var artifact = { fileTags: ["unmocable"] };
if (mocInfo.hasPluginMetaDataMacro)
artifact.explicitlyDependsOn = ["qt_plugin_metadata"];
if (input.fileTags.contains("hpp")) {
artifact.filePath = input.Qt.core.generatedHeadersDir
+ "/moc_" + input.completeBaseName + ".cpp";
var amalgamate = input.Qt.core.combineMocOutput;
artifact.fileTags.push(mocInfo.mustCompile ? (amalgamate ? "moc_cpp" : "cpp") : "hpp");
} else {
artifact.filePath = input.Qt.core.generatedHeadersDir + '/'
+ input.completeBaseName + ".moc";
artifact.fileTags.push("hpp");
}
var artifacts = [artifact];
if (product.Qt.core._generateMetaTypesFile)
artifacts.push({filePath: artifact.filePath + ".json", fileTags: "qt.core.metatypes.in"});
return artifacts;
}
function commands(project, product, inputs, outputs, input, output)
{
var cmd = new Command(fullPath(product), args(product, input, outputs));
cmd.description = 'moc ' + input.fileName;
cmd.highlight = 'codegen';
return cmd;
}
function generateMocCppCommands(inputs, output)
{
var cmd = new JavaScriptCommand();
cmd.description = "creating " + output.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
ModUtils.mergeCFiles(inputs["moc_cpp"], output.filePath);
};
return [cmd];
}
function generateMetaTypesCommands(inputs, output)
{
var inputFilePaths = inputs["qt.core.metatypes.in"].map(function(a) {
return a.filePath;
});
var cmd = new Command(fullPath(product),
["--collect-json", "-o", output.filePath].concat(inputFilePaths));
cmd.description = "generating " + output.fileName;
cmd.highlight = "codegen";
return cmd;
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/scxml.qbs 0000644 0001751 0000166 00000006052 14776170045 024061 0 ustar runner docker import qbs.FileInfo
import qbs.Utilities
QtModule {
qtModuleName: "Scxml"
property string _qscxmlcDir: Utilities.versionCompare(Qt.core.version, "6.3") >= 0
? Qt.core.libExecPath : Qt.core.binPath
property string qscxmlcName: "qscxmlc"
property string className
property string namespace
property bool generateStateMethods
property stringList additionalCompilerFlags
Rule {
inputs: ["qt.scxml.compilable"]
Artifact {
filePath: FileInfo.joinPaths(input.moduleProperty("Qt.core", "generatedHeadersDir"),
input.baseName + ".h")
fileTags: ["hpp", "unmocable"]
}
Artifact {
filePath: input.baseName + ".cpp"
fileTags: ["cpp", "unmocable", "qt.untranslatable"]
}
prepare: {
var compilerName = product.moduleProperty("Qt.scxml", "qscxmlcName");
var compilerPath = FileInfo.joinPaths(input.Qt.scxml._qscxmlcDir, compilerName);
var args = ["--header", outputs["hpp"][0].filePath,
"--impl", outputs["cpp"][0].filePath];
var cxx98 = input.moduleProperty("cpp", "cxxLanguageVersion") === "c++98";
if (cxx98)
args.push("-no-c++11");
var className = input.moduleProperty("Qt.scxml", "className");
if (className)
args.push("--classname", className);
var namespace = input.moduleProperty("Qt.scxml", "namespace");
if (namespace)
args.push("--namespace", namespace);
if (input.Qt.scxml.generateStateMethods
&& Utilities.versionCompare(product.Qt.scxml.version, "5.9") >= 0) {
args.push("--statemethods");
}
if (input.Qt.scxml.additionalCompilerFlags)
args = args.concat(input.Qt.scxml.additionalCompilerFlags);
args.push(input.filePath);
var cmd = new Command(compilerPath, args);
cmd.description = "compiling " + input.fileName;
cmd.highlight = "codegen";
return [cmd];
}
}
version: @version@
architectures: @archs@
targetPlatform: @targetPlatform@
staticLibsDebug: @staticLibsDebug@
staticLibsRelease: @staticLibsRelease@
dynamicLibsDebug: @dynamicLibsDebug@
dynamicLibsRelease: @dynamicLibsRelease@
linkerFlagsDebug: @linkerFlagsDebug@
linkerFlagsRelease: @linkerFlagsRelease@
frameworksDebug: @frameworksDebug@
frameworksRelease: @frameworksRelease@
frameworkPathsDebug: @frameworkPathsDebug@
frameworkPathsRelease: @frameworkPathsRelease@
libNameForLinkerDebug: @libNameForLinkerDebug@
libNameForLinkerRelease: @libNameForLinkerRelease@
libFilePathDebug: @libFilePathDebug@
libFilePathRelease: @libFilePathRelease@
pluginTypes: @pluginTypes@
moduleConfig: @moduleConfig@
cpp.defines: @defines@
cpp.systemIncludePaths: @includes@
cpp.libraryPaths: @libraryPaths@
@additionalContent@
}
qbs-src-2.6.1/share/qbs/module-providers/Qt/templates/core.qbs 0000644 0001751 0000166 00000046063 14776170045 023671 0 ustar runner docker import qbs.FileInfo
import qbs.ModUtils
import qbs.TextFile
import qbs.Utilities
import "core.js" as Core
import "moc.js" as Moc
import "qdoc.js" as Qdoc
import "rcc.js" as Rcc
Module {
condition: (qbs.targetPlatform === targetPlatform || isCombinedUIKitBuild)
&& (!qbs.architecture
|| architectures.length === 0
|| architectures.contains(qbs.architecture))
readonly property bool isCombinedUIKitBuild: ["ios", "tvos", "watchos"].contains(targetPlatform)
&& (!qbs.architecture || ["x86", "x86_64"].contains(qbs.architecture))
&& qbs.targetPlatform === targetPlatform + "-simulator"
Depends { name: "cpp" }
Depends { name: "Sanitizers.address"; condition: config.contains("sanitize_address") }
Group {
condition: qbs.targetOS.contains("android")
Depends { name: "Qt.android_support" }
product.Qt.android_support._qtBinaryDir: FileInfo.path(binPath)
product.Qt.android_support._qtInstallDir: FileInfo.path(installPath)
product.Qt.android_support.version: version
product.Qt.android_support.rccFilePath: Rcc.fullPath(product)
}
// qmlImportScanner is required by androiddeployqt even if the project doesn't
// depend on qml. That's why the scannerName must be defined here and not in the
// qml module
property string qmlImportScannerName: "qmlimportscanner"
property string qmlImportScannerFilePath: qmlLibExecPath + '/' + qmlImportScannerName
version: @version@
property stringList architectures: @archs@
property string targetPlatform: @targetPlatform@
property string libInfix: @libInfix@
property stringList config: @config@
property stringList qtConfig: @qtConfig@
readonly property stringList enabledFeatures: @enabledFeatures@
readonly property stringList disabledFeatures: @disabledFeatures@
property path binPath: @binPath@
property path installPath: @installPath@
property path incPath: @incPath@
property path libPath: @libPath@
property path installPrefixPath: @installPrefixPath@
property path libExecPath: @libExecPath@
property path qmlLibExecPath: @qmlLibExecPath@
property path pluginPath: @pluginPath@
property string mkspecName: @mkspecName@
property path mkspecPath: @mkspecPath@
property string mocName: "moc"
property stringList mocFlags: []
property string lreleaseName: "lrelease"
property string lupdateName: "lupdate"
property string rccName: "rcc"
property string qdocName: versionMajor >= 5 ? "qdoc" : "qdoc3"
property stringList qdocEnvironment
property path docPath: @docPath@
property path translationsPath: @translationsPath@
property string helpGeneratorLibExecPath: @helpGeneratorLibExecPath@
property stringList helpGeneratorArgs: versionMajor >= 5 ? ["-platform", "minimal"] : []
property var versionParts: version ? version.split('.').map(function(item) { return parseInt(item, 10); }) : []
property int versionMajor: versionParts[0]
property int versionMinor: versionParts[1]
property int versionPatch: versionParts[2]
property bool frameworkBuild: @frameworkBuild@
property bool staticBuild: @staticBuild@
property bool multiThreading: @multiThreading@
property stringList pluginMetaData: []
property bool enableKeywords: true
property bool generateMetaTypesFile
readonly property bool _generateMetaTypesFile: generateMetaTypesFile
&& Utilities.versionCompare(version, "5.15") >= 0
property string metaTypesInstallDir
property stringList availableBuildVariants: @availableBuildVariants@
property string qtBuildVariant: {
if (availableBuildVariants.contains(qbs.buildVariant))
return qbs.buildVariant;
if (qbs.buildVariant === "profiling" && availableBuildVariants.contains("release"))
return "release";
return availableBuildVariants.length > 0 ? availableBuildVariants[0] : "";
}
property stringList staticLibsDebug: @staticLibsDebug@
property stringList staticLibsRelease: @staticLibsRelease@
property stringList dynamicLibsDebug: @dynamicLibsDebug@
property stringList dynamicLibsRelease: @dynamicLibsRelease@
property stringList staticLibs: qtBuildVariant === "debug"
? staticLibsDebug : staticLibsRelease
property stringList dynamicLibs: qtBuildVariant === "debug"
? dynamicLibsDebug : dynamicLibsRelease
property stringList linkerFlagsDebug: @linkerFlagsDebug@
property stringList linkerFlagsRelease: @linkerFlagsRelease@
property stringList coreLinkerFlags: qtBuildVariant === "debug"
? linkerFlagsDebug : linkerFlagsRelease
property stringList frameworksDebug: @frameworksDebug@
property stringList frameworksRelease: @frameworksRelease@
property stringList coreFrameworks: qtBuildVariant === "debug"
? frameworksDebug : frameworksRelease
property stringList frameworkPathsDebug: @frameworkPathsDebug@
property stringList frameworkPathsRelease: @frameworkPathsRelease@
property stringList coreFrameworkPaths: qtBuildVariant === "debug"
? frameworkPathsDebug : frameworkPathsRelease
property string libNameForLinkerDebug: @libNameForLinkerDebug@
property string libNameForLinkerRelease: @libNameForLinkerRelease@
property string libNameForLinker: qtBuildVariant === "debug"
? libNameForLinkerDebug : libNameForLinkerRelease
property string libFilePathDebug: @libFilePathDebug@
property string libFilePathRelease: @libFilePathRelease@
property string libFilePath: qtBuildVariant === "debug"
? libFilePathDebug : libFilePathRelease
property bool useRPaths: qbs.targetOS.contains("linux") && !qbs.targetOS.contains("android")
property stringList coreLibPaths: @libraryPaths@
property bool hasLibrary: true
// These are deliberately not path types
// We don't want to resolve them against the source directory
property string generatedHeadersDir: product.buildDirectory + "/qt.headers"
property string qdocOutputDir: product.buildDirectory + "/qdoc_html"
property string qmDir: product.destinationDirectory
property string qmBaseName: product.targetName
property bool lreleaseMultiplexMode: false
property stringList moduleConfig: @moduleConfig@
Properties {
condition: moduleConfig.contains("use_gold_linker")
cpp.linkerVariant: "gold"
}
Properties {
condition: Utilities.versionCompare(version, "6") >= 0
cpp.cxxLanguageVersion: "c++17"
}
Properties {
condition: Utilities.versionCompare(version, "6") < 0
&& Utilities.versionCompare(version, "5.7.0") >= 0
cpp.cxxLanguageVersion: "c++11"
}
cpp.enableCompilerDefinesByLanguage: ["cpp"].concat(
qbs.targetOS.contains("darwin") ? ["objcpp"] : [])
cpp.defines: {
var defines = @defines@;
// ### QT_NO_DEBUG must be added if the current build variant is not derived
// from the build variant "debug"
if (!qbs.enableDebugCode)
defines.push("QT_NO_DEBUG");
if (!enableKeywords)
defines.push("QT_NO_KEYWORDS");
if (qbs.targetOS.containsAny(["ios", "tvos"])) {
defines = defines.concat(["DARWIN_NO_CARBON", "QT_NO_CORESERVICES", "QT_NO_PRINTER",
"QT_NO_PRINTDIALOG"]);
if (Utilities.versionCompare(version, "5.6.0") < 0)
defines.push("main=qtmn");
}
if (qbs.toolchain.contains("msvc"))
defines.push("_ENABLE_EXTENDED_ALIGNED_STORAGE");
return defines;
}
cpp.driverFlags: {
var flags = [];
if (qbs.toolchain.contains("gcc")) {
if (config.contains("sanitize_undefined"))
flags.push("-fsanitize=undefined");
if (config.contains("sanitize_thread"))
flags.push("-fsanitize=thread");
if (config.contains("sanitize_memory"))
flags.push("-fsanitize=memory");
}
return flags;
}
cpp.includePaths: generatedHeadersDir
cpp.systemIncludePaths: @includes@.concat(mkspecPath)
cpp.libraryPaths: {
var libPaths = [libPath];
if (staticBuild && pluginPath)
libPaths.push(pluginPath + "/platforms");
libPaths = libPaths.concat(coreLibPaths);
return libPaths;
}
cpp.staticLibraries: {
var libs = [];
if (qbs.targetOS.contains('windows') && !product.consoleApplication) {
libs = libs.concat(qtBuildVariant === "debug"
? @entryPointLibsDebug@ : @entryPointLibsRelease@);
}
libs = libs.concat(staticLibs);
return libs;
}
cpp.dynamicLibraries: dynamicLibs
cpp.linkerFlags: coreLinkerFlags
cpp.systemFrameworkPaths: coreFrameworkPaths.concat(frameworkBuild ? [libPath] : [])
cpp.frameworks: {
var frameworks = coreFrameworks
if (frameworkBuild)
frameworks.push(libNameForLinker);
if (qbs.targetOS.contains('ios') && staticBuild)
frameworks = frameworks.concat(["Foundation", "CoreFoundation"]);
if (frameworks.length === 0)
return undefined;
return frameworks;
}
cpp.rpaths: useRPaths ? libPath : undefined
Properties {
condition: qbs.toolchain.contains("msvc") && config.contains("static_runtime")
cpp.runtimeLibrary: "static"
}
Properties {
condition: qbs.toolchain.contains("msvc") && !config.contains("static_runtime")
cpp.runtimeLibrary: "dynamic"
}
Properties {
condition: versionMajor >= 5
cpp.positionIndependentCode: true
}
cpp.cxxFlags: {
var flags = [];
if (qbs.toolchain.contains('msvc')) {
if (versionMajor < 5)
flags.push('/Zc:wchar_t-');
if (Utilities.versionCompare(version, "6.3") >= 0
&& Utilities.versionCompare(cpp.compilerVersion, "19.10") >= 0) {
flags.push("/permissive-");
}
}
if (qbs.toolchain.includes("emscripten") && multiThreading)
flags.push("-pthread");
return flags;
}
Properties {
condition: qbs.targetOS.contains('darwin') && qbs.toolchain.contains('clang')
&& config.contains('c++11')
cpp.cxxStandardLibrary: "libc++"
}
Properties {
condition: qbs.toolchain.includes("emscripten")
cpp.driverLinkerFlags: {
var flags = [
"-sMAX_WEBGL_VERSION=2",
"-sFETCH=1",
"-sWASM_BIGINT=1",
"-sMODULARIZE",
"-sEXPORT_NAME=createQtAppInstance",
"-sALLOW_MEMORY_GROWTH",
'-sASYNCIFY_IMPORTS=["qt_asyncify_suspend_js", "qt_asyncify_resume_js"]',
'-sEXPORTED_RUNTIME_METHODS=["UTF16ToString", "stringToUTF16", "JSEvents", "specialHTMLTargets", "FS"]',
"-lembind"
];
if (multiThreading)
flags.push("-pthread")
return flags;
}
}
cpp.minimumWindowsVersion: @minWinVersion_optional@
cpp.minimumMacosVersion: @minMacVersion_optional@
cpp.minimumIosVersion: @minIosVersion_optional@
cpp.minimumTvosVersion: @minTvosVersion_optional@
cpp.minimumWatchosVersion: @minWatchosVersion_optional@
cpp.minimumAndroidVersion: @minAndroidVersion_optional@
// Universal Windows Platform support
cpp.windowsApiFamily: mkspecName.startsWith("winrt-") ? "pc" : undefined
cpp.windowsApiAdditionalPartitions: mkspecPath.startsWith("winrt-") ? ["phone"] : undefined
cpp.requireAppContainer: mkspecName.startsWith("winrt-")
additionalProductTypes: ["qm", "qt.core.metatypes"]
validate: {
var validator = new ModUtils.PropertyValidator("Qt.core");
validator.setRequiredProperty("binPath", binPath);
validator.setRequiredProperty("incPath", incPath);
validator.setRequiredProperty("libPath", libPath);
validator.setRequiredProperty("mkspecPath", mkspecPath);
validator.setRequiredProperty("version", version);
validator.setRequiredProperty("config", config);
validator.setRequiredProperty("qtConfig", qtConfig);
validator.setRequiredProperty("versionMajor", versionMajor);
validator.setRequiredProperty("versionMinor", versionMinor);
validator.setRequiredProperty("versionPatch", versionPatch);
if (!staticBuild)
validator.setRequiredProperty("pluginPath", pluginPath);
// Allow custom version suffix since some distributions might want to do this,
// but otherwise the version must start with a valid 3-component string
validator.addVersionValidator("version", version, 3, 3, true);
validator.addRangeValidator("versionMajor", versionMajor, 1);
validator.addRangeValidator("versionMinor", versionMinor, 0);
validator.addRangeValidator("versionPatch", versionPatch, 0);
validator.addCustomValidator("availableBuildVariants", availableBuildVariants, function (v) {
return v.length > 0;
}, "the Qt installation supports no build variants");
validator.addCustomValidator("qtBuildVariant", qtBuildVariant, function (variant) {
return availableBuildVariants.contains(variant);
}, "'" + qtBuildVariant + "' is not supported by this Qt installation");
validator.addCustomValidator("qtBuildVariant", qtBuildVariant, function (variant) {
return variant === qbs.buildVariant || !qbs.toolchain.contains("msvc");
}, " is '" + qtBuildVariant + "', but qbs.buildVariant is '" + qbs.buildVariant
+ "', which is not allowed when using MSVC");
validator.addFileNameValidator("resourceFileBaseName", resourceFileBaseName);
validator.validate();
}
FileTagger {
patterns: ["*.qrc"]
fileTags: ["qrc"]
}
FileTagger {
patterns: ["*.ts"]
fileTags: ["ts"]
}
FileTagger {
patterns: ["*.qdoc", "*.qdocinc"]
fileTags: ["qdoc"]
}
FileTagger {
patterns: ["*.qdocconf"]
fileTags: ["qdocconf"]
}
FileTagger {
patterns: ["*.qhp"]
fileTags: ["qhp"]
}
property bool combineMocOutput: cpp.combineCxxSources
property bool enableBigResources: false
// Product should not moc in the aggregate when multiplexing.
property bool enableMoc: !(product.multiplexed || product.aggregate)
|| product.multiplexConfigurationId
Group {
condition: enableMoc
Rule {
name: "QtCoreMocRuleCpp"
property string cppInput: cpp.combineCxxSources ? "cpp.combine" : "cpp"
property string objcppInput: cpp.combineObjcxxSources ? "objcpp.combine" : "objcpp"
inputs: [objcppInput, cppInput]
auxiliaryInputs: "qt_plugin_metadata"
excludedInputs: "unmocable"
outputFileTags: ["hpp", "unmocable", "qt.core.metatypes.in", "qt.untranslatable"]
outputArtifacts: Moc.outputArtifacts.apply(Moc, arguments)
prepare: Moc.commands.apply(Moc, arguments)
}
Rule {
name: "QtCoreMocRuleHpp"
inputs: "hpp"
auxiliaryInputs: ["qt_plugin_metadata", "cpp", "objcpp"]
excludedInputs: "unmocable"
outputFileTags: ["hpp", "cpp", "moc_cpp", "unmocable", "qt.core.metatypes.in",
"qt.untranslatable"]
outputArtifacts: Moc.outputArtifacts.apply(Moc, arguments)
prepare: Moc.commands.apply(Moc, arguments)
}
}
Rule {
multiplex: true
inputs: ["moc_cpp"]
Artifact {
filePath: "amalgamated_moc_" + product.targetName + ".cpp"
fileTags: ["cpp", "unmocable", "qt.untranslatable"]
}
prepare: Moc.generateMocCppCommands(inputs, output)
}
Rule {
multiplex: true
inputs: "qt.core.metatypes.in"
Artifact {
filePath: product.targetName.toLowerCase() + "_metatypes.json"
fileTags: "qt.core.metatypes"
qbs.install: product.Qt.core.metaTypesInstallDir
qbs.installDir: product.Qt.core.metaTypesInstallDir
}
prepare: Moc.generateMetaTypesCommands(inputs, output)
}
property path resourceSourceBase
property string resourcePrefix: "/"
property string resourceFileBaseName: product.targetName
Rule {
multiplex: true
inputs: ["qt.core.resource_data"]
Artifact {
filePath: product.Qt.core.resourceFileBaseName + ".qrc"
fileTags: ["qrc"]
}
prepare: Rcc.generateQrcFileCommands.apply(Rcc, arguments)
}
Rule {
inputs: ["qrc"]
outputFileTags: ["cpp", "cpp_intermediate_object", "qt.untranslatable"]
outputArtifacts: Rcc.rccOutputArtifacts(input)
prepare: Rcc.rccCommands(product, input, output)
}
Rule {
inputs: ["intermediate_obj"]
Artifact {
filePath: input.completeBaseName + ".2" + input.cpp.objectSuffix
fileTags: ["obj"]
}
prepare: Rcc.rccPass2Commands(product, input, output)
}
Rule {
inputs: ["ts"]
multiplex: lreleaseMultiplexMode
Artifact {
filePath: FileInfo.joinPaths(product.Qt.core.qmDir,
(product.Qt.core.lreleaseMultiplexMode
? product.Qt.core.qmBaseName
: input.baseName) + ".qm")
fileTags: ["qm"]
}
prepare: Core.lreleaseCommands.apply(Core, arguments)
}
Rule {
inputs: "qdocconf-main"
explicitlyDependsOn: ["qdoc", "qdocconf"]
outputFileTags: ModUtils.allFileTags(Qdoc.qdocFileTaggers())
outputArtifacts: Qdoc.outputArtifacts(product, input)
prepare: Qdoc.commands(product, input)
}
Rule {
inputs: "qhp"
auxiliaryInputs: ModUtils.allFileTags(Qdoc.qdocFileTaggers())
.filter(function(tag) { return tag !== "qhp"; })
Artifact {
filePath: input.completeBaseName + ".qch"
fileTags: ["qch"]
}
prepare: Core.qhelpGeneratorCommands(product, input, output)
}
Group
{
condition: qbs.toolchain.includes("emscripten") && (product.type.includes("application")
&& product.type.includes("qthtml"))
Rule {
inputs: ["application"]
multiplex: true
Artifact {
filePath : FileInfo.joinPaths(product.buildDirectory, product.targetName + ".html")
fileTags : ["qthtml"]
}
prepare: Core.wasmQtHtmlCommands(product, output)
}
Group {
fileTags: ["qthtml"]
files: [
module.pluginPath + "/platforms/qtloader.js",
module.pluginPath + "/platforms/qtlogo.svg"
]
}
}
@additionalContent@
}
qbs-src-2.6.1/share/share.qbs 0000644 0001751 0000166 00000011031 14776170045 015357 0 ustar runner docker import qbs.File
import qbs.FileInfo
import qbs.TextFile
import qbs.Utilities
Product {
name: "qbs resources"
type: ["qbs qml type descriptions", "qbs qml type bundle"]
Depends { name: "qbsbuildconfig" }
Group {
name: "Incredibuild"
prefix: "../bin/"
files: ["ibmsvc.xml", "ibqbs.bat"]
fileTags: []
qbs.install: qbs.targetOS.contains("windows")
qbs.installDir: qbsbuildconfig.appInstallDir
}
Group {
name: "CMake"
files: "CMakeLists.txt"
}
Group {
name: "Python packages"
prefix: "../src/3rdparty/python/**/"
files: ["*.py"]
fileTags: ["qbs resources"]
qbs.install: true
qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share/qbs/python"
qbs.installSourceBase: "../src/3rdparty/python/lib/python3.9/site-packages"
}
Group {
name: "Imports"
files: ["qbs/imports/qbs/**/*"]
fileTags: ["qbs resources"]
qbs.install: true
qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share"
qbs.installSourceBase: "."
}
Group {
name: "Modules"
files: ["qbs/modules/**/*"]
fileTags: ["qbs resources"]
qbs.install: true
qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share"
qbs.installSourceBase: "."
}
Group {
name: "Module providers"
files: ["qbs/module-providers/*", "qbs/module-providers/**/*"]
fileTags: ["qbs resources"]
qbs.install: true
qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share"
qbs.installSourceBase: "."
}
Group {
name: "Examples as resources"
files: ["../examples/**/*"]
fileTags: []
qbs.install: true
qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share/qbs"
qbs.installSourceBase: ".."
}
Rule {
condition: Utilities.versionCompare(product.qbs.version, "1.9.1") >= 0
multiplex: true
Artifact {
filePath: "qbs.qmltypes"
fileTags: ["qbs qml type descriptions"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "generating " + output.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
var tf;
try {
tf = new TextFile(output.filePath, TextFile.WriteOnly);
tf.writeLine(Utilities.qmlTypeInfo());
} finally {
if (tf)
tf.close();
}
};
return cmd;
}
}
Rule {
condition: Utilities.versionCompare(product.qbs.version, "1.9.1") >= 0
multiplex: true
Artifact {
filePath: "qbs-bundle.json"
fileTags: ["qbs qml type bundle"]
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "generating " + output.fileName;
cmd.highlight = "codegen";
cmd.sourceCode = function() {
var tf;
try {
var imports = File.directoryEntries(FileInfo.joinPaths(product.sourceDirectory,
"qbs", "imports", "qbs"),
File.Dirs | File.NoDotAndDotDot).filter(
function(i) { return i !== "base"; }).concat(
Utilities.builtinExtensionNames()).map(
function(i) { return "qbs." + i; });
imports.sort();
var obj = {
"name": "qbs",
"searchPaths": ["$(QBS_IMPORT_PATH)"],
"installPaths": ["$(QBS_IMPORT_PATH)"],
"implicitImports": ["__javascriptQt5__"],
"supportedImports": ["qbs"].concat(imports)
};
tf = new TextFile(output.filePath, TextFile.WriteOnly);
tf.writeLine(JSON.stringify(obj, undefined, 4));
} finally {
if (tf)
tf.close();
}
};
return cmd;
}
}
Group {
name: "QML Type Info"
fileTagsFilter: ["qbs qml type descriptions", "qbs qml type bundle"]
qbs.install: true
qbs.installDir: qbsbuildconfig.qmlTypeDescriptionsInstallDir
}
}
qbs-src-2.6.1/share/CMakeLists.txt 0000644 0001751 0000166 00000007126 14776170045 016320 0 ustar runner docker if(WIN32)
install(
FILES ../bin/ibmsvc.xml ../bin/ibqbs.bat
DESTINATION "${QBS_APP_INSTALL_DIR}"
)
endif()
# below we copy some files that are required to run qbs from the build directory
# emulating the same layout we will have after the installation
# copy & install python packages
set(_SITE_PACKAGES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src/3rdparty/python/lib/python3.9/site-packages/)
file(GLOB_RECURSE _SITE_PACKAGES_RELATIVE RELATIVE "${_SITE_PACKAGES_DIR}" "${_SITE_PACKAGES_DIR}/*.py")
set(_SITE_PACKAGES_SRC ${_SITE_PACKAGES_RELATIVE})
list_transform_prepend(_SITE_PACKAGES_SRC "${_SITE_PACKAGES_DIR}/")
set(_SITE_PACKAGES_DST ${_SITE_PACKAGES_RELATIVE})
list_transform_prepend(_SITE_PACKAGES_DST "${CMAKE_BINARY_DIR}/${QBS_OUTPUT_PREFIX}${QBS_RESOURCES_INSTALL_DIR}/qbs/python/")
add_custom_command(
OUTPUT ${_SITE_PACKAGES_DST}
DEPENDS ${_SITE_PACKAGES_SRC}
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${_SITE_PACKAGES_DIR}"
${CMAKE_BINARY_DIR}/${QBS_OUTPUT_PREFIX}${QBS_RESOURCES_INSTALL_DIR}/qbs/python
COMMENT "Copying Python packages"
)
install(
# trailing slash avoid copying the 'site-packages' dir and only copies its content
DIRECTORY "${_SITE_PACKAGES_DIR}"
DESTINATION "${QBS_RESOURCES_INSTALL_DIR}/qbs/python"
FILES_MATCHING PATTERN "*.py"
)
# copy & install the "share/qbs" dir
file(GLOB_RECURSE _QBS_RESOURCES_RELATIVE RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/qbs/*")
set(_QBS_RESOURCES_SRC ${_QBS_RESOURCES_RELATIVE})
list_transform_prepend(_QBS_RESOURCES_SRC "${CMAKE_CURRENT_SOURCE_DIR}/")
set(_QBS_RESOURCES_DST ${_QBS_RESOURCES_RELATIVE})
list_transform_prepend(_QBS_RESOURCES_DST "${CMAKE_BINARY_DIR}/${QBS_OUTPUT_PREFIX}${QBS_RESOURCES_INSTALL_DIR}/")
add_custom_command(
OUTPUT ${_QBS_RESOURCES_DST}
DEPENDS ${_QBS_RESOURCES_SRC}
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/qbs
${CMAKE_BINARY_DIR}/${QBS_OUTPUT_PREFIX}${QBS_RESOURCES_INSTALL_DIR}/qbs
COMMENT "Copying QBS resources"
)
install(
DIRECTORY qbs
DESTINATION "${QBS_RESOURCES_INSTALL_DIR}"
PATTERN ".gitignore" EXCLUDE
)
# install examples dir
install(
DIRECTORY ../examples
DESTINATION "${QBS_RESOURCES_INSTALL_DIR}/qbs"
)
set(_QMLTYPES_INSTALL_PATH "${PROJECT_BINARY_DIR}/resources-build/install-root/share/qbs/qml-type-descriptions/qbs.qmltypes")
get_update_path_command(UPDATE_PATH_COMMAND)
get_target_property(_QBS_OUTPUT_DIR qbs RUNTIME_OUTPUT_DIRECTORY)
add_custom_command(
OUTPUT "${_QMLTYPES_INSTALL_PATH}"
COMMAND ${CMAKE_COMMAND} -E env "${UPDATE_PATH_COMMAND}" ${_QBS_OUTPUT_DIR}/qbs
resolve
--settings-dir ${PROJECT_BINARY_DIR}/settings
-f ${PROJECT_SOURCE_DIR}/qbs.qbs
-d ${PROJECT_BINARY_DIR}/
config:resources-build
qbs.installPrefix:""
project.withCode:false
project.withDocumentation:false
profile:none
COMMAND ${CMAKE_COMMAND} -E env "${UPDATE_PATH_COMMAND}" ${_QBS_OUTPUT_DIR}/qbs
build
--settings-dir ${PROJECT_BINARY_DIR}/settings
-f ${PROJECT_SOURCE_DIR}/qbs.qbs
-d ${PROJECT_BINARY_DIR}/
config:resources-build
-p "qbs resources"
DEPENDS qbs "${_QBS_RESOURCES_DST}" qbs_processlauncher
)
add_custom_target(
BuildQbsResources ALL
DEPENDS
${_SITE_PACKAGES_DST}
${_QBS_RESOURCES_DST}
"${_QMLTYPES_INSTALL_PATH}"
)
install(
DIRECTORY ${PROJECT_BINARY_DIR}/resources-build/install-root/share/qbs/qml-type-descriptions
DESTINATION "${QBS_RESOURCES_INSTALL_DIR}/qbs"
)
qbs-src-2.6.1/release/ 0000755 0001751 0000166 00000000000 14776170045 014070 5 ustar runner docker qbs-src-2.6.1/tests/ 0000755 0001751 0000166 00000000000 14776170045 013612 5 ustar runner docker qbs-src-2.6.1/tests/auto/ 0000755 0001751 0000166 00000000000 14776170045 014562 5 ustar runner docker qbs-src-2.6.1/tests/auto/tools/ 0000755 0001751 0000166 00000000000 14776170045 015722 5 ustar runner docker qbs-src-2.6.1/tests/auto/tools/tools.qbs 0000644 0001751 0000166 00000000455 14776170045 017575 0 ustar runner docker import qbs.Utilities
QbsUnittest {
Depends { name: "qbsversion" }
testName: "tools"
condition: qbsbuildconfig.enableUnitTests
files: [
"tst_tools.cpp",
"tst_tools.h"
]
cpp.defines: base.concat(["QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version)])
}
qbs-src-2.6.1/tests/auto/tools/tst_tools.h 0000644 0001751 0000166 00000006635 14776170045 020137 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include
#include
QT_BEGIN_NAMESPACE
class QTemporaryDir;
QT_END_NAMESPACE
namespace qbs {
class Settings;
}
class TestTools : public QObject
{
Q_OBJECT
public:
TestTools(qbs::Settings *settings);
~TestTools();
public slots:
virtual void initTestCase();
private slots:
void fileSaver();
void fileCaseCheck();
void testBuildConfigMerging();
void testFileInfo();
void testProcessNameByPid();
void testProfiles();
void testSettingsMigration();
void testSettingsMigration_data();
void set_operator_eq();
void set_swap();
void set_size();
void set_capacity();
void set_reserve();
void set_clear();
void set_remove();
void set_contains();
void set_containsSet();
void set_find();
void set_begin();
void set_end();
void set_insert();
void set_reverseIterators();
void set_stlIterator();
void set_stlMutableIterator();
void set_setOperations();
void set_makeSureTheComfortFunctionsCompile();
void set_initializerList();
void set_intersects();
void stringutils_join();
void stringutils_join_data();
void stringutils_join_empty();
void stringutils_join_char();
void stringutils_join_char_data();
void stringutils_trimmed();
void hash_tuple();
void hash_range();
void span();
private:
QString setupSettingsDir1();
QString setupSettingsDir2();
QString setupSettingsDir3();
qbs::Settings * const m_settings;
QList m_tmpDirs;
const QString testDataDir;
};
qbs-src-2.6.1/tests/auto/tools/tst_tools.cpp 0000644 0001751 0000166 00000107457 14776170045 020476 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#undef QT_NO_CAST_FROM_ASCII // I am qmake, and I approve this hack.
#include "tst_tools.h"
#include "../shared.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace qbs;
using namespace qbs::Internal;
namespace std {
template struct hash>
{
std::size_t operator()(const std::vector &v) const noexcept
{
return hashRange(v);
}
};
} // namespace std
TestTools::TestTools(Settings *settings)
: m_settings(settings), testDataDir(testWorkDir("tools"))
{
}
TestTools::~TestTools()
{
qDeleteAll(m_tmpDirs);
}
void TestTools::initTestCase()
{
QDir().mkpath(testDataDir);
}
void TestTools::fileSaver()
{
QVERIFY(QDir::setCurrent(testDataDir));
static const char *fn = "foo.txt";
const auto run = [](const std::function &func) {
if (QFile::exists(fn))
QVERIFY(QFile::remove(fn));
func();
if (QFile::exists(fn))
QVERIFY(QFile::remove(fn));
};
// failing to open the file means nothing works
run([] {
Internal::FileSaver fs(fn);
QVERIFY(!fs.device());
QVERIFY(!fs.write("hello"));
QVERIFY(!fs.commit());
QVERIFY(!QFile::exists(fn));
});
// verify that correct usage creates a file with the right contents
run([] {
Internal::FileSaver fs(fn);
QVERIFY(fs.open());
QVERIFY(fs.device());
QVERIFY(fs.write("hello"));
QVERIFY(fs.commit());
QVERIFY(QFile::exists(fn));
QFile f(fn);
QVERIFY(f.open(QIODevice::ReadOnly));
QCOMPARE(f.readAll(), QByteArrayLiteral("hello"));
});
// failing to commit writes nothing
run([] {
Internal::FileSaver fs(fn);
QVERIFY(fs.open());
QVERIFY(fs.device());
QVERIFY(fs.write("hello"));
QVERIFY(!QFile::exists(fn));
});
// verify that correct usage creates a file with the right contents and does not overwrite
run([] {
{
Internal::FileSaver fs(fn);
QVERIFY(fs.open());
QVERIFY(fs.device());
QVERIFY(fs.write("hello"));
QVERIFY(fs.commit());
QVERIFY(QFile::exists(fn));
QFile f(fn);
QVERIFY(f.open(QIODevice::ReadOnly));
QCOMPARE(f.readAll(), QByteArrayLiteral("hello"));
}
const auto lm = QFileInfo(fn).lastModified();
QVERIFY(lm.isValid());
waitForNewTimestamp(".");
{
Internal::FileSaver fs(fn);
QVERIFY(fs.open());
QVERIFY(fs.device());
QVERIFY(fs.write("hello"));
QVERIFY(fs.commit());
QVERIFY(QFile::exists(fn));
}
const auto lm2 = QFileInfo(fn).lastModified();
QVERIFY(lm2.isValid());
QCOMPARE(lm, lm2); // timestamps should be the same since content did not change
waitForNewTimestamp(".");
{
Internal::FileSaver fs(fn);
QVERIFY(fs.open());
QVERIFY(fs.device());
QVERIFY(fs.write("hello2"));
QVERIFY(fs.commit());
QVERIFY(QFile::exists(fn));
QFile f(fn);
QVERIFY(f.open(QIODevice::ReadOnly));
QCOMPARE(f.readAll(), QByteArrayLiteral("hello2"));
}
const auto lm3 = QFileInfo(fn).lastModified();
QVERIFY(lm3.isValid());
QVERIFY(lm != lm3); // timestamps should differ since the content changed
waitForNewTimestamp(".");
{
// Test overwriteIfUnchanged
Internal::FileSaver fs(fn, true);
QVERIFY(fs.open());
QVERIFY(fs.device());
QVERIFY(fs.write("hello2"));
QVERIFY(fs.commit());
QVERIFY(QFile::exists(fn));
QFile f(fn);
QVERIFY(f.open(QIODevice::ReadOnly));
QCOMPARE(f.readAll(), QByteArrayLiteral("hello2"));
}
const auto lm4 = QFileInfo(fn).lastModified();
QVERIFY(lm4.isValid());
QVERIFY(lm3 != lm4); // timestamps should differ since we always overwrite
});
}
void TestTools::testFileInfo()
{
QCOMPARE(FileInfo::fileName("C:/waffl/copter.exe"), QString("copter.exe"));
QCOMPARE(FileInfo::baseName("C:/waffl/copter.exe.lib"), QString("copter"));
QCOMPARE(FileInfo::completeBaseName("C:/waffl/copter.exe.lib"), QString("copter.exe"));
QCOMPARE(FileInfo::suffix("C:/waffl/copter.exe.lib"), QString("lib"));
QCOMPARE(FileInfo::completeSuffix("C:/waffl/copter.exe.lib"), QString("exe.lib"));
QCOMPARE(FileInfo::path("abc"), QString("."));
QCOMPARE(FileInfo::path("/abc/lol"), QString("/abc"));
QCOMPARE(FileInfo::path("/fileInRoot"), QString(QLatin1Char('/')));
if (HostOsInfo::isWindowsHost())
QCOMPARE(FileInfo::path("C:/fileInDriveRoot"), QString("C:/"));
QVERIFY(!FileInfo::isAbsolute("bla/lol"));
QVERIFY(FileInfo::isAbsolute("/bla/lol"));
if (HostOsInfo::isWindowsHost()) {
QVERIFY(FileInfo::isAbsolute("C:\\bla\\lol"));
QVERIFY(FileInfo::isAbsolute("C:\\"));
QVERIFY(FileInfo::isAbsolute("C:/"));
QVERIFY(!FileInfo::isAbsolute("C:"));
}
QCOMPARE(FileInfo::resolvePath("/abc/lol", "waffl"), QString("/abc/lol/waffl"));
QCOMPARE(FileInfo::resolvePath("/abc/def/ghi/jkl/", "../foo/bar"), QString("/abc/def/ghi/foo/bar"));
QCOMPARE(FileInfo::resolvePath("/abc/def/ghi/jkl/", "../../foo/bar"), QString("/abc/def/foo/bar"));
QCOMPARE(FileInfo::resolvePath("/abc", "../../../foo/bar"), QString("/foo/bar"));
if (HostOsInfo::isWindowsHost()) {
QCOMPARE(FileInfo::resolvePath("C:/share", ".."), QString("C:/"));
QCOMPARE(FileInfo::resolvePath("C:/share", "D:/"), QString("D:/"));
QCOMPARE(FileInfo::resolvePath("C:/share", "D:"), QString()); // should soft-assert
}
QCOMPARE(FileInfo("/does/not/exist").lastModified(), FileTime());
}
void TestTools::fileCaseCheck()
{
QTemporaryFile tempFile(QDir::tempPath() + QLatin1String("/CamelCase"));
QVERIFY2(tempFile.open(), qPrintable(tempFile.errorString()));
QFileInfo tempFileInfo(tempFile.fileName());
const QString lowerFilePath = tempFileInfo.absolutePath() + QLatin1Char('/')
+ tempFileInfo.fileName().toLower();
const QString upperFilePath = tempFileInfo.absolutePath() + QLatin1Char('/')
+ tempFileInfo.fileName().toUpper();
QVERIFY(FileInfo::isFileCaseCorrect(tempFileInfo.absoluteFilePath()));
if (QFile::exists(lowerFilePath))
QVERIFY(!FileInfo::isFileCaseCorrect(lowerFilePath));
if (QFile::exists(upperFilePath))
QVERIFY(!FileInfo::isFileCaseCorrect(upperFilePath));
}
void TestTools::testProfiles()
{
TemporaryProfile tpp("parent", m_settings);
Profile parentProfile = tpp.p;
TemporaryProfile tpc("child", m_settings);
Profile childProfile = tpc.p;
parentProfile.removeBaseProfile();
parentProfile.remove("testKey");
QCOMPARE(parentProfile.value("testKey", "none").toString(), QLatin1String("none"));
parentProfile.setValue("testKey", "testValue");
QCOMPARE(parentProfile.value("testKey").toString(), QLatin1String("testValue"));
childProfile.remove("testKey");
childProfile.removeBaseProfile();
QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("none"));
childProfile.setBaseProfile("parent");
QCOMPARE(childProfile.value("testKey").toString(), QLatin1String("testValue"));
// Change base profile and check if the inherited value also changes.
TemporaryProfile tpf("foo", m_settings);
Profile fooProfile = tpf.p;
fooProfile.setValue("testKey", "gnampf");
childProfile.setBaseProfile("foo");
QCOMPARE(childProfile.value("testKey", "none").toString(), QLatin1String("gnampf"));
ErrorInfo errorInfo;
childProfile.setBaseProfile("SmurfAlongWithMe");
childProfile.value("blubb", QString(), &errorInfo);
QVERIFY(errorInfo.hasError());
errorInfo.clear();
childProfile.setBaseProfile("parent");
parentProfile.setBaseProfile("child");
QVERIFY(!childProfile.value("blubb", QString(), &errorInfo).isValid());
QVERIFY(errorInfo.hasError());
QVERIFY(!childProfile.allKeys(Profile::KeySelectionNonRecursive).empty());
errorInfo.clear();
QVERIFY(childProfile.allKeys(Profile::KeySelectionRecursive, &errorInfo).empty());
QVERIFY(errorInfo.hasError());
}
void TestTools::testSettingsMigration()
{
QFETCH(QString, baseDir);
QFETCH(bool, hasOldSettings);
Settings settings(baseDir);
if (hasOldSettings) {
// checks that we do not copy old "profiles/" dir anymore
QVERIFY(!QFileInfo(settings.baseDirectory() + "/qbs/" QBS_VERSION "/profiles/right.txt")
.exists());
QVERIFY(!settings.value("key", Settings::UserScope).toString().isEmpty());
} else {
QVERIFY(!QFileInfo(settings.baseDirectory() + "/qbs/" QBS_VERSION "/profiles").exists());
QVERIFY(settings.allKeys(Settings::UserScope).empty());
}
}
void TestTools::testSettingsMigration_data()
{
QTest::addColumn("baseDir");
QTest::addColumn("hasOldSettings");
QTest::newRow("settings dir with lots of versions") << setupSettingsDir1() << true;
QTest::newRow("settings dir with only a fallback") << setupSettingsDir2() << true;
QTest::newRow("no previous settings") << setupSettingsDir3() << false;
}
QString TestTools::setupSettingsDir1()
{
const auto baseDir = new QTemporaryDir;
m_tmpDirs.push_back(baseDir);
const Version thisVersion = Version::fromString(QBS_VERSION);
Version predecessor;
if (thisVersion.patchLevel() > 0) {
predecessor.setMajorVersion(thisVersion.majorVersion());
predecessor.setMinorVersion(thisVersion.minorVersion());
predecessor.setPatchLevel(thisVersion.patchLevel() - 1);
} else if (thisVersion.minorVersion() > 0) {
predecessor.setMajorVersion(thisVersion.majorVersion());
predecessor.setMinorVersion(thisVersion.minorVersion() - 1);
predecessor.setPatchLevel(99);
} else {
predecessor.setMajorVersion(thisVersion.majorVersion() - 1);
predecessor.setMajorVersion(99);
predecessor.setPatchLevel(99);
}
const auto versions = QList() << Version(0, 1, 0) << Version(1, 0, 5) << predecessor
<< Version(thisVersion.majorVersion() + 1, thisVersion.minorVersion(),
thisVersion.patchLevel())
<< Version(thisVersion.majorVersion(), thisVersion.minorVersion() + 1,
thisVersion.patchLevel())
<< Version(thisVersion.majorVersion(), thisVersion.minorVersion(),
thisVersion.patchLevel() + 1)
<< Version(99, 99, 99);
for (const Version &v : versions) {
const QString settingsDir = baseDir->path() + "/qbs/" + v.toString();
QSettings s(settingsDir + "/qbs.conf",
HostOsInfo::isWindowsHost() ? QSettings::IniFormat : QSettings::NativeFormat);
const QString profilesDir = settingsDir + "/profiles";
QDir::root().mkpath(profilesDir);
const QString magicString = v == predecessor ? "right" : "wrong";
QFile f(profilesDir + '/' + magicString + ".txt");
f.open(QIODevice::WriteOnly);
s.setValue("org/qt-project/qbs/key", profilesDir + magicString);
}
return baseDir->path();
}
QString TestTools::setupSettingsDir2()
{
const auto baseDir = new QTemporaryDir;
m_tmpDirs.push_back(baseDir);
const QString settingsDir = baseDir->path();
QSettings s(settingsDir + QLatin1String("/qbs.conf"),
HostOsInfo::isWindowsHost() ? QSettings::IniFormat : QSettings::NativeFormat);
const QString profilesDir = settingsDir + QLatin1String("/qbs/profiles");
QDir::root().mkpath(profilesDir);
QFile f(profilesDir + "/right.txt");
f.open(QIODevice::WriteOnly);
s.setValue("org/qt-project/qbs/key", profilesDir + "right");
return baseDir->path();
}
QString TestTools::setupSettingsDir3()
{
const auto baseDir = new QTemporaryDir;
m_tmpDirs.push_back(baseDir);
return baseDir->path();
}
void TestTools::testBuildConfigMerging()
{
TemporaryProfile tp(QLatin1String("tst_tools_profile"), m_settings);
Profile profile = tp.p;
profile.setValue(QStringLiteral("topLevelKey"), QStringLiteral("topLevelValue"));
profile.setValue(QStringLiteral("qbs.toolchain"), QStringLiteral("gcc"));
profile.setValue(QStringLiteral("qbs.architecture"),
QStringLiteral("Jean-Claude Pillemann"));
profile.setValue(QStringLiteral("cpp.treatWarningsAsErrors"), true);
QVariantMap overrideMap;
overrideMap.insert(QStringLiteral("qbs.toolchain"), QStringLiteral("clang"));
overrideMap.insert(QStringLiteral("qbs.installRoot"), QStringLiteral("/blubb"));
SetupProjectParameters params;
params.setSettingsDirectory(m_settings->baseDirectory());
params.setTopLevelProfile(profile.name());
params.setConfigurationName(QStringLiteral("debug"));
params.setOverriddenValues(overrideMap);
const ErrorInfo error = params.expandBuildConfiguration();
QVERIFY2(!error.hasError(), qPrintable(error.toString()));
const QVariantMap finalMap = params.finalBuildConfigurationTree();
QCOMPARE(finalMap.size(), 3);
QCOMPARE(finalMap.value(QStringLiteral("topLevelKey")).toString(),
QStringLiteral("topLevelValue"));
const QVariantMap finalQbsMap = finalMap.value(QStringLiteral("qbs")).toMap();
QCOMPARE(finalQbsMap.size(), 4);
QCOMPARE(finalQbsMap.value(QStringLiteral("toolchain")).toString(),
QStringLiteral("clang"));
QCOMPARE(finalQbsMap.value(QStringLiteral("configurationName")).toString(),
QStringLiteral("debug"));
QCOMPARE(finalQbsMap.value(QStringLiteral("architecture")).toString(),
QStringLiteral("Jean-Claude Pillemann"));
QCOMPARE(finalQbsMap.value(QStringLiteral("installRoot")).toString(), QLatin1String("/blubb"));
const QVariantMap finalCppMap = finalMap.value(QStringLiteral("cpp")).toMap();
QCOMPARE(finalCppMap.size(), 1);
QCOMPARE(finalCppMap.value(QStringLiteral("treatWarningsAsErrors")).toBool(), true);
}
void TestTools::testProcessNameByPid()
{
QCOMPARE(qAppName(), processNameByPid(QCoreApplication::applicationPid()));
}
int toNumber(const QString &str)
{
int res = 0;
for (const QChar &c : str)
res = (res * 10) + c.digitValue();
return res;
}
void TestTools::set_operator_eq()
{
{
Set set1, set2;
QVERIFY(set1 == set2);
QVERIFY(!(set1 != set2));
set1.insert(1);
QVERIFY(set1 != set2);
QVERIFY(!(set1 == set2));
set2.insert(1);
QVERIFY(set1 == set2);
QVERIFY(!(set1 != set2));
set2.insert(1);
QVERIFY(set1 == set2);
QVERIFY(!(set1 != set2));
set1.insert(2);
QVERIFY(set1 != set2);
QVERIFY(!(set1 == set2));
}
{
Set set1, set2;
QVERIFY(set1 == set2);
QVERIFY(!(set1 != set2));
set1.insert("one");
QVERIFY(set1 != set2);
QVERIFY(!(set1 == set2));
set2.insert("one");
QVERIFY(set1 == set2);
QVERIFY(!(set1 != set2));
set2.insert("one");
QVERIFY(set1 == set2);
QVERIFY(!(set1 != set2));
set1.insert("two");
QVERIFY(set1 != set2);
QVERIFY(!(set1 == set2));
}
{
Set a;
Set b;
a += "otto";
b += "willy";
QVERIFY(a != b);
QVERIFY(!(a == b));
}
{
Set s1, s2;
s1.reserve(100);
s2.reserve(4);
QVERIFY(s1 == s2);
s1 << 100 << 200 << 300 << 400;
s2 << 400 << 300 << 200 << 100;
QVERIFY(s1 == s2);
}
}
void TestTools::set_swap()
{
Set s1, s2;
s1.insert(1);
s2.insert(2);
s1.swap(s2);
QCOMPARE(*s1.begin(),2);
QCOMPARE(*s2.begin(),1);
}
void TestTools::set_size()
{
Set set;
QVERIFY(set.size() == 0);
QVERIFY(set.empty());
QVERIFY(set.size() == set.size());
set.insert(1);
QVERIFY(set.size() == 1);
QVERIFY(!set.empty());
QVERIFY(set.size() == set.size());
set.insert(1);
QVERIFY(set.size() == 1);
QVERIFY(!set.empty());
QVERIFY(set.size() == set.size());
set.insert(2);
QVERIFY(set.size() == 2);
QVERIFY(!set.empty());
QVERIFY(set.size() == set.size());
set.remove(1);
QVERIFY(set.size() == 1);
QVERIFY(!set.empty());
QVERIFY(set.size() == set.size());
set.remove(1);
QVERIFY(set.size() == 1);
QVERIFY(!set.empty());
QVERIFY(set.size() == set.size());
set.remove(2);
QVERIFY(set.size() == 0);
QVERIFY(set.empty());
QVERIFY(set.size() == set.size());
}
void TestTools::set_capacity()
{
Set set;
size_t n = set.capacity();
QVERIFY(n == 0);
for (int i = 0; i < 1000; ++i) {
set.insert(i);
QVERIFY(set.capacity() >= set.size());
}
}
void TestTools::set_reserve()
{
Set set;
set.reserve(1000);
QVERIFY(set.capacity() >= 1000);
for (int i = 0; i < 500; ++i)
set.insert(i);
QVERIFY(set.capacity() >= 1000);
for (int j = 0; j < 500; ++j)
set.remove(j);
QVERIFY(set.capacity() >= 1000);
}
void TestTools::set_clear()
{
Set set1, set2;
QVERIFY(set1.size() == 0);
set1.clear();
QVERIFY(set1.size() == 0);
set1.insert("foo");
QVERIFY(set1.size() != 0);
set2 = set1;
set1.clear();
QVERIFY(set1.size() == 0);
QVERIFY(set2.size() != 0);
set2.clear();
QVERIFY(set1.size() == 0);
QVERIFY(set2.size() == 0);
}
void TestTools::set_remove()
{
Set set1;
const size_t max = 500;
for (size_t i = 0; i < max; ++i)
set1.insert(QString::number(i));
QCOMPARE(set1.size(), max);
for (size_t j = 0; j < max; ++j) {
set1.remove(QString::number((j * 17) % max));
QCOMPARE(set1.size(), max - j - 1);
}
}
void TestTools::set_contains()
{
Set set1;
for (int i = 0; i < 500; ++i) {
QVERIFY(!set1.contains(QString::number(i)));
set1.insert(QString::number(i));
QVERIFY(set1.contains(QString::number(i)));
}
QCOMPARE(set1.size(), size_t { 500 });
for (int j = 0; j < 500; ++j) {
int i = (j * 17) % 500;
QVERIFY(set1.contains(QString::number(i)));
set1.remove(QString::number(i));
QVERIFY(!set1.contains(QString::number(i)));
}
}
void TestTools::set_containsSet()
{
Set set1;
Set set2;
// empty set contains the empty set
QVERIFY(set1.contains(set2));
for (int i = 0; i < 500; ++i) {
set1.insert(QString::number(i));
set2.insert(QString::number(i));
}
QVERIFY(set1.contains(set2));
set2.remove(QString::number(19));
set2.remove(QString::number(82));
set2.remove(QString::number(7));
QVERIFY(set1.contains(set2));
set1.remove(QString::number(23));
QVERIFY(!set1.contains(set2));
// filled set contains the empty set as well
Set set3;
QVERIFY(set1.contains(set3));
// the empty set doesn't contain a filled set
QVERIFY(!set3.contains(set1));
// verify const signature
const Set set4;
QVERIFY(set3.contains(set4));
}
void TestTools::set_find()
{
Set set1;
for (int i = 0; i < 500; ++i) {
QVERIFY(set1.find(QString::number(i)) == set1.end());
set1.insert(QString::number(i));
const auto it = set1.find(QString::number(i));
QVERIFY(it != set1.end());
QVERIFY(*it == QString::number(i));
}
QCOMPARE(set1.size(), size_t { 500 });
for (int j = 0; j < 500; ++j) {
int i = (j * 17) % 500;
const auto it = set1.find(QString::number(i));
QVERIFY(it != set1.end());
QVERIFY(*it == QString::number(i));
set1.remove(QString::number(i));
QVERIFY(set1.find(QString::number(i)) == set1.end());
}
}
void TestTools::set_begin()
{
Set set1;
Set set2 = set1;
{
const auto i = set1.constBegin();
const auto j = set1.cbegin();
const auto k = set2.constBegin();
const auto ell = set2.cbegin();
QVERIFY(i == j);
QVERIFY(k == ell);
}
set1.insert(44);
{
const auto i = set1.constBegin();
const auto j = set1.cbegin();
const auto k = set2.constBegin();
const auto ell = set2.cbegin();
QVERIFY(i == j);
QVERIFY(k == ell);
}
set2 = set1;
{
const auto i = set1.constBegin();
const auto j = set1.cbegin();
const auto k = set2.constBegin();
const auto ell = set2.cbegin();
QVERIFY(i == j);
QVERIFY(k == ell);
}
}
void TestTools::set_end()
{
Set set1;
Set set2 = set1;
{
const auto i = set1.constEnd();
const auto j = set1.cend();
const auto k = set2.constEnd();
const auto ell = set2.cend();
QVERIFY(i == j);
QVERIFY(k == ell);
QVERIFY(set1.constBegin() == set1.constEnd());
QVERIFY(set2.constBegin() == set2.constEnd());
}
set1.insert(44);
{
const auto i = set1.constEnd();
const auto j = set1.cend();
const auto k = set2.constEnd();
const auto ell = set2.cend();
QVERIFY(i == j);
QVERIFY(k == ell);
QVERIFY(set1.constBegin() != set1.constEnd());
QVERIFY(set2.constBegin() == set2.constEnd());
}
set2 = set1;
{
const auto i = set1.constEnd();
const auto j = set1.cend();
const auto k = set2.constEnd();
const auto ell = set2.cend();
QVERIFY(i == j);
QVERIFY(k == ell);
QVERIFY(set1.constBegin() != set1.constEnd());
QVERIFY(set2.constBegin() != set2.constEnd());
}
set1.clear();
set2.clear();
QVERIFY(set1.constBegin() == set1.constEnd());
QVERIFY(set2.constBegin() == set2.constEnd());
}
struct IdentityTracker {
int value, id;
};
inline bool operator==(IdentityTracker lhs, IdentityTracker rhs) { return lhs.value == rhs.value; }
inline bool operator<(IdentityTracker lhs, IdentityTracker rhs) { return lhs.value < rhs.value; }
void TestTools::set_insert()
{
{
Set set1;
QVERIFY(set1.size() == 0);
set1.insert(1);
QVERIFY(set1.size() == 1);
set1.insert(2);
QVERIFY(set1.size() == 2);
set1.insert(2);
QVERIFY(set1.size() == 2);
QVERIFY(set1.contains(2));
set1.remove(2);
QVERIFY(set1.size() == 1);
QVERIFY(!set1.contains(2));
set1.insert(2);
QVERIFY(set1.size() == 2);
QVERIFY(set1.contains(2));
}
{
Set set1;
QVERIFY(set1.size() == 0);
set1 << 1;
QVERIFY(set1.size() == 1);
set1 << 2;
QVERIFY(set1.size() == 2);
set1 << 2;
QVERIFY(set1.size() == 2);
QVERIFY(set1.contains(2));
set1.remove(2);
QVERIFY(set1.size() == 1);
QVERIFY(!set1.contains(2));
set1 << 2;
QVERIFY(set1.size() == 2);
QVERIFY(set1.contains(2));
}
{
Set set;
QCOMPARE(set.size(), size_t { 0 });
const int dummy = -1;
IdentityTracker id00 = {0, 0}, id01 = {0, 1}, searchKey = {0, dummy};
QCOMPARE(set.insert(id00).first->id, id00.id);
QCOMPARE(set.size(), size_t { 1 });
QCOMPARE(set.insert(id01).first->id, id00.id); // first inserted is kept
QCOMPARE(set.size(), size_t { 1 });
QCOMPARE(set.find(searchKey)->id, id00.id);
}
}
void TestTools::set_reverseIterators()
{
Set s;
s << 1 << 17 << 61 << 127 << 911;
std::vector v(s.begin(), s.end());
std::reverse(v.begin(), v.end());
const Set &cs = s;
QVERIFY(std::equal(v.begin(), v.end(), s.rbegin()));
QVERIFY(std::equal(v.begin(), v.end(), s.crbegin()));
QVERIFY(std::equal(v.begin(), v.end(), cs.rbegin()));
QVERIFY(std::equal(s.rbegin(), s.rend(), v.begin()));
QVERIFY(std::equal(s.crbegin(), s.crend(), v.begin()));
QVERIFY(std::equal(cs.rbegin(), cs.rend(), v.begin()));
}
void TestTools::set_stlIterator()
{
Set set1;
for (int i = 0; i < 25000; ++i)
set1.insert(QString::number(i));
{
int sum = 0;
auto i = set1.cbegin();
while (i != set1.end()) {
sum += toNumber(*i);
++i;
}
QVERIFY(sum == 24999 * 25000 / 2);
}
{
int sum = 0;
auto i = set1.cend();
while (i != set1.begin()) {
--i;
sum += toNumber(*i);
}
QVERIFY(sum == 24999 * 25000 / 2);
}
}
void TestTools::set_stlMutableIterator()
{
Set set1;
for (int i = 0; i < 25000; ++i)
set1.insert(QString::number(i));
{
int sum = 0;
auto i = set1.begin();
while (i != set1.end()) {
sum += toNumber(*i);
++i;
}
QVERIFY(sum == 24999 * 25000 / 2);
}
{
int sum = 0;
auto i = set1.end();
while (i != set1.begin()) {
--i;
sum += toNumber(*i);
}
QVERIFY(sum == 24999 * 25000 / 2);
}
{
Set set2 = set1;
Set set3 = set2;
auto i = set2.begin();
auto j = set3.begin();
while (i != set2.end()) {
i = set2.erase(i);
}
QVERIFY(set2.empty());
QVERIFY(!set3.empty());
j = set3.end();
while (j != set3.begin()) {
j--;
if (j + 1 != set3.end())
set3.erase(j + 1);
}
if (set3.begin() != set3.end())
set3.erase(set3.begin());
QVERIFY(set2.empty());
QVERIFY(set3.empty());
i = set2.insert("foo").first;
QCOMPARE(*i, QLatin1String("foo"));
}
}
void TestTools::set_setOperations()
{
Set set1, set2;
set1 << "alpha" << "beta" << "gamma" << "delta" << "zeta" << "omega";
set2 << "beta" << "gamma" << "delta" << "epsilon" << "iota" << "omega";
Set set3 = set1;
set3.unite(set2);
QVERIFY(set3.size() == 8);
QVERIFY(set3.contains("alpha"));
QVERIFY(set3.contains("beta"));
QVERIFY(set3.contains("gamma"));
QVERIFY(set3.contains("delta"));
QVERIFY(set3.contains("epsilon"));
QVERIFY(set3.contains("zeta"));
QVERIFY(set3.contains("iota"));
QVERIFY(set3.contains("omega"));
Set set4 = set2;
set4.unite(set1);
QVERIFY(set4.size() == 8);
QVERIFY(set4.contains("alpha"));
QVERIFY(set4.contains("beta"));
QVERIFY(set4.contains("gamma"));
QVERIFY(set4.contains("delta"));
QVERIFY(set4.contains("epsilon"));
QVERIFY(set4.contains("zeta"));
QVERIFY(set4.contains("iota"));
QVERIFY(set4.contains("omega"));
QVERIFY(set3 == set4);
Set set5 = set1;
set5.intersect(set2);
QVERIFY(set5.size() == 4);
QVERIFY(set5.contains("beta"));
QVERIFY(set5.contains("gamma"));
QVERIFY(set5.contains("delta"));
QVERIFY(set5.contains("omega"));
Set set6 = set2;
set6.intersect(set1);
QVERIFY(set6.size() == 4);
QVERIFY(set6.contains("beta"));
QVERIFY(set6.contains("gamma"));
QVERIFY(set6.contains("delta"));
QVERIFY(set6.contains("omega"));
QVERIFY(set5 == set6);
Set set7 = set1;
set7.subtract(set2);
QVERIFY(set7.size() == 2);
QVERIFY(set7.contains("alpha"));
QVERIFY(set7.contains("zeta"));
Set set8 = set2;
set8.subtract(set1);
QVERIFY(set8.size() == 2);
QVERIFY(set8.contains("epsilon"));
QVERIFY(set8.contains("iota"));
Set set9 = set1 | set2;
QVERIFY(set9 == set3);
Set set10 = set1 & set2;
QVERIFY(set10 == set5);
Set set11 = set1 + set2;
QVERIFY(set11 == set3);
Set set12 = set1 - set2;
QVERIFY(set12 == set7);
Set set13 = set2 - set1;
QVERIFY(set13 == set8);
Set set14 = set1;
set14 |= set2;
QVERIFY(set14 == set3);
Set set15 = set1;
set15 &= set2;
QVERIFY(set15 == set5);
Set set16 = set1;
set16 += set2;
QVERIFY(set16 == set3);
Set set17 = set1;
set17 -= set2;
QVERIFY(set17 == set7);
Set set18 = set2;
set18 -= set1;
QVERIFY(set18 == set8);
}
void TestTools::set_makeSureTheComfortFunctionsCompile()
{
Set set1, set2, set3;
set1 << 5;
set1 |= set2;
set1 |= 5;
set1 &= set2;
set1 &= 5;
set1 += set2;
set1 += 5;
set1 -= set2;
set1 -= 5;
set1 = set2 | set3;
set1 = set2 & set3;
set1 = set2 + set3;
set1 = set2 - set3;
}
void TestTools::set_initializerList()
{
Set set = {1, 1, 2, 3, 4, 5};
QCOMPARE(set.size(), size_t { 5 });
QVERIFY(set.contains(1));
QVERIFY(set.contains(2));
QVERIFY(set.contains(3));
QVERIFY(set.contains(4));
QVERIFY(set.contains(5));
// check _which_ of the equal elements gets inserted (in the QHash/QMap case, it's the last):
const Set set2 = {{1, 0}, {1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}};
QCOMPARE(set2.size(), size_t { 5 });
const int dummy = -1;
const IdentityTracker searchKey = {1, dummy};
QCOMPARE(set2.find(searchKey)->id, 0);
Set emptySet{};
QVERIFY(emptySet.empty());
Set set3{{}, {}, {}};
QVERIFY(!set3.empty());
}
void TestTools::set_intersects()
{
Set s1;
Set s2;
QVERIFY(!s1.intersects(s1));
QVERIFY(!s1.intersects(s2));
s1 << 100;
QVERIFY(s1.intersects(s1));
QVERIFY(!s1.intersects(s2));
s2 << 200;
QVERIFY(!s1.intersects(s2));
s1 << 200;
QVERIFY(s1.intersects(s2));
Set s3;
s3 << 500;
QVERIFY(!s1.intersects(s3));
s3 << 200;
QVERIFY(s1.intersects(s3));
}
void TestTools::stringutils_join()
{
QFETCH(std::vector, input);
QFETCH(std::string, separator);
QFETCH(std::string, expectedResult);
QCOMPARE(join(input, separator), expectedResult);
}
void TestTools::stringutils_join_data()
{
QTest::addColumn>("input");
QTest::addColumn("separator");
QTest::addColumn("expectedResult");
QTest::newRow("data1")
<< std::vector()
<< std::string()
<< std::string();
QTest::newRow("data2")
<< std::vector()
<< std::string("separator")
<< std::string();
QTest::newRow("data3")
<< std::vector({"one"})
<< std::string("separator")
<< std::string("one");
QTest::newRow("data4")
<< std::vector({"one"})
<< std::string("separator")
<< std::string("one");
QTest::newRow("data5")
<< std::vector({"a", "b"})
<< std::string(" ")
<< std::string("a b");
QTest::newRow("data6")
<< std::vector({"a", "b", "c"})
<< std::string(" ")
<< std::string("a b c");
}
void TestTools::stringutils_join_empty()
{
std::vector list;
std::string string = join(list, std::string());
QVERIFY(string.empty());
}
void TestTools::stringutils_join_char()
{
QFETCH(std::vector, input);
QFETCH(char, separator);
QFETCH(std::string, expectedResult);
QCOMPARE(join(input, separator), expectedResult);
}
void TestTools::stringutils_join_char_data()
{
QTest::addColumn>("input");
QTest::addColumn("separator");
QTest::addColumn("expectedResult");
QTest::newRow("data1")
<< std::vector()
<< ' '
<< std::string();
QTest::newRow("data5")
<< std::vector({"a", "b"})
<< ' '
<< std::string("a b");
QTest::newRow("data6")
<< std::vector({"a", "b", "c"})
<< ' '
<< std::string("a b c");
}
void TestTools::stringutils_trimmed()
{
std::string a;
a = "Text";
QCOMPARE(a, std::string("Text"));
QCOMPARE(trimmed(a), std::string("Text"));
QCOMPARE(a, std::string("Text"));
a = " ";
QCOMPARE(trimmed(a), std::string(""));
QCOMPARE(a, std::string(" "));
a = " a ";
QCOMPARE(trimmed(a), std::string("a"));
a = "Text";
QCOMPARE(trimmed(std::move(a)), std::string("Text"));
a = " ";
QCOMPARE(trimmed(std::move(a)), std::string(""));
a = " a ";
QCOMPARE(trimmed(std::move(a)), std::string("a"));
}
void TestTools::hash_tuple()
{
using Key = std::tuple;
Key key0{0, 5};
Key key1{10, 20};
Key key2{30, 40};
std::unordered_map map;
map.insert({key1, 1});
map.insert({key2, 2});
QCOMPARE(map[key0], 0);
QCOMPARE(map[key1], 1);
QCOMPARE(map[key2], 2);
}
void TestTools::hash_range()
{
using Key = std::vector;
Key key0;
Key key1{1};
Key key2{1, 2};
std::unordered_map map;
map.insert({key1, 1});
map.insert({key2, 2});
QCOMPARE(map[key0], 0);
QCOMPARE(map[key1], 1);
QCOMPARE(map[key2], 2);
}
void TestTools::span()
{
std::vector vec;
qbs::Internal::span span(vec);
}
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
const SettingsPtr s = settings();
TestTools tt(s.get());
return QTest::qExec(&tt, argc, argv);
}
qbs-src-2.6.1/tests/auto/tools/CMakeLists.txt 0000644 0001751 0000166 00000000204 14776170045 020456 0 ustar runner docker add_qbs_test(tools
DEFINES
"QBS_VERSION=\"${QBS_VERSION}\""
SOURCES
tst_tools.cpp
tst_tools.h
)
qbs-src-2.6.1/tests/auto/language/ 0000755 0001751 0000166 00000000000 14776170045 016345 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/tst_language.h 0000644 0001751 0000166 00000016561 14776170045 021204 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef TST_LANGUAGE_H
#define TST_LANGUAGE_H
#include
#include
#include
#include
#include
#include
#include
#include
class TestLanguage : public QObject
{
Q_OBJECT
public:
TestLanguage(qbs::ILogSink *logSink, qbs::Settings *settings);
~TestLanguage();
private slots:
void init();
void initTestCase();
void additionalProductTypes();
void baseProperty();
void baseValidation();
void brokenDependencyCycle();
void brokenDependencyCycle_data();
void buildConfigStringListSyntax();
void builtinFunctionInSearchPathsProperty();
void chainedProbes();
void canonicalArchitecture();
void conditionalDepends();
void convertStringList();
void correctDeclInParentLookup();
void delayedError();
void delayedError_data();
void dependencyOnAllProfiles();
void dependsItemInGroup_data();
void dependsItemInGroup();
void derivedSubProject();
void disabledPropertiesItem_data();
void disabledPropertiesItem();
void disabledSubProject();
void dottedNames_data();
void dottedNames();
void duplicateMultiplexValues_data();
void duplicateMultiplexValues();
void emptyJsFile();
void enumerateProjectProperties();
void evalErrorInNonPresentModule_data();
void evalErrorInNonPresentModule();
void environmentVariable();
void errorInDisabledProduct();
void erroneousFiles_data();
void erroneousFiles();
void exports();
void fileContextProperties();
void fileInProductAndModule_data();
void fileInProductAndModule();
void fileTags_data();
void fileTags();
void groupConditions_data();
void groupConditions();
void groupName();
void getNativeSetting();
void homeDirectory();
void identifierSearch_data();
void identifierSearch();
void idUsage();
void idUniqueness();
void importCollection();
void inheritedPropertiesItems_data();
void inheritedPropertiesItems();
void invalidBindingInDisabledItem();
void invalidOverrides();
void invalidOverrides_data();
void invalidPropOnNonRequiredModule_data();
void invalidPropOnNonRequiredModule();
void itemPrototype();
void itemScope();
void jsExtensions();
void jsImportUsedInMultipleScopes_data();
void jsImportUsedInMultipleScopes();
void keepLoadingDependencies();
void localProfileAsTopLevelProfile();
void moduleMergingVariantValues();
void moduleNameCollisions_data();
void moduleNameCollisions();
void moduleParameters_data();
void moduleParameters();
void modulePrioritizationBySearchPath_data();
void modulePrioritizationBySearchPath();
void moduleProperties_data();
void moduleProperties();
void modulePropertiesInGroups();
void modulePropertyOverridesPerProduct();
void moduleScope();
void moduleWithProductDependency();
void modules_data();
void modules();
void multiplexedExports();
void multiplexingByProfile();
void multiplexingByProfile_data();
void nonApplicableModulePropertyInProfile();
void nonApplicableModulePropertyInProfile_data();
void nonRequiredProducts();
void nonRequiredProducts_data();
void outerInGroup();
void overriddenPropertiesAndPrototypes();
void overriddenPropertiesAndPrototypes_data();
void overriddenVariantProperty();
void parameterTypes();
void pathProperties();
void probesAndMultiplexing();
void productConditions();
void productDirectories();
void profileValuesAndOverriddenValues();
void projectFileLookup();
void projectFileLookup_data();
void propertiesBlocks_data();
void propertiesBlocks();
void propertiesBlockInGroup_data();
void propertiesBlockInGroup();
void propertiesItemInModule();
void propertyAssignmentInExportedGroup();
void qbs1275();
void qbsPropertiesInProjectCondition();
void qbsPropertyConvenienceOverride();
void relaxedErrorMode();
void relaxedErrorMode_data();
void requiredAndNonRequiredDependencies();
void requiredAndNonRequiredDependencies_data();
void suppressedAndNonSuppressedErrors();
void throwingProbe();
void throwingProbe_data();
void defaultValue();
void defaultValue_data();
void qualifiedId();
void recursiveProductDependencies();
void rfc1034Identifier();
void throwThings_data();
void throwThings();
void useInternalProfile();
void versionCompare();
void wildcards_data();
void wildcards();
private:
QHash productsFromProject(
qbs::Internal::ResolvedProjectPtr project);
qbs::Internal::ResolvedModuleConstPtr findModuleByName(
qbs::Internal::ResolvedProductPtr product, const QString &name);
QVariant productPropertyValue(qbs::Internal::ResolvedProductPtr product, QString propertyName);
void handleInitCleanupDataTags(const char *projectFileName, bool *handled);
qbs::Internal::TopLevelProjectPtr resolveProject(const char *relProjectFilePath = nullptr);
qbs::ILogSink * const m_logSink;
qbs::Settings * const m_settings;
qbs::Internal::Logger m_logger;
std::unique_ptr m_engine;
qbs::Internal::TopLevelProjectPtr project;
qbs::SetupProjectParameters defaultParameters;
const QString m_wildcardsTestDirPath;
QTemporaryDir m_tempDir;
QRandomGenerator m_rand;
};
#endif // TST_LANGUAGE_H
qbs-src-2.6.1/tests/auto/language/language.qbs 0000644 0001751 0000166 00000001024 14776170045 020634 0 ustar runner docker import qbs.Utilities
QbsUnittest {
Depends { name: "qbsversion" }
Depends { name: "qbsconsolelogger" }
testName: "language"
condition: qbsbuildconfig.enableUnitTests
files: [
"tst_language.cpp",
"tst_language.h"
]
cpp.defines: base.concat([
"QBS_VERSION=" + Utilities.cStringQuote(qbsversion.version),
"SRCDIR=" + Utilities.cStringQuote(path)
])
Group {
name: "testdata"
prefix: "testdata/"
files: ["**/*"]
fileTags: []
}
}
qbs-src-2.6.1/tests/auto/language/testdata/ 0000755 0001751 0000166 00000000000 14776170045 020156 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/ 0000755 0001751 0000166 00000000000 14776170045 025053 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/disabled-properties-item.qbs 0000644 0001751 0000166 00000001024 14776170045 032454 0 ustar runner docker Product {
name: "p"
Depends { name: "higher1" }
Depends { name: "higher2" }
property bool setProp
property string value: "fromProduct"
property stringList productProp: "default"
lower.n: 10
Group {
condition: setProp
product.lower.prop: value
product.lower.listProp: "WITH_PRODUCT_PROP"
product.productProp: "condition1"
}
Group {
condition: lower.n > 7
product.lower.listProp: "N_GREATER_7"
product.productProp: "condition2"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/modules/ 0000755 0001751 0000166 00000000000 14776170045 026523 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/modules/higher1/ 0000755 0001751 0000166 00000000000 14776170045 030052 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/modules/higher1/higher1.qbs 0000644 0001751 0000166 00000000766 14776170045 032121 0 ustar runner docker Module {
Depends { name: "lower" }
property bool setProp
property string value: "fromHigher1"
Properties {
condition: setProp
lower.prop: value
lower.listProp: "WITH_HIGHER1_PROP"
}
Properties {
condition: lower.n > 5
lower.listProp: "N_GREATER_5"
}
Properties {
condition: lower.n < 10
lower.listProp: "N_LESS_10"
}
Properties {
condition: lower.n < 20
lower.listProp: "N_LESS_20"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/modules/higher2/ 0000755 0001751 0000166 00000000000 14776170045 030053 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/modules/higher2/higher2.qbs 0000644 0001751 0000166 00000000433 14776170045 032112 0 ustar runner docker Module {
Depends { name: "lower" }
property bool setProp
Properties {
condition: setProp
lower.prop: undefined
lower.listProp: "WITH_HIGHER2_PROP"
}
Properties {
condition: lower.n > 6
lower.listProp: "N_GREATER_6"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/modules/lower/ 0000755 0001751 0000166 00000000000 14776170045 027653 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/disabled-properties-item/modules/lower/lower.qbs 0000644 0001751 0000166 00000000567 14776170045 031522 0 ustar runner docker Module {
property bool setProp
property string value: "fromLower"
property string prop: "default"
property stringList listProp
property int n: 0
Group {
condition: setProp
module.prop: outer + "_" + value
module.listProp: "WITH_LOWER_PROP"
}
Group {
condition: n
module.listProp: ["N_NON_ZERO"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/inherited-properties-items/ 0000755 0001751 0000166 00000000000 14776170045 025442 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/inherited-properties-items/inherited-properties-items.qbs0000644 0001751 0000166 00000000151 14776170045 033432 0 ustar runner docker Project {
qbsSearchPaths: sourceDirectory
references: "inherited-properties-items-product.qbs"
}
qbs-src-2.6.1/tests/auto/language/testdata/inherited-properties-items/imports/ 0000755 0001751 0000166 00000000000 14776170045 027137 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/inherited-properties-items/imports/DebugName.qbs 0000644 0001751 0000166 00000000125 14776170045 031473 0 ustar runner docker Properties {
condition: qbs.buildVariant === "debug"
name: "product_debug"
}
qbs-src-2.6.1/tests/auto/language/testdata/inherited-properties-items/imports/ReleaseName.qbs 0000644 0001751 0000166 00000000131 14776170045 032022 0 ustar runner docker Properties {
condition: qbs.buildVariant === "release"
name: "product_release"
}
././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/inherited-properties-items/inherited-properties-items-product.qbs qbs-src-2.6.1/tests/auto/language/testdata/inherited-properties-items/inherited-properties-items-pro0000644 0001751 0000166 00000000114 14776170045 033443 0 ustar runner docker Product {
name: "product_default"
DebugName {}
ReleaseName {}
}
qbs-src-2.6.1/tests/auto/language/testdata/suppressed-and-non-suppressed-errors.qbs 0000644 0001751 0000166 00000000334 14776170045 030117 0 ustar runner docker Project {
Product {
name: "mysterious creature"
files: ["easter bunny"]
}
Product {
name: "tasty food"
condition: false
Depends { name: "TheBeautifulSausage" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/invalidBindingInDisabledItem.qbs 0000644 0001751 0000166 00000000515 14776170045 026345 0 ustar runner docker Project {
Product {
name: "product1"
condition: false
someNonsense: "Bitte stellen Sie die Tassen auf den Tisch."
}
Product {
name: "product2"
Group {
condition: false
moreNonsense: "Follen. Follen. Hünuntergefollen. Auf dön Töppüch."
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/qbs-properties-in-project-condition.qbs 0000644 0001751 0000166 00000000160 14776170045 027675 0 ustar runner docker Project {
condition: qbs.targetOS.includes("whatever")
Product {
name: "never reached"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/versionCompare.qbs 0000644 0001751 0000166 00000001135 14776170045 023661 0 ustar runner docker import qbs.Utilities
Product {
name: {
var e = "unexpected comparison result";
if (Utilities.versionCompare("1.5", "1.5") !== 0)
throw e;
if (Utilities.versionCompare("1.5", "1.5.0") !== 0)
throw e;
if (Utilities.versionCompare("1.5", "1.6") >= 0)
throw e;
if (Utilities.versionCompare("1.6", "1.5") <= 0)
throw e;
if (Utilities.versionCompare("2.5", "1.6") <= 0)
throw e;
if (Utilities.versionCompare("1.6", "2.5") >= 0)
throw e;
return "versionCompare";
}
}
qbs-src-2.6.1/tests/auto/language/testdata/overridden-properties-and-prototypes.qbs 0000644 0001751 0000166 00000000104 14776170045 030201 0 ustar runner docker Product {
name: "p"
Depends { name: "multiple_backends" }
}
qbs-src-2.6.1/tests/auto/language/testdata/error-in-disabled-product.qbs 0000644 0001751 0000166 00000001617 14776170045 025652 0 ustar runner docker Project {
Product {
name: "a"
condition: false
property stringList l: [undefined]
}
Product {
name: "b"
condition: false
Group {
name: { throw "boo!" }
}
}
Product {
name: "c"
Group {
condition: false
name: { throw "boo!" }
}
}
Project {
condition: false
Project {
condition: true
Product {
name: "d"
condition: { throw "ouch!" }
}
}
}
Product {
condition: false
Rule {
inputs: [5]
}
}
Project {
condition: false
minimumQbsVersion: false
}
Product {
name: "e"
condition: dummy.falseProperty
Depends { name: "does.not.exist" }
Depends { name: "dummy" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/non-required-products.qbs 0000644 0001751 0000166 00000001341 14776170045 025135 0 ustar runner docker Project {
Product {
name: "depender"
Depends { name: "dummy" }
Depends { name: "dependee"; required: false }
Properties {
condition: dependee.present
dummy.defines: ["WITH_DEPENDEE"]
}
}
Project {
name: "subproject"
Product {
name: "dependee"
}
}
Product {
name: "p1"
condition: p2.present
Depends { name: "p2"; required: false }
}
Product {
name: "p2"
condition: p3.present
Depends { name: "p3"; required: false }
}
Product {
name: "p3"
condition: nosuchmodule.present
Depends { name: "nosuchmodule"; required: false }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/productconditions.qbs 0000644 0001751 0000166 00000001430 14776170045 024435 0 ustar runner docker import qbs.Probes
Project {
Product {
name: "product_no_condition"
}
Product {
name: "product_true_condition"
condition: 1 === 1
}
Product {
name: "product_false_condition"
condition: 1 === 2
}
Product {
name: "product_condition_dependent_of_module"
condition: qbs.architecture !== (qbs.architecture + "foo")
}
Product {
name: "product_probe_condition_true"
condition: trueProbe.found
Probe {
id: trueProbe
configure: { found = true; }
}
}
Product {
name: "product_probe_condition_false"
condition: falseProbe.found
Probe {
id: falseProbe
configure: { found = false; }
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/id-uniqueness.qbs 0000644 0001751 0000166 00000000406 14776170045 023456 0 ustar runner docker import "idusagebase.qbs" as DerivedProduct
Project {
id: theProject
DerivedProduct {
id: baseProduct // OK - even though 'baseProduct' is used in the base item.
}
DerivedProduct {
id: baseProduct // ERROR
}
}
qbs-src-2.6.1/tests/auto/language/testdata/modules.qbs 0000644 0001751 0000166 00000002566 14776170045 022346 0 ustar runner docker Project {
Product {
name: "no_modules"
property var foo
}
Product {
name: "qt_core"
dummyqt.core.version: "1.2.3"
property var foo: dummyqt.core.coreVersion
Depends {
name: "dummyqt.core"
}
}
Product {
name: "qt_gui"
property var foo: dummyqt.gui.guiProperty
Depends {
name: "dummyqt.gui"
}
}
Product {
name: "qt_gui_network"
property var foo: dummyqt.gui.guiProperty + ',' + dummyqt.network.networkProperty
Depends {
name: "dummyqt"
submodules: ["gui", "network"]
}
}
Product {
name: "deep_module_name"
property var foo: deepdummy.deep.moat.depth
Depends {
name: "deepdummy.deep.moat"
}
}
Product {
name: "deep_module_name_submodule_syntax1"
property var foo: deepdummy.deep.moat.depth
Depends {
name: "deepdummy.deep"
submodules: ["moat"]
}
}
Product {
name: "deep_module_name_submodule_syntax2"
property var foo: deepdummy.deep.moat.depth
Depends {
name: "deepdummy"
submodules: ["deep.moat"]
}
}
Product {
name: "dummy_twice"
Depends { name: "dummy" }
Depends { name: "dummy" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/properties-block-in-group.qbs 0000644 0001751 0000166 00000000753 14776170045 025714 0 ustar runner docker Product {
name: "in-group"
property bool featureEnabled: true
Depends { name: "dummy" }
Depends { name: "module_with_group" }
dummy.defines: ["BASEDEF"]
Group {
condition: featureEnabled
name: "the group"
files: ["dummy.txt" ]
Properties {
condition: name === "the group"
dummy.defines: outer.concat("FEATURE_ENABLED", name.toUpperCase().replace(' ', '_'))
}
dummy.defines: "GROUP_ONLY"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/ 0000755 0001751 0000166 00000000000 14776170045 023604 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/module-parameters.qbs 0000644 0001751 0000166 00000001750 14776170045 027744 0 ustar runner docker Project {
property bool overrideFromModule
property bool overrideFromExport
property bool overrideFromProduct
Product {
name: "dep"
Export {
Depends {
name: "higher";
condition: project.overrideFromExport
lower.param: "fromExportDepends"
}
Parameters { lower.param: "fromParameters" }
}
}
Product {
name: "main"
Depends {
name: "dep"
condition: project.overrideFromProduct
lower.param: "fromProductDepends"
}
Depends {
name: "higher"
condition: project.overrideFromProduct
lower.param: "fromProductDepends"
}
Depends { name: "dep"; condition: !project.overrideFromProduct }
Depends { name: "higher"; condition: !project.overrideFromProduct }
Depends { name: "highest" }
Depends { name: "broken"; required: false }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/ 0000755 0001751 0000166 00000000000 14776170045 025254 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/broken/ 0000755 0001751 0000166 00000000000 14776170045 026534 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/broken/broken.qbs 0000644 0001751 0000166 00000000225 14776170045 030522 0 ustar runner docker Module {
Depends { name: "higher"; lower.param: "shouldNeverAppear" }
validate: { throw "As the name indicates, this module is broken."; }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/lower/ 0000755 0001751 0000166 00000000000 14776170045 026404 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/lower/lower.qbs 0000644 0001751 0000166 00000000075 14776170045 030245 0 ustar runner docker Module {
Parameter { property string param: "origin" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/highest/ 0000755 0001751 0000166 00000000000 14776170045 026707 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/highest/highest.qbs 0000644 0001751 0000166 00000000215 14776170045 031047 0 ustar runner docker Module {
Depends {
name: "higher"
condition: project.overrideFromModule
lower.param: "fromModuleDepends"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/higher/ 0000755 0001751 0000166 00000000000 14776170045 026522 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-parameters/modules/higher/higher.qbs 0000644 0001751 0000166 00000000132 14776170045 030473 0 ustar runner docker Module {
Depends { name: "lower" }
Parameters { lower.param: "fromParameters" }
}
qbs-src-2.6.1/tests/auto/language/testdata/rfc1034identifier.qbs 0000644 0001751 0000166 00000000464 14776170045 024016 0 ustar runner docker import qbs.Utilities
CppApplication {
name: Utilities.rfc1034Identifier("this!has@special#characters$uh-oh,Undersc0r3s_Are.Bad")
Properties {
condition: qbs.targetOS.includes("darwin")
bundle.infoPlist: { return {"CFBundleIdentifier": "$(PRODUCT_NAME:rfc1034identifier)"}; }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/getNativeSetting.qbs 0000644 0001751 0000166 00000001634 14776170045 024155 0 ustar runner docker import qbs.FileInfo
import qbs.Utilities
import qbs.Host
Project {
Product {
name: "p1"
targetName: {
if (Host.os().includes("macos")) {
return Utilities.getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductName");
} else if (Host.os().includes("windows")) {
var productName = Utilities.getNativeSetting("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion", "ProductName");
if (productName.includes("Windows")) {
return "Windows";
}
return undefined;
} else {
return Utilities.getNativeSetting(FileInfo.joinPaths(path, "nativesettings.ini"), "osname");
}
}
}
Product {
name: "p2"
targetName: Utilities.getNativeSetting("/dev/null", undefined, "fallback");
}
}
qbs-src-2.6.1/tests/auto/language/testdata/zort 0000644 0001751 0000166 00000000000 14776170045 021065 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/canonicalArchitecture.qbs 0000644 0001751 0000166 00000000124 14776170045 025154 0 ustar runner docker import qbs.Utilities
Product {
name: Utilities.canonicalArchitecture("i386")
}
qbs-src-2.6.1/tests/auto/language/testdata/conditionaldepends_base.qbs 0000644 0001751 0000166 00000000230 14776170045 025520 0 ustar runner docker Product {
name: 'conditionaldepends_base'
property bool someProp: false
Depends {
condition: someProp
name: 'dummy'
}
}
qbs-src-2.6.1/tests/auto/language/testdata/parameter-types.qbs 0000644 0001751 0000166 00000000734 14776170045 024013 0 ustar runner docker Project {
Product {
name: "foo"
qbsSearchPaths: "./erroneous"
Depends { name: "module_with_parameters" }
Depends {
name: "bar"
module_with_parameters.boolParameter: true
module_with_parameters.intParameter: 156
module_with_parameters.stringParameter: "hello"
module_with_parameters.stringListParameter: ["la", "le", "lu"]
}
}
Product {
name: "bar"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/baseproperty_base.qbs 0000644 0001751 0000166 00000000101 14776170045 024366 0 ustar runner docker Product {
property var narf
property var zort: ["bar"]
}
qbs-src-2.6.1/tests/auto/language/testdata/buildconfigstringlistsyntax.qbs 0000644 0001751 0000166 00000000060 14776170045 026540 0 ustar runner docker Project {
property stringList someStrings
}
qbs-src-2.6.1/tests/auto/language/testdata/exports.qbs 0000644 0001751 0000166 00000007350 14776170045 022376 0 ustar runner docker import "exports_product.qbs" as ProductWithInheritedExportItem
Project {
Product {
type: "app"
name: "myapp"
Depends { name: "mylib" }
Depends { name: "dummy" }
Depends { name: "qbs" }
dummy.defines: ["BUILD_" + product.name.toUpperCase()]
dummy.includePaths: ["./app"]
}
references: [
"subdir/exports-mylib.qbs",
"subdir2/exports-mylib2.qbs"
]
Product {
type: "app"
name: "A"
Depends { name: "qbs" }
Depends { name: "B" }
}
Product {
type: "lib"
name: "B"
Export {
Depends { name: "C" }
Depends { name: "qbs" }
}
}
Product {
type: "lib"
name: "C"
Export {
Depends { name: "D" }
Depends { name: "qbs" }
}
}
Product {
type: "lib"
name: "D"
}
Product {
type: "app"
name: "myapp2"
Depends { name: "productWithInheritedExportItem" }
Depends { name: "qbs" }
}
ProductWithInheritedExportItem {
name: "productWithInheritedExportItem"
Export {
dummy.cFlags: base.concat("PRODUCT_" + exportingProduct.name.toUpperCase())
dummy.cxxFlags: ["-bar"]
Properties {
dummy.defines: base.concat(["DEF"])
}
}
}
Product {
type: "app"
name: "myapp3"
Depends { name: "productWithInheritedExportItem"; versionAtLeast: "2.0" }
}
Project {
name: "sub1"
Product {
name: "sub p1"
Export {
Depends { name: "dummy" }
dummy.someString: project.name
}
}
}
Project {
name: "sub2"
Product {
name: "sub p2"
Depends { name: "sub p1" }
}
}
ParentWithExport {
name: "libA"
Export { Depends { name: "libB" } }
}
ParentWithExport { name: "libB" }
ParentWithExport {
name: "libC"
Export { Depends { name: "libA" } }
}
ParentWithExport {
name: "libD"
Export { Depends { name: "libA" } }
}
Product {
name: "libE"
Depends { name: "libD" }
Depends { name: "libC" }
Group {
qbs.install: false
}
}
Product {
name: "dependency"
Probe {
id: configProbe
property var config
configure: {
var obj = {};
obj.featureX = true;
obj.featureY = false;
obj.featureZ = true;
config = obj;
found = true;
}
}
property var config: configProbe.config
Export {
property bool depend: false
property var config: exportingProduct.config
Group {
condition: depend
Depends { name: "cpp" }
Properties { cpp.includePaths: ["."] }
}
}
}
Product {
name: "depender"
Depends { name: "dependency" }
property bool featureX: dependency.config.featureX
property bool featureY: dependency.config.featureY
property bool featureZ: dependency.config.featureZ
}
Product {
name: "broken_cycle1"
Export {
property bool depend: true
Depends { name: "broken_cycle3"; condition: depend }
}
}
Product {
name: "broken_cycle2"
Export {
Depends { name: "broken_cycle1" }
broken_cycle1.depend: false
}
}
Product {
name: "broken_cycle3"
Depends { name: "broken_cycle2" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/empty-js-file.qbs 0000644 0001751 0000166 00000000060 14776170045 023346 0 ustar runner docker import "empty-js-file.js" as Empty
Product {
}
qbs-src-2.6.1/tests/auto/language/testdata/property-assignment-in-exported-group.qbs 0000644 0001751 0000166 00000000473 14776170045 030311 0 ustar runner docker Project {
Product {
name: "dep"
Export {
Depends { name: "dummy" }
Group {
name: "exported_group"
dummy.someString: "test"
files: ["narf"]
}
}
}
Product {
Depends { name: "dep" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/aboutdialog.cpp 0000644 0001751 0000166 00000000000 14776170045 023142 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/idusage_group.qbs 0000644 0001751 0000166 00000000110 14776170045 023512 0 ustar runner docker Group {
id: baseGroup
name: "base"
prefix: baseGroup.name
}
qbs-src-2.6.1/tests/auto/language/testdata/environmentvariable.qbs 0000644 0001751 0000166 00000000121 14776170045 024731 0 ustar runner docker import qbs.Environment
Product {
name: Environment.getEnv("PRODUCT_NAME")
}
qbs-src-2.6.1/tests/auto/language/testdata/modulepropertiesingroups.qbs 0000644 0001751 0000166 00000004507 14776170045 026064 0 ustar runner docker Project {
Product {
name: "grouptest"
Depends { name: "gmod.gmod1" }
Depends { name: "gmod3" }
Depends { name: "gmod4" }
gmod.gmod1.gmod1_list2: base.concat([name, gmod.gmod1.gmod1_string])
gmod.gmod1.gmod1_list3: ["product"]
gmod.gmod1.p1: 1
Group {
name: "g1"
files: ["Banana"]
gmod.gmod1.gmod1_string: name
gmod.gmod1.gmod1_list2: outer.concat([name])
gmod.gmod1.p2: 2
gmod2.prop: 1
gmod2.commonName: "g1"
gmod3.gmod3_string: "g1_gmod3"
gmod4.gmod4_string: "g1_gmod4"
Group {
name: "g1.1"
gmod.gmod1.gmod1_string: name
gmod.gmod1.gmod1_list2: outer.concat([name])
gmod.gmod1.p2: 4
gmod2.prop: 2
gmod2.commonName: name
gmod3.gmod3_string: "g1.1_gmod3"
gmod4.gmod4_string: "g1.1_gmod4"
}
Group {
name: "g1.2"
gmod.gmod1.gmod1_string: name
gmod.gmod1.gmod1_list2: outer.concat([name])
gmod.gmod1.p2: 8
gmod2.commonName: name
gmod3.gmod3_string: "g1.2_gmod3"
}
}
Group {
name: "g2"
files: ["zort"]
gmod.gmod1.gmod1_string: name
gmod.gmod1.p1: 2
gmod.gmod1.p2: 4
gmod2.prop: 2
gmod3.gmod3_string: name + "_gmod3"
gmod4.gmod4_string: name + "_gmod4"
Group {
name: "g2.1"
Group {
name: "g2.1.1"
gmod.gmod1.gmod1_list2: [name]
gmod.gmod1.p2: 15
}
}
}
}
Product {
name: "grouptest2"
Depends { name: "gmod.gmod1" }
Group {
name: "g1"
gmod.gmod1.gmod1_list2: ["G1"]
Group {
name: "g1.1"
gmod.gmod1.gmod1_string: "G1.1"
}
}
}
Product {
name: "module-property-in-group-condition"
Depends { name: "cpp" }
Group {
condition: qbs.architecture === "x86_64"
cpp.includePaths: "."
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/subdir/ 0000755 0001751 0000166 00000000000 14776170045 021446 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/subdir/pathproperties_base.qbs 0000644 0001751 0000166 00000000166 14776170045 026223 0 ustar runner docker Product {
property path base_fileInProductDir: "foo"
property path base_fileInBaseProductDir: path + "/bar"
}
qbs-src-2.6.1/tests/auto/language/testdata/subdir/exports-mylib.qbs 0000644 0001751 0000166 00000000747 14776170045 025003 0 ustar runner docker StaticLibrary {
name: "mylib"
Depends { name: "dummy" }
dummy.defines: ["BUILD_" + product.name.toUpperCase()]
property string definePrefix: "USE_"
property path aPath: "."
dummy.somePath: aPath
Export {
Depends { name: "dummy" }
Depends { name: "mylib2" }
dummy.defines: [exportingProduct.definePrefix + exportingProduct.name.toUpperCase()]
dummy.includePaths: ["./lib"]
dummy.somePath: exportingProduct.aPath
}
}
qbs-src-2.6.1/tests/auto/language/testdata/delayed-error/ 0000755 0001751 0000166 00000000000 14776170045 022714 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/delayed-error/validation.qbs 0000644 0001751 0000166 00000000250 14776170045 025552 0 ustar runner docker Project {
property bool enableProduct: true
Product {
name: "theProduct"
condition: project.enableProduct
Depends { name: "m" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/delayed-error/nonexisting.qbs 0000644 0001751 0000166 00000000263 14776170045 025771 0 ustar runner docker Project {
property bool enableProduct: true
Product {
name: "theProduct"
condition: project.enableProduct
Depends { name: "nosuchmodule" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/delayed-error/modules/ 0000755 0001751 0000166 00000000000 14776170045 024364 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/delayed-error/modules/m/ 0000755 0001751 0000166 00000000000 14776170045 024620 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/delayed-error/modules/m/m.qbs 0000644 0001751 0000166 00000000070 14776170045 025560 0 ustar runner docker Module {
validate: { throw "Validation error!"; }
}
qbs-src-2.6.1/tests/auto/language/testdata/dirwithoneproject/ 0000755 0001751 0000166 00000000000 14776170045 023721 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/dirwithoneproject/project.qbs 0000644 0001751 0000166 00000000000 14776170045 026064 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/ParentWithExport.qbs 0000644 0001751 0000166 00000000176 14776170045 024160 0 ustar runner docker Product {
Export {
Depends { name: "dummy" }
dummy.defines: [exportingProduct.name.toUpperCase()]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/nativesettings.ini 0000644 0001751 0000166 00000000016 14776170045 023723 0 ustar runner docker osname = Unix
qbs-src-2.6.1/tests/auto/language/testdata/use-internal-profile.qbs 0000644 0001751 0000166 00000000300 14776170045 024722 0 ustar runner docker Project {
name: "theproject"
Profile {
name: "theprofile"
dummy.defines: name
}
Product {
name: "theproduct"
Depends { name: "dummy" }
}
} qbs-src-2.6.1/tests/auto/language/testdata/modulescope.qbs 0000644 0001751 0000166 00000000400 14776170045 023176 0 ustar runner docker import "modulescope_base.qbs" as MyProduct
Project {
MyProduct {
name: "product1"
property int e: 12
property int f: 13
scopemod.a: 2
scopemod.f: 2
scopemod.g: e * f
scopemod.h: base + 2
}
}
qbs-src-2.6.1/tests/auto/language/testdata/throw.qbs 0000644 0001751 0000166 00000000703 14776170045 022030 0 ustar runner docker Project {
property string throwType
property bool dummy: {
if (throwType === "bool")
throw true;
if (throwType === "int")
throw 43;
if (throwType === "string")
throw "an error";
if (throwType === "list")
throw ["an", "error"];
if (throwType === "object")
throw { result: "crash", reason: "overheating" };
throw "type missing";
}
}
qbs-src-2.6.1/tests/auto/language/testdata/qbs-property-convenience-override.qbs 0000644 0001751 0000166 00000000076 14776170045 027446 0 ustar runner docker Product {
name: "p"
qbs.installPrefix: "/usr/local"
}
qbs-src-2.6.1/tests/auto/language/testdata/propertiesblocks.qbs 0000644 0001751 0000166 00000013676 14776170045 024274 0 ustar runner docker import "propertiesblocks_base.qbs" as ProductBase
Project {
Product {
name: "property_overwrite"
Depends { name: "dummy" }
dummy.defines: ["SOMETHING"]
Properties {
dummy.defines: ["OVERWRITTEN"]
}
}
Product {
name: "property_set_indirect"
Depends { name: "dummyqt.core" }
Properties {
dummyqt.core.zort: "VAL"
}
}
Product {
name: "property_overwrite_no_outer"
Depends { name: "dummy" }
Properties {
dummy.defines: ["OVERWRITTEN"]
}
}
Product {
name: "property_append_to_outer"
Depends { name: "dummy" }
dummy.defines: ["ONE"]
Properties {
dummy.defines: outer.concat(["TWO"])
}
}
Product {
name: "property_append_to_indirect_outer"
Depends { name: "dummy" }
property stringList myDefines: ["ONE"]
dummy.defines: myDefines
Properties {
dummy.defines: outer.concat(["TWO"])
}
}
ProductBase {
name: "property_append_to_indirect_derived_outer1"
Properties {
dummy.cFlags: outer.concat("PROPS")
}
}
ProductBase {
name: "property_append_to_indirect_derived_outer2"
Properties {
dummy.cFlags: outer.concat("PROPS")
}
dummy.cFlags: ["PRODUCT"]
}
ProductBase {
name: "property_append_to_indirect_derived_outer3"
Properties {
dummy.cFlags: outer.concat("PROPS")
}
dummy.cFlags: base.concat("PRODUCT")
}
Product {
name: "property_append_to_indirect_merged_outer"
Depends { name: "dummy" }
property string justOne: "ONE"
dummy.rpaths: [justOne]
Properties {
dummy.rpaths: outer.concat(["TWO"])
}
}
Product {
name: "multiple_exclusive_properties"
Depends { name: "dummy" }
Properties {
dummy.defines: ["OVERWRITTEN"]
}
Properties {
condition: false
dummy.defines: ["IMPOSSIBLE"]
}
Properties {
condition: undefined
dummy.defines: ["SOMETHING"]
}
}
Product {
name: "multiple_exclusive_properties_no_outer"
Depends { name: "dummy" }
Properties {
condition: undefined
dummy.defines: ["OVERWRITTEN"]
}
Properties {
condition: false
dummy.defines: ["IMPOSSIBLE"]
}
}
Product {
name: "multiple_exclusive_properties_append_to_outer"
Depends { name: "dummy" }
dummy.defines: ["ONE"]
Properties {
dummy.defines: outer.concat(["TWO"])
}
Properties {
condition: false
dummy.defines: ["IMPOSSIBLE"]
}
}
Product {
name: "ambiguous_properties"
Depends { name: "dummy" }
dummy.defines: ["ONE"]
Properties {
dummy.defines: outer.concat(["TWO"])
}
Properties {
condition: false
dummy.defines: outer.concat(["IMPOSSIBLE"])
}
Properties {
dummy.defines: outer.concat(["THREE"])
}
}
Product {
name: "condition_refers_to_product_property"
property bool narf: true
property string someString: "SOMETHING"
Depends { name: "dummy" }
Properties {
condition: narf
dummy.defines: ["OVERWRITTEN"]
someString: "OVERWRITTEN"
}
}
property bool zort: true
Product {
name: "condition_refers_to_project_property"
property string someString: "SOMETHING"
Depends { name: "dummy" }
Properties {
condition: project.zort
dummy.defines: ["OVERWRITTEN"]
someString: "OVERWRITTEN"
}
}
ProductBase {
name: "inheritance_overwrite_in_subitem"
dummy.defines: ["OVERWRITTEN_IN_SUBITEM"]
}
ProductBase {
name: "inheritance_retain_base1"
dummy.defines: base.concat("SUB")
}
ProductBase {
name: "inheritance_retain_base2"
Properties {
condition: true
dummy.defines: base.concat("SUB")
}
Properties {
condition: undefined
dummy.defines: ["GNAMPF"]
}
}
ProductBase {
name: "inheritance_retain_base3"
Properties {
condition: true
dummy.defines: base.concat("SUB")
}
// no dummy.defines binding
}
ProductBase {
name: "inheritance_retain_base4"
Properties {
condition: false
dummy.defines: ["NEVERMORE"]
}
// no "else case" for dummy.defines. The value is derived from ProductBase.
}
ProductBase {
name: "inheritance_condition_in_subitem1"
defineBase: false
dummy.defines: base.concat("SUB")
}
ProductBase {
name: "inheritance_condition_in_subitem2"
defineBase: false
// no dummy.defines binding
}
Product {
id: knolf
name: "gnampf"
}
Product {
name: "condition_references_id"
Depends { name: "dummy" }
Properties {
condition: knolf.name === "gnampf"
dummy.defines: ["OVERWRITTEN"]
}
}
Product {
name: "using_derived_Properties_item"
Depends { name: "dummy" }
MyProperties {
condition: true
dummy.defines: ["string from MyProperties"]
}
}
Product {
name: "conditional-depends"
Depends {
name: "dummy"
condition: false
}
Properties {
condition: false
dummy.defines: ["a string"]
}
}
Product {
name: "use-module-with-properties-item"
Depends { name: "module-with-properties-item" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/ 0000755 0001751 0000166 00000000000 14776170045 027065 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000167 00000000000 011607 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/invalid-prop-on-non-required-module.qbs qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/invalid-prop-on-non-r0000644 0001751 0000166 00000000666 14776170045 033065 0 ustar runner docker Project {
property bool useExistingModule
Product {
name: "a"
condition: project.useExistingModule
Depends { name: "deploader" }
Depends { name: "dep" }
dep.nosuchprop: true
}
Product {
name: "b"
condition: !project.useExistingModule
Depends { name: "deploader" }
Depends { name: "random"; required: false }
random.nosuchprop: true
}
}
qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/ 0000755 0001751 0000166 00000000000 14776170045 030535 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/deploader/ 0000755 0001751 0000166 00000000000 14776170045 032474 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/deploader/deploader.qbs qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/deploader/dep0000644 0001751 0000166 00000000501 14776170045 033163 0 ustar runner docker Module {
// This indirection exists to properly model QBS-1776.
// "deploader" corresponds to "bundle", and "dep" corresponds to "codesign"
Depends { condition: project.useExistingModule; name: "dep"; required: false }
Depends { condition: !project.useExistingModule; name: "random"; required: false }
}
qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/dep/ 0000755 0001751 0000166 00000000000 14776170045 031305 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/invalid-prop-on-non-required-module/modules/dep/dep.qbs 0000644 0001751 0000166 00000000012 14776170045 032555 0 ustar runner docker Module {}
qbs-src-2.6.1/tests/auto/language/testdata/moduleproperties.qbs 0000644 0001751 0000166 00000003705 14776170045 024274 0 ustar runner docker Project {
name: "MyProject"
property string projectName: name
Product {
name: "merge_lists"
Depends { name: "dummyqt"; submodules: ["gui", "network"] }
Depends { name: "dummy" }
dummy.defines: ["THE_PRODUCT"]
}
Product {
name: "merge_lists_and_values"
Depends { name: "dummyqt"; submodules: ["network", "gui"] }
Depends { name: "dummy" }
dummy.defines: "THE_PRODUCT"
}
Product {
name: "merge_lists_with_duplicates"
Depends { name: "dummy" }
dummy.cxxFlags: ["-foo", "BAR", "-foo", "BAZ"]
}
Product {
name: "merge_lists_with_prototype_values"
Depends { name: "dummyqt"; submodules: ["gui", "network"] }
Depends { name: "dummy" }
}
Product {
name: "list_property_that_references_product"
type: ["blubb"]
Depends { name: "dummy" }
dummy.listProp: ["x"]
}
Product {
name: "list_property_depending_on_overridden_property"
Depends { name: "dummy" }
dummy.listProp2: ["PRODUCT_STUFF"]
dummy.controllingProp: true
}
Product {
name: "overridden_list_property"
Depends { name: "dummy" }
Properties {
overrideListProperties: true
dummy.listProp: ["PRODUCT_STUFF"]
}
}
Product {
name: "shadowed-list-property"
property string productName: name
Depends { name: "dummy" }
dummy.defines: [projectName, productName]
}
Product {
name: "shadowed-scalar-property"
property string productName: name
Depends { name: "dummy" }
dummy.someString: projectName + "_" + productName
}
Product {
name: "merged-varlist"
property string productName: name
Depends { name: "dummy" }
Depends { name: "dummyqt.core" }
dummy.controllingProp: true
dummy.varListProp: ({d: "product"})
}
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/ 0000755 0001751 0000166 00000000000 14776170045 024535 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/simple-collision1.qbs 0000644 0001751 0000166 00000000063 14776170045 030606 0 ustar runner docker Product {
Depends { name: "prefix1.suffix" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/no-collision2.qbs 0000644 0001751 0000166 00000000143 14776170045 027731 0 ustar runner docker Product {
Depends { name: "prefix1.middle1" }
Depends { name: "prefix1.middle2.suffix" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/simple-collision2.qbs 0000644 0001751 0000166 00000000054 14776170045 030607 0 ustar runner docker Product {
Depends { name: "prefix2" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/complex-collision.qbs 0000644 0001751 0000166 00000000144 14776170045 030703 0 ustar runner docker Product {
Depends { name: "prefix1.middle1" }
Depends { name: "prefix1.middle1.suffix1" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/no-collision1.qbs 0000644 0001751 0000166 00000000154 14776170045 027732 0 ustar runner docker Product {
Depends { name: "prefix1.middle1.suffix1" }
Depends { name: "prefix1.middle1.suffix2" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/ 0000755 0001751 0000166 00000000000 14776170045 026205 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/ 0000755 0001751 0000166 00000000000 14776170045 027563 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/suffix/ 0000755 0001751 0000166 00000000000 14776170045 031067 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/suffix/suffix.qbs 0000644 0001751 0000166 00000000053 14776170045 033100 0 ustar runner docker Module {
Depends { name: "prefix1" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/prefix1.qbs 0000644 0001751 0000166 00000000013 14776170045 031642 0 ustar runner docker Module {
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/ 0000755 0001751 0000166 00000000000 14776170045 031102 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix1/ 0000755 0001751 0000166 00000000000 14776170045 032467 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix1/suffix1.qbs qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix1/su0000644 0001751 0000166 00000000012 14776170045 033032 0 ustar runner docker Module {}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix2/ 0000755 0001751 0000166 00000000000 14776170045 032470 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000156 00000000000 011605 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix2/suffix2.qbs qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/suffix2/su0000644 0001751 0000166 00000000012 14776170045 033033 0 ustar runner docker Module {}
././@LongLink 0000644 0000000 0000000 00000000146 00000000000 011604 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/middle1.qbs qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle1/middle1.qb0000644 0001751 0000166 00000000012 14776170045 032736 0 ustar runner docker Module {}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle2/ 0000755 0001751 0000166 00000000000 14776170045 031103 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle2/suffix/ 0000755 0001751 0000166 00000000000 14776170045 032407 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000154 00000000000 011603 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle2/suffix/suffix.qbs qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix1/middle2/suffix/suf0000644 0001751 0000166 00000000012 14776170045 033120 0 ustar runner docker Module {}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix2/ 0000755 0001751 0000166 00000000000 14776170045 027564 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix2/suffix/ 0000755 0001751 0000166 00000000000 14776170045 031070 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix2/suffix/suffix.qbs 0000644 0001751 0000166 00000000013 14776170045 033075 0 ustar runner docker Module {
}
qbs-src-2.6.1/tests/auto/language/testdata/module-name-collisions/modules/prefix2/prefix2.qbs 0000644 0001751 0000166 00000000062 14776170045 031650 0 ustar runner docker Module {
Depends { name: "prefix2.suffix" }
}
qbs-src-2.6.1/tests/auto/language/testdata/chained-probes/ 0000755 0001751 0000166 00000000000 14776170045 023041 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/chained-probes/chained-probes.qbs 0000644 0001751 0000166 00000000046 14776170045 026433 0 ustar runner docker Product {
Depends { name: "m" }
}
qbs-src-2.6.1/tests/auto/language/testdata/chained-probes/modules/ 0000755 0001751 0000166 00000000000 14776170045 024511 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/chained-probes/modules/m/ 0000755 0001751 0000166 00000000000 14776170045 024745 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/chained-probes/modules/m/m.qbs 0000644 0001751 0000166 00000000646 14776170045 025716 0 ustar runner docker Module {
Probe {
id: probe1
property string probe1Prop
configure: { probe1Prop = "probe1Val"; found = true }
}
Probe {
id: probe2
property string inputProp: prop1
property string probe2Prop
configure: { probe2Prop = inputProp + "probe2Val"; found = true }
}
property string prop1: probe1.probe1Prop
property string prop2: probe2.probe2Prop
}
qbs-src-2.6.1/tests/auto/language/testdata/import-collection/ 0000755 0001751 0000166 00000000000 14776170045 023621 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/import-collection/product.qbs 0000644 0001751 0000166 00000000302 14776170045 026003 0 ustar runner docker import Collection as Collection1
import "collection" as Collection2
Product {
name: "da product"
targetName: Collection1.f1() + Collection1.f2() + Collection2.f1() + Collection2.f2()
}
qbs-src-2.6.1/tests/auto/language/testdata/import-collection/project.qbs 0000644 0001751 0000166 00000000055 14776170045 025776 0 ustar runner docker Project {
references: ["product.qbs"]
}
qbs-src-2.6.1/tests/auto/language/testdata/import-collection/imports/ 0000755 0001751 0000166 00000000000 14776170045 025316 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/import-collection/imports/Collection/ 0000755 0001751 0000166 00000000000 14776170045 027411 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/import-collection/imports/Collection/file2.js 0000644 0001751 0000166 00000000041 14776170045 030743 0 ustar runner docker function f2() { return "C1f2"; }
qbs-src-2.6.1/tests/auto/language/testdata/import-collection/imports/Collection/file1.js 0000644 0001751 0000166 00000000041 14776170045 030742 0 ustar runner docker function f1() { return "C1f1"; }
qbs-src-2.6.1/tests/auto/language/testdata/import-collection/collection/ 0000755 0001751 0000166 00000000000 14776170045 025754 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/import-collection/collection/file2.js 0000644 0001751 0000166 00000000041 14776170045 027306 0 ustar runner docker function f2() { return "C2f2"; }
qbs-src-2.6.1/tests/auto/language/testdata/import-collection/collection/file1.js 0000644 0001751 0000166 00000000041 14776170045 027305 0 ustar runner docker function f1() { return "C2f1"; }
qbs-src-2.6.1/tests/auto/language/testdata/duplicate-multiplex-value2.qbs 0000644 0001751 0000166 00000000247 14776170045 026057 0 ustar runner docker Product {
name: "p"
multiplexByQbsProperties: ["architectures", "buildVariants", "architectures"]
aggregate: false
qbs.architectures: ["x86", "arm"]
}
qbs-src-2.6.1/tests/auto/language/testdata/empty-js-file.js 0000644 0001751 0000166 00000000000 14776170045 023167 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/idusagebase.qbs 0000644 0001751 0000166 00000000633 14776170045 023143 0 ustar runner docker import "idusagebasebase.qbs" as DeriveMeCrazy
import "idusage_group.qbs" as MyGroup
import "idusage_group2.qbs" as MyGroup2
DeriveMeCrazy {
id: baseProduct
property int nr: theProject.initialNr + 1
name: "product1_" + nr
property string productName: baseProduct.name
MyGroup {
name: "group in base product"
}
MyGroup2 {
name: "another group in base product"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/idusage.qbs 0000644 0001751 0000166 00000001354 14776170045 022311 0 ustar runner docker import "idusagebase.qbs" as DerivedProduct
Project {
id: theProject
property int initialNr: 0
DerivedProduct {
id: product1
}
Product {
id: product2
property int nr: theProject.initialNr + product1.nr + 1
name: "product2_" + nr
}
Product {
id: product3
property int nr: product2.nr + 1
name: "product3_" + nr
}
DerivedProduct {
id: product4
nr: product3.nr + 1
name: "product4_" + nr
}
Product {
name: "product5"
Depends { name: "deepdummy.deep.moat"; id: moat }
Group {
Group {
condition: moat.present
files: "dummy.txt"
}
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/module-merging-variant-values/ 0000755 0001751 0000166 00000000000 14776170045 026030 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-merging-variant-values/module-merging-variant-values.qbs qbs-src-2.6.1/tests/auto/language/testdata/module-merging-variant-values/module-merging-variant-valu0000644 0001751 0000166 00000000173 14776170045 033276 0 ustar runner docker Product {
multiplexByQbsProperties: ["architectures"]
qbs.architectures: ["a1", "a2"]
Depends { name: "m2" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-merging-variant-values/modules/ 0000755 0001751 0000166 00000000000 14776170045 027500 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-merging-variant-values/modules/m2/ 0000755 0001751 0000166 00000000000 14776170045 030016 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-merging-variant-values/modules/m2/m2.qbs 0000644 0001751 0000166 00000000717 14776170045 031050 0 ustar runner docker Module {
Depends { name: "m1" }
m1.arch: qbs.architecture
property string arch: qbs.architecture
validate: {
if (qbs.architecture !== "a1" && qbs.architecture !== "a2")
throw "Unexpected arch " + qbs.architecture;
if (arch !== qbs.architecture)
throw "Oops: " + arch + "/" + qbs.architecture;
if (m1.arch !== qbs.architecture)
throw "Oops: " + m1.arch + "/" + qbs.architecture;
}
}
qbs-src-2.6.1/tests/auto/language/testdata/module-merging-variant-values/modules/m1/ 0000755 0001751 0000166 00000000000 14776170045 030015 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-merging-variant-values/modules/m1/m1.qbs 0000644 0001751 0000166 00000000272 14776170045 031042 0 ustar runner docker Module {
condition: qbs.architecture === "a1" || qbs.architecture === "a2"
property string arch
qbs.architecture: undefined // We do something like this in GenericGCC.qbs
}
qbs-src-2.6.1/tests/auto/language/testdata/correct-decl-in-parent-lookup.qbs 0000644 0001751 0000166 00000000137 14776170045 026436 0 ustar runner docker Product {
name: "p"
Depends { name: "dummy" }
dummy.cxxFlags: base.concat(["x"])
}
qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/ 0000755 0001751 0000166 00000000000 14776170045 027334 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/product.qbs 0000644 0001751 0000166 00000000072 14776170045 031522 0 ustar runner docker Product {
Depends { name: "conflicting-instances" }
}
qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/project.qbs 0000644 0001751 0000166 00000000054 14776170045 031510 0 ustar runner docker Project {
references: ["product.qbs"]
}
qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/bar/ 0000755 0001751 0000166 00000000000 14776170045 030100 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/ 0000755 0001751 0000166 00000000000 14776170045 031550 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000163 00000000000 011603 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/conflicting-instances/ qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/conflict0000755 0001751 0000166 00000000000 14776170045 033272 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000172 00000000000 011603 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/conflicting-instances/bar.qbs qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/bar/modules/conflict0000644 0001751 0000166 00000000064 14776170045 033274 0 ustar runner docker Module {
property string moduleVariant: "bar"
}
qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/foo/ 0000755 0001751 0000166 00000000000 14776170045 030117 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/ 0000755 0001751 0000166 00000000000 14776170045 031567 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000163 00000000000 011603 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/conflicting-instances/ qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/conflict0000755 0001751 0000166 00000000000 14776170045 033311 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000172 00000000000 011603 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/conflicting-instances/foo.qbs qbs-src-2.6.1/tests/auto/language/testdata/module-prioritization-by-search-path/foo/modules/conflict0000644 0001751 0000166 00000000064 14776170045 033313 0 ustar runner docker Module {
property string moduleVariant: "foo"
}
qbs-src-2.6.1/tests/auto/language/testdata/dirwithnoprojects/ 0000755 0001751 0000166 00000000000 14776170045 023737 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/dirwithnoprojects/.gitignore 0000644 0001751 0000166 00000000016 14776170045 025724 0 ustar runner docker *
!.gitignore
qbs-src-2.6.1/tests/auto/language/testdata/baseproperty.qbs 0000644 0001751 0000166 00000000222 14776170045 023400 0 ustar runner docker import "baseproperty_base.qbs" as BaseProduct
BaseProduct {
name: "product1"
narf: base.concat(["boo"])
zort: base.concat(["boo"])
}
qbs-src-2.6.1/tests/auto/language/testdata/local-profile-as-top-level-profile.qbs 0000644 0001751 0000166 00000000201 14776170045 027352 0 ustar runner docker Product {
Profile {
name: "test-profile"
qbs.architecture: "arm"
qbs.targetPlatform: "macos"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/propertiesblocks_base.qbs 0000644 0001751 0000166 00000000411 14776170045 025245 0 ustar runner docker Product {
property bool defineBase: true
Depends { name: "dummy" }
Properties {
condition: defineBase
dummy.defines: ["BASE"]
}
dummy.defines: ["SOMETHING"]
property stringList myCFlags: ["BASE"]
dummy.cFlags: myCFlags
}
qbs-src-2.6.1/tests/auto/language/testdata/base-validate/ 0000755 0001751 0000166 00000000000 14776170045 022657 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/base-validate/base-validate.qbs 0000644 0001751 0000166 00000000046 14776170045 026067 0 ustar runner docker Product {
Depends { name: "m" }
}
qbs-src-2.6.1/tests/auto/language/testdata/base-validate/modules/ 0000755 0001751 0000166 00000000000 14776170045 024327 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/base-validate/modules/m/ 0000755 0001751 0000166 00000000000 14776170045 024563 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/base-validate/modules/m/MParent.qbs 0000644 0001751 0000166 00000000063 14776170045 026637 0 ustar runner docker Module {
condition: false
validate: true
}
qbs-src-2.6.1/tests/auto/language/testdata/base-validate/modules/m/m.qbs 0000644 0001751 0000166 00000000306 14776170045 025525 0 ustar runner docker MParent {
condition: true
validate: {
var parentResult = base;
if (!parentResult)
throw "Parent failed";
throw "Parent succeeded, child failed.";
}
}
qbs-src-2.6.1/tests/auto/language/testdata/dotted-names/ 0000755 0001751 0000166 00000000000 14776170045 022542 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/dotted-names/dotted-names.qbs 0000644 0001751 0000166 00000000774 14776170045 025645 0 ustar runner docker Project {
name: "theProject"
property bool includeDottedProduct
property bool includeDottedModule
Project {
condition: project.includeDottedProduct
Product {
name: "a.b"
Export { property string c: "default" }
}
}
Product {
name: "p"
Depends { name: "a.b"; condition: project.includeDottedProduct }
Depends { name: "x.y"; condition: project.includeDottedModule }
a.b.c: "p"
x.y.z: "p"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/dotted-names/modules/ 0000755 0001751 0000166 00000000000 14776170045 024212 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/dotted-names/modules/x/ 0000755 0001751 0000166 00000000000 14776170045 024461 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/dotted-names/modules/x/y/ 0000755 0001751 0000166 00000000000 14776170045 024731 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/dotted-names/modules/x/y/xy.qbs 0000644 0001751 0000166 00000000054 14776170045 026077 0 ustar runner docker Module {
property string z: "default"
}
qbs-src-2.6.1/tests/auto/language/testdata/overridden-variant-property.qbs 0000644 0001751 0000166 00000000064 14776170045 026352 0 ustar runner docker Product {
name: "p"
property var myObject
}
qbs-src-2.6.1/tests/auto/language/testdata/module-depends-on-product.qbs 0000644 0001751 0000166 00000000225 14776170045 025661 0 ustar runner docker Project {
Product {
name: "p1"
Depends { name: "module-with-product-dependency" }
}
Product {
name: "p2"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/module-property-overrides-per-product.qbs 0000644 0001751 0000166 00000000567 14776170045 030306 0 ustar runner docker Project {
Product {
Depends { name: "dummy" }
name: "a"
property stringList rpaths: dummy.rpaths
}
Product {
Depends { name: "dummy" }
name: "b"
property stringList rpaths: dummy.rpaths
}
Product {
Depends { name: "dummy" }
name: "c"
property stringList rpaths: dummy.rpaths
}
}
qbs-src-2.6.1/tests/auto/language/testdata/invalid-overrides.qbs 0000644 0001751 0000166 00000000322 14776170045 024310 0 ustar runner docker Project {
name: "My.Project"
property bool x
Product {
name: "MyProduct"
property bool x
}
Product {
name: "MyOtherProduct"
Depends { name: "cpp" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/multiplexed-exports.qbs 0000644 0001751 0000166 00000001012 14776170045 024715 0 ustar runner docker Project {
Product {
name: "dep"
multiplexByQbsProperties: ["buildVariants"]
qbs.buildVariants: ["debug", "release"]
property string includeDir: qbs.buildVariant === "debug" ? "/d" : "/r"
Export {
Depends { name: "cpp" }
cpp.includePaths: exportingProduct.includeDir
}
}
Product {
name: "p"
Depends { name: "dep" }
multiplexByQbsProperties: ["buildVariants"]
qbs.buildVariants: ["debug", "release"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/dependencyOnAllProfiles.qbs 0000644 0001751 0000166 00000000410 14776170045 025430 0 ustar runner docker Project {
property string profile1
property string profile2
Product {
name: "dep"
qbs.profiles: [project.profile1, project.profile2]
}
Product {
name: "main"
Depends {
name: "dep"
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/builtinFunctionInSearchPathsProperty.qbs 0000644 0001751 0000166 00000000246 14776170045 030225 0 ustar runner docker import qbs.Environment
Project {
qbsSearchPaths: {
if (!Environment.getEnv("PATH"))
throw "Environment.getEnv doesn't seem to work";
}
}
qbs-src-2.6.1/tests/auto/language/testdata/keep-loading-dependencies.qbs 0000644 0001751 0000166 00000000111 14776170045 025641 0 ustar runner docker Product {
Depends { name: "none"; submodules: ["m1", "m2", "m3"] }
}
qbs-src-2.6.1/tests/auto/language/testdata/disabled-subproject.qbs 0000644 0001751 0000166 00000000761 14776170045 024616 0 ustar runner docker Project {
SubProject {
condition: false
filePath: "nosuchfile.qbs"
}
SubProject {
Properties {
condition: false
}
filePath: "nosuchfile.qbs"
}
SubProject {
condition: true
Properties {
condition: false
}
filePath: "nosuchfile.qbs"
}
SubProject {
condition: false
Properties {
condition: true
}
filePath: "nosuchfile.qbs"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/dummy.txt 0000644 0001751 0000166 00000000000 14776170045 022040 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/profilevaluesandoverriddenvalues.qbs 0000644 0001751 0000166 00000001422 14776170045 027531 0 ustar runner docker Project {
Product {
name: "product1"
property bool dummyProp: {
if (!(dummy.cFlags instanceof Array))
throw new Error("dummy.cFlags: Array type expected.");
if (!(dummy.cxxFlags instanceof Array))
throw new Error("dummy.cxxFlags: Array type expected.");
if (!(dummy.defines instanceof Array))
throw new Error("dummy.defines: Array type expected.");
return true;
}
consoleApplication: true
Depends { name: "dummy" }
// dummy.cxxFlags is set via profile and is not overridden
dummy.defines: ["IN_FILE"] // set in profile, overridden in file
dummy.cFlags: ["IN_FILE"] // set in profile, overridden on command line
}
}
qbs-src-2.6.1/tests/auto/language/testdata/MyProperties.qbs 0000644 0001751 0000166 00000000017 14776170045 023325 0 ustar runner docker Properties {
}
qbs-src-2.6.1/tests/auto/language/testdata/exports_product.qbs 0000644 0001751 0000166 00000000336 14776170045 024133 0 ustar runner docker Product {
Export {
version: "2.0"
Depends { name: "dummy" }
dummy.cFlags: ["BASE_" + exportingProduct.name.toUpperCase()]
dummy.cxxFlags: ["-foo"]
dummy.defines: ["ABC"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/enum-project-props.qbs 0000644 0001751 0000166 00000000412 14776170045 024433 0 ustar runner docker Project {
property string anExistingFile: "dummy.txt"
Product {
files: {
for (var k in project) {
if (k === "anExistingFile")
return [project[k]];
}
return [];
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/properties-item-in-module.qbs 0000644 0001751 0000166 00000000204 14776170045 025700 0 ustar runner docker Project {
Product { name: "a"; Depends { name: "dummyqt.core" } }
Product { name: "b"; Depends { name: "dummyqt.core" } }
}
qbs-src-2.6.1/tests/auto/language/testdata/idusagebasebase.qbs 0000644 0001751 0000166 00000000176 14776170045 024000 0 ustar runner docker Product {
id: baseBaseProduct
name: "ace of base"
property string productNameInBaseOfBase: baseBaseProduct.name
}
qbs-src-2.6.1/tests/auto/language/testdata/narf 0000644 0001751 0000166 00000000000 14776170045 021015 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/filecontextproperties.qbs 0000644 0001751 0000166 00000000143 14776170045 025324 0 ustar runner docker Product {
name: "product1"
property string narf: filePath
property string zort: path
}
qbs-src-2.6.1/tests/auto/language/testdata/narf.zort 0000644 0001751 0000166 00000000000 14776170045 022012 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/file-in-product-and-module.qbs 0000644 0001751 0000166 00000000262 14776170045 025711 0 ustar runner docker Product {
name: "p"
Depends { name: "module_with_file" }
property bool addFileToProduct
Group {
files: "zort"
condition: addFileToProduct
}
}
qbs-src-2.6.1/tests/auto/language/testdata/broken-dependency-cycle1.qbs 0000644 0001751 0000166 00000000501 14776170045 025433 0 ustar runner docker Project {
Product {
name: "p1"
Export {
property bool c: true
Depends { name: "p2"; condition: c }
}
}
Product {
name: "p2"
Depends { name: "p1" }
p1.c: false
}
Product {
name: "p3"
Depends { name: "p1" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/non-applicable-module-property-in-profile.qbs 0000644 0001751 0000166 00000000672 14776170045 030765 0 ustar runner docker Project {
property string targetOS
property string toolchain
Product {
name: "p"
multiplexByQbsProperties: ["profiles"]
qbs.profiles: ["theProfile"]
Depends { name: "multiple_backends" }
Profile {
name: "theProfile"
qbs.targetOS: [project.targetOS]
qbs.toolchain: [project.toolchain]
multiple_backends.backend3Prop: "value"
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/groupname.qbs 0000644 0001751 0000166 00000000541 14776170045 022662 0 ustar runner docker Project {
Product {
name: "MyProduct"
Group {
name: product.name + ".MyGroup"
files: "*"
}
}
Product {
name: "My2ndProduct"
Group {
name: product.name + ".MyGroup"
files: ["narf"]
}
Group {
files: ["zort"]
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/homeDirectory.qbs 0000644 0001751 0000166 00000000661 14776170045 023505 0 ustar runner docker Project {
Product {
name: "home"
// These should resolve
property path home: "~"
property path homeSlash: "~/"
property path homeUp: "~/.."
property path homeFile: "~/a"
// These are sanity checks and should not
property path bogus1: "a~b"
property path bogus2: "a/~/bb"
property path user: "~foo/bar" // we don't resolve other-user paths
}
}
qbs-src-2.6.1/tests/auto/language/testdata/groupconditions.qbs 0000644 0001751 0000166 00000002140 14776170045 024110 0 ustar runner docker Project {
property bool someTrueProperty: true
Product {
name: "no_condition_no_group"
files: ["main.cpp"]
}
Product {
name: "no_condition"
Group {
files: ["main.cpp"]
}
}
Product {
name: "true_condition"
Group {
condition: true
files: ["main.cpp"]
}
}
Product {
name: "false_condition"
Group {
condition: false
files: ["main.cpp"]
}
}
Product {
name: "true_condition_from_product"
property bool anotherTrueProperty: true
Group {
condition: anotherTrueProperty
files: ["main.cpp"]
}
}
Product {
name: "true_condition_from_project"
Group {
condition: project.someTrueProperty
files: ["main.cpp"]
}
}
Product {
name: "condition_accessing_module_property"
Group {
condition: qbs.targetOS.includes("narf")
files: ["main.cpp"]
qbs.install: false
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/broken-dependency-cycle2.qbs 0000644 0001751 0000166 00000000501 14776170045 025434 0 ustar runner docker Project {
Product {
name: "p1"
Export {
property bool c: true
Depends { name: "p2"; condition: c }
}
}
Product {
name: "p3"
Depends { name: "p1" }
}
Product {
name: "p2"
Depends { name: "p1" }
p1.c: false
}
}
qbs-src-2.6.1/tests/auto/language/testdata/modulescope_base.qbs 0000644 0001751 0000166 00000000103 14776170045 024170 0 ustar runner docker Product {
Depends { name: "scopemod" }
scopemod.h: e * f
}
qbs-src-2.6.1/tests/auto/language/testdata/derived-sub-project/ 0000755 0001751 0000166 00000000000 14776170045 024033 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/derived-sub-project/subproject.qbs 0000644 0001751 0000166 00000000014 14776170045 026715 0 ustar runner docker Product {
}
qbs-src-2.6.1/tests/auto/language/testdata/derived-sub-project/project.qbs 0000644 0001751 0000166 00000000212 14776170045 026203 0 ustar runner docker Project {
DerivedSubProject {
filePath: "subproject.qbs"
Properties {
name: "something"
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/derived-sub-project/DerivedSubProject.qbs 0000644 0001751 0000166 00000000017 14776170045 030123 0 ustar runner docker SubProject {
}
qbs-src-2.6.1/tests/auto/language/testdata/relaxed-error-mode/ 0000755 0001751 0000166 00000000000 14776170045 023653 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/relaxed-error-mode/file1.txt 0000644 0001751 0000166 00000000000 14776170045 025402 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/relaxed-error-mode/relaxed-error-mode.qbs 0000644 0001751 0000166 00000001210 14776170045 030051 0 ustar runner docker Project {
Product {
name: "recursive depender"
Depends { name: "depender required" }
files: "file1.txt"
}
Product {
name: "broken"
Depends { name: "nosuchmodule" }
}
Product {
name: "depender required"
Depends { name: "broken" }
files: "file1.txt"
}
Product {
name: "depender nonrequired"
Depends { name: "broken"; required: false }
files: "file1.txt"
}
Product {
name: "missing file"
files: ["file1.txt", "file3.txt", "file2.txt"]
}
Product {
name: "fine"
files: "file2.txt"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/relaxed-error-mode/file2.txt 0000644 0001751 0000166 00000000000 14776170045 025403 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/main.cpp 0000644 0001751 0000166 00000000000 14776170045 021574 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/duplicate-multiplex-value.qbs 0000644 0001751 0000166 00000000212 14776170045 025765 0 ustar runner docker Product {
name: "p"
multiplexByQbsProperties: "architectures"
aggregate: false
qbs.architectures: ["x86", "arm", "x86"]
}
qbs-src-2.6.1/tests/auto/language/testdata/jsimportsinmultiplescopes.js 0000644 0001751 0000166 00000000301 14776170045 026060 0 ustar runner docker function getName(qbsModule)
{
if (qbsModule.debugInformation)
return "MyProduct_debug";
else
return "MyProduct";
}
function getInstallDir()
{
return "somewhere";
}
qbs-src-2.6.1/tests/auto/language/testdata/recursive-dependencies/ 0000755 0001751 0000166 00000000000 14776170045 024611 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/recursive-dependencies/recursive-dependencies.qbs 0000644 0001751 0000166 00000000430 14776170045 031750 0 ustar runner docker Project {
Product {
name: "p1"
Depends { name: "p3" }
}
Product {
name: "p2"
Depends { name: "p3" }
}
Product {
name: "p3"
Export {
Depends { name: "p4" }
}
}
Product { name: "p4" }
}
qbs-src-2.6.1/tests/auto/language/testdata/drawline.asm 0000644 0001751 0000166 00000000000 14776170045 022453 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/additional-product-types.qbs 0000644 0001751 0000166 00000000460 14776170045 025615 0 ustar runner docker Product {
name: "p"
type: ["tag1"]
Depends { name: "dummy" }
Depends { name: "dummy2" }
property bool hasTag1: type.includes("tag1")
property bool hasTag2: type.includes("tag2")
property bool hasTag3: type.includes("tag3")
property bool hasTag4: type.includes("tag4")
}
qbs-src-2.6.1/tests/auto/language/testdata/jsextensions.js 0000644 0001751 0000166 00000004207 14776170045 023253 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qbs.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
(function() { // Function wrapper to keep the environment clean.
/*
* poor man's JS test suite
*/
var testctx = {};
function initTestContext(name)
{
testctx.nr = 1;
testctx.name = name;
}
function verify(c)
{
if (!c)
throw testctx.name + ": verification #" + testctx.nr + " failed.";
testctx.nr++;
}
/*
* Tests for extensions of JavaScript builtin types.
*/
var a = ["one", "two", "three"];
initTestContext("Array.prototype.contains");
for (var k in a)
verify(k !== "contains");
verify(a.includes("one"));
verify(a.includes("two"));
verify(a.includes("three"));
verify(!a.includes("four"));
})() // END function wrapper
qbs-src-2.6.1/tests/auto/language/testdata/idusage_group2.qbs 0000644 0001751 0000166 00000000140 14776170045 023577 0 ustar runner docker import "idusage_group.qbs" as MyGroup
MyGroup {
name: "between the hammer and the anvil"
}
qbs-src-2.6.1/tests/auto/language/testdata/dirwithmultipleprojects/ 0000755 0001751 0000166 00000000000 14776170045 025156 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/dirwithmultipleprojects/project.qbs 0000644 0001751 0000166 00000000000 14776170045 027321 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/dirwithmultipleprojects/project2.qbs 0000644 0001751 0000166 00000000000 14776170045 027403 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/defaultvalue/ 0000755 0001751 0000166 00000000000 14776170045 022637 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/defaultvalue/test.txt 0000644 0001751 0000166 00000000000 14776170045 024345 0 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/defaultvalue/egon.qbs 0000644 0001751 0000166 00000000311 14776170045 024271 0 ustar runner docker Project {
Product {
name: "dep"
Export { Depends { name: "higher" } }
}
Product {
name: "egon"
Depends { name: "dep" }
lower.prop1: "blubb"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/defaultvalue/modules/ 0000755 0001751 0000166 00000000000 14776170045 024307 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/defaultvalue/modules/lower/ 0000755 0001751 0000166 00000000000 14776170045 025437 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/defaultvalue/modules/lower/lower.qbs 0000644 0001751 0000166 00000000306 14776170045 027275 0 ustar runner docker Module {
property string prop1
property string prop2: prop1 === "blubb" ? "withBlubb" : "withoutBlubb"
property stringList listProp: prop1 === "blubb" ? ["blubb", "other"] : ["other"]
}
qbs-src-2.6.1/tests/auto/language/testdata/defaultvalue/modules/higher/ 0000755 0001751 0000166 00000000000 14776170045 025555 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/defaultvalue/modules/higher/higher.qbs 0000644 0001751 0000166 00000000252 14776170045 027531 0 ustar runner docker Module {
Depends { name: "lower" }
lower.prop2: lower.prop1 === "egon" ? "withEgon" : original
lower.listProp: lower.prop1 === "egon" ? ["egon"] : original
}
qbs-src-2.6.1/tests/auto/language/testdata/outerInGroup.qbs 0000644 0001751 0000166 00000000755 14776170045 023336 0 ustar runner docker Project {
Product {
name: "OuterInGroup"
Depends { name: "dummy" }
qbs.installDir: "/somewhere"
dummy.someString: "s1"
Properties { dummy.someString: outer.concat("s2") }
files: ["main.cpp"]
Group {
Group {
name: "Special Group"
files: ["aboutdialog.cpp"]
qbs.installDir: outer + "/else"
dummy.someString: outer.concat("s3")
}
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/productdirectories.qbs 0000644 0001751 0000166 00000000036 14776170045 024601 0 ustar runner docker Product {
name: "MyApp"
}
qbs-src-2.6.1/tests/auto/language/testdata/pathproperties.qbs 0000644 0001751 0000166 00000000423 14776170045 023735 0 ustar runner docker import "subdir/pathproperties_base.qbs" as ProductBase
ProductBase {
name: "product1"
property path projectFileDir: "."
property pathList filesInProjectFileDir: ["./aboutdialog.h", "aboutdialog.cpp"]
Depends { name: "dummy" }
dummy.includePaths: ["."]
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/ 0000755 0001751 0000166 00000000000 14776170045 022177 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared_property_wrapper.qbs 0000644 0001751 0000166 00000000117 14776170045 030517 0 ustar runner docker Project {
SubProject {
filePath: "undeclared_property.qbs"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/conflicting_fileTagsFilter.qbs 0000644 0001751 0000166 00000000262 14776170045 030171 0 ustar runner docker Product {
type: "app"
Group {
fileTagsFilter: "app"
qbs.install: true
}
Group {
fileTagsFilter: "app"
qbs.install: false
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/ambiguous-multiplex-dependency.qbs 0000644 0001751 0000166 00000000563 14776170045 031042 0 ustar runner docker Project {
Product {
name: "a"
multiplexByQbsProperties: ["architectures", "buildVariants"]
qbs.architectures: ["x86", "arm"]
qbs.buildVariants: ["debug", "release"]
}
Product {
name: "b"
Depends { name: "a" }
multiplexByQbsProperties: ["architectures"]
qbs.architectures: ["x86", "arm"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/wrongQbsVersionFormat.qbs 0000644 0001751 0000166 00000000062 14776170045 027225 0 ustar runner docker Project {
minimumQbsVersion: "hfyh1234wat?"
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/dependency_cycle.qbs 0000644 0001751 0000166 00000000454 14776170045 026206 0 ustar runner docker Project {
Product {
name: "A"
Depends { name: "B" }
files: ["main.cpp"]
}
Product {
name: "B"
Depends { name: "C" }
files: ["main.cpp"]
}
Product {
name: "C"
Depends { name: "A" }
files: ["main.cpp"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared_module_property_in_module.qbs 0000644 0001751 0000166 00000000103 14776170045 032352 0 ustar runner docker Product {
name: "p"
Depends { name: "no_such_property" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/module-property-binding-in-project.qbs 0000644 0001751 0000166 00000000041 14776170045 031530 0 ustar runner docker Project {
qbs.sysroot: "/"
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/wrong-toplevel-item.qbs 0000644 0001751 0000166 00000000015 14776170045 026622 0 ustar runner docker Artifact {
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/importloop2.qbs 0000644 0001751 0000166 00000000045 14776170045 025173 0 ustar runner docker import "importloop1.qbs" as X
X {}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/module-var-in-product.qbs 0000644 0001751 0000166 00000000111 14776170045 027034 0 ustar runner docker Product {
property bool p
Group {
module.p: true
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/invalid-property-option.qbs 0000644 0001751 0000166 00000000106 14776170045 027521 0 ustar runner docker Product {
Depends { name: "module-with-wrong-property-option" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undefined_stringlist_element.qbs 0000644 0001751 0000166 00000000107 14776170045 030640 0 ustar runner docker Product {
property string blubb
files: ["foo", blubb, "bar"]
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/subproject_cycle.qbs 0000644 0001751 0000166 00000000116 14776170045 026243 0 ustar runner docker Project {
SubProject {
filePath: "subproject_cycle2.qbs"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/references_cycle2.qbs 0000644 0001751 0000166 00000000067 14776170045 026273 0 ustar runner docker Project {
references: ["references_cycle3.qbs"]
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/module-with-id.qbs 0000644 0001751 0000166 00000000101 14776170045 025526 0 ustar runner docker Product {
name: "p"
Depends { name: "module-with-id" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared_property_in_export_item.qbs 0000644 0001751 0000166 00000000300 14776170045 032056 0 ustar runner docker Project {
Product {
name: "p1"
Export {
Depends { name: "cpp" }
cpp.blubb: "x"
}
}
Product {
Depends { name: "p1" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/dependency_cycle3a.qbs 0000644 0001751 0000166 00000000262 14776170045 026427 0 ustar runner docker Project {
Product {
name: "B"
Depends { productTypes: ["a"] }
}
Product {
type: ["a"]
name: "A"
Depends { name: "B" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/references_cycle3.qbs 0000644 0001751 0000166 00000000066 14776170045 026273 0 ustar runner docker Project {
references: ["references_cycle.qbs"]
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared_property_in_export_item2.qbs 0000644 0001751 0000166 00000000242 14776170045 032145 0 ustar runner docker Project {
Product {
name: "p1"
Export {
something.other: "x"
}
}
Product {
Depends { name: "p1" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/overwrite-inherited-readonly-property.qbs 0000644 0001751 0000166 00000000077 14776170045 032406 0 ustar runner docker ParentItem {
readOnlyString: "changing the unchangeable"
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/ParentWithExport.qbs 0000644 0001751 0000166 00000000075 14776170045 026177 0 ustar runner docker Product {
Export {
property bool theProp
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/unknown_item_type.qbs 0000644 0001751 0000166 00000000143 14776170045 026462 0 ustar runner docker Narf {
zort: 1 // This invalid binding should not hide the "Unexpected item type" error.
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/invalid-parameter-type.qbs 0000644 0001751 0000166 00000000342 14776170045 027270 0 ustar runner docker Product {
Depends { name: "module_with_parameters" }
Depends {
name: "readonly"
module_with_parameters.boolParameter: "This is not an error."
module_with_parameters.stringParameter: 123
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared-parameter2.qbs 0000644 0001751 0000166 00000000124 14776170045 027051 0 ustar runner docker Product {
name: "myproduct"
Depends { name: "readonly"; foo.bar: "bla" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/frozen-object-list.qbs 0000644 0001751 0000166 00000000446 14776170045 026432 0 ustar runner docker
Product {
Probe {
id: probe
property varList output
configure: {
output = [{"key": "value"}];
found = true;
}
}
property var test: {
var result = probe.output;
result.push({});
return result;
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/original-in-export-item3.qbs 0000644 0001751 0000166 00000000330 14776170045 027450 0 ustar runner docker Project {
Product {
name: "a"
Export {
Properties {
x.y.z: original
}
}
}
Product {
name: "b"
Depends { name: "a" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/syntax-error-in-probe.qbs 0000644 0001751 0000166 00000000125 14776170045 027072 0 ustar runner docker Product {
Probe {
id: hurz
configure: { fngkgsdjfgklkf }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/multiple_properties_in_subproject.qbs 0000644 0001751 0000166 00000000160 14776170045 031740 0 ustar runner docker Project {
SubProject {
Properties { condition: false }
Properties { name: "blubb" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared_property.qbs 0000644 0001751 0000166 00000000042 14776170045 026754 0 ustar runner docker Product {
doesntexist: 123
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared_property_in_export_item3.qbs 0000644 0001751 0000166 00000000172 14776170045 032150 0 ustar runner docker Project {
Product {
name: "p1"
Export { blubb: false }
}
Product { Depends { name: "p1" } }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/ParentItem.qbs 0000644 0001751 0000166 00000000146 14776170045 024757 0 ustar runner docker Product {
property bool cpp
readonly property string readOnlyString: "I cannot be changed!"
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared_item.qbs 0000644 0001751 0000166 00000000055 14776170045 026032 0 ustar runner docker Product {
cpp.defines: ["SUPERCRAZY"]
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/invalid-references.qbs 0000644 0001751 0000166 00000000060 14776170045 026447 0 ustar runner docker Project {
references: "nosuchproject.qbs"
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/missing-js-file.qbs 0000644 0001751 0000166 00000000073 14776170045 025706 0 ustar runner docker Product {
Depends { name: "missing-js-file-module" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/dependency_cycle3.qbs 0000644 0001751 0000166 00000000262 14776170045 026266 0 ustar runner docker Project {
Product {
type: ["a"]
name: "A"
Depends { name: "B" }
}
Product {
name: "B"
Depends { productTypes: ["a"] }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/throw_in_property_binding.qbs 0000644 0001751 0000166 00000000102 14776170045 030166 0 ustar runner docker Product {
name: {
throw "something is wrong";
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/original-in-module-prototype.qbs 0000644 0001751 0000166 00000000101 14776170045 030434 0 ustar runner docker Product {
Depends { name: "module-with-invalid-original" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/original-in-export-item.qbs 0000644 0001751 0000166 00000000271 14776170045 027371 0 ustar runner docker Project {
Product {
name: "a"
Export {
property string p: original
}
}
Product {
name: "b"
Depends { name: "a" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/references_cycle.qbs 0000644 0001751 0000166 00000000067 14776170045 026211 0 ustar runner docker Project {
references: ["references_cycle2.qbs"]
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/duplicate_sources_wildcards.qbs 0000644 0001751 0000166 00000000146 14776170045 030460 0 ustar runner docker Product {
files: ["*.qbs"]
Group {
files: ["duplicate_sources_wildcards.qbs"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/unknown_module.qbs 0000644 0001751 0000166 00000000074 14776170045 025753 0 ustar runner docker Product {
Depends { name: "neitherModuleNorProduct" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/invalid_file.qbs 0000644 0001751 0000166 00000000057 14776170045 025335 0 ustar runner docker Product {
files: ["main.cpp", "other.h"]
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/subproject_cycle2.qbs 0000644 0001751 0000166 00000000116 14776170045 026325 0 ustar runner docker Project {
SubProject {
filePath: "subproject_cycle3.qbs"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undefined_stringlist_element_in_probe.qbs 0000644 0001751 0000166 00000000223 14776170045 032514 0 ustar runner docker Product {
Probe {
id: dummy
property stringList l
configure: {
l = ["a", undefined, "b"]
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/invalid-parameter-rhs.qbs 0000644 0001751 0000166 00000000174 14776170045 027106 0 ustar runner docker Product {
Depends { name: "prefix2.suffix" }
Depends { name: "readonly"; prefix2.suffix.nope: access.will.fail }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/dependency_cycle2.qbs 0000644 0001751 0000166 00000000556 14776170045 026273 0 ustar runner docker Project {
Product {
name: "A"
Depends { name: "B" }
files: ["main.cpp"]
}
Product {
name: "B"
Depends { name: "C" }
files: ["main.cpp"]
}
Product {
name: "C"
Depends { name: "A" }
files: ["main.cpp"]
}
Product {
name: "D"
files: ["main.cpp"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/original-in-product-property.qbs 0000644 0001751 0000166 00000000051 14776170045 030452 0 ustar runner docker Product {
property int n: original
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/reserved_name_in_import.qbs 0000644 0001751 0000166 00000000065 14776170045 027606 0 ustar runner docker import "../idusagebase.qbs" as TextFile
Product { }
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/original-in-export-item2.qbs 0000644 0001751 0000166 00000000255 14776170045 027455 0 ustar runner docker Project {
Product {
name: "a"
Export {
x.y.z: original
}
}
Product {
name: "b"
Depends { name: "a" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/conflicting-properties-in-export-items.qbs 0000644 0001751 0000166 00000000110 14776170045 032431 0 ustar runner docker ParentWithExport {
Export {
property string theProp
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/oldQbsVersion.qbs 0000644 0001751 0000166 00000000137 14776170045 025501 0 ustar runner docker Project {
minimumQbsVersion: "999.5.4"
Product {
qbs.enableSound: true
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/subproject_cycle3.qbs 0000644 0001751 0000166 00000000115 14776170045 026325 0 ustar runner docker Project {
SubProject {
filePath: "subproject_cycle.qbs"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/frozen-object.qbs 0000644 0001751 0000166 00000000473 14776170045 025461 0 ustar runner docker
Product {
Probe {
id: probe
property var output
configure: {
output = {"key": "value"}
found = true
}
}
property var test: {
"use strict"
var result = probe.output;
result.key = "newValue";
return result;
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/no-configure-in-probe.qbs 0000644 0001751 0000166 00000000057 14776170045 027014 0 ustar runner docker Product {
Probe {
id: hurz
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/nonexistentouter.qbs 0000644 0001751 0000166 00000000064 14776170045 026343 0 ustar runner docker Project {
Product {
name: outer
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/mismatching-multiplex-dependency.qbs 0000644 0001751 0000166 00000000463 14776170045 031351 0 ustar runner docker Project {
Product {
name: "a"
multiplexByQbsProperties: ["architectures"]
qbs.architectures: ["x86", "arm"]
}
Product {
name: "b"
Depends { name: "a" }
multiplexByQbsProperties: ["architectures"]
qbs.architectures: ["mips", "ppc"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/overwrite-readonly-module-property.qbs 0000644 0001751 0000166 00000000146 14776170045 031715 0 ustar runner docker Product {
Depends { name: "readonly" }
readonly.readOnlyString: "changing the unchangeable"
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/multiple_exports.qbs 0000644 0001751 0000166 00000000050 14776170045 026320 0 ustar runner docker Product {
Export {}
Export {}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared-parameter1.qbs 0000644 0001751 0000166 00000000162 14776170045 027052 0 ustar runner docker Product {
Depends { name: "prefix2.suffix" }
Depends { name: "readonly"; prefix2.suffix.nope: "nope" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/invalid_child_item_type.qbs 0000644 0001751 0000166 00000000051 14776170045 027552 0 ustar runner docker Project {
Depends { name: "foo" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/undeclared_property_in_Properties_item.qbs 0000644 0001751 0000166 00000000072 14776170045 032677 0 ustar runner docker Product {
Properties {
blubb.bla: "x"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/misused-inherited-property.qbs 0000644 0001751 0000166 00000000055 14776170045 030212 0 ustar runner docker ParentItem {
cpp.compilerName: "blubb"
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/conflicting-module-instances.qbs 0000644 0001751 0000166 00000000072 14776170045 030454 0 ustar runner docker Product {
Depends { name: "conflicting-instances" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/rule-without-output-tags.qbs 0000644 0001751 0000166 00000000346 14776170045 027653 0 ustar runner docker Product {
Rule {
inputs: "input-tag"
prepare: {
var cmd = new JavaScriptCommand;
cmd.silent = true;
cmd.sourceCode = function() {};
return cmd;
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/main.cpp 0000644 0001751 0000166 00000003560 14776170045 023633 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
int main() { }
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/missing-colon.qbs 0000644 0001751 0000166 00000000132 14776170045 025463 0 ustar runner docker Product {
Depends { name: "dummy" }
qbsSearchPaths: ".."
dummy.cxxFlags { }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/invalid_property_type.qbs 0000644 0001751 0000166 00000000053 14776170045 027337 0 ustar runner docker Product {
property nonsense esnesnon
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/importloop1.qbs 0000644 0001751 0000166 00000000045 14776170045 025172 0 ustar runner docker import "importloop2.qbs" as X
X {}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/invalid_stringlist_element.qbs 0000644 0001751 0000166 00000000057 14776170045 030331 0 ustar runner docker Product {
files: ["foo", ["zoo"], "bar"]
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/properties-item-with-invalid-condition.qbs 0000644 0001751 0000166 00000000234 14776170045 032416 0 ustar runner docker Product {
Depends { name: "cpp" }
Properties {
condition: cpp.nonexistingproperty.includes("somevalue")
cpp.defines: ["ABC"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/duplicate_sources.qbs 0000644 0001751 0000166 00000000122 14776170045 026416 0 ustar runner docker Product {
files: ["main.cpp"]
Group {
files: ["main.cpp"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/dependency_cycle4.qbs 0000644 0001751 0000166 00000000055 14776170045 026267 0 ustar runner docker Product {
Depends { name: "module-a" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/ 0000755 0001751 0000166 00000000000 14776170045 023647 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-with-wrong-property-option/ 0000755 0001751 0000166 00000000000 14776170045 032427 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-with-wrong-property-option/m.qbs0000644 0001751 0000166 00000000230 14776170045 033365 0 ustar runner docker Module {
property string someProp
PropertyOptions {
name: "s0meProp"
description: "Oops, spelt the property name wrong"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/conflicting-instances/ 0000755 0001751 0000166 00000000000 14776170045 030133 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/conflicting-instances/conflicting-instance1.qbs qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/conflicting-instances/conflicting-insta0000644 0001751 0000166 00000000013 14776170045 033463 0 ustar runner docker Module {
}
././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/conflicting-instances/conflicting-instance2.qbs qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/conflicting-instances/conflicting-insta0000644 0001751 0000166 00000000013 14776170045 033463 0 ustar runner docker Module {
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/prefix2/ 0000755 0001751 0000166 00000000000 14776170045 025226 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/prefix2/suffix/ 0000755 0001751 0000166 00000000000 14776170045 026532 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/prefix2/suffix/suffix.qbs 0000644 0001751 0000166 00000000013 14776170045 030537 0 ustar runner docker Module {
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/prefix2/prefix2.qbs 0000644 0001751 0000166 00000000062 14776170045 027312 0 ustar runner docker Module {
Depends { name: "prefix2.suffix" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module_with_parameters/ 0000755 0001751 0000166 00000000000 14776170045 030412 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module_with_parameters/module_with_parameters.qbs qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module_with_parameters/module_with_para0000644 0001751 0000166 00000000321 14776170045 033654 0 ustar runner docker Module {
Parameter { property bool boolParameter }
Parameter { property int intParameter }
Parameter { property stringList stringListParameter }
Parameter { property string stringParameter }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/ 0000755 0001751 0000166 00000000000 14776170045 030132 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000147 00000000000 011605 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/missing-js-file.js qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/missing-js-file.0000644 0001751 0000166 00000000054 14776170045 033132 0 ustar runner docker var userfile = require("javascriptfile.js")
././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/missing-js-file-module.qbs qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/missing-js-file-module/missing-js-file-0000644 0001751 0000166 00000000071 14776170045 033130 0 ustar runner docker import "missing-js-file.js" as MissingJsFile
Module { }
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/readonly/ 0000755 0001751 0000166 00000000000 14776170045 025464 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/readonly/readonly.qbs 0000644 0001751 0000166 00000000117 14776170045 030007 0 ustar runner docker Module {
readonly property string readOnlyString: "I cannot be changed!"
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/no_such_property/ 0000755 0001751 0000166 00000000000 14776170045 027251 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/no_such_property/no-such-property.qbs 0000644 0001751 0000166 00000000152 14776170045 033214 0 ustar runner docker Module {
Depends { name: "module_with_parameters" }
module_with_parameters.noSuchProperty: true
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-a/ 0000755 0001751 0000166 00000000000 14776170045 025352 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-a/module-a.qbs 0000644 0001751 0000166 00000000054 14776170045 027563 0 ustar runner docker Module {
Depends { name: "module-b" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-with-id/ 0000755 0001751 0000166 00000000000 14776170045 026477 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithIdParent.qbs 0000644 0001751 0000166 00000000012 14776170045 032707 0 ustar runner docker Module {}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-with-id/ModuleWithId.qbs 0000644 0001751 0000166 00000000037 14776170045 031544 0 ustar runner docker ModuleWithIdParent { id: foo }
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-b/ 0000755 0001751 0000166 00000000000 14776170045 025353 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-b/module-b.qbs 0000644 0001751 0000166 00000000054 14776170045 027565 0 ustar runner docker Module {
Depends { name: "module-a" }
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-with-invalid-original/ 0000755 0001751 0000166 00000000000 14776170045 031333 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000173 00000000000 011604 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-with-invalid-original/module-with-invalid-original.qbs qbs-src-2.6.1/tests/auto/language/testdata/erroneous/modules/module-with-invalid-original/module-wit0000644 0001751 0000166 00000000053 14776170045 033342 0 ustar runner docker Module {
property string p: original
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/dependency-profile-mismatch-2.qbs 0000644 0001751 0000166 00000000441 14776170045 030423 0 ustar runner docker Project {
Profile {
name: "profile1"
}
Profile {
name: "profile2"
}
Product {
name: "dep"
qbs.profiles: ["profile1", "profile2"]
}
Product {
name: "main"
Depends { name: "dep"; profiles: ["profile47"]; }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/erroneous/dependency-profile-mismatch.qbs 0000644 0001751 0000166 00000000350 14776170045 030263 0 ustar runner docker Project {
Profile {
name: "profile1"
}
Product {
name: "dep"
qbs.profiles: ["profile1"]
}
Product {
name: "main"
Depends { name: "dep"; profiles: ["profile47"]; }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/jsimportsinmultiplescopes.qbs 0000644 0001751 0000166 00000000253 14776170045 026237 0 ustar runner docker import "jsimportsinmultiplescopes.js" as MyFunctions
Product {
name: MyFunctions.getName(qbs)
qbs.installDir: MyFunctions.getInstallDir()
files: "main.cpp"
}
qbs-src-2.6.1/tests/auto/language/testdata/qbs1275.qbs 0000644 0001751 0000166 00000001111 14776170045 021763 0 ustar runner docker Project {
Product {
name: "v-bug"
Export {
Depends { name: "cpp"}
cpp.defines: ""
}
}
Product {
name: "e-bug"
Export { Depends { name: "v-bug" } }
}
Product {
name: "u-bug"
Export { Depends { name: "c-bug" } }
}
Product {
name: "c-bug"
Export { Depends { name: "e-bug" } }
}
Product
{
name: "H-bug"
Depends { name: "e-bug" }
Depends { name: "u-bug" }
Group {
qbs.install: true
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/ 0000755 0001751 0000166 00000000000 14776170045 027513 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/dependency-via-module.qbs qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/dependency-via-modu0000644 0001751 0000166 00000000174 14776170045 033275 0 ustar runner docker Product {
Depends { name: "failing-validation"; required: false }
Depends { name: "failing-validation-indirect" }
}
././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-module.qbs qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-modu0000644 0001751 0000166 00000000215 14776170045 033276 0 ustar runner docker Product {
Depends { name: "failing-validation"; required: false }
Depends { name: "failing-validation-indirect"; required: false }
}
././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-export.qbs qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-expo0000644 0001751 0000166 00000000410 14776170045 033302 0 ustar runner docker Project {
Product {
name: "dep"
Export {
Depends { name: "failing-validation" }
}
}
Product {
Depends { name: "failing-validation"; required: false }
Depends { name: "dep"; required: false }
}
}
././@LongLink 0000644 0000000 0000000 00000000164 00000000000 011604 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-export-indirect.qbs qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/required-chain-expo0000644 0001751 0000166 00000000575 14776170045 033316 0 ustar runner docker Project {
Product {
name: "dep2"
Export {
Depends { name: "dep1" }
}
}
Product {
name: "dep1"
Export {
Depends { name: "failing-validation-indirect" }
}
}
Product {
Depends { name: "failing-validation"; required: false }
Depends { name: "dep2"; required: false }
}
}
././@LongLink 0000644 0000000 0000000 00000000153 00000000000 011602 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/dependency-via-export.qbs qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/dependency-via-expo0000644 0001751 0000166 00000000367 14776170045 033310 0 ustar runner docker Project {
Product {
name: "dep"
Export {
Depends { name: "failing-validation" }
}
}
Product {
Depends { name: "failing-validation"; required: false }
Depends { name: "dep" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/complicated.qbs 0000644 0001751 0000166 00000000301 14776170045 032500 0 ustar runner docker Product {
Depends { name: "failing-validation"; required: false }
Depends { name: "failing-validation-indirect" }
Depends { name: "failing-validation-indirect"; required: false }
}
././@LongLink 0000644 0000000 0000000 00000000151 00000000000 011600 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/direct-dependencies.qbs qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/direct-dependencies0000644 0001751 0000166 00000000163 14776170045 033334 0 ustar runner docker Product {
Depends { name: "failing-validation"; required: false }
Depends { name: "failing-validation" }
}
qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/ 0000755 0001751 0000166 00000000000 14776170045 031163 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000166 00000000000 011606 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-validation-indirect/ qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-val0000755 0001751 0000166 00000000000 14776170045 033275 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000225 00000000000 011602 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-validation-indirect/failing-validation-indirect.qbs qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-val0000644 0001751 0000166 00000000066 14776170045 033301 0 ustar runner docker Module {
Depends { name: "failing-validation" }
}
././@LongLink 0000644 0000000 0000000 00000000155 00000000000 011604 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-validation/ qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-val0000755 0001751 0000166 00000000000 14776170045 033275 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000203 00000000000 011576 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-validation/failing-validation.qbs qbs-src-2.6.1/tests/auto/language/testdata/required-and-nonrequired-dependencies/modules/failing-val0000644 0001751 0000166 00000000070 14776170045 033274 0 ustar runner docker Module {
validate: { throw "validation error!"; }
}
qbs-src-2.6.1/tests/auto/language/testdata/depends-item-in-group.qbs 0000644 0001751 0000166 00000000707 14776170045 025005 0 ustar runner docker Project {
Product { name: "dep" }
Product {
name: "main"
property bool enableGroup1
property bool enableGroup2
property bool enableDepends
Group {
condition: enableGroup1
Group {
condition: product.enableGroup2
property bool forwarded: product.enableDepends
Depends { name: "dep"; condition: forwarded }
}
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/throwing-probe.qbs 0000644 0001751 0000166 00000000302 14776170045 023626 0 ustar runner docker Product {
name: "theProduct"
property bool enableProbe
Probe {
id: whatever
condition: enableProbe
configure: {
throw "Error!";
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/ 0000755 0001751 0000166 00000000000 14776170045 021626 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/broken/ 0000755 0001751 0000166 00000000000 14776170045 023106 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/broken/broken.qbs 0000644 0001751 0000166 00000000565 14776170045 025103 0 ustar runner docker Module {
Probe {
id: theProbe
property stringList broken
property stringList fine
configure: {
broken = [["x"]];
fine = ["x"]
found = true;
}
}
property stringList broken: theProbe.broken
property stringList fine: theProbe.fine.filter(function(incl) { return incl != "y"; });
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/multiple_backends/ 0000755 0001751 0000166 00000000000 14776170045 025313 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/multiple_backends/backend3.qbs 0000644 0001751 0000166 00000000210 14776170045 027465 0 ustar runner docker Module {
condition: qbs.targetOS.includes("os2") && qbs.toolchain.includes("tc")
priority: 1
property string backend3Prop
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/multiple_backends/backend2.qbs 0000644 0001751 0000166 00000000176 14776170045 027477 0 ustar runner docker Module {
condition: qbs.targetOS.includes("os2")
property string prop: "backend 2"
property string backend2Prop
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/multiple_backends/backend1.qbs 0000644 0001751 0000166 00000000135 14776170045 027471 0 ustar runner docker Module {
condition: qbs.targetOS.includes("os1")
property string prop: "backend 1"
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/dummyqt/ 0000755 0001751 0000166 00000000000 14776170045 023326 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/dummyqt/gui/ 0000755 0001751 0000166 00000000000 14776170045 024112 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/dummyqt/gui/dummygui.qbs 0000644 0001751 0000166 00000000416 14776170045 026462 0 ustar runner docker Module {
Depends { name: "dummyqt.core" }
property string guiProperty: "guiProperty"
property string someString: "ene mene muh"
Depends { name: "dummy" }
dummy.defines: ["QT_GUI"]
dummy.someString: someString
dummy.zort: dummyqt.core.zort
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/dummyqt/core/ 0000755 0001751 0000166 00000000000 14776170045 024256 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/dummyqt/core/dummycore.qbs 0000644 0001751 0000166 00000001116 14776170045 026770 0 ustar runner docker Module {
property int versionMajor: 5
property int versionMinor: 0
property int versionPatch: 0
property string version: versionMajor.toString() + "." + versionMinor.toString() + "." + versionPatch.toString()
property string coreProperty: "coreProperty"
property string coreVersion: version
property string zort: "zort in dummyqt.core"
Depends { name: "dummy" }
dummy.defines: ["QT_CORE"]
dummy.rpaths: ["/opt/qt/lib"]
dummy.cFlags: [zort]
dummy.varListProp: [{c: "qtcore"}]
Properties {
dummy.productName: product.name
}
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/dummyqt/network/ 0000755 0001751 0000166 00000000000 14776170045 025017 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/dummyqt/network/dummynetwork.qbs 0000644 0001751 0000166 00000000271 14776170045 030273 0 ustar runner docker Module {
Depends { name: "dummyqt"; submodules: ["core"] }
property string networkProperty: "networkProperty"
Depends { name: "dummy" }
dummy.defines: ["QT_NETWORK"]
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod2/ 0000755 0001751 0000166 00000000000 14776170045 022636 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod2/gmod2.qbs 0000644 0001751 0000166 00000000312 14776170045 024351 0 ustar runner docker Module {
property int prop: 0
property string gmod2_string: "gmod2_string_proto"
property string commonName: "commonName_in_gmod2"
property stringList gmod2_list: ["gmod2_list_proto"]
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/module_with_group/ 0000755 0001751 0000166 00000000000 14776170045 025362 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/module_with_group/module_with_group.qbs 0000644 0001751 0000166 00000000724 14776170045 031630 0 ustar runner docker Module {
Depends { name: "dummy" }
property string moduleDefine: "module_define"
property string group
Group {
name: "module_group"
condition: group == name
Properties {
dummy.defines: [moduleDefine.toUpperCase(), name.toUpperCase()]
}
}
Group {
name: "module_group_alt"
condition: group == name
product.dummy.defines: [moduleDefine.toUpperCase(), name.toUpperCase()]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy3_loader/ 0000755 0001751 0000166 00000000000 14776170045 024372 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy3_loader/dummy3_loader.qbs 0000644 0001751 0000166 00000000105 14776170045 027641 0 ustar runner docker Module {
Depends { name: "dummy3" }
dummy3.loadDummy: true
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/scopemod/ 0000755 0001751 0000166 00000000000 14776170045 023437 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/scopemod/scopemod.qbs 0000644 0001751 0000166 00000000303 14776170045 025753 0 ustar runner docker Module {
property int a: 1
property int b: 1
property int c: a + 1
property int d: b + 1
property int e: 1
property int f: 1
property int g: 1
property int h: 1
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy/ 0000755 0001751 0000166 00000000000 14776170045 022761 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy/dummy_base.qbs 0000644 0001751 0000166 00000000103 14776170045 025607 0 ustar runner docker Module {
condition: false
property pathList includePaths
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy/dummy.qbs 0000644 0001751 0000166 00000001731 14776170045 024625 0 ustar runner docker import "dummy_base.qbs" as DummyBase
DummyBase {
condition: true
additionalProductTypes: ["tag2"]
property bool falseProperty: false
property stringList defines
property stringList cFlags
property stringList cxxFlags
property stringList rpaths: ["$ORIGIN"]
property string someString
property string productName: product.name
property string upperCaseProductName: productName.toUpperCase()
property string zort: "zort in dummy"
property pathList includePaths
property path somePath
property stringList listProp: product.type.includes("blubb") ? ["123"] : ["456"]
property bool controllingProp: false
property stringList listProp2: controllingProp
? ["DEFAULT_STUFF", "EXTRA_STUFF"] : ["DEFAULT_STUFF"]
property varList varListProp: [{a: controllingProp, b: someString}]
Probe {
id: QBS_1821
property stringList Flags: cxxFlags
configure: {}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy2/ 0000755 0001751 0000166 00000000000 14776170045 023043 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy2/dummy2.qbs 0000644 0001751 0000166 00000000224 14776170045 024765 0 ustar runner docker Module {
additionalProductTypes: ["tag3"]
property var defines
property var someTrueProp: true
property var someFalseProp: false
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/module-with-properties-item/ 0000755 0001751 0000166 00000000000 14776170045 027212 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000157 00000000000 011606 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/modules/module-with-properties-item/module-with-properties-item.qbs qbs-src-2.6.1/tests/auto/language/testdata/modules/module-with-properties-item/module-with-propertie0000644 0001751 0000166 00000000330 14776170045 033376 0 ustar runner docker Module {
property bool boolProperty: true
property string stringProperty: "set in Module item"
Properties {
condition: boolProperty
stringProperty: "overridden in Properties item"
}
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod/ 0000755 0001751 0000166 00000000000 14776170045 022554 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod/gmod1/ 0000755 0001751 0000166 00000000000 14776170045 023563 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod/gmod1/gmod1.qbs 0000644 0001751 0000166 00000001063 14776170045 025301 0 ustar runner docker Module {
Depends { name: "gmod2" }
Depends { name: "gmod4" }
property stringList gmod1_list1: ["gmod1_list1_proto", gmod1_string]
property stringList gmod1_list2: ["gmod1_list2_proto"]
property stringList gmod1_list3: [gmod1_string]
property string gmod1_string: "gmod1_string_proto"
property string commonName: "commonName_in_gmod1"
property int depProp: gmod2.prop
property int p0: p1 + p2
property int p1: 0
property int p2: 0
gmod2.gmod2_string: gmod1_string
gmod2.gmod2_list: [gmod1_string, commonName]
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/module-with-product-dependency/ 0000755 0001751 0000166 00000000000 14776170045 027656 5 ustar runner docker ././@LongLink 0000644 0000000 0000000 00000000165 00000000000 011605 L ustar root root qbs-src-2.6.1/tests/auto/language/testdata/modules/module-with-product-dependency/module-with-product-dependency.qbs qbs-src-2.6.1/tests/auto/language/testdata/modules/module-with-product-dependency/module-with-produc0000644 0001751 0000166 00000000046 14776170045 033331 0 ustar runner docker Module {
Depends { name: "p2" }
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod4/ 0000755 0001751 0000166 00000000000 14776170045 022640 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod4/gmod4.qbs 0000644 0001751 0000166 00000000276 14776170045 024366 0 ustar runner docker Module {
Depends { name: "gmod2" }
Depends { name: "gmod3" }
property string gmod4_string: "gmod4_string_proto"
gmod2.gmod2_list: [gmod4_string + "_" + gmod3.gmod3_string]
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy3/ 0000755 0001751 0000166 00000000000 14776170045 023044 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/dummy3/dummy3.qbs 0000644 0001751 0000166 00000000142 14776170045 024766 0 ustar runner docker Module {
property bool loadDummy: false
Depends { name: "dummy"; condition: loadDummy }
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/deepdummy/ 0000755 0001751 0000166 00000000000 14776170045 023617 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/deepdummy/deep/ 0000755 0001751 0000166 00000000000 14776170045 024534 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/deepdummy/deep/moat/ 0000755 0001751 0000166 00000000000 14776170045 025474 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/deepdummy/deep/moat/dummydeepmoat.qbs 0000644 0001751 0000166 00000000202 14776170045 031047 0 ustar runner docker Module {
property string depth: "abysmal"
Depends { name: "dummy"; id: dummyId }
property string zort: dummyId.zort
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod3/ 0000755 0001751 0000166 00000000000 14776170045 022637 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/gmod3/qmod3.qbs 0000644 0001751 0000166 00000000205 14776170045 024366 0 ustar runner docker Module {
Depends { name: "gmod2" }
property string gmod3_string: "gmod3_string_proto"
gmod2.gmod2_list: [gmod3_string]
}
qbs-src-2.6.1/tests/auto/language/testdata/modules/module_with_file/ 0000755 0001751 0000166 00000000000 14776170045 025145 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/modules/module_with_file/module-with-file.qbs 0000644 0001751 0000166 00000000567 14776170045 031037 0 ustar runner docker Module {
property bool file1IsTarget
property bool file2IsTarget
Group {
prefix: product.sourceDirectory + '/'
files: "zort"
filesAreTargets: product.module_with_file.file1IsTarget
}
Group {
prefix: product.sourceDirectory + '/'
files: "zort"
filesAreTargets: product.module_with_file.file2IsTarget
}
}
qbs-src-2.6.1/tests/auto/language/testdata/Banana 0000644 0001751 0000166 00000000032 14776170045 021254 0 ustar runner docker Peanut butter jelly time!
qbs-src-2.6.1/tests/auto/language/testdata/eval-error-in-non-present-module.qbs 0000644 0001751 0000166 00000000164 14776170045 027101 0 ustar runner docker Product {
name: "p"
property bool moduleRequired
Depends { name: "broken"; required: moduleRequired }
}
qbs-src-2.6.1/tests/auto/language/testdata/probes-and-multiplexing.qbs 0000644 0001751 0000166 00000000626 14776170045 025442 0 ustar runner docker Product {
multiplexByQbsProperties: "architectures"
qbs.architectures: ["x86", "x86_64", "arm"]
property string archFromProbe: theProbe.archOut
Probe {
id: theProbe
property string archIn: qbs.architecture
property string archOut
configure: { archOut = archIn; }
}
Group {
name: "theGroup"
qbs.sysroot: "/" + theProbe.archOut
}
}
qbs-src-2.6.1/tests/auto/language/testdata/filetags.qbs 0000644 0001751 0000166 00000003073 14776170045 022466 0 ustar runner docker Project {
FileTagger {
patterns: "*.cpp"
fileTags: ["cpp"]
}
Product {
name: "filetagger_project_scope"
files: ["main.cpp"]
}
Product {
name: "filetagger_product_scope"
files: ["drawline.asm"]
FileTagger {
patterns: "*.asm"
fileTags: ["asm"]
}
}
Product {
name: "filetagger_static_pattern"
files: "Banana"
FileTagger {
patterns: "Banana"
fileTags: ["yellow"]
}
}
Product {
name: "unknown_file_tag"
files: "narf.zort"
}
Product {
name: "set_file_tag_via_group"
Group {
files: ["main.cpp"]
fileTags: ["c++"]
}
}
Product {
name: "override_file_tag_via_group"
Group {
files: "main.cpp" // gets file tag "cpp" through the FileTagger
fileTags: ["c++"]
}
}
Product {
name: "add_file_tag_via_group"
Group {
overrideTags: false
files: "main.cpp"
fileTags: ["zzz"]
}
}
Product {
name: "prioritized_filetagger"
files: ["main.cpp"]
FileTagger {
patterns: ["*.cpp"]
fileTags: ["cpp1"]
priority: 3
}
FileTagger {
patterns: ["*.cpp"]
fileTags: ["cpp2"]
priority: 3
}
FileTagger {
patterns: ["*.cpp"]
fileTags: ["ignored"]
priority: 2
}
}
}
qbs-src-2.6.1/tests/auto/language/testdata/subdir2/ 0000755 0001751 0000166 00000000000 14776170045 021530 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/subdir2/exports-mylib2.qbs 0000644 0001751 0000166 00000000537 14776170045 025144 0 ustar runner docker StaticLibrary {
name: "mylib2"
Depends { name: "dummy" }
dummy.defines: ["BUILD_" + product.name.toUpperCase()]
property string definePrefix: "USE_"
Export {
Depends { name: "dummy" }
dummy.defines: [exportingProduct.definePrefix + exportingProduct.name.toUpperCase()]
dummy.includePaths: ["./lib"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/multiplexing-by-profile/ 0000755 0001751 0000166 00000000000 14776170045 024745 5 ustar runner docker qbs-src-2.6.1/tests/auto/language/testdata/multiplexing-by-profile/p2.qbs 0000644 0001751 0000166 00000000551 14776170045 025776 0 ustar runner docker Project {
Profile {
name: "profile1"
qbs.architecture: "dummy"
}
Profile {
name: "profile2"
qbs.architecture: "blubb"
}
Product {
name: "p1"
qbs.profiles: ["profile1"]
}
Product {
name: "p2"
qbs.profiles: ["profile1", "profile2"]
Depends { name: "p1" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/multiplexing-by-profile/p1.qbs 0000644 0001751 0000166 00000000424 14776170045 025774 0 ustar runner docker Project {
Profile {
name: "theProfile"
qbs.architecture: "dummy"
}
Product {
name: "p1"
qbs.profiles: ["theProfile"]
}
Product {
name: "p2"
qbs.profiles: ["theProfile"]
Depends { name: "p1" }
}
}
qbs-src-2.6.1/tests/auto/language/testdata/multiplexing-by-profile/p3.qbs 0000644 0001751 0000166 00000001021 14776170045 025770 0 ustar runner docker Project {
Profile {
name: "profile1"
qbs.architecture: "dummy"
}
Profile {
name: "profile2"
qbs.architecture: "blubb"
}
Profile {
name: "profile3"
qbs.architecture: "hurz"
}
Profile {
name: "profile4"
qbs.architecture: "zonk"
}
Product {
name: "p1"
qbs.profiles: ["profile1", "profile2"]
Depends { name: "p2" }
}
Product {
name: "p2"
qbs.profiles: ["profile3", "profile4"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/multiplexing-by-profile/p4.qbs 0000644 0001751 0000166 00000000601 14776170045 025774 0 ustar runner docker Project {
Profile {
name: "profile1"
qbs.architecture: "dummy"
}
Profile {
name: "profile2"
qbs.architecture: "blubb"
}
Product {
name: "p1"
qbs.profiles: ["profile1"]
Depends { name: "p2"; profiles: ["profile1"] }
}
Product {
name: "p2"
qbs.profiles: ["profile1", "profile2"]
}
}
qbs-src-2.6.1/tests/auto/language/testdata/conditionaldepends.qbs 0000644 0001751 0000166 00000004216 14776170045 024536 0 ustar runner docker import "conditionaldepends_base.qbs" as CondBase
Project {
CondBase {
name: 'conditionaldepends_derived'
someProp: true
}
CondBase {
name: 'conditionaldepends_derived_false'
someProp: "knolf" === "narf"
}
Product {
name: "product_props_true"
property bool someTrueProp: true
Depends { condition: someTrueProp; name: "dummy" }
}
Product {
name: "product_props_false"
property bool someFalseProp: false
Depends { condition: someFalseProp; name: "dummy" }
}
property bool someTruePrjProp: true
Product {
name: "project_props_true"
Depends { condition: project.someTruePrjProp; name: "dummy" }
}
property bool someFalsePrjProp: false
Product {
name: "project_props_false"
Depends { condition: project.someFalsePrjProp; name: "dummy" }
}
Product {
name: "module_props_true"
Depends { name: "dummy2" }
Depends { condition: dummy2.someTrueProp; name: "dummy" }
}
Product {
name: "module_props_false"
Depends { name: "dummy2" }
Depends { condition: dummy2.someFalseProp; name: "dummy" }
}
Product {
name: "multilevel_module_props_true"
Depends { name: "dummy3" }
dummy3.loadDummy: true
}
Product {
name: "multilevel_module_props_false"
Depends { name: "dummy3" }
}
Product {
name: "multilevel_module_props_overridden"
Depends { name: "dummy3" }
}
Product {
name: "multilevel2_module_props_true"
Depends { name: "dummy3_loader" }
}
Product {
name: "contradictory_conditions1"
Depends { condition: false; name: "dummy" }
Depends { condition: true; name: "dummy" } // this one wins
}
Product {
name: "contradictory_conditions2"
Depends { condition: true; name: "dummy" } // this one wins
Depends { condition: false; name: "dummy" }
}
Product {
name: "unknown_dependency_condition_false"
Depends { condition: false; name: "doesonlyexistifhellfreezesover" }
}
}
qbs-src-2.6.1/tests/auto/language/tst_language.cpp 0000644 0001751 0000166 00000471215 14776170045 021540 0 ustar runner docker /****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qbs.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#undef QT_NO_CAST_FROM_ASCII // I am qmake, and I approve this hack.
#include "tst_language.h"
#include "../shared.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
Q_DECLARE_METATYPE(QList)
using namespace qbs;
using namespace qbs::Internal;
static QString testDataDir() {
return testDataSourceDir(SRCDIR "/testdata");
}
static QString testProject(const char *fileName) {
return testDataDir() + QLatin1Char('/') + QLatin1String(fileName);
}
class JSSourceValueCreator
{
FileContextPtr m_fileContext;
std::vector> m_strings;
public:
JSSourceValueCreator(const FileContextPtr &fileContext)
: m_fileContext(fileContext)
{
}
JSSourceValuePtr create(const QString &sourceCode)
{
JSSourceValuePtr value = JSSourceValue::create();
value->setFile(m_fileContext);
auto str = std::make_unique(sourceCode);
value->setSourceCode(*str.get());
m_strings.push_back(std::move(str));
return value;
}
};
TestLanguage::TestLanguage(ILogSink *logSink, Settings *settings)
: m_logSink(logSink)
, m_settings(settings)
, m_wildcardsTestDirPath(QDir::tempPath() + QLatin1String("/_wildcards_test_dir_"))
{
m_rand.seed(QTime::currentTime().msec());
qRegisterMetaType >("QList");
}
TestLanguage::~TestLanguage() = default;
QHash TestLanguage::productsFromProject(ResolvedProjectPtr project)
{
QHash result;
const auto products = project->allProducts();
for (const ResolvedProductPtr &product : products)
result.insert(product->name, product);
return result;
}
template
typename C::value_type findByName(const C &container, const QString &name)
{
auto endIt = std::end(container);
auto it = std::find_if(std::begin(container), endIt,
[&name] (const typename C::value_type &thing) {
return thing->name == name;
});
if (it != endIt)
return *it;
return typename C::value_type();
}
ResolvedModuleConstPtr TestLanguage::findModuleByName(ResolvedProductPtr product, const QString &name)
{
return findByName(product->modules, name);
}
QVariant TestLanguage::productPropertyValue(ResolvedProductPtr product, QString propertyName)
{
QStringList propertyNameComponents = propertyName.split(QLatin1Char('.'));
if (propertyNameComponents.size() > 1)
return product->moduleProperties->property(propertyNameComponents);
return getConfigProperty(product->productProperties, propertyNameComponents);
}
void TestLanguage::handleInitCleanupDataTags(const char *projectFileName, bool *handled)
{
const QByteArray dataTag = QTest::currentDataTag();
if (dataTag == "init") {
*handled = true;
bool exceptionCaught = false;
try {
resolveProject(projectFileName);
QVERIFY(!!project);
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
} else if (dataTag == "cleanup") {
*handled = true;
project.reset();
} else {
*handled = false;
}
}
TopLevelProjectPtr TestLanguage::resolveProject(const char *relProjectFilePath)
{
if (relProjectFilePath)
defaultParameters.setProjectFilePath(testProject(relProjectFilePath));
defaultParameters.expandBuildConfiguration();
ProjectResolver resolver(defaultParameters, m_engine.get(), m_logger);
return project = resolver.resolve();
}
void TestLanguage::init()
{
// clear caches, otherwise StoredVariantValues may end up being at the same address
// as the destroyed value
m_engine->reset();
m_logSink->setLogLevel(LoggerInfo);
defaultParameters = {};
defaultParameters.setBuildRoot(m_tempDir.path() + "/buildroot");
defaultParameters.setPropertyCheckingMode(ErrorHandlingMode::Strict);
defaultParameters.setSettingsDirectory(m_settings->baseDirectory());
defaultParameters.setTopLevelProfile(profileName());
defaultParameters.setMaxJobCount(1);
defaultParameters.setConfigurationName("default");
defaultParameters.setEnvironment(QProcessEnvironment::systemEnvironment());
defaultParameters.setSearchPaths({SRCDIR "/../../../share/qbs"});
QVERIFY(m_tempDir.isValid());
}
#define HANDLE_INIT_CLEANUP_DATATAGS(fn) {\
bool handled;\
handleInitCleanupDataTags(fn, &handled);\
if (handled)\
return;\
QVERIFY(!!project);\
}
void TestLanguage::initTestCase()
{
m_logger = Logger(m_logSink);
m_engine = ScriptEngine::create(m_logger, EvalContext::PropertyEvaluation);
QVERIFY(QFileInfo(m_wildcardsTestDirPath).isAbsolute());
}
void TestLanguage::additionalProductTypes()
{
bool exceptionCaught = false;
try {
resolveProject("additional-product-types.qbs");
QVERIFY(!!project);
const QHash products = productsFromProject(project);
const ResolvedProductConstPtr product = products.value("p");
QVERIFY(!!product);
const QVariantMap cfg = product->productProperties;
QVERIFY(cfg.value("hasTag1").toBool());
QVERIFY(cfg.value("hasTag2").toBool());
QVERIFY(cfg.value("hasTag3").toBool());
QVERIFY(!cfg.value("hasTag4").toBool());
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::baseProperty()
{
bool exceptionCaught = false;
try {
resolveProject("baseproperty.qbs");
QVERIFY(!!project);
QHash products = productsFromProject(project);
ResolvedProductPtr product = products.value("product1");
QVERIFY(!!product);
QVariantMap cfg = product->productProperties;
QCOMPARE(cfg.value("narf").toStringList(), QStringList() << "boo");
QCOMPARE(cfg.value("zort").toStringList(), QStringList() << "bar" << "boo");
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::baseValidation()
{
try {
resolveProject("base-validate/base-validate.qbs");
QVERIFY2(false, "exception expected");
} catch (const qbs::ErrorInfo &e) {
QVERIFY2(e.toString().contains("Parent succeeded, child failed."),
qPrintable(e.toString()));
}
}
void TestLanguage::brokenDependencyCycle()
{
QFETCH(QString, projectFileName);
try {
resolveProject(qPrintable(projectFileName));
} catch (const qbs::ErrorInfo &e) {
QVERIFY2(false, qPrintable(e.toString()));
}
}
void TestLanguage::brokenDependencyCycle_data()
{
QTest::addColumn("projectFileName");
QTest::newRow("one order of products") << "broken-dependency-cycle1.qbs";
QTest::newRow("another order of products") << "broken-dependency-cycle2.qbs";
}
void TestLanguage::buildConfigStringListSyntax()
{
bool exceptionCaught = false;
try {
QVariantMap overriddenValues;
overriddenValues.insert("project.someStrings", "foo,bar,baz");
defaultParameters.setOverriddenValues(overriddenValues);
resolveProject("buildconfigstringlistsyntax.qbs");
QVERIFY(!!project);
QCOMPARE(project->projectProperties().value("someStrings").toStringList(),
QStringList() << "foo" << "bar" << "baz");
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::builtinFunctionInSearchPathsProperty()
{
bool exceptionCaught = false;
try {
QVERIFY(resolveProject("builtinFunctionInSearchPathsProperty.qbs"));
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::chainedProbes()
{
bool exceptionCaught = false;
try {
resolveProject("chained-probes/chained-probes.qbs");
QVERIFY(!!project);
QCOMPARE(project->products.size(), size_t(1));
const QString prop1Val = project->products.front()->moduleProperties
->moduleProperty("m", "prop1").toString();
QCOMPARE(prop1Val, QLatin1String("probe1Val"));
const QString prop2Val = project->products.front()->moduleProperties
->moduleProperty("m", "prop2").toString();
QCOMPARE(prop2Val, QLatin1String("probe1Valprobe2Val"));
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::versionCompare()
{
bool exceptionCaught = false;
try {
QVERIFY(resolveProject("versionCompare.qbs"));
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::canonicalArchitecture()
{
bool exceptionCaught = false;
try {
resolveProject("canonicalArchitecture.qbs");
QVERIFY(!!project);
QHash products = productsFromProject(project);
ResolvedProductPtr product = products.value(QStringLiteral("x86"));
QVERIFY(!!product);
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::rfc1034Identifier()
{
bool exceptionCaught = false;
try {
resolveProject("rfc1034identifier.qbs");
QVERIFY(!!project);
QHash products = productsFromProject(project);
ResolvedProductPtr product = products.value(QStringLiteral("this-has-special-characters-"
"uh-oh-Undersc0r3s-Are.Bad"));
QVERIFY(!!product);
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::throwThings_data()
{
QTest::addColumn("type");
QTest::addColumn("result");
QTest::addRow("bool") << "bool" << "true";
QTest::addRow("int") << "int" << "43";
QTest::addRow("string") << "string" << "an error";
QTest::addRow("list") << "list" << R"([
"an",
"error"
])";
QTest::addRow("object") << "object" << R"({
"reason": "overheating",
"result": "crash"
})";
}
void TestLanguage::throwThings()
{
QFETCH(QString, type);
QFETCH(QString, result);
bool exceptionCaught = false;
try {
defaultParameters.setOverriddenValues({{"project.throwType", type}});
resolveProject("throw.qbs");
} catch (const ErrorInfo &e) {
exceptionCaught = true;
QVERIFY2(e.toString().contains(result), qPrintable(e.toString()));
}
QVERIFY(exceptionCaught);
}
void TestLanguage::conditionalDepends()
{
bool exceptionCaught = false;
ResolvedProductPtr product;
ResolvedModuleConstPtr dependency;
try {
defaultParameters.setOverriddenValues({std::make_pair(QString("products."
"multilevel_module_props_overridden.dummy3.loadDummy"), true)});
resolveProject("conditionaldepends.qbs");
QVERIFY(!!project);
QHash products = productsFromProject(project);
product = products.value("conditionaldepends_derived");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("conditionaldepends_derived_false");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy");
QCOMPARE(dependency, ResolvedModuleConstPtr());
product = products.value("product_props_true");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("product_props_false");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy");
QCOMPARE(dependency, ResolvedModuleConstPtr());
product = products.value("project_props_true");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("project_props_false");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy");
QCOMPARE(dependency, ResolvedModuleConstPtr());
product = products.value("module_props_true");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy2");
QVERIFY(!!dependency);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("module_props_false");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy2");
QVERIFY(!!dependency);
dependency = findModuleByName(product, "dummy");
QCOMPARE(dependency, ResolvedModuleConstPtr());
product = products.value("multilevel_module_props_true");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy3");
QVERIFY(!!dependency);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("multilevel_module_props_false");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy3");
QVERIFY(!!dependency);
dependency = findModuleByName(product, "dummy");
QCOMPARE(dependency, ResolvedModuleConstPtr());
product = products.value("multilevel_module_props_overridden");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy3");
QVERIFY(!!dependency);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("multilevel2_module_props_true");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy3_loader");
QVERIFY(!!dependency);
dependency = findModuleByName(product, "dummy3");
QVERIFY(!!dependency);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("contradictory_conditions1");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("contradictory_conditions2");
QVERIFY(!!product);
dependency = findModuleByName(product, "dummy");
QVERIFY(!!dependency);
product = products.value("unknown_dependency_condition_false");
QVERIFY(!!product);
dependency = findModuleByName(product, "doesonlyexistifhellfreezesover");
QVERIFY(!dependency);
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::convertStringList()
{
FileContextPtr fileContext = FileContext::create();
fileContext->setFilePath("/dev/null");
JSSourceValueCreator sourceValueCreator(fileContext);
ItemPool pool;
Item *scope = Item::create(&pool, ItemType::Scope);
scope->setProperty("x", sourceValueCreator.create("[\"a\", \"b\"]"));
Evaluator evaluator(m_engine.get());
auto variantValue = evaluator.variantValue(scope, "x");
// despite we have a stringList prop, we evaluate it as a QVariantList
QCOMPARE(variantValue.userType(), QMetaType::Type::QVariantList);
// and we have to convert it explicitly
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
variantValue.convert(QMetaType(QMetaType::QStringList));
#else
variantValue.convert(QMetaType::QStringList);
#endif
QCOMPARE(variantValue.userType(), QMetaType::Type::QStringList);
QCOMPARE(variantValue, QStringList({"a", "b"}));
}
void TestLanguage::correctDeclInParentLookup()
{
ErrorInfo exception;
try {
resolveProject("correct-decl-in-parent-lookup.qbs");
QVERIFY(project);
QCOMPARE(project->products.size(), size_t(1));
const ResolvedProductConstPtr theProduct = productsFromProject(project).value("p");
QVERIFY(theProduct);
QCOMPARE(
theProduct->moduleProperties->moduleProperty("dummy", "cxxFlags").toStringList(),
QStringList("x"));
} catch (const ErrorInfo &e) {
exception = e;
}
QVERIFY2(!exception.hasError(), qPrintable(exception.toString()));
}
void TestLanguage::delayedError()
{
QFETCH(bool, productEnabled);
try {
QFETCH(QString, projectFileName);
QVariantMap overriddenValues;
overriddenValues.insert("project.enableProduct", productEnabled);
defaultParameters.setOverriddenValues(overriddenValues);
resolveProject(projectFileName.toLatin1());
QCOMPARE(productEnabled, false);
QVERIFY(!!project);
QCOMPARE(project->products.size(), size_t(1));
const ResolvedProductConstPtr theProduct = productsFromProject(project).value("theProduct");
QVERIFY(!!theProduct);
QCOMPARE(theProduct->enabled, false);
} catch (const ErrorInfo &e) {
if (!productEnabled)
qDebug() << e.toString();
QCOMPARE(productEnabled, true);
}
}
void TestLanguage::delayedError_data()
{
QTest::addColumn("projectFileName");
QTest::addColumn("productEnabled");
QTest::newRow("product enabled, module validation error")
<< "delayed-error/validation.qbs" << true;
QTest::newRow("product disabled, module validation error")
<< "delayed-error/validation.qbs" << false;
QTest::newRow("product enabled, module not found")
<< "delayed-error/nonexisting.qbs" << true;
QTest::newRow("product disabled, module not found")
<< "delayed-error/nonexisting.qbs" << false;
}
void TestLanguage::dependencyOnAllProfiles()
{
bool exceptionCaught = false;
try {
TemporaryProfile p1("p1", m_settings);
p1.p.setValue("qbs.architecture", "arch1");
TemporaryProfile p2("p2", m_settings);
p2.p.setValue("qbs.architecture", "arch2");
QVariantMap overriddenValues;
overriddenValues.insert("project.profile1", "p1");
overriddenValues.insert("project.profile2", "p2");
defaultParameters.setOverriddenValues(overriddenValues);
resolveProject("dependencyOnAllProfiles.qbs");
QVERIFY(!!project);
QCOMPARE(project->products.size(), size_t(3));
const ResolvedProductConstPtr mainProduct = productsFromProject(project).value("main");
QVERIFY(!!mainProduct);
QCOMPARE(mainProduct->dependencies.size(), size_t { 2 });
for (const ResolvedProductPtr &p : mainProduct->dependencies) {
QCOMPARE(p->name, QLatin1String("dep"));
QVERIFY(p->profile() == "p1" || p->profile() == "p2");
}
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::dependsItemInGroup_data()
{
QTest::addColumn("enableGroup1");
QTest::addColumn("enableGroup2");
QTest::addColumn("enableDepends");
QTest::addColumn("dependencyExpected");
QTest::newRow("all disabled") << false << false << false << false;
QTest::newRow("only Depends enabled") << false << false << true << false;
QTest::newRow("only inner Group enabled") << false << true << false << false;
QTest::newRow("inner Group and Depends enabled") << false << true << true << false;
QTest::newRow("only outer Group enabled") << true << false << false << false;
QTest::newRow("only outer Group and Depends enabled") << true << false << true << false;
QTest::newRow("only Groups enabled") << true << true << false << false;
QTest::newRow("everything enabled") << true << true << true << true;
}
void TestLanguage::dependsItemInGroup()
{
QFETCH(bool, enableGroup1);
QFETCH(bool, enableGroup2);
QFETCH(bool, enableDepends);
QFETCH(bool, dependencyExpected);
bool exceptionCaught = false;
try {
const QVariantMap overriddenValues{
std::make_pair("products.main.enableGroup1", enableGroup1),
std::make_pair("products.main.enableGroup2", enableGroup2),
std::make_pair("products.main.enableDepends", enableDepends)};
defaultParameters.setOverriddenValues(overriddenValues);
resolveProject("depends-item-in-group.qbs");
QVERIFY(project);
const ResolvedProductConstPtr mainProduct = productsFromProject(project).value("main");
QVERIFY(mainProduct);
QCOMPARE(mainProduct->dependencies.empty(), !dependencyExpected);
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::derivedSubProject()
{
bool exceptionCaught = false;
try {
resolveProject("derived-sub-project/project.qbs");
QVERIFY(!!project);
const QHash products = productsFromProject(project);
QCOMPARE(products.size(), 1);
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::disabledPropertiesItem_data()
{
QTest::addColumn("setInProduct");
QTest::addColumn("setInHigher1");
QTest::addColumn("setInHigher2");
QTest::addColumn("setInLower");
QTest::addColumn("expectedValue");
QTest::addColumn("expectedListValue");
QTest::addColumn("expectedProductValue");
QTest::newRow("default")
<< false << false << false << false << QString("default")
<< QStringList{"N_GREATER_7", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"}
<< QStringList{"condition2"};
QTest::newRow("lower only")
<< false << false << false << true << QString("default_fromLower")
<< QStringList{"N_GREATER_7", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"}
<< QStringList{"condition2"};
QTest::newRow("higher2 only")
<< false << false << true << false << QString()
<< QStringList{"N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"}
<< QStringList{"condition2"};
QTest::newRow("lower and higher2")
<< false << false << true << true << QString()
<< QStringList{"N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"}
<< QStringList{"condition2"};
QTest::newRow("higher1 only")
<< false << true << false << false << QString("fromHigher1")
<< QStringList{"N_GREATER_7", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"}
<< QStringList{"condition2"};
QTest::newRow("lower and higher1")
<< false << true << false << true << QString("fromHigher1")
<< QStringList{"N_GREATER_7", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"}
<< QStringList{"condition2"};
QTest::newRow("product only")
<< true << false << false << false << QString("fromProduct")
<< QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"}
<< QStringList{"condition1", "condition2"};
QTest::newRow("product and lower")
<< true << false << false << true << QString("fromProduct")
<< QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"}
<< QStringList{"condition1", "condition2"};
QTest::newRow("product and higher2")
<< true << false << true << false << QString("fromProduct")
<< QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"}
<< QStringList{"condition1", "condition2"};
QTest::newRow("product, higher2 and lower")
<< true << false << true << true << QString("fromProduct")
<< QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"}
<< QStringList{"condition1", "condition2"};
QTest::newRow("product and higher1")
<< true << true << false << false << QString("fromProduct")
<< QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"}
<< QStringList{"condition1", "condition2"};
QTest::newRow("product, higher1 and higher2")
<< true << true << true << false << QString("fromProduct")
<< QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "N_NON_ZERO"}
<< QStringList{"condition1", "condition2"};
QTest::newRow("all")
<< true << true << true << true << QString("fromProduct")
<< QStringList{"WITH_PRODUCT_PROP", "N_GREATER_7", "WITH_HIGHER2_PROP", "N_GREATER_6", "WITH_HIGHER1_PROP", "N_GREATER_5", "N_LESS_20", "WITH_LOWER_PROP", "N_NON_ZERO"}
<< QStringList{"condition1", "condition2"};
}
void TestLanguage::disabledPropertiesItem()
{
QFETCH(bool, setInLower);
QFETCH(bool, setInHigher1);
QFETCH(bool, setInHigher2);
QFETCH(bool, setInProduct);
QFETCH(QString, expectedValue);
QFETCH(QStringList, expectedListValue);
QFETCH(QStringList, expectedProductValue);
QVariantMap overriddenValues;
overriddenValues.insert("modules.lower.setProp", setInLower);
overriddenValues.insert("modules.higher1.setProp", setInHigher1);
overriddenValues.insert("modules.higher2.setProp", setInHigher2);
overriddenValues.insert("products.p.setProp", setInProduct);
defaultParameters.setOverriddenValues(overriddenValues);
bool exceptionCaught = false;
try {
resolveProject("disabled-properties-item/disabled-properties-item.qbs");
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
QVERIFY(!!project);
const QHash products = productsFromProject(project);
QCOMPARE(products.size(), 1);
const ResolvedProductConstPtr &p = *products.constBegin();
QCOMPARE(p->moduleProperties->moduleProperty("lower", "prop").toString(), expectedValue);
QCOMPARE(
p->moduleProperties->moduleProperty("lower", "listProp").toStringList(), expectedListValue);
QCOMPARE(p->productProperties.value("productProp").toStringList(), expectedProductValue);
}
void TestLanguage::disabledSubProject()
{
bool exceptionCaught = false;
try {
resolveProject("disabled-subproject.qbs");
QVERIFY(!!project);
const QHash products = productsFromProject(project);
QCOMPARE(products.size(), 0);
} catch (const ErrorInfo &e) {
exceptionCaught = true;
qDebug() << e.toString();
}
QCOMPARE(exceptionCaught, false);
}
void TestLanguage::dottedNames_data()
{
QTest::addColumn("useProduct");
QTest::addColumn("useModule");
QTest::addColumn("expectSuccess");
QTest::addColumn