From 9937e3b3548fd3d6caf573723ecacd2ad925f1a1 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 17 Feb 2023 17:03:21 +0100 Subject: Prefer built-in JS function in modules contains -> includes Change-Id: Id893c2ea0659d9bded4f5cec1a3160ccd802118b Reviewed-by: Ivan Komissarov --- share/qbs/modules/Android/sdk/utils.js | 12 +-- share/qbs/modules/Exporter/pkgconfig/pkgconfig.js | 24 +++--- share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs | 4 +- share/qbs/modules/Exporter/qbs/qbsexporter.js | 10 +-- share/qbs/modules/Sanitizers/address/asan.qbs | 10 +-- share/qbs/modules/archiver/archiver.qbs | 6 +- share/qbs/modules/bundle/BundleModule.qbs | 30 ++++---- share/qbs/modules/bundle/bundle.js | 2 +- share/qbs/modules/cli/CLIModule.qbs | 6 +- share/qbs/modules/cli/cli.js | 10 +-- share/qbs/modules/cli/mono.qbs | 6 +- share/qbs/modules/cli/windows-dotnet.qbs | 2 +- share/qbs/modules/codesign/android.qbs | 4 +- share/qbs/modules/codesign/apple.qbs | 20 ++--- share/qbs/modules/codesign/codesign.js | 12 +-- share/qbs/modules/codesign/signtool.qbs | 6 +- share/qbs/modules/cpp/DarwinGCC.qbs | 36 ++++----- share/qbs/modules/cpp/GenericGCC.qbs | 32 ++++---- share/qbs/modules/cpp/LinuxGCC.qbs | 4 +- share/qbs/modules/cpp/MingwBaseModule.qbs | 6 +- share/qbs/modules/cpp/UnixGCC.qbs | 4 +- share/qbs/modules/cpp/android-gcc.qbs | 6 +- share/qbs/modules/cpp/cosmic.qbs | 2 +- share/qbs/modules/cpp/cpp.js | 8 +- share/qbs/modules/cpp/darwin.js | 4 +- share/qbs/modules/cpp/dmc.js | 12 +-- share/qbs/modules/cpp/dmc.qbs | 2 +- share/qbs/modules/cpp/freebsd-gcc.qbs | 6 +- share/qbs/modules/cpp/gcc.js | 90 +++++++++++----------- share/qbs/modules/cpp/iar.qbs | 2 +- share/qbs/modules/cpp/ios-gcc.qbs | 12 +-- share/qbs/modules/cpp/keil.qbs | 2 +- share/qbs/modules/cpp/macos-gcc.qbs | 4 +- share/qbs/modules/cpp/msvc.js | 20 ++--- share/qbs/modules/cpp/qnx-qcc.qbs | 6 +- share/qbs/modules/cpp/sdcc.js | 2 +- share/qbs/modules/cpp/sdcc.qbs | 2 +- share/qbs/modules/cpp/setuprunenv.js | 20 ++--- share/qbs/modules/cpp/tvos-gcc.qbs | 8 +- share/qbs/modules/cpp/watchos-gcc.qbs | 8 +- share/qbs/modules/cpp/watcom.js | 16 ++-- share/qbs/modules/cpp/watcom.qbs | 4 +- share/qbs/modules/cpp/windows-clang-cl.qbs | 6 +- share/qbs/modules/cpp/windows-clang-mingw.qbs | 8 +- share/qbs/modules/cpp/windows-mingw.qbs | 4 +- share/qbs/modules/cpp/windows-msvc-base.qbs | 2 +- share/qbs/modules/cpp/windows-msvc.qbs | 6 +- share/qbs/modules/dmg/DMGModule.qbs | 2 +- share/qbs/modules/dmg/dmg.js | 2 +- share/qbs/modules/freedesktop/FreeDesktop.qbs | 2 +- share/qbs/modules/ib/IBModule.qbs | 4 +- share/qbs/modules/ib/ib.js | 16 ++-- share/qbs/modules/ico/ico.js | 6 +- share/qbs/modules/innosetup/InnoSetupModule.qbs | 2 +- share/qbs/modules/java/JavaModule.qbs | 6 +- share/qbs/modules/java/utils.js | 8 +- share/qbs/modules/nodejs/NodeJS.qbs | 6 +- share/qbs/modules/nsis/NSISModule.qbs | 8 +- share/qbs/modules/pkgconfig/pkgconfig.qbs | 2 +- share/qbs/modules/protobuf/cpp/protobufcpp.qbs | 6 +- share/qbs/modules/qbs/common.qbs | 40 +++++----- share/qbs/modules/qnx/qnx.qbs | 8 +- share/qbs/modules/typescript/typescript.js | 4 +- share/qbs/modules/wix/WiXModule.qbs | 24 +++--- share/qbs/modules/xcode/xcode.js | 24 +++--- share/qbs/modules/xcode/xcode.qbs | 4 +- 66 files changed, 341 insertions(+), 341 deletions(-) diff --git a/share/qbs/modules/Android/sdk/utils.js b/share/qbs/modules/Android/sdk/utils.js index 2b111522e..232ee5a30 100644 --- a/share/qbs/modules/Android/sdk/utils.js +++ b/share/qbs/modules/Android/sdk/utils.js @@ -84,7 +84,7 @@ function prepareDex(project, product, inputs, outputs, input, output, explicitly return; dep.artifacts["java.jar"].forEach(function(artifact) { - if (!jarFiles.contains(artifact.filePath)) + if (!jarFiles.includes(artifact.filePath)) jarFiles.push(artifact.filePath); }); dep.dependencies.forEach(traverseJarDeps); @@ -93,7 +93,7 @@ function prepareDex(project, product, inputs, outputs, input, output, explicitly if (typeof product.artifacts["java.jar"] !== "undefined") { product.artifacts["java.jar"].forEach(function(artifact) { - if (!jarFiles.contains(artifact.filePath)) + if (!jarFiles.includes(artifact.filePath)) jarFiles.push(artifact.filePath); }); } @@ -166,7 +166,7 @@ function commonAaptPackageArgs(project, product, inputs, outputs, input, output, throw "File '" + resources[i].filePath + "' is tagged as an Android resource, " + "but is not located under a directory called 'res'."; } - if (!resourceDirs.contains(resDir)) + if (!resourceDirs.includes(resDir)) resourceDirs.push(resDir); } } @@ -181,7 +181,7 @@ function commonAaptPackageArgs(project, product, inputs, outputs, input, output, throw "File '" + assets[i].filePath + "' is tagged as an Android asset, " + "but is not located under a directory called 'assets'."; } - if (!assetDirs.contains(assetDir)) + if (!assetDirs.includes(assetDir)) assetDirs.push(assetDir); } } @@ -265,7 +265,7 @@ function prepareAapt2Link(project, product, inputs, outputs, input, output, expl throw "File '" + assets[i].filePath + "' is tagged as an Android asset, " + "but is not located under a directory called 'assets'."; } - if (!assetDirs.contains(assetDir)) + if (!assetDirs.includes(assetDir)) assetDirs.push(assetDir); } } @@ -429,7 +429,7 @@ function stlDeploymentData(product, inputs, type) return data; for (var i = 0; i < theInputs.length; ++i) { var currentInput = theInputs[i]; - if (uniqueFilePaths.contains(currentInput.filePath)) + if (uniqueFilePaths.includes(currentInput.filePath)) continue; uniqueFilePaths.push(currentInput.filePath); data.uniqueInputs.push(currentInput); diff --git a/share/qbs/modules/Exporter/pkgconfig/pkgconfig.js b/share/qbs/modules/Exporter/pkgconfig/pkgconfig.js index 52b4dffe3..50bba536c 100644 --- a/share/qbs/modules/Exporter/pkgconfig/pkgconfig.js +++ b/share/qbs/modules/Exporter/pkgconfig/pkgconfig.js @@ -33,7 +33,7 @@ var ModUtils = require("qbs.ModUtils"); function quote(value) { - if (value.contains(" ") || value.contains("'") || value.contains('"')) { + if (value.includes(" ") || value.includes("'") || value.includes('"')) { return '"' + value.replace(/(["'\\])/g, "\\$1") + '"'; } return value; @@ -105,12 +105,12 @@ function collectAutodetectedData(topLevelProduct) var libArtifacts; var isProduct = !productOrModule.present; var considerDynamicLibs = !isProduct || (productOrModule.type - && productOrModule.type.contains("dynamiclibrary")); + && productOrModule.type.includes("dynamiclibrary")); if (considerDynamicLibs) { libArtifacts = productOrModule.artifacts.dynamiclibrary; } else { var considerStaticLibs = !isProduct || (productOrModule.type - && productOrModule.type.contains("staticlibrary")); + && productOrModule.type.includes("staticlibrary")); if (considerStaticLibs) libArtifacts = productOrModule.artifacts.staticlibrary; } @@ -186,7 +186,7 @@ function collectAutodetectedData(topLevelProduct) exportedDepNames.push(exportedDeps[i].name); for (i = 0; i < (productOrModule.dependencies || []).length; ++i) { var dep = productOrModule.dependencies[i]; - if (exportedDepNames.contains(dep.name)) + if (exportedDepNames.includes(dep.name)) continue; privateDeps.push(dep); } @@ -197,22 +197,22 @@ function collectAutodetectedData(topLevelProduct) var depHasPkgConfig = dep.Exporter && dep.Exporter.pkgconfig; if (depHasPkgConfig) { var entry = FileInfo.completeBaseName(dep.Exporter.pkgconfig.fileName); - if (excludedDeps.contains(entry)) + if (excludedDeps.includes(entry)) return; - if (isPrivateDep && !data.requiresPrivate.contains(entry) - && !explicitRequiresPrivate.contains(entry)) { + if (isPrivateDep && !data.requiresPrivate.includes(entry) + && !explicitRequiresPrivate.includes(entry)) { data.requiresPrivate.push(entry); } - if (!isPrivateDep && !data.requires.contains(entry) - && !explicitRequires.contains(entry)) { + if (!isPrivateDep && !data.requires.includes(entry) + && !explicitRequires.includes(entry)) { data.requires.push(entry); } } else { - if (excludedDeps.contains(dep.name)) + if (excludedDeps.includes(dep.name)) return; - if (isPrivateDep && explicitRequiresPrivate.contains(dep.name)) + if (isPrivateDep && explicitRequiresPrivate.includes(dep.name)) return; - if (!isPrivateDep && explicitRequires.contains(dep.name)) + if (!isPrivateDep && explicitRequires.includes(dep.name)) return; collectAutodetectedDataRecursive(dep, isPrivateDep); } diff --git a/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs b/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs index c36afd953..feb0e017c 100644 --- a/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs +++ b/share/qbs/modules/Exporter/pkgconfig/pkgconfig.qbs @@ -34,9 +34,9 @@ Module { auxiliaryInputs: { if (!autoDetect) return undefined; - if (product.type.contains("staticlibrary")) + if (product.type.includes("staticlibrary")) return ["staticlibrary"]; - if (product.type.contains("dynamiclibrary")) + if (product.type.includes("dynamiclibrary")) return ["dynamiclibrary"]; } diff --git a/share/qbs/modules/Exporter/qbs/qbsexporter.js b/share/qbs/modules/Exporter/qbs/qbsexporter.js index be46372c3..f09dd2d0c 100644 --- a/share/qbs/modules/Exporter/qbs/qbsexporter.js +++ b/share/qbs/modules/Exporter/qbs/qbsexporter.js @@ -74,7 +74,7 @@ function writeTargetArtifactGroups(product, output, moduleFile) var tag = product.Exporter.qbs._artifactTypes[i]; var artifactsForTag = product.artifacts[tag] || []; for (var j = 0; j < artifactsForTag.length; ++j) { - if (!relevantArtifacts.contains(artifactsForTag[j])) + if (!relevantArtifacts.includes(artifactsForTag[j])) relevantArtifacts.push(artifactsForTag[j]); } } @@ -82,7 +82,7 @@ function writeTargetArtifactGroups(product, output, moduleFile) var artifactCount = relevantArtifacts ? relevantArtifacts.length : 0; for (i = 0; i < artifactCount; ++i) { var artifact = relevantArtifacts[i]; - if (!artifact.fileTags.contains("installable")) + if (!artifact.fileTags.includes("installable")) continue; // Put all artifacts with the same set of file tags into the same group, so we don't @@ -172,7 +172,7 @@ function writeProperty(project, product, moduleInstallDir, prop, indentation, co var moduleName; if (isModuleProperty) { moduleName = prop.name.slice(0, separatorIndex); - if ((product.Exporter.qbs.excludedDependencies || []).contains(moduleName)) + if ((product.Exporter.qbs.excludedDependencies || []).includes(moduleName)) return; } line += prop.name + ": "; @@ -244,7 +244,7 @@ function isExcludedDependency(product, childItem) 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.contains(unquotedRhs)) + if (prop.name === "name" && product.Exporter.qbs.excludedDependencies.includes(unquotedRhs)) return true; } return false; @@ -264,7 +264,7 @@ function writeImportStatements(product, moduleFile) var imports = product.exports.imports; // We potentially use FileInfo ourselves when transforming paths in stringifyValue(). - if (!imports.contains("import qbs.FileInfo")) + if (!imports.includes("import qbs.FileInfo")) imports.push("import qbs.FileInfo"); for (var i = 0; i < imports.length; ++i) diff --git a/share/qbs/modules/Sanitizers/address/asan.qbs b/share/qbs/modules/Sanitizers/address/asan.qbs index 39605ef4e..9ae6f285e 100644 --- a/share/qbs/modules/Sanitizers/address/asan.qbs +++ b/share/qbs/modules/Sanitizers/address/asan.qbs @@ -34,9 +34,9 @@ Module { Depends { name: "cpp" } property bool enabled: true - readonly property bool _supported: qbs.toolchain.contains("gcc") - || qbs.toolchain.contains("clang-cl") - || (qbs.toolchain.contains("msvc") + 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 @@ -53,7 +53,7 @@ Module { var flags = []; if (!_enabled) return flags; - if (qbs.toolchain.contains("msvc") && !qbs.toolchain.contains("clang-cl")) { + if (qbs.toolchain.includes("msvc") && !qbs.toolchain.includes("clang-cl")) { flags.push("/fsanitize=address"); if (detectUseAfterReturn !== "never") flags.push("/fsanitize-address-use-after-return"); @@ -63,7 +63,7 @@ Module { if (detectUseAfterScope) flags.push("-fsanitize-address-use-after-scope"); if (detectUseAfterReturn) { - if (qbs.toolchain.contains("llvm")) { + if (qbs.toolchain.includes("llvm")) { if (Utilities.versionCompare(cpp.compilerVersion, "13") >= 0) flags.push("-fsanitize-address-use-after-return=" + detectUseAfterReturn); } else if (detectUseAfterReturn === "never") { diff --git a/share/qbs/modules/archiver/archiver.qbs b/share/qbs/modules/archiver/archiver.qbs index 6da3f43ff..069e76717 100644 --- a/share/qbs/modules/archiver/archiver.qbs +++ b/share/qbs/modules/archiver/archiver.qbs @@ -54,7 +54,7 @@ Module { names: ["7z"] platformSearchPaths: { var paths = base; - if (Host.os().contains("windows")) { + if (Host.os().includes("windows")) { var env32 = Environment.getEnv("PROGRAMFILES(X86)"); var env64 = Environment.getEnv("PROGRAMFILES"); if (env64 === env32 && env64.endsWith(" (x86)")) @@ -212,7 +212,7 @@ Module { args.push("-0"); } else { compression = compression === "bz2" ? "bzip2" : compression; - if (["store", "deflate", "bzip2"].contains(compression)) + if (["store", "deflate", "bzip2"].includes(compression)) args.push("-Z", compression); if (compressionLevel) @@ -221,7 +221,7 @@ Module { args.push("-r", output.filePath, ".", "-i@" + input.filePath); args = args.concat(product.moduleProperty("archiver", "flags")); - } else if (["tar", "zip", "jar"].contains(binaryName)) { + } else if (["tar", "zip", "jar"].includes(binaryName)) { throw binaryName + ": unrecognized archive type: '" + type + "'"; } else if (binaryName) { throw "unrecognized archive tool: '" + binaryName + "'"; diff --git a/share/qbs/modules/bundle/BundleModule.qbs b/share/qbs/modules/bundle/BundleModule.qbs index d43be5116..0d8452a7e 100644 --- a/share/qbs/modules/bundle/BundleModule.qbs +++ b/share/qbs/modules/bundle/BundleModule.qbs @@ -47,13 +47,13 @@ Module { Probe { id: bundleSettingsProbe - condition: qbs.targetOS.contains("darwin") + 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.contains("macos") + property bool isMacOs: qbs.targetOS.includes("macos") property bool xcodePresent: xcode.present property string xcodeVersion: xcode.version @@ -74,9 +74,9 @@ Module { "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.contains("simulator") ? "-simulator" : "", + "LLVM_TARGET_TRIPLE_SUFFIX": qbs.targetOS.includes("simulator") ? "-simulator" : "", "SWIFT_PLATFORM_TARGET_PREFIX": isMacOs ? "macos" - : qbs.targetOS.contains("ios") ? "ios" : "", + : qbs.targetOS.includes("ios") ? "ios" : "", "TARGET_BUILD_DIR": product.buildDirectory, "WRAPPER_NAME": bundleName, "WRAPPER_EXTENSION": extension @@ -118,7 +118,7 @@ Module { additionalProductTypes: !(product.multiplexed || product.aggregate) || !product.multiplexConfigurationId ? ["bundle.content"] : [] - property bool isBundle: !product.consoleApplication && qbs.targetOS.contains("darwin") + property bool isBundle: !product.consoleApplication && qbs.targetOS.includes("darwin") readonly property bool isShallow: bundleSettingsProbe.xcodeSettings["SHALLOW_BUNDLE"] === "YES" @@ -152,7 +152,7 @@ Module { property var infoPlist property bool processInfoPlist: true property bool embedInfoPlist: product.consoleApplication && !isBundle - property string infoPlistFormat: qbs.targetOS.contains("macos") ? "same-as-input" : "binary1" + property string infoPlistFormat: qbs.targetOS.includes("macos") ? "same-as-input" : "binary1" property string localizedResourcesFolderSuffix: ".lproj" @@ -227,7 +227,7 @@ Module { } validate: { - if (!qbs.targetOS.contains("darwin")) + if (!qbs.targetOS.includes("darwin")) return; if (!bundleSettingsProbe.found) { var error = "Bundle product type " + _productTypeIdentifier + " is not supported."; @@ -273,7 +273,7 @@ Module { } Rule { - condition: qbs.targetOS.contains("darwin") + condition: qbs.targetOS.includes("darwin") multiplex: true requiresInputs: false // TODO: The resources property should probably be a tag instead. inputs: ["infoplist", "partial_infoplist"] @@ -455,7 +455,7 @@ Module { infoPlistFormat = "xml1"; var validFormats = [ "xml1", "binary1", "json" ]; - if (!validFormats.contains(infoPlistFormat)) + if (!validFormats.includes(infoPlistFormat)) throw("Invalid Info.plist format " + infoPlistFormat + ". " + "Must be in [xml1, binary1, json]."); @@ -473,7 +473,7 @@ Module { } Rule { - condition: qbs.targetOS.contains("darwin") + condition: qbs.targetOS.includes("darwin") multiplex: true inputs: ["aggregate_infoplist"] @@ -514,7 +514,7 @@ Module { } Rule { - condition: qbs.targetOS.contains("darwin") + condition: qbs.targetOS.includes("darwin") multiplex: true inputs: ["bundle.input", "aggregate_infoplist", "pkginfo", "hpp", @@ -540,7 +540,7 @@ Module { var fp = inputs["bundle.input"][i].moduleProperty("bundle", "_bundleFilePath"); if (!fp) throw("Artifact " + inputs["bundle.input"][i].filePath + " has no associated bundle file path"); - var extraTags = inputs["bundle.input"][i].fileTags.contains("application") + var extraTags = inputs["bundle.input"][i].fileTags.includes("application") ? ["bundle.application-executable"] : []; artifacts.push({ filePath: fp, @@ -621,7 +621,7 @@ Module { for (var i = 0; i < artifacts.length; ++i) artifacts[i].bundle = { wrapperPath: wrapperPath }; - if (Host.os().contains("darwin") && product.codesign + if (Host.os().includes("darwin") && product.codesign && product.codesign.enableCodeSigning) { artifacts.push({ filePath: FileInfo.joinPaths(product.bundle.contentsFolderPath, "_CodeSignature/CodeResources"), @@ -772,12 +772,12 @@ Module { if (cmd.sources && cmd.sources.length) commands.push(cmd); - if (product.moduleProperty("qbs", "hostOS").contains("darwin")) { + if (product.moduleProperty("qbs", "hostOS").includes("darwin")) { Array.prototype.push.apply(commands, Codesign.prepareSign( project, product, inputs, outputs, input, output)); if (bundleType === "application" - && product.moduleProperty("qbs", "targetOS").contains("macos")) { + && product.moduleProperty("qbs", "targetOS").includes("macos")) { var bundlePath = FileInfo.joinPaths( product.destinationDirectory, product.bundle.bundleName); cmd = new Command(ModUtils.moduleProperty(product, "lsregisterPath"), diff --git a/share/qbs/modules/bundle/bundle.js b/share/qbs/modules/bundle/bundle.js index 7fb89974a..ec0e30054 100644 --- a/share/qbs/modules/bundle/bundle.js +++ b/share/qbs/modules/bundle/bundle.js @@ -83,7 +83,7 @@ var _productTypeIdentifiers = { function productTypeIdentifier(productType) { for (var k in _productTypeIdentifiers) { - if (productType.contains(k)) + if (productType.includes(k)) return _productTypeIdentifiers[k]; } return "com.apple.package-type.wrapper"; diff --git a/share/qbs/modules/cli/CLIModule.qbs b/share/qbs/modules/cli/CLIModule.qbs index df58942b5..3b12284ed 100644 --- a/share/qbs/modules/cli/CLIModule.qbs +++ b/share/qbs/modules/cli/CLIModule.qbs @@ -5,9 +5,9 @@ import qbs.ModUtils import "cli.js" as CLI Module { - Depends { name: "bundle"; condition: qbs.targetOS.contains("darwin") } + Depends { name: "bundle"; condition: qbs.targetOS.includes("darwin") } Properties { - condition: qbs.targetOS.contains("darwin") + condition: qbs.targetOS.includes("darwin") bundle.isBundle: false } @@ -89,7 +89,7 @@ Module { setupBuildEnvironment: { var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), - Host.os().contains("windows")); + Host.os().includes("windows")); v.prepend(product.cli.toolchainInstallPath); v.set(); } diff --git a/share/qbs/modules/cli/cli.js b/share/qbs/modules/cli/cli.js index 38833ac51..faa812201 100644 --- a/share/qbs/modules/cli/cli.js +++ b/share/qbs/modules/cli/cli.js @@ -59,16 +59,16 @@ function prepareCompiler(product, inputs, output) { "cli.fsharp": fsharpCompilerPath }; - var pathFunction = product.moduleProperty("qbs", "hostOS").contains("windows") + var pathFunction = product.moduleProperty("qbs", "hostOS").includes("windows") ? FileInfo.toWindowsSeparators : function (path) { return path; }; var outputDescription = "assembly"; - if (output.fileTags.contains("application")) { + if (output.fileTags.includes("application")) { args.push("/target:" + (product.consoleApplication === false ? "winexe" : "exe")); - } else if (output.fileTags.contains("dynamiclibrary")) { + } else if (output.fileTags.includes("dynamiclibrary")) { args.push("/target:library"); - } else if (output.fileTags.contains("cli.netmodule")) { + } else if (output.fileTags.includes("cli.netmodule")) { args.push("/target:module"); outputDescription = "netmodule"; } @@ -77,7 +77,7 @@ function prepareCompiler(product, inputs, output) { var keys = Object.keys(inputs); var language; for (i in keys) { - if (Object.keys(compilers).contains(keys[i])) { + 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]; diff --git a/share/qbs/modules/cli/mono.qbs b/share/qbs/modules/cli/mono.qbs index 2ed65fd67..f16387dd7 100644 --- a/share/qbs/modules/cli/mono.qbs +++ b/share/qbs/modules/cli/mono.qbs @@ -3,7 +3,7 @@ import qbs.Host import qbs.Probes CLIModule { - condition: qbs.toolchain && qbs.toolchain.contains("mono") + condition: qbs.toolchain && qbs.toolchain.includes("mono") debugInfoSuffix: ".mdb" csharpCompilerName: "mcs" @@ -15,9 +15,9 @@ CLIModule { names: ["mono"] platformSearchPaths: { var paths = []; - if (Host.os().contains("macos")) + if (Host.os().includes("macos")) paths.push("/Library/Frameworks/Mono.framework/Commands"); - if (Host.os().contains("unix")) + if (Host.os().includes("unix")) paths.push("/usr/bin"); return paths; } diff --git a/share/qbs/modules/cli/windows-dotnet.qbs b/share/qbs/modules/cli/windows-dotnet.qbs index 6fde50b85..a4d27c207 100644 --- a/share/qbs/modules/cli/windows-dotnet.qbs +++ b/share/qbs/modules/cli/windows-dotnet.qbs @@ -1,7 +1,7 @@ import qbs.Utilities CLIModule { - condition: qbs.toolchain && qbs.toolchain.contains("dotnet") + condition: qbs.toolchain && qbs.toolchain.includes("dotnet") debugInfoSuffix: ".pdb" csharpCompilerName: "csc" diff --git a/share/qbs/modules/codesign/android.qbs b/share/qbs/modules/codesign/android.qbs index e149e033c..b1811dcfd 100644 --- a/share/qbs/modules/codesign/android.qbs +++ b/share/qbs/modules/codesign/android.qbs @@ -37,7 +37,7 @@ import qbs.Probes import "codesign.js" as CodeSign CodeSignModule { - condition: qbs.targetOS.contains("android") + condition: qbs.targetOS.includes("android") priority: 1 enableCodeSigning: true @@ -55,7 +55,7 @@ CodeSignModule { property string keytoolName: "keytool" property string debugKeystorePath: FileInfo.joinPaths( - Environment.getEnv(Host.os().contains("windows") + Environment.getEnv(Host.os().includes("windows") ? "USERPROFILE" : "HOME"), ".android", "debug.keystore") readonly property string debugKeystorePassword: "android" diff --git a/share/qbs/modules/codesign/apple.qbs b/share/qbs/modules/codesign/apple.qbs index 05232d7c1..72384a06a 100644 --- a/share/qbs/modules/codesign/apple.qbs +++ b/share/qbs/modules/codesign/apple.qbs @@ -43,14 +43,14 @@ import "codesign.js" as CodeSign import "../xcode/xcode.js" as XcodeUtils CodeSignModule { - Depends { name: "xcode"; required: qbs.toolchain && qbs.toolchain.contains("xcode") } + Depends { name: "xcode"; required: qbs.toolchain && qbs.toolchain.includes("xcode") } Probes.BinaryProbe { id: codesignProbe names: [codesignName] } - condition: Host.os().contains("macos") && qbs.targetOS.contains("darwin") + condition: Host.os().includes("macos") && qbs.targetOS.includes("darwin") priority: 0 enableCodeSigning: _codeSigningRequired @@ -78,15 +78,15 @@ CodeSignModule { var isDebug = qbs.buildVariant !== "release"; - if (qbs.targetOS.contains("ios") || qbs.targetOS.contains("tvos") - || qbs.targetOS.contains("watchos")) { + 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.contains("macos")) { + if (qbs.targetOS.includes("macos")) { switch (signingType) { case "app-store": return isDebug ? "Mac Developer" : "3rd Party Mac Developer Application"; @@ -161,22 +161,22 @@ CodeSignModule { readonly property bool _provisioningProfileAllowed: product.bundle && product.bundle.isBundle - && product.type.contains("application") + && 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.contains("macos") + _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.contains("macos")) + if (qbs.targetOS.includes("macos")) return "OSX"; - if (qbs.targetOS.contains("ios") || qbs.targetOS.contains("watchos")) + if (qbs.targetOS.includes("ios") || qbs.targetOS.includes("watchos")) return "iOS"; - if (qbs.targetOS.contains("tvos")) + if (qbs.targetOS.includes("tvos")) return "tvOS"; } diff --git a/share/qbs/modules/codesign/codesign.js b/share/qbs/modules/codesign/codesign.js index 80b82f1ce..903d16f80 100644 --- a/share/qbs/modules/codesign/codesign.js +++ b/share/qbs/modules/codesign/codesign.js @@ -43,7 +43,7 @@ function findSigningIdentities(searchString, team) { var matchedIdentities = {}; for (var key in identities) { var identity = identities[key]; - if (team && ![identity.subjectInfo.O, identity.subjectInfo.OU].contains(team)) + if (team && ![identity.subjectInfo.O, identity.subjectInfo.OU].includes(team)) continue; if (searchString === key || (identity.subjectInfo.CN && identity.subjectInfo.CN.startsWith(searchString))) { @@ -105,7 +105,7 @@ function findBestProvisioningProfile(product, files) { // 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.contains("application")) + if (actualSigningIdentity.SHA1 === "-" || !product.type.includes("application")) return undefined; // Filter out any provisioning profiles we know to be unsuitable from the start @@ -116,7 +116,7 @@ function findBestProvisioningProfile(product, files) { var certCommonNames = (data["DeveloperCertificates"] || []).map(function (cert) { return Utilities.certificateInfo(cert).subjectInfo.CN; }); - if (!certCommonNames.contains(actualSigningIdentity.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(", ") + "): " @@ -126,7 +126,7 @@ function findBestProvisioningProfile(product, files) { } var platforms = data["Platform"] || []; - if (platforms.length > 0 && profilePlatform && !platforms.contains(profilePlatform)) { + if (platforms.length > 0 && profilePlatform && !platforms.includes(profilePlatform)) { console.log("Skipping provisioning profile for platform " + platforms.join(", ") + " (current platform " + profilePlatform + ")" + ": " + profile.filePath); @@ -134,7 +134,7 @@ function findBestProvisioningProfile(product, files) { } if (teamIdentifier - && !data["TeamIdentifier"].contains(teamIdentifier) + && !data["TeamIdentifier"].includes(teamIdentifier) && data["TeamName"] !== teamIdentifier) { console.log("Skipping provisioning profile for team " + data["TeamIdentifier"] + " (" + data["TeamName"] + ") (current team " + teamIdentifier + ")" @@ -225,7 +225,7 @@ function findBestSignToolSearchPaths(arch) { }); function addSearchPath(searchPath) { - if (File.exists(searchPath) && !searchPaths.contains(searchPath)) { + if (File.exists(searchPath) && !searchPaths.includes(searchPath)) { searchPaths.push(searchPath); return true; } diff --git a/share/qbs/modules/codesign/signtool.qbs b/share/qbs/modules/codesign/signtool.qbs index 0fc50f1b7..111f0a307 100644 --- a/share/qbs/modules/codesign/signtool.qbs +++ b/share/qbs/modules/codesign/signtool.qbs @@ -35,9 +35,9 @@ import qbs.Probes import "codesign.js" as CODESIGN CodeSignModule { - condition: qbs.targetOS.contains("windows") - && Host.os().contains("windows") - && qbs.toolchain.contains("msvc") + condition: qbs.targetOS.includes("windows") + && Host.os().includes("windows") + && qbs.toolchain.includes("msvc") _canSignArtifacts: true diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs index c42d25362..e20973acc 100644 --- a/share/qbs/modules/cpp/DarwinGCC.qbs +++ b/share/qbs/modules/cpp/DarwinGCC.qbs @@ -43,7 +43,7 @@ import "gcc.js" as Gcc UnixGCC { condition: false - Depends { name: "xcode"; required: qbs.toolchain && qbs.toolchain.contains("xcode") } + Depends { name: "xcode"; required: qbs.toolchain && qbs.toolchain.includes("xcode") } Probes.BinaryProbe { id: lipoProbe @@ -76,7 +76,7 @@ UnixGCC { dynamicLibrarySuffix: ".dylib" Properties { - condition: product.multiplexByQbsProperties.contains("buildVariants") + condition: product.multiplexByQbsProperties.includes("buildVariants") && qbs.buildVariants && qbs.buildVariants.length > 1 && (!product.aggregate || !!product.multiplexConfigurationId) && qbs.buildVariant !== "release" @@ -107,7 +107,7 @@ UnixGCC { property var defaultInfoPlist: { var dict = {}; - if (qbs.targetOS.contains("macos")) { + 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 @@ -117,32 +117,32 @@ UnixGCC { dict["LSMinimumSystemVersion"] = minimumMacosVersion; } - if (qbs.targetOS.contains("ios") && minimumIosVersion) + if (qbs.targetOS.includes("ios") && minimumIosVersion) dict["MinimumOSVersion"] = minimumIosVersion; - else if (qbs.targetOS.contains("tvos") && minimumTvosVersion) + else if (qbs.targetOS.includes("tvos") && minimumTvosVersion) dict["MinimumOSVersion"] = minimumTvosVersion; - else if (qbs.targetOS.contains("watchos") && minimumWatchosVersion) + 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.contains("ios")) { + if (qbs.targetOS.includes("ios")) { if (qbs.architecture === "arm64") dict["UIRequiredDeviceCapabilities"] = ["arm64"]; else dict["UIRequiredDeviceCapabilities"] = ["armv7"]; } - if (qbs.targetOS.contains("tvos")) + if (qbs.targetOS.includes("tvos")) dict["UIRequiredDeviceCapabilities"] = ["arm64"]; } } if (xcode.present) { var targetDevices = DarwinTools.targetedDeviceFamily(xcode.targetDevices); - if (qbs.targetOS.contains("ios")) + if (qbs.targetOS.includes("ios")) dict["UIDeviceFamily"] = targetDevices; if (qbs.targetOS.containsAny(["ios", "watchos"])) { @@ -153,13 +153,13 @@ UnixGCC { "UIInterfaceOrientationLandscapeRight" ]; - if (targetDevices.contains("ipad")) + if (targetDevices.includes("ipad")) dict["UISupportedInterfaceOrientations~ipad"] = orientations; - if (targetDevices.contains("watch")) + if (targetDevices.includes("watch")) dict["UISupportedInterfaceOrientations"] = orientations.slice(0, 2); - if (targetDevices.contains("iphone")) { + if (targetDevices.includes("iphone")) { orientations.splice(1, 1); dict["UISupportedInterfaceOrientations"] = orientations; } @@ -199,13 +199,13 @@ UnixGCC { // 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.contains("ios") && minimumIosVersion) + if (qbs.targetOS.includes("ios") && minimumIosVersion) env["IPHONEOS_DEPLOYMENT_TARGET"] = minimumIosVersion; - if (qbs.targetOS.contains("macos") && minimumMacosVersion) + if (qbs.targetOS.includes("macos") && minimumMacosVersion) env["MACOSX_DEPLOYMENT_TARGET"] = minimumMacosVersion; - if (qbs.targetOS.contains("watchos") && minimumWatchosVersion) + if (qbs.targetOS.includes("watchos") && minimumWatchosVersion) env["WATCHOS_DEPLOYMENT_TARGET"] = minimumWatchosVersion; - if (qbs.targetOS.contains("tvos") && minimumTvosVersion) + if (qbs.targetOS.includes("tvos") && minimumTvosVersion) env["TVOS_DEPLOYMENT_TARGET"] = minimumTvosVersion; if (xcode.present) @@ -218,7 +218,7 @@ UnixGCC { property string minimumDarwinVersionCompilerFlag property string minimumDarwinVersionLinkerFlag - property bool libcxxAvailable: qbs.toolchain.contains("clang") && cxxLanguageVersion !== "c++98" + property bool libcxxAvailable: qbs.toolchain.includes("clang") && cxxLanguageVersion !== "c++98" Rule { condition: enableAggregationRules @@ -271,7 +271,7 @@ UnixGCC { } Rule { - condition: qbs.targetOS.contains("darwin") + condition: qbs.targetOS.includes("darwin") multiplex: true Artifact { diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs index 025aad498..22a98ad57 100644 --- a/share/qbs/modules/cpp/GenericGCC.qbs +++ b/share/qbs/modules/cpp/GenericGCC.qbs @@ -43,7 +43,7 @@ import 'cpp.js' as Cpp import 'gcc.js' as Gcc CppModule { - condition: qbs.toolchain && qbs.toolchain.contains("gcc") + condition: qbs.toolchain && qbs.toolchain.includes("gcc") priority: -100 Depends { name: "codesign" } @@ -123,9 +123,9 @@ CppModule { precompiledHeaderSuffix: ".gch" - property bool compilerHasTargetOption: qbs.toolchain.contains("clang") + property bool compilerHasTargetOption: qbs.toolchain.includes("clang") && Utilities.versionCompare(compilerVersion, "3.1") >= 0 - property bool assemblerHasTargetOption: qbs.toolchain.contains("xcode") + property bool assemblerHasTargetOption: qbs.toolchain.includes("xcode") && Utilities.versionCompare(compilerVersion, "7") >= 0 property string target: targetArch ? [targetArch, targetVendor, targetSystem, targetAbi].join("-") @@ -182,9 +182,9 @@ CppModule { property string toolchainPathPrefix: Gcc.pathPrefix(toolchainInstallPath, toolchainPrefix) property string binutilsPathPrefix: Gcc.pathPrefix(binutilsPath, toolchainPrefix) - property string cCompilerName: (qbs.toolchain.contains("clang") ? "clang" : "gcc") + property string cCompilerName: (qbs.toolchain.includes("clang") ? "clang" : "gcc") + compilerExtension - property string cxxCompilerName: (qbs.toolchain.contains("clang") ? "clang++" : "g++") + property string cxxCompilerName: (qbs.toolchain.includes("clang") ? "clang++" : "g++") + compilerExtension compilerPathByLanguage: ({ @@ -216,7 +216,7 @@ CppModule { linkerScriptFlag: "-T" readonly property bool shouldCreateSymlinks: { - return createSymlinks && internalVersion && ["macho", "elf"].contains(cpp.imageFormat); + return createSymlinks && internalVersion && ["macho", "elf"].includes(cpp.imageFormat); } readonly property bool shouldSignArtifacts: codesign._canSignArtifacts @@ -251,18 +251,18 @@ CppModule { property var buildEnv: { var env = {}; - if (qbs.toolchain.contains("mingw")) + if (qbs.toolchain.includes("mingw")) env.PATH = [toolchainInstallPath]; // For libwinpthread etc return env; } exceptionHandlingModel: { - if (qbs.toolchain.contains("mingw")) { + 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().contains("windows")) + if (!Host.os().includes("windows")) prefix = FileInfo.joinPaths(toolchainInstallPath, "..", "lib", "gcc", toolchainPrefix, [compilerVersionMajor, compilerVersionMinor].join(".")); @@ -314,7 +314,7 @@ CppModule { if (gccProbe.targetPlatform) { // Can't differentiate Darwin OSes at the compiler level alone if (gccProbe.targetPlatform === "darwin" - ? !qbs.targetOS.contains("darwin") + ? !qbs.targetOS.includes("darwin") : qbs.targetPlatform !== gccProbe.targetPlatform) isWrongTriple = true; } else if (qbs.targetPlatform) { @@ -351,7 +351,7 @@ CppModule { var validateFlagsFunction = function (value) { if (value) { for (var i = 0; i < value.length; ++i) { - if (["-target", "-triple", "-arch"].contains(value[i])) + if (["-target", "-triple", "-arch"].includes(value[i])) return false; } } @@ -403,7 +403,7 @@ CppModule { inputs: { var tags = ["obj", "res", "linkerscript", "versionscript"]; if (product.bundle && product.bundle.embedInfoPlist - && product.qbs.targetOS.contains("darwin")) { + && product.qbs.targetOS.includes("darwin")) { tags.push("aggregate_infoplist"); } return tags; @@ -483,9 +483,9 @@ CppModule { var objCount = objs ? objs.length : 0; for (var i = 0; i < objCount; ++i) { var ft = objs[i].fileTags; - if (ft.contains("c_obj")) + if (ft.includes("c_obj")) tags.push("c_staticlibrary"); - if (ft.contains("cpp_obj")) + if (ft.includes("cpp_obj")) tags.push("cpp_staticlibrary"); } return [{ @@ -521,7 +521,7 @@ CppModule { inputs: { var tags = ["obj", "res", "linkerscript"]; if (product.bundle && product.bundle.embedInfoPlist - && product.qbs.targetOS.contains("darwin")) { + && product.qbs.targetOS.includes("darwin")) { tags.push("aggregate_infoplist"); } return tags; @@ -564,7 +564,7 @@ CppModule { inputs: { var tags = ["obj", "res", "linkerscript"]; if (product.bundle && product.bundle.embedInfoPlist - && product.qbs.targetOS.contains("darwin")) { + && product.qbs.targetOS.includes("darwin")) { tags.push("aggregate_infoplist"); } return tags; diff --git a/share/qbs/modules/cpp/LinuxGCC.qbs b/share/qbs/modules/cpp/LinuxGCC.qbs index 17346d048..4b594a0aa 100644 --- a/share/qbs/modules/cpp/LinuxGCC.qbs +++ b/share/qbs/modules/cpp/LinuxGCC.qbs @@ -32,8 +32,8 @@ import qbs.Host import qbs.Process UnixGCC { - condition: qbs.targetOS.contains('linux') && - qbs.toolchain && qbs.toolchain.contains('gcc') + condition: qbs.targetOS.includes('linux') && + qbs.toolchain && qbs.toolchain.includes('gcc') priority: 1 targetVendor: "pc" diff --git a/share/qbs/modules/cpp/MingwBaseModule.qbs b/share/qbs/modules/cpp/MingwBaseModule.qbs index e96f8ba41..c9cfe9bd8 100644 --- a/share/qbs/modules/cpp/MingwBaseModule.qbs +++ b/share/qbs/modules/cpp/MingwBaseModule.qbs @@ -47,7 +47,7 @@ GenericGCC { runtimeLibrary: "dynamic" Properties { - condition: product.multiplexByQbsProperties.contains("buildVariants") + condition: product.multiplexByQbsProperties.includes("buildVariants") && qbs.buildVariants && qbs.buildVariants.length > 1 && qbs.buildVariant !== "release" && product.type.containsAny(["staticlibrary", "dynamiclibrary"]) @@ -96,9 +96,9 @@ GenericGCC { var tf; try { tf = new TextFile(outputFilePath, TextFile.WriteOnly); - if (productType.contains("application")) + if (productType.includes("application")) tf.write("1 "); // CREATEPROCESS_MANIFEST_RESOURCE_ID - else if (productType.contains("dynamiclibrary")) + else if (productType.includes("dynamiclibrary")) tf.write("2 "); // ISOLATIONAWARE_MANIFEST_RESOURCE_ID tf.write("24 "); // RT_MANIFEST tf.writeLine(Utilities.cStringQuote(inputFilePath)); diff --git a/share/qbs/modules/cpp/UnixGCC.qbs b/share/qbs/modules/cpp/UnixGCC.qbs index 94dfb1907..6f377c5c8 100644 --- a/share/qbs/modules/cpp/UnixGCC.qbs +++ b/share/qbs/modules/cpp/UnixGCC.qbs @@ -31,8 +31,8 @@ import qbs.File GenericGCC { - condition: qbs.toolchain && qbs.toolchain.contains("gcc") - && qbs.targetOS.contains("unix") + condition: qbs.toolchain && qbs.toolchain.includes("gcc") + && qbs.targetOS.includes("unix") priority: -50 dynamicLibraryPrefix: "lib" diff --git a/share/qbs/modules/cpp/android-gcc.qbs b/share/qbs/modules/cpp/android-gcc.qbs index aded485cd..7c45d3c6b 100644 --- a/share/qbs/modules/cpp/android-gcc.qbs +++ b/share/qbs/modules/cpp/android-gcc.qbs @@ -39,7 +39,7 @@ import 'gcc.js' as Gcc LinuxGCC { Depends { name: "Android.ndk" } - condition: qbs.targetOS.contains("android") && qbs.toolchain && qbs.toolchain.contains("llvm") + condition: qbs.targetOS.includes("android") && qbs.toolchain && qbs.toolchain.includes("llvm") priority: 2 rpaths: [] @@ -58,7 +58,7 @@ LinuxGCC { return "i686"; } } - property string targetDir: "android" + (["armeabi", "armeabi-v7a"].contains(Android.ndk.abi) ? "eabi" : "") + 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); @@ -155,7 +155,7 @@ LinuxGCC { target: [targetArch, targetSystem, targetAbi].join("-") targetSystem: "linux" - targetAbi: "android" + (["armeabi", "armeabi-v7a"].contains(Android.ndk.abi) ? "eabi" : "") + + targetAbi: "android" + (["armeabi", "armeabi-v7a"].includes(Android.ndk.abi) ? "eabi" : "") + Android.ndk.platformVersion endianness: "little" diff --git a/share/qbs/modules/cpp/cosmic.qbs b/share/qbs/modules/cpp/cosmic.qbs index 46c904ac5..8bf0f22a3 100644 --- a/share/qbs/modules/cpp/cosmic.qbs +++ b/share/qbs/modules/cpp/cosmic.qbs @@ -37,7 +37,7 @@ import "cosmic.js" as COSMIC import "cpp.js" as Cpp CppModule { - condition: qbs.toolchain && qbs.toolchain.contains("cosmic") + condition: qbs.toolchain && qbs.toolchain.includes("cosmic") Probes.BinaryProbe { id: compilerPathProbe diff --git a/share/qbs/modules/cpp/cpp.js b/share/qbs/modules/cpp/cpp.js index b93d42f21..a13504013 100644 --- a/share/qbs/modules/cpp/cpp.js +++ b/share/qbs/modules/cpp/cpp.js @@ -42,7 +42,7 @@ function languageVersion(versionArray, knownValues, lang) { return versions[0]; for (var i = 0; i < knownValues.length; ++i) { var candidate = knownValues[i]; - if (versions.contains(candidate)) + if (versions.includes(candidate)) return candidate; } var version = versions[0]; @@ -134,7 +134,7 @@ function assemblerOutputArtifacts(input) { } function compilerOutputArtifacts(input, inputs) { - var objTags = input.fileTags.contains("cpp_intermediate_object") + var objTags = input.fileTags.includes("cpp_intermediate_object") ? ["intermediate_obj"] : ["obj"]; if (inputs) { @@ -233,7 +233,7 @@ function collectLibraryDependencies(product) { 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.contains("dynamiclibrary_import"); + && artifacts[0].fileTags.includes("dynamiclibrary_import"); for (var i = 0; i < artifactFilePaths.length; ++i) { addFilePath(artifactFilePaths[i], wholeArchive, artifactsAreImportLibs ? dep.name : undefined); @@ -254,7 +254,7 @@ function collectLibraryDependencies(product) { externalLibs.forEach(function(libName) { var isObjectFile = objSuffix && libName.endsWith(objSuffix); if (isObjectFile) { - if (seenObjectFiles.contains(libName)) + if (seenObjectFiles.includes(libName)) return; seenObjectFiles.push(libName); } diff --git a/share/qbs/modules/cpp/darwin.js b/share/qbs/modules/cpp/darwin.js index e4f740dbe..0223c5ed3 100644 --- a/share/qbs/modules/cpp/darwin.js +++ b/share/qbs/modules/cpp/darwin.js @@ -73,7 +73,7 @@ function lipoOutputArtifacts(product, inputs, fileTag, debugSuffix) { // approach for all bundle types. var defaultVariant; if (!buildVariants.some(function (x) { return x.name === "release"; }) - && product.multiplexByQbsProperties.contains("buildVariants") + && product.multiplexByQbsProperties.includes("buildVariants") && product.qbs.buildVariants && product.qbs.buildVariants.length > 1) { var defaultBuildVariant = product.qbs.defaultBuildVariant; buildVariants.map(function (variant) { @@ -137,7 +137,7 @@ function prepareLipo(project, product, inputs, outputs, input, output) { 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"].contains(tag) + return ["application", "dynamiclibrary", "staticlibrary", "loadablemodule"].includes(tag) ? inputs[tag] : []; })); diff --git a/share/qbs/modules/cpp/dmc.js b/share/qbs/modules/cpp/dmc.js index a398d6581..ea7cd7bb5 100644 --- a/share/qbs/modules/cpp/dmc.js +++ b/share/qbs/modules/cpp/dmc.js @@ -56,15 +56,15 @@ function targetFlags(platform, architecture, extender, consoleApp, type) { var flags = []; if (architecture === "x86_16") { flags.push("-ml"); - if (type.contains("application") && !consoleApp) + if (type.includes("application") && !consoleApp) flags.push("-WA"); - else if (type.contains("dynamiclibrary")) + else if (type.includes("dynamiclibrary")) flags.push("-WD"); } else if (architecture === "x86") { flags.push("-mn"); - if (type.contains("application")) + if (type.includes("application")) flags.push("-WA"); - else if (type.contains("dynamiclibrary")) + else if (type.includes("dynamiclibrary")) flags.push("-WD"); } return flags; @@ -350,12 +350,12 @@ function linkerFlags(project, product, inputs, outputs) { })); // Output. - if (product.type.contains("application")) { + 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.contains("dynamiclibrary")) { + } 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"); diff --git a/share/qbs/modules/cpp/dmc.qbs b/share/qbs/modules/cpp/dmc.qbs index db9e6b2fb..ac89550e8 100644 --- a/share/qbs/modules/cpp/dmc.qbs +++ b/share/qbs/modules/cpp/dmc.qbs @@ -38,7 +38,7 @@ import "dmc.js" as DMC import "cpp.js" as Cpp CppModule { - condition: Host.os().contains("windows") && qbs.toolchain && qbs.toolchain.contains("dmc") + condition: Host.os().includes("windows") && qbs.toolchain && qbs.toolchain.includes("dmc") Probes.BinaryProbe { id: compilerPathProbe diff --git a/share/qbs/modules/cpp/freebsd-gcc.qbs b/share/qbs/modules/cpp/freebsd-gcc.qbs index fb6d45b37..e04ed7f2b 100644 --- a/share/qbs/modules/cpp/freebsd-gcc.qbs +++ b/share/qbs/modules/cpp/freebsd-gcc.qbs @@ -32,11 +32,11 @@ import "freebsd.js" as FreeBSD import qbs.Host UnixGCC { - condition: qbs.targetOS.contains("freebsd") && - qbs.toolchain && qbs.toolchain.contains("gcc") + condition: qbs.targetOS.includes("freebsd") && + qbs.toolchain && qbs.toolchain.includes("gcc") priority: 1 - targetSystem: "freebsd" + (Host.os().contains("freebsd") ? FreeBSD.hostKernelRelease() : "") + targetSystem: "freebsd" + (Host.os().includes("freebsd") ? FreeBSD.hostKernelRelease() : "") distributionIncludePaths: ["/usr/local/include"] distributionLibraryPaths: ["/usr/local/lib"] diff --git a/share/qbs/modules/cpp/gcc.js b/share/qbs/modules/cpp/gcc.js index 25fe06861..747c6c9ee 100644 --- a/share/qbs/modules/cpp/gcc.js +++ b/share/qbs/modules/cpp/gcc.js @@ -230,7 +230,7 @@ function escapeLinkerFlags(product, inputs, linkerFlags) { if (useCompilerDriverLinker(product, inputs)) { var sep = ","; - var useXlinker = linkerFlags.some(function (f) { return f.contains(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 @@ -247,7 +247,7 @@ function escapeLinkerFlags(product, inputs, linkerFlags) { return xlinkerFlags; } - if (product.cpp.enableSuspiciousLinkerFlagWarnings && linkerFlags.contains("-Xlinker")) { + 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."); @@ -262,7 +262,7 @@ function escapeLinkerFlags(product, inputs, linkerFlags) { } function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPath) { - var isDarwin = product.qbs.targetOS.contains("darwin"); + var isDarwin = product.qbs.targetOS.includes("darwin"); var libraryDependencies = collectLibraryDependencies(product, isDarwin); var frameworks = product.cpp.frameworks; var weakFrameworks = product.cpp.weakFrameworks; @@ -275,7 +275,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat var escapableLinkerFlags = []; - if (primaryOutput.fileTags.contains("dynamiclibrary")) { + if (primaryOutput.fileTags.includes("dynamiclibrary")) { if (isDarwin) { args.push((function () { var tags = ["c", "cpp", "objc", "objcpp", "asm_cpp"]; @@ -300,7 +300,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat } } - if (primaryOutput.fileTags.contains("loadablemodule")) + if (primaryOutput.fileTags.includes("loadablemodule")) args.push(isDarwin ? "-bundle" : "-shared"); if (primaryOutput.fileTags.containsAny(["dynamiclibrary", "loadablemodule"])) { @@ -323,7 +323,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat var sysroot = product.cpp.syslibroot; if (sysroot) { - if (product.qbs.toolchain.contains("qcc")) + if (product.qbs.toolchain.includes("qcc")) escapableLinkerFlags.push("--sysroot=" + sysroot); else if (isDarwin) escapableLinkerFlags.push("-syslibroot", sysroot); @@ -340,7 +340,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat function fixupRPath(rpath) { // iOS, tvOS, watchOS, and others, are fine - if (!product.qbs.targetOS.contains("macos")) + if (!product.qbs.targetOS.includes("macos")) return rpath; // ...as are newer versions of macOS @@ -356,11 +356,11 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat } function isNotSystemRunPath(p) { - return !FileInfo.isAbsolutePath(p) || (!systemRunPaths.contains(p) - && !canonicalSystemRunPaths.contains(File.canonicalFilePath(p))); + return !FileInfo.isAbsolutePath(p) || (!systemRunPaths.includes(p) + && !canonicalSystemRunPaths.includes(File.canonicalFilePath(p))); }; - if (!product.qbs.targetOS.contains("windows")) { + if (!product.qbs.targetOS.includes("windows")) { for (i in rpaths) { if (isNotSystemRunPath(rpaths[i])) escapableLinkerFlags.push("-rpath", fixupRPath(rpaths[i])); @@ -370,7 +370,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat if (product.cpp.entryPoint) escapableLinkerFlags.push("-e", product.cpp.entryPoint); - if (product.qbs.toolchain.contains("mingw")) { + if (product.qbs.toolchain.includes("mingw")) { if (product.consoleApplication !== undefined) escapableLinkerFlags.push("-subsystem", product.consoleApplication ? "console" : "windows"); @@ -398,7 +398,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat var stdlib = isLinkingCppObjects ? product.cpp.cxxStandardLibrary : undefined; - if (stdlib && product.qbs.toolchain.contains("clang")) + if (stdlib && product.qbs.toolchain.includes("clang")) args.push("-stdlib=" + stdlib); // Flags for library search paths @@ -472,7 +472,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat var symbolLinkMode = dep.symbolLinkMode; if (isDarwin && symbolLinkMode) { - if (!["lazy", "reexport", "upward", "weak"].contains(symbolLinkMode)) + if (!["lazy", "reexport", "upward", "weak"].includes(symbolLinkMode)) throw new Error("unknown value '" + symbolLinkMode + "' for cpp.symbolLinkMode"); if (FileInfo.isAbsolutePath(lib) || lib.startsWith('@')) @@ -530,7 +530,7 @@ function linkerFlags(project, product, inputs, outputs, primaryOutput, linkerPat Array.prototype.push.apply(escapedLinkerFlags, args); if (useCompilerDriver) escapedLinkerFlags = escapedLinkerFlags.concat(Cpp.collectMiscLinkerArguments(product)); - if (product.qbs.toolchain.contains("mingw") && product.cpp.runtimeLibrary === "static") + if (product.qbs.toolchain.includes("mingw") && product.cpp.runtimeLibrary === "static") escapedLinkerFlags = ['-static-libgcc', '-static-libstdc++'].concat(escapedLinkerFlags); return escapedLinkerFlags; } @@ -577,7 +577,7 @@ function languageTagFromFileExtension(toolchain, fileName) { "s" : "asm", "S" : "asm_cpp" }; - if (!toolchain.contains("clang")) + if (!toolchain.includes("clang")) m["sx"] = "asm_cpp"; // clang does NOT recognize .sx return m[fileName.substring(i + 1)]; } @@ -585,7 +585,7 @@ function languageTagFromFileExtension(toolchain, fileName) { // 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.contains("qcc") && config.qnx && !config.qnx.qnx7; + return config.qbs.toolchain.includes("qcc") && config.qnx && !config.qnx.qnx7; } function effectiveCompilerInfo(toolchain, input, output) { @@ -593,7 +593,7 @@ function effectiveCompilerInfo(toolchain, input, output) { var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags)); // Whether we're compiling a precompiled header or normal source file - var pchOutput = output.fileTags.contains(tag + "_pch"); + var pchOutput = output.fileTags.includes(tag + "_pch"); var compilerPathByLanguage = input.cpp.compilerPathByLanguage; if (compilerPathByLanguage) @@ -601,7 +601,7 @@ function effectiveCompilerInfo(toolchain, input, output) { if (!compilerPath || tag !== languageTagFromFileExtension(toolchain, input.fileName) || isLegacyQnxSdk(input)) { - if (input.qbs.toolchain.contains("qcc")) + if (input.qbs.toolchain.includes("qcc")) language = qnxLangArgs(input, tag); else language = ["-x", languageName(tag) + (pchOutput ? '-header' : '')]; @@ -749,7 +749,7 @@ function standardFallbackValueOrDefault(toolchain, compilerVersion, languageVers if (m) { for (var idx = 0; idx < m.toolchains.length; ++idx) { var tc = m.toolchains[idx]; - if (toolchain.contains(tc.name)) { + 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. @@ -771,7 +771,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { // Determine which C-language we're compiling var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(output.fileTags)); - if (!["c", "cpp", "objc", "objcpp", "asm_cpp"].contains(tag)) + if (!["c", "cpp", "objc", "objcpp", "asm_cpp"].includes(tag)) throw ("unsupported source language: " + tag); var compilerInfo = effectiveCompilerInfo(product.qbs.toolchain, @@ -804,12 +804,12 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { args = args.concat(configFlags(input)); - if (!input.qbs.toolchain.contains("qcc")) + if (!input.qbs.toolchain.includes("qcc")) args.push('-pipe'); if (input.cpp.enableReproducibleBuilds) { var toolchain = product.qbs.toolchain; - if (!toolchain.contains("clang")) { + 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)); @@ -817,8 +817,8 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { var major = product.cpp.compilerVersionMajor; var minor = product.cpp.compilerVersionMinor; - if ((toolchain.contains("clang") && (major > 3 || (major === 3 && minor >= 5))) || - (toolchain.contains("gcc") && (major > 4 || (major === 4 && minor >= 9)))) { + if ((toolchain.includes("clang") && (major > 3 || (major === 3 && minor >= 5))) || + (toolchain.includes("gcc") && (major > 4 || (major === 4 && minor >= 9)))) { args.push("-Wdate-time"); } } @@ -846,7 +846,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { } var visibility = input.cpp.visibility; - if (!product.qbs.toolchain.contains("mingw")) { + if (!product.qbs.toolchain.includes("mingw")) { if (visibility === 'hidden' || visibility === 'minimal') args.push('-fvisibility=hidden'); if ((visibility === 'hiddenInlines' || visibility === 'minimal') && tag === 'cpp') @@ -862,7 +862,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { args = args.concat(Cpp.collectMiscCompilerArguments(input, tag)); var pchTag = compilerInfo.tag + "_pch"; - var pchOutput = output.fileTags.contains(pchTag); + var pchOutput = output.fileTags.includes(pchTag); var pchInputs = explicitlyDependsOn[pchTag]; if (!pchOutput && pchInputs && pchInputs.length === 1 && ModUtils.moduleProperty(input, 'usePrecompiledHeader', tag)) { @@ -875,7 +875,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { args = args.concat(Cpp.collectPreincludePathsArguments(input)); var positionIndependentCode = input.cpp.positionIndependentCode; - if (positionIndependentCode && !product.qbs.targetOS.contains("windows")) + if (positionIndependentCode && !product.qbs.targetOS.includes("windows")) args.push('-fPIC'); var cppFlags = input.cpp.cppFlags; @@ -887,7 +887,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { args = args.concat(Cpp.collectSystemIncludePathsArguments(input)); var minimumWindowsVersion = input.cpp.minimumWindowsVersion; - if (minimumWindowsVersion && product.qbs.targetOS.contains("windows")) { + if (minimumWindowsVersion && product.qbs.targetOS.includes("windows")) { var hexVersion = WindowsUtils.getWindowsVersionInFormat(minimumWindowsVersion, 'hex'); if (hexVersion) { var versionDefs = [ 'WINVER', '_WIN32_WINNT', '_WIN32_WINDOWS' ]; @@ -921,7 +921,7 @@ function compilerFlags(project, product, input, output, explicitlyDependsOn) { if (tag === "cpp" || tag === "objcpp") { var cxxStandardLibrary = product.cpp.cxxStandardLibrary; - if (cxxStandardLibrary && product.qbs.toolchain.contains("clang")) { + if (cxxStandardLibrary && product.qbs.toolchain.includes("clang")) { args.push("-stdlib=" + cxxStandardLibrary); } } @@ -936,7 +936,7 @@ function additionalCompilerAndLinkerFlags(product) { var args = [] var requireAppExtensionSafeApi = product.cpp.requireAppExtensionSafeApi; - if (requireAppExtensionSafeApi !== undefined && product.qbs.targetOS.contains("darwin")) { + if (requireAppExtensionSafeApi !== undefined && product.qbs.targetOS.includes("darwin")) { args.push(requireAppExtensionSafeApi ? "-fapplication-extension" : "-fno-application-extension"); } @@ -987,7 +987,7 @@ function prepareAssembler(project, product, inputs, outputs, input, output) { function compilerEnvVars(config, compilerInfo) { - if (config.qbs.toolchain.contains("qcc")) + if (config.qbs.toolchain.includes("qcc")) return ["QCC_CONF_PATH"]; var list = ["CPATH", "TMPDIR"]; @@ -999,15 +999,15 @@ function compilerEnvVars(config, compilerInfo) list.push("OBJC_INCLUDE_PATH"); else if (compilerInfo.tag === "objccpp") list.push("OBJCPLUS_INCLUDE_PATH"); - if (config.qbs.targetOS.contains("macos")) + if (config.qbs.targetOS.includes("macos")) list.push("MACOSX_DEPLOYMENT_TARGET"); - else if (config.qbs.targetOS.contains("ios")) + else if (config.qbs.targetOS.includes("ios")) list.push("IPHONEOS_DEPLOYMENT_TARGET"); - else if (config.qbs.targetOS.contains("tvos")) + else if (config.qbs.targetOS.includes("tvos")) list.push("TVOS_DEPLOYMENT_TARGET"); - else if (config.qbs.targetOS.contains("watchos")) + else if (config.qbs.targetOS.includes("watchos")) list.push("WATCHOS_DEPLOYMENT_TARGET"); - if (config.qbs.toolchain.contains("clang")) { + if (config.qbs.toolchain.includes("clang")) { list.push("TEMP", "TMP"); } else { list.push("LANG", "LC_CTYPE", "LC_MESSAGES", "LC_ALL", "GCC_COMPARE_DEBUG", @@ -1018,7 +1018,7 @@ function compilerEnvVars(config, compilerInfo) function linkerEnvVars(config, inputs) { - if (config.qbs.toolchain.contains("clang") || config.qbs.toolchain.contains("qcc")) + if (config.qbs.toolchain.includes("clang") || config.qbs.toolchain.includes("qcc")) return []; var list = ["GNUTARGET", "LDEMULATION", "COLLECT_NO_DEMANGLE"]; if (useCompilerDriverLinker(config, inputs)) @@ -1028,7 +1028,7 @@ function linkerEnvVars(config, inputs) function setResponseFileThreshold(command, product) { - if (product.qbs.targetOS.contains("windows") && Host.os().contains("windows")) + if (product.qbs.targetOS.includes("windows") && Host.os().includes("windows")) command.responseFileThreshold = 10000; } @@ -1036,7 +1036,7 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli var compilerInfo = effectiveCompilerInfo(product.qbs.toolchain, input, output); var compilerPath = compilerInfo.path; - var pchOutput = output.fileTags.contains(compilerInfo.tag + "_pch"); + var pchOutput = output.fileTags.includes(compilerInfo.tag + "_pch"); var args = compilerFlags(project, product, input, output, explicitlyDependsOn); var wrapperArgsLength = 0; @@ -1126,7 +1126,7 @@ function getSymbolInfo(product, inputFile) // 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.contains(line); }); + return !undefinedGlobalSymbols.includes(line); }); result.success = true; } catch (e) { console.debug("Failed to collect symbols for shared library: nm command '" @@ -1338,7 +1338,7 @@ function prepareLinker(project, product, inputs, outputs, input, output) { var responseFileArgumentIndex = wrapperArgsLength; // qcc doesn't properly handle response files, so we have to do it manually - var useQnxResponseFileHack = product.qbs.toolchain.contains("qcc") + 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, @@ -1358,7 +1358,7 @@ function prepareLinker(project, product, inputs, outputs, input, output) { setResponseFileThreshold(cmd, product); commands.push(cmd); - if (product.qbs.targetOS.contains("darwin")) { + if (product.qbs.targetOS.includes("darwin")) { if (!product.aggregate) { commands = commands.concat(separateDebugInfoCommandsDarwin( product, outputs, [primaryOutput])); @@ -1492,7 +1492,7 @@ function dumpDefaultPaths(env, compilerFilePath, args, nullDevice, pathListSepar if (libraryPaths.length === 0) libraryPaths.push(sysroot + "/lib", sysroot + "/usr/lib"); - if (frameworkPaths.length === 0 && targetOS.contains("darwin")) + if (frameworkPaths.length === 0 && targetOS.includes("darwin")) frameworkPaths.push(sysroot + "/System/Library/Frameworks"); return { @@ -1520,9 +1520,9 @@ function targetLinkerFlags(targetArch, targetOS) { "x86_64": "elf_x86_64", } }; - if (targetOS.contains("windows")) + if (targetOS.includes("windows")) return linkerFlags["windows"][targetArch]; - else if (targetOS.contains("freebsd")) + else if (targetOS.includes("freebsd")) return linkerFlags["freebsd"][targetArch]; return linkerFlags["other"][targetArch]; } diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs index f02c033ce..558635ef5 100644 --- a/share/qbs/modules/cpp/iar.qbs +++ b/share/qbs/modules/cpp/iar.qbs @@ -37,7 +37,7 @@ import "cpp.js" as Cpp import "iar.js" as IAR CppModule { - condition: qbs.toolchain && qbs.toolchain.contains("iar") + condition: qbs.toolchain && qbs.toolchain.includes("iar") Probes.BinaryProbe { id: compilerPathProbe diff --git a/share/qbs/modules/cpp/ios-gcc.qbs b/share/qbs/modules/cpp/ios-gcc.qbs index 92e072a0a..968b873da 100644 --- a/share/qbs/modules/cpp/ios-gcc.qbs +++ b/share/qbs/modules/cpp/ios-gcc.qbs @@ -37,8 +37,8 @@ import qbs.Utilities DarwinGCC { priority: 1 - condition: qbs.targetOS.contains('ios') && - qbs.toolchain && qbs.toolchain.contains('gcc') + condition: qbs.targetOS.includes('ios') && + qbs.toolchain && qbs.toolchain.includes('gcc') minimumIosVersion: { if (Host.architecture() == "armv7a") @@ -51,10 +51,10 @@ DarwinGCC { targetSystem: "ios" + (minimumIosVersion || "") minimumDarwinVersion: minimumIosVersion - minimumDarwinVersionCompilerFlag: qbs.targetOS.contains("ios-simulator") + minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("ios-simulator") ? "-mios-simulator-version-min" : "-miphoneos-version-min" - minimumDarwinVersionLinkerFlag: qbs.targetOS.contains("ios-simulator") + minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("ios-simulator") ? "-ios_simulator_version_min" : "-iphoneos_version_min" @@ -69,13 +69,13 @@ DarwinGCC { 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.contains("ios-simulator") + return qbs.targetOS.includes("ios-simulator") ? ["-fobjc-abi-version=2", "-fobjc-legacy-dispatch"] : []; } Rule { - condition: !product.qbs.targetOS.contains("ios-simulator") + condition: !product.qbs.targetOS.includes("ios-simulator") inputsFromDependencies: ["bundle.content"] Artifact { diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs index edee1697b..5922ad4e2 100644 --- a/share/qbs/modules/cpp/keil.qbs +++ b/share/qbs/modules/cpp/keil.qbs @@ -36,7 +36,7 @@ import "cpp.js" as Cpp import "keil.js" as KEIL CppModule { - condition: Host.os().contains("windows") && qbs.toolchain && qbs.toolchain.contains("keil") + condition: Host.os().includes("windows") && qbs.toolchain && qbs.toolchain.includes("keil") Probes.BinaryProbe { id: compilerPathProbe diff --git a/share/qbs/modules/cpp/macos-gcc.qbs b/share/qbs/modules/cpp/macos-gcc.qbs index 612b46ae8..c667bbc29 100644 --- a/share/qbs/modules/cpp/macos-gcc.qbs +++ b/share/qbs/modules/cpp/macos-gcc.qbs @@ -33,8 +33,8 @@ import qbs.Utilities DarwinGCC { priority: 1 - condition: qbs.targetOS.contains('macos') && - qbs.toolchain && qbs.toolchain.contains('gcc') + condition: qbs.targetOS.includes('macos') && + qbs.toolchain && qbs.toolchain.includes('gcc') targetSystem: "macosx" + (minimumMacosVersion || "") diff --git a/share/qbs/modules/cpp/msvc.js b/share/qbs/modules/cpp/msvc.js index 748095aff..8be4bff24 100644 --- a/share/qbs/modules/cpp/msvc.js +++ b/share/qbs/modules/cpp/msvc.js @@ -80,7 +80,7 @@ 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 Utilities.versionCompare(input.cpp.compilerVersion, "19.12.25831") >= 0 - || (input.qbs.toolchain.contains("clang-cl") && input.cpp.compilerVersionMajor >= 7); + || (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 7); } function hasZCplusPlusOption(input) @@ -93,23 +93,23 @@ function hasZCplusPlusOption(input) // ignores this option, so this doesn't really matter // https://reviews.llvm.org/D45877 return Utilities.versionCompare(input.cpp.compilerVersion, "19.14.26433") >= 0 - || (input.qbs.toolchain.contains("clang-cl") && input.cpp.compilerVersionMajor >= 9); + || (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 9); } function hasCxx20Option(input) { return Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30133.0") >= 0 - || (input.qbs.toolchain.contains("clang-cl") && input.cpp.compilerVersionMajor >= 13); + || (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 13); } function hasCVerOption(input) { return Utilities.versionCompare(input.cpp.compilerVersion, "19.29.30138.0") >= 0 - || (input.qbs.toolchain.contains("clang-cl") && input.cpp.compilerVersionMajor >= 13); + || (input.qbs.toolchain.includes("clang-cl") && input.cpp.compilerVersionMajor >= 13); } function supportsExternalIncludesOption(input) { - if (input.qbs.toolchain.contains("clang-cl")) + 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: @@ -127,7 +127,7 @@ function addCxxLanguageVersionFlag(input, args) { // Visual C++ 2013, Update 3 var hasStdOption = Utilities.versionCompare(input.cpp.compilerVersion, "18.00.30723") >= 0 // or clang-cl - || input.qbs.toolchain.contains("clang-cl"); + || input.qbs.toolchain.includes("clang-cl"); if (!hasStdOption) return; @@ -164,7 +164,7 @@ function addCLanguageVersionFlag(input, args) { } function handleClangClArchitectureFlags(product, architecture, flags) { - if (product.qbs.toolchain.contains("clang-cl")) { + if (product.qbs.toolchain.includes("clang-cl")) { if (architecture === "x86") flags.push("-m32"); else if (architecture === "x86_64") @@ -181,7 +181,7 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli // Determine which C-language we're compiling var tag = ModUtils.fileTagForTargetLanguage(input.fileTags.concat(Object.keys(outputs))); - if (!["c", "cpp"].contains(tag)) + if (!["c", "cpp"].includes(tag)) throw ("unsupported source language"); var enableExceptions = input.cpp.enableExceptions; @@ -313,7 +313,7 @@ function prepareCompiler(project, product, inputs, outputs, input, output, expli var pchInputs = explicitlyDependsOn[tag + "_pch"]; if (pchOutput) { // create PCH - if (input.qbs.toolchain.contains("clang-cl")) { + 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 @@ -396,7 +396,7 @@ function prepareLinker(project, product, inputs, outputs, input, output) { return a.filePath; }); var generateManifestFiles = !linkDLL && product.cpp.generateManifestFile; - var useClangCl = product.qbs.toolchain.contains("clang-cl"); + var useClangCl = product.qbs.toolchain.includes("clang-cl"); var canEmbedManifest = useClangCl || product.cpp.compilerVersionMajor >= 17 // VS 2012 var linkerPath = effectiveLinkerPath(product, inputs); diff --git a/share/qbs/modules/cpp/qnx-qcc.qbs b/share/qbs/modules/cpp/qnx-qcc.qbs index a39a6a998..69288ddd8 100644 --- a/share/qbs/modules/cpp/qnx-qcc.qbs +++ b/share/qbs/modules/cpp/qnx-qcc.qbs @@ -33,8 +33,8 @@ import qbs.FileInfo UnixGCC { Depends { name: "qnx" } - condition: qbs.targetOS.contains("qnx") && - qbs.toolchain && qbs.toolchain.contains("qcc") + condition: qbs.targetOS.includes("qnx") && + qbs.toolchain && qbs.toolchain.includes("qcc") priority: 1 distributionIncludePaths: FileInfo.joinPaths(qnx.targetDir, "usr", "include") @@ -79,7 +79,7 @@ UnixGCC { toolchainPrefix: target + "-" - targetVendor: ["x86", "x86_64"].contains(qbs.architecture) ? "pc" : base + targetVendor: ["x86", "x86_64"].includes(qbs.architecture) ? "pc" : base targetSystem: "nto" targetAbi: "qnx" + qnx.version + (qnxTargetArchName === "armv7le" ? "eabi" : "") diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js index 9861da296..49da8a715 100644 --- a/share/qbs/modules/cpp/sdcc.js +++ b/share/qbs/modules/cpp/sdcc.js @@ -396,7 +396,7 @@ function buildLinkerMapFilePath(target, suffix) { // 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().contains("windows"); + var isWindows = Host.os().includes("windows"); if (isWindows && input.cpp.debugInformation) { var cmd = new JavaScriptCommand(); cmd.objectPath = outputs.obj[0].filePath; diff --git a/share/qbs/modules/cpp/sdcc.qbs b/share/qbs/modules/cpp/sdcc.qbs index 4e6f05bc0..24cb6d738 100644 --- a/share/qbs/modules/cpp/sdcc.qbs +++ b/share/qbs/modules/cpp/sdcc.qbs @@ -35,7 +35,7 @@ import "cpp.js" as Cpp import "sdcc.js" as SDCC CppModule { - condition: qbs.toolchain && qbs.toolchain.contains("sdcc") + condition: qbs.toolchain && qbs.toolchain.includes("sdcc") Probes.BinaryProbe { id: compilerPathProbe diff --git a/share/qbs/modules/cpp/setuprunenv.js b/share/qbs/modules/cpp/setuprunenv.js index df034e72a..2ea331a30 100644 --- a/share/qbs/modules/cpp/setuprunenv.js +++ b/share/qbs/modules/cpp/setuprunenv.js @@ -35,7 +35,7 @@ var ModUtils = require("qbs.ModUtils"); // TODO: append/prepend functionality sh function addNewElement(list, elem) { - if (!list.contains(elem)) + if (!list.includes(elem)) list.push(elem); } @@ -49,7 +49,7 @@ function artifactDir(artifact) function addExternalLibPath(product, list, path) { addNewElement(list, path); - if (Host.os().contains("windows") && FileInfo.fileName(path) === "lib") { + if (Host.os().includes("windows") && FileInfo.fileName(path) === "lib") { var binPath = FileInfo.joinPaths(FileInfo.path(path), "bin"); if (File.exists(binPath)) addNewElement(list, binPath); @@ -58,7 +58,7 @@ function addExternalLibPath(product, list, path) function gatherPaths(product, libPaths, frameworkPaths, seenProducts) { - if (seenProducts.contains(product.name)) + if (seenProducts.includes(product.name)) return; seenProducts.push(product.name); @@ -106,7 +106,7 @@ function gatherPaths(product, libPaths, frameworkPaths, seenProducts) function setupRunEnvironment(product, config) { - if (config.contains("ignore-lib-dependencies")) + if (config.includes("ignore-lib-dependencies")) return; if (Host.platform() !== product.qbs.targetPlatform) @@ -120,8 +120,8 @@ function setupRunEnvironment(product, config) if (runPaths && runPaths.length > 0) { var canonicalRunPaths = runPaths.map(function(p) { return File.canonicalFilePath(p); }); var filterFunc = function(libPath) { - return !runPaths.contains(libPath) - && !canonicalRunPaths.contains(File.canonicalFilePath(libPath)); + return !runPaths.includes(libPath) + && !canonicalRunPaths.includes(File.canonicalFilePath(libPath)); }; libPaths = libPaths.filter(filterFunc); frameworkPaths = frameworkPaths.filter(filterFunc); @@ -129,19 +129,19 @@ function setupRunEnvironment(product, config) if (libPaths.length > 0) { var envVarName; - if (product.qbs.targetOS.contains("windows")) + if (product.qbs.targetOS.includes("windows")) envVarName = "PATH"; - else if (product.qbs.targetOS.contains("macos")) + 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().contains("windows")); + Host.os().includes("windows")); libPaths.forEach(function(p) { envVar.prepend(p); }); envVar.set(); } - if (product.qbs.targetOS.contains("macos") && frameworkPaths.length > 0) { + 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(); diff --git a/share/qbs/modules/cpp/tvos-gcc.qbs b/share/qbs/modules/cpp/tvos-gcc.qbs index 19bc9b787..eba3b091e 100644 --- a/share/qbs/modules/cpp/tvos-gcc.qbs +++ b/share/qbs/modules/cpp/tvos-gcc.qbs @@ -30,16 +30,16 @@ DarwinGCC { priority: 1 - condition: qbs.targetOS.contains('tvos') && - qbs.toolchain && qbs.toolchain.contains('gcc') + condition: qbs.targetOS.includes('tvos') && + qbs.toolchain && qbs.toolchain.includes('gcc') targetSystem: "tvos" + (minimumTvosVersion || "") minimumDarwinVersion: minimumTvosVersion - minimumDarwinVersionCompilerFlag: qbs.targetOS.contains("tvos-simulator") + minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("tvos-simulator") ? "-mtvos-simulator-version-min" : "-mtvos-version-min" - minimumDarwinVersionLinkerFlag: qbs.targetOS.contains("tvos-simulator") + minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("tvos-simulator") ? "-tvos_simulator_version_min" : "-tvos_version_min" } diff --git a/share/qbs/modules/cpp/watchos-gcc.qbs b/share/qbs/modules/cpp/watchos-gcc.qbs index 46e4bf874..3a160f6d0 100644 --- a/share/qbs/modules/cpp/watchos-gcc.qbs +++ b/share/qbs/modules/cpp/watchos-gcc.qbs @@ -31,16 +31,16 @@ DarwinGCC { priority: 1 - condition: qbs.targetOS.contains('watchos') && - qbs.toolchain && qbs.toolchain.contains('gcc') + condition: qbs.targetOS.includes('watchos') && + qbs.toolchain && qbs.toolchain.includes('gcc') targetSystem: "watchos" + (minimumWatchosVersion || "") minimumDarwinVersion: minimumWatchosVersion - minimumDarwinVersionCompilerFlag: qbs.targetOS.contains("watchos-simulator") + minimumDarwinVersionCompilerFlag: qbs.targetOS.includes("watchos-simulator") ? "-mwatchos-simulator-version-min" : "-mwatchos-version-min" - minimumDarwinVersionLinkerFlag: qbs.targetOS.contains("watchos-simulator") + minimumDarwinVersionLinkerFlag: qbs.targetOS.includes("watchos-simulator") ? "-watchos_simulator_version_min" : "-watchos_version_min" } diff --git a/share/qbs/modules/cpp/watcom.js b/share/qbs/modules/cpp/watcom.js index 005780c7d..9ae893db9 100644 --- a/share/qbs/modules/cpp/watcom.js +++ b/share/qbs/modules/cpp/watcom.js @@ -81,11 +81,11 @@ function targetFlag(platform, architecture, type) { return "-bos2v2"; } else if (platform === "windows") { if (architecture === "x86_16") { - if (type.contains("dynamiclibrary")) + if (type.includes("dynamiclibrary")) return "-bwindows_dll"; return "-bwindows"; } else if (architecture === "x86") { - if (type.contains("dynamiclibrary")) + if (type.includes("dynamiclibrary")) return "-bnt_dll"; return "-bnt"; } @@ -130,9 +130,9 @@ function guessEnvironment(hostOs, platform, architecture, setVariable("WATCOM", [toolchainRootPath], undefined, pathListSeparator); setVariable("EDPATH", ["eddat"], toolchainRootPath, pathListSeparator); - if (hostOs.contains("linux")) + if (hostOs.includes("linux")) setVariable("PATH", ["binl64", "binl"], toolchainRootPath, pathListSeparator); - else if (hostOs.contains("windows")) + else if (hostOs.includes("windows")) setVariable("PATH", ["binnt64", "binnt"], toolchainRootPath, pathListSeparator); if (platform === "linux") { @@ -311,12 +311,12 @@ function compilerFlags(project, product, input, outputs, explicitlyDependsOn) { product.type); args.push(target); - if (product.type.contains("application")) { + if (product.type.includes("application")) { if (product.qbs.targetPlatform === "windows") { var consoleApplication = product.consoleApplication; args.push(consoleApplication ? "-mconsole" : "-mwindows"); } - } else if (product.type.contains("dynamiclibrary")) { + } else if (product.type.includes("dynamiclibrary")) { args.push("-shared"); } @@ -423,11 +423,11 @@ function linkerFlags(project, product, inputs, outputs) { product.type); args.push(target); - if (product.type.contains("application")) { + 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.contains("dynamiclibrary")) { + } else if (product.type.includes("dynamiclibrary")) { if (product.qbs.targetPlatform === "windows") { args.push("-Wl, option implib=" + FileInfo.toNativeSeparators( outputs.dynamiclibrary_import[0].filePath)); diff --git a/share/qbs/modules/cpp/watcom.qbs b/share/qbs/modules/cpp/watcom.qbs index eed63692c..84157b67b 100644 --- a/share/qbs/modules/cpp/watcom.qbs +++ b/share/qbs/modules/cpp/watcom.qbs @@ -37,7 +37,7 @@ import "cpp.js" as Cpp import "watcom.js" as WATCOM CppModule { - condition: qbs.toolchain && qbs.toolchain.contains("watcom") + condition: qbs.toolchain && qbs.toolchain.includes("watcom") Probes.BinaryProbe { id: compilerPathProbe @@ -170,7 +170,7 @@ CppModule { Rule { id: dynamicLibraryLinker - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") multiplex: true inputs: ["obj", "res"] inputsFromDependencies: ["staticlibrary", "dynamiclibrary_import"] diff --git a/share/qbs/modules/cpp/windows-clang-cl.qbs b/share/qbs/modules/cpp/windows-clang-cl.qbs index bc69faf06..32abb572a 100644 --- a/share/qbs/modules/cpp/windows-clang-cl.qbs +++ b/share/qbs/modules/cpp/windows-clang-cl.qbs @@ -35,9 +35,9 @@ import qbs.FileInfo import 'windows-msvc-base.qbs' as MsvcBaseModule MsvcBaseModule { - condition: Host.os().contains('windows') && - qbs.targetOS.contains('windows') && - qbs.toolchain && qbs.toolchain.contains('clang-cl') + condition: Host.os().includes('windows') && + qbs.targetOS.includes('windows') && + qbs.toolchain && qbs.toolchain.includes('clang-cl') priority: 100 Probes.ClangClBinaryProbe { diff --git a/share/qbs/modules/cpp/windows-clang-mingw.qbs b/share/qbs/modules/cpp/windows-clang-mingw.qbs index b5bac0572..cfe6f2745 100644 --- a/share/qbs/modules/cpp/windows-clang-mingw.qbs +++ b/share/qbs/modules/cpp/windows-clang-mingw.qbs @@ -38,8 +38,8 @@ import "msvc.js" as MSVC import "setuprunenv.js" as SetupRunEnv MingwBaseModule { - condition: qbs.targetOS.contains("windows") && - qbs.toolchain && qbs.toolchain.contains("clang") + 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 @@ -69,7 +69,7 @@ MingwBaseModule { "llvm-rc" + compilerExtension) setupBuildEnvironment: { - if (Host.os().contains("windows") && product.qbs.sysroot) { + 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(); @@ -77,7 +77,7 @@ MingwBaseModule { } setupRunEnvironment: { - if (Host.os().contains("windows") && product.qbs.sysroot) { + 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(); diff --git a/share/qbs/modules/cpp/windows-mingw.qbs b/share/qbs/modules/cpp/windows-mingw.qbs index 4c20eda5f..9ba4258c5 100644 --- a/share/qbs/modules/cpp/windows-mingw.qbs +++ b/share/qbs/modules/cpp/windows-mingw.qbs @@ -37,8 +37,8 @@ import 'cpp.js' as Cpp import "setuprunenv.js" as SetupRunEnv MingwBaseModule { - condition: qbs.targetOS.contains("windows") && - qbs.toolchain && qbs.toolchain.contains("mingw") + condition: qbs.targetOS.includes("windows") && + qbs.toolchain && qbs.toolchain.includes("mingw") priority: 0 probeEnv: buildEnv diff --git a/share/qbs/modules/cpp/windows-msvc-base.qbs b/share/qbs/modules/cpp/windows-msvc-base.qbs index d188d53f3..1a2c338db 100644 --- a/share/qbs/modules/cpp/windows-msvc-base.qbs +++ b/share/qbs/modules/cpp/windows-msvc-base.qbs @@ -95,7 +95,7 @@ CppModule { precompiledHeaderSuffix: ".pch" imageFormat: "pe" Properties { - condition: product.multiplexByQbsProperties.contains("buildVariants") + condition: product.multiplexByQbsProperties.includes("buildVariants") && qbs.buildVariants && qbs.buildVariants.length > 1 && qbs.buildVariant !== "release" && product.type.containsAny(["staticlibrary", "dynamiclibrary"]) diff --git a/share/qbs/modules/cpp/windows-msvc.qbs b/share/qbs/modules/cpp/windows-msvc.qbs index a57c4cc5a..c30cec239 100644 --- a/share/qbs/modules/cpp/windows-msvc.qbs +++ b/share/qbs/modules/cpp/windows-msvc.qbs @@ -34,9 +34,9 @@ import qbs.Probes import "windows-msvc-base.qbs" as MsvcBaseModule MsvcBaseModule { - condition: Host.os().contains('windows') && - qbs.targetOS.contains('windows') && - qbs.toolchain && qbs.toolchain.contains('msvc') + condition: Host.os().includes('windows') && + qbs.targetOS.includes('windows') && + qbs.toolchain && qbs.toolchain.includes('msvc') priority: 50 Probes.ClBinaryProbe { diff --git a/share/qbs/modules/dmg/DMGModule.qbs b/share/qbs/modules/dmg/DMGModule.qbs index f069cb5dc..59161b1db 100644 --- a/share/qbs/modules/dmg/DMGModule.qbs +++ b/share/qbs/modules/dmg/DMGModule.qbs @@ -40,7 +40,7 @@ import "dmg.js" as Dmg Module { Depends { name: "xcode"; required: false } - condition: Host.os().contains("darwin") && qbs.targetOS.contains("darwin") + condition: Host.os().includes("darwin") && qbs.targetOS.includes("darwin") property string volumeName: product.targetName PropertyOptions { diff --git a/share/qbs/modules/dmg/dmg.js b/share/qbs/modules/dmg/dmg.js index 636a34af3..7d50d95f3 100644 --- a/share/qbs/modules/dmg/dmg.js +++ b/share/qbs/modules/dmg/dmg.js @@ -104,7 +104,7 @@ function dmgbuildSettings(product, inputs) { "dmg.sourceBase '" + a.dmg.sourceBase + "'."); } - var isSymlink = a.fileTags.contains("dmg.input.symlink"); + var isSymlink = a.fileTags.includes("dmg.input.symlink"); return { "x": a.dmg.iconX, "y": a.dmg.iconY, diff --git a/share/qbs/modules/freedesktop/FreeDesktop.qbs b/share/qbs/modules/freedesktop/FreeDesktop.qbs index dbb6d4151..5fe7ed72c 100644 --- a/share/qbs/modules/freedesktop/FreeDesktop.qbs +++ b/share/qbs/modules/freedesktop/FreeDesktop.qbs @@ -46,7 +46,7 @@ Module { 'Version': '1.1', } } - property bool _fdoSupported: qbs.targetOS.contains("unix") && !qbs.targetOS.contains("darwin") + property bool _fdoSupported: qbs.targetOS.includes("unix") && !qbs.targetOS.includes("darwin") additionalProductTypes: "freedesktop.desktopfile" diff --git a/share/qbs/modules/ib/IBModule.qbs b/share/qbs/modules/ib/IBModule.qbs index 4ff8abea2..e6183e20c 100644 --- a/share/qbs/modules/ib/IBModule.qbs +++ b/share/qbs/modules/ib/IBModule.qbs @@ -50,7 +50,7 @@ Module { } } - condition: Host.os().contains("darwin") && qbs.targetOS.contains("darwin") + condition: Host.os().includes("darwin") && qbs.targetOS.includes("darwin") property bool warnings: true property bool errors: true @@ -196,7 +196,7 @@ Module { cmd.highlight = 'compiler'; // May not be strictly needed, but is set by some versions of Xcode - if (input.fileTags.contains("storyboard")) + if (input.fileTags.includes("storyboard")) cmd.environment.push("IBSC_MINIMUM_COMPATIBILITY_VERSION=" + (product.moduleProperty("cpp", "minimumDarwinVersion") || "")); diff --git a/share/qbs/modules/ib/ib.js b/share/qbs/modules/ib/ib.js index ebb615e8e..d6873b261 100644 --- a/share/qbs/modules/ib/ib.js +++ b/share/qbs/modules/ib/ib.js @@ -116,7 +116,7 @@ function ibtooldArguments(product, inputs, input, outputs, overrideOutput) { var outputFormat = ModUtils.moduleProperty(product, "outputFormat"); if (outputFormat) { - if (!["binary1", "xml1", "human-readable-text"].contains(outputFormat)) + if (!["binary1", "xml1", "human-readable-text"].includes(outputFormat)) throw("Invalid ibtoold output format: " + outputFormat + ". " + "Must be in [binary1, xml1, human-readable-text]."); @@ -205,9 +205,9 @@ function ibtooldArguments(product, inputs, input, outputs, overrideOutput) { function ibtoolFileTaggers(fileTags) { var ext; - if (fileTags.contains("nib") && !fileTags.contains("storyboard")) + if (fileTags.includes("nib") && !fileTags.includes("storyboard")) ext = "nib"; - if (fileTags.contains("storyboard") && !fileTags.contains("nib")) + if (fileTags.includes("storyboard") && !fileTags.includes("nib")) ext = "storyboard"; if (!ext) @@ -223,9 +223,9 @@ function ibtoolFileTaggers(fileTags) { function ibtoolCompiledDirSuffix(product, input) { var suffix = input.completeBaseName; - if (input.fileTags.contains("nib")) + if (input.fileTags.includes("nib")) suffix += ModUtils.moduleProperty(product, "compiledNibSuffix"); - else if (input.fileTags.contains("storyboard")) + else if (input.fileTags.includes("storyboard")) suffix += ModUtils.moduleProperty(product, "compiledStoryboardSuffix"); return suffix; } @@ -252,7 +252,7 @@ function ibtoolOutputArtifacts(product, inputs, input) { var artifacts = tracker.artifacts(ibtoolBuildDirectory); if (product.moduleProperty("ib", "ibtoolVersionMajor") >= 6) { - var prefix = input.fileTags.contains("storyboard") ? "SB" : ""; + 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"] }); @@ -261,7 +261,7 @@ function ibtoolOutputArtifacts(product, inputs, input) { // 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.contains("compiled_ibdoc")) + if (artifacts[i].fileTags.includes("compiled_ibdoc")) artifacts[i].bundle = { _bundleFilePath: artifacts[i].filePath.replace(ibtoolBuildDirectory, main) }; @@ -296,7 +296,7 @@ function actoolOutputArtifacts(product, inputs) { } for (var i = 0; i < artifacts.length; ++i) { - if (artifacts[i].fileTags.contains("compiled_assetcatalog")) { + if (artifacts[i].fileTags.includes("compiled_assetcatalog")) { artifacts[i].bundle = { _bundleFilePath: artifacts[i].filePath.replace( product.buildDirectory + "/actool.dir", diff --git a/share/qbs/modules/ico/ico.js b/share/qbs/modules/ico/ico.js index a61d585ab..dc96eedf3 100644 --- a/share/qbs/modules/ico/ico.js +++ b/share/qbs/modules/ico/ico.js @@ -40,20 +40,20 @@ function prepareIconset(project, product, inputs, outputs, input, output) { ico: {} }; }); - inputs = {"png": inputs.filter(function (a) { return a.fileTags.contains("png"); })}; + 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.contains("ico")) { + if (output.fileTags.includes("ico")) { args.push("--icon"); if (product.ico.alphaThreshold !== undefined) args.push("--alpha-threshold=" + product.ico.alphaThreshold); } - var isCursor = output.fileTags.contains("cur"); + var isCursor = output.fileTags.includes("cur"); if (isCursor) args.push("--cursor"); diff --git a/share/qbs/modules/innosetup/InnoSetupModule.qbs b/share/qbs/modules/innosetup/InnoSetupModule.qbs index 930d85a9a..9f1018ec4 100644 --- a/share/qbs/modules/innosetup/InnoSetupModule.qbs +++ b/share/qbs/modules/innosetup/InnoSetupModule.qbs @@ -33,7 +33,7 @@ import qbs.ModUtils import qbs.Probes Module { - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") Probes.InnoSetupProbe { id: innoSetupProbe diff --git a/share/qbs/modules/java/JavaModule.qbs b/share/qbs/modules/java/JavaModule.qbs index d4d7c4492..343b2f4ba 100644 --- a/share/qbs/modules/java/JavaModule.qbs +++ b/share/qbs/modules/java/JavaModule.qbs @@ -123,10 +123,10 @@ Module { } else { paths.push(FileInfo.joinPaths(jdkPath, "include")); - var hostOS = Host.os().contains("windows") ? Host.os().concat(["win32"]) : Host.os(); + 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.contains(platforms[i])) { + if (hostOS.includes(platforms[i])) { // Corresponds to JDK_INCLUDE_SUBDIR in the JDK Makefiles paths.push(FileInfo.joinPaths(jdkPath, "include", platforms[i])); break; @@ -141,7 +141,7 @@ Module { property path classFilesDir: FileInfo.joinPaths(product.buildDirectory, "classes") property path internalClassFilesDir: FileInfo.joinPaths(product.buildDirectory, ".classes") - property bool isAppleJava: Host.os().contains("darwin") + property bool isAppleJava: Host.os().includes("darwin") && (compilerVersionMajor < 1 || (compilerVersionMajor === 1 && compilerVersionMinor < 7)) diff --git a/share/qbs/modules/java/utils.js b/share/qbs/modules/java/utils.js index 8fb9661fa..9ee5932dc 100644 --- a/share/qbs/modules/java/utils.js +++ b/share/qbs/modules/java/utils.js @@ -79,7 +79,7 @@ function findJdkPath(hostOS, arch, environmentPaths, searchPaths) { return environmentPaths[i]; } - if (hostOS.contains("windows")) { + if (hostOS.includes("windows")) { var rootKey = jdkRootRegistryKey(useWow64Key(arch)); if (rootKey) { var current = Utilities.getNativeSetting(rootKey, "CurrentVersion"); // 1.8 etc. @@ -94,7 +94,7 @@ function findJdkPath(hostOS, arch, environmentPaths, searchPaths) { return undefined; } - if (hostOS.contains("macos")) { + 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. @@ -114,7 +114,7 @@ function findJdkPath(hostOS, arch, environmentPaths, searchPaths) { } } - if (hostOS.contains("unix")) { + if (hostOS.includes("unix")) { var requiredTools = ["javac", "java", "jar"]; for (i = 0; i < searchPaths.length; ++i) { function fullToolPath(tool) { @@ -246,7 +246,7 @@ function helperFullyQualifiedNames(type) { ]; if (type === "java") { return names.filter(function (name) { - return !name.contains("$"); + return !name.includes("$"); }); } else if (type === "class") { return names; diff --git a/share/qbs/modules/nodejs/NodeJS.qbs b/share/qbs/modules/nodejs/NodeJS.qbs index db10fb36f..412f9b8bb 100644 --- a/share/qbs/modules/nodejs/NodeJS.qbs +++ b/share/qbs/modules/nodejs/NodeJS.qbs @@ -85,13 +85,13 @@ Module { "tmp", "nodejs.intermediate") setupBuildEnvironment: { - var v = new ModUtils.EnvironmentVariable("PATH", FileInfo.pathListSeparator(), Host.os().contains("windows")); + 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().contains("windows")); + 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(); } @@ -119,7 +119,7 @@ Module { outputArtifacts: { var tags = ["nodejs_processed_js"]; - if (input.fileTags.contains("application_js") || + if (input.fileTags.includes("application_js") || product.moduleProperty("nodejs", "applicationFile") === input.filePath) tags.push("application"); diff --git a/share/qbs/modules/nsis/NSISModule.qbs b/share/qbs/modules/nsis/NSISModule.qbs index cf8626949..11a5670b5 100644 --- a/share/qbs/modules/nsis/NSISModule.qbs +++ b/share/qbs/modules/nsis/NSISModule.qbs @@ -35,7 +35,7 @@ import qbs.ModUtils import qbs.Utilities Module { - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") property path toolchainInstallPath: Utilities.getNativeSetting(registryKey) @@ -90,7 +90,7 @@ Module { // Private properties property string registryKey: { - if (!Host.os().contains("windows")) + if (!Host.os().includes("windows")) return undefined; var keys = [ "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", "HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS" ]; @@ -105,7 +105,7 @@ Module { // Only *require* the toolchain install path on Windows // On other (Unix-like) operating systems it'll probably be in the PATH - if (qbs.targetOS.contains("windows")) + if (qbs.targetOS.includes("windows")) validator.setRequiredProperty("toolchainInstallPath", toolchainInstallPath); validator.setRequiredProperty("versionMajor", versionMajor); @@ -159,7 +159,7 @@ Module { var args = []; // Prefix character for makensis options - var opt = product.moduleProperty("qbs", "hostOS").contains("windows") ? "/" : "-"; + var opt = product.moduleProperty("qbs", "hostOS").includes("windows") ? "/" : "-"; if (ModUtils.moduleProperty(product, "disableConfig")) { args.push(opt + "NOCONFIG"); diff --git a/share/qbs/modules/pkgconfig/pkgconfig.qbs b/share/qbs/modules/pkgconfig/pkgconfig.qbs index b436263e9..901e7e02e 100644 --- a/share/qbs/modules/pkgconfig/pkgconfig.qbs +++ b/share/qbs/modules/pkgconfig/pkgconfig.qbs @@ -47,7 +47,7 @@ Module { } property path sysroot: { - if (qbs.targetOS.contains("macos")) + if (qbs.targetOS.includes("macos")) return ""; return qbs.sysroot; } diff --git a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs index 9d333d327..ae218a0c2 100644 --- a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs +++ b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs @@ -68,7 +68,7 @@ ProtobufBase { var result = []; if (_libraryName) result.push(_libraryName) - if (qbs.targetOS.contains("unix")) + if (qbs.targetOS.includes("unix")) result.push("pthread"); if (useGrpc) { result = result.concat(_extraGrpcLibs); @@ -98,7 +98,7 @@ ProtobufBase { ".pb.h"), HelperFunctions.cppArtifact(outputDir, input, "cpp", ".pb.cc") ]; - if (input.fileTags.contains("protobuf.grpc")) { + if (input.fileTags.includes("protobuf.grpc")) { result.push( HelperFunctions.cppArtifact(outputDir, input, ["hpp", "protobuf.hpp"], ".grpc.pb.h"), @@ -111,7 +111,7 @@ ProtobufBase { prepare: { var result = HelperFunctions.doPrepare( input.protobuf.cpp, product, input, outputs, "cpp"); - if (input.fileTags.contains("protobuf.grpc")) { + 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)); diff --git a/share/qbs/modules/qbs/common.qbs b/share/qbs/modules/qbs/common.qbs index 530bcb2d2..7723c6050 100644 --- a/share/qbs/modules/qbs/common.qbs +++ b/share/qbs/modules/qbs/common.qbs @@ -53,10 +53,10 @@ Module { readonly property string hostPlatform: undefined // set internally readonly property stringList hostOS: Utilities.canonicalPlatform(hostPlatform) property string hostOSVersion: { - if (hostOS && hostOS.contains("macos")) { + 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.contains("windows")) { + } else if (hostOS && hostOS.includes("windows")) { var version = Utilities.getNativeSetting(windowsRegistryKey, "CurrentVersion"); return version + "." + hostOSBuildVersion; } @@ -64,10 +64,10 @@ Module { readonly property string hostArchitecture: undefined // set internally property string hostOSBuildVersion: { - if (hostOS.contains("macos")) { + if (hostOS.includes("macos")) { return Utilities.getNativeSetting("/System/Library/CoreServices/ServerVersion.plist", "ProductBuildVersion") || Utilities.getNativeSetting("/System/Library/CoreServices/SystemVersion.plist", "ProductBuildVersion"); - } else if (hostOS.contains("windows")) { + } else if (hostOS.includes("windows")) { return Utilities.getNativeSetting(windowsRegistryKey, "CurrentBuildNumber"); } } @@ -79,19 +79,19 @@ Module { property string targetPlatform: hostPlatform readonly property stringList targetOS: Utilities.canonicalPlatform(targetPlatform) - property string pathListSeparator: hostOS.contains("windows") ? ";" : ":" - property string pathSeparator: hostOS.contains("windows") ? "\\" : "/" - property string nullDevice: hostOS.contains("windows") ? "NUL" : "/dev/null" - property path shellPath: hostOS.contains("windows") ? windowsShellPath : "/bin/sh" + 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.contains("windows")) - return hostOS.contains("windows") ? "msvc" : "mingw"; - if (targetOS.contains("darwin")) - return hostOS.contains("macos") ? "xcode" : "clang"; - if (targetOS.contains("freebsd")) + 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.contains("qnx")) + if (targetOS.includes("qnx")) return "qcc"; if (targetOS.containsAny(["haiku", "vxworks", "unix"])) return "gcc"; @@ -102,7 +102,7 @@ Module { property path installSourceBase property string installRoot: project.buildDirectory + "/install-root" property string installDir - property string installPrefix: qbs.targetOS.contains("unix") ? "/usr/local" : "" + property string installPrefix: qbs.targetOS.includes("unix") ? "/usr/local" : "" property path sysroot PropertyOptions { @@ -122,12 +122,12 @@ Module { validator.setRequiredProperty("hostOS", hostOS); validator.setRequiredProperty("targetOS", targetOS); validator.addCustomValidator("targetOS", targetOS, function (value) { - if (!value || (value.contains("osx") && !value.contains("macos"))) + 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.contains("windows") || hostOS.contains("macos"))) { + 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 " + @@ -170,7 +170,7 @@ Module { ]; var canonical = Utilities.canonicalToolchain.apply(Utilities, value); for (var i = 0; i < pairs.length; ++i) { - if (canonical.contains(pairs[i][0]) && canonical.contains(pairs[i][1])) + if (canonical.includes(pairs[i][0]) && canonical.includes(pairs[i][1])) return false; } return true; @@ -183,14 +183,14 @@ Module { 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.contains("windows") ? "PATH" : "WINEPATH" + 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.contains("windows")); + product.qbs.hostOS.includes("windows")); v.value = env[i]; v.set(); } diff --git a/share/qbs/modules/qnx/qnx.qbs b/share/qbs/modules/qnx/qnx.qbs index f329db18c..899b72441 100644 --- a/share/qbs/modules/qnx/qnx.qbs +++ b/share/qbs/modules/qnx/qnx.qbs @@ -40,7 +40,7 @@ Module { Probes.PathProbe { id: qnxSdkProbe names: ["qnx700", "qnx660", "qnx650"] - searchPaths: Host.os().contains("windows") + searchPaths: Host.os().includes("windows") ? [Environment.getEnv("USERPROFILE"), Environment.getEnv("SystemDrive")] : [Environment.getEnv("HOME"), "/opt"] } @@ -78,11 +78,11 @@ Module { property string hostArch: qnx7 ? "x86_64" : "x86" property string hostOs: { - if (Host.os().contains("linux")) + if (Host.os().includes("linux")) return "linux"; - if (Host.os().contains("macos")) + if (Host.os().includes("macos")) return "darwin"; - if (Host.os().contains("windows")) + if (Host.os().includes("windows")) return qnx7 ? "win64" : "win32"; } diff --git a/share/qbs/modules/typescript/typescript.js b/share/qbs/modules/typescript/typescript.js index 7b2cf98df..199f486cf 100644 --- a/share/qbs/modules/typescript/typescript.js +++ b/share/qbs/modules/typescript/typescript.js @@ -146,7 +146,7 @@ function outputArtifacts(product, inputs) { var i, appIndex = -1; if (product.moduleProperty("typescript", "singleFile")) { for (i = 0; i < artifacts.length; ++i) { - if (artifacts[i].fileTags.contains("compiled_typescript")) { + if (artifacts[i].fileTags.includes("compiled_typescript")) { appIndex = i; break; } @@ -169,7 +169,7 @@ function outputArtifacts(product, inputs) { } } - if (appIndex === -1 || !artifacts[appIndex].fileTags.contains("compiled_typescript")) + 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 + "'"; diff --git a/share/qbs/modules/wix/WiXModule.qbs b/share/qbs/modules/wix/WiXModule.qbs index 31bdac51f..077f259f4 100644 --- a/share/qbs/modules/wix/WiXModule.qbs +++ b/share/qbs/modules/wix/WiXModule.qbs @@ -36,7 +36,7 @@ import qbs.Probes import qbs.Utilities Module { - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") Probes.WiXProbe { id: wixProbe @@ -113,19 +113,19 @@ Module { description: "the list of localizations to build the MSI for; leave undefined to build all localizations" } - property stringList extensions: product.type.contains("wixsetup") ? ["WixBalExtension"] : [] // default to WiX Standard Bootstrapper extension + property stringList extensions: product.type.includes("wixsetup") ? ["WixBalExtension"] : [] // default to WiX Standard Bootstrapper extension // private properties property string targetSuffix: { - if (product.type.contains("msi")) { + if (product.type.includes("msi")) { return windowsInstallerSuffix; - } else if (product.type.contains("wixsetup")) { + } else if (product.type.includes("wixsetup")) { return executableSuffix; } } // MSI/MSM package validation only works natively on Windows - property bool enablePackageValidation: Host.os().contains("windows") + property bool enablePackageValidation: Host.os().includes("windows") property string executableSuffix: ".exe" property string windowsInstallerSuffix: ".msi" @@ -227,7 +227,7 @@ Module { if (ModUtils.moduleProperty(input, "visualStudioCompatibility")) { var toolchain = product.moduleProperty("qbs", "toolchain"); var toolchainInstallPath = product.moduleProperty("cpp", "toolchainInstallPath"); - if (toolchain && toolchain.contains("msvc") && 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'))); @@ -335,12 +335,12 @@ Module { multiplex: true inputs: ["wixobj", "wxl"] auxiliaryInputs: ["installable"] - inputsFromDependencies: product.type.contains("wixsetup") ? ["msi"] : [] + inputsFromDependencies: product.type.includes("wixsetup") ? ["msi"] : [] outputArtifacts: { var artifacts = []; - if (product.type.contains("wixsetup")) { + if (product.type.includes("wixsetup")) { artifacts.push({ fileTags: ["wixsetup", "application"], filePath: FileInfo.joinPaths(product.destinationDirectory, @@ -350,7 +350,7 @@ Module { }); } - if (product.type.contains("msi")) { + if (product.type.includes("msi")) { artifacts.push({ fileTags: ["msi"], filePath: FileInfo.joinPaths(product.destinationDirectory, @@ -376,9 +376,9 @@ Module { prepare: { var i; var primaryOutput; - if (product.type.contains("wixsetup")) { + if (product.type.includes("wixsetup")) { primaryOutput = outputs.wixsetup[0]; - } else if (product.type.contains("msi")) { + } else if (product.type.includes("msi")) { primaryOutput = outputs.msi[0]; } else { throw("WiX: Unsupported product type '" + product.type + "'"); @@ -427,7 +427,7 @@ Module { args.push(FileInfo.toWindowsSeparators(inputs.wxl[i].filePath)); } - if (product.type.contains("msi")) { + if (product.type.includes("msi")) { var cultures = ModUtils.moduleProperty(product, "cultures"); args.push("-cultures:" + (cultures && cultures.length > 0 ? cultures.join(";") : "null")); diff --git a/share/qbs/modules/xcode/xcode.js b/share/qbs/modules/xcode/xcode.js index c6c77ca73..15afddb95 100644 --- a/share/qbs/modules/xcode/xcode.js +++ b/share/qbs/modules/xcode/xcode.js @@ -207,25 +207,25 @@ function archsSpecsPath(version, targetOS, platformType, platformPath, devicePla if (Utilities.versionCompare(version, "13.3") >= 0) { var baseDir = FileInfo.joinPaths(developerPath, "..", "PlugIns/XCBSpecifications.ideplugin/Contents/Resources"); - var baseName = targetOS.contains("macos") ? "MacOSX Architectures" - : targetOS.contains("ios-simulator") ? "iOS Simulator" - : targetOS.contains("ios") ? "iOS Device" - : targetOS.contains("tvos-simulator") ? "tvOS Simulator" - : targetOS.contains("tvos") ? "tvOS Device" - : targetOS.contains("watchos-simulator") ? "watchOS Simulator" : "watchOS Device"; + 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.contains("macos")) + if (targetOS.includes("macos")) _specsPluginBaseName = "OSX"; } if (Utilities.versionCompare(version, "7") >= 0) { - if (targetOS.contains("ios")) + if (targetOS.includes("ios")) _specsPluginBaseName = "iOSPlatform"; - if (targetOS.contains("tvos")) + if (targetOS.includes("tvos")) _specsPluginBaseName = "AppleTV"; - if (targetOS.contains("watchos")) + if (targetOS.includes("watchos")) _specsPluginBaseName = "Watch"; } @@ -236,8 +236,8 @@ function archsSpecsPath(version, targetOS, platformType, platformPath, devicePla "Resources") : FileInfo.joinPaths(platformPath, "Developer", "Library", "Xcode", "Specifications"); - var _archSpecsFileBaseName = targetOS.contains("ios") - ? (targetOS.contains("ios-simulator") ? "iPhone Simulator " : "iPhoneOS") + var _archSpecsFileBaseName = targetOS.includes("ios") + ? (targetOS.includes("ios-simulator") ? "iPhone Simulator " : "iPhoneOS") : DarwinTools.applePlatformDirectoryName(targetOS, platformType) + " "; if (_specsPluginBaseName) { diff --git a/share/qbs/modules/xcode/xcode.qbs b/share/qbs/modules/xcode/xcode.qbs index 1975f04b7..941b8d395 100644 --- a/share/qbs/modules/xcode/xcode.qbs +++ b/share/qbs/modules/xcode/xcode.qbs @@ -26,8 +26,8 @@ Module { sdksPath: xcodeModule.sdksPath } - condition: qbs.targetOS.contains("darwin") && - qbs.toolchain && qbs.toolchain.contains("xcode") + condition: qbs.targetOS.includes("darwin") && + qbs.toolchain && qbs.toolchain.includes("xcode") version: xcodeProbe.xcodeVersion -- cgit v1.2.1 From 385dbb2ad143bbd0c32f21d6e3cbbd4d116ebcff Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 17 Feb 2023 17:08:46 +0100 Subject: Docs: Do not use .contains() Amends e3522f42773cfbb9a980e859c906457b3571fa1f. Change-Id: If51576f080ee5c01eeae493934cf646403594965 Reviewed-by: Ivan Komissarov --- doc/howtos.qdoc | 18 +++++++++--------- doc/qbs.qdoc | 4 ++-- doc/reference/items/language/group.qdoc | 8 ++++---- doc/reference/items/language/module.qdoc | 2 +- doc/reference/items/language/properties.qdoc | 18 +++++++++--------- doc/reference/modules/cpp-module.qdoc | 4 ++-- doc/reference/modules/qbs-module.qdoc | 20 ++++++++++---------- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/doc/howtos.qdoc b/doc/howtos.qdoc index e21a2588d..268bee7c0 100644 --- a/doc/howtos.qdoc +++ b/doc/howtos.qdoc @@ -390,19 +390,19 @@ Depends { name: "cpp" } cpp.includePaths: ["/somewhere/include"] Properties { - condition: qbs.targetOS.contains("android") + condition: qbs.targetOS.includes("android") cpp.dynamicLibraries: ["/somewhere/android/" + Android.ndk.abi + "/lib1.so"] } Properties { - condition: qbs.targetOS.contains("macos") + condition: qbs.targetOS.includes("macos") cpp.dynamicLibraries: ["/somewhere/macos/lib1.dylib"] } Properties { - condition: qbs.targetOS.contains("windows") && qbs.architecture === "x86" + condition: qbs.targetOS.includes("windows") && qbs.architecture === "x86" cpp.dynamicLibraries: ["/somewhere/windows_x86/lib1.lib"] } Properties { - condition: qbs.targetOS.contains("windows") && qbs.architecture === "x86_64" + condition: qbs.targetOS.includes("windows") && qbs.architecture === "x86_64" cpp.dynamicLibraries: ["/somewhere/windows_x86_64/lib1.lib"] } } @@ -532,7 +532,7 @@ CppApplication { // ... - readonly property bool isMsvc: qbs.toolchain.contains("msvc") + readonly property bool isMsvc: qbs.toolchain.includes("msvc") cpp.commonCompilerFlags: isMsvc ? "/wd4996" : "-Wno-deprecated-declarations" } @@ -755,7 +755,7 @@ \c qbs.targetOS has the wrong value: \code - readonly property bool unix: qbs.targetOS.contains("unix") + readonly property bool unix: qbs.targetOS.includes("unix") \endcode To find out the value of \c qbs.targetOS, use \c {console.info()}: @@ -763,7 +763,7 @@ \code readonly property bool unix: { console.info("qbs.targetOS: " + qbs.targetOS) - return qbs.targetOS.contains("unix") + return qbs.targetOS.includes("unix") } \endcode @@ -771,9 +771,9 @@ be useful if the property contains invalid or unsupported value: \code readonly property bool unix: { - if (qbs.targetOS.contains("darwin")) + if (qbs.targetOS.includes("darwin")) throw "Apple platforms are not supported"; - return qbs.targetOS.contains("unix") + return qbs.targetOS.includes("unix") } \endcode diff --git a/doc/qbs.qdoc b/doc/qbs.qdoc index fc28f6a66..45d6dfc91 100644 --- a/doc/qbs.qdoc +++ b/doc/qbs.qdoc @@ -1257,7 +1257,7 @@ This is how you do it: \code Group { - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") files: [ "harddiskdeleter_win.cpp", "blowupmonitor_win.cpp", @@ -1265,7 +1265,7 @@ ] } Group { - condition: qbs.targetOS.contains("linux") + condition: qbs.targetOS.includes("linux") files: [ "harddiskdeleter_linux.cpp", "blowupmonitor_linux.cpp", diff --git a/doc/reference/items/language/group.qdoc b/doc/reference/items/language/group.qdoc index a1676676e..c9b6dd1cf 100644 --- a/doc/reference/items/language/group.qdoc +++ b/doc/reference/items/language/group.qdoc @@ -48,21 +48,21 @@ } Group { name: "Windows files" - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") files: "myclass_win_impl.cpp" } Group { name: "Unix files" - condition: qbs.targetOS.contains("unix") + condition: qbs.targetOS.includes("unix") files: "unixhelper.cpp" Group { name: "Linux files" - condition: qbs.targetOS.contains("linux") + condition: qbs.targetOS.includes("linux") files: "myclass_linux_impl.cpp" } Group { name: "FreeBSD files" - condition: qbs.targetOS.contains("freebsd") + condition: qbs.targetOS.includes("freebsd") files: "myclass_freebsd_impl.cpp" } } diff --git a/doc/reference/items/language/module.qdoc b/doc/reference/items/language/module.qdoc index f630f60fd..172939537 100644 --- a/doc/reference/items/language/module.qdoc +++ b/doc/reference/items/language/module.qdoc @@ -169,7 +169,7 @@ \qml Module { property bool featureEnabled: - (product.type.contains("application")) ? true : false + (product.type.includes("application")) ? true : false } \endqml diff --git a/doc/reference/items/language/properties.qdoc b/doc/reference/items/language/properties.qdoc index 6e235d927..49da1dee1 100644 --- a/doc/reference/items/language/properties.qdoc +++ b/doc/reference/items/language/properties.qdoc @@ -44,7 +44,7 @@ \code Product { Properties { - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") cpp.defines: ["ON_WINDOWS"] cpp.includePaths: ["extraWindowsIncludes"] } @@ -57,12 +57,12 @@ \code Product { Properties { - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") cpp.defines: ["ON_WINDOWS"] cpp.includePaths: ["myWindowsIncludes"] } Properties { - condition: qbs.targetOS.contains("linux") + condition: qbs.targetOS.includes("linux") cpp.defines: ["ON_LINUX"] cpp.includePaths: ["myLinuxIncludes"] } @@ -73,16 +73,16 @@ \code Product { cpp.defines: { - if (qbs.targetOS.contains("windows")) + if (qbs.targetOS.includes("windows")) return ["ON_WINDOWS"]; - if (qbs.targetOS.contains("linux")) + if (qbs.targetOS.includes("linux")) return ["ON_LINUX"]; return ["ON_UNKNOWN_PLATFORM"]; } cpp.includePaths: { - if (qbs.targetOS.contains("windows")) + if (qbs.targetOS.includes("windows")) return ["myWindowsIncludes"]; - if (qbs.targetOS.contains("linux")) + if (qbs.targetOS.includes("linux")) return ["myLinuxIncludes"]; return base; } @@ -94,11 +94,11 @@ \code Product { Properties { - condition: qbs.targetOS.contains("windows") + condition: qbs.targetOS.includes("windows") cpp.defines: outer.concat("ON_WINDOWS") // === ["FOO", "ON_WINDOWS"] } Properties { - condition: qbs.targetOS.contains("linux") + condition: qbs.targetOS.includes("linux") cpp.defines: ["ON_LINUX"] // === ["ON_LINUX"] } cpp.defines: ["FOO"] diff --git a/doc/reference/modules/cpp-module.qdoc b/doc/reference/modules/cpp-module.qdoc index 540516135..f0b6de063 100644 --- a/doc/reference/modules/cpp-module.qdoc +++ b/doc/reference/modules/cpp-module.qdoc @@ -1409,11 +1409,11 @@ \code Properties { - condition: qbs.toolchain.contains("gcc") + condition: qbs.toolchain.includes("gcc") cpp.linkerVariant: "gold" } Properties { - condition: qbs.toolchain.contains("clang-cl") + condition: qbs.toolchain.includes("clang-cl") cpp.linkerVariant: "lld" } \endcode diff --git a/doc/reference/modules/qbs-module.qdoc b/doc/reference/modules/qbs-module.qdoc index e0d0ec457..7fc1479d4 100644 --- a/doc/reference/modules/qbs-module.qdoc +++ b/doc/reference/modules/qbs-module.qdoc @@ -55,7 +55,7 @@ name: "Runtime resources" files: "*.qml" qbs.install: true - qbs.installDir: condition: qbs.targetOS.contains("unix") + qbs.installDir: condition: qbs.targetOS.includes("unix") ? "share/myapp" : "resources" } Group { @@ -64,7 +64,7 @@ qbs.install: true qbs.installDir: "bin" } - qbs.installPrefix: condition: qbs.targetOS.contains("unix") + qbs.installPrefix: condition: qbs.targetOS.includes("unix") ? "usr/local" : "MyApp" } \endcode @@ -477,12 +477,12 @@ \code Properties { // flags for GCC - condition: qbs.toolchain.contains("gcc") + condition: qbs.toolchain.includes("gcc") cpp.commonCompilerFlags: ... } Properties { // flags for MSVC - condition: qbs.toolchain.contains("msvc") + condition: qbs.toolchain.includes("msvc") cpp.commonCompilerFlags: ... } \endcode @@ -498,7 +498,7 @@ use: \code - qbs.toolchain.contains("gcc") + qbs.toolchain.includes("gcc") \endcode since XCode, GCC and Clang belong to the \c "gcc" family. @@ -645,17 +645,17 @@ \code Group { // Includes all Unix-like platforms, such as: Linux, BSD, Apple platforms and others. - condition: qbs.targetOS.contains("unix") + condition: qbs.targetOS.includes("unix") files: ... } Group { // Includes all Apple platforms, such as macOS, iOS, and iOS Simulator. - condition: qbs.targetOS.contains("darwin") + condition: qbs.targetOS.includes("darwin") files: ... } Group { // Includes only macOS - condition: qbs.targetOS.contains("macos") + condition: qbs.targetOS.includes("macos") files: ... } \endcode @@ -668,7 +668,7 @@ use \code - qbs.targetOS.contains("darwin") + qbs.targetOS.includes("darwin") \endcode @@ -681,7 +681,7 @@ versus \code - qbs.targetOS.contains("linux") && !qbs.targetOS.contains("android") + qbs.targetOS.includes("linux") && !qbs.targetOS.includes("android") \endcode For the complete list of possible values, see -- cgit v1.2.1 From e332de10b30665d9d6dcaf6d4d72aad918ca0b5d Mon Sep 17 00:00:00 2001 From: Ivan Komissarov Date: Sun, 19 Feb 2023 11:52:04 +0300 Subject: docker: update Windows image - install latest vs2019 compiler - install latest win10 SDK - add vswhere to simplify searching VS - update Qt to 6.2.4 - update Qbs to 1.24.0 - drop support for 32-bit packages in choco Change-Id: I0a57baf160307b84e62fea5c56687efcce7fe42c Reviewed-by: Christian Kandeler --- .github/workflows/release.yml | 10 +++------- docker-compose.yml | 6 +++--- docker/windowsservercore/Dockerfile | 18 +++++++++--------- src/packages/chocolatey/chocolateyinstall.ps1 | 4 ---- 4 files changed, 15 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c600845d1..ea8c401ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -154,8 +154,7 @@ jobs: modules.qbsbuildconfig.enableUnitTests:false modules.cpp.treatWarningsAsErrors:true project.withDocumentation:true - config:release-64 profile:qt64 - config:release profile:qt + config:release profile:qt64 - name: Print clcache stats run: docker-compose run --rm windows clcache -s - name: Get archive name @@ -169,7 +168,6 @@ jobs: path: | release/qbs.*.nupkg release/qbs-windows-*.zip - release-64/qbs-windows-*.zip create-archives: name: Create Archives @@ -211,12 +209,11 @@ jobs: uses: actions/download-artifact@v1 with: name: qbs-windows-${{ github.run_id }} - path: ./tmp + path: ./tmp/release - name: Copy Windows artifacts run: | cp ./tmp/release/qbs.*.nupkg ./release - cp ./tmp/release/qbs-windows-x86-*.zip ./release - cp ./tmp/release-64/qbs-windows-x86_64-*.zip ./release + cp ./tmp/release/qbs-windows-x86_64-*.zip ./release - name: Copy changelog run: cp changelogs/changes-${{ steps.get-version-name.outputs.version-name }}.md release || echo "changelog not found" - name: Generate checksums @@ -236,7 +233,6 @@ jobs: release/qbs-src-*.tar.gz release/qbs-linux-*.tar.gz release/qbs.*.nupkg - release/qbs-windows-x86-*.zip release/qbs-windows-x86_64-*.zip release/changes-*.md release/md5sums.txt diff --git a/docker-compose.yml b/docker-compose.yml index 680d1b837..ceedef4a7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -178,13 +178,13 @@ services: QTCREATOR_VERSION: 5.0.3 windows: - image: ${DOCKER_USER:-qbsbuild}/qbsdev:windowsservercore-5.15.0_1.18.2-0 + image: ${DOCKER_USER:-qbsbuild}/qbsdev:windowsservercore-6.2.4_1.24.0-0 build: dockerfile: docker/windowsservercore/Dockerfile context: . args: - QT_VERSION: 5.15.0 - QBS_VERSION: 1.18.2 + QT_VERSION: 6.2.4 + QTCREATOR_VERSION: 9.0.1 working_dir: 'C:/qbs' environment: - BUILD_OPTIONS diff --git a/docker/windowsservercore/Dockerfile b/docker/windowsservercore/Dockerfile index 0909d81f2..8fce9fa59 100644 --- a/docker/windowsservercore/Dockerfile +++ b/docker/windowsservercore/Dockerfile @@ -6,7 +6,7 @@ LABEL Description="Windows Server Core development environment for Qbs with Qt, RUN reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v Disabled /t REG_DWORD /d 1 /f RUN reg add "HKLM\SOFTWARE\Microsoft\Windows\Windows Error Reporting" /v DontShowUI /t REG_DWORD /d 1 /f -# Install VS from the website since chocolatey has broken .NET 4.8 (dotnetfx package) which is a +# Install VS 2019 from the website since chocolatey has broken .NET 4.8 (dotnetfx package) which is a # dependency for the visualstudio2019buildtools package RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \ Invoke-WebRequest "https://aka.ms/vs/16/release/vs_community.exe" \ @@ -14,18 +14,17 @@ RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \ RUN "%TEMP%\vs_community.exe" --quiet --wait --norestart --noUpdateInstaller \ --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \ - --add Microsoft.VisualStudio.Component.Windows10SDK.18362 + --add Microsoft.VisualStudio.Component.Windows10SDK.20348 RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \ $Env:chocolateyVersion = '0.10.15' ; \ $Env:chocolateyUseWindowsCompression = 'false' ; \ "[Net.ServicePointManager]::SecurityProtocol = \"tls12, tls11, tls\"; iex ((New-Object System.Net.WebClient).DownloadString('http://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" -ARG QBS_VERSION -RUN choco install -y python && \ +RUN choco install -y python --version 3.9 && \ choco install -y 7zip --version 19.0 && \ choco install -y git --version 2.24.0 --params "/GitAndUnixToolsOnPath" && \ - choco install -y qbs --version %QBS_VERSION% + choco install -y vswhere # for building the documentation RUN pip install beautifulsoup4 lxml @@ -42,13 +41,14 @@ RUN certutil -generateSSTFromWU roots.sst && \ ARG QT_VERSION COPY scripts/install-qt.sh install-qt.sh -RUN bash -c "./install-qt.sh -d /c/Qt --version ${QT_VERSION} --toolchain win64_msvc2019_64 qtbase qtdeclarative qttools" +RUN bash -c "./install-qt.sh -d /c/Qt --version ${QT_VERSION} --toolchain win64_msvc2019_64 qtbase qtdeclarative qttools qt5compat" ENV QTDIR64=C:\\Qt\\${QT_VERSION}\\msvc2019_64 -RUN bash -c "./install-qt.sh -d /c/Qt --version ${QT_VERSION} --toolchain win32_msvc2019 qtbase qtdeclarative qttools" -ENV QTDIR=C:\\Qt\\${QT_VERSION}\\msvc2019 +########### Install Qbs ############# +ARG QTCREATOR_VERSION +RUN bash -c "./install-qt.sh -d /c/Qt --version ${QTCREATOR_VERSION} qtcreator" +RUN setx PATH "C:\\Qt\\Tools\\QtCreator\\bin;%PATH%" RUN qbs setup-toolchains --detect && \ qbs setup-qt %QTDIR64%/bin/qmake.exe qt64 && \ - qbs setup-qt %QTDIR%/bin/qmake.exe qt && \ qbs config defaultProfile qt64 diff --git a/src/packages/chocolatey/chocolateyinstall.ps1 b/src/packages/chocolatey/chocolateyinstall.ps1 index f55d87eb9..fb763e681 100644 --- a/src/packages/chocolatey/chocolateyinstall.ps1 +++ b/src/packages/chocolatey/chocolateyinstall.ps1 @@ -9,15 +9,11 @@ ForEach ($line in (New-Object Net.WebClient).DownloadString("$qbsBaseUrl/${check $checksums.Add($items[1], $items[0]) } -$qbs32 = "qbs-windows-x86-$qbsVersion.zip" $qbs64 = "qbs-windows-x86_64-$qbsVersion.zip" Install-ChocolateyZipPackage ` -PackageName 'qbs' ` - -Url "$qbsBaseUrl/$qbs32" ` -UnzipLocation "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" ` -Url64bit "$qbsBaseUrl/$qbs64" ` - -Checksum $checksums[$qbs32] ` - -ChecksumType $checksumType ` -Checksum64 $checksums[$qbs64] ` -ChecksumType64 $checksumType -- cgit v1.2.1 From 1f8c6d3560607078cf33a396f1907bb1677ba234 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Wed, 22 Feb 2023 12:40:57 +0200 Subject: CMake: Enable exception handling on MSVC Sample warning: Building CXX object src\shared\qbs\src\shared\json\CMakeFiles\qbsjson.dir\json.cpp.obj C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(378): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(371): note: while compiling class template member function 'std::basic_ostream> &std::basic_ostream>::operator <<(unsigned __int64)' F:\Projects\qt-creator\qt-creator\src\shared\qbs\src\shared\json\json.cpp(4142): note: see reference to function template instantiation 'std::basic_ostream> &std::basic_ostream>::operator <<(unsigned __int64)' being compiled C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\include\ostream(671): note: see reference to class template instantiation 'std::basic_ostream>' being compiled Change-Id: I404cdeb5e447fe880998aaec4c576c0ed6dd3507 Reviewed-by: Ivan Komissarov --- cmake/QbsBuildConfig.cmake | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmake/QbsBuildConfig.cmake b/cmake/QbsBuildConfig.cmake index f70a1c53c..4e49cf4b3 100644 --- a/cmake/QbsBuildConfig.cmake +++ b/cmake/QbsBuildConfig.cmake @@ -175,6 +175,9 @@ function(add_qbs_library target_name) RUNTIME DESTINATION ${QBS_DLL_INSTALL_DIR} ) endif() + if(MSVC) + target_compile_options(${target_name} PUBLIC /EHsc) + endif() endfunction() function(add_qbs_plugin target_name) -- cgit v1.2.1 From 73994b550f85576844df229c6c7bea44604091e9 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 3 Mar 2023 10:01:29 +0100 Subject: Prevent dangling JS values As opposed to QtScript, such values cannot be re-used in QuickJS. This was overlooked in 087c22e17721f37490dd2048a567b6a58065d939. I assume this is the culprit for seemingly random crashes and "not a function" messages we have been seeing sometimes when building with Qt Creator. Change-Id: Ia4e7aed0cda97439ac75db5ecfbf08ff096a02b2 Reviewed-by: Ivan Komissarov --- src/lib/corelib/buildgraph/depscanner.cpp | 9 ++------- src/lib/corelib/buildgraph/transformer.cpp | 12 +++--------- src/lib/corelib/language/language.cpp | 16 ++++++++++++++++ src/lib/corelib/language/language.h | 8 +++----- src/lib/corelib/language/scriptengine.cpp | 4 ++++ src/lib/corelib/language/scriptengine.h | 3 +++ 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/lib/corelib/buildgraph/depscanner.cpp b/src/lib/corelib/buildgraph/depscanner.cpp index e4e10f477..01e781a54 100644 --- a/src/lib/corelib/buildgraph/depscanner.cpp +++ b/src/lib/corelib/buildgraph/depscanner.cpp @@ -238,16 +238,11 @@ QStringList UserDependencyScanner::evaluate(Artifact *artifact, const ScopedJsValueList argsMgr(m_engine->context(), args); const TemporaryGlobalObjectSetter gos(m_engine, m_global); - JSValue &function = script.scriptFunction; - if (!JS_IsFunction(m_engine->context(), function)) { - function = m_engine->evaluate(JsValueOwner::ScriptEngine, script.sourceCode()); - if (Q_UNLIKELY(!JS_IsFunction(m_engine->context(), function))) - throw ErrorInfo(Tr::tr("Invalid scan script."), script.location()); - } + const JSValue function = script.getFunction(m_engine, Tr::tr("Invalid scan script.")); const ScopedJsValue result( m_engine->context(), JS_Call(m_engine->context(), function, m_engine->globalObject(), - int(args.size()), args.data())); + int(args.size()), args.data())); m_engine->clearRequestedProperties(); if (JsException ex = m_engine->checkAndClearException(script.location())) { ErrorInfo err = ex.toErrorInfo(); diff --git a/src/lib/corelib/buildgraph/transformer.cpp b/src/lib/corelib/buildgraph/transformer.cpp index ae044cd2c..2346ad5c9 100644 --- a/src/lib/corelib/buildgraph/transformer.cpp +++ b/src/lib/corelib/buildgraph/transformer.cpp @@ -259,18 +259,12 @@ AbstractCommandPtr Transformer::createCommandFromScriptValue( void Transformer::createCommands(ScriptEngine *engine, const PrivateScriptFunction &script, const JSValueList &args) { - if (JS_IsUndefined(script.scriptFunction)) { - script.scriptFunction = engine->evaluate(JsValueOwner::ScriptEngine, script.sourceCode(), - script.location().filePath(), - script.location().line()); - if (Q_UNLIKELY(!JS_IsFunction(engine->context(), script.scriptFunction))) - throw ErrorInfo(Tr::tr("Invalid prepare script."), script.location()); - } JSValueList argv(args.cbegin(), args.cend()); + const JSValue function = script.getFunction(engine, Tr::tr("Invalid prepare script.")); const ScopedJsValue scriptValue( engine->context(), - JS_Call(engine->context(), script.scriptFunction, engine->globalObject(), - int(argv.size()), argv.data())); + JS_Call(engine->context(), function, engine->globalObject(), + int(argv.size()), argv.data())); propertiesRequestedInPrepareScript = engine->propertiesRequestedInScript(); propertiesRequestedFromArtifactInPrepareScript = engine->propertiesRequestedFromArtifact(); importedFilesUsedInPrepareScript = engine->importedFilesUsedInScript(); diff --git a/src/lib/corelib/language/language.cpp b/src/lib/corelib/language/language.cpp index 3c6fcf454..ecfe09d71 100644 --- a/src/lib/corelib/language/language.cpp +++ b/src/lib/corelib/language/language.cpp @@ -976,5 +976,21 @@ bool operator==(const ExportedModule &m1, const ExportedModule &m2) && depMapsEqual(m1.dependencyParameters, m2.dependencyParameters); } +JSValue PrivateScriptFunction::getFunction(ScriptEngine *engine, const QString &errorMessage) const +{ + if (JS_IsUndefined(scriptFunction)) { + ScopedJsValue val(engine->context(), + engine->evaluate(JsValueOwner::Caller, sourceCode(), + location().filePath(), location().line())); + if (Q_UNLIKELY(!JS_IsFunction(engine->context(), val))) + throw ErrorInfo(errorMessage, location()); + scriptFunction = val.release(); + engine->addExternallyCachedValue(&scriptFunction); + } else { + QBS_CHECK(JS_IsFunction(engine->context(), scriptFunction)); + } + return scriptFunction; +} + } // namespace Internal } // namespace qbs diff --git a/src/lib/corelib/language/language.h b/src/lib/corelib/language/language.h index d055aa132..a1115519d 100644 --- a/src/lib/corelib/language/language.h +++ b/src/lib/corelib/language/language.h @@ -70,15 +70,12 @@ #include #include -QT_BEGIN_NAMESPACE -class QScriptEngine; -QT_END_NAMESPACE - namespace qbs { namespace Internal { class BuildGraphLocker; class BuildGraphLoader; class BuildGraphVisitor; +class ScriptEngine; class FileTagger { @@ -335,8 +332,8 @@ class PrivateScriptFunction friend bool operator==(const PrivateScriptFunction &a, const PrivateScriptFunction &b); public: void initialize(const ScriptFunctionPtr &sharedData) { m_sharedData = sharedData; } - mutable JSValue scriptFunction = JS_UNDEFINED; // not stored + JSValue getFunction(ScriptEngine *engine, const QString &errorMessage) const; QString &sourceCode() const { return m_sharedData->sourceCode; } CodeLocation &location() const { return m_sharedData->location; } ResolvedFileContextConstPtr &fileContext() const { return m_sharedData->fileContext; } @@ -349,6 +346,7 @@ public: private: ScriptFunctionPtr m_sharedData; + mutable JSValue scriptFunction = JS_UNDEFINED; // not stored }; bool operator==(const PrivateScriptFunction &a, const PrivateScriptFunction &b); diff --git a/src/lib/corelib/language/scriptengine.cpp b/src/lib/corelib/language/scriptengine.cpp index 6be9de4d4..bd7394b16 100644 --- a/src/lib/corelib/language/scriptengine.cpp +++ b/src/lib/corelib/language/scriptengine.cpp @@ -185,6 +185,10 @@ ScriptEngine::~ScriptEngine() JS_FreeValue(m_context, ext); for (const JSValue &s : qAsConst(m_stringCache)) JS_FreeValue(m_context, s); + for (JSValue * const externalRef : std::as_const(m_externallyCachedValues)) { + JS_FreeValue(m_context, *externalRef); + *externalRef = JS_UNDEFINED; + } setPropertyOnGlobalObject(QLatin1String("console"), JS_UNDEFINED); JS_FreeContext(m_context); JS_FreeRuntime(m_jsRuntime); diff --git a/src/lib/corelib/language/scriptengine.h b/src/lib/corelib/language/scriptengine.h index c0a0948b7..d7798decf 100644 --- a/src/lib/corelib/language/scriptengine.h +++ b/src/lib/corelib/language/scriptengine.h @@ -164,6 +164,8 @@ public: void addImportRequestedInScript(quintptr importValueId); std::vector importedFilesUsedInScript() const; + void addExternallyCachedValue(JSValue *v) { m_externallyCachedValues.push_back(v); } + void setUsesIo() { m_usesIo = true; } void clearUsesIo() { m_usesIo = false; } bool usesIo() const { return m_usesIo; } @@ -381,6 +383,7 @@ private: QHash m_internalExtensions; QHash m_stringCache; QHash m_evalResults; + std::vector m_externallyCachedValues; QHash, JSValue> m_artifactsScriptValues; QVariantMap m_properties; std::recursive_mutex m_artifactsMutex; -- cgit v1.2.1 From 1a6cfb0af220926f8b00219c5dd7feb36bcaa0d2 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 2 Mar 2023 11:19:44 +0100 Subject: Qt/Android: Adapt to 6.4 androiddeployqt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-111558 Change-Id: I728c69635b3946db8a9019fa2fecf076d72d8468 Reviewed-by: Raphaƫl Cotty Reviewed-by: Ivan Komissarov --- changelogs/changes-2.0.0.md | 3 +++ share/qbs/module-providers/Qt/templates/android_support.qbs | 8 +++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/changelogs/changes-2.0.0.md b/changelogs/changes-2.0.0.md index 52bfada7c..93a37ae7f 100644 --- a/changelogs/changes-2.0.0.md +++ b/changelogs/changes-2.0.0.md @@ -3,6 +3,9 @@ * Removed the long-deprecated loadFile() and loadExtension() functions * Removed the qmake project files +# Qt support +* Adapt to androiddeployqt on Windows no longer accepting tool paths without suffix in 6.4 (QTBUG-111558) + # BareMetal support * Added support for HPPA architectures diff --git a/share/qbs/module-providers/Qt/templates/android_support.qbs b/share/qbs/module-providers/Qt/templates/android_support.qbs index 68276070f..66914d11b 100644 --- a/share/qbs/module-providers/Qt/templates/android_support.qbs +++ b/share/qbs/module-providers/Qt/templates/android_support.qbs @@ -220,9 +220,11 @@ Module { 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 + '",'); - f.writeLine('"rcc-binary": "' + product.Qt.android_support.rccFilePath + '",'); + 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 = []; -- cgit v1.2.1