Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tracker.hostOS = product.moduleProperty("qbs", "hostOS");
tracker.shellPath = product.moduleProperty("qbs", "shellPath");
tracker.command = ModUtils.moduleProperty(product, "actoolPath");
tracker.commandArgsFunction = function (outputDirectory) {
// Last --output-format argument overrides any previous ones
return ibtooldArguments(product, inputs, undefined,
undefined, outputDirectory).concat(["--output-format", "xml1"]);
};
tracker.processStdOutFunction = parseActoolOutput;
var artifacts = tracker.artifacts(product.buildDirectory + "/actool.dir");
// Newer versions of actool don't generate *anything* if there's no input;
// in that case a partial Info.plist would not have been generated either
if (artifacts && artifacts.length > 0) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
"assetcatalog_generated_info.plist"),
fileTags: ["partial_infoplist"]
});
}
for (var i = 0; i < artifacts.length; ++i) {
if (artifacts[i].fileTags.contains("compiled_assetcatalog")) {
artifacts[i].bundle = {
_bundleFilePath: artifacts[i].filePath.replace(
product.buildDirectory + "/actool.dir",
BundleTools.destinationDirectoryForResource(product, inputs.assetcatalog[0]))
};
}
}
return artifacts;
checkValuePrefix(prop.name, value, project.buildDirectory, "project build directory");
checkValuePrefix(prop.name, value, project.sourceDirectory, "project source directory");
}
// Adapt file paths pointing into the install dir, that is, make them relative to the
// module file for relocatability. We accept them with or without the install root.
// The latter form will typically be a result of applying the prefixMapping property,
// while the first one could be an untransformed path, for instance if the project
// file is written in such a way that include paths are picked up from the installed
// location rather than the source directory.
var valuePrefixToStrip;
var fullInstallPrefix = FileInfo.joinPaths(product.qbs.installRoot, product.qbs.installPrefix);
if (fullInstallPrefix.length > 1 && value.startsWith(fullInstallPrefix)) {
valuePrefixToStrip = fullInstallPrefix;
} else {
var installPrefix = FileInfo.joinPaths("/", product.qbs.installPrefix);
if (installPrefix.length > 1 && value.startsWith(installPrefix))
valuePrefixToStrip = installPrefix;
}
if (valuePrefixToStrip) {
var deployedModuleInstallDir = moduleInstallDir.slice(fullInstallPrefix.length);
return "FileInfo.cleanPath(FileInfo.joinPaths(path, FileInfo.relativePath("
+ JSON.stringify(deployedModuleInstallDir) + ", "
+ JSON.stringify(value.slice(valuePrefixToStrip.length) || "/") + ")))";
}
return JSON.stringify(value);
}
// Catch user oversights: Paths that point into the project source or build directories
// make no sense in the module.
if (!value.startsWith(product.qbs.installRoot)) {
checkValuePrefix(prop.name, value, project.buildDirectory, "project build directory");
checkValuePrefix(prop.name, value, project.sourceDirectory, "project source directory");
}
// Adapt file paths pointing into the install dir, that is, make them relative to the
// module file for relocatability. We accept them with or without the install root.
// The latter form will typically be a result of applying the prefixMapping property,
// while the first one could be an untransformed path, for instance if the project
// file is written in such a way that include paths are picked up from the installed
// location rather than the source directory.
var valuePrefixToStrip;
var fullInstallPrefix = FileInfo.joinPaths(product.qbs.installRoot, product.qbs.installPrefix);
if (fullInstallPrefix.length > 1 && value.startsWith(fullInstallPrefix)) {
valuePrefixToStrip = fullInstallPrefix;
} else {
var installPrefix = FileInfo.joinPaths("/", product.qbs.installPrefix);
if (installPrefix.length > 1 && value.startsWith(installPrefix))
valuePrefixToStrip = installPrefix;
}
if (valuePrefixToStrip) {
var deployedModuleInstallDir = moduleInstallDir.slice(fullInstallPrefix.length);
return "FileInfo.cleanPath(FileInfo.joinPaths(path, FileInfo.relativePath("
+ JSON.stringify(deployedModuleInstallDir) + ", "
+ JSON.stringify(value.slice(valuePrefixToStrip.length) || "/") + ")))";
}
return JSON.stringify(value);
}
function getGTestDir(qbs, str) {
if (!str) {
if (qbs.hostOS.contains("linux") && File.exists("/usr/src/gtest"))
return "/usr/src/gtest";
} else {
return FileInfo.joinPaths(str, "googletest");
}
return "";
}
function applicationLinkerOutputArtifacts(product) {
var app = {
fileTags: ["application"],
filePath: FileInfo.joinPaths(
product.destinationDirectory,
PathTools.applicationFilePath(product))
};
var mem_map = {
fileTags: ["mem_map"],
filePath: FileInfo.joinPaths(
product.destinationDirectory,
product.targetName + ".map")
};
return [app, mem_map]
}
function tiffutilOutputFilePath(product, basePath) {
return FileInfo.joinPaths(product.destinationDirectory,
"hidpi-images",
FileInfo.relativePath(product.sourceDirectory, basePath) +
product.ib.tiffSuffix);
}
return helperFullyQualifiedNames("class").map(function (name) {
return {
filePath: FileInfo.joinPaths(ModUtils.moduleProperty(product, "internalClassFilesDir"),
name + ".class"),
fileTags: ["java.class-internal"]
};
});
}
function debugInfoFilePath(product, variantSuffix, fileTag) {
var name = debugInfoFileName(product, variantSuffix, fileTag);
if (product.moduleProperty("qbs", "targetOS").contains("darwin") && debugInfoIsBundle(product)) {
return FileInfo.joinPaths(debugInfoBundlePath(product, fileTag),
"Contents", "Resources", "DWARF", name);
} else if (product.moduleProperty("bundle", "isBundle")) {
return FileInfo.joinPaths(product.moduleProperty("bundle", "executableFolderPath"), name);
}
return name;
}
function applicationLinkerOutputArtifacts(product) {
var app = {
fileTags: ["application"],
filePath: FileInfo.joinPaths(
product.destinationDirectory,
PathTools.applicationFilePath(product))
};
var mem_map = {
fileTags: ["mem_map"],
filePath: FileInfo.joinPaths(
product.destinationDirectory,
product.targetName + ".map")
};
return [app, mem_map]
}
variants = variants || [{}];
var artifacts = [];
if (product.cpp.separateDebugInformation) {
variants.map(function (variant) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.debugInfoFilePath(product,
variant.suffix,
fileTag)),
fileTags: ["debuginfo_" + debugInfoTagSuffix]
});
});
if (PathTools.debugInfoIsBundle(product)) {
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.debugInfoBundlePath(product, fileTag)),
fileTags: ["debuginfo_bundle"]
});
artifacts.push({
filePath: FileInfo.joinPaths(product.destinationDirectory,
PathTools.debugInfoPlistFilePath(product, fileTag)),
fileTags: ["debuginfo_plist"]
});
}
}
return artifacts;
}