aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenis Shienkov <denis.shienkov@gmail.com>2021-05-04 16:49:38 +0300
committerDenis Shienkov <denis.shienkov@gmail.com>2021-05-06 10:18:11 +0000
commit8b4ea1276558e65109982339d3ae65a143e2360d (patch)
treece18aa59d60a34f01b990673a19f55c56b0eac82
parent614e7381255bc48a494df45f09015c0ad9a7453f (diff)
Fix conditionally generation for some artifacts and tags
We need to generate a list of file tags and artifacts taking into account the dependent properties from the product. For example, we should only build tags for generating linker files if the generateLinkerMapFile property has been set. Change-Id: I286c566ffe119eebf24b60113dda65403f7af3dd Reviewed-by: Ivan Komissarov <ABBAPOH@gmail.com> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
-rw-r--r--share/qbs/modules/cpp/GenericGCC.qbs34
-rw-r--r--share/qbs/modules/cpp/iar.js38
-rw-r--r--share/qbs/modules/cpp/iar.qbs6
-rw-r--r--share/qbs/modules/cpp/keil.js38
-rw-r--r--share/qbs/modules/cpp/keil.qbs6
-rw-r--r--share/qbs/modules/cpp/sdcc.js101
-rw-r--r--share/qbs/modules/cpp/sdcc.qbs6
-rw-r--r--share/qbs/modules/cpp/windows-msvc-base.qbs11
8 files changed, 157 insertions, 83 deletions
diff --git a/share/qbs/modules/cpp/GenericGCC.qbs b/share/qbs/modules/cpp/GenericGCC.qbs
index 934636849..db45c8683 100644
--- a/share/qbs/modules/cpp/GenericGCC.qbs
+++ b/share/qbs/modules/cpp/GenericGCC.qbs
@@ -403,12 +403,14 @@ CppModule {
}
inputsFromDependencies: ["dynamiclibrary_symbols", "staticlibrary", "dynamiclibrary_import"]
- outputFileTags: [
- "bundle.input",
- "dynamiclibrary", "dynamiclibrary_symlink", "dynamiclibrary_symbols", "debuginfo_dll",
- "debuginfo_bundle","dynamiclibrary_import", "debuginfo_plist",
- "codesign.signed_artifact",
- ]
+ outputFileTags: {
+ var tags = ["bundle.input", "dynamiclibrary", "dynamiclibrary_symlink",
+ "dynamiclibrary_symbols", "debuginfo_dll", "debuginfo_bundle",
+ "dynamiclibrary_import", "debuginfo_plist"];
+ if (shouldSignArtifacts)
+ tags.push("codesign.signed_artifact");
+ return tags;
+ }
outputArtifacts: {
var artifacts = [{
filePath: product.destinationDirectory + "/"
@@ -519,8 +521,13 @@ CppModule {
}
inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
- outputFileTags: ["bundle.input", "loadablemodule", "debuginfo_loadablemodule",
- "debuginfo_bundle", "debuginfo_plist", "codesign.signed_artifact"]
+ outputFileTags: {
+ var tags = ["bundle.input", "loadablemodule", "debuginfo_loadablemodule",
+ "debuginfo_bundle", "debuginfo_plist"];
+ if (shouldSignArtifacts)
+ tags.push("codesign.signed_artifact");
+ return tags;
+ }
outputArtifacts: {
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
@@ -559,8 +566,15 @@ CppModule {
}
inputsFromDependencies: ["dynamiclibrary_symbols", "dynamiclibrary_import", "staticlibrary"]
- outputFileTags: ["bundle.input", "application", "debuginfo_app", "debuginfo_bundle",
- "debuginfo_plist", "mem_map", "codesign.signed_artifact"]
+ outputFileTags: {
+ var tags = ["bundle.input", "application", "debuginfo_app", "debuginfo_bundle",
+ "debuginfo_plist"];
+ if (shouldSignArtifacts)
+ tags.push("codesign.signed_artifact");
+ if (generateLinkerMapFile)
+ tags.push("mem_map");
+ return tags;
+ }
outputArtifacts: {
var app = {
filePath: FileInfo.joinPaths(product.destinationDirectory,
diff --git a/share/qbs/modules/cpp/iar.js b/share/qbs/modules/cpp/iar.js
index 416de7ee2..47158a209 100644
--- a/share/qbs/modules/cpp/iar.js
+++ b/share/qbs/modules/cpp/iar.js
@@ -612,6 +612,20 @@ function collectLibraryDependencies(product) {
return result;
}
+function compilerOutputTags(needsListingFiles) {
+ var tags = ["obj"];
+ if (needsListingFiles)
+ tags.push("lst");
+ return tags;
+}
+
+function applicationLinkerOutputTags(needsLinkerMapFile) {
+ var tags = ["application"];
+ if (needsLinkerMapFile)
+ tags.push("mem_map");
+ return tags;
+}
+
function compilerOutputArtifacts(input, isCompilerArtifacts) {
var artifacts = [];
artifacts.push({
@@ -636,19 +650,21 @@ function compilerOutputArtifacts(input, isCompilerArtifacts) {
}
function applicationLinkerOutputArtifacts(product) {
- var app = {
+ var artifacts = [{
fileTags: ["application"],
filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- PathTools.applicationFilePath(product))
- };
- var mem_map = {
- fileTags: ["mem_map"],
- filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- product.targetName + product.cpp.linkerMapSuffix)
- };
- return [app, mem_map]
+ product.destinationDirectory,
+ PathTools.applicationFilePath(product))
+ }];
+ if (product.cpp.generateLinkerMapFile) {
+ artifacts.push({
+ fileTags: ["mem_map"],
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ product.targetName + product.cpp.linkerMapSuffix)
+ });
+ }
+ return artifacts;
}
function staticLibraryLinkerOutputArtifacts(product) {
diff --git a/share/qbs/modules/cpp/iar.qbs b/share/qbs/modules/cpp/iar.qbs
index 9709695c1..eee750840 100644
--- a/share/qbs/modules/cpp/iar.qbs
+++ b/share/qbs/modules/cpp/iar.qbs
@@ -98,7 +98,7 @@ CppModule {
Rule {
id: assembler
inputs: ["asm"]
- outputFileTags: ["obj", "lst"]
+ outputFileTags: IAR.compilerOutputTags(generateAssemblerListingFiles)
outputArtifacts: IAR.compilerOutputArtifacts(input, false)
prepare: IAR.prepareAssembler.apply(IAR, arguments)
}
@@ -112,7 +112,7 @@ CppModule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
- outputFileTags: ["obj", "lst"]
+ outputFileTags: IAR.compilerOutputTags(generateCompilerListingFiles)
outputArtifacts: IAR.compilerOutputArtifacts(input, true)
prepare: IAR.prepareCompiler.apply(IAR, arguments)
}
@@ -122,7 +122,7 @@ CppModule {
multiplex: true
inputs: ["obj", "linkerscript"]
inputsFromDependencies: ["staticlibrary"]
- outputFileTags: ["application", "mem_map"]
+ outputFileTags: IAR.applicationLinkerOutputTags(generateLinkerMapFile)
outputArtifacts: IAR.applicationLinkerOutputArtifacts(product)
prepare: IAR.prepareLinker.apply(IAR, arguments)
}
diff --git a/share/qbs/modules/cpp/keil.js b/share/qbs/modules/cpp/keil.js
index 27e4e12d7..a36fe592c 100644
--- a/share/qbs/modules/cpp/keil.js
+++ b/share/qbs/modules/cpp/keil.js
@@ -582,6 +582,20 @@ function filterC166Output(output) {
return filteredLines.join('\n');
};
+function compilerOutputTags(needsListingFiles) {
+ var tags = ["obj"];
+ if (needsListingFiles)
+ tags.push("lst");
+ return tags;
+}
+
+function applicationLinkerOutputTags(needsLinkerMapFile) {
+ var tags = ["application"];
+ if (needsLinkerMapFile)
+ tags.push("mem_map");
+ return tags;
+}
+
function compilerOutputArtifacts(input, isCompilerArtifacts) {
var artifacts = [];
artifacts.push({
@@ -606,19 +620,21 @@ function compilerOutputArtifacts(input, isCompilerArtifacts) {
}
function applicationLinkerOutputArtifacts(product) {
- var app = {
+ var artifacts = [{
fileTags: ["application"],
filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- PathTools.applicationFilePath(product))
- };
- var mem_map = {
- fileTags: ["mem_map"],
- filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- product.targetName + product.cpp.linkerMapSuffix)
- };
- return [app, mem_map];
+ product.destinationDirectory,
+ PathTools.applicationFilePath(product))
+ }];
+ if (product.cpp.generateLinkerMapFile) {
+ artifacts.push({
+ fileTags: ["mem_map"],
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ product.targetName + product.cpp.linkerMapSuffix)
+ });
+ }
+ return artifacts;
}
function staticLibraryLinkerOutputArtifacts(product) {
diff --git a/share/qbs/modules/cpp/keil.qbs b/share/qbs/modules/cpp/keil.qbs
index ea99b589c..1d84f43d8 100644
--- a/share/qbs/modules/cpp/keil.qbs
+++ b/share/qbs/modules/cpp/keil.qbs
@@ -102,7 +102,7 @@ CppModule {
Rule {
id: assembler
inputs: ["asm"]
- outputFileTags: ["obj", "lst"]
+ outputFileTags: KEIL.compilerOutputTags(generateAssemblerListingFiles)
outputArtifacts: KEIL.compilerOutputArtifacts(input, false)
prepare: KEIL.prepareAssembler.apply(KEIL, arguments)
}
@@ -116,7 +116,7 @@ CppModule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
- outputFileTags: ["obj", "lst"]
+ outputFileTags: KEIL.compilerOutputTags(generateCompilerListingFiles)
outputArtifacts: KEIL.compilerOutputArtifacts(input, true)
prepare: KEIL.prepareCompiler.apply(KEIL, arguments)
}
@@ -126,7 +126,7 @@ CppModule {
multiplex: true
inputs: ["obj", "linkerscript"]
inputsFromDependencies: ["staticlibrary"]
- outputFileTags: ["application", "mem_map"]
+ outputFileTags: KEIL.applicationLinkerOutputTags(generateLinkerMapFile)
outputArtifacts: KEIL.applicationLinkerOutputArtifacts(product)
prepare: KEIL.prepareLinker.apply(KEIL, arguments)
}
diff --git a/share/qbs/modules/cpp/sdcc.js b/share/qbs/modules/cpp/sdcc.js
index 1904f59fc..022ab54b7 100644
--- a/share/qbs/modules/cpp/sdcc.js
+++ b/share/qbs/modules/cpp/sdcc.js
@@ -239,79 +239,100 @@ function collectLibraryDependencies(product) {
return result;
}
-function compilerOutputArtifacts(input, isCompilerArtifacts) {
- var obj = {
- fileTags: ["obj"],
- filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + input.cpp.objectSuffix
- };
+function compilerOutputTags(needsListingFiles) {
+ // We need to use the asm_adb, asm_src, asm_sym and rst_data
+ // artifacts without of any conditions. Because SDCC always generates
+ // it (and seems, this behavior can not be disabled for SDCC).
+
+ var tags = ["obj", "asm_adb", "asm_src", "asm_sym", "rst_data"]
+ if (needsListingFiles)
+ tags.push("lst");
+ return tags;
+}
+function applicationLinkerOutputTags(needsLinkerMapFile) {
+ // We need to use the lk_cmd, and mem_summary artifacts without
+ // of any conditions. Because SDCC always generates
+ // it (and seems, this behavior can not be disabled for SDCC).
+
+ var tags = ["application", "lk_cmd", "mem_summary"];
+ if (needsLinkerMapFile)
+ tags.push("mem_map");
+ return tags;
+}
+
+function compilerOutputArtifacts(input, isCompilerArtifacts) {
// We need to use the asm_adb, asm_src, asm_sym and rst_data
// artifacts without of any conditions. Because SDCC always generates
// it (and seems, this behavior can not be disabled for SDCC).
- var asm_adb = {
+
+ var artifacts = [{
+ fileTags: ["obj"],
+ filePath: Utilities.getHash(input.baseDir) + "/"
+ + input.fileName + input.cpp.objectSuffix
+ }, {
fileTags: ["asm_adb"],
filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + ".adb"
- };
- var asm_src = {
+ + input.fileName + ".adb"
+ }, {
fileTags: ["asm_src"],
filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + ".asm"
- };
- var asm_sym = {
+ + input.fileName + ".asm"
+ }, {
fileTags: ["asm_sym"],
filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + ".sym"
- };
- var rst_data = {
+ + input.fileName + ".sym"
+ }, {
fileTags: ["rst_data"],
filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + ".rst"
- };
- var artifacts = [obj, asm_adb, asm_src, asm_sym, rst_data];
+ + input.fileName + ".rst"
+ }];
if (isCompilerArtifacts && input.cpp.generateCompilerListingFiles) {
artifacts.push({
fileTags: ["lst"],
filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + input.cpp.compilerListingSuffix
+ + input.fileName + input.cpp.compilerListingSuffix
});
} else if (!isCompilerArtifacts && input.cpp.generateAssemblerListingFiles) {
artifacts.push({
fileTags: ["lst"],
filePath: Utilities.getHash(input.baseDir) + "/"
- + input.fileName + input.cpp.assemblerListingSuffix
+ + input.fileName + input.cpp.assemblerListingSuffix
});
}
return artifacts;
}
function applicationLinkerOutputArtifacts(product) {
- var app = {
+ // We need to use the lk_cmd, and mem_summary artifacts without
+ // of any conditions. Because SDCC always generates
+ // it (and seems, this behavior can not be disabled for SDCC).
+
+ var artifacts = [{
fileTags: ["application"],
filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- PathTools.applicationFilePath(product))
- };
- var lk_cmd = {
+ product.destinationDirectory,
+ PathTools.applicationFilePath(product))
+ }, {
fileTags: ["lk_cmd"],
filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- product.targetName + ".lk")
- };
- var mem_summary = {
+ product.destinationDirectory,
+ product.targetName + ".lk")
+ }, {
fileTags: ["mem_summary"],
filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- product.targetName + ".mem")
- };
- var mem_map = {
- fileTags: ["mem_map"],
- filePath: FileInfo.joinPaths(
- product.destinationDirectory,
- product.targetName + product.cpp.linkerMapSuffix)
- };
- return [app, lk_cmd, mem_summary, mem_map]
+ product.destinationDirectory,
+ product.targetName + ".mem")
+ }];
+ if (product.cpp.generateLinkerMapFile) {
+ artifacts.push({
+ fileTags: ["mem_map"],
+ filePath: FileInfo.joinPaths(
+ product.destinationDirectory,
+ product.targetName + product.cpp.linkerMapSuffix)
+ });
+ }
+ return artifacts;
}
function staticLibraryLinkerOutputArtifacts(product) {
diff --git a/share/qbs/modules/cpp/sdcc.qbs b/share/qbs/modules/cpp/sdcc.qbs
index c5a0893d4..4e68c8c24 100644
--- a/share/qbs/modules/cpp/sdcc.qbs
+++ b/share/qbs/modules/cpp/sdcc.qbs
@@ -99,7 +99,7 @@ CppModule {
Rule {
id: assembler
inputs: ["asm"]
- outputFileTags: ["obj", "asm_adb", "lst", "asm_src", "asm_sym", "rst_data"]
+ outputFileTags: SDCC.compilerOutputTags(generateAssemblerListingFiles)
outputArtifacts: SDCC.compilerOutputArtifacts(input, false)
prepare: SDCC.prepareAssembler.apply(SDCC, arguments)
}
@@ -113,7 +113,7 @@ CppModule {
id: compiler
inputs: ["cpp", "c"]
auxiliaryInputs: ["hpp"]
- outputFileTags: ["obj", "asm_adb", "lst", "asm_src", "asm_sym", "rst_data"]
+ outputFileTags: SDCC.compilerOutputTags(generateCompilerListingFiles)
outputArtifacts: SDCC.compilerOutputArtifacts(input, true)
prepare: SDCC.prepareCompiler.apply(SDCC, arguments)
}
@@ -123,7 +123,7 @@ CppModule {
multiplex: true
inputs: ["obj", "linkerscript"]
inputsFromDependencies: ["staticlibrary"]
- outputFileTags: ["application", "lk_cmd", "mem_summary", "mem_map"]
+ outputFileTags: SDCC.applicationLinkerOutputTags(generateLinkerMapFile)
outputArtifacts: SDCC.applicationLinkerOutputArtifacts(product)
prepare: SDCC.prepareLinker.apply(SDCC, arguments)
}
diff --git a/share/qbs/modules/cpp/windows-msvc-base.qbs b/share/qbs/modules/cpp/windows-msvc-base.qbs
index c45ec5ec3..10093f144 100644
--- a/share/qbs/modules/cpp/windows-msvc-base.qbs
+++ b/share/qbs/modules/cpp/windows-msvc-base.qbs
@@ -155,7 +155,12 @@ CppModule {
auxiliaryInputs: ["hpp"]
explicitlyDependsOn: ["c_pch", "cpp_pch"]
- outputFileTags: ["obj", "intermediate_obj", "lst"]
+ outputFileTags: {
+ var tags = ["obj", "intermediate_obj"];
+ if (generateCompilerListingFiles)
+ tags.push("lst");
+ return tags;
+ }
outputArtifacts: {
var tags = input.fileTags.contains("cpp_intermediate_object")
? ["intermediate_obj"]
@@ -197,7 +202,9 @@ CppModule {
inputsFromDependencies: ['staticlibrary', 'dynamiclibrary_import', "debuginfo_app"]
outputFileTags: {
- var tags = ["application", "debuginfo_app", "mem_map"];
+ var tags = ["application", "debuginfo_app"];
+ if (generateLinkerMapFile)
+ tags.push("mem_map");
if (shouldSignArtifacts)
tags.push("codesign.signed_artifact");
return tags;